Skip to main content
POST
/
v1
/
solver
/
solve
Solve a constraint model
curl --request POST \
  --url https://api.erna.ai/v1/solver/solve \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "variables": [
    {
      "type": "bool",
      "name": "<string>"
    }
  ],
  "constraints": [
    {
      "type": "linear",
      "terms": [
        {
          "var": "<string>",
          "coeff": 123
        }
      ],
      "op": "<=",
      "rhs": 123
    }
  ],
  "objective": {
    "sense": "minimize",
    "terms": [
      {
        "var": "<string>",
        "coeff": 123
      }
    ]
  },
  "options": {
    "timeLimitSeconds": 123,
    "solutionLimit": 123
  }
}
'
{
  "status": "OPTIMAL",
  "values": {},
  "statistics": {
    "solveTimeMs": 123,
    "conflicts": 123,
    "branches": 123
  },
  "error": "<string>",
  "solutionInfo": "<string>",
  "softViolations": [
    {
      "constraintId": "<string>",
      "violationAmount": 123,
      "targetValue": 123,
      "actualValue": 123
    }
  ]
}

Authorizations

Authorization
string
header
required

OAuth2 access token or API key

Body

application/json
variables
object[]
required
constraints
object[]
required
objective
object
options
object

Response

Solver result

status
enum<string>
required
Available options:
OPTIMAL,
FEASIBLE,
INFEASIBLE,
TIMEOUT,
ERROR
values
object
statistics
object
error
string
solutionInfo
string
softViolations
object[]