What are the orders of the variables and constraints exported by the 'export' command consistent with?

29 views
Skip to first unread message

qi wang

unread,
Mar 19, 2020, 5:46:16 AM3/19/20
to YALMIP
What are the orders of the variables exported by the 'export' command consistent with? similarly, what are the orders of the constraints exported by the 'export' command consistent with? 
Does it depend on the order in which the variables are defined? And the order in which the constraints are written?

For example:
x1=sdpvar(2,1);
x2=sdpvar(2,1);
x3=sdpvar(2,1);
Con=[];
Con = Con + [lb1<=x1<=ub1];
Con = Con + [lb2<=x2<=ub2];
Con = Con + [lb3<=x3<=ub3];
Con = Con + [lb4<=x1+x3<=ub4];
Con = Con + [lb5<=x2+x3<=ub5];
obj=A*[x1;x2];
options = sdpsettings('solver','cplex','verbose',1);
[model,recoverymodel,diagnostic,internalmodel] = export(Con,obj,options);

The details in the exported 'model' are as follows:
model.H,model.f,model.Aineq,model.bineq ...
,model.Aeq,model.beq,model.lb,model.ub

Johan Löfberg

unread,
Mar 19, 2020, 6:23:59 AM3/19/20
to YALMIP
in the order they were defined

qi wang

unread,
Mar 19, 2020, 8:32:04 AM3/19/20
to YALMIP
After using the optimize command,
Can we use the following expression to get the value of obj
obj_value=double(obj);

Johan Löfberg

unread,
Mar 19, 2020, 9:29:23 AM3/19/20
to YALMIP
Of course, except that it is called value, not double.

qi wang

unread,
Mar 19, 2020, 9:37:58 AM3/19/20
to YALMIP
Thx for you reply. I have another two questions.
1. Is there any difference between value and double?  I tried. The values got by the two commands are the same.
2. The result got by value(obj) is different from the objective value got by cplexqp.  Why is this? I have no idea.

Johan Löfberg

unread,
Mar 19, 2020, 9:42:35 AM3/19/20
to YALMIP
there is no official command called double

typically difference is that there is an additive constant in the objective which isn't used by the solver
Reply all
Reply to author
Forward
Message has been deleted
0 new messages