Maps SDK for C++ 1.0.0
Loading...
Searching...
No Matches
gem::vrp::Route Class Reference

A route is a part of the optimization's solution. More...

Inheritance diagram for gem::vrp::Route:
Collaboration diagram for gem::vrp::Route:

Public Member Functions

 Route ()=default
 Default constructor.
 Route (const Route &)=default
 Default copy constructor.
 Route (Route &&) noexcept=default
 Default move constructor noexcept is deduced.
Routeoperator= (const Route &)=default
 Default copy assignment operator.
Routeoperator= (Route &&) noexcept=default
 Default move assignment operator.
bool operator== (Route const &route) const
 Compares two Route objects for equality.
bool operator!= (Route const &route) const
 Compares two Route objects for equality.
LargeInteger getId () const noexcept
 Get the id of the route; it is used to identify the route when you have to update or delete it.
LargeInteger getOptimizationId () const noexcept
 Get the optimization id to which the route belongs.
const ConfigurationParametersRef getConfigurationParameters () const noexcept
 Get the ConfigurationParameters for which the route was generated.
RoutesetConfigurationParameters (const ConfigurationParameters &params) noexcept
 Set the ConfigurationParameters of the route.
const RouteOrderListRef getOrders () const noexcept
 Get the list of orders that are ordered in the visiting order.
const VehicleRef getVehicle () const noexcept
 Get the Vehicle object upon which constraints are applied.
RoutesetVehicle (const IVehicle &vehicle) noexcept
 Set the vehicle object on which constraints are applied.
const VehicleConstraintsRef getVehicleConstraints () const noexcept
 Get the VehicleConstraints of the route.
RoutesetVehicleConstraints (const VehicleConstraints &vehConstr) noexcept
 Set the VehicleConstraints of the route.
const DepartureRef getDeparture () const noexcept
 Get the departure of the route.
RoutesetDeparture (const Departure &departure) noexcept
 Set the departure, from where the vehicle has to start the route.
const DestinationRef getDestination () const noexcept
 Get the destination of the route.
RoutesetDestination (const Destination &destination) noexcept
 Set the destination of the route.
EMatrixBuildType getMatrixBuildType () const noexcept
 Retrieves the method used for building the distance and time matrices.
RoutesetMatrixBuildType (EMatrixBuildType matrixBuildType) noexcept
 Sets the method to be used for constructing the distance and time matrices for the optimization.
const std::map< EVehicleType, FloatListList > & getDistanceMatrices () const noexcept
 Retrieves custom distance matrices set for each vehicle type.
const std::map< EVehicleType, IntListList > & getTimeMatrices () const noexcept
 Retrieves custom time matrices set for each vehicle type.
ERideStatus getRideStatus () const noexcept
 Return the status of the ride.
const TimeRef getCreationTime () const noexcept
 Get the time when the route was created.
float getTotalDistance () const noexcept
 Get the total distance of the route in the distance unit set in the ConfigurationParameters.
int getTotalTime () const noexcept
 Get the total duration of the route in seconds.
int getTotalServiceTime () const noexcept
 Get the total service time of all the orders of the route in seconds.
int getTotalWaitTime () const noexcept
 Get the total wait time of the route in seconds.
float getCost () const noexcept
 Get the cost of the route (the price for the total fuel that will be consumed).
float getNeededFuel () const noexcept
 Get the total amount of fuel used during the route.
const std::vector< vrp::VRPActualBreak > & getBreaks () const noexcept
 Retrieves the list of actual breaks associated with the current object.
const CoordinatesListRef getShape () const noexcept
 Get the shape of the route.
int reoptimize (ProgressListener listener, Request &request) noexcept
 Async reoptimize the route.
int unlink (ProgressListener listener) noexcept
 Async unlinks the route from its optimization and a new Optimization is made for the route.
