Richard
Richard

Reputation: 61429

Pyomo: Limit number of iterations

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?

Upvotes: 2

Views: 2939

Answers (1)

johannesmik
johannesmik

Reputation: 751

Does this work?

solver  = SolverFactory('ipopt')
solver.options['max_iter'] = 10
results = solver.solve(model,tee=False)

Upvotes: 6

Related Questions