Search code examples
mathematical-optimizationlinear-programminglpsolve

Is there a way add constraint like x(y+z)<0 in LpSolve?


I want to add constraints like

0.2(x1+x2+y1+y2+900)>=1;

in LpSolve but i've got Parse error. i've tried to like but still got error:

0.2*(x1+x2+y1+y2+900)>=1;

How should I specify for .lp format? Thank you.


Solution

  • You can use:

    0.2*x1 + 0.2*x2 + 0.2*y1 + 0.2*y2 + 180 >=1;
    

    And it should work. (That is, perform the distributive multiplication manually.) A modeling language like JuMP or CVXPY would handle this automatically.