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
| ax = df_par.plot(x='%SKU', y='%CumSum', figsize = (20,7.5)) | |
| plt.xlabel('Percentage of SKU (%)',fontsize=15) | |
| plt.ylabel('Percentage of Boxes Ordered (%)',fontsize=15) | |
| plt.title('Pareto Analysis using Cumulative Sum of Boxes Prepared (%) = f(%SKU)', fontsize = 15) | |
| plt.show() |
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
| # > 80% Volume | |
| df_par80 = df_par[df_par['%CumSum'] > 80].copy() | |
| perc_sku80 = df_par80['%SKU'].min() | |
| perc_sum80 = df_par80['%CumSum'].min() | |
| # 20% SKU | |
| df_sku20 = df_par[df_par['%SKU'] > 20].copy() | |
| perc_sku20 = df_sku20['%SKU'].min() | |
| perc_sum20 = df_sku20['%CumSum'].min() |
We can't make this file beautiful and searchable because it's too large.
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
| DATE FORMAT ORDER_NUMBER SKU PCS | |
| 01/01/2017 835220 290731 1.0 | |
| 01/01/2017 835220 373272 1.0 | |
| 01/01/2017 835214 362101 1.0 | |
| 01/01/2017 835215 215515 1.0 | |
| 01/01/2017 835215 287995 1.0 | |
| 01/01/2017 835215 310751 1.0 | |
| 01/01/2017 835215 331543 1.0 | |
| 01/01/2017 835212 159789 1.0 | |
| 01/01/2017 835209 309851 1.0 |
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
| import pandas as pd | |
| from pulp import * # pip install pulp | |
| import matplotlib.pyplot as plt | |
| from itertools import chain, repeat | |
| def ncycles(iterable, n): | |
| "Returns the sequence elements n times" | |
| return chain.from_iterable(repeat(tuple(iterable), n)) | |
| # Staff needs per Day |
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]) |
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
| # Solve Model | |
| model.solve() | |
| # The status of the solution is printed to the screen | |
| print("Status:", LpStatus[model.status]) | |
| # How many workers per day ? | |
| dct_work = {} | |
| for v in model.variables(): | |
| dct_work[int(v.name[-1])] = int(v.varValue) |
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
| Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | ||
|---|---|---|---|---|---|---|---|---|
| Shift: Monday | 14 | 14 | 14 | 14 | 14 | 0 | 0 | |
| Shift: Tuesday | 0 | 14 | 14 | 14 | 14 | 14 | 0 | |
| Shift: Wednesday | 0 | 0 | 8 | 8 | 8 | 8 | 8 | |
| Shift: Thursday | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| Shift: Friday | 13 | 13 | 0 | 0 | 13 | 13 | 13 | |
| Shift: Saturday | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| Shift: Sunday | 4 | 4 | 4 | 4 | 0 | 0 | 4 |
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
| Days | Staff Demand | Staff Supply | Extra_Ressources | |
|---|---|---|---|---|
| Monday | 31 | 31 | 0 | |
| Tuesday | 45 | 45 | 0 | |
| Wednesday | 40 | 40 | 0 | |
| Thursday | 40 | 40 | 0 | |
| Friday | 48 | 49 | 1 | |
| Saturday | 30 | 35 | 5 | |
| Sunday | 25 | 25 | 0 |
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
| # Count Machines | |
| machines_count = 1 + max(task[0] for job in jobs_data for task in job) | |
| print("{:,} machines".format(machines_count)) | |
| all_machines = range(machines_count) | |
| # Computes horizon dynamically as the sum of all durations. | |
| horizon = sum(task[1] for job in jobs_data for task in job) | |
| print("Total Time using Naive Solution: {} min".format(horizon)) | |
| # Named tuple to store information about created variables |
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
| # Add Constraints: No Overlapping of tasks for the same machine | |
| # Create and add disjunctive constraints. | |
| for machine in all_machines: | |
| model.AddNoOverlap(machine_to_intervals[machine]) | |
| # Precedences inside a job: End Time of Step n is before starting time of Step n+1 | |
| for job_id, job in enumerate(jobs_data): | |
| for task_id in range(len(job) - 1): | |
| model.Add(all_tasks[job_id, task_id + | |
| 1].start >= all_tasks[job_id, task_id].end) |