0

A construction company has 6 projects, for each they need $d_i$ workers. The company has no workers at the beginning of project 1.

Each new worker must take a safety course that costs 300, and 50 more for each worker. If there is no new worker there is no course.

Firing a worker does not cost any money, and a workers can't be rehired.

Given that the salary of a worker is 100 per project, formulate a linear programming problem that minimizes the workers costs.

What I tried:

Let $x_i$ be the number of new workers for project $i$.

Let $y_i$ be the number of old workers remaining from previous projects until project $i$ (all the workers hired - all the workers that were fired)

Let $z_i$ be an indicator such that $z_i =0 \iff x_i>0$

The function I'm trying to solve is:

$\min(\sum_{i=1}^6 150x_i + 300(1-z_i) + 100y_i)$

s.t:

\begin{align}
x_i,y_i,z_i &\ge 0 \\
z_i &\ge 1-x_i \\
y_i + x_i &\ge d_i \\
y_i &\ge y_{i-1} + x_i
\end{align}

Something feels not right to me. The main reason is that I tried to use matlab to solve this and it failed.

What did I do wrong? How can I solve this question?

1 Answers1

1

When I see this correctly you have two small mistakes in your constraints.

The first appears when you use z_i >= 1-x_i. This allows z_i to take the value 1 all the time, which will never give you the extra cost of 300. You need to upper bound z_i such that z_i will not be 1 when you have x_i>0. For this constraint you need something called big M. For sufficiently large M you would then use z_i <= 1-x_i/M. This way when x_i=0 you can have z_i=1, otherwise the right hand side is smaller than 1 and due to integrality z_i has to be zero. Note that you usually want to choose M as tight as possible. So in your case d_i might be a good choice.

The second small mistake lays in y_i >= y_{i-1} + x_i. This way you can increase y_i over y_{i-1} without having to set any x_i. To force x_i to increase you need to flip the inequality. Additionally by the way you defined y_i this inequality should refer to x_{i-1}. Thus you should end up with y_i <= y_{i-1} + x_{i-1}. Additionally you need to take care of corner cases (i.e. y_1 = 0)

I think with these two changes it should work. Let me know whether it helped you. And if it still doesn't work I might have missed something.

SimonT
  • 483
  • 3
  • 8