3 strange problems

76 views
Skip to first unread message

Per Dahlgaard Pedersen

unread,
Jul 2, 2016, 4:51:02 PM7/2/16
to YALMIP

Hi 

I have 3 strange problems with a yalmip optimization code.


First this code

    qs_ref= [-16    11     8; -23  -8    -6];

    qs_down=[ 16    23    19; 1    20    20];

    qs_up=  [10     14     7; 15    13    6];

    ps_unit=[  2     4     0; 1     5     3];

   

    %buyer

    qb_ref= [0  0 ;  0 0 ];

    qb_down=[23 17;  0 20];

    qb_up=  [13 22; 22 16];

    pb_unit=[1 1  ;  1  0];

   

    yalmip('clear')

    qs = sdpvar(2,3);

    qb = sdpvar(2,2);

   

    Constraints=[-qs_down<=qs<=qs_up;...

        -qb_down<=qb<=qb_up;...

        sum(min(qs,zeros(2,3)),2)==sum(min(qb,zeros(2,2)),2);...

        sum(max(qs,zeros(2,3)),2)==sum(max(qb,zeros(2,2)),2)];

   

    Objective = 100*sum(sum(ps_unit.*abs(qs),2)-sum(pb_unit.*abs(qb),2));

    diagnostics=solvesdp(Constraints,Objective,sdpsettings('verbose',0))

 

returns

   solvertime: 0

          info: 'No suitable solver'

       problem: -2

    yalmiptime: 1.8290

 

But if I change the numbers a little like

    qs_ref= [16    19     7; 20    21    -20];

    qs_down=[ 7    24     4; 14    24     24];

    qs_up=  [24    20    11; 12     4     23];

    ps_unit=[ 4     3     4;  5     0      5];

   

    %buyer

    qb_ref= [0   0; 0 0 ];

    qb_down=[16 18; 4 1 ];

    qb_up=  [ 7  2; 1 21];

    pb_unit=[ 3  5; 2  0];

 

it solves nicely with the scip solver, but I get the error message:

   yalmiptime: 0.3413

    solvertime: 0.1427

          info: 'Infeasible problem (SCIP)'

       problem: 1

 

Do you know why there is no suitable solver for the first problem and why I get the message “infeasible problem” but still a nice solution.

Now I want to extend my contraints with:

    for i=1:2

        min_p_buy=max(pb_unit(i,:));

        for j=1:2

            Constraints=[Constraints; implies(qb(i,j)>=1, min_p_buy==2)];

        end

end

 

but  I always get an error like:

 

One or more output arguments not assigned during call to "varargout".

 

Error in implies (line 62)

        varargout{1} = implies_internal(varargin{3:end});

 

Error in lmi/expandmeta (line 7)

    Fnew = [Fnew, feval(F.clauses{i}.data{1},'expand',[],F.clauses{i}.data{2:end})];

 

Error in expandmodel (line 33)

        F = expandmeta(F);

 

Error in compileinterfacedata (line 116)

    [F,failure,cause,operators] = expandmodel(F,h,options);

 

Error in solvesdp (line 219)

[interfacedata,recoverdata,solver,diagnostic,F,Fremoved,ForiginalQuadratics] =

compileinterfacedata(F,[],logdetStruct,h,options,0,solving_parametric);

 

Error in TF_market_clear_linear (line 108)

    diagnostics=solvesdp(Constraints,Objective,sdpsettings('solver','scip','verbose',0))

 

Any clue what is wrong?

 

Looking forward to hear from you


Johan Löfberg

unread,
Jul 3, 2016, 2:19:54 AM7/3/16
to YALMIP

Per Dahlgaard Pedersen

unread,
Jul 12, 2016, 12:51:55 PM7/12/16
to YALMIP
Hi Johan

Thanks for your quick reply. 
Where is the text in red you mention in your answer I should look at?
I'm a little confused, hope that you can clarify.

Regards Per

Johan Löfberg

unread,
Jul 12, 2016, 12:58:10 PM7/12/16
to YALMIP
YALMIPs symbolic variable

The most important command in YALMIP is sdpvar. This command is used to the define decision variables. To define a matrix (or scalar) P with n rows and m columns, we write
P = sdpvar(n,m)
[$[Get Code]]

A square matrix is symmetric by default!. To obtain a fully parameterized (i.e. not necessarily symmetric) square matrix, a third argument is needed.


Constraints

To define a collection of constraints, we simply define and concatenate them. The meaning of a constraint is context-dependent. If the left-hand side and right-hand side are Hermitian, the constraint is interpreted in terms of positive definiteness, otherwise element-wise. Hence, declaring a symmetric matrix and a positive definiteness constraint is done with
n = 3;
P = sdpvar(n,n);
C = [P>=0];
[$[Get Code]]

while a symmetric matrix with positive elements is defined with, e.g.,
P = sdpvar(n,n);
C = [P(:)>=0];
On 2016-07-12 18:51, Per Dahlgaard Pedersen wrote:
Reply all
Reply to author
Forward
0 new messages