22 #include "../MSEdge.h" 25 #define ANALYSIS_DBG(X) {X} 27 #define ANALYSIS_DBG(X) DBG(X) 31 const std::string& subid,
const Phases& phases,
int step,
SUMOTime delay,
32 const std::map<std::string, std::string>& parameters) :
36 std::transform(pols.begin(), pols.end(), pols.begin(), ::tolower);
37 DBG(std::ostringstream str; str <<
"policies: " << pols;
WRITE_MESSAGE(str.str());)
39 if (pols.find(
"platoon") != std::string::npos) {
42 if (pols.find(
"phase") != std::string::npos) {
45 if (pols.find(
"marching") != std::string::npos) {
48 if (pols.find(
"congestion") != std::string::npos) {
61 std::ostringstream d_str; d_str << getMaxCongestionDuration(); vector<MSSOTLPolicy*>
policies =
getPolicies();
63 WRITE_MESSAGE(
"getMaxCongestionDuration " + d_str.str());
for (
int i = 0; i < policies.size(); i++) {
66 std::ostringstream _str;
72 if (m_useVehicleTypesWeights && pols.find(
"phase") == std::string::npos) {
73 WRITE_ERROR(
"VEHICLE TYPES WEIGHT only works with phase policy, which is missing");
122 srand((
int) time(NULL));
125 MSLane* currentLane = NULL;
135 for (MSTrafficLightLogic::LaneVectorVector::const_iterator laneVector =
myLanes.begin();
136 laneVector !=
myLanes.end(); laneVector++) {
137 for (MSTrafficLightLogic::LaneVector::const_iterator lane = laneVector->begin(); lane != laneVector->end();
139 currentLane = (*lane);
148 WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::init Intersection " +
getID() +
" pheromoneInputLanes adding " + currentLane->
getID());)
151 WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::init Intersection " +
getID() +
" pheromoneInputLanes: lane " + currentLane->
getID() +
" not allowed");)
159 for (
int i = 0; i < (int)myLinks.size(); i++) {
161 for (
int j = 0; j < (int)oneLink.size(); j++) {
162 currentLane = oneLink[j]->getLane();
168 WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::init Intersection " +
getID() +
" pheromoneOutputLanes adding " + currentLane->
getID());)
171 WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::init Intersection " +
getID() +
" pheromoneOutputLanes lane " + currentLane->
getID() +
" not allowed");)
182 WRITE_MESSAGE(
"*** Intersection " +
getID() +
" will run using MSSwarmTrafficLightLogic ***");
184 logData = logFileName.compare(
"") != 0;
186 swarmLogFile.open(logFileName.c_str(), std::ios::out | std::ios::binary);
207 std::string laneId = laneIterator->first;
213 std::string laneId = laneIterator->first;
300 const double beta,
const double gamma) {
303 std::ostringstream _str; _str << logString <<
" Lanes " << pheroMap.size() <<
" TL " <<
getID() <<
" .";
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::updatePheromoneLevels:: " + _str.str());)
305 for (MSLaneId_PheromoneMap::iterator laneIterator = pheroMap.begin(); laneIterator != pheroMap.end();
307 std::string laneId = laneIterator->first;
308 double oldPhero = laneIterator->second;
311 bool updatePheromone = (meanVehiclesSpeed > -1);
315 double derivative = 0;
319 if (updatePheromone) {
320 double currentDerivative = 0;
354 double pheroAdd =
MAX2((maxSpeed - meanVehiclesSpeed) * 10 / maxSpeed, 0.0);
363 if (updatePheromone) {
364 std::ostringstream oss;
366 oss <<
" der " << derivative <<
" phero " << pheroAdd <<
" maxS " << maxSpeed <<
" meanS " << meanVehiclesSpeed;
372 double phero = beta * oldPhero + gamma * pheroAdd * updatePheromone;
375 std::ostringstream i_str;
376 i_str <<
"MSSwarmTrafficLightLogic::updatePheromoneLevels " << logString <<
" > 10. Value: " << phero;
381 pheroMap[laneId] = phero;
384 std::ostringstream i_str;
392 i_str <<
" op " << oldPhero <<
" ms " << meanVehiclesSpeed <<
" p " << pheroAdd * updatePheromone <<
393 " pe " << oldPhero - oldPhero * beta <<
" pd " << gamma * pheroAdd * updatePheromone <<
" np " <<
424 for (
int i = 0; i < (int)policies.size(); i++) {
428 std::ostringstream phero_str; phero_str <<
"Policy " << policies[i]->getName() <<
" sensitivity reset to " << policies[i]->getThetaSensitivity() <<
" due to evaporated input pheromone.";
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::updateSensitivities::" + phero_str.str());)
435 if (!
skipEta || currentPolicy->
getName().compare(
"Congestion") != 0) {
451 for (
int i = 0; i < (int)policies.size(); i++) {
453 double newSensitivity;
455 if (policy == currentPolicy) {
463 if (policy == currentPolicy) {
474 if (policy == currentPolicy) {
480 phero_str <<
" policy " << policy->
getName() <<
" newSensitivity " << newSensitivity <<
" ,pol.Sensitivity " << policy->
getThetaSensitivity() <<
" ,elapsedTime " << elapsedTime << lf.str() <<
" NEWERSensitivity= " << max(min(newSensitivity,
getThetaMax()),
getThetaMin()) <<
" ID " <<
getID() <<
" .";
482 if (policy == currentPolicy && eta > 0) {
484 }
else if (policy == currentPolicy && eta < 0) {
486 }
else if (eta > 0) {
488 }
else if (eta < 0) {
507 std::string laneId = iterator->first;
508 pheroIn += iterator->second;
510 std::ostringstream phero_str; phero_str <<
" lane " << iterator->first <<
" pheromoneIN " << iterator->second <<
" id " <<
getID() <<
" .";
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::getPheromoneForInputLanes::" + phero_str.str());)
526 std::ostringstream phero_str; phero_str <<
" lane " << iterator->first <<
" pheromoneOUT " << iterator->second <<
" id " <<
getID() <<
" .";
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::getPheromoneForOutputLanes::" + phero_str.str());)
527 pheroOut += iterator->second;
541 std::string laneId = iterator->first;
542 sum += pow(iterator->second - average_phero_in, 2);
547 ostringstream so_str; so_str <<
" dispersionIn " << result;
WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::getDispersionForInputLanes::" + so_str.str());)
558 sum += pow(iterator->second - average_phero_out, 2);
563 ostringstream so_str; so_str <<
" dispersionOut " << result;
WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::getDispersionForOutputLanes::" + so_str.str());)
570 double max_phero_val_current = 0;
571 double max_phero_val_old = 0;
572 double temp_avg_other_lanes = 0;
573 std::string laneId_max;
577 std::string laneId = iterator->first;
578 double lanePhero = iterator->second;
580 max_phero_val_current = lanePhero;
584 if (lanePhero > max_phero_val_current) {
585 max_phero_val_old = max_phero_val_current;
586 max_phero_val_current = lanePhero;
587 temp_avg_other_lanes = (temp_avg_other_lanes * (counter - 1) + max_phero_val_old) / counter;
589 temp_avg_other_lanes = (temp_avg_other_lanes * (counter - 1) + lanePhero) / counter;
595 double result = max_phero_val_current - temp_avg_other_lanes;
597 ostringstream so_str; so_str <<
" currentMaxPhero " << max_phero_val_current <<
" lane " << laneId_max <<
" avgOtherLanes " << temp_avg_other_lanes <<
" distance " << result;
WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::getDistanceOfMaxPheroForInputLanes::" + so_str.str());)
605 double max_phero_val_current = 0;
606 double max_phero_val_old = 0;
607 double temp_avg_other_lanes = 0;
608 std::string laneId_max;
612 std::string laneId = iterator->first;
613 double lanePhero = iterator->second;
615 max_phero_val_current = lanePhero;
619 if (lanePhero > max_phero_val_current) {
620 max_phero_val_old = max_phero_val_current;
621 max_phero_val_current = lanePhero;
622 temp_avg_other_lanes = (temp_avg_other_lanes * (counter - 1) + max_phero_val_old) / counter;
624 temp_avg_other_lanes = (temp_avg_other_lanes * (counter - 1) + lanePhero) / counter;
630 double result = max_phero_val_current - temp_avg_other_lanes;
632 ostringstream so_str; so_str <<
" currentMaxPhero " << max_phero_val_current <<
" lane " << laneId_max <<
" avgOtherLanes " << temp_avg_other_lanes <<
" distance " << result;
WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::getDistanceOfMaxPheroForOutputLanes::" + so_str.str());)
652 choosePolicy(pheroIn, pheroOut, distancePheroIn, distancePheroOut);
655 if (newPolicy != oldPolicy) {
658 if (oldPolicy->
getName().compare(
"Congestion") == 0) {
678 return 1 - (1 / ((double) factor));
684 MSLane* currentLane = NULL;
685 int count = 0, minIn = 0, minOut = 0, toSub, tmp;
686 bool inInit =
true, outInit =
true;
687 double eta, normalized, diff, phi, delta;
698 for (MSTrafficLightLogic::LaneVectorVector::const_iterator laneVector =
myLanes.begin();
699 laneVector !=
myLanes.end(); laneVector++) {
700 for (MSTrafficLightLogic::LaneVector::const_iterator lane = laneVector->begin(); lane != laneVector->end();
702 currentLane = (*lane);
710 std::ostringstream cars_str; cars_str <<
"Lane " << currentLane->
getID() <<
": vehicles entered - " << count;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
722 for (MSTrafficLightLogic::LinkVectorVector::const_iterator linkVector =
myLinks.begin();
723 linkVector !=
myLinks.end(); linkVector++) {
724 for (MSTrafficLightLogic::LinkVector::const_iterator link = linkVector->begin(); link != linkVector->end();
726 currentLane = (*link)->getLane();
734 std::ostringstream cars_str; cars_str <<
"Lane " << currentLane->
getID() <<
": vehicles gone out- " << count;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
744 toReset.push_back(currentLane->
getID());
748 }
else if (count <= minOut) {
762 std::string lane = (*laneId);
765 if (inInit && tmp != 0) {
769 if (tmp < minIn && tmp != 0) {
773 toReset.push_back(lane);
776 std::ostringstream cars_str; cars_str <<
"Lane " << lane <<
" passed: " << tmp;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
784 toSub = std::min(minIn, minOut);
787 while (!toReset.empty()) {
788 std::string laneId = toReset.back();
800 std::ostringstream final_str; final_str <<
"Total cars in lanes: " <<
carsIn <<
" Total cars out: " << carsOut <<
" Difference: " << diff <<
" Pure eta: " << normalized;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + final_str.str());)
804 std::ostringstream eta_str; eta_str <<
"Min found:" << toSub <<
" MinIn:" << minIn <<
" MinOut:" << minOut;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + eta_str.str());)
822 eta = (-normalized * (1 / phi));
860 eta = normalized * phi;
873 MSLane* currentLane = NULL;
874 int count = 0, minIn = 0, minOut = 0, toSub, tmp;
875 bool inInit =
true, outInit =
true;
876 double eta, ratio, phi, normalized, delta;
887 for (MSTrafficLightLogic::LaneVectorVector::const_iterator laneVector =
myLanes.begin();
888 laneVector !=
myLanes.end(); laneVector++) {
889 for (MSTrafficLightLogic::LaneVector::const_iterator lane = laneVector->begin(); lane != laneVector->end();
891 currentLane = (*lane);
899 std::ostringstream cars_str; cars_str <<
"Lane " << currentLane->
getID() <<
": vehicles entered - " << count;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
911 for (MSTrafficLightLogic::LinkVectorVector::const_iterator linkVector =
myLinks.begin();
912 linkVector !=
myLinks.end(); linkVector++) {
913 for (MSTrafficLightLogic::LinkVector::const_iterator link = linkVector->begin(); link != linkVector->end();
915 currentLane = (*link)->getLane();
923 std::ostringstream cars_str; cars_str <<
"Lane " << currentLane->
getID() <<
": vehicles gone out- " << count;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
933 toReset.push_back(currentLane->
getID());
937 }
else if (count <= minOut) {
952 std::string lane = (*laneId);
955 if (inInit && tmp != 0) {
959 if (tmp < minIn && tmp != 0) {
963 toReset.push_back(lane);
966 std::ostringstream cars_str; cars_str <<
"Lane " << lane <<
" passed: " << tmp;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
974 toSub = std::min(minIn, minOut);
977 while (!toReset.empty()) {
978 std::string laneId = toReset.back();
988 ratio = std::numeric_limits<double>::infinity();
989 normalized = std::numeric_limits<double>::infinity();
993 std::ostringstream final_str; final_str <<
"Total cars in lanes: " <<
carsIn <<
" Total cars out: " <<
carsOut <<
" Ratio: " << ratio <<
" Pure eta: " << normalized;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + final_str.str());)
997 std::ostringstream eta_str; eta_str <<
"Min found:" << toSub <<
". MinIn:" << minIn <<
" MinOut:" << minOut;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + eta_str.str());)
1016 eta = (-(normalized) * (1 / phi));
1052 eta = (normalized) * phi;
1060 std::ostringstream eta_str; eta_str <<
"Eta Normalized: " << eta <<
".";
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + eta_str.str());)
1067 MSLane* currentLane = NULL;
1070 for (MSTrafficLightLogic::LaneVectorVector::const_iterator laneVector =
myLanes.begin();
1071 laneVector !=
myLanes.end(); laneVector++) {
1073 for (MSTrafficLightLogic::LaneVector::const_iterator lane = laneVector->begin(); lane != laneVector->end();
1075 currentLane = (*lane);
1080 for (MSTrafficLightLogic::LinkVectorVector::const_iterator linkVector =
myLinks.begin();
1081 linkVector !=
myLinks.end(); linkVector++) {
1082 for (MSTrafficLightLogic::LinkVector::const_iterator link = linkVector->begin(); link != linkVector->end();
1084 currentLane = (*link)->getLane();
1091 double dispersion_out) {
1094 if (it.operator * ()->getName() ==
"Phase") {
1100 std::vector<double> thetaStimuli;
1101 double thetaSum = 0.0;
1103 for (
int i = 0; i < (int)
getPolicies().size(); i++) {
1104 double stimulus =
getPolicies()[i]->computeDesirability(phero_in, phero_out, dispersion_in, dispersion_out);
1105 double thetaStimulus = pow(stimulus, 2) / (pow(stimulus, 2) + pow(
getPolicies()[i]->getThetaSensitivity(), 2));
1107 thetaStimuli.push_back(thetaStimulus);
1108 thetaSum += thetaStimulus;
1112 ostringstream so_str; so_str <<
" policy " <<
getPolicies()[i]->getName() <<
" stimulus " << stimulus <<
" pow(stimulus,2) " << pow(stimulus, 2) <<
" pow(Threshold,2) " << pow(
getPolicies()[i]->getThetaSensitivity(), 2) <<
" thetaStimulus " << thetaStimulus <<
" thetaSum " << thetaSum <<
" TL " <<
getID();
WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::choosePolicy::" + so_str.str());)
1121 double partialSum = 0;
1122 for (
int i = 0; i < (int)
getPolicies().size(); i++) {
1123 partialSum += thetaStimuli[i];
1127 ostringstream aao_str; aao_str <<
" policy " <<
getPolicies()[i]->getName() <<
" partialSum " << partialSum <<
" thetaStimuls " << thetaStimuli[i] <<
" r " << r <<
" TL " <<
getID();
WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::choosePolicy::" + aao_str.str());)
1129 if (partialSum >= r) {
1149 std::string laneState =
"";
1153 laneState += state[*it];
std::map< std::string, double > MSLaneId_PheromoneMap
void initScaleFactorDispersionOut(int lanes_out)
virtual std::string getMessage()=0
MSSOTLSensors * getSensors()
const std::string & getState() const
Returns the state within this phase.
Builds detectors for microsim.
MSEdge & getEdge() const
Returns the lane's edge.
double getPheromoneForOutputLanes()
int getReinforcementMode()
Class for low-level platoon policy.
MSSwarmTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &subid, const Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > ¶meters)
Constructor without sensors passed.
SUMOTime getMaxCongestionDuration()
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
std::string getPoliciesParam()
double getChangePlanProbability()
bool allowLine(MSLane *)
Check if a lane is allowed to be added to the maps pheromoneInputLanes and pheromoneOutputLanes Contr...
std::string time2string(SUMOTime t)
Class for low-level marching policy.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
void init(NLDetectorBuilder &nb)
Initialises the tls.
virtual int decideNextPhase(SUMOTime elapsed, const MSPhaseDefinition *stage, int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed, int vehicleCount)
std::ofstream swarmLogFile
void updatePheromoneLevels()
Update pheromone levels Pheromone on input lanes is costantly updated Pheromone follows a discrete-ti...
void updateSensitivities()
const std::string & getID() const
Returns the id.
SUMOTime congestion_steps
double getPheromoneForInputLanes()
LaneIdVector targetLanes
A copy of the target lanes of this phase.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
int getPhaseIndexWithMaxCTS()
const LinkVector & getLinksAt(int i) const
Returns the list of links that are controlled by the signals at the given position.
virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed, const MSPhaseDefinition *stage, int vehicleCount)=0
A self-organizing high-level traffic light logic.
LaneVectorVector myLanes
The list of LaneVectors; each vector contains the incoming lanes that belong to the same link index...
double calculatePhi(int factor)
Method that should calculate the valor of phi a coefficient to amplify/attenuate eta based on a facto...
A class that stores and controls tls and switching of their programs.
bool mustChange
When true, indicates that the current policy MUST be changed. It's used to force the exit from the co...
MSSOTLPolicyDesirability * getDesirabilityAlgorithm()
MSSOTLPolicy * currentPolicy
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
std::string getLaneLightState(const std::string &laneId)
double getDistanceOfMaxPheroForOutputLanes()
MSSOTLE2Sensors * getCountSensors()
Return the sensors that count the passage of vehicles in and out of the tl.
std::pair< std::string, double > MSLaneId_Pheromone
double getDispersionForOutputLanes(double average_phero_out)
std::map< std::string, std::string > m_pheroLevelLog
int getPassedVeh(std::string laneId, bool out)
std::vector< MSSOTLPolicy * > & getPolicies()
Returns the vector of the low-level policies used by this high-level tll.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
double calculateEtaRatio()
bool skipEta
When true indicates that we can skip the evaluation of eta since we've a congestion policy that is la...
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
void decidePolicy()
Decide the current policy according to pheromone levels The decision reflects on currentPolicy value...
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
std::map< std::string, CircularBuffer< double > *> m_meanSpeedHistory
bool isCrossing() const
return whether this edge is a pedestrian crossing
bool gotTargetLane
When true indicates that we've already acquired the target lanes for this particular phase...
virtual void setThetaSensitivity(double val)
double getScaleFactorDispersionIn()
MSLaneId_PheromoneMap pheromoneOutputLanes
This pheromone is an indicator of congestion on output lanes. Its levels refer to the average speed o...
virtual int countVehicles(MSLane *lane)=0
~MSSwarmTrafficLightLogic()
std::vector< MSLink * > LinkVector
Definition of the list of links that are subjected to this tls.
MSSOTLPolicy * getCurrentPolicy()
Returns the low-level policy currently selected by this high-level tll.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
virtual double meanVehiclesSpeed(MSLane *lane)=0
This class determines the desirability algorithm of a MSSOTLPolicy when used in combination with a hi...
LinkVectorVector myLinks
The list of LinkVectors; each vector contains the links that belong to the same link index...
virtual double getMaxSpeed(std::string laneId)=0
virtual double getThetaSensitivity()
static int _2int(const E *const data)
converts a char-type array into the integer value described by it
SUMOTime getCurrentPhaseElapsed()
void activate(MSSOTLPolicy *policy)
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
void init(NLDetectorBuilder &nb)
Initialises the tls with sensors on incoming and outgoing lanes Sensors are built in the simulation a...
std::vector< MSSOTLPolicy * > policies
double getDistanceOfMaxPheroForInputLanes()
int getCurrentPhaseIndex() const
Returns the current index within the program.
Class for low-level phase policy.
double getForgettingCox()
void inform(std::string msg, bool addType=true)
adds a new error to the list
void choosePolicy(double phero_in, double phero_out, double dispersion_in, double dispersion_out)
static double _2double(const E *const data)
converts a char-type array into the double value described by it
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
MSLaneId_PheromoneMap pheromoneInputLanes
This pheronome is an indicator of congestion on input lanes. Its levels refer to the average speed of...
Class for a low-level policy.
bool isWalkingArea() const
return whether this edge is walking area
SUMOTime lastThetaSensitivityUpdate
Class for low-level congestion policy.
bool m_useVehicleTypesWeights
const LaneIdVector & getTargetLaneSet() const
void subtractPassedVeh(std::string laneId, int passed)
void initScaleFactorDispersionIn(int lanes_in)
LaneCheckMap laneCheck
Map to check if a lane was already controlled during the elaboration of eta.
double getScaleFactorDispersionOut()
std::vector< std::string > LaneIdVector
#define WRITE_MESSAGE(msg)
double calculateEtaDiff()
Method that should calculate the valor of eta a coefficient to evaluate the current policy's work...
Representation of a lane in the micro simulation.
bool isPushButtonPressed()
std::map< std::string, std::vector< int > > m_laneIndexMap
void addPolicy(MSSOTLPolicy *policy)
double getDispersionForInputLanes(double average_phero_in)
void resetPheromone()
Resets pheromone levels.
int countVehicles(MSPhaseDefinition phase)
std::map< std::string, CircularBuffer< double > *> m_derivativeHistory