[SciPy-user] [OpenOpt] problem with ralg (latest SVN)

Emanuele Olivetti emanuele@relativita....
Sun Sep 7 02:47:40 CDT 2008


Thanks Dmitrey,

I've just tried to update, install and test latest OpenOpt (SVN)
and it seems to work well with numpy 1.0.3 + scipy 0.5.2 shipped
with ubuntu 7.10 (or better, now nlp_1.py runs some
iterations and then the Python process gives "segmentation fault",
but this is a known Python/NumPy issue as far as I remember).
Anyway doesn't stop anymore. Thanks for the fix.

About your suggstion to use other solvers than ralg, I've
some good preliminary experience with scipy_lbfgsb; even
scipy_tnc seems to work well but requires a too recent scipy.
This is what happens with scipy 0.5.2 bundled with ubuntu 7.10
when calling scipy_tnc:
---
result = self.problem.solve(self.optimization_algorithm) # perform
optimization!
  File
"/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/BaseProblem.py",
line 185, in solve
    return runProbSolver(self, solvers, *args, **kwargs)
  File
"/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/runProbSolver.py",
line 167, in runProbSolver
    solver(p)
  File
"/usr/lib/python2.5/site-packages/scikits/openopt/solvers/scipy_optim/scipy_tnc_oo.py",
line 38, in __solver__
    xf, nfeval, rc = fmin_tnc(p.f, x0 = p.x0, fprime=p.df, args=(),
approx_grad=0, bounds=bounds, messages=messages, maxfun=maxfun,
ftol=p.ftol, xtol=p.xtol, pgtol=p.gradtol)
TypeError: fmin_tnc() got an unexpected keyword argument 'xtol'
----
About algencan, I hanven't tried yet and I'm really interested. It is
just my lack of time and the external dependencies that slow down
my attempt. Anyway I've added optional logscale to my code, which
is similar to setting the lower bound I need:
problem.lb = N.zeros(problem.n) + contol

Best,

Emanuele


