Free Python optimization framework

Thursday, January 31, 2008

About prob structure redefinition

I have noticed 2 lines of code sent by an openopt user:

#unfortunately, as openopt is now, this needs to be defined again
#each time it is solved
It is followed by function for prob redefinition:
def setupF2dProblem(init_point, maxIterates):
...
return prob

Let me explain the situation once again. Maybe, you have already noticed the error messages when trying to use prob instance one more time: r=p.solve(...). This problem is due to Python issue 1515: deepcopy doesn't copy instance methods (url)
prob instance contains lots of function handlers, referring to each other, and while running p.solve(...) they seriously changes to other values, and some new fields (function handlers, flags True/False, some new values - Python lists, arrays etc) appear. It's impossible for me to remove all the changes done and successfully keep cleaning the prob instance of all that stuff after solving finish. It may cause inpredictable bugs, appearing once time-to-time, and hunting for this kind is very difficult.
So I decided to wait until Python developers will fix the bug. They informed me of the url for issue 1515 during Python bug day, when I have committed the bugreport (some weeks later pastebin.com will remove the code). So, they recommended me temporary solution - to add the line
d[types.MethodType] = _deepcopy_atomic
to copy.py file (like it's mentioned in the url provided), but modifying Python core sources is inappropriate solution for the case - I can't demand the one from each OO user (moreover, not all of them has write access to Python core files). I haven't tried it by myself as well, so I don't know does it helps or no.
So, it would be nice to increase the bug severity from "normal" (as it is assigned for now) to something bigger, maybe Python developers would increase their efforts to fix the one. Let me also attach in comment the bugreport, since it will disappear soon from pastebin.com.

Tuesday, January 29, 2008

New OO class: GLP (global problem)

New OO class have been created: GLP (global problem)
Currently single GLP solver is "galileo" (by Donald Goodman, alg: Genetic Algorithm; license: GPL)
I have included galileo code to OO. For now it can solve only continuous problems with finite box-bounds. I intend to add handling all-discrete problems as well (AFAIK this solver can't handle mixed discrete-continuous).

For GLP default p.plotOnlyCurrentMinimum = True, while for all other classes default value is False.
Currently stop criteria for GLP are maxIter, maxFunEvals, maxTime, maxCPUTime, fEnough. AFAIK xtol and ftol are inappropriate stop criteria for GLP class. I intend to add something like maxNonSuccess = 15 (number of iterations when better value haven't been obtained).
Here's graphical output for the example.

Monday, January 28, 2008

SAGE online Calc: very convenient

Today I have created account (available for free) for SAGE Notebook (online calculator) and found the one very convenient. Here's snapshot from Mozilla browser:

Some major changes to ralg

Some major changes to ralg have been made. Almost all tests works better now.
Also, since now ralg will take into account do you define problem as NLP or NSP (and hence behaviour and trajectory will be different).

Thursday, January 24, 2008

bugfix related to "ratAll undefined"

some days ago I forget to commit some changes to svn
if you had encountered "ratAll undefined" update svn (or try using updated openopt.tar.gz file)

Monday, January 21, 2008

some more changes to ralg

some more changes to enhance solution precision.

Some changes in ralg

Some changes have been committed to NLP/NSP solver ralg (first of all to improve solution precision). They are similar to Fortran ralg version, however, equality constraints handling of the latter is still better than Python one.