Model creation failed

690 views
Skip to first unread message

Marc Wijnand

unread,
May 7, 2015, 11:17:47 AM5/7/15
to yal...@googlegroups.com
I would like to know what the error message 'model creation failed' means. Where can you find more information about this?
___
Context: I want to minimize log(det(B)) where B is a 2x2 matrix and the constraints are inequalities in function of elements of B. I use optimize(constraints,cost)
Execution of the program yields
solvertime: 0
       problem: 14
          info: 'Model creation failed (Model not available in objective at level 3)'
    yalmiptime: 0.0642
Removing the log yields
'Model creation failed (Model not available in objective at level 2)'
After other edits, I obtained respectively
 'Model creation failed (Model not available in constraint #1 at level 2)'
['No solver found']

Johan Löfberg

unread,
May 7, 2015, 2:40:45 PM5/7/15
to yal...@googlegroups.com
A bit strange error message, but it basically means you are trying to use a high-level operator which only can be implemented using an epigraph reformulation, but your model does not satisfy convexity properties required for this. With code, it is easy to see where your problem lies

Johan Löfberg

unread,
May 8, 2015, 3:47:25 AM5/8/15
to yal...@googlegroups.com
and of course, a major additional hurdle is the fact that you are trying to minimize the concave log(det)) function, i.e., even if you sorted out the other stuff, you are stuck with a nonconvex problem.

Marc Wijnand

unread,
May 8, 2015, 5:26:51 AM5/8/15
to yal...@googlegroups.com
Thank you for this information. I did not want to post code before making sure that the problem statement as well as the implementation make sense.
(My code determines the maximum volume ellipsoid {x'Px<=alpha} inside a polyhedron defined by the inequality constraint matrices Vae and Vbe.)

This is a MWE:
- I define a positive definite matrix Pi.
- I define constraint matrices VAe and Vbe.
- I want to minimize det(inv(B)), where B=sqrt(alpha)*Pi^(-1/2) with alpha as decision variable. Because it is not possible to calculate inv(B) when B contains an sdpvar, I explicitly construct the help variable Binv. Then I define the cost function
cost=det(Binv).
The constraints are defined as
norm(B*VAe(i,:)',2)<=Vbe(i); %i=1,...,length(Vbe).
(Btw: we know that det(inv(B)) has to be positive as Pi is PD and alpha>=0.)

%Define matrix Pi
Pi=[3.4309 1.4534; 1.4534 3.3298];

%Define matrices VAe, Vbe
VAe=[-0.1046   -0.2476
         0   -0.1961
    0.1961    0.0000
    0.1046    0.2476
         0    0.1961
   -0.1961   -0.0000]
Vbe=[0.9632
    0.9806
    0.9806
    0.9632
    0.9806
    0.9806]

%Optimization
sdpvar alpha
B=sqrt(alpha)*Pi^(-1/2);
    a=B(1,1);
    b=B(1,2);
    c=B(2,1);
    d=B(2,2);
Binv=1/(a*d-b*c)*[d -b; -c a];
cost=det(Binv)%log(det(Binv)), we know det(Binv)>=0
cond=[];
for i=1:length(Vbe)
    cond=[cond norm(B*VAe(i,:)',2)<=Vbe(i)]
end
%cond=[cond alpha>=0]
optimize(cond,cost)

This gives 'Model creation failed (Model not available in objective at level 2)'.

Johan Löfberg

unread,
May 8, 2015, 5:35:36 AM5/8/15
to yal...@googlegroups.com
So you actually want to maximize det(B) which is equivalent to maximize log(det(B)) which is concave and thus you can hopefully use a logdet solver.

However, you cannot throw the concave socp-modelled sqrt operator into something which later is used in the convex operator norm (and the logdet operator). You have to be much more careful than that when you want to derive well structured models. You model is easily reformulated to something which satisfies convexity propagation rules and can be reformulated to a mixed socp/sdp with MAXDET term

sdpvar sqrt_alpha
B=sqrt_alpha*Pi^(-1/2);
    a=B(1,1);
    b=B(1,2);
    c=B(2,1);
    d=B(2,2);
cost=-logdet(B)
cond=[];
for i=1:length(Vbe)
    cond=[cond norm(B*VAe(i,:)',2)<=Vbe(i)]
end

Marc Wijnand

unread,
May 8, 2015, 8:04:14 AM5/8/15
to yal...@googlegroups.com
Thanks a lot for this help! This finally solved my problem.

terminalregion.jpg
Reply all
Reply to author
Forward
0 new messages