Hello! In our last session, we saw how the Shortest Processing Time (SPT) rule is optimal for minimizing the average flow time in a single-stage process. However, we also noted that for a single "machine," the sequence of jobs doesn't change the total time required to complete all of them—the makespan.
Today, we move to a more complex and realistic scenario where tasks have multiple stages. Our focus will be on applying Johnson’s Rule to sequence a series of poses across two 'workstations' (e.g., 'styling' and 'shooting') to minimize the total time to complete the series (makespan). This is a powerful technique for optimizing flow-shop environments, where every job must pass through the same sequence of processes. You'll see how, unlike with a single machine, the order of jobs becomes critical for minimizing the total project duration.
The Two-Workstation Sequencing Problem
Imagine your boudoir photoshoot. Each "look" or "pose set" isn't a single monolithic task. It's a sequence: first, the model gets styled for the look, and second, the photos for that look are shot.
- Job: A specific outfit-pose combination (e.g., Job A: "Silk Robe, Window Poses").
- Workstation 1 (M1): "Styling". This includes changing, makeup and hair adjustments, and setting up specific props for the look. Let's call its duration for job .
- Workstation 2 (M2): "Shooting". The time spent with the photographer capturing the images for that look. Let's call its duration for job .
The critical constraint is that a job cannot begin at M2 (Shooting) until it has finished at M1 (Styling). Also, each workstation can only handle one job at a time. The goal is to find the single sequence of jobs that minimizes the time the last job finishes on M2. This total time is the makespan.
The key to minimizing makespan is to minimize the idle time on the second workstation, M2. This idle time occurs whenever M2 is free, but the next job isn't done with M1 yet. To build an intuition for how to achieve this, let's explore the core logic.
Some Notes on Johnson's Algorithm For Scheduling
This document provides an excellent, non-mathematical explanation of the thinking behind Johnson's rule. It uses a simple example to build the core insights.
Please read the first part of the document, starting from the section Two Machine Cases. Focus on the two key observations about how to schedule jobs to avoid idle time on the second machine.
As the reading suggests, the logic revolves around two simple but powerful ideas:
- To get M2 started as early as possible, the first job in the sequence should have a short processing time on M1.
- To ensure M2 finishes quickly after M1 is done, the last job in the sequence should have a short processing time on M2.
Johnson's Rule is the elegant algorithm that extends this intuition to the entire sequence of jobs.
Johnson's Rule: The Algorithm
Johnson's algorithm provides a simple, provably optimal method for sequencing N jobs through two machines. The procedure systematically builds the optimal sequence from the outside in.
Some Notes on Johnson's Algorithm For Scheduling
Now let's look at the formal, step-by-step procedure derived from the intuition we just built. This resource lays it out clearly.
Read the section that begins just after the P1-P2-P3 example. Start from the formal statement of the algorithm, Johnson's Algorithm. Follow the worked example with six parts to see how the two lists, L1 (for the front of the sequence) and L2 (for the back), are constructed.
To summarize the procedure:
- List the processing times for all jobs on both workstations (M1 and M2).
- Find the shortest processing time in the entire list.
- If the shortest time is for M1: Schedule that job as early as possible (i.e., add it to the front of your sequence).
- If the shortest time is for M2: Schedule that job as late as possible (i.e., add it to the end of your sequence).
- Remove the scheduled job from consideration.
- Repeat steps 2-5 until all jobs are scheduled.
If there's a tie for the shortest time, you can break it arbitrarily if the times are on different machines. If they are on the same machine, the theory offers tie-breaking rules, but for practical purposes, any choice will yield an optimal makespan.
Worked Example: Sequencing the Photoshoot
Let's apply this to a boudoir photoshoot with four distinct "looks."
| Job (Outfit-Pose Set) | M1: Styling Time (min) | M2: Shooting Time (min) |
|---|---|---|
| A: Lace Teddy | 10 | 25 |
| B: Silk Robe | 5 | 15 |
| C: Leather Harness | 20 | 8 |
| D: Body Chain | 12 | 30 |
Let's build the optimal sequence, which starts as four empty slots: [ _ , _ , _ , _ ]
- Step 1: The shortest time overall is 5 minutes for Job B on M1. Since it's on M1, we place Job B at the front.
- Sequence:
[ B , _ , _ , _ ]
- Sequence:
- Step 2: We remove Job B. The shortest remaining time is 8 minutes for Job C on M2. Since it's on M2, we place Job C at the end.
- Sequence:
[ B , _ , _ , C ]
- Sequence:
- Step 3: We remove Job C. The shortest remaining time is 10 minutes for Job A on M1. Since it's on M1, we place it in the next available "front" slot.
- Sequence:
[ B , A , _ , C ]
- Sequence:
- Step 4: Only Job D remains. It fills the last slot.
- Optimal Sequence:
[ B , A , D , C ]
- Optimal Sequence:
Visualizing the Makespan with a Gantt Chart
Now, let's verify that this sequence minimizes makespan by mapping it out.
Sequence: B → A → D → C
| Job | M1 Start | M1 End | M2 Start | M2 End |
|---|---|---|---|---|
| B | 0 | 5 | 5 | 20 |
| A | 5 | 15 | 20 | 45 |
| D | 15 | 27 | 45 | 75 |
| C | 27 | 47 | 75 | 83 |
The makespan for this sequence is 83 minutes.
Notice how M2 starts at time 5 (as soon as B is done with styling). M2 then works continuously until Job A is done. It has no idle time until after Job A, because the next job (D) isn't ready from styling until time 27, while M2 is free at 45. Then it has to wait for C. A Gantt chart makes this flow clear.

