Free Python optimization framework

Friday, June 6, 2008

Unified text output

I have turned NLP/NSP/GLP solvers to show unified text output. That one can be edited by user (I'll publish detailed description in OO Doc page ASAP).

Now it's like this for constrained problems:

iter objFunVal log10(maxResidual)
0 6.115e+01 2.13
10 2.360e+01 0.72
20 1.754e+01 0.38
..........
1290 2.015e+01 -6.23

and like this for unconstrained (or those problem-solver pairs which always have feasible iter points, for example some box-bounded problems and solvers):

iter objFunVal
0 -2.825e+06
10 -7.106e+05
...
1570 -4.787e-03

Maximization problems

I have committed some changes, they allows handling of maximization problems

objFunc -> max
(subjected to some constraints)

via p.goal = 'max'
(or 'maximum')

Currently LP, MILP, QP classes have no the possibility, it's only valid for NLP, NSP, GLP

of course, the parameter goal could be used in prob assignment or solve function as well:
p = NLP(..., goal='max')
or
r = p.solve(solverName, ... (other parameters), goal='max')
here's graphical output from modified nlp3.py (using -f instead of f, already in subversion).

Tuesday, June 3, 2008

Connecting IPOPT, Part 2

I intend to have OpenOpt<->IPOPT bridge (via Eric's pyipopt) till next OO release.

However, currently it works for Linux only (and I'm certainly not the one who could try to make it cross-platform) and requires hand-turn of makefile, first of all related to paths (python and numpy directories); also, probably you'll have to add -llapack (provided lapack-dev installation, if you have message "undefined symbol @dswap_") and -lgfortran (if you have "/usr/lib/libipopt.so.0: undefined symbol: _gfortran_concat_string", mb it requires gfortran installation, if you haven't the one installed). For more details see comments here (somehow they are not mentioned in Eric's README file).

So after the issues I have IPOPT working for me. Here's picture below. This one referrs to nlp_bench2.py (from /examples) with modified h3: instead of
(x[-5]+x[-6]-2*M+1.5)**6=0
I have taken
(x[-5]+x[-6]-2*M+1.5)**2=0
(because, as I have noticed, IPOPT handles the constraint so badly that I thought I have bug(s) in IPOPT connection, and hunting for those ones took a long time for me, because that constraint is present in my other NLP tests involved). And (despite IPOPT work probably can be somehow enhances via ipopt.opt file options modification) this is another one proof that having several solvers (like OO provides) is always better than having a single one, even so famous as IPOPT, isn't it?

Sunday, May 18, 2008

major changes for non-linear constraints

After some code cleanup (still there is some more to be done) I have committed some changes for non-linear constraints handling. If your constraints are split, for example
p.c = [c1, c2, c3],
or
p.h = [h1, h2]

some solvers can take benefits (ralg for c and h, ALGENCAN for c; others available for now in OO cannot).

They will take less evaluations for these non-linear constraints.

Thursday, May 8, 2008

blas and lapack issues with CVXOPT installation

As I have made conclusion from my own experience with CVXOPT installation (from source, i.e. tarball), as well as from some user comments, CVXOPT sometimes cannot find lapack and blas, despite they are present.

I noticed that it searches for llapack and lblas, and despite I have libblas.so.3 and liblapack.so.3 (installed in my KUBUNTU 8.04, to /usr/lib, via aptitude) it doesn't work. So I had copied libblas.so.3 and liblapack.so.3 into files libblas.so and liblapack.so (same directory /usr/lib) and now all works ok (mb creating soft links would be enough?).

I hope CVXOPT developers will take it into account, mb this problem happens with some other OSes as well.

P.S. If you intend to use OO<->CVXOPT<->glpk connection don't forget to set BUILD_GLPK=1 in CVXOPT setup.py file. glpk should be already installed.

Wednesday, May 7, 2008

Some code cleanup

I have started some code cleanup (mentioned in OO timeline), some changes have been already committed and some more will be done from time to time, so current OO taken from svn or latest tarball can work unstably (of course, I have checked my tests before code commit, but some other may fail).

Thursday, May 1, 2008

Python Wins "Favorite Scripting Language" Award

(The information has been taken from PSF blog)
--------------------------------------------------------------------------------------
Python Wins "Favorite Scripting Language" Award.

May 1, 2008 Linux Journal announced their 2008 Readers' Choice Awards today, and we are happy to say that Python won the Favorite Scripting Language category with 28.9% of the vote. PHP, Bash and Perl (in that order) won honorable mentions. Thanks to everyone who took the time to register their votes. Python's popularity does seem to be climbing this year, as attendance at the recent Chicago PyCon confirmed with a 77% increase in attendance. Let's hope that leads to career opportunities for Python users!

--------------------------------------------------------------------------------------
Favorite Scripting Language:
  • Python (28.9%)

Honorable Mentions

  • PHP (21.7%)
  • bash (19.8%)
  • Perl (17%)