Min, max and absolute value
Input
{
"constraints": [
{
"target_var": "a",
"type": "abs",
"var": "x"
},
{
"op": "min",
"target_var": "lo",
"type": "min_max",
"vars": [
"x",
"y"
]
},
{
"op": "max",
"target_var": "hi",
"type": "min_max",
"vars": [
"x",
"y"
]
},
{
"if_all": [
{
"op": "<",
"rhs": 0,
"terms": [
{
"coeff": 1,
"var": "x"
}
],
"type": "linear"
},
{
"op": ">",
"rhs": 0,
"terms": [
{
"coeff": 1,
"var": "y"
}
],
"type": "linear"
}
],
"then": {
"op": ">=",
"rhs": 3,
"terms": [
{
"coeff": 1,
"var": "a"
}
],
"type": "linear"
},
"type": "implication"
}
],
"objective": null,
"timeout_ms": null,
"variables": [
{
"max": -3,
"min": -3,
"name": "x"
},
{
"max": 2,
"min": 2,
"name": "y"
},
{
"max": 4,
"min": 0,
"name": "a"
},
{
"max": 4,
"min": -4,
"name": "lo"
},
{
"max": 4,
"min": -4,
"name": "hi"
}
]
}Output
Build-time verified. stats.elapsed_ms normalized to 0.
{
"best_bound": null,
"objective_value": null,
"solution": {
"a": 3,
"hi": 2,
"lo": -3,
"x": -3,
"y": 2
},
"stats": {
"elapsed_ms": 0,
"timed_out": false
},
"unsat_core": null,
"verdict": "feasible",
"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":"x","min":-3,"max":-3},{"name":"y","min":2,"max":2},{"name":"a","min":0,"max":4},{"name":"lo","min":-4,"max":4},{"name":"hi","min":-4,"max":4}],"constraints":[{"type":"abs","var":"x","target_var":"a"},{"type":"min_max","op":"min","vars":["x","y"],"target_var":"lo"},{"type":"min_max","op":"max","vars":["x","y"],"target_var":"hi"},{"type":"implication","if_all":[{"type":"linear","terms":[{"var":"x","coeff":1}],"op":"<","rhs":0},{"type":"linear","terms":[{"var":"y","coeff":1}],"op":">","rhs":0}],"then":{"type":"linear","terms":[{"var":"a","coeff":1}],"op":">=","rhs":3}}],"objective":null,"timeout_ms":null}'