Simulator — play with a 2D LP
Drag the profit coefficients and the constraint right-hand sides, and watch the optimum switch with your own hands.
What you are looking at
- Blue polygon: the feasible region where every constraint is satisfied simultaneously
- Blue lines: the boundary lines
2x + y = b₁andx + 2y = b₂ - Orange dashed line: a level line of the current objective
c_x x + c_y y = z - Thick red line or red dot: the current optimum
Pressing the presets in the order Standard → A-heavy → B-heavy → Tighter constraints makes the changes easier to track.
Move the feasible region and the optimum
Change the profit coefficients and the constraint right-hand sides, and see on the spot how the direction of the objective and the shape of the feasible region change.
Adjust the coefficients
Profit from producing one extra lot of A. Larger values tend to push the optimum to the right.
Profit from producing one extra lot of B. Larger values tend to push the optimum upward.
The right-hand side of 2x + y ≤ b₁. Decreasing it shrinks the feasible region toward the lower-left.
The right-hand side of x + 2y ≤ b₂. Decreasing it pushes the feasible region inward.
Feasible region and optimum
| Vertex type | x | y | z | Active constraints |
|---|
Five interactions to try
- Press A-heavy and the lower-right vertex takes over.
- Press B-heavy and an entire upper edge becomes optimal.
- In Alternate optima 1,
2x + yis parallel to the constraint edge. - In Alternate optima 2,
x + 2yis parallel to the constraint edge. - In Tighter constraints, you can see the feasible region itself shrink.
Hands-on
Press the presets and check that the simulator agrees with the answers you got by hand.
Check the Standard preset
Press "Standard" and read the coordinates of the optimum from the simulator output.
Show hint
In the standard case the optimum is the intersection (6, 4) where both process constraints bind simultaneously.
Where does the optimum go under A-heavy?
Press "A-heavy". With the profit coefficients changed to c_x = 12, c_y = 5, enter the coordinates of the optimum.
Show hint
With a larger profit coefficient on A, the objective tilts to the right and the lower-right vertex (8, 0) becomes optimal.
B-heavy produces alternate optima
Press "B-heavy". Choose the type of optimum and enter the optimal value.
Show hint
Under B-heavy, z = 3x + 6y = 3(x + 2y), which is parallel to the constraint x + 2y ≤ 14. So z = 42 along the entire edge.
How does tightening the constraints shrink the region?
Press "Tighter constraints". Enter the coordinates of the optimum and the optimal value.
Show hint
With the constraints changed to 2x + y ≤ 14 and x + 2y ≤ 10, the intersection is (6, 2) and the objective value is 3×6 + 5×2 = 28.
Key takeaways from this chapter
- When the ratio of profit coefficients changes, the direction of the objective changes.
- When the right-hand sides of the constraints change, the feasible region itself shrinks or expands.
- The simulator is a tool for reconfirming, graphically, the vertex comparisons you did by hand.
Bridge to the next chapter — same logic, in code
Every time you move a slider, the simulator silently enumerates the intersections of the boundary lines, keeps only the feasible vertices, and scores them with the objective function. That is exactly the procedure you carried out by hand in Chapter 4.
In Chapter 6 we read this same logic written out in Python. Reading the chapter is easier when you map the simulator's outputs — "kind of optimum", "best vertex / best edge", "active constraints" — back to the parts of the code that produce them.