I have to write a linear program for the following problem:
We have three products that are made in a factory:
A, B and C, we are given the amount of energy every product needs (A ~ 1kWh, B ~ 2kWh, C ~ 10 kWh) to be made, final profit of each product ( A ~20£, B ~ 50£ and C ~ 100£) and time of production for a particular product (A ~0.5hour, B ~ 1 hour, C ~ 2hours). A factory must pay 18£ for 60 kWh no matter whether they consume it or not but if it consumes more it has to pay 0.1£ per every additional kWh. Write optimization problem for this task for maximum profit of the factory. Factory works for 23 hours, after that machines are shut down and all products are sold. What is the maximum profit of the factory?
So how do you write an optimization problem for this? The part that bothers me is how to know how much will the factory pay for additional electricity, therefore I dont know how to write the function for optimum as you would need an if statement: if the amount of electricity is lower than 60kWh you would just subtract 18£ from the maximum profit, else you would add 0.1*p where p is the amount of additional kWh they consumed, but how do you translate this to optimization problem, or maybe I need to write max(min()) problem somehow (min form minimum electricity consumed and maximum for max profit) . I understand the theory behind optimization problem but am new to this and just need a little help. Thank you for your answers.
I think you can do this by introducing decision variables $u$ and $v$ that indicate, respectively, the amount of energy used up to 60 kWh and the amount of energy used beyond 60 kWh. The following constraints will do the trick: $$\begin{align} u + v & = p_A + p_B + p_C \\ u & \le 60, \end{align}$$ where $p_i$ is the energy used by factory $i$. Then the objective function uses the term $$18 + 0.1v.$$ The first term represents the fixed cost of 18£ while the second represents the per-unit cost of 0.1£ per kWh in excess of 60.
Note that $u$ will always be "used up" before we start to use $v$, since energy contained in $u$ is "free" in the objective function, while energy in $v$ incurs a cost.