50 typedef std::map<const MSStoppingPlace*, StoppingPlaceMemoryEntry, ComparatorIdLess>
StoppingPlaceMap;
63 auto it =
myMap.find(
id);
64 if (it ==
myMap.end()) {
79 return (
int)
myMap.size();
92 auto it =
myMap.find(stoppingPlace);
93 if (it ==
myMap.end()) {
96 return local ? it->second.blockedAtTimeLocal : it->second.blockedAtTime;
102 myMap[stoppingPlace].score = score;
106 for (
auto& item :
myMap) {
107 item.second.score =
"";
112 typename StoppingPlaceMap::const_iterator
begin()
const {
113 return myMap.begin();
117 typename StoppingPlaceMap::const_iterator
end()
const {
156 const int insertStopIndex = 0,
const bool keepCurrentStop =
true);
178 std::map<MSStoppingPlace*, ConstMSEdgeVector>& newRoutes,
179 std::map<MSStoppingPlace*, ConstMSEdgeVector>& stoppingPlaceApproaches,
182 const int insertStopIndex = 0,
183 const bool keepCurrentStop =
true);
255 double getWeight(
SUMOVehicle& veh,
const std::string param,
const double defaultWeight,
const bool warn =
false);
278 for (
auto& it : stoppingPlaceParams) {
279 const double value =
getWeight(veh, it.first, stoppingPlaceDefaults[it.first]);
281 if (value > maxValues[it.first]) {
282 maxValues[it.first] = value;
289 const int stopCount = (int)veh.
getStops().size();
290 if (insertStopIndex == 0 || stopCount == 0) {
294 const int stopIndex =
MIN2(insertStopIndex, stopCount - 1);
295 std::list<MSStop>::const_iterator it = veh.
getStops().begin();
296 std::advance(it, stopIndex);
297 MSStop relevantStop = *it;
298 return relevantStop.
edge;
std::vector< const MSEdge * > ConstMSEdgeVector
std::vector< MSEdge * > MSEdgeVector
ConstMSEdgeVector::const_iterator MSRouteIterator
SumoXMLTag
Numbers representing SUMO-XML - element names.
A road/street connecting two junctions.
MSRouteIterator edge
The edge in the route to stop at.
A lane area vehicles can halt at.
virtual bool useStoppingPlace(MSStoppingPlace *stoppingPlace)
Whether the stopping place should be included in the search (can be used to add an additional filter)
virtual void rememberBlockedStoppingPlace(SUMOVehicle &veh, const MSStoppingPlace *stoppingPlace, bool blocked)=0
store the blocked stopping place in the vehicle
virtual SUMOTime sawBlockedStoppingPlace(SUMOVehicle &veh, MSStoppingPlace *place, bool local)=0
ask the vehicle when it has seen the stopping place
StoppingPlaceParamSwitchMap_t myNormParams
std::map< std::string, bool > StoppingPlaceParamSwitchMap_t
std::map< std::string, double > StoppingPlaceParamMap_t
const bool myConsiderDestVisibility
static void updateMaxValues(StoppingPlaceParamMap_t &stoppingPlaceValues, StoppingPlaceParamMap_t &maxValues)
keep track of the maximum values of each component
virtual SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouter(SUMOVehicle &veh, const MSEdgeVector &prohibited={})
Provide the router to use (MSNet::getRouterTT or MSRoutingEngine)
std::map< MSStoppingPlace *, StoppingPlaceParamMap_t, ComparatorIdLess > StoppingPlaceMap_t
virtual int getNumberStoppingPlaceReroutes(SUMOVehicle &veh)=0
ask how many times already the vehicle has been rerouted to another stopping place
virtual double getStoppingPlaceCapacity(MSStoppingPlace *stoppingPlace)=0
Return the number of places the StoppingPlace provides.
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 a...
MSStoppingPlace * reroute(std::vector< StoppingPlaceVisible > &stoppingPlaceCandidates, const std::vector< double > &probs, SUMOVehicle &veh, bool &newDestination, ConstMSEdgeVector &newRoute, StoppingPlaceParamMap_t &scores, const MSEdgeVector &closedEdges={}, const int insertStopIndex=0, const bool keepCurrentStop=true)
main method to trigger the rerouting to the "best" StoppingPlace according to the custom evaluation f...
virtual ~MSStoppingPlaceRerouter()
const MSRouteIterator determineRerouteOrigin(SUMOVehicle &veh, int insertStopIndex)
Determine the rerouting origin edge (not necessarily the current edge of the vehicle!...
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...
const SumoXMLTag myStoppingType
virtual double getStoppingPlaceOccupancy(MSStoppingPlace *stoppingPlace)=0
Return the number of occupied places of the StoppingPlace.
const std::string myParamPrefix
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
virtual StoppingPlaceParamMap_t collectWeights(SUMOVehicle &veh)
read target function weights for this vehicle
StoppingPlaceParamMap_t myEvalParams
StoppingPlaceParamSwitchMap_t myInvertParams
virtual void rememberStoppingPlaceScore(SUMOVehicle &veh, MSStoppingPlace *place, const std::string &score)=0
store the stopping place score in the vehicle
virtual void resetStoppingPlaceScores(SUMOVehicle &veh)=0
forget all stopping place score for this vehicle
virtual void setNumberStoppingPlaceReroutes(SUMOVehicle &veh, int value)=0
update the number of reroutes for the vehicle
virtual bool validComponentValues(StoppingPlaceParamMap_t &stoppingPlaceValues)
Whether the stopping place should be discarded due to its results from the component evaluation (allo...
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.
std::pair< MSStoppingPlace *, bool > StoppingPlaceVisible
virtual double getLastStepStoppingPlaceOccupancy(MSStoppingPlace *stoppingPlace)=0
Return the number of occupied places of the StoppingPlace from the previous time step.
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, const int insertStopIndex=0, const bool keepCurrentStop=true)
compute the target function for a single alternative
MSStoppingPlaceRerouter()=delete
Constructor.
Representation of a vehicle.
virtual ConstMSEdgeVector::const_iterator getRerouteOrigin() const =0
Returns the starting point for reroutes (usually the current edge)
virtual const std::list< MSStop > & getStops() const =0
void resetStoppingPlaceScores()
int size() const
Returns the number of stored items within the container.
virtual ~StoppingPlaceMemory()
std::map< const MSStoppingPlace *, StoppingPlaceMemoryEntry, ComparatorIdLess > StoppingPlaceMap
Definition of the map containing all visited stopping places.
void clear()
Removes all data about evaluated StoppingPlace items.
SUMOTime sawBlockedStoppingPlace(const MSStoppingPlace *stoppingPlace, bool local) const
Get the time the StoppingPlace was confirmed to be blocked.
StoppingPlaceMap myMap
The map from StoppingPlace to single evaluation.
void rememberStoppingPlaceScore(const MSStoppingPlace *stoppingPlace, const std::string &score)
score only needed when running with gui
StoppingPlaceMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
StoppingPlaceMemory()
Constructor.
void rememberBlockedStoppingPlace(const MSStoppingPlace *stoppingPlace, bool local)
Store the time the StoppingPlace was confirmed to be blocked.
bool remove(MSStoppingPlace *id)
Removes an item.
StoppingPlaceMap::const_iterator begin() const
Returns a reference to the begin iterator for the internal map.
store information for a single stopping place
SUMOTime blockedAtTimeLocal
StoppingPlaceMemoryEntry()