Free Python optimization framework

Thursday, June 12, 2008

Connecting IPOPT, Part 3

I have wrote automatic generation of ipopt.opt file. That one is read from current directory; to omit creating of the one (and hence all-defaults or using ipopt.opt file from current directory) use
r = p.solve('ipopt', optFile = False)
(default value for optFile is "auto", also, I intend to provide possibility for loading the file from given location, like
optFile = "\\home\\dmitrey\\myipoptsettings.opt"
).

Currently it consists of 3 lines:
print_level -2 (to suppress annoying huge text output)
tol (p.ftol is put here)
constr_viol_tol (p.contol is put here)


I found it too long and complicated to implement all those parameters with their default values (and hence duplicate ipopt code) that are can be changed by IPOPT developers from time to time (and it's hard to monitor), so to add other fields from ipopt.opt file specification you should use "options" as string (comma and semicolon delimiters can be used here, and space or "=" can be delimiters for option name and value), not as Python *args or **kwargs.

Example:

r = p.solve('ipopt', options = 'dual_inf_tol=1.005; compl_inf_tol 1.005e-4, alpha_for_y dual-and-full')

Let me also remember you that running ipopt from OO requires pyipopt installation, and currently pyipopt is Linux-only. Also, some days ago pyipopt bug related to fail on problems w/o non-linear constraints has been fixed.

No comments: