Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSStoppingPlaceRerouter Class Referenceabstract

#include <MSStoppingPlaceRerouter.h>

Inheritance diagram for MSStoppingPlaceRerouter:
[legend]

Public Types

typedef std::map< MSStoppingPlace *, StoppingPlaceParamMap_t, ComparatorIdLessStoppingPlaceMap_t
 
typedef std::map< std::string, double > StoppingPlaceParamMap_t
 
typedef std::map< std::string, bool > StoppingPlaceParamSwitchMap_t
 
typedef std::pair< MSStoppingPlace *, bool > StoppingPlaceVisible
 

Public Member Functions

virtual StoppingPlaceParamMap_t collectWeights (SUMOVehicle &veh)
 read target function weights for this vehicle
 
virtual bool evaluateCustomComponents (SUMOVehicle &veh, double brakeGap, bool newDestination, MSStoppingPlace *alternative, double occupancy, double prob, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, StoppingPlaceParamMap_t &stoppingPlaceValues, ConstMSEdgeVector &newRoute, ConstMSEdgeVector &stoppingPlaceApproach, StoppingPlaceParamMap_t &maxValues, StoppingPlaceParamMap_t &addInput)
 Compute some custom target function components.
 
virtual bool evaluateDestination (SUMOVehicle &veh, double brakeGap, bool newDestination, MSStoppingPlace *alternative, double occupancy, double prob, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, StoppingPlaceMap_t &stoppingPlaces, std::map< MSStoppingPlace *, ConstMSEdgeVector > &newRoutes, std::map< MSStoppingPlace *, ConstMSEdgeVector > &stoppingPlaceApproaches, StoppingPlaceParamMap_t &maxValues, StoppingPlaceParamMap_t &addInput)
 compute the target function for a single alternative
 
virtual double getLastStepStoppingPlaceOccupancy (MSStoppingPlace *stoppingPlace)=0
 Return the number of occupied places of the StoppingPlace from the previous time step.
 
virtual int getNumberStoppingPlaceReroutes (SUMOVehicle &veh)=0
 ask how many times already the vehicle has been rerouted to another stopping place
 
virtual SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouter (SUMOVehicle &veh, const MSEdgeVector &prohibited={})
 Provide the router to use (MSNet::getRouterTT or MSRoutingEngine)
 
virtual double getStoppingPlaceCapacity (MSStoppingPlace *stoppingPlace)=0
 Return the number of places the StoppingPlace provides.
 
virtual double getStoppingPlaceOccupancy (MSStoppingPlace *stoppingPlace)=0
 Return the number of occupied places of the StoppingPlace.
 
double getWeight (SUMOVehicle &veh, const std::string param, const double defaultWeight, const bool warn=false)
 read the value of a stopping place search param, e.g. a component weight factor
 
 MSStoppingPlaceRerouter (SumoXMLTag stoppingType, std::string paramPrefix="", bool checkValidity=false, bool checkVisibility=true, StoppingPlaceParamMap_t addEvalParams={}, StoppingPlaceParamSwitchMap_t addInvertParams={})
 Constructor.
 
virtual void rememberBlockedStoppingPlace (SUMOVehicle &veh, const MSStoppingPlace *stoppingPlace, bool blocked)=0
 store the blocked stopping place in the vehicle
 
virtual void rememberStoppingPlaceScore (SUMOVehicle &veh, MSStoppingPlace *place, const std::string &score)=0
 store the stopping place score in the vehicle
 
MSStoppingPlacereroute (std::vector< StoppingPlaceVisible > &stoppingPlaceCandidates, const std::vector< double > &probs, SUMOVehicle &veh, bool &newDestination, ConstMSEdgeVector &newRoute, StoppingPlaceParamMap_t &scores, const MSEdgeVector &closedEdges={})
 main method to trigger the rerouting to the "best" StoppingPlace according to the custom evaluation function
 
virtual void resetStoppingPlaceScores (SUMOVehicle &veh)=0
 forget all stopping place score for this vehicle
 
virtual SUMOTime sawBlockedStoppingPlace (SUMOVehicle &veh, MSStoppingPlace *place, bool local)=0
 ask the vehicle when it has seen the stopping place
 