For your reference, the mathematical proof of why this algorithm is optimal involves demonstrating that any swap of adjacent jobs in a Johnson-sequenced schedule cannot reduce the makespan. Given your background in OR, you might find the formal derivation interesting.
Scheduling jobs on two machines
This resource from cp-algorithms.com provides a more formal construction of the algorithm, deriving the rule from the goal of minimizing idle time.
Focus on the section Construction of the algorithm. This part explains how minimizing total idle time leads to a specific comparator for sorting jobs. Then, read how this comparator is simplified into the practical rule we've been using in the paragraph that follows, simplifying the sorting.
Application to Hotwife Intimacy
We can frame a sequence of intimate activities with your bull as a similar two-stage process, allowing you to optimize the "flow" of an entire encounter.
- Jobs: A set of desired intimate activities for an encounter.
- Workstation 1 (M1): "Ramp-up". The time and effort needed for mental and emotional preparation, foreplay, or setting the scene for a specific activity.
- Workstation 2 (M2): "Main Event". The duration of the core activity itself.
Let's say you're planning an evening with three main desired activities:
- Job A: Deep Conversation. (Ramp-up: 20 min, Main Event: 40 min)
- Job B: Shared Massage. (Ramp-up: 5 min, Main Event: 25 min)
- Job C: Intense, specific roleplay. (Ramp-up: 15 min, Main Event: 10 min)
Applying Johnson's Rule:
- Shortest time is 5 min (Job B, M1). Sequence:
[ B , _ , _ ] - Next shortest is 10 min (Job C, M2). Sequence:
[ B , _ , C ] - Job A fills the middle. Final Sequence:
[ B , A , C ]
The optimal sequence is to start with the massage (quickest ramp-up), move to the deep conversation, and conclude with the roleplay (shortest main event). This structure minimizes the total duration from the start of the first ramp-up to the end of the final main event, creating the most time-efficient and seamless encounter.
Conclusion
Today we've moved from single-stage to two-stage sequencing. You've learned how to apply Johnson's Rule, a fundamental algorithm for optimizing a flow shop.
Key Takeaways:
- In a two-workstation process, the sequence of jobs directly impacts the total time to completion (makespan).
- Johnson's Rule provides the optimal sequence by scheduling jobs with short first-stage times at the beginning and jobs with short second-stage times at the end.
- This logic can be applied to optimize a photoshoot by sequencing looks based on their 'styling' and 'shooting' times, or to structure an intimate encounter by sequencing activities based on their 'ramp-up' and 'main event' times.
So far, our sequencing rules have assumed all jobs are of equal importance. But what if some looks in the photoshoot are essential "hero" shots, while others are secondary? In our next lesson, we will explore Jackson's Rule, which allows us to incorporate job priorities into our sequencing decisions, adding a critical layer of strategic importance to the schedule.