the correspondence between constraints and Lagrangian multipliers when call fmincon?

28 views
Skip to first unread message

UniMilky

unread,
Sep 23, 2017, 10:49:44 AM9/23/17
to YALMIP
When i use YALMIP call the fmincon ,the output are as below. How can i know every constraints corresponds to which lambda?
result.solveroutput.lambda

ans = 

         eqlin: [0x1 double]
      eqnonlin: [0x1 double]
       ineqlin: [100x1 double]
         lower: [40x1 double]
         upper: [40x1 double]
    ineqnonlin: [40x1 double]

Johan Löfberg

unread,
Sep 23, 2017, 10:55:35 AM9/23/17
to YALMIP
Basically in the order they were defined.

With the caveat that yalmip might have introduced internal constraints, so some of them could correspond to things you don't even know of, and moved from constraints to bounds.

Trying to reverse engineer is not trivial, except in simple models

UniMilky

unread,
Sep 23, 2017, 9:22:31 PM9/23/17
to YALMIP
Thanks a lot.
I have a set of constrains as below:(only x is the variable, others are all consts)
f = [];

for i = 1 : N
    for j = 1 : K
        sumy = 0; 
        sumx = 0;
        tmp = 0; 
        for m = 1 : N
            sumy = sumy + y(m,j);
        end
        for t = 1 : K
            sumx = sumx + x(i,t);
        end
        for s = 1 : K
            sumsy = 0;
            for m = 1 : N
                sumsy = sumsy + y(m,s);
            end
            tmp = tmp + B(i)*x(i,s)*p(i,s)*8*sumsy/(w(s)*10^3);
        end
        f = [f;(rt(i)*(B(i)*x(i,j)*sumy*8/(w(j)*10^3) + tc(i)*sumx) + ...
            re(i)*(tmp + tc(i)*sumx*Pidle(i)) - rt(i)*tm(i) - re(i)*em(i))];
    end
end

cause i need to use the lambda to generate a new constrain like this:
.
so i need to know the relations between the constrains and lambda, but this need to call fmincon directly.
My question is:
        When directly call fmincon through matlab, the coefficients matrix of the linear constraints is hard to get, is there any good methods? 



Johan Löfberg

unread,
Sep 24, 2017, 3:45:00 AM9/24/17
to YALMIP
use export and export linear constrints to any linear solver

Johan Löfberg

unread,
Sep 24, 2017, 3:46:44 AM9/24/17
to YALMIP
and this is a model here yalmip will introduce internal constraints in the nonlinear model, as a/(b+cx) <=1 will be written as a*y^(-1)<=1, y==b+cx

UniMilky

unread,
Sep 24, 2017, 7:41:12 AM9/24/17
to YALMIP
https://groups.google.com/d/topic/yalmip/796Y-c1nRA8/discussion But this subject shows that the export of fmincon output an empty  model.

Johan Löfberg

unread,
Sep 24, 2017, 8:13:58 AM9/24/17
to YALMIP
You cannot export an fmincon model. What i said is that you can export the linear part to a linear solver and thus obtain the linear constraints
If you have a nonlinear model where extra variables are introduced, you will not be able to export anything cleanly. You can see the linear parts including extra variables bu turning on 'savedebug' when calling fmincon, and then load the model from the file fmincondebug

UniMilky

unread,
Sep 24, 2017, 8:09:46 PM9/24/17
to YALMIP
Got it.
Thank you.
Reply all
Reply to author
Forward
0 new messages