virtual void setNumberStoppingPlaceReroutes (SUMOVehicle &veh, int value)=0
 update the number of reroutes for the vehicle
 
virtual bool useStoppingPlace (MSStoppingPlace *stoppingPlace)
 Whether the stopping place should be included in the search (can be used to add an additional filter)
 
virtual bool validComponentValues (StoppingPlaceParamMap_t &stoppingPlaceValues)
 Whether the stopping place should be discarded due to its results from the component evaluation (allows to check for min/max thresholds and other non-linear relations)
 
virtual ~MSStoppingPlaceRerouter ()
 

Static Public Member Functions

static double getTargetValue (const StoppingPlaceParamMap_t &absValues, const StoppingPlaceParamMap_t &maxValues, const StoppingPlaceParamMap_t &weights, const StoppingPlaceParamSwitchMap_t &norm, const StoppingPlaceParamSwitchMap_t &invert)
 compute the scalar target function value by means of a linear combination of all components/weights after normalising and optionally inverting the values
 
static void updateMaxValues (StoppingPlaceParamMap_t &stoppingPlaceValues, StoppingPlaceParamMap_t &maxValues)
 keep track of the maximum values of each component
 

Protected Member Functions

void readEvaluationWeights (SUMOVehicle &veh, StoppingPlaceParamMap_t &stoppingPlaceParams, StoppingPlaceParamMap_t &stoppingPlaceDefaults, StoppingPlaceParamMap_t &maxValues)
 Ask the vehicle about the relevant rerouting parameters and initiate the maximum value data structure.
 

Protected Attributes

bool myCheckValidity
 
const bool myConsiderDestVisibility
 
StoppingPlaceParamMap_t myEvalParams
 
StoppingPlaceParamSwitchMap_t myInvertParams
 
StoppingPlaceParamSwitchMap_t myNormParams
 
const std::string myParamPrefix
 
const SumoXMLTag myStoppingType
 

Private Member Functions

 MSStoppingPlaceRerouter ()=delete
 Constructor.
 

Detailed Description

Definition at line 127 of file MSStoppingPlaceRerouter.h.

Member Typedef Documentation

◆ StoppingPlaceMap_t

◆ StoppingPlaceParamMap_t

typedef std::map<std::string, double> MSStoppingPlaceRerouter::StoppingPlaceParamMap_t

Definition at line 129 of file MSStoppingPlaceRerouter.h.

◆ StoppingPlaceParamSwitchMap_t

typedef std::map<std::string, bool> MSStoppingPlaceRerouter::StoppingPlaceParamSwitchMap_t

Definition at line 130 of file MSStoppingPlaceRerouter.h.

◆ StoppingPlaceVisible

Definition at line 132 of file MSStoppingPlaceRerouter.h.

Constructor & Destructor Documentation

◆ MSStoppingPlaceRerouter() [1/2]

MSStoppingPlaceRerouter::MSStoppingPlaceRerouter ( SumoXMLTag  stoppingType,
std::string  paramPrefix = "",
bool  checkValidity = false,
bool  checkVisibility = true,
StoppingPlaceParamMap_t  addEvalParams = {},
StoppingPlaceParamSwitchMap_t  addInvertParams = {} 
)

Constructor.

Definition at line 37 of file MSStoppingPlaceRerouter.cpp.

References myEvalParams, myInvertParams, and myNormParams.

◆ ~MSStoppingPlaceRerouter()

virtual MSStoppingPlaceRerouter::~MSStoppingPlaceRerouter ( )
inlinevirtual

Definition at line 138 of file MSStoppingPlaceRerouter.h.

◆ MSStoppingPlaceRerouter() [2/2]

MSStoppingPlaceRerouter::MSStoppingPlaceRerouter ( )
privatedelete

Constructor.

Member Function Documentation

◆ collectWeights()

MSStoppingPlaceRerouter::StoppingPlaceParamMap_t MSStoppingPlaceRerouter::collectWeights ( SUMOVehicle veh)
virtual

read target function weights for this vehicle

