Increasing the max iteration over 10,000 in gekko

Viewed 40

I am optimizing a large MINLP with sometimes as high as (30 * 30) binary variables. I have no time constrain and wish to get the best answer the solver can come up with.

But the solver terminates before a solution is reached claiming the max_interations have been reached. How to set max_iterations over 10,000.

Also if the max_iterations have been reached , how can I extract the best solution that has been discovered till now ?

Thanks in advance. Also Prof John D.Hedengren thanks for the previous answer

1 Answers

Try setting the solver option for minlp_maximum_iterations to a high number such as 50000. Set the minlp_gap_tol to a lower number such as 1.0e-4 to continue iterating until the iteration count or gap tolerance is reached. If the solver reaches the maximum iterations (50000), an error is returned and the solution should not be used.

m.solver_options = ['minlp_gap_tol 1.0e-4',\
                    'minlp_maximum_iterations 50000',\
                    'minlp_max_iter_with_int_sol 40000']

The minlp_max_iter_with_int_sol limits the number of iterations and returns the best integer solution after the first integer solution is found. As long at an integer solution is found within the first 10000 iterations, Gekko returns the best integer solution. There are additional solver options that may help such as minlp_branch_method.

Related