int addOrders (ProgressListener listener, const RouteOrderList &orders, bool optimalPosition, Request &request, bool reoptimize=false, const std::map< vrp::EVehicleType, FloatListList > distancesToTheOtherLocations=std::map< vrp::EVehicleType, FloatListList >(), const std::map< vrp::EVehicleType, IntListList > timesToTheOtherLocations=std::map< vrp::EVehicleType, IntListList >()) noexcept
 Async add orders to the route.
int deleteOrder (ProgressListener listener, RouteOrder &order) noexcept
 Async deletes an order from a route.
int exportInFile (const String &fileName, const String &folderPath, int format) const noexcept
 Export route data in the desired format.

Detailed Description

A route is a part of the optimization's solution.

After an optimization is added, it receives a solution, which is a list of routes.

A route is the trip that a vehicle travels to visit the orders, so the number of routes returned is maximum the number of vehicles set in the optimization. If in the optimization only one vehicle is used, then the solution will contain only one route.

Implements share-read / copy-on-write Api object over IRoute.

Member Function Documentation

◆ addOrders()

int gem::vrp::Route::addOrders ( ProgressListener listener,
const RouteOrderList & orders,
bool optimalPosition,
Request & request,
bool reoptimize = false,
const std::map< vrp::EVehicleType, FloatListList > distancesToTheOtherLocations = std::map<vrp::EVehicleTypeFloatListList>(),
const std::map< vrp::EVehicleType, IntListList > timesToTheOtherLocations = std::map<vrp::EVehicleTypeIntListList>() )
inlinenoexcept

Async add orders to the route.

The orders will also be added in the orders list of the route's optimization.

Parameters
[in]listenerOperation progress listener. Returns:
[in]ordersThe Order objects list
[in]optimalPositionIf the orders should be added at the optimal position or not
[in]reoptimizeIf the route should be reoptimized after addition or not
[out]requestIf the optimization is reoptimized, then a request is created for this operation. Use the request's id to get the current status of the operation.
[in]distancesToTheOtherLocationsThe distances from each added order to the other orders of the optimization, for each vehicle type used (if the matrices are set by the user)
[in]timesToTheOtherLocationsThe times from each added order to the other orders of the optimization, for each vehicle type used (if the matrices are set by the user)
Returns
Error code if the operation couldn't start. If operation successfully started the progress and completion notifications will come via the listener
See also
EMatrixBuildType

◆ deleteOrder()

int gem::vrp::Route::deleteOrder ( ProgressListener listener,
RouteOrder & order )
inlinenoexcept

Async deletes an order from a route.

The order will also be deleted from the optimization.

Parameters
[in]listenerOperation progress listener. Returns:
[in]orderThe order that will be deleted. If the operation succeeded the object will have the id 0.
Returns
Error code if the operation couldn't start. If operation successfully started the progress and completion notifications will come via the listener

◆ exportInFile()

int gem::vrp::Route::exportInFile ( const String & fileName,
const String & folderPath,
int format ) const
inlinenoexcept

Export route data in the desired format.

Parameters
[in]fileNamethe name of the file where the route is exported
[in]folderPaththe folder where the file route is created
[in]formatthe file format: 0 = db, 1 = gpx
Returns
An error code representing if the export was successfully done or not.

◆ getBreaks()

const std::vector< vrp::VRPActualBreak > & gem::vrp::Route::getBreaks ( ) const
inlinenoexcept

Retrieves the list of actual breaks associated with the current object.

Returns
A constant reference to a std::vector containing vrp::VRPActualBreak objects representing the actual breaks.

◆ getConfigurationParameters()

const ConfigurationParametersRef gem::vrp::Route::getConfigurationParameters ( ) const
inlinenoexcept

Get the ConfigurationParameters for which the route was generated.

Returns
A constant reference to the ConfigurationParameters object representing the route's parameters.

◆ getCost()

float gem::vrp::Route::getCost ( ) const
inlinenoexcept

Get the cost of the route (the price for the total fuel that will be consumed).

If the used vehicle is a car or truck, than the price is calculated depending on the vehicle’s consumption, the price of the vehicle's fuel type and the total distance; otherwise the price is 0.

Returns
The fuel price for the entire route

