knapsack_solve
Solves the 0-1 knapsack problem by selecting items that maximize total value without exceeding a specified weight capacity.
Instructions
Solve the 0-1 knapsack problem: pick items to maximize value within a weight capacity.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"capacity": "<capacity>",
"items": "<items>"
},
"name": "knapsack_solve"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Array of { name?, weight, value } objects. | |
| capacity | Yes | Maximum weight capacity (integer units, max 100000). |