Skip to content

feat: add 0/1 Knapsack Problem solver (Phase 5) - #11

Merged
sjamal merged 1 commit into
mainfrom
feature/phase-5-knapsack
Aug 23, 2026
Merged

feat: add 0/1 Knapsack Problem solver (Phase 5)#11
sjamal merged 1 commit into
mainfrom
feature/phase-5-knapsack

Conversation

@sjamal

@sjamal sjamal commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Adds a bottom-up tabulation 0/1 Knapsack solver with backtracking to recover selected items, exposed through the existing MCP/HTTP service layer as well as src/, with full test coverage and ADR 0016. First Phase 5 item.

- Add src/dynamic_programming/knapsack.py implementing bottom-up
  tabulation with backtracking to recover the selected item set,
  avoiding recursion-depth limits versus a top-down memoized approach.
- Add tests/test_dynamic_programming.py covering typical selection,
  zero capacity, empty items, over-capacity items, mismatched-length
  and negative-input validation, with full coverage.
- Expose Knapsack via the service layer: dp_knapsack_01 wrapper in
  service/tools.py, MCP tool, and
  POST /dynamic-programming/knapsack endpoint, each with tests.
- Add ADR 0016 documenting the tabulation/backtracking design.
- Update README and ROADMAP; first Phase 5 item.
@sjamal
sjamal merged commit 0ac2121 into main Aug 23, 2026
1 check passed
@sjamal
sjamal deleted the feature/phase-5-knapsack branch August 23, 2026 01:25
sjamal added a commit that referenced this pull request Aug 23, 2026
- Add src/dynamic_programming/knapsack.py implementing bottom-up
  tabulation with backtracking to recover the selected item set,
  avoiding recursion-depth limits versus a top-down memoized approach.
- Add tests/test_dynamic_programming.py covering typical selection,
  zero capacity, empty items, over-capacity items, mismatched-length
  and negative-input validation, with full coverage.
- Expose Knapsack via the service layer: dp_knapsack_01 wrapper in
  service/tools.py, MCP tool, and
  POST /dynamic-programming/knapsack endpoint, each with tests.
- Add ADR 0016 documenting the tabulation/backtracking design.
- Update README and ROADMAP; first Phase 5 item.
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.

1 participant