Definition at line 537 of file MSStoppingPlaceRerouter.cpp.

References getWeight(), and myEvalParams.

Referenced by reroute().

Here is the caller graph for this function:

◆ evaluateCustomComponents()

bool MSStoppingPlaceRerouter::evaluateCustomComponents ( SUMOVehicle veh,
double  brakeGap,
bool  newDestination,
MSStoppingPlace alternative,
double  occupancy,
double  prob,
SUMOAbstractRouter< MSEdge, SUMOVehicle > &  router,
StoppingPlaceParamMap_t stoppingPlaceValues,
ConstMSEdgeVector newRoute,
ConstMSEdgeVector stoppingPlaceApproach,
StoppingPlaceParamMap_t maxValues,
StoppingPlaceParamMap_t addInput 
)
virtual

Compute some custom target function components.

Parameters
[in]vehthe concerned vehicle
[in]brakeGapthe distance before which the vehicle cannot stop
[in]newDestinationwhether the destination changed
[in]alternativethe stopping place to evaluate
[in]occupancyoccupancy of the stopping place
[in]routerthe router to use for evaluation if needed
[in,out]stoppingPlaceValuesthe data structure to write the evaluation values to
[in]newRoutethe complete route to the destination passing by the stopping place
[in]stoppingPlaceApproachthe route to the stopping place
[in]maxValuesthe maximum values of the components
[in]addInputexternal input data
Returns
false if the stopping place cannot be used according to the custom evaluation components

Reimplemented in MSDevice_StationFinder.

Definition at line 510 of file MSStoppingPlaceRerouter.cpp.

Referenced by evaluateDestination().

Here is the caller graph for this function:

◆ evaluateDestination()

bool MSStoppingPlaceRerouter::evaluateDestination ( SUMOVehicle veh,
double  brakeGap,
bool  newDestination,
MSStoppingPlace alternative,
double  occupancy,
double  prob,
SUMOAbstractRouter< MSEdge, SUMOVehicle > &  router,
StoppingPlaceMap_t stoppingPlaces,
std::map< MSStoppingPlace *, ConstMSEdgeVector > &  newRoutes,
std::map< MSStoppingPlace *, ConstMSEdgeVector > &  stoppingPlaceApproaches,
StoppingPlaceParamMap_t maxValues,
StoppingPlaceParamMap_t addInput 
)
virtual

compute the target function for a single alternative

Parameters
[in]vehthe concerned vehicle
[in]brakeGapthe distance before which the vehicle cannot stop
[in]newDestinationwhether the destination changed
[in]alternativethe stopping place to evaluate
[in]occupancyoccupancy of the stopping place
[in]probthe predefined probability of this stopping place
[in]routerthe router to use for evaluation if needed
[in,out]stoppingPlacesthe data structure to write the evaluation values to
[in,out]newRoutesthe data structure to write the chosen route to/from the stopping place to
[in,out]stoppingPlaceApproachesthe data structure to write the chosen route to the stopping place to
[in,out]maxValuesmaximum values for all evaluation components
[in]addInputexternal input data
Returns
false if the stopping place cannot be used

Definition at line 388 of file MSStoppingPlaceRerouter.cpp.

References MSRoute::begin(), SUMOAbstractRouter< E, V >::compute(), RGBColor::DEFAULT_COLOR, MSRoute::end(), evaluateCustomComponents(), SUMOVehicle::getArrivalPos(), MSStoppingPlace::getBeginLanePosition(), MSRoute::getColor(), MSRoute::getDistanceBetween(), MSLane::getEdge(), SUMOTrafficObject::getEdge(), MSRoute::getEdges(), MSStoppingPlace::getEndLanePosition(), Named::getID(), MSNet::getInstance(), MSStoppingPlace::getLane(), MSRoute::getLastEdge(), MSStoppingPlace::getLastFreePos(), MSLane::getLength(), SUMOTrafficObject::getPositionOnLane(), SUMOVehicle::getRerouteOrigin(), SUMOVehicle::getRoute(), MSLane::getSpeedLimit(), SUMOVehicle::getStopIndices(), getStoppingPlaceCapacity(), getStoppingPlaceOccupancy(), MSRoute::getStops(), MSGlobals::gUsingInternalLanes, MSNet::hasInternalLinks(), MAX2(), myCheckValidity, myParamPrefix, SUMOAbstractRouter< E, V >::recomputeCosts(), rememberStoppingPlaceScore(), SIMSTEP, MSRoute::size(), time2string(), TL, updateMaxValues(), validComponentValues(), and WRITE_WARNINGF.