◆ getCreationTime()

const TimeRef gem::vrp::Route::getCreationTime ( ) const
inlinenoexcept

Get the time when the route was created.

Returns
The moment when the route was created, as a TimeRef reference.

◆ getDeparture()

const DepartureRef gem::vrp::Route::getDeparture ( ) const
inlinenoexcept

Get the departure of the route.

Returns
A constant reference to the Departure object representing the route's departure point.

◆ getDestination()

const DestinationRef gem::vrp::Route::getDestination ( ) const
inlinenoexcept

Get the destination of the route.

Returns
A constant reference to the Destination object representing the route's destination point.

◆ getDistanceMatrices()

const std::map< EVehicleType, FloatListList > & gem::vrp::Route::getDistanceMatrices ( ) const
inlinenoexcept

Retrieves custom distance matrices set for each vehicle type.

This is used when distances between locations vary based on the type of vehicle, and precise control over routing is needed.

Returns
A map of vehicle types to their respective distance matrices.

◆ getId()

LargeInteger gem::vrp::Route::getId ( ) const
inlinenoexcept

Get the id of the route; it is used to identify the route when you have to update or delete it.

Returns
The route's id as LargeInteger
See also
Service::updateRoute(), Service::deleteRoute()

◆ getMatrixBuildType()

EMatrixBuildType gem::vrp::Route::getMatrixBuildType ( ) const
inlinenoexcept

Retrieves the method used for building the distance and time matrices.

Returns
The matrix build type as an EMatrixBuildType enumeration value.

◆ getNeededFuel()

float gem::vrp::Route::getNeededFuel ( ) const
inlinenoexcept

Get the total amount of fuel used during the route.

Returns
The needed fuel to complete the route

◆ getOptimizationId()

LargeInteger gem::vrp::Route::getOptimizationId ( ) const
inlinenoexcept

Get the optimization id to which the route belongs.

Returns
The optimization's id to which the route belongs

◆ getOrders()

const RouteOrderListRef gem::vrp::Route::getOrders ( ) const
inlinenoexcept

Get the list of orders that are ordered in the visiting order.

Returns
A constant reference to the RouteOrderList object representing the route's orders.

◆ getRideStatus()

ERideStatus gem::vrp::Route::getRideStatus ( ) const
inlinenoexcept

Return the status of the ride.

Returns
The status of the ride as an ERideStatus enumeration value.

◆ getShape()

const CoordinatesListRef gem::vrp::Route::getShape ( ) const
inlinenoexcept

Get the shape of the route.

Returns
a list of coordinates

◆ getTimeMatrices()

const std::map< EVehicleType, IntListList > & gem::vrp::Route::getTimeMatrices ( ) const
inlinenoexcept

Retrieves custom time matrices set for each vehicle type.

Similar to distance matrices but specifies the travel time between locations for different vehicle types.

Returns
A map of vehicle types to their respective time matrices.

◆ getTotalDistance()

float gem::vrp::Route::getTotalDistance ( ) const
inlinenoexcept

Get the total distance of the route in the distance unit set in the ConfigurationParameters.

Returns
The total distance of the route

◆ getTotalServiceTime()

int gem::vrp::Route::getTotalServiceTime ( ) const
inlinenoexcept

Get the total service time of all the orders of the route in seconds.

Returns
The total service time from the route

◆ getTotalTime()

int gem::vrp::Route::getTotalTime ( ) const
inlinenoexcept

Get the total duration of the route in seconds.

Returns
The total duration of the route

◆ getTotalWaitTime()

int gem::vrp::Route::getTotalWaitTime ( ) const
inlinenoexcept

Get the total wait time of the route in seconds.

Returns
Vehicle's total wait time along the route

◆ getVehicle()

const VehicleRef gem::vrp::Route::getVehicle ( ) const
inlinenoexcept

Get the Vehicle object upon which constraints are applied.

Returns
A constant reference to the Vehicle object representing the route's vehicle.

◆ getVehicleConstraints()

