Created
April 5, 2021 21:10
-
-
Save samirsaci/b5c56548f7c9207a9a66d37a55967634 to your computer and use it in GitHub Desktop.
Models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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