[SciPy-User] Lagrange Multipliers in optimize.slsqp

Skipper Seabold jsseabold@gmail....
Fri Feb 26 09:35:59 CST 2010


On Fri, Feb 26, 2010 at 8:55 AM,  <josef.pktd@gmail.com> wrote:
> On Thu, Feb 25, 2010 at 11:08 PM, Skipper Seabold <jsseabold@gmail.com> wrote:
>> On Thu, Feb 25, 2010 at 8:17 PM, Guilherme P. de Freitas
>> <guilherme@gpfreitas.com> wrote:
>>> Hi all,
>>>
>>> Would it be possible for optimize.slsqp to return the Lagrange
>>> multipliers of the constraints? I don't know Fortran, but it seems
>>> that they are available in the original Fortran code:
>>>
>>> http://projects.scipy.org/scipy/browser/trunk/scipy/optimize/slsqp/slsqp_optmz.f#L581
>>
>> That looks like the constraint of the the lsq subroutine part of
>> sequential least squares algorithm.
>>
>> http://projects.scipy.org/scipy/browser/trunk/scipy/optimize/slsqp/slsqp_optmz.f#L164
>
>
> here is the workspace `w` description of the main slsqp routine
>
> http://projects.scipy.org/scipy/browser/trunk/scipy/optimize/slsqp/slsqp_optmz.f#L144
>
> w is available in python, but non of the content of it is used in python
>
> http://projects.scipy.org/scipy/browser/trunk/scipy/optimize/slsqp.py#L345
>
> So, correctly extracting the slices from the workspace w should be
> possible to get the Lagrange multipliers that were used.
>

Ah, this should be enough then to return the multipliers.  See if
it gives what you'd expect?  Then you can file an enhancement ticket
if you want the multipliers back.

Index: slsqp.py
===================================================================
--- slsqp.py    (revision 6242)
+++ slsqp.py    (working copy)
@@ -371,5 +371,6 @@
         return [list(x),
                 float(fx),
                 int(majiter),
-                int(mode),
+                list(w[:m]),
+                int(mode),
                 exit_modes[int(mode)] ]

Skipper


More information about the SciPy-User mailing list