-def optimize(dimension, boundary, function_d, n_nest, n_turns):
- space = Space(dimension, boundary, function_d, n_nest)
- for _ in xrange(n_turns):
- next_turn(space)
- return space.best
+def optimize(dimension, boundary, function_d, n_nest, n_turns, reset=1):
+ best_list = []
+ for i in xrange(reset):
+ space = Space(dimension, boundary, function_d, n_nest)
+ for _ in xrange(n_turns / reset):
+ next_turn(space)
+ best_list.append((space.best_value, space.best))
+ # print space.best_value
+
+ return max(best_list)[1]