Cost Objective¶
Overview¶
The Cost Objective minimizes total operating cost by combining three cost components for each vehicle: a fixed activation cost, a distance‑based cost, and a time‑based cost. This objective lets you model real economic trade‑offs: some vehicles may be cheap to drive but slow, some fast but expensive, and some you'd rather not activate unless necessary because of high startup/usage overhead.
When to Use¶
- Both driver labor time and distance‑driven expenses (fuel, wear, tolls) materially affect cost.
- You want to discourage activating unnecessary vehicles by assigning a non‑zero
fixedcost per vehicle. - Your fleet is heterogeneous (different cost rates per vehicle) and you need the optimizer to choose economically.
- Neither a pure distance nor a pure duration objective captures your cost reality; you need a balanced trade‑off across time and distance.
- You want to run "what‑if" cost sensitivity scenarios by adjusting cost weights.
Behavior¶
- Each vehicle's total evaluated cost includes:\ Total Route Cost ≈ fixed + (distance_in_meters × per_km / 1000) + (time_in_seconds × per_hour / 3600).
- All three fields are read from the vehicle's cost settings.
- If
per_houris missing or falsy, a default of 3600 is applied. - If
per_kmis missing or falsy, a default of 1000 is applied. - If
fixedis missing, treat it as 0 (no activation penalty) unless your application defines another default. - Costs are aggregated across the route; the optimizer selects assignments that yield the lowest total cost across all vehicles.
General Validation¶
- All cost values (
fixed,per_km,per_hour) must be ≥ 0. - Use consistent units: distances must match the scale implied by
per_km(meters converted to km by dividing by 1000); times must match the scale implied byper_hour(seconds converted to hours by dividing by 3600). - Check scale balance: extremely large
per_kmversus tinyper_hour(or vice versa) can skew optimization; choose realistic ratios. - Provide
fixedcosts intentionally—set higher values to discourage opening extra vehicles; set 0 if activation cost is irrelevant. - Vehicle capacities, job amounts, and time windows must be valid; the solver enforces feasibility before cost comparison.
- Ensure cost fields exist for every vehicle or confirm you are comfortable with the defaults that will be applied.