feat(engine): daily-mode OR-Tools VRP model #72
No reviewers
Labels
No labels
in-progress
in-review
ready-for-agent
seam-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
patrick/Polaris!72
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/engine-daily-mode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
This adds the planning engine: given a day's jobs, presence windows and crews, it works out which crew should do which job when, and hands back a proposed plan plus a clear reason for every job it couldn't fit in (site unreachable, crew unavailable, confidence too low, and so on). Planners will see this as the actual routing/scheduling behind a plan version once the orchestration ticket (T-E) wires it in; until then it's exercised directly through fixtures and
polaris replay-run --file.What it takes into account: which sites a vehicle is actually predicted to be at and how confident that prediction is, which crews have the right skills, any manual pins/forbids/time-fixes a planner has set, each crew's shift hours and lunch break, and travel time between stops (straight-line estimate for now — real road-network travel time is a later ticket, #42). It also tries not to reshuffle a crew's already-confirmed work unless the improvement is worth it, and keeps a crew's mandatory lunch break in the schedule even if that means turning away a lower-priority job.
Tested against three prepared scenarios: a small two-job case with a known best answer, a medium eight-job case with a mix of skills, locks and a lunch break, and a stress case that piles every kind of manual override onto the same two jobs to prove each one is actually respected.
Related Issues
Closes #18
PH2 / T-C in
docs/12-implementation-plan.md. Scenario S04.Type of Change
Breaking Changes
None.
Test Plan
Tests green, including a slow regression test (skipped by default, run with
--run-slow) that solves the medium fixture within its real 120-second daily time budget. Also ranpolaris replay-run --fileby hand against all three fixtures to confirm the command still loads and reports on them cleanly end to end.Checklist
docs/updated for any behavioural change (ADR added if a prior decision was reversed)polaris.domainortoolswas already declared in PH0.2Additional Context
Follow-up outside this ticket's owned paths:
polaris/cli/replay_run.py's_solve_stub/_validate_stubstill print "not built yet" — that file belongs to PH1.4 (T-C isn't allowed to touch it per the row's owned-paths, and its own test asserts the stub's exact stub output), and its docstring frames wiring it up as work for once both T-C and T-D have landed. Both have now merged, so wiring those two stub bodies to the realpolaris.engine.solve/polaris.validator.validatecalls is a small, ready follow-up — happy to pick it up as a tiny seam PR if no one already has it, otherwise flagging it here so it isn't lost. In the meantime this PR proves the composition directly (test_solve_composes_with_replay_runs_own_loader, plus the fixtures ran by hand through the actual CLI).Also worth a reviewer's eyes: the installed OR-Tools build's
RoutingModel.SetAllowedVehiclesForIndex— the calldocs/05-planning-engine.mdnames for skill/lock constraints — raises aTypeErrorfor every input shape (list, tuple, array, numpy), a broken SWIG binding rather than a usage mistake (double-checked againstAddDisjunction, whose ownSpanargument binds fine). Used the documented-equivalentVehicleVar(node).SetValues([...])instead everywhere; commented invrp_model.pyand noted indocs/05-planning-engine.md's constraint table so it isn't rediscovered from scratch later.Also resolved Q10 in
docs/05-planning-engine.mdconcretely: the mandatory break node's location is the shift's start location (crew returns to base for lunch) rather than wherever the route happens to be — flagged in the doc as worth revisiting if that assumption proves wrong in practice.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01LoNrSy7Reyp7evkfcdHeLX