## 16.5  Exercise

A company produces two types of products T1 and T2, which requires the following resources to produce each unit of the product:

 Resource T1 T2 Labour (hours) 9 6 Pumps (units) 1 1 Tubing (m) 12 16

The amount of profit per unit of products are:

T1
£350
T2
£300

They have the following resources available: 1566 hours of labour, 200 pumps, and 2880 metres of tubing.

1. Write a program to maximise the profit for the company, using eplex as a black box solver. Write a predicate that returns the profit and the values for T1 and T2.
2. What program change is required to answer this question: What profit can be achieved if exactly 150 units of T1 are required?
3. What would the profit be if fractional numbers of refrigerators could be produced?
4. Rewrite the program from (1) without optimize/2, using eplex_solver_setup/1, eplex_solve/1, and eplex_var_get/3.
5. In the program from (4), remove the integrality constraints (so that eplex only sees an LP problem). Solve the integer problem by interleaving solving of the LP problem with a rounding heuristic:
• solve the continuous relaxation
• round the solution for T1 to the nearest integer and instantiate it Initially just return the maximum profit value.
• re-solve the new continuous relaxation
• round the solution for T2 to the nearest integer and instantiate it
• re-solve the new continuous relaxation

What is the result in terms of T1, T2 and Profit?

6. Rewrite the program from (5) using eplex_solver_setup/4 and automatic triggering of the solver instead of explicit calls to eplex_solve/1. The solver should be triggered whenever variables get instantiated.