1
$\begingroup$

I'm given the following linear programming problem:

There are 2 different companies that a firm can invest in: Company A and Company B. These investments yield returns based on how much is invested, as follows:

  • For Company A,

    • $0$ return for investment $< 10M$

    • $1 \rm{M}$ return for $10 \rm{M} \leq$ investment $< 20 \rm{M}$

    • $1.5 \rm{M}$ return for $20 \rm{M} \leq$ investment $< 30 \rm{M}$

    • $1.7 \rm{M}$ return for $30 \rm{M} \leq$ investment

  • For Company B,

    • $0$ return for investment $< 15 \rm{M}$
    • $2 \rm{M}$ return for $15 \rm{M} \leq$ investment $< 30 \rm{M}$
    • $2.5 \rm{M}$ return for $30 \rm{M} \leq$ investment

You are given a budget of $\$ 50 \rm{M}$. Find the optimal set of investments to make to maximize return.


I know this is a pretty trivial example, but I'm trying to figure out how to frame it mathematically. My approach was to break out the different investment ranges for each company into separate decision variables, and then add binary variables so that we can make those investment ranges mutually exclusive (for example, you cannot invest make 2 separate investments into a company). Here's what I have so far.


Objective function

\begin{align*} 0P_1 + P_2 + 1.5P_3 + 1.7P_4 + 0P_5 + 2P_6 + 2.5P_7 &= Z \ \end{align*}

Constraints

\begin{align*} P_1 + P_2 + P_3 + P_4 + P_5 + P_6 + P_7 &\leq 50 \ \end{align*}

\begin{align*} P_1 &\geq 0 \ \end{align*}

\begin{align*} P_1 &< 10 \ \end{align*}

\begin{align*} P_2 &\geq 10 \ \end{align*}

\begin{align*} P_2 &< 20 \ \end{align*}

\begin{align*} P_3 &\geq 20 \ \end{align*}

\begin{align*} P_3 &< 30 \ \end{align*}

\begin{align*} P_4 &\geq 30 \ \end{align*}

\begin{align*} P_5 &\geq 0 \ \end{align*}

\begin{align*} P_5 &< 15 \ \end{align*}

\begin{align*} P_6 &\geq 15 \ \end{align*}

\begin{align*} P_6 &< 30 \ \end{align*}

\begin{align*} P_7 &\geq 30 \ \end{align*}

\begin{align*} P_1 &\leq M_1y_1 \text{ such that } y_1 \text{ is a binary variable and } M_1 \text{ is a very large number } > 1e10 \ \end{align*}

\begin{align*} P_2 &\leq M_2y_2 \text{ such that } y_2 \text{ is a binary variable and } M_2 \text{ is a very large number } > 1e10 \ \end{align*}

\begin{align*} P_3 &\leq M_3y_3 \text{ such that } y_3 \text{ is a binary variable and } M_3 \text{ is a very large number } > 1e10 \ \end{align*}

\begin{align*} P_4 &\leq M_4y_4 \text{ such that } y_4 \text{ is a binary variable and } M_4 \text{ is a very large number } > 1e10 \ \end{align*}

\begin{align*} P_5 &\leq M_5y_5 \text{ such that } y_5 \text{ is a binary variable and } M_5 \text{ is a very large number } > 1e10 \ \end{align*}

\begin{align*} P_6 &\leq M_6y_6 \text{ such that } y_6 \text{ is a binary variable and } M_6 \text{ is a very large number } > 1e10 \ \end{align*}

\begin{align*} P_7 &\leq M_7y_7 \text{ such that } y_7 \text{ is a binary variable and } M_7 \text{ is a very large number } > 1e10 \ \end{align*}

\begin{align*} y_1 + y_2 + y_3 + y_4 &\leq 1 \ \end{align*}

\begin{align*} y_5 + y_6 + y_7 &\leq 1 \end{align*}


The problem is, when I implement this in Python (using PuLP), it tells me that the problem is infeasible. What's wrong with my formulation here?

$\endgroup$
2
  • $\begingroup$ Have a look to this suggestion. Give a reply if something is unclear. $\endgroup$ Commented Apr 6, 2023 at 22:13
  • $\begingroup$ Suggestion looks promising, but in that example, what about if z depends on both x and y? Are they just added together? $\endgroup$ Commented Apr 6, 2023 at 23:46

3 Answers 3

1
$\begingroup$

You have positive lower bounds on five of the seven $P_i$ variables, so your big-M constraints force at least five $y_i=1$. But your final two constraints allow at most two $y_i=1$, so your formulation is indeed infeasible.

$\endgroup$
1
  • $\begingroup$ Ahh nice catch. However, if I modify the lower bounds to be 0 for the P variables, that leaves the solver open to picking a number between 0 and the former lower bound, which I don't want. $\endgroup$ Commented Apr 7, 2023 at 5:51
1
$\begingroup$

Replace your long list of bounds with either
$ 0 \le p_2 \le 10y_1$
$ 10y_2 \le p_2 \le 20y_2$ and so on.
Or
$ 10y_2+20y_3 + 30(1-y_1-y_2-y_3)\le p_1 \le 10y_1+20y_2+30y_3$
$ y_1+ y_2+y_3 \le 1$ where $p_1$ is investment for company 1. Similarly for company 2.

$\endgroup$
1
$\begingroup$

You really only need the binary variables (and your objective function is wrong). According to the wording of the problem, for an investment between \$10M and \$20M in A, you earn \$1M, not $\$1M \times P_2.$ If the returns are constant within intervals, you might as well invest the minimum amount that qualifies for whichever intervals you pick.

So the "rational" investment possibilities for A are 0, 10, 20 or 30 (which will correspond to binary variables $y_1,\dots,y_4)$ and the "rational" possibilities for B are 0, 15 or 30 (corresponding to binary variables $y_5, \dots, y_7).$ Your last two constraints remain correct, and you can easily frame the objective function and budget constraints in terms of the binary variables.

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.