const VehicleConstraintsRef gem::vrp::Route::getVehicleConstraints ( ) const
inlinenoexcept

Get the VehicleConstraints of the route.

Returns
A constant reference to the VehicleConstraints object representing the route's vehicle constraints.

◆ operator!=()

bool gem::vrp::Route::operator!= ( Route const & route) const
inline

Compares two Route objects for equality.

Parameters
routeAnother Route object to compare against.
Returns
True if both Route objects represent the same data, false otherwise.

◆ operator=() [1/2]

Route & gem::vrp::Route::operator= ( const Route & )
default

Default copy assignment operator.

Replaces the contents of this object with a copy of another Route object.

Returns
A reference to the current object.

◆ operator=() [2/2]

Route & gem::vrp::Route::operator= ( Route && )
defaultnoexcept

Default move assignment operator.

Moves the contents of another Route object into this one.

Returns
A reference to the current object.

◆ operator==()

bool gem::vrp::Route::operator== ( Route const & route) const
inline

Compares two Route objects for equality.

Parameters
routeAnother Route object to compare against.
Returns
True if both Route objects represent the same data, false otherwise.

◆ reoptimize()

int gem::vrp::Route::reoptimize ( ProgressListener listener,
Request & request )
inlinenoexcept

Async reoptimize the route.

Parameters
[in]listenerOperation progress listener. Returns:
[out]requestThe request created for this operation. Use the request'id to get the current status of the operation.
Returns
Error code if the operation couldn't start. If operation successfully started the progress and completion notifications will come via the listener

◆ setConfigurationParameters()

Route & gem::vrp::Route::setConfigurationParameters ( const ConfigurationParameters & params)
inlinenoexcept

Set the ConfigurationParameters of the route.

Used when you want to update the route's configuration parameters.

Parameters
paramsThe new configuration parameters of the route
Returns
A reference to this Route object after the modification.
See also
Service::updateRoute()

◆ setDeparture()

Route & gem::vrp::Route::setDeparture ( const Departure & departure)
inlinenoexcept

Set the departure, from where the vehicle has to start the route.

Used when you want to update the route's start order using the method Service::updateRoute().

Parameters
departureThe new departure of the route
Returns
A reference to this Route object after the modification.

◆ setDestination()

Route & gem::vrp::Route::setDestination ( const Destination & destination)
inlinenoexcept

Set the destination of the route.

This method can be used when route type is ERouteType::RT_CustomEnd in order to update the route's end order using the method Service::updateRoute().

Parameters
destinationThe new destination of the route
Returns
A reference to this Route object after the modification.
See also
ERouteType

◆ setMatrixBuildType()

Route & gem::vrp::Route::setMatrixBuildType ( EMatrixBuildType matrixBuildType)
inlinenoexcept

Sets the method to be used for constructing the distance and time matrices for the optimization.

This can significantly impact the optimization's realism and accuracy.

Parameters
matrixBuildTypeThe matrix build type as an EMatrixBuildType enumeration value.
Returns
A reference to this Route object.

◆ setVehicle()

Route & gem::vrp::Route::setVehicle ( const IVehicle & vehicle)
inlinenoexcept

Set the vehicle object on which constraints are applied.

Parameters
vehicleThe new vehicle object of this route
Returns
A reference to this Route object after the modification.

◆ setVehicleConstraints()

Route & gem::vrp::Route::setVehicleConstraints ( const VehicleConstraints & vehConstr)
inlinenoexcept

Set the VehicleConstraints of the route.

Used when you want to update the route's vehicle constraints using the method Service::updateRoute()

Parameters
vehConstrThe new constraints for the route's vehicle
Returns
A reference to this Route object after the modification.

◆ unlink()

int gem::vrp::Route::unlink ( ProgressListener listener)
inlinenoexcept

Async unlinks the route from its optimization and a new Optimization is made for the route.

Parameters
[in]listenerOperation progress listener. Returns:
Returns
Error code if the operation couldn't start. If operation successfully started the progress and completion notifications will come via the listener