I am currently trying to use lpsolve55 (lpsolve Python Interface version 5.5.0.9
using lpsolve version 5.5.2.11) to see if it gives a better performance than PULP_CBC_CMD for my Linear Programming (LP) problem.
However, I kept running into the weird error of Invalid vector, when I tried to add a constraint with a numeric list of length 230 (entries are of dtype=float64). I am not sure how to fix it, but when I read this documentation (https://web.mit.edu/lpsolve/doc/Python.htm), it does say something like "Matrices with too few or too much elements gives an 'invalid vector.' error." I don't think a list of length 230 should be called "too much elements." I did add a constraint successfully with a list of size 7800, in exactly the same manner. So I am not sure what is going on with lpsolve55 package.
For example, the following line is successful:
lp.lpsolve('add_constraint', problem, coeffs, 'LE', per['max'])
where coeffs is a list containing 7000 floating numbers, and per['max'] is just another floating number.
The second constraint prompts the error lpsolve.error: invalid vector.
lp.lpsolve('add_constraint', problem, y, 'LE', rhs_max)
where y is a list of only 230 floating numbers, rhs_max is just another floating number
Question. Is it because lpsolve55 is not designed to solve a large-scale LP problem with potentially 1000+ variables in the objective function?
I tried everything I could think of (e.g. using np.array rather than list, or try to replace y with y[0:10]). Nothing worked.