Referenced by reroute().

Here is the caller graph for this function:

◆ getLastStepStoppingPlaceOccupancy()

virtual double MSStoppingPlaceRerouter::getLastStepStoppingPlaceOccupancy ( MSStoppingPlace stoppingPlace)
pure virtual

Return the number of occupied places of the StoppingPlace from the previous time step.

Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.

Referenced by reroute().

Here is the caller graph for this function:

◆ getNumberStoppingPlaceReroutes()

virtual int MSStoppingPlaceRerouter::getNumberStoppingPlaceReroutes ( SUMOVehicle veh)
pure virtual

ask how many times already the vehicle has been rerouted to another stopping place

Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.

Referenced by reroute().

Here is the caller graph for this function:

◆ getRouter()

SUMOAbstractRouter< MSEdge, SUMOVehicle > & MSStoppingPlaceRerouter::getRouter ( SUMOVehicle veh,
const MSEdgeVector prohibited = {} 
)
virtual

Provide the router to use (MSNet::getRouterTT or MSRoutingEngine)

Reimplemented in MSDevice_StationFinder.

Definition at line 531 of file MSStoppingPlaceRerouter.cpp.

References MSNet::getInstance(), SUMOTrafficObject::getRNGIndex(), and MSNet::getRouterTT().

Referenced by reroute().

Here is the caller graph for this function:

◆ getStoppingPlaceCapacity()

virtual double MSStoppingPlaceRerouter::getStoppingPlaceCapacity ( MSStoppingPlace stoppingPlace)
pure virtual

Return the number of places the StoppingPlace provides.

Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.

Referenced by evaluateDestination(), and reroute().

Here is the caller graph for this function:

◆ getStoppingPlaceOccupancy()

virtual double MSStoppingPlaceRerouter::getStoppingPlaceOccupancy ( MSStoppingPlace stoppingPlace)
pure virtual

Return the number of occupied places of the StoppingPlace.

Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.

Referenced by evaluateDestination(), and reroute().

Here is the caller graph for this function:

◆ getTargetValue()

double MSStoppingPlaceRerouter::getTargetValue ( const StoppingPlaceParamMap_t absValues,
const StoppingPlaceParamMap_t maxValues,
const StoppingPlaceParamMap_t weights,
const StoppingPlaceParamSwitchMap_t norm,
const StoppingPlaceParamSwitchMap_t invert 
)
static

compute the scalar target function value by means of a linear combination of all components/weights after normalising and optionally inverting the values

Parameters
[in]absValuesthe component values
[in]maxValuesmax values for all components
[in]weightsweight factors for all components
[in]normwhich component should be normalised
[in]invertwhich component should be inverted
Returns
target function value for a single stopping place and vehicle

Definition at line 586 of file MSStoppingPlaceRerouter.cpp.

Referenced by reroute().

Here is the caller graph for this function:

◆ getWeight()

double MSStoppingPlaceRerouter::getWeight ( SUMOVehicle veh,
const std::string  param,
const double  defaultWeight,
const bool  warn = false 
)

read the value of a stopping place search param, e.g. a component weight factor

Parameters
[in]vehthe concerned vehicle
[in]paramthe name of the stopping place search param, excluding the param prefix (e.g. "parking.")
[in]defaultWeightvalue to return in case the param hasn't been defined for the vehicle
[in]warnwhether a warning message shall be issued if the param is not defined for the vehicle
Returns
param value

Definition at line 549 of file MSStoppingPlaceRerouter.cpp.

References Named::getID(), MSVehicleType::getParameter(), SUMOTrafficObject::getParameter(), Parameterised::getParameter(), SUMOTrafficObject::getVehicleType(), Parameterised::hasParameter(), myParamPrefix, TL, StringUtils::toDouble(), toString(), WRITE_MESSAGEF, and WRITE_WARNINGF.

