Skip to content

[codex] Fix Clarke-Wright metric-class scaling regression - #66

Merged
blackopsrepl merged 6 commits into
mainfrom
fix/clarke-wright-metric-class-0141
May 16, 2026
Merged

[codex] Fix Clarke-Wright metric-class scaling regression#66
blackopsrepl merged 6 commits into
mainfrom
fix/clarke-wright-metric-class-0141

Conversation

@blackopsrepl

Copy link
Copy Markdown
Collaborator

Summary

Fixes the Clarke-Wright construction scaling regression introduced by owner-aware route hooks.

The solver now supports an optional route_metric_class_fn hook for planning list variables. Clarke-Wright computes savings once per metric class instead of once per owner when owners share identical depot and route-distance behavior. Owner-specific feasibility is still evaluated during merge and final assignment, so heterogeneous fleets keep their correctness boundary.

This also exposes solverforge::cvrp::route_metric_class, which groups CVRP owners by their backing ProblemData pointer, and prepares the workspace patch surface for 0.14.1 without tagging.

Root Cause

The 0.14.0 owner-aware Clarke-Wright path generated savings for every owner and every customer pair. For benchmark models that use one route entity per customer, the large CVRP smoke case expanded from roughly n^2 savings to n^2 * owners, causing the watchdog timeout before construction could return.

Changes

  • Add optional route_metric_class_fn metadata and macro support.
  • Group Clarke-Wright savings by metric class while preserving owner-specific feasibility and deterministic owner matching.
  • Add CVRP route_metric_class helper and facade export.
  • Add focused regressions for metric-class savings scaling and shared-class owner feasibility.
  • Update wireframes, public fixture, macro UI expectation, and 0.14.1 release metadata.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-features
  • Downstream local benchmark build: make build-cvrp-solverforge
  • Downstream local benchmark build: make build-employee-scheduling-solverforge
  • Downstream CVRP smoke against the PR worktree: X-n1001-k43 returned hard-feasible in 1.088s with watchdog_killed=false; X-n101-k25 and X-n106-k14 also returned hard-feasible without watchdog kills.

Add an optional route_metric_class_fn hook to list-variable metadata and macro generation so route owners that share identical depot and distance behavior can share Clarke-Wright savings rows.

Use the hook inside ListClarkeWrightPhase to compute savings per metric class while keeping owner-specific route feasibility and final owner matching. When no hook is supplied, each owner remains its own metric class, preserving the existing construction semantics.
Add a CVRP route_metric_class helper that groups owners by their backing ProblemData pointer. This gives Clarke-Wright a conservative proof that vehicles share depot and distance behavior without weakening owner-specific route feasibility.

Re-export the helper through both solverforge-cvrp and the solverforge facade, and cover shared-data and distinct-data behavior with focused unit tests.
Add targeted Clarke-Wright regressions for route metric classes. The first proves that savings generation scales with metric classes rather than owner count; the second proves that owners sharing a metric class still keep owner-specific route feasibility during assignment.
Update the public macro, solver, facade, and CVRP wireframes for route_metric_class_fn and route_metric_class so the documented surface matches the new checked-in API.

Also update the Clarke-Wright publication fixture and macro UI expectation so public examples and compile-fail diagnostics include the new supported planning_list_variable argument.
Bump the workspace version, inter-crate publish dependencies, lockfile entries, README, AGENTS guidance, and crate wireframes from 0.14.0 to 0.14.1.

This prepares the patch release metadata for the Clarke-Wright metric-class fix without creating a tag, pushing remotes, or hand-editing changelog content.
Apply the repository rustfmt ordering and line wrapping to the new route metric class imports and test module declarations so the validation gate passes without changing behavior.
@blackopsrepl blackopsrepl self-assigned this May 16, 2026
@blackopsrepl blackopsrepl added the bug Something isn't working label May 16, 2026
@blackopsrepl
blackopsrepl marked this pull request as ready for review May 16, 2026 13:25
@blackopsrepl
blackopsrepl merged commit 8e33f58 into main May 16, 2026
4 checks passed
@blackopsrepl
blackopsrepl deleted the fix/clarke-wright-metric-class-0141 branch May 16, 2026 13:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 58d1d0d3a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant