MulaiMulai sekarang secara gratis

Scheduling workers problem

You are looking to hire workers to work in a warehouse. Each worker is expected to work 5 consecutive days and then have two days off. The chart below has the estimated number of workers you will need each day. You are looking to hire the minimum number of workers to handle the workload for each day.

Expected Workload

Day of Week Employees Needed
0 = Monday 31
1 = Tuesday 45
2 = Wednesday 40
3 = Thursday 40
4 = Friday 48
5 = Saturday 30
6 = Sunday 25
  • The pulp module has been imported and the model has been initialized for you. Also, the variable days has been defined for you as a list of number from 0-6.

Latihan ini adalah bagian dari kursus

Supply Chain Analytics in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# The class has been initialize, and days defined
model = LpProblem("Minimize Staffing", LpMinimize)
days = list(range(7))

# Define Decision Variables
x = LpVariable.dicts('staff_', ____, lowBound=0, cat=____)
Edit dan Jalankan Kode