Question

I do not understand how to set free variables in a LP problem that I am trying to solve with lp_solve and the Java wrapper.

I use the method

public void setUnbounded(int colnr) throws LpSolveException

that from javadocs should "set if the variable is free".

However when I call it before solving the LP I get the error

lpsolve.LpSolveException: ERROR in set_unbounded: status = -1 (Model has not been optimized)

Any clues on what does "Model has not been optimized" mean? If I am not mistaken I should set the free variables before solving the LP. Am I right?

Was it helpful?

Solution

I found the problem. I was trying to set the column #0 which corresponds to the value of the objective function. The mistake was due to the fact that by printing the LP (with printLp()) the column #0 was hidden for clarity.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top