In previous articles, I modeled and solved a single machine scheduling problem. What if we have two resources that operate in a pre-determined sequence (but not in parallel) to process a set of similar jobs? The so-called “flow shop” scheduling models focus on these situations. It can be production scheduling inside a factory. Or it can be service scheduling between facilities and customers inside a supply chain. Accordingly, flow shop scheduling has numerous applications. In this article, I propose a simple model for flow shop scheduling in Python.
Modeling and solving flow shop scheduling problem in Python
Herein, I code the decision problem according to the following assumptions and regarding the elements of the decision making environment:
- Can not conduct more than one task at a time. (No multi-tasking)
- Have a setup time before starting to conduct any task.
- May not process one job after another immediately (except the first one).
- Operate in a predetermined sequence.
- Have a specific processing time on each machine.
- Have a specific priority (weight) for their completion.
- Are equivalent to a single job (i.e., all tasks consist of one job).
- Follow a predetermined process route.
- Follow the same sequence (permutation) on all machines.
- Starts from zero (for the first machine).
- Is to minimize the total weighted completion time (TWCT) (for jobs that leave the last machine in the sequence).
Herein, I provide a code that models the decision problem, satisfying the mentioned assumptions:
To solve the model, I use the following command:
Fortunately, there are no errors, the status is reported feasible and optimal, and the following results are obtained:
Therefore, the obtained sequence is: 2->4->1->3, which is similar for all machines. Finally, a visualization of the results can be as follows:
In this article, I created a simple and basic model for flow shop scheduling in Python then solved it using PuLP, an interface in Python, which by default uses the open-source CBC solver for integer programming models. If you found the description interesting, let us know by commenting below this article!
If this article is going to be used in research or other publishing methods, you can cite it as Tafakkori (2022) (in text) and refer to it as follows: Tafakkori, K. (2022). Flow shop scheduling with PuLP in Python. Supply Chain Data Analytics. url: https://www.supplychaindataanalytics.com/flow-shop-scheduling-with-pulp-in-python
Industrial engineer focusing on leveraging optimization methods and artificial intelligence technologies using multiple programming languages to empower a business to achieve its goals!