# cvxpy: Code that works for default solver doesn't work for cp.GLPK_MI

The following code works:

import numpy as np
import cvxpy as cp
ci = np.array([10,7,6,3])
x = cp.Variable(len(ci),boolean=True)
objective = cp.Minimize(cp.sum_squares(ci@(2*x-1)))
problm = cp.Problem(objective)
_ = problm.solve()


However, if I pass a larger ci array, it doesn't work. Per recommendation here, I want to try GLPK instead. So, I change the last line:

_ = problm.solve(solver=cp.GLPK_MI)


This leads to the following error:

SolverError: Either candidate conic solvers (['GLPK_MI']) do not support the cones output by the problem (SOC), or there are not enough constraints in the problem.


Is it the way I'm specifying constraints works for the default solver but not for GLMK_MI?

• You can only solve linear problems using GLPK, so GLPK sís imply not applicable to your problem. – ErlingMOSEK Jan 22 '20 at 10:13
• @ErlingMOSEK is correct. Try using Gurobi, CPLEX, or Mosek, if they are available to you. – Mark L. Stone Jan 22 '20 at 13:02
• @MarkLStone any reference on how much they cost? – Rohit Pandey Jan 22 '20 at 17:28
• MOSEK can be used for free for academics. Commercial pricing can be seen at mosek.com/sales/commercial-pricing – ErlingMOSEK Jan 23 '20 at 11:33
• CPLEX and Gurobi both have free academic licenses, which require verification that you are at a degree-granting academic institution. – prubin Sep 1 '20 at 20:04