Eclipse SUMO - Simulation of Urban MObility
|
#include <MSStoppingPlaceRerouter.h>
Public Types | |
typedef std::map< MSStoppingPlace *, StoppingPlaceParamMap_t, ComparatorIdLess > | StoppingPlaceMap_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 | |
MSStoppingPlace * | 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 | |
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. | |
Definition at line 127 of file MSStoppingPlaceRerouter.h.
typedef std::map<MSStoppingPlace*, StoppingPlaceParamMap_t, ComparatorIdLess> MSStoppingPlaceRerouter::StoppingPlaceMap_t |
Definition at line 131 of file MSStoppingPlaceRerouter.h.
typedef std::map<std::string, double> MSStoppingPlaceRerouter::StoppingPlaceParamMap_t |
Definition at line 129 of file MSStoppingPlaceRerouter.h.
typedef std::map<std::string, bool> MSStoppingPlaceRerouter::StoppingPlaceParamSwitchMap_t |
Definition at line 130 of file MSStoppingPlaceRerouter.h.
typedef std::pair<MSStoppingPlace*, bool> MSStoppingPlaceRerouter::StoppingPlaceVisible |
Definition at line 132 of file MSStoppingPlaceRerouter.h.
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.
|
inlinevirtual |
Definition at line 138 of file MSStoppingPlaceRerouter.h.
|
privatedelete |
Constructor.
|
virtual |
read target function weights for this vehicle
Definition at line 537 of file MSStoppingPlaceRerouter.cpp.
References getWeight(), and myEvalParams.
Referenced by reroute().
|
virtual |
Compute some custom target function components.
[in] | veh | the concerned vehicle |
[in] | brakeGap | the distance before which the vehicle cannot stop |
[in] | newDestination | whether the destination changed |
[in] | alternative | the stopping place to evaluate |
[in] | occupancy | occupancy of the stopping place |
[in] | router | the router to use for evaluation if needed |
[in,out] | stoppingPlaceValues | the data structure to write the evaluation values to |
[in] | newRoute | the complete route to the destination passing by the stopping place |
[in] | stoppingPlaceApproach | the route to the stopping place |
[in] | maxValues | the maximum values of the components |
[in] | addInput | external input data |
Reimplemented in MSDevice_StationFinder.
Definition at line 510 of file MSStoppingPlaceRerouter.cpp.
Referenced by evaluateDestination().
|
virtual |
compute the target function for a single alternative
[in] | veh | the concerned vehicle |
[in] | brakeGap | the distance before which the vehicle cannot stop |
[in] | newDestination | whether the destination changed |
[in] | alternative | the stopping place to evaluate |
[in] | occupancy | occupancy of the stopping place |
[in] | prob | the predefined probability of this stopping place |
[in] | router | the router to use for evaluation if needed |
[in,out] | stoppingPlaces | the data structure to write the evaluation values to |
[in,out] | newRoutes | the data structure to write the chosen route to/from the stopping place to |
[in,out] | stoppingPlaceApproaches | the data structure to write the chosen route to the stopping place to |
[in,out] | maxValues | maximum values for all evaluation components |
[in] | addInput | external input data |
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().
|
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().
|
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().
|
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().
|
pure virtual |
Return the number of places the StoppingPlace provides.
Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.
Referenced by evaluateDestination(), and reroute().
|
pure virtual |
Return the number of occupied places of the StoppingPlace.
Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.
Referenced by evaluateDestination(), and reroute().
|
static |
compute the scalar target function value by means of a linear combination of all components/weights after normalising and optionally inverting the values
[in] | absValues | the component values |
[in] | maxValues | max values for all components |
[in] | weights | weight factors for all components |
[in] | norm | which component should be normalised |
[in] | invert | which component should be inverted |
Definition at line 586 of file MSStoppingPlaceRerouter.cpp.
Referenced by reroute().
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
[in] | veh | the concerned vehicle |
[in] | param | the name of the stopping place search param, excluding the param prefix (e.g. "parking.") |
[in] | defaultWeight | value to return in case the param hasn't been defined for the vehicle |
[in] | warn | whether a warning message shall be issued if the param is not defined for the vehicle |
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().
|
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().
|
pure virtual |
store the blocked stopping place in the vehicle
Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.
Referenced by reroute().
|
pure virtual |
store the stopping place score in the vehicle
Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.
Referenced by evaluateDestination(), and 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
[in] | veh | the concerned vehicle |
[in] | stoppingPlaceCandidates | stopping places to choose from and whether they are visible for the vehicle |
[in] | probs | probabilities of all candidate stopping places |
[in] | newDestination | whether the destination changed |
[out] | newRoute | the route to/from the chosen stopping place is stored here |
[in,out] | scores | input score values from external source and get scores of all components of the "best" StoppingPlace |
[in] | closedEdges | edges to avoid during routing |
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().
|
pure virtual |
forget all stopping place score for this vehicle
Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.
Referenced by reroute().
|
pure virtual |
ask the vehicle when it has seen the stopping place
Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.
Referenced by reroute().
|
pure virtual |
update the number of reroutes for the vehicle
Implemented in MSTriggeredRerouter, and MSDevice_StationFinder.
Referenced by reroute().
|
static |
keep track of the maximum values of each component
[in] | stoppingPlaceValues | the target function component values of a vehicle |
[in,out] | maxValues | stores the maximum values of the given stoppingPlaceValues and previously given maxValues |
Definition at line 576 of file MSStoppingPlaceRerouter.cpp.
Referenced by evaluateDestination().
|
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().
|
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().
|
protected |
Definition at line 287 of file MSStoppingPlaceRerouter.h.
Referenced by evaluateDestination(), and MSDevice_StationFinder::findChargingStation().
|
protected |
Definition at line 288 of file MSStoppingPlaceRerouter.h.
Referenced by reroute().
|
protected |
Definition at line 289 of file MSStoppingPlaceRerouter.h.
Referenced by collectWeights(), and MSStoppingPlaceRerouter().
|
protected |
Definition at line 291 of file MSStoppingPlaceRerouter.h.
Referenced by MSStoppingPlaceRerouter(), and reroute().
|
protected |
Definition at line 290 of file MSStoppingPlaceRerouter.h.
Referenced by MSStoppingPlaceRerouter(), and reroute().
|
protected |
Definition at line 286 of file MSStoppingPlaceRerouter.h.
Referenced by evaluateDestination(), and getWeight().
|
protected |
Definition at line 285 of file MSStoppingPlaceRerouter.h.
Referenced by reroute().