I'm running into issues on CVXPY. I used MOSEK and the exact same problem seems to solve to a solution. If I try to use GUROBI in the solve() method, it gives me a SolverError telling me to set verbose=True, which dos not seem to help either. The output for solve() is below. Any pointers would be appreciated.
===============================================================================
CVXPY
v1.3.2
===============================================================================
(CVXPY) Oct 01 09:21:26 PM: Your problem has 16355 variables, 14412 constraints, and 0 parameters.
(CVXPY) Oct 01 09:21:26 PM: It is compliant with the following grammars: DCP, DQCP
(CVXPY) Oct 01 09:21:26 PM: (If you need to solve this problem multiple times, but with different data, consider using parameters.)
(CVXPY) Oct 01 09:21:26 PM: CVXPY will first compile your problem; then, it will invoke a numerical solver to obtain a solution.
-------------------------------------------------------------------------------
Compilation
-------------------------------------------------------------------------------
(CVXPY) Oct 01 09:21:26 PM: Compiling problem (target solver=GUROBI).
(CVXPY) Oct 01 09:21:26 PM: Reduction chain: Dcp2Cone -> CvxAttr2Constr -> ConeMatrixStuffing -> GUROBI
(CVXPY) Oct 01 09:21:26 PM: Applying reduction Dcp2Cone
(CVXPY) Oct 01 09:21:31 PM: Applying reduction CvxAttr2Constr
(CVXPY) Oct 01 09:21:31 PM: Applying reduction ConeMatrixStuffing
(CVXPY) Oct 01 09:21:49 PM: Applying reduction GUROBI
(CVXPY) Oct 01 09:21:57 PM: Finished problem compilation (took 3.087e+01 seconds).
-------------------------------------------------------------------------------
Numerical solver
-------------------------------------------------------------------------------
(CVXPY) Oct 01 09:21:57 PM: Invoking solver GUROBI to obtain a solution.
Set parameter QCPDual to value 1
Gurobi Optimizer version 10.0.3 build v10.0.3rc0 (mac64[arm])
CPU model: Apple M1 Max
Thread count: 10 physical cores, 10 logical processors, using up to 10 threads
---------------------------------------------------------------------------
SolverError Traceback (most recent call last)
example.ipynb Cell 20 line 1
----> 1 problem.solve(solver=cp.GUROBI, verbose=True)
File ~/venv/lib/python3.11/site-packages/cvxpy/problems/problem.py:495, in Problem.solve(self, *args, **kwargs)
493 else:
494 solve_func = Problem._solve
--> 495 return solve_func(self, *args, **kwargs)
File ~/venv/lib/python3.11/site-packages/cvxpy/problems/problem.py:1070, in Problem._solve(self, solver, warm_start, verbose, gp, qcp, requires_grad, enforce_dpp, ignore_dpp, canon_backend, **kwargs)
1068 end = time.time()
1069 self._solve_time = end - start
-> 1070 self.unpack_results(solution, solving_chain, inverse_data)
1071 if verbose:
1072 print(_FOOTER)
File ~/venv/lib/python3.11/site-packages/cvxpy/problems/problem.py:1395, in Problem.unpack_results(self, solution, chain, inverse_data)
1393 warnings.warn(INF_OR_UNB_MESSAGE)
1394 if solution.status in s.ERROR:
-> 1395 raise error.SolverError(
1396 "Solver '%s' failed. " % chain.solver.name() +
1397 "Try another solver, or solve with verbose=True for more "
1398 "information.")
1400 self.unpack(solution)
1401 self._solver_stats = SolverStats(self._solution.attr,
1402 chain.solver.name())
SolverError: Solver 'GUROBI' failed. Try another solver, or solve with verbose=True for more information.
The below is the same problem's solve() output for MOSEK
===============================================================================
CVXPY
v1.3.2
===============================================================================
(CVXPY) Oct 01 09:28:56 PM: Your problem has 16355 variables, 14412 constraints, and 0 parameters.
(CVXPY) Oct 01 09:28:56 PM: It is compliant with the following grammars: DCP, DQCP
(CVXPY) Oct 01 09:28:56 PM: (If you need to solve this problem multiple times, but with different data, consider using parameters.)
(CVXPY) Oct 01 09:28:56 PM: CVXPY will first compile your problem; then, it will invoke a numerical solver to obtain a solution.
-------------------------------------------------------------------------------
Compilation
-------------------------------------------------------------------------------
(CVXPY) Oct 01 09:28:56 PM: Compiling problem (target solver=MOSEK).
(CVXPY) Oct 01 09:28:56 PM: Reduction chain: Dcp2Cone -> CvxAttr2Constr -> ConeMatrixStuffing -> MOSEK
(CVXPY) Oct 01 09:28:56 PM: Applying reduction Dcp2Cone
(CVXPY) Oct 01 09:29:03 PM: Applying reduction CvxAttr2Constr
/Users/user/venv/lib/python3.11/site-packages/cvxpy/problems/problem.py:157: UserWarning: Objective contains too many subexpressions. Consider vectorizing your CVXPY code to speed up compilation.
warnings.warn("Objective contains too many subexpressions. "
(CVXPY) Oct 01 09:29:03 PM: Applying reduction ConeMatrixStuffing
(CVXPY) Oct 01 09:29:23 PM: Applying reduction MOSEK
(CVXPY) Oct 01 09:29:30 PM: Finished problem compilation (took 3.448e+01 seconds).
-------------------------------------------------------------------------------
Numerical solver
-------------------------------------------------------------------------------
(CVXPY) Oct 01 09:29:30 PM: Invoking solver MOSEK to obtain a solution.
(CVXPY) Oct 01 09:29:30 PM: Problem
(CVXPY) Oct 01 09:29:30 PM: Name :
(CVXPY) Oct 01 09:29:30 PM: Objective sense : maximize
(CVXPY) Oct 01 09:29:30 PM: Type : CONIC (conic optimization problem)
(CVXPY) Oct 01 09:29:30 PM: Constraints : 30767
(CVXPY) Oct 01 09:29:30 PM: Affine conic cons. : 0
(CVXPY) Oct 01 09:29:30 PM: Disjunctive cons. : 0
(CVXPY) Oct 01 09:29:30 PM: Cones : 14412
(CVXPY) Oct 01 09:29:30 PM: Scalar variables : 57648
(CVXPY) Oct 01 09:29:30 PM: Matrix variables : 0
(CVXPY) Oct 01 09:29:30 PM: Integer variables : 0
(CVXPY) Oct 01 09:29:30 PM:
(CVXPY) Oct 01 09:29:30 PM: Optimizer started.
(CVXPY) Oct 01 09:29:30 PM: Presolve started.
(CVXPY) Oct 01 09:29:30 PM: Linear dependency checker started.
(CVXPY) Oct 01 09:29:30 PM: Linear dependency checker terminated.
(CVXPY) Oct 01 09:29:30 PM: Eliminator started.
(CVXPY) Oct 01 09:29:30 PM: Freed constraints in eliminator : 2
(CVXPY) Oct 01 09:29:30 PM: Eliminator terminated.
(CVXPY) Oct 01 09:29:30 PM: Eliminator started.
(CVXPY) Oct 01 09:29:30 PM: Freed constraints in eliminator : 0
(CVXPY) Oct 01 09:29:30 PM: Eliminator terminated.
(CVXPY) Oct 01 09:29:30 PM: Eliminator - tries : 2 time : 0.00
(CVXPY) Oct 01 09:29:30 PM: Lin. dep. - tries : 1 time : 0.00
(CVXPY) Oct 01 09:29:30 PM: Lin. dep. - primal attempts : 1 successes : 1
(CVXPY) Oct 01 09:29:30 PM: Lin. dep. - dual attempts : 0 successes : 0
(CVXPY) Oct 01 09:29:30 PM: Lin. dep. - primal deps. : 2 dual deps. : 0
(CVXPY) Oct 01 09:29:30 PM: Presolve terminated. Time: 0.04
(CVXPY) Oct 01 09:29:30 PM: Optimizer - threads : 10
(CVXPY) Oct 01 09:29:30 PM: Optimizer - solved problem : the primal
(CVXPY) Oct 01 09:29:30 PM: Optimizer - Constraints : 16350
(CVXPY) Oct 01 09:29:30 PM: Optimizer - Cones : 14412
(CVXPY) Oct 01 09:29:30 PM: Optimizer - Scalar variables : 43233 conic : 43233
(CVXPY) Oct 01 09:29:30 PM: Optimizer - Semi-definite variables: 0 scalarized : 0
(CVXPY) Oct 01 09:29:30 PM: Factor - setup time : 0.03
(CVXPY) Oct 01 09:29:30 PM: Factor - dense det. time : 0.00 GP order time : 0.00
(CVXPY) Oct 01 09:29:30 PM: Factor - nonzeros before factor : 4.81e+04 after factor : 6.70e+04
(CVXPY) Oct 01 09:29:30 PM: Factor - dense dim. : 0 flops : 1.09e+06
(CVXPY) Oct 01 09:29:30 PM: ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
(CVXPY) Oct 01 09:29:30 PM: 0 1.0e+00 5.1e+01 1.4e+04 0.00e+00 -1.441036880e+04 1.631204518e+00 1.0e+00 0.10
(CVXPY) Oct 01 09:29:30 PM: 1 2.9e-01 1.5e+01 7.5e+03 -9.59e-01 1.078798811e+03 1.479240959e+04 2.9e-01 0.13
(CVXPY) Oct 01 09:29:30 PM: 2 1.2e-01 6.2e+00 4.4e+03 -8.57e-01 2.904365568e+04 4.144461932e+04 1.2e-01 0.14
(CVXPY) Oct 01 09:29:31 PM: 3 9.0e-02 4.6e+00 3.5e+03 -6.59e-01 4.519531594e+04 5.681332578e+04 9.0e-02 0.15
(CVXPY) Oct 01 09:29:31 PM: 4 2.9e-02 1.4e+00 1.3e+03 -5.31e-01 1.274823813e+05 1.349130385e+05 2.9e-02 0.16
(CVXPY) Oct 01 09:29:31 PM: 5 1.5e-02 7.7e-01 5.6e+02 1.43e-01 1.703792241e+05 1.751587659e+05 1.5e-02 0.17
(CVXPY) Oct 01 09:29:31 PM: 6 2.5e-03 1.3e-01 4.5e+01 4.97e-01 2.294870234e+05 2.304595812e+05 2.5e-03 0.18
(CVXPY) Oct 01 09:29:31 PM: 7 5.4e-04 2.7e-02 4.5e+00 9.50e-01 2.398677055e+05 2.400782648e+05 5.4e-04 0.19
(CVXPY) Oct 01 09:29:31 PM: 8 2.1e-04 1.0e-02 1.1e+00 1.00e+00 2.415629733e+05 2.416436379e+05 2.1e-04 0.20
(CVXPY) Oct 01 09:29:31 PM: 9 1.1e-05 5.4e-04 1.3e-02 1.00e+00 2.425720405e+05 2.425761970e+05 1.1e-05 0.21
(CVXPY) Oct 01 09:29:31 PM: 10 8.6e-08 4.3e-06 9.2e-06 1.00e+00 2.426263978e+05 2.426264310e+05 8.6e-08 0.22
(CVXPY) Oct 01 09:29:31 PM: 11 9.3e-09 4.7e-07 3.3e-07 1.00e+00 2.426267917e+05 2.426267954e+05 9.3e-09 0.23
(CVXPY) Oct 01 09:29:31 PM: 12 1.1e-09 5.8e-08 1.4e-08 1.00e+00 2.426268344e+05 2.426268348e+05 1.1e-09 0.23
(CVXPY) Oct 01 09:29:31 PM: 13 1.9e-10 7.4e-09 6.2e-10 1.00e+00 2.426268397e+05 2.426268397e+05 1.4e-10 0.24
(CVXPY) Oct 01 09:29:31 PM: Optimizer terminated. Time: 0.26
(CVXPY) Oct 01 09:29:31 PM:
(CVXPY) Oct 01 09:29:31 PM:
(CVXPY) Oct 01 09:29:31 PM: Interior-point solution summary
(CVXPY) Oct 01 09:29:31 PM: Problem status : PRIMAL_AND_DUAL_FEASIBLE
(CVXPY) Oct 01 09:29:31 PM: Solution status : OPTIMAL
(CVXPY) Oct 01 09:29:31 PM: Primal. obj: 2.4262683967e+05 nrm: 2e+02 Viol. con: 2e-08 var: 0e+00 cones: 0e+00
(CVXPY) Oct 01 09:29:31 PM: Dual. obj: 2.4262683972e+05 nrm: 4e+02 Viol. con: 0e+00 var: 2e-07 cones: 0e+00
-------------------------------------------------------------------------------
Summary
-------------------------------------------------------------------------------
(CVXPY) Oct 01 09:29:31 PM: Problem status: optimal
(CVXPY) Oct 01 09:29:31 PM: Optimal value: 2.426e+05
(CVXPY) Oct 01 09:29:31 PM: Compilation took 3.448e+01 seconds
(CVXPY) Oct 01 09:29:31 PM: Solver (including time spent in interface) took 2.999e-01 seconds