Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyomo: Limit number of iterations

Tags:

python

pyomo

I have a Pyomo model that eventually gets solved like so:

solver  = SolverFactory('ipopt')
results = solver.solve(model,tee=False)

The model current runs for 3000 iterations before giving up.

In my mind, there must be a way to use one of these two lines to limit the number of iterations. How can I do that?

like image 841
Richard Avatar asked Jan 23 '26 14:01

Richard


1 Answers

Does this work?

solver  = SolverFactory('ipopt')
solver.options['max_iter'] = 10
results = solver.solve(model,tee=False)
like image 153
johannesmik Avatar answered Jan 25 '26 03:01

johannesmik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!