Skip to content

Fix #513: [Model] ProductionPlanning#761

Open
GiggleLiu wants to merge 3 commits intomainfrom
issue-513
Open

Fix #513: [Model] ProductionPlanning#761
GiggleLiu wants to merge 3 commits intomainfrom
issue-513

Conversation

@GiggleLiu
Copy link
Contributor

Summary

  • add an implementation plan for the ProductionPlanning model from issue [Model] ProductionPlanning #513
  • map the issue details, check-issue corrections, CLI work, tests, and paper work into executable batches

Fixes #513

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 99.12664% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.66%. Comparing base (5441368) to head (cea94a7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/models/misc/production_planning.rs 98.47% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main     #761    +/-   ##
========================================
  Coverage   97.65%   97.66%            
========================================
  Files         455      457     +2     
  Lines       55706    55935   +229     
========================================
+ Hits        54401    54628   +227     
- Misses       1305     1307     +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GiggleLiu
Copy link
Contributor Author

Implementation Summary

Changes

  • Added the new ProductionPlanning model, schema registration, exports, and example-db fixture.
  • Added model/unit tests covering constructor guards, evaluation semantics, serialization, brute-force satisfiability, and the issue example.
  • Extended pred create with ProductionPlanning support, new per-period cost/demand flags, help text, and CLI tests.
  • Documented Production Planning in the paper and added the supporting bibliography reference.

Deviations from Plan

  • The canonical example-db fixture uses a smaller 4-period instance instead of the issue bodys 6-period worked example because the repos example optimality check requires a tractable search space. The original 6-period example is still covered by dedicated unit tests and the paper section.

Open Questions

  • None.

@GiggleLiu
Copy link
Contributor Author

Agentic Review Report

Structural Check

Structural Review: model ProductionPlanning

Structural Completeness

# Check Status
1 Model file exists PASS — src/models/misc/production_planning.rs
2 inventory::submit! present PASS — src/models/misc/production_planning.rs:12
3 Serialize / Deserialize derive on struct PASS — src/models/misc/production_planning.rs:32
4 Problem trait impl PASS — src/models/misc/production_planning.rs:121
5 Aggregate value / metric present PASS — src/models/misc/production_planning.rs:123 (type Metric = bool)
6 Test link from model file PASS — src/models/misc/production_planning.rs:224
7 Test file exists PASS — src/unit_tests/models/misc/production_planning.rs
8 Test file has >= 3 tests PASS — 12 test functions in src/unit_tests/models/misc/production_planning.rs
9 Registered in category mod.rs PASS — src/models/misc/mod.rs:58, src/models/misc/mod.rs:97, src/models/misc/mod.rs:130
10 Re-exported in models/mod.rs PASS — src/models/mod.rs:43
11 Variant registration exists PASS — src/models/misc/production_planning.rs:186
12 CLI problem resolution PASS — registry-backed resolution works; pred show ProductionPlanning succeeds without a manual alias entry
13 CLI create support PASS — problemreductions-cli/src/commands/create.rs:3107
14 Canonical model example registered PASS — src/models/misc/mod.rs:130 feeds src/example_db/model_builders.rs
15 Paper display-name entry PASS — docs/paper/reductions.typ:157
16 Paper problem-def block PASS — docs/paper/reductions.typ:5303

Build Status

  • make test: PASS
  • make clippy: PASS

Semantic Review

  • evaluate() correctness: OK — src/models/misc/production_planning.rs:137 matches the issue definition: capacity bound, nonnegative prefix inventory, setup/production/inventory cost accumulation, and budget feasibility.
  • dims() correctness: OK — src/models/misc/production_planning.rs:125 exposes exactly c_i + 1 choices per period.
  • Size getter consistency: OK — max_capacity() and num_periods() support the declared complexity string.
  • Blacklisted auto-generated files: OK — none of the forbidden generated files appear in the diff.
  • Deterministic whitelist packet: FAIL — the packet marks this PR outside the current model whitelist because it also touches CLI and top-level re-export files. Manual inspection shows those edits are required integration points for a new model, so I did not treat the whitelist failure itself as a correctness bug.

Issue Compliance

# Check Status
1 Problem name matches issue OK — ProductionPlanning
2 Mathematical definition matches OK — same demands/capacities/setup/production/inventory/budget structure
3 Problem framing matches OK — implemented as a satisfaction problem (bool)
4 Type parameters match OK — none
5 Configuration space matches OK — one bounded integer variable per period
6 Feasibility check matches OK — rejects capacity overflow and negative prefix inventory
7 Objective / budget check matches OK — cumulative production, holding, and setup costs are enforced against B
8 Complexity matches OK — "(max_capacity + 1)^num_periods"

Summary

  • 16/16 structural checklist items passed.
  • 8/8 issue-compliance checks passed.
  • Pipeline packet whitelist reported a false-positive fail because the current whitelist is narrower than the real integration surface for a new model PR.

Quality Check

Quality Review

Design Principles

  • DRY: OK — repeated per-period parsing is factored into parse_named_u64_list and ensure_named_len.
  • KISS: OK — the model implementation and CLI wiring stay straightforward.
  • HC/LC: OK — model semantics, CLI plumbing, tests, and paper updates remain separated cleanly.

HCI (CLI changed)

  • Error messages: ISSUE — pred create ProductionPlanning advertises --cost-bound in its parameter list, but the implementation only accepts --cost-budget (problemreductions-cli/src/commands/create.rs:739, problemreductions-cli/src/commands/create.rs:922, problemreductions-cli/src/commands/create.rs:3138).
  • Discoverability: ISSUE — the no-args help path steers users toward a non-existent flag before they ever reach a successful manual create flow.
  • Consistency: OK — the actual parser, example string, and create implementation are internally consistent around --cost-budget.
  • Least surprise: ISSUE — the parameter table and example line in the same help output contradict each other.
  • Feedback: OK — successful create / solve / evaluate flows are clear and informative.

Test Quality

  • Naive test detection: ISSUE — the new CLI tests in problemreductions-cli/src/commands/create.rs:7040 cover serialization and missing required inputs, but they do not exercise the schema-driven help path where the wrong flag name is shown.

Issues

Critical (Must Fix)

  • None.

Important (Should Fix)

  • pred create ProductionPlanning is not self-consistent: the first-run help output tells users to pass --cost-bound, but the actual command only accepts --cost-budget. Reproduced in the current worktree with pred create ProductionPlanning ... --cost-bound 80, which fails immediately and then tells the user to use --cost-budget instead. (problemreductions-cli/src/commands/create.rs:739, problemreductions-cli/src/commands/create.rs:922, problemreductions-cli/src/commands/create.rs:3138)

Minor (Nice to Have)

  • Add a regression test for the schema-driven help output of ProductionPlanning so future flag-name overrides stay aligned with the actual parser (problemreductions-cli/src/commands/create.rs:7040).

Summary

  • One confirmed important HCI bug: the pred create ProductionPlanning help path documents the wrong budget flag.
  • One minor test gap: no regression coverage for the help-path flag mapping that exposed the mismatch.

Agentic Feature Tests

Feature Test: ProductionPlanning

Commands exercised

  • pred list
  • pred show ProductionPlanning
  • pred create ProductionPlanning (help path)
  • pred create --example ProductionPlanning
  • pred solve <example> --solver brute-force
  • pred evaluate <example> --config 3,0,4,1
  • pred create ProductionPlanning --num-periods 6 --demands 5,3,7,2,8,5 --capacities 12,12,12,12,12,12 --setup-costs 10,10,10,10,10,10 --production-costs 1,1,1,1,1,1 --inventory-costs 1,1,1,1,1,1 --cost-budget 80
  • pred solve <manual-instance> --solver brute-force
  • pred evaluate <manual-instance> --config 8,0,10,0,12,0

Results

  • Discoverability: PARTIAL — pred list shows ProductionPlanning, and pred show ProductionPlanning renders the catalog entry correctly.
  • Setup: PASS — no extra setup beyond the existing workspace build was needed.
  • Functionality: PASS — canonical example creation, manual instance creation, brute-force solve, and explicit evaluate all work in the PR worktree.
  • Expected vs actual: PARTIAL — the model behaves correctly once invoked with --cost-budget, but the initial per-problem help output points users at --cost-bound, which is rejected.
  • Blocked steps: None.
  • Friction points: The first-run help output is contradictory; the parameter table says --cost-bound, while the example and parser require --cost-budget.
  • Doc suggestions: Align the schema-driven help flag override for ProductionPlanning with the actual CLI flag name, and add a regression test covering that help path.

Confirmed Findings

  • Confirmed: pred create ProductionPlanning prints --cost-bound in the parameter list but rejects --cost-bound during actual parsing and validation. Severity: Important.
  • Not reproducible in current worktree: None.

Generated by review-pipeline

@GiggleLiu
Copy link
Contributor Author

Agentic Review Report

Supersedes the previous review-pipeline comment; same findings, cleaned formatting.

Structural Check

Structural Review: model ProductionPlanning

Structural Completeness

# Check Status
1 Model file exists PASS — src/models/misc/production_planning.rs
2 inventory::submit! present PASS — src/models/misc/production_planning.rs:12
3 Serialize / Deserialize derive on struct PASS — src/models/misc/production_planning.rs:32
4 Problem trait impl PASS — src/models/misc/production_planning.rs:121
5 Aggregate value / metric present PASS — src/models/misc/production_planning.rs:123 (type Metric = bool)
6 Test link from model file PASS — src/models/misc/production_planning.rs:224
7 Test file exists PASS — src/unit_tests/models/misc/production_planning.rs
8 Test file has >= 3 tests PASS — 12 test functions in src/unit_tests/models/misc/production_planning.rs
9 Registered in category mod.rs PASS — src/models/misc/mod.rs:58, src/models/misc/mod.rs:97, src/models/misc/mod.rs:130
10 Re-exported in models/mod.rs PASS — src/models/mod.rs:43
11 Variant registration exists PASS — src/models/misc/production_planning.rs:186
12 CLI problem resolution PASS — registry-backed resolution works; pred show ProductionPlanning succeeds without a manual alias entry
13 CLI create support PASS — problemreductions-cli/src/commands/create.rs:3107
14 Canonical model example registered PASS — src/models/misc/mod.rs:130 feeds src/example_db/model_builders.rs
15 Paper display-name entry PASS — docs/paper/reductions.typ:157
16 Paper problem-def block PASS — docs/paper/reductions.typ:5303

Build Status

  • make test: PASS
  • make clippy: PASS

Semantic Review

  • evaluate() correctness: OK — src/models/misc/production_planning.rs:137 matches the issue definition: capacity bound, nonnegative prefix inventory, setup/production/inventory cost accumulation, and budget feasibility.
  • dims() correctness: OK — src/models/misc/production_planning.rs:125 exposes exactly c_i + 1 choices per period.
  • Size getter consistency: OK — max_capacity() and num_periods() support the declared complexity string.
  • Blacklisted auto-generated files: OK — none of the forbidden generated files appear in the diff.
  • Deterministic whitelist packet: FAIL — the packet marks this PR outside the current model whitelist because it also touches CLI and top-level re-export files. Manual inspection shows those edits are required integration points for a new model, so I did not treat the whitelist failure itself as a correctness bug.

Issue Compliance

# Check Status
1 Problem name matches issue OK — ProductionPlanning
2 Mathematical definition matches OK — same demands/capacities/setup/production/inventory/budget structure
3 Problem framing matches OK — implemented as a satisfaction problem (bool)
4 Type parameters match OK — none
5 Configuration space matches OK — one bounded integer variable per period
6 Feasibility check matches OK — rejects capacity overflow and negative prefix inventory
7 Objective / budget check matches OK — cumulative production, holding, and setup costs are enforced against B
8 Complexity matches OK — "(max_capacity + 1)^num_periods"

Summary

  • 16/16 structural checklist items passed.
  • 8/8 issue-compliance checks passed.
  • Pipeline packet whitelist reported a false-positive fail because the current whitelist is narrower than the real integration surface for a new model PR.

Quality Check

Quality Review

Design Principles

  • DRY: OK — repeated per-period parsing is factored into parse_named_u64_list and ensure_named_len.
  • KISS: OK — the model implementation and CLI wiring stay straightforward.
  • HC/LC: OK — model semantics, CLI plumbing, tests, and paper updates remain separated cleanly.

HCI (CLI changed)

  • Error messages: ISSUE — pred create ProductionPlanning advertises --cost-bound in its parameter list, but the implementation only accepts --cost-budget (problemreductions-cli/src/commands/create.rs:739, problemreductions-cli/src/commands/create.rs:922, problemreductions-cli/src/commands/create.rs:3138).
  • Discoverability: ISSUE — the no-args help path steers users toward a non-existent flag before they ever reach a successful manual create flow.
  • Consistency: OK — the actual parser, example string, and create implementation are internally consistent around --cost-budget.
  • Least surprise: ISSUE — the parameter table and example line in the same help output contradict each other.
  • Feedback: OK — successful create / solve / evaluate flows are clear and informative.

Test Quality

  • Naive test detection: ISSUE — the new CLI tests in problemreductions-cli/src/commands/create.rs:7040 cover serialization and missing required inputs, but they do not exercise the schema-driven help path where the wrong flag name is shown.

Issues

Critical (Must Fix)

  • None.

Important (Should Fix)

  • pred create ProductionPlanning is not self-consistent: the first-run help output tells users to pass --cost-bound, but the actual command only accepts --cost-budget. Reproduced in the current worktree with pred create ProductionPlanning ... --cost-bound 80, which fails immediately and then tells the user to use --cost-budget instead. (problemreductions-cli/src/commands/create.rs:739, problemreductions-cli/src/commands/create.rs:922, problemreductions-cli/src/commands/create.rs:3138)

Minor (Nice to Have)

  • Add a regression test for the schema-driven help output of ProductionPlanning so future flag-name overrides stay aligned with the actual parser (problemreductions-cli/src/commands/create.rs:7040).

Summary

  • One confirmed important HCI bug: the pred create ProductionPlanning help path documents the wrong budget flag.
  • One minor test gap: no regression coverage for the help-path flag mapping that exposed the mismatch.

Agentic Feature Tests

Feature Test: ProductionPlanning

Commands exercised

  • pred list
  • pred show ProductionPlanning
  • pred create ProductionPlanning (help path)
  • pred create --example ProductionPlanning
  • pred solve <example> --solver brute-force
  • pred evaluate <example> --config 3,0,4,1
  • pred create ProductionPlanning --num-periods 6 --demands 5,3,7,2,8,5 --capacities 12,12,12,12,12,12 --setup-costs 10,10,10,10,10,10 --production-costs 1,1,1,1,1,1 --inventory-costs 1,1,1,1,1,1 --cost-budget 80
  • pred solve <manual-instance> --solver brute-force
  • pred evaluate <manual-instance> --config 8,0,10,0,12,0

Results

  • Discoverability: PARTIAL — pred list shows ProductionPlanning, and pred show ProductionPlanning renders the catalog entry correctly.
  • Setup: PASS — no extra setup beyond the existing workspace build was needed.
  • Functionality: PASS — canonical example creation, manual instance creation, brute-force solve, and explicit evaluate all work in the PR worktree.
  • Expected vs actual: PARTIAL — the model behaves correctly once invoked with --cost-budget, but the initial per-problem help output points users at --cost-bound, which is rejected.
  • Blocked steps: None.
  • Friction points: The first-run help output is contradictory; the parameter table says --cost-bound, while the example and parser require --cost-budget.
  • Doc suggestions: Align the schema-driven help flag override for ProductionPlanning with the actual CLI flag name, and add a regression test covering that help path.

Confirmed Findings

  • Confirmed: pred create ProductionPlanning prints --cost-bound in the parameter list but rejects --cost-bound during actual parsing and validation. Severity: Important.
  • Not reproducible in current worktree: None.

Generated by review-pipeline

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Model] ProductionPlanning

1 participant