Resources Reference¶
What is a Resource?
A Resource is a delivery vehicle.
Resource Entity Reference¶
Name | Format | Description | Required | Example |
---|---|---|---|---|
id | GUID | Unique resource reference that is generated by the system | N/A | fe9cdda3-7288-48b4-a6aa-8e02c883526b |
algorithm_fields | Object | algorithm_fields of Resources is empty but still required. |
True | {} |
created | Date-time | The Date-time in which the Resource was created | N/A | 2017-11-13T14:30:00Z |
modified | Date-time | The Date-time in which the Resource was modified last time | N/A | 2017-11-13T14:30:00Z |
external_data | Object | The external data introduced when the Resource was created | False | {"customer_name": "Plotwise"} |
current_state | String | The name of the current Resource state | N/A | planned |
old_state | String | The name of the previous Resource state | N/A | new |
state_reason | String | The cause of the current state, useful to troubleshoot when the entity reaches an error state | N/A | initialized/resource/391a3fe7-6dc8-4c4f-9d2a-1cb84ac55e31/errors |
bucket | GUID | The Bucket Guid where the Resource belongs to | N/A | b96f55c4-c10c-4f58-8ec6-d77c2b3b94f1 |
driver_capacity | Float | New in v2 The maximum amount a driver is legally allowed to handle in a given shift including both the amount delivered and picked up. If not set, it is assumed that such limit is not applicable. |
False | 1000.0 |
vehicle_capacity | Float | New in v2 The maximum amount of physical capacity in the vehicle. Vehicles with a higher capacity are assigned to routes that start earlier. |
False | 900.0 |
vehicle_capacity_vector | Capacity | Same as vehicle_capacity but allows multiple values, mutually exclusive with vehicle_capacity field. Setting Null to a capacity of a resource means it is unlimited. |
False | {"capacity_1":12.3, "capacity_2": null, "capacity_3": null, "capacity_4": null, "capacity_5": null } |
driver_capacity_vector | Capacity | Same as driver_capacity but allows multiple values, mutually exclusive with driver_capacity field. Setting Null to a capacity of a resource means it is unlimited. |
False | {"capacity_1":12.3, "capacity_2": null, "capacity_3": null, "capacity_4": null, "capacity_5": null } |
resource_route_tag | String | Tag used to pair resources with matching routes. A tag cannot be longer than 32 characters and can only contains letters, numbers, underscores, and hyphens. | False | "early_shift" |
initial_cost | Float | The initial cost of planning this resource |
False | 10.0 |
time_cost | Float | Additional cost per second of shift resulting from planning this resource |
False | 0.0012 |
dist_cost | Float | Additional cost per meter travelled resulting from planning this resource |
False | 0.03 |
maximum_route_distance_meters | Integer | The maximum distance (in meters) a route using this resource can be | False | 250000 |
resource_event_tags | Array of Strings | The tags used to pair up events with this resource. The Event.resource_event_tags must be a subset of this attribute to be considered as a match. You can specify up to five tags. | False | ["tag1", "tag2"] |
Available actions¶
Cancel¶
Action in which a certain resource is cancelled.
The associated route will get a new resource assigned to it, as long as that resource can fit all of the events that are on the route. If no resource can be found, the route will be emptied (but kept in the route pool), and the events will be re-planned on other routes as much as possible. Events that could not be re-planned will become unplannable events - they will go into the cancelled state with a state reason that matches the cancelled resource uuid.
States¶
New¶
Original state in which the resource is created.
Planned¶
State in which the resource is planned for a certain route.
Allocated¶
State in which the resource gets when the bucket in which it belongs to is finalized and the Resource is used.
Errored¶
State in which the resource is going to be if there is an error with it. See more about potential errors here.
Cancelled¶
State the resource gets when it is cancelled. This state is reached if the resource is directly cancelled by the user, or it is reassigned/replanned.
Non-Allocated¶
State in which the resource gets if the bucket in which belongs to is finalized and it is not being used.
Gotchas¶
- Make sure you send in all the available resources! This will help to plan as many events as possible, while the algorithm will be constantly trying to reduce number of resources that are actually used in the plan
- If you reduce the number of resources, events that have been planned before may not fit anymore.
- All
capacity
is self-defined by the API consumer. It can be a number of packages, weight, volume, etc. It is always a Float. - Make sure that the definition of
capacity
is the same for resources and events.
Examples¶
Find the examples here.