[Ipopt] cyipopt - New python interface to Ipopt written in Cython
Herb Schilling
HSchilling at nasa.gov
Wed Sep 28 10:07:38 EDT 2011
Hello Amit,
On Sep 27, 2011, at 4:27 PM, Amit Aides wrote:
> Hello,
>
> I have written a new python wrapper for Ipopt. It is called cyipopt and
> can be downloaded from:
> http://code.google.com/p/cyipopt/
>
> It is similar to pyipopt. Likewise it makes use of the Ipopt C
> interface. But it uses a different calling convention, more similar to
> the Matlab interface. I include two examples under the folder 'test'.
> One is the classic hs071 problem and the other one is a translation of
> the lasso example from the Matlab interface. The matplotlib package is
> needed for running the lasso example.
>
> Another difference is that it is written using Cython, which makes it
> much easier to develop and maintain. It also enables the implementation
> of some convenience features, e.g. if no jacobian/hessian structure
> callbacks are defined than the jacobian/hessian are assumed to be dense.
> Other convenience examples are:
> 1) It figures out the number of non zero values by calling the structure
> callbacks.
> 2) Missing boundaries (on the optimization variables and constraints)
> are set to infinity.
> It is also possible to add support for scipy.sparse matrices if needed.
>
> I have tested cyipopt on Win 7 32/64 bit. I will be happy to know if
> someone is able to use it on linux machines.
Thanks for writing this and sharing it with the mailing list.
I tried it on Red Hat Linux and :
1. I had to edit the setup.py file to make the installation work. Here are the parts I had to change. Some of this is specific to my computer, obviously! The one thing I would recommend is that you use forward slashes for path delimiters. From http://docs.python.org/distutils/setupscript.html
Note that any pathnames (files or directories) supplied in the setup script should be written using the Unix convention, i.e. slash-separated. The Distutils will take care of converting this platform-neutral representation into whatever is appropriate on your current platform before actually using the pathname. This makes your setup script portable across operating systems, which of course is one of the major goals of the Distutils. In
PACKAGE_NAME = 'ipopt'
IPOPT_ICLUDE_DIR=r'/home/hschilli/local/include/coin'
IPOPT_LIB='ipopt'
IPOPT_LIB_DIR=r'/home/hschilli/local/lib/coin'
IPOPT_DLL='libipopt.so'
ext_modules = [
Extension(
PACKAGE_NAME + '.' + 'cyipopt',
[r'src/cyipopt.pyx'],
include_dirs=[IPOPT_ICLUDE_DIR, np.get_include()],
libraries=[IPOPT_LIB,'coinhsl','coinlapack','coinblas','coinmumps','coinmetis'],
library_dirs=[IPOPT_LIB_DIR,'/home/hschilli/local/lib/coin/ThirdParty']
)
],
2. The lasso example worked fine. But the other example generated this output. I haven't had time to look into what the problem is there.
(devenv)[659]cyipopt(dev) > python test/examplehs071.py
******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************
This is Ipopt version 3.9.2, running with linear solver ma27.
Exception ValueError: 'The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()' in 'ipopt.cyipopt.jacobian_cb' ignored
Exception of type: ERROR_IN_TNLP_DERIVATIVE_TEST in file "IpTNLPAdapter.cpp" at line 2526:
Exception message: retval evaluated false: In TNLP derivative test: Jacobian structure could not be evaluated.
EXIT: Some uncaught Ipopt exception encountered.
Solution of the primal variables: x=array([ 1., 5., 5., 1.])
Solution of the dual variables: lambda=array([ 0., 0.])
Objective=0.0
>
> I will appreciate any feedback: bugs, feature requests etc.
>
> Thank you,
> Amit Aides
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
-----------------------
Herb Schilling
hschilling at nasa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20110928/dc0ea91d/attachment.html>
More information about the Ipopt
mailing list