Referenced by collectWeights(), MSDevice_StationFinder::findChargingStation(), readEvaluationWeights(), and reroute().

Here is the caller graph for this function:

◆ readEvaluationWeights()

void MSStoppingPlaceRerouter::readEvaluationWeights ( SUMOVehicle veh,
StoppingPlaceParamMap_t stoppingPlaceParams,
StoppingPlaceParamMap_t stoppingPlaceDefaults,
StoppingPlaceParamMap_t maxValues 
)
inlineprotected

Ask the vehicle about the relevant rerouting parameters and initiate the maximum value data structure.

Definition at line 269 of file MSStoppingPlaceRerouter.h.

References getWeight().

◆ rememberBlockedStoppingPlace()

virtual void MSStoppingPlaceRerouter::rememberBlockedStoppingPlace ( SUMOVehicle veh,
const MSStoppingPlace stoppingPlace,
bool  blocked 
)
pure virtual

store the blocked stopping place in the vehicle

Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.

Referenced by reroute().

Here is the caller graph for this function:

◆ rememberStoppingPlaceScore()

virtual void MSStoppingPlaceRerouter::rememberStoppingPlaceScore ( SUMOVehicle veh,
MSStoppingPlace place,
const std::string &  score 
)
pure virtual

store the stopping place score in the vehicle

Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.

Referenced by evaluateDestination(), and reroute().

Here is the caller graph for this function:

◆ reroute()

MSStoppingPlace * MSStoppingPlaceRerouter::reroute ( std::vector< StoppingPlaceVisible > &  stoppingPlaceCandidates,
const std::vector< double > &  probs,
SUMOVehicle veh,
bool &  newDestination,
ConstMSEdgeVector newRoute,
StoppingPlaceParamMap_t scores,
const MSEdgeVector closedEdges = {} 
)

main method to trigger the rerouting to the "best" StoppingPlace according to the custom evaluation function

Parameters
[in]vehthe concerned vehicle
[in]stoppingPlaceCandidatesstopping places to choose from and whether they are visible for the vehicle
[in]probsprobabilities of all candidate stopping places
[in]newDestinationwhether the destination changed
[out]newRoutethe route to/from the chosen stopping place is stored here
[in,out]scoresinput score values from external source and get scores of all components of the "best" StoppingPlace
[in]closedEdgesedges to avoid during routing
Returns
the best stopping place according to the target function or nullptr

Definition at line 51 of file MSStoppingPlaceRerouter.cpp.

References collectWeights(), DEBUGCOND, evaluateDestination(), SUMOVehicle::getArrivalPos(), MSStoppingPlace::getBeginLanePosition(), SUMOVehicle::getBrakeGap(), MSLane::getEdge(), SUMOTrafficObject::getEdge(), MSStoppingPlace::getEndLanePosition(), Named::getID(), Named::getIDSecure(), MSStoppingPlace::getLane(), SUMOTrafficObject::getLane(), MSRoute::getLastEdge(), getLastStepStoppingPlaceOccupancy(), SUMOVehicle::getNextParkingArea(), getNumberStoppingPlaceReroutes(), SUMOTrafficObject::getPositionOnLane(), SUMOTrafficObject::getRNG(), SUMOVehicle::getRoute(), getRouter(), getStoppingPlaceCapacity(), getStoppingPlaceOccupancy(), SUMOVehicle::getStops(), getTargetValue(), getWeight(), joinToString(), MIN2(), myConsiderDestVisibility, myInvertParams, myNormParams, myStoppingType, RandHelper::rand(), rememberBlockedStoppingPlace(), rememberStoppingPlaceScore(), resetStoppingPlaceScores(), sawBlockedStoppingPlace(), setNumberStoppingPlaceReroutes(), SIMSTEP, SIMTIME, STEPS2TIME, SUMO_TAG_PARKING_AREA, TIME2STEPS, time2string(), TL, toString(), useStoppingPlace(), and WRITE_WARNINGF.

