opticoder-binding-cases / cases /case_knapsack.json
alirezaaminzadeh's picture
Publish OptiCoder structured binding cases
b3aa878 verified
Raw
History Blame Contribute Delete
2.27 kB
{
"case_id": "case_knapsack",
"problem_type": "knapsack",
"natural_language": "Select items to maximize profit. Item profits are 24, 13, 23, 15, 16 and weights are 12, 7, 11, 8, 9. Knapsack capacity is 26. Each item can be taken at most once.",
"binding": {
"problem_hint": "knapsack",
"entities": {
"items": [
{
"id": "I1",
"label": null,
"attributes": {}
},
{
"id": "I2",
"label": null,
"attributes": {}
},
{
"id": "I3",
"label": null,
"attributes": {}
},
{
"id": "I4",
"label": null,
"attributes": {}
},
{
"id": "I5",
"label": null,
"attributes": {}
}
]
},
"parameters": {
"profit": {
"name": "profit",
"value": [
24.0,
13.0,
23.0,
15.0,
16.0
],
"unit": null,
"source_span": null
},
"weight": {
"name": "weight",
"value": [
12.0,
7.0,
11.0,
8.0,
9.0
],
"unit": null,
"source_span": null
}
},
"scalars": {
"capacity": 26.0
},
"binding_confidence": 0.88
},
"formulation": {
"problem_type": "knapsack",
"sets": {
"I": "items"
},
"parameters": [
"profit",
"weight"
],
"variables": [
{
"name": "x",
"indices": [
"i"
],
"domain": "binary",
"non_negative": true,
"description": "1 if item i is selected"
}
],
"objective": {
"sense": "maximize",
"expression": "sum(profit[i] * x[i] for i in I)",
"description": "Maximize total profit"
},
"constraints": [
{
"name": "capacity",
"expression": "sum(weight[i] * x[i] for i in I)",
"sense": "<=",
"rhs_expression": "capacity",
"description": "Respect knapsack capacity"
}
],
"notes": []
},
"ground_truth_objective": 51.0
}