Setting ipopt tolerance when using SolverFactory()

827 views
Skip to first unread message

Bodhi Biswas

unread,
Mar 7, 2016, 11:56:50 PM3/7/16
to Pyomo Forum
Hello,

I'm new to Pyomo, so this may be a basic question! 
I am attempting (without success) to slacken the tolerance of the ipopt algorithm from the default 1e-08, to 1e-03.

Here the snippet I am using within my python script:

#------------------------------------------
solver='ipopt'
opt=SolverFactory(solver)
opt.tol = 1e-3        #Is this right???
results = opt.solve(disc_instance, tee=True)
#------------------------------------------


The solver keeps iterating despite meeting the new tolerance requirement.  I must not be using the correct syntax for specifying the tolerance requirement.

Any suggestions?
Thanks

Gabriel Hackebeil

unread,
Mar 8, 2016, 12:06:34 AM3/8/16
to pyomo...@googlegroups.com
You are close.

Solver options can be set in a number of ways. If you plan to use a solver plugin more than once and you want the options to persist, you can update the options dictionary directly on the solver plugin.

opt = SolverFactory(‘ipopt’)
opt.options[‘tol’] = 1e-3
results = opt.solve(instance)

If you want options that only last for a single solve invocation, you can pass them into the solve method via a dictionary with the options keyword.

opt = SolverFactory(‘ipopt’)
# use tol
results = opt.solve(instance, options={‘tol’: 1e-3})
# do not use tol
results = opt.solve(instance)

Gabe

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages