Assigned() (int, model.IntDomain)function gives access to the set of locations and the vehicle those locations were assigned to in the previous call to
Next(). The function can be called on a fleet state and will return an index and an IntDomain. Note, if no locations were assigned, then an empty domain will be returned by the function. Previously, accessing this information required ranging and recomputing over all vehicles. We recommend using the new
Assignedfunction for a more efficient approach.
Vehicle(index int) vehicle.Statefunction gives fast access to the state of a particular vehicle. The function takes an index of a vehicle (this can be passed from
Assigned) and returns the vehicle state.
IntDomainrepresenting the next locations to be assigned to vehicles. If
nil, the minimum from the domain of remaining location indices will be taken by default.
IntDomainrepresenting valid combinations of vehicles and locations to be assigned next. New vehicle filters are detailed below.
UnassignedPenalitieson the fleet
struct. Locations can have different penalties (e.g., if there is a high priority locations that must be served, they can have higher penalties).
transform func(vehicle.State) vehicle.Statehas been added to
CustomRouterto provide access to the underlying vehicle model. This enables constraints such as earliness and lateness to be considered as part of the vehicle model search to find improving results faster. ETAs and time windows can now be tracked when planning a vehicle route as well.
vehicle.State.Cost(index int) float64. This simplifies the calculation of an ETA as part of the value function.
vehicle.State.Constraints(). This new method returns the constraints of vehicle at the state it was called on.
vehicle.Costerinterface specifies a
Cost(index int) intmethod implemented by the Window constraint that captures both the accumulated measure and enforced wait time.
TRUE. See the package docs for additional details.
EuclideanByIndex, etc.). As we add new measures, we are moving to a more scalable system where only
ByPointis specified, and
ByIndexis dynamically generated.
Indexedfunction to generate a ByIndex measure:
Indexed(m ByPoint, points Point) ByIndex. The function takes a ByPoint measure and a slice of points as input and returns a ByIndex measure.
Vehicleinput schema has a new field
IntDomain. This domain specifies a set of locations one of which has to be visited by the vehicle. One usage scenario is when the vehicle should go on a break, and there are multiple break locations. The model will choose the closest (as determined by the given measure) one. Additionally we added
Alternate() (index, location int), which gives access to the index in the route at which the alternate location can be found as well as the actual location that is used from the set of alternate locations.
Dispatch, a base multi-vehicle fleet routing app with no pre-specified constraints. This base app is ready to use with Hop v0.7.1 and can be easily extended to include the new functionality detailed above. Stay tuned as we continue to add new apps.