Trying to answer this question:

A factory produces chocolate and candy. In order to produce 100 kilograms of chocolate, the factory has to use machine A for 1 hour, machine B for 4 hours, and machine C for 2 hours. In order to produce 100 kilograms of candy, the factory has to use machine A for 2 hours, machine B for 1 hour, and machine C for 1 hour. The factory will earn 5 pounds for each kilogram of chocolate it produces and 3 pounds for each kilogram of candy it produces. Machine A and machine B belong to the factory and can be run for free 24 hours a day. However machine C is rented from a different company and can only be run up to 16 hours a day and costs 20 pounds for each hour it is run. Write down an LP model to maximize the factory profit per day. Explain what each of the variables in the LP formulation means.

Initially I had

$max z = 5x_1 + 3x_2$

$x_1 + 2x_2 \leq 24$ // machine A

$4x_1 + x_2 \leq 24$ // machine B

$2x_1 + x_2 \leq 16$ // machine B

$x_1, x_2, x_3 \geq 0$

However, I then realised that machine C costs £20 for every hour it is used, which affects the objective function. Been looking at this for a while and still can't figure out how to formulate this, any ideas? Would be highly appreciated.

edit: Should the objective function have something like $-20x_3$ at the end? Where $x_3$ is the number of hours machine C runs for




introducing a dummy varaible $t$.

Objective function:

add term $-20t $ to the function


Replacing the last constraint w.r.t. Machine C with \begin{align} t \leq 16 \\ 2x_1 + 1x_2 \leq t \\ t\geq 0. \end{align} Done !


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.