|
| FirstOrderDynamics (Graph &graph) |
| Construct a new First Order Dynamics object.
|
|
void | setAgentSpeed (Size agentId) override |
| Set the speed of an agent.
|
|
void | setSpeedFluctuationSTD (double speedFluctuationSTD) |
| Set the standard deviation of the speed fluctuation.
|
|
double | streetMeanSpeed (Id streetId) const override |
| Get the mean speed of a street in .
|
|
Measurement< double > | streetMeanSpeed () const override |
| Get the mean speed of the streets in .
|
|
Measurement< double > | streetMeanSpeed (double threshold, bool above) const override |
| Get the mean speed of the streets with density above or below a threshold in .
|
|
| Dynamics (Graph &graph) |
| Construct a new Dynamics object.
|
|
void | setItineraries (std::span< Itinerary > 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 | setDestinationNodes (const std::span< Id > &destinationNodes, bool updatePaths=true) |
| Set the dynamics destination nodes auto-generating itineraries.
|
|
void | setForcePriorities (bool forcePriorities) |
| Set the force priorities flag.
|
|
void | setDataUpdatePeriod (Delay dataUpdatePeriod) |
| Set the data update period.
|
|
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 | optimizeTrafficLights (Delay nCycles, double threshold=0., double densityTolerance=0.) |
| Optimize the traffic lights by changing the green and red times.
|
|
const Graph & | graph () const |
| Get the graph.
|
|
const std::unordered_map< Id, std::unique_ptr< Itinerary > > & | itineraries () const |
| Get the itineraries.
|
|
const std::map< Id, std::unique_ptr< Agent< Delay > > > & | agents () const |
| Get the agents.
|
|
TimePoint | time () const |
| Get the time.
|
|
void | addAgent (const Agent< Delay > &agent) |
| Add an agent to the simulation.
|
|
void | addAgent (std::unique_ptr< Agent< Delay > > agent) |
| Add an agent to the simulation.
|
|
void | addAgent (Id srcNodeId, Id itineraryId) |
| Add an agent with given source node and itinerary.
|
|
void | addAgents (Id itineraryId, Size nAgents=1, std::optional< Id > srcNodeId=std::nullopt) |
| Add a pack of agents to the simulation.
|
|
template<typename... Tn>
requires (is_agent_v<Tn> && ...) |
void | addAgents (Tn... agents) |
| Add a pack of agents to the simulation.
|
|
template<typename T1 , typename... Tn>
requires (is_agent_v<T1> && (is_agent_v<Tn> && ...)) |
void | addAgents (T1 agent, Tn... agents) |
| Add a pack of agents to the simulation.
|
|
void | addAgents (std::span< Agent< Delay > > 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.
|
|
template<typename TContainer >
requires (std::is_same_v<TContainer, std::unordered_map<Id, double>> || std::is_same_v<TContainer, std::map<Id, double>>) |
void | addAgentsRandomly (Size nAgents, const TContainer &src_weights, const TContainer &dst_weights) |
|
void | removeAgent (Size agentId) |
| Remove an agent from the simulation.
|
|
template<typename T1 , typename... Tn>
requires (std::is_convertible_v<T1, Size> && (std::is_convertible_v<Tn, Size> && ...)) |
void | removeAgents (T1 id, Tn... ids) |
|
void | addItinerary (const Itinerary &itinerary) |
| Add an itinerary.
|
|
void | addItinerary (std::unique_ptr< Itinerary > itinerary) |
| Add an itinerary.
|
|
template<typename... Tn>
requires (is_itinerary_v<Tn> && ...) |
void | addItineraries (Tn... itineraries) |
|
template<typename T1 , typename... Tn>
requires (is_itinerary_v<T1> && (is_itinerary_v<Tn> && ...)) |
void | addItineraries (T1 itinerary, Tn... itineraries) |
| Add a pack of itineraries.
|
|
void | addItineraries (std::span< Itinerary > itineraries) |
| Add a set of itineraries.
|
|
void | resetTime () |
| Reset the simulation time.
|
|
Measurement< double > | agentMeanSpeed () const |
| Get the mean speed of the agents in .
|
|
Measurement< double > | streetMeanDensity (bool normalized=false) const |
| Get the mean density of the streets in .
|
|
Measurement< double > | streetMeanFlow () const |
| Get the mean flow of the streets in .
|
|
Measurement< double > | streetMeanFlow (double threshold, bool above) const |
| Get the mean flow of the streets in .
|
|
Measurement< double > | meanSpireInputFlow (bool resetValue=true) |
| Get the mean spire input flow of the streets in .
|
|
Measurement< double > | meanSpireOutputFlow (bool resetValue=true) |
| Get the mean spire output flow of the streets in .
|
|
Measurement< double > | meanTravelTime (bool clearData=false) |
| Get the mean travel time of the agents in .
|
|
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 |
|
|
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_evolveStreet (const Id streetId, const std::unique_ptr< Street > &pStreet, bool reinsert_agents) |
| Evolve a street.
|
|
virtual bool | m_evolveNode (const std::unique_ptr< Node > &pNode) |
| If possible, removes one agent from the node, putting it on the next street.
|
|
virtual void | m_evolveAgents () |
| Evolve the agents.
|
|
void | m_updatePath (const std::unique_ptr< Itinerary > &pItinerary) |
| Update the path of a single itinerary.
|
|
std::unordered_map< Id, std::unique_ptr< Itinerary > > | m_itineraries |
|
std::map< Id, std::unique_ptr< Agent< Delay > > > | m_agents |
|
TimePoint | m_time |
|
TimePoint | m_previousSpireTime |
|
Graph | m_graph |
|
double | m_errorProbability |
|
double | m_minSpeedRateo |
|
double | m_maxFlowPercentage |
|
std::mt19937_64 | m_generator {std::random_device{}()} |
|
std::uniform_real_distribution< double > | m_uniformDist {0., 1.} |
|
std::vector< unsigned int > | m_travelTimes |
|
std::unordered_map< Id, Id > | m_agentNextStreetId |
|
bool | m_forcePriorities |
|
std::optional< Delay > | m_dataUpdatePeriod |
|
std::unordered_map< Id, std::array< unsigned long long, 4 > > | m_turnCounts |
|
std::unordered_map< Id, std::array< long, 4 > > | m_turnMapping |
|
std::unordered_map< Id, unsigned long long > | m_streetTails |
|