Difficulty with changing any Gurobi solver setting

With the latest CVX version 2.2, Build 9, has anyone tried to change any Gurobi setting?

If I only set “cvx_solver gurobi”, CVX works fine and solves the problem using Gurobi default settings. However, if I add any setting change such as “cvx_solver_settings(‘NumericFocus’, 3)”, a bunch of errors fly out when reaching cvx_end line:

Error using gurobi
result = gurobi(model, params)

Error in cvx_run_solver (line 50)
[ varargout{1:nargout} ] = sfunc( inputs{:} );

Error in cvx_gurobi>solve (line 216)
res = cvx_run_solver( @gurobi, prob, params, ‘res’, settings, 3 );

Error in cvxprob/solve (line 435)
[ x, status, tprec, iters ] = shim.solve( At, b, c, cones, quiet, prec, solv.settings, eargs{:} );

Error in cvx_end (line 88)
solve( prob );

Error in cvx_code (line 33)
cvx_end

I believe the Gurobi is up to date:
Gurobi Optimizer version 12.0.2 build v12.0.2rc0 (win64 - Windows 10.0 (19045.2))
Copyright (c) 2025, Gurobi Optimization, LLC

Thank you!

There have been various CVX interface issues (bugs) with Gurobi. This appears to be one of them. I had the same experience as you when I just tried it in CVX 2.2.2.

Thank you so much for confirming! Did you by any chance successfully change Gurobi setting with an older version of CVX?

Or does anyone know if CVXPY is free from these interface issues with Gurobi?

i didn’t try an older version of CVX. I suppose there is some chance it might work with an older version of Gurobi, but I have no reason to think it would, and if it did, you would still be using an older, and perhaps inferior version of Gurobi…

CVXPY is under active development, and i have no reason to think it wouldn’t work. The same for YALMIP, which is MATLAB-based and is also under active development.

1 Like