{"id":21293310,"url":"https://github.com/ejw-data/linear-programming-production-scheduling","last_synced_at":"2025-03-15T16:44:28.620Z","repository":{"id":182392362,"uuid":"668378500","full_name":"ejw-data/linear-programming-production-scheduling","owner":"ejw-data","description":"Examples of Linear Programming (LP) optimizations","archived":false,"fork":false,"pushed_at":"2024-02-18T19:54:51.000Z","size":1327,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T06:47:00.615Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ejw-data.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-07-19T17:00:34.000Z","updated_at":"2023-09-10T18:34:08.000Z","dependencies_parsed_at":"2024-02-18T20:52:25.820Z","dependency_job_id":null,"html_url":"https://github.com/ejw-data/linear-programming-production-scheduling","commit_stats":null,"previous_names":["ejw-data/algo-linear-programming","ejw-data/linear-programming-production-scheduling"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejw-data%2Flinear-programming-production-scheduling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejw-data%2Flinear-programming-production-scheduling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejw-data%2Flinear-programming-production-scheduling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejw-data%2Flinear-programming-production-scheduling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ejw-data","download_url":"https://codeload.github.com/ejw-data/linear-programming-production-scheduling/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243762236,"owners_count":20343976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T13:54:16.011Z","updated_at":"2025-03-15T16:44:28.598Z","avatar_url":"https://github.com/ejw-data.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# linear-programming-production-scheduling\n\nAuthor:  Erin James Wills, ejw.data@gmail.com  \n\n![Linear Programming](./images/linear-programming.png)  \n\n\u003ccite\u003ePhoto by \u003ca href=\"https://unsplash.com/@marcinjozwiak?utm_source=unsplash\u0026utm_medium=referral\u0026utm_content=creditCopyText\"\u003eMarcin Jozwiak\u003c/a\u003e on \u003ca href=\"https://unsplash.com/s/photos/logistics?utm_source=unsplash\u0026utm_medium=referral\u0026utm_content=creditCopyText\"\u003eUnsplash\u003c/a\u003e\u003c/cite\u003e\n\n\u003cbr\u003e\n\n## Overview  \nThis repo contains linear programming examples of production scheduling and distribution using Excel and Python.  These activities are largely from a Udemy course on `Data Science and Supply Chain Analytics with Python`.  Part of my interest in doing these activities was to improve the content of the course - many of the examples were not well structured and even had errors.   To make the examples provided more error resistent, I converted the examples to Python using PuLP.    \n\nThese particular topics interest me since it is very similar to chemical production problems where raw materials must be allocated to production facilities based on the demand, product margin, and storage and distribution limits.  The level of complexity that can be accounted for in these problems is quite amazing expecially when blending solutions for forecasting, linear optimization, and discrete event simulations.   I might add a combination of those technologies into a solution in the next update.  \n\n## Examples  \nBelow is an example of a class activity of a basic production scheduling problem.  The activity was not very well organized so I modified it to be more understandable.  \n![Original Basic Optimization](./images/original-basic-sceduling.png)  \n\nHere is what the modified version looks like.  The inputs are color coded and constraints clearly labeled.  \n![Organized Basic Optimization](./images/organized-basic-sceduling.png)  \n\nA screen shot of the advanced homework solution is below but upon reviewing the image, it is obvious the constraints were not appropriately set.    \n![Original Advanced Optimization](./images/original-adv-scheduling.png)   \nBelow is the modified version that has contraints that meet the problem statement and is organized to more clearly see the relationships among the tables.  \n![Organized Advanced Optimization](./images/organized-adv-scheduling.png)  \n\nAlthough Excel Solver is a popular tool for these type of linear programming problems, much of the setup requires not making any mistakes in setting up the relationships in the spreadsheet and the relationships are hidden witin the cell equations.  I moved the problems to Python and using PuLP to create a much more readable and understandable model.  In addition, I am modifying the code to use pandas dataframes as the source data so additional data exploration can be easily accomplished during analysis.  \n\nAdditional features will be added but as of the latest revision, about 85% of the expanded content has been completed and all the fundamental content is complete.  \n\n## Repo Contents  \n\n### Excel Simulations  \n1.  `constrained-linear-equations.xlsx` - Selecting product quantity to produce maximize profits and keeping with raw material inventory.\n1.  `transportation-goods.xlsx` - Selecting factory production and shipments of each product to each country while minimizing cost, meeting demand, and not exceeding factory capacity.  \n1.  `adv-transportation-goods.xlsx` - Selecting factory production, distribution center, and shipments of each product to each country while minimizing cost, meeting demand, and not exceeding factory capacity.  \n1.  `production-scheduling.xlsx` - Determining production and inventory amounts based on minimizing operational expenses while operating within production capacity and at least meeting demand.\n\n\u003cbr\u003e\n\n### Python Simulations  \n1.  `linear-optimization.ipynb` - Python PuLP library version of the Excel `constrained-linear-equations.xlsx`\n1.  `linear-optimization-shipping.ipynb` - Python PuLP library version of the Excel `transportation-goods.xlsx`\n1.  `linear-optimization-shipping-pandas.ipynb` - modified version of `linear-optimization-shipping.ipynb` that utilizes pandas dataframes to access data instead of generating lists.\n1.  `linear-optimization-adv-shipping-pandas.ipynb` - work in progress  \n1.  `production-scheduling.ipynb` - Python PuLP library version of Excel `production-scheduling.xlsx`\n1.  `production-scheduling-sensitivity.ipynb` - modified version of `production-scheduling.ipynb` that allows for a list of any any user supplied variable to be substituted.  The outcomes are plotted on to allow easy analysis of the effects of variable changes.  \n  \n\n### Technologies\n* Excel\n* Python PuLP\n### Improvements\n* add visualization of Excel and Python answers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fejw-data%2Flinear-programming-production-scheduling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fejw-data%2Flinear-programming-production-scheduling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fejw-data%2Flinear-programming-production-scheduling/lists"}