Warning: Solver not applicable (gurobi)

1,308 views
Skip to first unread message

碧尧邵

unread,
Apr 22, 2017, 9:23:12 AM4/22/17
to YALMIP
I am solve a linear programming under a nonlinear constraints. I think the constraints are right and gurobi solver work for demo. However matlab post a error :Warning: Solver not applicable (gurobi). A part of my matlab code. 
Thanks in advance for anybody who can help me with this.


x = sdpvar(8,1);
lamda=sdpvar(size(line_1,1),2);
% K is a 3*3 matrix
K_1=inv(K);
F=[x(1)*x(5)+x(2)*x(6)+x(3)*x(7)==0 x(1)^2+x(2)^2+x(3)^2-1==0 x(5)^2+x(6)^2+x(7)^2-1==0];
f=0;
for i=1:size(line_1,1)
    % q is a 3*1 vector
    q=[line_1(i,:) 1]';
    % my objection is to min f
    f=f+abs(lamda(i,1)-lamda(i,2));
    % constraints
    F=[F [x(1) x(2) x(3)]*K_1*q*lamda(i,1)-x(4)==0 [x(5) x(6) x(7)]*K_1*q*lamda(i,2)-x(8)==0];
end
% optimize(F,f);
% ops = sdpsettings('solver', 'lpsolve', 'verbose', 2);
ops = sdpsettings('solver', 'gurobi');
result = solvesdp(F, f, ops);
double(x);
 

Johan Löfberg

unread,
Apr 22, 2017, 11:41:20 AM4/22/17
to YALMIP
Well, you already answered your self, the model is nonlinear. Gurobi is a linear solver

碧尧邵

unread,
Apr 22, 2017, 9:58:56 PM4/22/17
to YALMIP
Okay. Could you recommend some suitable solvers for this problem? Thank you so much!

碧尧邵

unread,
Apr 22, 2017, 11:08:53 PM4/22/17
to YALMIP
I choose fmincon function as solver because it is a nonlinear solver. Matlab post a problem:

Converged to an infeasible point.
fmincon stopped because the size of the current step is less than
the default value of the step size tolerance but constraints are not
satisfied to within the selected value of the constraint tolerance

here is the stopping criteria details:
Optimization stopped because the relative changes in all elements of x are
less than options.TolX = 1.000000e-10, but the relative maximum constraint
violation, 1.000000e+00, exceeds options.TolCon = 1.000000e-06.

Johan Löfberg

unread,
Apr 23, 2017, 2:04:16 AM4/23/17
to YALMIP
that's the problem with your model, it is nonconvex hence no guarantee that a local nonlinear solver will find any solution. try other local nonlnear solvers such as ipopt or knitro, or global nonlinear solvers such as bmibnb or baron

Mark L. Stone

unread,
Apr 23, 2017, 10:14:55 AM4/23/17
to YALMIP
Or try a non-default starting value, by using sdpsettings('usex0',1) and assign.

碧尧邵

unread,
Apr 24, 2017, 10:16:37 PM4/24/17
to YALMIP
I am confused about whether yalmip is suitable for building a nonlinear model with abs

Johan Löfberg

unread,
Apr 25, 2017, 1:24:59 AM4/25/17
to YALMIP
Sure, but with a caveat: If the abs operator i used in a non-convex fashion, YALMIP will derive a mixed-integer model of the absolute value.
Reply all
Reply to author
Forward
0 new messages