|
Dynamical system model
|
The Agent class represents an agent in the network. More...
#include <Agent.hpp>
Public Member Functions | |
| Agent (std::time_t const &spawnTime, std::optional< Id > itineraryId=std::nullopt, std::optional< Id > srcNodeId=std::nullopt) | |
| Construct a new Agent object. | |
| Agent (std::time_t const &spawnTime, std::vector< Id > const &trip, std::optional< Id > srcNodeId=std::nullopt) | |
| Construct a new Agent object. | |
| void | setSrcNodeId (Id srcNodeId) |
| void | setStreetId (std::optional< Id > streetId=std::nullopt) |
| Set the street occupied by the agent. | |
| 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) |
| Update the agent's itinerary. | |
| void | setMaxTime (std::time_t const maxTime) |
| Set the agent's maximum time. | |
| void | updateItinerary () |
| 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. | |
| Id | itineraryId () const |
| Get the agent's itinerary. | |
| auto | maxDistance () const |
| Get the agent's maximum distance. | |
| auto | maxTime () const |
| Get the agent's maximum time. | |
| std::vector< Id > const & | trip () const noexcept |
| Get the agent's trip. | |
| 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 > | 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 | 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 | ( | std::time_t const & | spawnTime, |
| std::optional< Id > | itineraryId = std::nullopt, | ||
| std::optional< Id > | srcNodeId = std::nullopt ) |
Construct a new Agent object.
| spawnTime | The agent's spawn time |
| itineraryId | Optional, The agent's destination node. If not provided, the agent is a random agent |
| srcNodeId | Optional, The id of the source node of the agent |
| dsf::mobility::Agent::Agent | ( | std::time_t const & | spawnTime, |
| std::vector< Id > const & | trip, | ||
| std::optional< Id > | srcNodeId = std::nullopt ) |
Construct a new Agent object.
| spawnTime | The agent's spawn time |
| itineraryIds | The agent's itinerary |
| srcNodeId | Optional, The id of the source node of the agent |
|
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 a random agent.
| Id dsf::mobility::Agent::itineraryId | ( | ) | const |
Get the agent's itinerary.
| std::logic_error | if the agent is a random agent |
|
inline |
Get the agent's maximum distance.
|
inline |
Get the agent's maximum time.
|
inlinenoexcept |
Get the id of the next street.
| 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 |
|
inline |
Update the agent's itinerary.
If possible, the agent's itinerary is updated by removing the first element from the itinerary's vector.
|
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::setSpeed | ( | double | speed | ) |
Set the agent's speed.
| speed,The | agent's speed |
| std::invalid_argument,if | speed is negative |
| 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 street currently occupied by the agent.
|
inlinenoexcept |
Get the agent's trip.