Referenced by MSDevice_StationFinder::findChargingStation(), and MSTriggeredRerouter::rerouteParkingArea().

Here is the caller graph for this function:

◆ resetStoppingPlaceScores()

virtual void MSStoppingPlaceRerouter::resetStoppingPlaceScores ( SUMOVehicle veh)
pure virtual

forget all stopping place score for this vehicle

Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.

Referenced by reroute().

Here is the caller graph for this function:

◆ sawBlockedStoppingPlace()

virtual SUMOTime MSStoppingPlaceRerouter::sawBlockedStoppingPlace ( SUMOVehicle veh,
MSStoppingPlace place,
bool  local 
)
pure virtual

ask the vehicle when it has seen the stopping place

Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.

Referenced by reroute().

Here is the caller graph for this function:

◆ setNumberStoppingPlaceReroutes()

virtual void MSStoppingPlaceRerouter::setNumberStoppingPlaceReroutes ( SUMOVehicle veh,
int  value 
)
pure virtual

update the number of reroutes for the vehicle

Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.

Referenced by reroute().

Here is the caller graph for this function:

◆ updateMaxValues()

void MSStoppingPlaceRerouter::updateMaxValues ( StoppingPlaceParamMap_t stoppingPlaceValues,
StoppingPlaceParamMap_t maxValues 
)
static

keep track of the maximum values of each component

Parameters
[in]stoppingPlaceValuesthe target function component values of a vehicle
[in,out]maxValuesstores the maximum values of the given stoppingPlaceValues and previously given maxValues

Definition at line 576 of file MSStoppingPlaceRerouter.cpp.

Referenced by evaluateDestination().

Here is the caller graph for this function:

◆ useStoppingPlace()

bool MSStoppingPlaceRerouter::useStoppingPlace ( MSStoppingPlace stoppingPlace)
virtual

Whether the stopping place should be included in the search (can be used to add an additional filter)

Reimplemented in MSDevice_StationFinder.

Definition at line 525 of file MSStoppingPlaceRerouter.cpp.

Referenced by reroute().

Here is the caller graph for this function:

◆ validComponentValues()

bool MSStoppingPlaceRerouter::validComponentValues ( StoppingPlaceParamMap_t stoppingPlaceValues)
virtual

Whether the stopping place should be discarded due to its results from the component evaluation (allows to check for min/max thresholds and other non-linear relations)

Reimplemented in MSDevice_StationFinder.

Definition at line 519 of file MSStoppingPlaceRerouter.cpp.

Referenced by evaluateDestination().

Here is the caller graph for this function:

Field Documentation

◆ myCheckValidity

bool MSStoppingPlaceRerouter::myCheckValidity
protected

◆ myConsiderDestVisibility

const bool MSStoppingPlaceRerouter::myConsiderDestVisibility
protected

Definition at line 288 of file MSStoppingPlaceRerouter.h.

Referenced by reroute().

◆ myEvalParams

StoppingPlaceParamMap_t MSStoppingPlaceRerouter::myEvalParams
protected

Definition at line 289 of file MSStoppingPlaceRerouter.h.

Referenced by collectWeights(), and MSStoppingPlaceRerouter().

◆ myInvertParams

StoppingPlaceParamSwitchMap_t MSStoppingPlaceRerouter::myInvertParams
protected

Definition at line 291 of file MSStoppingPlaceRerouter.h.

Referenced by MSStoppingPlaceRerouter(), and reroute().

◆ myNormParams

StoppingPlaceParamSwitchMap_t MSStoppingPlaceRerouter::myNormParams
protected

Definition at line 290 of file MSStoppingPlaceRerouter.h.

Referenced by MSStoppingPlaceRerouter(), and reroute().

◆ myParamPrefix

const std::string MSStoppingPlaceRerouter::myParamPrefix
protected

Definition at line 286 of file MSStoppingPlaceRerouter.h.

Referenced by evaluateDestination(), and getWeight().

◆ myStoppingType

const SumoXMLTag MSStoppingPlaceRerouter::myStoppingType
protected

Definition at line 285 of file MSStoppingPlaceRerouter.h.

Referenced by reroute().


The documentation for this class was generated from the following files: