Home /
Expert Answers /
Computer Science /
this-is-random-restart-of-hill-climbing-search-algorithm-using-local-search-in-python-having-trouble-pa124
(Solved): This is random Restart of Hill Climbing Search algorithm using local search in python having trouble ...
This is random Restart of Hill Climbing Search algorithm using local search in python having trouble of understanding it
[26] \# TODO: Improvement to the Hill-climbing search algorithm using random restarts \# objective function: function to be maximized \# lower_bounds: minimum allowable values for the input vector to the objective function # upper_bounds: maximum allowable values for the input vector to the objective function \# step_size: numerical interval by which to change the current (x,y) state to generate a new neighboring state # num_restarts: how many times to restart hill-climbing \# returns: best [ x,y ] solution found def random_restart_hill_climbing(objective_function, lower_bounds, upper_bounds, step_size = 0.01, num_restarts=10): return random_restart_solution = random_restart_hill_climbing(objective_function, lower_bounds, upper_bounds) print('Random restart hill climbing solution is: random_restart_solution)