0

I have the following linear program that keeps evaluating all solutions to zero. Which additional constraints could I add to force $x>0$ or $y>0$ or both $z,y>0$?

\begin{equation*} \begin{aligned} & \underset{f}{\text{min}} & & f(x,y,z) = 0.23x + 0.05y - 0.03z \\ & \text{s.t.} & & x + y \le 7400 \\ &&& -x + z \ge -6500 \\ &&& -y - z \ge 0 \\ &&& z \le 0 \\ &&& x,y \ge 0 \end{aligned} \end{equation*}

The idea is that the optimizer support all 3 cases:

  • if $y=0$ and $z=0$ then $x>0$
  • if $x=0$ then $y>0$ and $z<0$
  • if $x>0$ and $y>0$ and $z<0$ then $x+y \le 7400$

Using SciPy's linprog

c = [0.23, 0.05, -0.03]
A_ineq = [[1, 1, 0], [1, 0,-1], [0, 1, 1]]
b_ineq = [7400, 6500, 0]
bnds = ((0, None), (0, None), (None, 0))
res = linprog(c, A_ub=A_ineq, b_ub=b_ineq, bounds=bnds, method='simplex')
print(res)

```
  • 1
    You can make an edit of your post. And I don´t understand what do you mean by"$\textit{... that keeps evaluating all solutions to zero}"$. – callculus42 May 21 '20 at 16:07
  • You have found an optimal solution, right? What more do you expect? If you want a variable to be nonnegative, just set it to an arbitrarily small positive number. – LinAlg May 21 '20 at 20:43
  • (1) Edit your post to correct the error (the edit link is on the left, opposite your name glyph at the bottom.) Also, get rid of "Z =" from the "min Z = ..." line. It is nonsensical, since $Z$ is a different variable. (2) $(0,0,0)$ pretty clearly is the unique minimum for your problem. If you want something different, you will have to reshape your domain to not include that point. What would be the appropriate additional constraint depends on what the purpose of this problem is. We don't know that, so we can't answer for you. – Paul Sinclair May 22 '20 at 00:24
  • You are right, the linear program does what it is specified to do. The purpose of the problem is to find the cheapest combination of $x,y,z$ to obtain $b_x$ in [5000, 7400] and $b_y$ [-6500, -5000]. Either using $x$ or $y$ and $z$ to reach the objective, ensuring that $b_z$ is always or close to zero. – user751978 May 22 '20 at 10:27

0 Answers0