21 #ifndef MSDevice_Routing_h 22 #define MSDevice_Routing_h 121 static void waitForAll();
125 static void unlock() {
126 myThreadPool.unlock();
128 static bool isParallel() {
129 return myThreadPool.size() > 0;
194 void setParameter(
const std::string& key,
const std::string& value);
211 virtual ~WorkerThread() {
226 : myVehicle(v), myTime(time), myOnInit(onInit) {}
234 RoutingTask&
operator=(
const RoutingTask&);
SUMOTime myPeriod
The period with which a vehicle shall be rerouted.
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key ...
static double myRandomizeWeightsFactor
Whether to disturb edge weights dynamically.
SUMOTime mySkipRouting
The time for which routing may be skipped because we cannot be inserted.
static SUMOTime adaptEdgeEfforts(SUMOTime currentTime)
Adapt edge efforts by the current edge states.
static SUMOTime myAdaptationInterval
At which time interval the edge weights get updated.
SUMOTime myLastRouting
The last time a routing took place.
MSDevice_Routing(SUMOVehicle &holder, const std::string &id, SUMOTime period, SUMOTime preInsertionPeriod)
Constructor.
Notification
Definition of a vehicle state.
A device that performs vehicle rerouting based on current edge speeds.
Computes the shortest path through a network using the A* algorithm.
const std::string deviceName() const
return the name for this type of device
SUMOTime myPreInsertionPeriod
The period with which a vehicle shall be rerouted before insertion.
static int myAdaptationSteps
The number of steps for averaging edge speeds (ring-buffer)
SUMOTime wrappedRerouteCommandExecute(SUMOTime currentTime)
Performs rerouting after a period.
static Command * myEdgeWeightSettingCommand
The weights adaptation/overwriting command.
void skipRouting(const SUMOTime currentTime)
Labels the current time step as "unroutable".
Base (microsim) event class.
static std::vector< std::vector< double > > myPastEdgeSpeeds
The container of edge speeds.
static double myAdaptationWeight
Information which weight prior edge efforts have.
A road/street connecting two junctions.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Routing-options.
static bool myWithTaz
whether taz shall be used at initial rerouting
void reroute(const SUMOTime currentTime, const bool onInit=false)
initiate the rerouting, create router / thread pool on first use
Representation of a vehicle.
static void initEdgeWeights()
initialize the edge weights if not done before
static std::map< std::pair< const MSEdge *, const MSEdge * >, const MSRoute * > myCachedRoutes
The container of pre-calculated routes.
MSDevice_Routing & operator=(const MSDevice_Routing &)
Invalidated assignment operator.
static std::vector< double > myEdgeSpeeds
The container of edge speeds.
WrappingCommand< MSDevice_Routing > * myRerouteCommand
The (optional) command responsible for rerouting.
static bool isEnabled()
returns whether any routing actions take place
Abstract in-vehicle device.
A pool of worker threads which distributes the tasks and collects the results.
static SUMOAbstractRouter< MSEdge, SUMOVehicle > * myRouter
The router to use.
A storage for options typed value containers)
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into)
Build devices for the given vehicle, if needed.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes a new route on vehicle insertion.
~MSDevice_Routing()
Destructor.
static void cleanup()
deletes the router instance
static bool checkOptions(OptionsCont &oc)
checks MSDevice_Routing-options
Abstract superclass of a task to be run with an index to keep track of pending tasks.
A thread repeatingly calculating incoming tasks.
static AStarRouter< MSEdge, SUMOVehicle, prohibited_withPermissions< MSEdge, SUMOVehicle > > * myRouterWithProhibited
The router to use by rerouter elements.
std::vector< MSEdge * > MSEdgeVector
static double getAssumedSpeed(const MSEdge *edge)
return current travel speed assumption
static SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector())
return the router instance
static SUMOTime myLastAdaptation
Information when the last edge weight adaptation occured.
Representation of a lane in the micro simulation.
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key ...
SUMOTime preInsertionReroute(const SUMOTime currentTime)
Performs rerouting before insertion into the network.
static int myAdaptationStepsIndex
The current index in the pastEdgeSpeed ring-buffer.