<div dir="ltr"><div style>Hello!</div><div style><br></div><div style>I am getting incorrect Lagrange multipliers for equality constrained variables ("parameters"). For example, when I solve the following problem:</div>
<div style><br></div><div style>minimize: x0*(3+x1^2)</div><div style>subject to:</div><div style> [1.0, -10] <= [x0,x1] <= [1.0, 10]</div><div style><br></div><div style>I get that the multipliers corresponding to the bound is [0,0], which is obviously wrong (it should be [-3,0]).</div>
<div style><br></div><div style>If I formulate the same constraint as a nonlinear constraint or if I allow a range for x0 (e.g. [1.000,1.0001]), then I get the correct multipliers.</div><div style><br></div><div style>I suspect this is related to Ipopt "optimizing away" the variable. Is there some way to prevent this from happening? Or maybe I missed something in the doumentation?</div>
<div style><br></div><div style>Thanks!</div><div style>Joel</div><div style><br></div><div style><br></div><div style>P.S: I use Ipopt from CasADi. For reference here is my test script:</div><div><br></div><pre style="margin-top:0px;margin-bottom:0px;padding:6px 10px;border:1px solid rgb(204,204,204);font-size:12.800000190734863px;font-family:Consolas,'Liberation Mono',Courier,monospace;background-color:rgb(248,248,248);line-height:19px;overflow:auto;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;color:rgb(51,51,51)">
<span class="" style="margin:0px;padding:0px;border:0px">from</span> <span class="" style="margin:0px;padding:0px;border:0px;color:rgb(85,85,85)">casadi</span> <span class="" style="margin:0px;padding:0px;border:0px">import</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">*</span>
<span class="" style="margin:0px;padding:0px;border:0px">x</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">=</span> <span class="" style="margin:0px;padding:0px;border:0px">ssym</span><span class="" style="margin:0px;padding:0px;border:0px">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(221,17,68)">"x"</span><span class="" style="margin:0px;padding:0px;border:0px">,</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">2</span><span class="" style="margin:0px;padding:0px;border:0px">)</span>
<span class="" style="margin:0px;padding:0px;border:0px">f</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">=</span> <span class="" style="margin:0px;padding:0px;border:0px">SXFunction</span><span class="" style="margin:0px;padding:0px;border:0px">([</span><span class="" style="margin:0px;padding:0px;border:0px">x</span><span class="" style="margin:0px;padding:0px;border:0px">],[</span><span class="" style="margin:0px;padding:0px;border:0px">x</span><span class="" style="margin:0px;padding:0px;border:0px">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">0</span><span class="" style="margin:0px;padding:0px;border:0px">]</span><span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">*</span><span class="" style="margin:0px;padding:0px;border:0px">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">3</span><span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">+</span><span class="" style="margin:0px;padding:0px;border:0px">x</span><span class="" style="margin:0px;padding:0px;border:0px">[</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">1</span><span class="" style="margin:0px;padding:0px;border:0px">]</span><span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">**</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">2</span><span class="" style="margin:0px;padding:0px;border:0px">)])</span>
<span class="" style="margin:0px;padding:0px;border:0px">s</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">=</span> <span class="" style="margin:0px;padding:0px;border:0px">IpoptSolver</span><span class="" style="margin:0px;padding:0px;border:0px">(</span><span class="" style="margin:0px;padding:0px;border:0px">f</span><span class="" style="margin:0px;padding:0px;border:0px">)</span>
<span class="" style="margin:0px;padding:0px;border:0px">s</span><span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">.</span><span class="" style="margin:0px;padding:0px;border:0px">init</span><span class="" style="margin:0px;padding:0px;border:0px">()</span>
<span class="" style="margin:0px;padding:0px;border:0px">s</span><span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">.</span><span class="" style="margin:0px;padding:0px;border:0px">setInput</span><span class="" style="margin:0px;padding:0px;border:0px">([</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">1.</span><span class="" style="margin:0px;padding:0px;border:0px">,</span> <span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">-</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">10.</span><span class="" style="margin:0px;padding:0px;border:0px">],</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(221,17,68)">"lbx"</span><span class="" style="margin:0px;padding:0px;border:0px">)</span>
<span class="" style="margin:0px;padding:0px;border:0px">s</span><span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">.</span><span class="" style="margin:0px;padding:0px;border:0px">setInput</span><span class="" style="margin:0px;padding:0px;border:0px">([</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">1.</span><span class="" style="margin:0px;padding:0px;border:0px">,</span> <span class="" style="margin:0px;padding:0px;border:0px;color:rgb(0,153,153)">10.</span><span class="" style="margin:0px;padding:0px;border:0px">],</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(221,17,68)">"ubx"</span><span class="" style="margin:0px;padding:0px;border:0px">)</span>
<span class="" style="margin:0px;padding:0px;border:0px">s</span><span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">.</span><span class="" style="margin:0px;padding:0px;border:0px">evaluate</span><span class="" style="margin:0px;padding:0px;border:0px">()</span>
<span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">print</span> <span class="" style="margin:0px;padding:0px;border:0px">s</span><span class="" style="margin:0px;padding:0px;border:0px;font-weight:bold">.</span><span class="" style="margin:0px;padding:0px;border:0px">output</span><span class="" style="margin:0px;padding:0px;border:0px">(</span><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(221,17,68)">"lam_x"</span><span class="" style="margin:0px;padding:0px;border:0px">)</span> <span class="" style="margin:0px;padding:0px;border:0px;color:rgb(153,153,136);font-style:italic"># [0,0] # wrong!!!</span>
</pre><div><span class="" style="margin:0px;padding:0px;border:0px;color:rgb(153,153,136);font-style:italic"><br></span></div><div><br></div><div><br></div><div><br></div>-- <br>Joel Andersson, PhD Student<br>Electrical Engineering Department (ESAT-SCD), Room 05.11,<br>
K.U.Leuven, Kasteelpark Arenberg 10 - bus 2446, 3001 Heverlee, Belgium<br>Phone: +32-16-321819<br>Mobile: +32-486-672874 (Belgium) / +34-63-4408800 (Spain) / +46-707-360512 (Sweden)<br><br>Private address: Weidestraat 5, 3000 Leuven, Belgium
</div>