-
Notifications
You must be signed in to change notification settings - Fork 4
Add random agents management #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| template <typename delay_t> | ||
| requires(is_numeric_v<delay_t>) | ||
| Agent<delay_t>::Agent(Id id, Id itineraryId, std::optional<Id> srcNodeId) | ||
| Agent<delay_t>::Agent(Id id, std::optional<Id> itineraryId, std::optional<Id> srcNodeId) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| : m_id{id}, | ||
| m_trip{itineraryId}, | ||
| m_trip{itineraryId.has_value() ? std::vector<Id>{itineraryId.value()} | ||
| : std::vector<Id>{}}, |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| template <typename agent_t> | ||
| void Dynamics<agent_t>::removeAgent(Size agentId) { | ||
| m_agents.erase(agentId); | ||
| } |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| /// The matrix format is deduced from the file extension. Currently only .dsm files are supported. | ||
| void importMatrix(const std::string& fileName, bool isAdj = true); | ||
| void importMatrix(const std::string& fileName, | ||
| bool isAdj = true, |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.8 rule Note
| void importMatrix(const std::string& fileName, bool isAdj = true); | ||
| void importMatrix(const std::string& fileName, | ||
| bool isAdj = true, | ||
| double defaultSpeed = 13.8888888889); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.8 rule Note
| for (auto queueIndex = 0; queueIndex < nLanes; ++queueIndex) { | ||
| if (uniformDist(this->m_generator) > m_maxFlowPercentage || | ||
| pStreet->queue(queueIndex).empty()) { | ||
| if (pStreet->queue(queueIndex).empty()) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
| auto const bCanPass = uniformDist(this->m_generator) < m_passageProbability; | ||
| bool bArrived{false}; | ||
| if (!bCanPass) { | ||
| if (pAgent->isRandom()) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
| bArrived = true; | ||
| } | ||
| } | ||
| if (bArrived) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
| } | ||
| if (this->m_itineraries[agent->itineraryId()]->destination() == | ||
| street->nodePair().second) { | ||
| if (bArrived) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
| buildLog(std::format("The maximum flow percentage ({}) must be between 0 and 1", | ||
| maxFlowPercentage))); | ||
| void RoadDynamics<delay_t>::setPassageProbability(double passageProbability) { | ||
| if (passageProbability < 0. || passageProbability > 1.) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule Note
| Street s12{7, 118 / 8, 118., 13.9, std::make_pair(1, 2)}; | ||
| Street s23{13, 222 / 8, 222., 13.9, std::make_pair(2, 3)}; | ||
| Street s34{19, 651 / 4, 651., 13.9, std::make_pair(3, 4)}; | ||
| Street s34{19, 1, 651., 13.9, std::make_pair(3, 4), 2}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
Agent#107Random agents are immortal agents. The only way to kill them is to set the passage probability at junctions: if a normal agent cannot pass, it waits, but if a random agent cannot pass, it dies.