Capacitated bin packing (CP-SAT)
Input
{
"constraints": [
{
"op": "==",
"rhs": 1,
"terms": [
{
"coeff": 1,
"var": "x0_0"
},
{
"coeff": 1,
"var": "x0_1"
},
{
"coeff": 1,
"var": "x0_2"
}
],
"type": "linear"
},
{
"op": "==",
"rhs": 1,
"terms": [
{
"coeff": 1,
"var": "x1_0"
},
{
"coeff": 1,
"var": "x1_1"
},
{
"coeff": 1,
"var": "x1_2"
}
],
"type": "linear"
},
{
"op": "==",
"rhs": 1,
"terms": [
{
"coeff": 1,
"var": "x2_0"
},
{
"coeff": 1,
"var": "x2_1"
},
{
"coeff": 1,
"var": "x2_2"
}
],
"type": "linear"
},
{
"op": "==",
"rhs": 1,
"terms": [
{
"coeff": 1,
"var": "x3_0"
},
{
"coeff": 1,
"var": "x3_1"
},
{
"coeff": 1,
"var": "x3_2"
}
],
"type": "linear"
},
{
"op": "==",
"rhs": 1,
"terms": [
{
"coeff": 1,
"var": "x4_0"
},
{
"coeff": 1,
"var": "x4_1"
},
{
"coeff": 1,
"var": "x4_2"
}
],
"type": "linear"
},
{
"op": "==",
"rhs": 1,
"terms": [
{
"coeff": 1,
"var": "x5_0"
},
{
"coeff": 1,
"var": "x5_1"
},
{
"coeff": 1,
"var": "x5_2"
}
],
"type": "linear"
},
{
"op": "<=",
"rhs": 0,
"terms": [
{
"coeff": 4,
"var": "x0_0"
},
{
"coeff": 8,
"var": "x1_0"
},
{
"coeff": 1,
"var": "x2_0"
},
{
"coeff": 4,
"var": "x3_0"
},
{
"coeff": 2,
"var": "x4_0"
},
{
"coeff": 1,
"var": "x5_0"
},
{
"coeff": -10,
"var": "used0"
}
],
"type": "linear"
},
{
"op": "<=",
"rhs": 0,
"terms": [
{
"coeff": 4,
"var": "x0_1"
},
{
"coeff": 8,
"var": "x1_1"
},
{
"coeff": 1,
"var": "x2_1"
},
{
"coeff": 4,
"var": "x3_1"
},
{
"coeff": 2,
"var": "x4_1"
},
{
"coeff": 1,
"var": "x5_1"
},
{
"coeff": -10,
"var": "used1"
}
],
"type": "linear"
},
{
"op": "<=",
"rhs": 0,
"terms": [
{
"coeff": 4,
"var": "x0_2"
},
{
"coeff": 8,
"var": "x1_2"
},
{
"coeff": 1,
"var": "x2_2"
},
{
"coeff": 4,
"var": "x3_2"
},
{
"coeff": 2,
"var": "x4_2"
},
{
"coeff": 1,
"var": "x5_2"
},
{
"coeff": -10,
"var": "used2"
}
],
"type": "linear"
},
{
"op": ">=",
"rhs": 0,
"terms": [
{
"coeff": 1,
"var": "used0"
},
{
"coeff": -1,
"var": "used1"
}
],
"type": "linear"
},
{
"op": ">=",
"rhs": 0,
"terms": [
{
"coeff": 1,
"var": "used1"
},
{
"coeff": -1,
"var": "used2"
}
],
"type": "linear"
}
],
"objective": {
"sense": "minimize",
"terms": [
{
"coeff": 1,
"var": "used0"
},
{
"coeff": 1,
"var": "used1"
},
{
"coeff": 1,
"var": "used2"
}
]
},
"timeout_ms": 3000,
"variables": [
{
"max": 1,
"min": 0,
"name": "x0_0"
},
{
"max": 1,
"min": 0,
"name": "x0_1"
},
{
"max": 1,
"min": 0,
"name": "x0_2"
},
{
"max": 1,
"min": 0,
"name": "x1_0"
},
{
"max": 1,
"min": 0,
"name": "x1_1"
},
{
"max": 1,
"min": 0,
"name": "x1_2"
},
{
"max": 1,
"min": 0,
"name": "x2_0"
},
{
"max": 1,
"min": 0,
"name": "x2_1"
},
{
"max": 1,
"min": 0,
"name": "x2_2"
},
{
"max": 1,
"min": 0,
"name": "x3_0"
},
{
"max": 1,
"min": 0,
"name": "x3_1"
},
{
"max": 1,
"min": 0,
"name": "x3_2"
},
{
"max": 1,
"min": 0,
"name": "x4_0"
},
{
"max": 1,
"min": 0,
"name": "x4_1"
},
{
"max": 1,
"min": 0,
"name": "x4_2"
},
{
"max": 1,
"min": 0,
"name": "x5_0"
},
{
"max": 1,
"min": 0,
"name": "x5_1"
},
{
"max": 1,
"min": 0,
"name": "x5_2"
},
{
"max": 1,
"min": 0,
"name": "used0"
},
{
"max": 1,
"min": 0,
"name": "used1"
},
{
"max": 1,
"min": 0,
"name": "used2"
}
]
}Output
Build-time verified. stats.elapsed_ms normalized to 0.
{
"best_bound": 2,
"objective_value": 2,
"solution": {
"used0": 1,
"used1": 1,
"used2": 0,
"x0_0": 1,
"x0_1": 0,
"x0_2": 0,
"x1_0": 0,
"x1_1": 1,
"x1_2": 0,
"x2_0": 0,
"x2_1": 1,
"x2_2": 0,
"x3_0": 1,
"x3_1": 0,
"x3_2": 0,
"x4_0": 1,
"x4_1": 0,
"x4_2": 0,
"x5_0": 0,
"x5_1": 1,
"x5_2": 0
},
"stats": {
"elapsed_ms": 0,
"timed_out": false
},
"unsat_core": null,
"verdict": "optimal",
"verified": true
}Request
curl --fail-with-body --silent --show-error https://oracles.burgeonads.com/v1/solve/cpsat -H 'Content-Type: application/json' --data-raw '{"variables":[{"name":"x0_0","min":0,"max":1},{"name":"x0_1","min":0,"max":1},{"name":"x0_2","min":0,"max":1},{"name":"x1_0","min":0,"max":1},{"name":"x1_1","min":0,"max":1},{"name":"x1_2","min":0,"max":1},{"name":"x2_0","min":0,"max":1},{"name":"x2_1","min":0,"max":1},{"name":"x2_2","min":0,"max":1},{"name":"x3_0","min":0,"max":1},{"name":"x3_1","min":0,"max":1},{"name":"x3_2","min":0,"max":1},{"name":"x4_0","min":0,"max":1},{"name":"x4_1","min":0,"max":1},{"name":"x4_2","min":0,"max":1},{"name":"x5_0","min":0,"max":1},{"name":"x5_1","min":0,"max":1},{"name":"x5_2","min":0,"max":1},{"name":"used0","min":0,"max":1},{"name":"used1","min":0,"max":1},{"name":"used2","min":0,"max":1}],"constraints":[{"type":"linear","terms":[{"var":"x0_0","coeff":1},{"var":"x0_1","coeff":1},{"var":"x0_2","coeff":1}],"op":"==","rhs":1},{"type":"linear","terms":[{"var":"x1_0","coeff":1},{"var":"x1_1","coeff":1},{"var":"x1_2","coeff":1}],"op":"==","rhs":1},{"type":"linear","terms":[{"var":"x2_0","coeff":1},{"var":"x2_1","coeff":1},{"var":"x2_2","coeff":1}],"op":"==","rhs":1},{"type":"linear","terms":[{"var":"x3_0","coeff":1},{"var":"x3_1","coeff":1},{"var":"x3_2","coeff":1}],"op":"==","rhs":1},{"type":"linear","terms":[{"var":"x4_0","coeff":1},{"var":"x4_1","coeff":1},{"var":"x4_2","coeff":1}],"op":"==","rhs":1},{"type":"linear","terms":[{"var":"x5_0","coeff":1},{"var":"x5_1","coeff":1},{"var":"x5_2","coeff":1}],"op":"==","rhs":1},{"type":"linear","terms":[{"var":"x0_0","coeff":4},{"var":"x1_0","coeff":8},{"var":"x2_0","coeff":1},{"var":"x3_0","coeff":4},{"var":"x4_0","coeff":2},{"var":"x5_0","coeff":1},{"var":"used0","coeff":-10}],"op":"<=","rhs":0},{"type":"linear","terms":[{"var":"x0_1","coeff":4},{"var":"x1_1","coeff":8},{"var":"x2_1","coeff":1},{"var":"x3_1","coeff":4},{"var":"x4_1","coeff":2},{"var":"x5_1","coeff":1},{"var":"used1","coeff":-10}],"op":"<=","rhs":0},{"type":"linear","terms":[{"var":"x0_2","coeff":4},{"var":"x1_2","coeff":8},{"var":"x2_2","coeff":1},{"var":"x3_2","coeff":4},{"var":"x4_2","coeff":2},{"var":"x5_2","coeff":1},{"var":"used2","coeff":-10}],"op":"<=","rhs":0},{"type":"linear","terms":[{"var":"used0","coeff":1},{"var":"used1","coeff":-1}],"op":">=","rhs":0},{"type":"linear","terms":[{"var":"used1","coeff":1},{"var":"used2","coeff":-1}],"op":">=","rhs":0}],"objective":{"sense":"minimize","terms":[{"var":"used0","coeff":1},{"var":"used1","coeff":1},{"var":"used2","coeff":1}]},"timeout_ms":3000}'