Authorization
Bearer <YOUR-API-KEY>
/v0/run
endpoint with a JSON
body that follows the input schema. The API server should return a runID
similar to the following:duration
set in the run options
. Depending on the problem, the solver may finish sooner than the alloted time.succeeded
, you may request the result using the last endpoint.requested
or started
, it means that the solver is still running and you should wait to request the result. We recommend you set a maximum number of retries for the polling. Sleep for a short time, then poll the endpoint until there are no retries left or the status is succeeded
. Instead of retries, you can also use a timeout, as outlined in our code samples.failed
or timed_out
, it means that you will not be able to request the result./v0/run/{run_id}/result
endpoint using the runID
obtained from the first request. The response is a JSON
payload that follows the output schema. Modify the input of your run request to see how your result changes. If you have any questions or need help, please contact us at [email protected].JSON
) to produce decisions that are actionable by software systems. This makes decisions more interpretable and easier to test. It also makes integration with data warehouses and business intelligence platforms significantly easier. An input contains the following components:stop_groups
array
of array
of string
duration_groups
array
of object
.json
file. Sign up for Nextmv Cloud Console for additional sample input files.vehicles
define all vehicles in a fleet. Available vehicle property fields and type requirements are detailed in the table below. Besides being a mandatory field, the id
must be unique. Except for id
, required fields can be set as defaults instead of being set for each vehicle.alternate_stops
references stops by ID in the alternate_stops
object, not the stops
object.id
string
"id": "vehicle-1"
speed
float
[meters/second]"speed": 25
start
object
"start": { "lon":-96.659222, "lat": 33.122746 }
end
object
"end": { "lon": -96.659222, "lat": 33.122746 }
compatibility_attributes
array
of string
"compatibility_attributes": ["refrigerated"]
vehicles
:stops
define all stops (or requests) that are candidates for assignment. Just like id
for vehicles, id
for stops must be unique. Available stop property fields and type requirements are detailed in the table below.id
string
"id": "order-1-pickup"
position
object
"position": { "lon": -96.827094, "lat": 33.004745 }
stop_duration
int
[seconds]"stop_duration": 120
quantity
object
or int
"quantity": { "weight": -50 }
or "quantity": -50
hard_window
array
of timestamp
"hard_window": [ "2021-10-17T09:00:00-06:00", "2021-10-17T10:00:00-06:00" ]
precedes
array
of string
or string
"precedes": ["order-1-drop", "order-2-drop"]
or "precedes": "order-1-drop"
succeeds
array
of string
or string
"succeeds": ["order-1-drop", "order-2-drop"]
or "succeeds": "order-1-drop"
compatibility_attributes
array
of array
of string
"compatibility_attributes": ["refrigerated"]
stops
:run_profile
is a single JSON
object with an id
attribute specifying a previously configured run profile. Settings for the profile are merged with the input for the run. Additional integration-specific fields may be added to the run profile. Please note that third-party integrations are configured as part of a run profile. See available integrations for more information.id
string
"id": "<MY-RUN-PROFILE-ID>"
run_profile
:options
can also be added to the input file. Note, in the Nextmv Cloud console, options added to an input file will override options configured using the graphical user interface (e.g., a duration specified in an input file will override a duration set using the runtime slider). Available option fields and type requirements are detailed in the table below.duration
string
"solver": { "limits": { "duration": "5s" } }
solutions
int
"solver": { "limits": { "solutions": 1 } }
nodes
int
"solver": { "limits": { "nodes": 10 } }
expansion
int
"solver": { "diagram": { "expansion": { "limit": 1 } }
options
:stop_groups
define a list of stops to be grouped together. Each group must consist of at least 2 stops, given by their IDs. Here is an example of using stop_groups
:alternate_stops
defines a list of stops. An alternate stop can be referenced by a vehicle by using the alternate_stops
property. In addition to the stops already assigned to the vehicle, one alternate stop will be assigned from all referenced alternate stops. An alternate stop has the same fields as a normal stop. Here is an example of using alternate_stops
:duration_groups
define groups of stops that would take on an additional duration cost if any stop in the group is approached from a location outside of it. Any individual stop durations will be applied as usual. Two fields are required for each duration group: group
and duration
. A location must not be repeated within a group and must not be part of several groups. The table below defines the schema for a duration group.group
array
of string
"group": ["location-1"]
duration
int
[seconds]"duration": 120
duration_groups
:JSON
format. The output schema contains the following components.hop
string
Hop
) used.options
object
state
object
state
object containing a solution. The state
contains the following components:.json
file.vehicles
key contains the route per vehicle and different fields with statistics for that vehicle. The components of a vehicle's solution are described in the following table.id
string
"id": "vehicle-1"
value
int
"value": 5745
travel_distance
float
[meters]"travel_distance": 51450.103837858944
travel_time
float
[seconds]"travel_time": 5745.074947478
vehicle_initialization_costs
int
"vehicle_initialization_costs": 0
route
array
of object
"route": [{"id":"location-1", "lon": -96.7503, "lat": 33.2058, "distance": 12542.225, "eta": "2022-02-22T09:20:54:06-00", "ets": "2022-02-22T09:20:54:06-00"}, {...}, ...]
route
are described in the following table.id
string
"id": "location-1"
lon
float
"lon": -96.659222
lat
float
"lat": 33.122746
distance
float
[meters]"distance": 0
eta
timestamp
"eta": "2021-10-17T09:00:00-06:00"
ets
timestamp
"ets": "2021-10-17T09:00:00-06:00"
unassigned
key holds an array of unassigned stops (objects). Each unassigned stop has the following fields:id
string
"id": "location-1"
lon
float
"lon": -96.659222
lat
float
"lat": 33.122746
unassigned
stops look like in the output.value_summary
key holds summary statistics of the overall solution, like the total distance traveled and the value of the solution. The components of the value summary are described below.value
int
"value": 211264
total_travel_distance
float
[meters]"total_travel_distance": 101843.988
total_travel_time
float
[seconds]"total_travel_time": 11265.113
total_earliness_penalty
float
[seconds]"total_earliness_penalty": 0
total_lateness_penalty
float
[seconds]"total_lateness_penalty": 0
total_unassigned_penalty
int
[seconds]"total_unassigned_penalty": 200000
total_vehicle_initialization_costs
int
[seconds]"total_vehicle_initialization_costs": 0
value_summary
looks like in the output.statistics
object for each solution returned by the solver.bounds
object
search
object
time
object
value
int
bounds
key follows the schema described below.lower
int
upper
int
upper
and lower
bounds are continuously updated after generating a new state.search
object shows the solver's search mechanism, which is a state exploration. It projects states forward from the root state to determine what decisions you should make. Every transition in that search produces a new state which is then explored. Each of these categories contain both feasible and infeasible states. See the solver overview for more information.generated
int
filtered
int
expanded
int
reduced
int
restricted
int
deferred
int
explored
int
solutions
int
time
object shows the time it took for the solver to find the solution shown.elapsed
string
elapsed_seconds
float
start
timestamp