# optimizing contractor schedules - operations research linear programming

I am facing the below problem

I know for each week how many workers that I need. I need to ensure that for a given week I have workers more than or equal to what I need.

week    workers_required
ww01    5
ww02    2
ww03    1
ww04    6
ww05    2
ww06    10
ww07    2
ww08    1
ww09    0
ww10    9


I also know what are different contracts that my supplier offers. Longer the contract, lesser is the cost per week. For example, if I sign a 1 week contract it costs me 50/week but if I sign 5 week contract it costs me 35/week.

1 contract is for 1 worker.

contract    cost
1 week          50
2 week          80
5 week          175
10 week         300


I can sign any number of contracts. Moreover, I can sign a contract and then extend it at the same weekly rate. For example I can sign a 5 week contract and extend it for any number of weeks at the cost of 35/week.

My objective is to spend minimum

I would like to find how many and what type contracts should I sign and when should I start them

How could I set up my problem? I am planning to use R lpsolve package or in Excel using opensolver or whats best.

+++++++++++++++++++++++update1

I am not exactly sure about the mathematical reason. But I feel that I can solve this problem one worker at a time and still get the optimum solution. In the below case how could I frame the problem? I know that the solution here is going to be buy a 10 week contract and let a worker sit idle in ww09. But how could I formulate the problem and solve it mathematically?

1. I can start any number of contracts. But i pay for them immediately
2. Number of active contracts per week should be more than or equal to workers required in that week
3. My goal is to minimize the cost

contract cost

1 week          50
2 week          80
5 week          175
10 week         300


1 worker is required in ww1 to ww10 except week 9. Week 9 requires 0 workers