Yalmip with Gurobi 9.0.0 - solver not found

655 views
Skip to first unread message

Rabab Haider

unread,
Feb 4, 2020, 4:58:21 PM2/4/20
to YALMIP
Hello,

I am trying to run yalmip with gurobi 9.0.0 as a solver, using the export function. I was successfully running this about 2 weeks ago or so. However, when I went back to my code to run it again, yalmip is saying the sovler cannot be found. I have checked and the gurobi install is in my matlab path. I have also run yalmiptest, and when I do so, it identifies that gurobi is a found solver. Then, when I run the export function, it says the solver cannot be found. If I then rerun yalmiptest, Gurobi is no longer found as a solver.

I have tried updating to the newest version of Yalmip, and re-run the install process, and the same issue persisted.

I have also tried adding gurobi to the path (and done the matlab install again), saved the path, run yalmiptest and found the solver, then closed matlab and reopened it, and the problem persists. 

If relevant, I am running macOS, updated to the latest version of Yalmip today, and am running Gurobi 9.0.0.


Are there any suggestions you may have for why this is happening, or how to get around the issue?

Thanks so much,
Rabab

Rabab H

unread,
Feb 4, 2020, 5:04:04 PM2/4/20
to YALMIP
Also just to add another note, I have another instance where I solve an optimization problem with CVX calling the gurobi solver, and this solves with issues.

Johan Löfberg

unread,
Feb 4, 2020, 5:10:41 PM2/4/20
to yal...@googlegroups.com
yalmip simply checks if gurobi is installed by running which('gurobi'), and export works here

>> which('gurobi')
C:\gurobi900\win64\matlab\gurobi.mexw64
>> sdpvar x
export(x<=0,x,sdpsettings('solver','gurobi'))
ans = 
  struct with fields:

                  A: 1
                obj: 1
              sense: '<'
                rhs: 0
                 lb: -Inf
                 ub: Inf
             objcon: 0
              vtype: 'C'
                  Q: 0
             params: [1×1 struct]
    NegativeSemiVar: []

Rabab H

unread,
Feb 4, 2020, 5:22:33 PM2/4/20
to YALMIP
Thanks for your quick reply.

When I run the command, which('gurobi'), it is unable to find the instance. However, CVX is still able to find gurobi and use it. 

I have tried the following: 
- Added the gurobi instance to the path. run command savepath.
- Check if the instance can be found (using the which command), and it is found
- Run a simple test case as follows, which works:
      sdpvar x
      optimize(x>=0,x,sdpsettings('solver','gurobi'))
- Tried running a script which invokes the export command, which does not work (saying solver cannot be found). Here I also try the which command again just to be sure and as expected solver is not found. Prior to running the export command however, in the same script I successfully solve a problem with CVX using Gurobi.

From your tests, it appears the problem is not from Yalmip. Is it possible the issue is coming from Matlab itself, or perhaps with CVX as I run the instance prior to the yalmip commands? Apologies for this, as the issue is not reproducible on your end, but I wasn't sure where to go from here, and thought someone may have also experienced the same issue.

Best.
Rabab

Johan Löfberg

unread,
Feb 4, 2020, 5:27:46 PM2/4/20
to YALMIP
cvx, if it works as it did in the past, manipulates the path (adds and deletes solvers) on every call.

somehow you are failing to set the path on your machine. savepath does not work in some scenarios where you don't have full access rights to the file holding the path

Rabab H

unread,
Feb 5, 2020, 9:08:20 AM2/5/20
to YALMIP
Thanks for your reply -  I didn't know CVX behaved in this way. Indeed, if I don't call CVX prior to using Yalmip, it is able to find the Gurobi install.

I will look into this and if I can find a fix, will post it for future reference. 

Johan Löfberg

unread,
Feb 5, 2020, 9:19:53 AM2/5/20
to YALMIP
Using gurobi in cvx and outside of cvx at the same time is a mess since cvx deletes it from the path. The only way around that is to hack cvx and remove the code which tampers with the path
Reply all
Reply to author
Forward
0 new messages