FAQ
From OpenOpt
How to turn text output (all those "starting solver ...", "time elapsed ...", etc) off?
- Use iprint = 0 (final output only) or iprint < 0 (btw it's mentioned in NLP docstring). In future warnings are intended to be shown if iprint >= -1. However, some solvers like ALGENCAN have their own text output system, that's hard to suppress, it requires using different approach like, for example, the one.
Does it have MATLAB fmincon equivalent?
- Yes, you should take a look at the solvers from NLP
How to handle maximization problems?
- Use p.goal = 'max' or 'maximum' (since v 0.27 you can also use r = p.maximize(...)). However, this is valid only for some problem types (NLP, NSP, some other).
== Can I try ralg or other nonlinear solvers with AMPL models?
- If you have AMPL and nlpy installed, you can use its module amplpy to get objective and constraints values and derivatives. However, currently OpenOpt-connected solvers can't handle 2nd derivatives info (w/o some tricks).
How can I handle fixed variables?
- Some mature solvers like ALGENCAN, IPOPT can handle it rather effectively by themselves
- Currently for ralg and some others only FuncDesigner can provide effective handling (neither lb<=x<=ub nor Aeq x = beq constraints can't do it so effectively).
I have same parts of code involved in objective function and/or nonlinear constraints and/or their derivatives. Can I somehow avoid same calculations?
- You can do it very effectively if your model is coded in FuncDesigner.
Does this have any parallel computation code?
- NLP solver IPOPT uses MUMPS that can be turned (during installation) to use several CPU
- GLP solver pswarm can handle several CPU (via MPI) but I'm not sure it's relevant to his Python API
- There are some efforts of parallel numpy, such as this one or commercial StarP.
- There are some efforts in latest numpy versions, provided they have been built with correct flags for parallel BLAS and LAPACK (via ATLAS or somehow else); particularly, it will run numpy.dot (that is intensively used in OpenOpt Kernel and some solvers - ralg, some scipy NLP solvers) on several CPU, some other matrix operations (multiplication, devision etc can also gain sufficient speedup).
- MATLAB OpenOpt (that is no longer supported) can calculate 1st derivative df numerically via parallel cycle by parfor. However, it can benefit for costly funcs only. I intended to implement something like that in Python, but I don't know which library is better, and those that I had seen have (as for me) inconvenient syntax & complicated documentation. If someone is familiar with a Python library for parallel calculation, he could easily use it to calculate df, dc, dh numerically: (func(x+dx[i])-func(x)/dx). Parallel computation is intended to be provided in future.
Why sometimes some r.evals fields are non-integer, like r.evals['c'] = 150.5?
- Some solvers (ralg, algencan) in some points along trajectory call derivatives for only several non-linear constraints (those that are active, i.e. more than zero or contol, or moreover, only maximum violated constraint). So the number is sum of (number of required constraints to be calculated)/(number of all constraints of the type(eq or ineq)). So, if you have a function that calculates all constraints together and that one is costly, non-integer value means the solver could take some benefits would you divide those ones into separate funcs (see also NLP, constrained solvers last column).
- Let me also note that using FuncDesigner provides much more precise evaluations number control, each oofun has counters "evals" (how many times the func has been called with new input) and "same" (how many times previous value has been substituted, because oofun has been called with same input, for example from f and df, or from f and c). So you can observe my_oofun.evals and my_oofun.same fields.
Are there any plans for providing 2nd derivatives in FuncDesigner?
- It will be hardly done, at least in nearest future.
Have you willing to collaborate with our project(s)?
- Send more info, we will take a look.
(to be continued)


