0.3 Optimizing for Gas Instead of Time
In 0.2 the same stop constraints
were paired with a rush: finish as soon as possible. With a hard force limit, that meant bang-bang — slam the gas (), then slam the brake ().
The clock is not the only score. Suppose the shop bills the driver for gas, not overtime. Same door, same rest conditions — different objective.
A simple gas proxy
Keep the vehicle: no drag, . Real engines burn fuel in messy ways. Here we use a toy meter that matches the story:
Gas used is proportional to effort — how hard and how long you push or brake. Units are N·s (impulse). Coasting with adds nothing to , even though the clock keeps ticking. At rest with , gas stays flat too.
(Other proxies exist — punishes large forces more sharply. is enough to feel the trade-off.)
Gentle force, longer trip
Fix an accel-then-brake plan with equal and a halfway switch (no coast). Larger shortens , as in 0.2. Under , that same slam raises gas: you pay a high rate for every second of thrust and brake. A smaller stretches the schedule but keeps the meter lower. The door conditions do not care which you pick — both can stop cleanly at .
Coasting is free (in this model)
You can also accel briefly, coast () at constant speed, then brake so at the door. Coast distance costs time and zero gas. The plan still has to leave enough room to scrub speed before . Open-loop again: marks chosen ahead of time, not from a sensor.
Try it
Compare Min time (max F), Sip gas (small F), and Coast-heavy. Read both and after each run. Open Data to see gas climb only while .
- Phase
- —
- Acceleration
- |a| = F/m = 6.55 m/s²
- Speed
- v = 0.00 m/s
- Position
- x = 0.0 / 80 m
- Time
- t = 0.00 s
- Gas
- G = ∫|F| dt = 0 N·s
Accel then brake (no coast). Larger |F| finishes sooner but burns more gas in this model.
Discussion
Time-optimal and gas-optimal are different problems with the same boundary conditions. For minimum time with , extremes win: never linger below the limit, and coasting wastes the clock. For minimum in this drag-free toy, the incentives flip. Soft force and long coast both look good on the meter; they look terrible on a stopwatch.
That is the first taste of multi-objective control. Changing the cost changes the “best” open-loop plan even when the vehicle and the destination stay fixed. Later chapters will meet the same idea with matrices ( vs in Section 4.1, LQR) and with hard constraints (Section 4.2, MPC). Here the pizza run is enough: pick what you care about — minutes or gas — and watch the widget disagree with itself.
When brakes are free
The meter charges for both throttle and brake. That is a fair “effort” score, but it is an odd gas story: cars do not burn fuel by pressing the brake pedal. (They do wear pads — a different cost.)
A closer toy for “tank of gas” is to bill only when the force is forward:
While (braking) or (coast / rest), the integrand is zero. Gas climbs only during the accel phase. In the playground above, switch the meter to throttle only (brakes free) and re-run Min time vs Sip gas. Under , the brake half of a bang-bang plan is free on the gas plot — you still pay for the slam of , and a smaller throttle still looks cheaper if you are patient.
The lesson is the same as in the Discussion: the cost function is a modeling choice. Absolute value treats push and pull as equal effort; treats braking as free. Real fleets mix fuel, time, wear, and comfort. The widget just lets you feel how flipping that choice moves the numbers.