Chapter 5

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.

Overall 0 / 32 correct
This page 0 / 4 correct
Saved in localStorage only

What you are looking at

  • Blue polygon: the feasible region where every constraint is satisfied simultaneously
  • Blue lines: the boundary lines 2x + y = b₁ and x + 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
How to use it

Pressing the presets in the order Standard → A-heavy → B-heavy → Tighter constraints makes the changes easier to track.

Simulator

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.

Presets
Objective maximize z = 3x + 5y
Current constraints 2x + y ≤ 16 / x + 2y ≤ 14
Type of optimum
Optimal point / edge
Optimal value
Active constraints
Interact with the controls and key points to focus on will appear here.

Feasible region and optimum

Vertex type x y z Active constraints

Five interactions to try

  1. Press A-heavy and the lower-right vertex takes over.
  2. Press B-heavy and an entire upper edge becomes optimal.
  3. In Alternate optima 1, 2x + y is parallel to the constraint edge.
  4. In Alternate optima 2, x + 2y is parallel to the constraint edge.
  5. In Tighter constraints, you can see the feasible region itself shrink.
Practice

Hands-on

Press the presets and check that the simulator agrees with the answers you got by hand.

Practice 5-1

Check the Standard preset

Unanswered

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.

Practice 5-2

Where does the optimum go under A-heavy?

Unanswered

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.

Practice 5-3

B-heavy produces alternate optima

Unanswered

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.

Practice 5-4

How does tightening the constraints shrink the region?

Unanswered

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.