Dynamical system model
Loading...
Searching...
No Matches
dsm::SecondOrderDynamics< Id, Size > Class Template Reference
Inheritance diagram for dsm::SecondOrderDynamics< Id, Size >:
dsm::Dynamics< Id, Size, double >

Public Member Functions

void setAgentSpeed (Size agentId)
 Set the speed of an agent.
 
void setSpeed ()
 
- Public Member Functions inherited from dsm::Dynamics< Id, Size, double >
 Dynamics (Graph< Id, Size > &graph)
 Construct a new Dynamics object.
 
void setItineraries (std::span< Itinerary< Id > > itineraries)
 Set the itineraries.
 
void setSeed (unsigned int seed)
 Set the seed for the graph's random number generator.
 
void setMinSpeedRateo (double minSpeedRateo)
 Set the minim speed rateo, i.e. the minim speed with respect to the speed limit.
 
void setErrorProbability (double errorProbability)
 Set the error probability.
 
void setMaxFlowPercentage (double maxFlowPercentage)
 Set the maximum flow percentage.
 
void setForcePriorities (bool forcePriorities)
 Set the force priorities flag.
 
virtual void updatePaths ()
 Update the paths of the itineraries based on the actual travel times.
 
virtual void evolve (bool reinsert_agents=false)
 Evolve the simulation.
 
void evolve (F f, Tn... args)
 Evolve the simulation.
 
void optimizeTrafficLights (double percentage, double threshold=0.)
 Optimize the traffic lights by changing the green and red times.
 
const Graph< Id, Size > & graph () const
 Get the graph.
 
const std::unordered_map< Id, std::unique_ptr< Itinerary< Id > > > & itineraries () const
 Get the itineraries.
 
const std::map< Id, std::unique_ptr< Agent< Id, Size, double > > > & agents () const
 Get the agents.
 
TimePoint time () const
 Get the time.
 
void addAgent (const Agent< Id, Size, double > &agent)
 Add an agent to the simulation.
 
void addAgent (std::unique_ptr< Agent< Id, Size, double > > agent)
 Add an agent to the simulation.
 
void addAgents (Id itineraryId, Size nAgents=1, std::optional< Id > srcNodeId=std::nullopt)
 Add a pack of agents to the simulation.
 
void addAgents (Tn... agents)
 Add a pack of agents to the simulation.
 
void addAgents (T1 agent, Tn... agents)
 Add a pack of agents to the simulation.
 
void addAgents (std::span< Agent< Id, Size, double > > agents)
 Add a set of agents to the simulation.
 
virtual void addAgentsUniformly (Size nAgents, std::optional< Id > itineraryId=std::nullopt)
 Add a set of agents to the simulation.
 
void removeAgent (Size agentId)
 Remove an agent from the simulation.
 
void removeAgents (T1 id, Tn... ids)
 
void addItinerary (const Itinerary< Id > &itinerary)
 Add an itinerary.
 
void addItinerary (std::unique_ptr< Itinerary< Id > > itinerary)
 Add an itinerary.
 
void addItineraries (Tn... itineraries)
 
void addItineraries (T1 itinerary, Tn... itineraries)
 Add a pack of itineraries.
 
void addItineraries (std::span< Itinerary< Id > > itineraries)
 Add a set of itineraries.
 
void resetTime ()
 Reset the simulation time.
 
Measurement< double > agentMeanSpeed () const
 Get the mean speed of the agents in $m/s$.
 
virtual double streetMeanSpeed (Id) const=0
 
virtual Measurement< double > streetMeanSpeed () const=0
 
virtual Measurement< double > streetMeanSpeed (double, bool) const=0
 
Measurement< double > streetMeanDensity () const
 Get the mean density of the streets in $m^{-1}$.
 
Measurement< double > streetMeanFlow () const
 Get the mean flow of the streets in $s^{-1}$.
 
Measurement< double > streetMeanFlow (double threshold, bool above) const
 Get the mean flow of the streets in $s^{-1}$.
 
Measurement< double > meanSpireInputFlow (bool resetValue=true)
 Get the mean spire input flow of the streets in $s^{-1}$.
 
Measurement< double > meanSpireOutputFlow (bool resetValue=true)
 Get the mean spire output flow of the streets in $s^{-1}$.
 
Measurement< double > meanTravelTime (bool clearData=false)
 Get the mean travel time of the agents in $s$.
 
const std::unordered_map< Id, std::array< unsigned long long, 4 > > & turnCounts () const
 Get the turn counts of the agents.
 
std::unordered_map< Id, std::array< double, 4 > > turnProbabilities (bool reset=true)
 Get the turn probabilities of the agents.
 
std::unordered_map< Id, std::array< long, 4 > > turnMapping () const
 

Additional Inherited Members

- Protected Member Functions inherited from dsm::Dynamics< Id, Size, double >
virtual Id m_nextStreetId (Id agentId, Id NodeId, std::optional< Id > streetId=std::nullopt)
 Get the next street id.
 
virtual void m_increaseTurnCounts (Id streetId, double delta)
 Increase the turn counts.
 
virtual void m_evolveStreets (bool reinsert_agents)
 Evolve the streets.
 
virtual void m_evolveNodes ()
 Evolve the nodes.
 
virtual void m_evolveAgents ()
 Evolve the agents.
 
void m_updatePath (const std::unique_ptr< Itinerary< Id > > &pItinerary)
 Update the path of a single itinerary.
 
- Protected Attributes inherited from dsm::Dynamics< Id, Size, double >
std::unordered_map< Id, std::unique_ptr< Itinerary< Id > > > m_itineraries
 
std::map< Id, std::unique_ptr< Agent< Id, Size, double > > > m_agents
 
TimePoint m_time
 
TimePoint m_previousSpireTime
 
Graph< Id, Size > m_graph
 
double m_errorProbability
 
double m_minSpeedRateo
 
double m_maxFlowPercentage
 
std::mt19937_64 m_generator
 
std::uniform_real_distribution< double > m_uniformDist
 
std::vector< unsigned int > m_travelTimes
 
std::unordered_map< Id, Id > m_agentNextStreetId
 
bool m_forcePriorities
 
std::unordered_map< Id, std::array< unsigned long long, 4 > > m_turnCounts
 
std::unordered_map< Id, std::array< long, 4 > > m_turnMapping
 

Member Function Documentation

◆ setAgentSpeed()

template<typename Id , typename Size >
requires (std::unsigned_integral<Id> && std::unsigned_integral<Size>)
void dsm::SecondOrderDynamics< Id, Size >::setAgentSpeed ( Size agentId)
virtual

Set the speed of an agent.

This is a pure-virtual function, it must be implemented in the derived classes

Parameters
agentIdThe id of the agent

Implements dsm::Dynamics< Id, Size, double >.


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