Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Created April 5, 2021 21:10
Show Gist options
  • Select an option

  • Save samirsaci/b5c56548f7c9207a9a66d37a55967634 to your computer and use it in GitHub Desktop.

Select an option

Save samirsaci/b5c56548f7c9207a9a66d37a55967634 to your computer and use it in GitHub Desktop.
Models
# Initialize Model
model = LpProblem("Minimize Staffing", LpMinimize)
# Create Variables
start_jours = ['Shift: ' + i for i in jours]
x = LpVariable.dicts('shift_', n_days, lowBound=0, cat='Integer')
# Define Objective
model += lpSum([x[i] for i in n_days])
# Add constraints
for d, l_excl, staff in zip(n_days, list_excl, n_staff):
model += lpSum([x[i] for i in n_days if i not in l_excl]) >= staff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment