Solver as a Service
Sign Up Now →Sign Up Now

Milestone 2: solve the draft over REST

Preview

An inline manifest is the shortest development loop. Use the manifest’s own problem_type in the route and place the manifest under options.manifest:

{
  "problem": {
    "staff": [
      {"id": "alice"},
      {"id": "ben"}
    ],
    "shifts": [
      {"id": "mon-open"},
      {"id": "mon-close"}
    ]
  },
  "solver": {},
  "options": {
    "manifest": {
      "domain": "RetailRostering",
      "problem_type": "my_rota",
      "version": "0.1",
      "decision": {
        "entities": {"source": "staff", "identity": "id"},
        "groups": {"source": "shifts", "identity": "id"},
        "domain": {
          "total_over_entities": false,
          "total_over_groups": true
        }
      },
      "constraints": {
        "staffed": {
          "name": "Every shift is covered",
          "description": "At least one employee must cover every shift.",
          "type": "hard",
          "default_enabled": true,
          "contract": "aggregate",
          "parameters": {
            "collect": "count",
            "compare": ">=",
            "limit": 1
          }
        }
      }
    }
  }
}

Save that request as solve.json, then submit it:

curl --fail-with-body \
  -H "Authorization: Bearer ${SOLVER_TOKEN}" \
  -H 'Content-Type: application/json' \
  --data @solve.json \
  "${SOLVER_URL}/api/v1/solve/my_rota"

Inline manifests are not returned by GET /api/v1/manifests because they are not installed. That isolation prevents two users' drafts with the same name from overwriting one another.