dmitrey wrote:
> Hi Emanuele,
> update svn and try now,
> HTH, D.
>
> P.S. IIRC you are deal with box-bounded problems, let me remember you 
> once again, that ralg (especially current implementation) handles it 
> very badly (especially when lots of active constraints in optim point) 
> in comparison to scipy_lbfgsb, scipy_tnc or algencan (all are available 
> from oo, requires scipy or algencan installed), these ones have very 
> appropriate specialized box-bound solvers.
> Regards, D
>
> Emanuele Olivetti wrote:
>   
>> OK. Running another custom example I got again the initial "ralg missing"
>> error message. Increasing verbosity as you suggested (problem.debug = 1)
>> shows the same error message shown before, i.e. "cond" is not available
>> in numpy.linalg, so import fails:
>> ----
>> ...<cut>...
>>  in solve
>>     result = self.problem.solve(self.optimization_algorithm) # perform
>> optimization!
>>   File
>> "/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/BaseProblem.py",
>> line 185, in solve
>>     return runProbSolver(self, solvers, *args, **kwargs)
>>   File
>> "/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/runProbSolver.py",
>> line 43, in runProbSolver
>>     solverClass =  getattr(my_import(__solverPaths__[solver_str]),
>> solver_str)
>>   File
>> "/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/runProbSolver.py",
>> line 268, in my_import
>>     mod = __import__(name)
>>   File
>> "/usr/lib/python2.5/site-packages/scikits/openopt/solvers/UkrOpt/ralg_oo.py",
>> line 2, in <module>
>>     from numpy.linalg import norm, cond
>> ImportError: cannot import name cond
>> ----
>>
>> Hope this helps,
>>
>> Emanuele
>>
>> Emanuele Olivetti wrote:
>>   
>>     
>>> Thanks for help.
>>>
>>> Unfortunately after updating from SVN again I'm not able to reproduce
>>> the same error, but instead I get this, about failing to import "cond" from
>>> numpy.linalg. It seems that "cond" is not available until the very latest
>>> numpy (and even autogenerated NumPy API on scipy.org have no "cond"):
>>> ----
>>> $ python openopt/scikits/openopt/examples/nlp_1.py
>>> OpenOpt checks user-supplied gradient df (shape: (150,) )
>>> according to:
>>>     prob.diffInt = [  1.00000000e-07]
>>>     |1 - info_user/info_numerical| <= prob.maxViolation = 0.01
>>> derivatives are equal
>>> ========================
>>> OpenOpt checks user-supplied gradient dc (shape: (2, 150) )
>>> according to:
>>>     prob.diffInt = [  1.00000000e-07]
>>>     |1 - info_user/info_numerical| <= prob.maxViolation = 0.01
>>> derivatives are equal
>>> ========================
>>> OpenOpt checks user-supplied gradient dh (shape: (2, 150) )
>>> according to:
>>>     prob.diffInt = [  1.00000000e-07]
>>>     |1 - info_user/info_numerical| <= prob.maxViolation = 0.01
>>> derivatives are equal
>>> ========================
>>> Traceback (most recent call last):
>>>   File "openopt/scikits/openopt/examples/nlp_1.py", line 108, in <module>
>>>     r = p.solve('ralg', debug = 1)
>>>   File
>>> "/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/BaseProblem.py",
>>> line 185, in solve
>>>     return runProbSolver(self, solvers, *args, **kwargs)
>>>   File
>>> "/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/runProbSolver.py",
>>> line 43, in runProbSolver
>>>     solverClass =  getattr(my_import(__solverPaths__[solver_str]),
>>> solver_str)
>>>   File
>>> "/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/runProbSolver.py",
>>> line 268, in my_import
>>>     mod = __import__(name)
>>>   File
>>> "/usr/lib/python2.5/site-packages/scikits/openopt/solvers/UkrOpt/ralg_oo.py",
>>> line 2, in <module>
>>>     from numpy.linalg import norm, cond
>>> ImportError: cannot import name cond
>>> ----
>>>
>>> Any suggestion on how to solve this?
>>>
>>> Sorry for the mess.
>>>
>>> Emanuele
>>>
>>> Note: this error pops out using numpy+scipy shipped with
>>> ubuntu. When using recent SVN version of numpy+scipy
>>> everything works well.
>>>
>>> dmitrey wrote:
>>>   
>>>     
>>>       
>>>> Hi Emanuele,
>>>>  as it is mentioned in openopt install webpage and README.txt  numpy v 
>>>>  >= 1.1.0 is recommended. Some other oo users informed of bugs due to 
>>>> older versions.
>>>>
>>>> Could you inform what will be outputed if you set p.debug = 1? (either 
>>>> directly or via p = NLP(..., debug=1,...))
>>>>
>>>> If the problem with numpy versions is critical for users of your soft, 
>>>> you'd better to put more recent numpy into Debian soft channel.
>>>>
>>>> Regards, D.
>>>>
>>>> Emanuele Olivetti wrote:
>>>>   
>>>>     
>>>>       
>>>>         
>>>>> Same problem with numpy 1.0.4 + scipy 0.6.0
>>>>> (shipped with ubuntu 8.04 hardy heron).
>>>>>
>>>>> E.
>>>>>
>>>>> Emanuele Olivetti wrote:
>>>>>   
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>>>> Dear all and Dmitrey,
>>>>>>
>>>>>> I've just updated to latest openopt (SVN). When using numpy 1.0.3
>>>>>> and scipy 0.5.2 (standard in Ubuntu 7.10 gutsy gibbon) openopt says
>>>>>> that "ralg" (NLP) algorithm is missing! With more recent numpy
>>>>>> and scipy it seems to work reliably. But what happened with respect
>>>>>> to older numpy+scipy? In that case even running examples/nlp_1.py
>>>>>> returns:
>>>>>> ----
>>>>>> $ python nlp_1.py
>>>>>> OpenOpt checks user-supplied gradient df (shape: (150,) )
>>>>>> according to:
>>>>>>     prob.diffInt = [  1.00000000e-07]
>>>>>>     |1 - info_user/info_numerical| <= prob.maxViolation = 0.01
>>>>>> derivatives are equal
>>>>>> ========================
>>>>>> OpenOpt checks user-supplied gradient dc (shape: (2, 150) )
>>>>>> according to:
>>>>>>     prob.diffInt = [  1.00000000e-07]
>>>>>>     |1 - info_user/info_numerical| <= prob.maxViolation = 0.01
>>>>>> derivatives are equal
>>>>>> ========================
>>>>>> OpenOpt checks user-supplied gradient dh (shape: (2, 150) )
>>>>>> according to:
>>>>>>     prob.diffInt = [  1.00000000e-07]
>>>>>>     |1 - info_user/info_numerical| <= prob.maxViolation = 0.01
>>>>>> derivatives are equal
>>>>>> ========================
>>>>>> OO Error:incorrect solver is called, maybe the solver "ralg" is not
>>>>>> installed. Maybe setting p.debug=1 could specify the matter more precisely
>>>>>> Traceback (most recent call last):
>>>>>>   File "nlp_1.py", line 110, in <module>
>>>>>>     r = p.solve('ralg')
>>>>>>   File
>>>>>> "/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/BaseProblem.py",
>>>>>> line 185, in solve
>>>>>>     return runProbSolver(self, solvers, *args, **kwargs)
>>>>>>   File
>>>>>> "/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/runProbSolver.py",
>>>>>> line 48, in runProbSolver
>>>>>>     p.err('incorrect solver is called, maybe the solver "' + solver_str
>>>>>> +'" is not installed. Maybe setting p.debug=1 could specify the matter
>>>>>> more precisely')
>>>>>>   File
>>>>>> "/usr/lib/python2.5/site-packages/scikits/openopt/Kernel/oologfcn.py",
>>>>>> line 16, in ooerr
>>>>>>     raise OpenOptException(msg)
>>>>>> scikits.openopt.Kernel.oologfcn.OpenOptException: incorrect solver is
>>>>>> called, maybe the solver "ralg" is not installed. Maybe setting
>>>>>> p.debug=1 could specify the matter more precisely
>>>>>> ----
>>>>>>
>>>>>> This did not happen before so I guess it is due to a recent
>>>>>> commit. It is possible to solve the problem?
>>>>>>
>>>>>> Kind Regards,
>>>>>>
>>>>>> Emanuele
>>>>>>
>>>>>> _______________________________________________
>>>>>> SciPy-user mailing list
>>>>>> SciPy-user@scipy.org
>>>>>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>>>>>
>>>>>>   
>>>>>>     
>>>>>>       
>>>>>>         
>>>>>>           
>>>>>>             
>>>>> _______________________________________________
>>>>> SciPy-user mailing list
>>>>> SciPy-user@scipy.org
>>>>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>>>>
>>>>>
>>>>>
>>>>>   
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>> _______________________________________________
>>>> SciPy-user mailing list
>>>> SciPy-user@scipy.org
>>>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>>>
>>>>   
>>>>     
>>>>       
>>>>         
>>> _______________________________________________
>>> SciPy-user mailing list
>>> SciPy-user@scipy.org
>>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>>
>>>   
>>>     
>>>       
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user@scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>
>>
>>
>>   
>>     
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>   



More information about the SciPy-user mailing list