|
Dynamical System Framework
|
The Agent class represents an agent in the network. More...
#include <Agent.hpp>
Public Member Functions | |
| Agent (Id const id, std::time_t const &spawnTime, std::optional< Id > destination=std::nullopt, std::optional< Id > srcNodeId=std::nullopt) | |
| Construct a new Agent object. | |
| void | setSrcNodeId (Id srcNodeId) |
| Set the id of the source node of the agent. | |
| void | setSpawnTime (std::time_t const &spawnTime) |
| Set the agent's spawn time. | |
| void | setStreetId (std::optional< Id > streetId=std::nullopt) |
| Set the street occupied by the agent. | |
| auto | setSrcStreetId (Id srcStreetId) |
| Set the id of the first street of the agent's trip. | |
| auto | setNextStreetId (Id nextStreetId) |
| Set the id of the next street. | |
| void | setSpeed (double speed) |
| Set the agent's speed. | |
| void | setFreeTime (std::time_t const &freeTime) |
| Set the agent's free time. | |
| void | incrementDistance (double distance) |
| Increment the agent's distance by a given value. | |
| void | setMaxDistance (double const maxDistance) |
| Set the agent's maximum distance. | |
| void | setMaxTime (std::time_t const maxTime) |
| Set the agent's maximum time. | |
| void | setIntelligent (bool const isIntelligent) noexcept |
| Set whether the agent is intelligent. | |
| void | setPath (std::span< Id const > streets) |
| Set the streets the agent plans to take after the one it is on (or, before its departure, after its first street). | |
| void | dropPath () noexcept |
| Drop the agent's planned streets, so that its route is planned again when needed; the destination is kept. | |
| void | advancePath () |
| Remove the next planned street, once the agent takes it. | |
| void | reset (std::time_t const &spawnTime) |
| Reset the agent. | |
| std::time_t const & | spawnTime () const noexcept |
| Get the agent's spawn time. | |
| std::time_t const & | freeTime () const noexcept |
| Get the agent's free time. | |
| Id | id () const noexcept |
| Get the agent's id. | |
| std::optional< Id > | destination () const noexcept |
| Get the agent's destination street. | |
| auto | maxDistance () const |
| Get the agent's maximum distance. | |
| auto | maxTime () const |
| Get the agent's maximum time. | |
| std::optional< Id > | streetId () const noexcept |
| Get the id of the street currently occupied by the agent. | |
| std::optional< Id > | srcNodeId () const noexcept |
| Get the id of the source node of the agent. | |
| std::optional< Id > | srcStreetId () const noexcept |
| Get the id of the first street of the agent's trip. | |
| std::optional< Id > | nextStreetId () const noexcept |
| Get the id of the next street. | |
| double | speed () const noexcept |
| Get the agent's speed. | |
| double | distance () const noexcept |
| Get the agent's travelled distance. | |
| bool | isRandom () const noexcept |
| Return true if the agent is a random agent. | |
| bool | isIntelligent () const noexcept |
| Return true if the agent is intelligent. | |
| std::optional< Id > | nextPlannedStreetId () const noexcept |
| Get the next planned street. | |
| std::size_t | nPlannedStreets () const noexcept |
| Get the number of planned streets. | |
| bool | hasArrived (std::optional< std::time_t > const ¤tTime) const noexcept |
| Check if a random agent has arrived at its destination. | |
The Agent class represents an agent in the network.
| dsf::mobility::Agent::Agent | ( | Id const | id, |
| std::time_t const & | spawnTime, | ||
| std::optional< Id > | destination = std::nullopt, | ||
| std::optional< Id > | srcNodeId = std::nullopt ) |
Construct a new Agent object.
| id | The agent's id |
| spawnTime | The agent's spawn time |
| destination | Optional, the id of the agent's destination street: the agent travels it, and arrives at its end. If not provided, the agent is a random agent |
| srcNodeId | Optional, The id of the source node of the agent |
| void dsf::mobility::Agent::advancePath | ( | ) |
Remove the next planned street, once the agent takes it.
| std::logic_error | if there is no planned street |
|
inlinenoexcept |
Get the agent's destination street.
|
inlinenoexcept |
Get the agent's travelled distance.
|
inlinenoexcept |
Get the agent's free time.
|
inlinenoexcept |
Check if a random agent has arrived at its destination.
| currentTime | The current simulation time |
|
inlinenoexcept |
Get the agent's id.
| void dsf::mobility::Agent::incrementDistance | ( | double | distance | ) |
Increment the agent's distance by a given value.
| distance | The value to increment the agent's distance byù |
| std::invalid_argument,if | distance is negative |
|
inlinenoexcept |
Return true if the agent is intelligent.
|
inlinenoexcept |
Return true if the agent is a random agent.
|
inline |
Get the agent's maximum distance.
|
inline |
Get the agent's maximum time.
|
inlinenoexcept |
Get the next planned street.
|
inlinenoexcept |
Get the id of the next street.
|
inlinenoexcept |
Get the number of planned streets.
| void dsf::mobility::Agent::reset | ( | std::time_t const & | spawnTime | ) |
Reset the agent.
Reset the following values:
| void dsf::mobility::Agent::setFreeTime | ( | std::time_t const & | freeTime | ) |
Set the agent's free time.
| freeTime | The agent's free time |
|
inlinenoexcept |
Set whether the agent is intelligent.
| isIntelligent | If true, the agent plans its routes on the current traffic, otherwise on free-flow travel times |
|
inline |
Set the agent's maximum distance.
| maxDistance | The agent's maximum distance |
| std::invalid_argument,if | maxDistance is not positive |
|
inline |
Set the agent's maximum time.
| maxTime | The agent's maximum time |
|
inline |
Set the id of the next street.
| nextStreetId | The id of the next street |
| void dsf::mobility::Agent::setPath | ( | std::span< Id const > | streets | ) |
Set the streets the agent plans to take after the one it is on (or, before its departure, after its first street).
| streets | The ids of the streets, in travel order |
| std::logic_error | if the agent is a random agent |
| void dsf::mobility::Agent::setSpawnTime | ( | std::time_t const & | spawnTime | ) |
Set the agent's spawn time.
| spawnTime | The time-step at which the agent enters the simulation |
The spawn time is stamped when the agent is created, but an agent may sit in the dynamics' pending list for an arbitrary number of time-steps before a free slot on its source node/street becomes available. Re-stamping it on actual insertion keeps the measured travel time the time spent in the network.
| void dsf::mobility::Agent::setSpeed | ( | double | speed | ) |
Set the agent's speed.
| speed,The | agent's speed |
| std::invalid_argument,if | speed is negative |
| void dsf::mobility::Agent::setSrcNodeId | ( | Id | srcNodeId | ) |
Set the id of the source node of the agent.
| srcNodeId | The id of the source node |
|
inline |
Set the id of the first street of the agent's trip.
| srcStreetId | The id of the first street, which must be an outgoing street of the agent's source node |
| void dsf::mobility::Agent::setStreetId | ( | std::optional< Id > | streetId = std::nullopt | ) |
Set the street occupied by the agent.
| streetId | The id of the street currently occupied by the agent |
|
inlinenoexcept |
Get the agent's spawn time.
|
inlinenoexcept |
Get the agent's speed.
|
inlinenoexcept |
Get the id of the source node of the agent.
|
inlinenoexcept |
Get the id of the first street of the agent's trip.
|
inlinenoexcept |
Get the id of the street currently occupied by the agent.