@@ -43,7 +43,6 @@ namespace dsm {
4343 protected:
4444 Time m_previousOptimizationTime;
4545 double m_errorProbability;
46- double m_maxFlowPercentage;
4746 double m_passageProbability;
4847 std::vector<double > m_travelTimes;
4948 std::unordered_map<Id, Id> m_agentNextStreetId;
@@ -89,11 +88,6 @@ namespace dsm {
8988 // / @param errorProbability The error probability
9089 // / @throw std::invalid_argument If the error probability is not between 0 and 1
9190 void setErrorProbability (double errorProbability);
92- // / @brief Set the maximum flow percentage
93- // / @param maxFlowPercentage The maximum flow percentage
94- // / @details The maximum flow percentage is the percentage of the maximum flow that a street can transmit. Default is 1 (100%).
95- // / @throw std::invalid_argument If the maximum flow percentage is not between 0 and 1
96- void setMaxFlowPercentage (double maxFlowPercentage);
9791
9892 void setPassageProbability (double passageProbability);
9993 // / @brief Set the force priorities flag
@@ -154,8 +148,7 @@ namespace dsm {
154148 : Dynamics<Agent<delay_t >>(graph, seed),
155149 m_previousOptimizationTime{0 },
156150 m_errorProbability{0 .},
157- m_maxFlowPercentage{1 .},
158- m_passageProbability{1.1 },
151+ m_passageProbability{1 .},
159152 m_forcePriorities{false } {
160153 for (const auto & [streetId, street] : this ->m_graph .streetSet ()) {
161154 m_streetTails.emplace (streetId, 0 );
@@ -240,8 +233,7 @@ namespace dsm {
240233 auto const nLanes = pStreet->nLanes ();
241234 std::uniform_real_distribution<double > uniformDist{0 ., 1 .};
242235 for (auto queueIndex = 0 ; queueIndex < nLanes; ++queueIndex) {
243- if (uniformDist (this ->m_generator ) > m_maxFlowPercentage ||
244- pStreet->queue (queueIndex).empty ()) {
236+ if (pStreet->queue (queueIndex).empty ()) {
245237 continue ;
246238 }
247239 const auto agentId{pStreet->queue (queueIndex).front ()};
@@ -261,11 +253,15 @@ namespace dsm {
261253 continue ;
262254 }
263255 }
256+ auto const bCanPass = uniformDist (this ->m_generator ) < m_passageProbability;
264257 bool bArrived{false };
265- std::uniform_real_distribution<double > uniformDist{0 ., 1 .};
266- if (uniformDist (this ->m_generator ) > m_passageProbability) {
267- m_agentNextStreetId.erase (agentId);
268- bArrived = true ;
258+ if (!bCanPass) {
259+ if (pAgent->isRandom ()) {
260+ m_agentNextStreetId.erase (agentId);
261+ bArrived = true ;
262+ } else {
263+ continue ;
264+ }
269265 }
270266 if (!pAgent->isRandom ()) {
271267 if (destinationNode->id () ==
@@ -458,17 +454,6 @@ namespace dsm {
458454 m_errorProbability = errorProbability;
459455 }
460456
461- template <typename delay_t >
462- requires (is_numeric_v<delay_t >)
463- void RoadDynamics<delay_t >::setMaxFlowPercentage(double maxFlowPercentage) {
464- if (maxFlowPercentage < 0 . || maxFlowPercentage > 1 .) {
465- throw std::invalid_argument (
466- buildLog (std::format (" The maximum flow percentage ({}) must be between 0 and 1" ,
467- maxFlowPercentage)));
468- }
469- m_maxFlowPercentage = maxFlowPercentage;
470- }
471-
472457 template <typename delay_t >
473458 requires (is_numeric_v<delay_t >)
474459 void RoadDynamics<delay_t >::setPassageProbability(double passageProbability) {
0 commit comments