2.3 Planning Optimiser Output
This section describes the output from the planning optimiser.
2.3.1 Plan Submit Response Object
A plan submit response object is returned when a plan request is submitted via the submit-plan endpoint. It has the following fields:
- client_id: a string giving the user assigned identifier of the optimisation job. (This is the same as the id field of the plan request object with which the optimiser was invoked.) This field may be null if the status field is ERROR (e.g. if the input was misformed and no usable client_id could be found).
- task_id: a string giving the task identifier assigned to the submitted instance by the optimiser. This field will be null if the status field is ERROR.
- status: a string giving one of the response status codes.
- errors: if status is ERROR then this is an array of strings describing the errors encountered; it is null otherwise.
- warnings: an array of strings describing potential problems.
2.3.2 Plan Query Response Object
A plan query response object is returned when querying the state of a planning optimisation job via the query-plan endpoint. It has the following fields:
- client_id: a string giving the user assigned identifier of the optimisation job.
- phase: a string which is one of the phase codes.
- progress: a number between 0 and 1 indicating optimiser progress.
- iteration: an integer, giving the current number of iterations that the optimiser has run for. This will be 0 if the phase is one of PENDING or COMPUTE_MATRIX.
- of: the total number (integer) of iterations that the optimiser will run for.
- objective: the value of the optimiser’s objective function for the best solution found so far. This is not meaningful if the phase is PENDING or COMPUTE_MATRIX. “Better” solutions are those whose objective value tends towards −∞.
2.3.3 Plan Fetch Response Object
A plan fetch response object is returned when fetching the result of a planning optimisation job via the query-plan endpoint. It has the following fields:
- client_id: a string giving the user assigned identifier of the optimisation job.
- status: a string giving one of the response status codes.
- assignments: if status is OK then this is (possibly empty) array of plan response assignment objects giving the assignment of jobs to crews; it is null if status is ERROR.
- errors: if status is ERROR then this is an array of strings describing the errors encountered; it is null otherwise.
- total_cost: if status is OK then this a number giving the total monetary cost for the solution; it is 0 otherwise.
- total_distance: if status is OK then this is a number giving the total distance (in km) for the solution; it is 0 otherwise.
- total_crew_shifts: if status is OK then this is an integer giving the total available crew-shifts for the planning period. (A crew-shift denotes a crew for given day / shift.)
- assigned_jobs: if status is OK then this is an integer giving the number of assigned jobs for the solution; it is 0 otherwise.
- total_jobs: if status is OK then this is an integer giving the total number of jobs to be assigned for the planning period; it is 0 otherwise.
- objective: if status is OK then this a number giving the optimiser’s objective function value for the solution; it is 0 otherwise;
- build: a string giving the version of the optimiser that created this response.
2.3.4 Phase Codes
A phase code describes the state of a planning optimisation job. There are five possible values:
- PENDING: the job has been accepted by the optimiser but it has not yet started running.
- COMPUTE_MATRIX: the optimiser is computing route information required for the job.
- OPTIMISE: the optimiser is running the job.
- READY: the optimiser has finished running the job and a result is available.
- FAILED: an error occurred while the optimiser was running the job.
2.3.5 Check Response Object
A check response object is returned when a plan request or dispatch request is submitted via the check-plan or check-dispatch endpoint. It has the following fields:
- status: a string giving one of the response status codes.
- errors: if status is ERROR then this is an array of strings describing the errors encountered; it is null otherwise.
2.3.6 Plan Response Assignment Object
An plan response assignment object describes the allocation of an job to a crew. It has the following fields:
- crew_id: the unique identifier of the crew.
- job_id: the unique identifier of the job.
- start_time: the date-time at which the job is scheduled to commence.
- finish_time: the date-time at which the job is scheduled to be completed.

