How do I add solver to Yalmip? keeps telling me solver not found even after installing Gurobi

366 views
Skip to first unread message

Shankar Kartha

unread,
Apr 20, 2021, 8:47:37 PM4/20/21
to YALMIP
Hi Yalmip forum, 

I am trying to get the basic Unit Commitment example shown in the Yalmip forum up and running. For some reason I get the following error 

Unrecognized function or variable 'getIpOptions'.

Error in fmincon (line 846)
    options = getIpOptions(options,sizes.nVar,mEq,flags.constr,defaultopt,10,0.01);

Error in callfmincon (line 93)
    [xout,fmin,flag,output,lambda] =
    fmincon(f,model.x0,model.A,model.b,model.Aeq,model.beq,model.lb,model.ub,g,model.options.fmincon);

Error in bnb_solvelower (line 246)
    output = feval(lowersolver,p);

Error in bnb>branch_and_bound (line 536)
        output = bnb_solvelower(lowersolver,relaxed_p,upper,lower,x_min,aggresiveprune,allSolutions);

Error in bnb (line 223)
[x_min,solved_nodes,lower,upper,profile,diagnostics] = branch_and_bound(p,pss);

Error in solvesdp (line 368)
    eval(['output = ' solver.call '(interfacedata);']);

Error in optimize (line 31)
[varargout{1:nargout}] = solvesdp(varargin{:});

Error in Test_1 (line 30)
optimize(Constraints,Objective,ops)

Steps tried:
1. I tried re-installing Yalmip which didn't work. 
2. I installed Gurobi through an academic license and tried calling gurobi through sdp settings which also didn't work. It told me solver not found. How can I add Gurobi to Yalmip? 

Any inputs appreciated. 

Thank you,
Shankar 

Johan Löfberg

unread,
Apr 21, 2021, 1:28:05 AM4/21/21
to YALMIP
For gurobi you follow the directions gurobi has including licenses, and then you simply add the gurobi directory to the matlab path

Regarding the crash which has nothing to do with gurobi as YALMIP has selected fmincon as solver here (which is weird as the unit commitment is a MILP, so I think you are not telling us the full story) it appears you have a broken installation of fmincon. fmincon uses an internal function getIpoptions and it i missing in your installation

>> which getIpOptions
C:\Program Files\MATLAB\R2020b\toolbox\optim\optim\getIpOptions.m
>> which fmincon
C:\Program Files\MATLAB\R2020b\toolbox\shared\optimlib\fmincon.m


Shankar Kartha

unread,
Apr 21, 2021, 1:13:39 PM4/21/21
to YALMIP
Hi Johan, 

Thank you for getting back to me. In regards to YALMIP installation - All I did was follow the instructions given on the site in terms of adding the paths to MATLAB 

->/YALMIP-master 
->/YALMIP-master/extras 
->/YALMIP-master/solvers 
->/YALMIP-master/modules 
->/YALMIP-master/modules/parametric 
->/YALMIP-master/modules/moment 
->/YALMIP-master/modules/global 
->/YALMIP-master/modules/sos 
->/YALMIP-master/operators

and I ran yalmiptest to see what all solvers it is detecting. Is there any additional steps that I need to do to make sure fmincon installation happens correctly or to make sure that yalmip is using the MILP solver? 

Since, you think it's possible that I might be providing incomplete information is there anything specific you would like me to look for? 

Thank you,
Shankar 

Shankar Kartha

unread,
Apr 21, 2021, 1:21:17 PM4/21/21
to YALMIP
Also, you are right about the broken fmincon installation. 

>> which getIpOptions
C:\Program Files\MATLAB\R2020b\toolbox\optim\optim\getIpOptions.m
>> which fmincon
C:\Program Files\MATLAB\R2020b\toolbox\shared\optimlib\fmincon.m

Are the above file paths normally present as part of a MATLAB installation? Because I can't seem to find them in my installation. 

Thank you,
Shankar 

Johan Löfberg

unread,
Apr 21, 2021, 1:36:02 PM4/21/21
to YALMIP
They are part of the optimization toolbox. You obviously have fmincon since the crash appears in that file. You either have a weird broken installation of optimization toolbox in general, or have removed the optim path from your path


however, he fact that fmincon is called indicates you have setup a bad model, as bnb has invoked a nonlinear solver instead of an LP/QP solver. and of course, bnb should not have been called at all as you really should have a real MILP solver installed and solve a MILP
Reply all
Reply to author
Forward
0 new messages