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?