23 #include "../MSEdge.h" 26 #define ANALYSIS_DBG(X) {X} 28 #define ANALYSIS_DBG(X) DBG(X) 32 const std::string& subid,
const Phases& phases,
int step,
SUMOTime delay,
33 const std::map<std::string, std::string>& parameters) :
37 std::transform(pols.begin(), pols.end(), pols.begin(), ::tolower);
38 DBG(std::ostringstream str; str <<
"policies: " << pols;
WRITE_MESSAGE(str.str());)
40 if (pols.find(
"platoon") != std::string::npos) {
43 if (pols.find(
"phase") != std::string::npos) {
46 if (pols.find(
"marching") != std::string::npos) {
49 if (pols.find(
"congestion") != std::string::npos) {
62 std::ostringstream d_str; d_str << getMaxCongestionDuration(); vector<MSSOTLPolicy*>
policies =
getPolicies();
64 WRITE_MESSAGE(
"getMaxCongestionDuration " + d_str.str());
for (
int i = 0; i < policies.size(); i++) {
67 std::ostringstream _str;
73 if (m_useVehicleTypesWeights && pols.find(
"phase") == std::string::npos) {
74 WRITE_ERROR(
"VEHICLE TYPES WEIGHT only works with phase policy, which is missing");
123 srand((
int) time(NULL));
126 MSLane* currentLane = NULL;
136 for (MSTrafficLightLogic::LaneVectorVector::const_iterator laneVector =
myLanes.begin();
137 laneVector !=
myLanes.end(); laneVector++) {
138 for (MSTrafficLightLogic::LaneVector::const_iterator lane = laneVector->begin(); lane != laneVector->end();
140 currentLane = (*lane);
149 WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::init Intersection " +
getID() +
" pheromoneInputLanes adding " + currentLane->
getID());)
152 WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::init Intersection " +
getID() +
" pheromoneInputLanes: lane " + currentLane->
getID() +
" not allowed");)
160 for (
int i = 0; i < (int)myLinks.size(); i++) {
162 for (
int j = 0; j < (int)oneLink.size(); j++) {
163 currentLane = oneLink[j]->getLane();
169 WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::init Intersection " +
getID() +
" pheromoneOutputLanes adding " + currentLane->
getID());)
172 WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::init Intersection " +
getID() +
" pheromoneOutputLanes lane " + currentLane->
getID() +
" not allowed");)
183 WRITE_MESSAGE(
"*** Intersection " +
getID() +
" will run using MSSwarmTrafficLightLogic ***");
185 logData = logFileName.compare(
"") != 0;
187 swarmLogFile.open(logFileName.c_str(), std::ios::out | std::ios::binary);
208 std::string laneId = laneIterator->first;
214 std::string laneId = laneIterator->first;
304 std::ostringstream _str; _str << logString <<
" Lanes " << pheroMap.size() <<
" TL " <<
getID() <<
" .";
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::updatePheromoneLevels:: " + _str.str());)
306 for (MSLaneId_PheromoneMap::iterator laneIterator = pheroMap.begin(); laneIterator != pheroMap.end();
308 std::string laneId = laneIterator->first;
309 SUMOReal oldPhero = laneIterator->second;
312 bool updatePheromone = (meanVehiclesSpeed > -1);
320 if (updatePheromone) {
364 if (updatePheromone) {
365 std::ostringstream oss;
367 oss <<
" der " << derivative <<
" phero " << pheroAdd <<
" maxS " << maxSpeed <<
" meanS " << meanVehiclesSpeed;
373 SUMOReal phero = beta * oldPhero + gamma * pheroAdd * updatePheromone;
376 std::ostringstream i_str;
377 i_str <<
"MSSwarmTrafficLightLogic::updatePheromoneLevels " << logString <<
" > 10. Value: " << phero;
382 pheroMap[laneId] = phero;
385 std::ostringstream i_str;
393 i_str <<
" op " << oldPhero <<
" ms " << meanVehiclesSpeed <<
" p " << pheroAdd * updatePheromone <<
394 " pe " << oldPhero - oldPhero * beta <<
" pd " << gamma * pheroAdd * updatePheromone <<
" np " <<
425 for (
int i = 0; i < (int)policies.size(); i++) {
429 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());)
436 if (!
skipEta || currentPolicy->
getName().compare(
"Congestion") != 0) {
452 for (
int i = 0; i < (int)policies.size(); i++) {
456 if (policy == currentPolicy) {
464 if (policy == currentPolicy) {
475 if (policy == currentPolicy) {
481 phero_str <<
" policy " << policy->
getName() <<
" newSensitivity " << newSensitivity <<
" ,pol.Sensitivity " << policy->
getThetaSensitivity() <<
" ,elapsedTime " << elapsedTime << lf.str() <<
" NEWERSensitivity= " <<
max(
min(newSensitivity,
getThetaMax()),
getThetaMin()) <<
" ID " <<
getID() <<
" .";
483 if (policy == currentPolicy && eta > 0) {
485 }
else if (policy == currentPolicy && eta < 0) {
487 }
else if (eta > 0) {
489 }
else if (eta < 0) {
508 std::string laneId = iterator->first;
509 pheroIn += iterator->second;
511 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());)
527 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());)
528 pheroOut += iterator->second;
542 std::string laneId = iterator->first;
543 sum += pow(iterator->second - average_phero_in, 2);
548 ostringstream so_str; so_str <<
" dispersionIn " << result;
WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::getDispersionForInputLanes::" + so_str.str());)
559 sum += pow(iterator->second - average_phero_out, 2);
564 ostringstream so_str; so_str <<
" dispersionOut " << result;
WRITE_MESSAGE(
"MSSwarmTrafficLightLogic::getDispersionForOutputLanes::" + so_str.str());)
574 std::string laneId_max;
578 std::string laneId = iterator->first;
579 SUMOReal lanePhero = iterator->second;
581 max_phero_val_current = lanePhero;
585 if (lanePhero > max_phero_val_current) {
586 max_phero_val_old = max_phero_val_current;
587 max_phero_val_current = lanePhero;
588 temp_avg_other_lanes = (temp_avg_other_lanes * (counter - 1) + max_phero_val_old) / counter;
590 temp_avg_other_lanes = (temp_avg_other_lanes * (counter - 1) + lanePhero) / counter;
596 SUMOReal result = max_phero_val_current - temp_avg_other_lanes;
598 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());)
609 std::string laneId_max;
613 std::string laneId = iterator->first;
614 SUMOReal lanePhero = iterator->second;
616 max_phero_val_current = lanePhero;
620 if (lanePhero > max_phero_val_current) {
621 max_phero_val_old = max_phero_val_current;
622 max_phero_val_current = lanePhero;
623 temp_avg_other_lanes = (temp_avg_other_lanes * (counter - 1) + max_phero_val_old) / counter;
625 temp_avg_other_lanes = (temp_avg_other_lanes * (counter - 1) + lanePhero) / counter;
631 SUMOReal result = max_phero_val_current - temp_avg_other_lanes;
633 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());)
653 choosePolicy(pheroIn, pheroOut, distancePheroIn, distancePheroOut);
656 if (newPolicy != oldPolicy) {
659 if (oldPolicy->
getName().compare(
"Congestion") == 0) {
679 return 1 - (1 / ((
SUMOReal) factor));
685 MSLane* currentLane = NULL;
686 int count = 0, minIn = 0, minOut = 0, toSub, tmp;
687 bool inInit =
true, outInit =
true;
688 SUMOReal eta, normalized, diff, phi, delta;
699 for (MSTrafficLightLogic::LaneVectorVector::const_iterator laneVector =
myLanes.begin();
700 laneVector !=
myLanes.end(); laneVector++) {
701 for (MSTrafficLightLogic::LaneVector::const_iterator lane = laneVector->begin(); lane != laneVector->end();
703 currentLane = (*lane);
711 std::ostringstream cars_str; cars_str <<
"Lane " << currentLane->
getID() <<
": vehicles entered - " << count;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
723 for (MSTrafficLightLogic::LinkVectorVector::const_iterator linkVector =
myLinks.begin();
724 linkVector !=
myLinks.end(); linkVector++) {
725 for (MSTrafficLightLogic::LinkVector::const_iterator link = linkVector->begin(); link != linkVector->end();
727 currentLane = (*link)->getLane();
735 std::ostringstream cars_str; cars_str <<
"Lane " << currentLane->
getID() <<
": vehicles gone out- " << count;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
745 toReset.push_back(currentLane->
getID());
749 }
else if (count <= minOut) {
763 std::string lane = (*laneId);
766 if (inInit && tmp != 0) {
770 if (tmp < minIn && tmp != 0) {
774 toReset.push_back(lane);
777 std::ostringstream cars_str; cars_str <<
"Lane " << lane <<
" passed: " << tmp;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
788 while (!toReset.empty()) {
789 std::string laneId = toReset.back();
801 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());)
805 std::ostringstream eta_str; eta_str <<
"Min found:" << toSub <<
" MinIn:" << minIn <<
" MinOut:" << minOut;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + eta_str.str());)
823 eta = (-normalized * (1 / phi));
861 eta = normalized * phi;
874 MSLane* currentLane = NULL;
875 int count = 0, minIn = 0, minOut = 0, toSub, tmp;
876 bool inInit =
true, outInit =
true;
877 SUMOReal eta, ratio, phi, normalized, delta;
888 for (MSTrafficLightLogic::LaneVectorVector::const_iterator laneVector =
myLanes.begin();
889 laneVector !=
myLanes.end(); laneVector++) {
890 for (MSTrafficLightLogic::LaneVector::const_iterator lane = laneVector->begin(); lane != laneVector->end();
892 currentLane = (*lane);
900 std::ostringstream cars_str; cars_str <<
"Lane " << currentLane->
getID() <<
": vehicles entered - " << count;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
912 for (MSTrafficLightLogic::LinkVectorVector::const_iterator linkVector =
myLinks.begin();
913 linkVector !=
myLinks.end(); linkVector++) {
914 for (MSTrafficLightLogic::LinkVector::const_iterator link = linkVector->begin(); link != linkVector->end();
916 currentLane = (*link)->getLane();
924 std::ostringstream cars_str; cars_str <<
"Lane " << currentLane->
getID() <<
": vehicles gone out- " << count;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
934 toReset.push_back(currentLane->
getID());
938 }
else if (count <= minOut) {
953 std::string lane = (*laneId);
956 if (inInit && tmp != 0) {
960 if (tmp < minIn && tmp != 0) {
964 toReset.push_back(lane);
967 std::ostringstream cars_str; cars_str <<
"Lane " << lane <<
" passed: " << tmp;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + cars_str.str());)
978 while (!toReset.empty()) {
979 std::string laneId = toReset.back();
989 ratio = std::numeric_limits<SUMOReal>::infinity();
990 normalized = std::numeric_limits<SUMOReal>::infinity();
994 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());)
998 std::ostringstream eta_str; eta_str <<
"Min found:" << toSub <<
". MinIn:" << minIn <<
" MinOut:" << minOut;
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + eta_str.str());)
1017 eta = (-(normalized) * (1 / phi));
1053 eta = (normalized) * phi;
1061 std::ostringstream eta_str; eta_str <<
"Eta Normalized: " << eta <<
".";
WRITE_MESSAGE(
time2string(
MSNet::getInstance()->getCurrentTimeStep()) +
" MSSwarmTrafficLightLogic::calculateEta::" + eta_str.str());)
1068 MSLane* currentLane = NULL;
1071 for (MSTrafficLightLogic::LaneVectorVector::const_iterator laneVector =
myLanes.begin();
1072 laneVector !=
myLanes.end(); laneVector++) {
1074 for (MSTrafficLightLogic::LaneVector::const_iterator lane = laneVector->begin(); lane != laneVector->end();
1076 currentLane = (*lane);
1081 for (MSTrafficLightLogic::LinkVectorVector::const_iterator linkVector =
myLinks.begin();
1082 linkVector !=
myLinks.end(); linkVector++) {
1083 for (MSTrafficLightLogic::LinkVector::const_iterator link = linkVector->begin(); link != linkVector->end();
1085 currentLane = (*link)->getLane();
1095 if (it.operator * ()->getName() ==
"Phase") {
1101 std::vector<SUMOReal> thetaStimuli;
1104 for (
int i = 0; i < (int)
getPolicies().size(); i++) {
1105 SUMOReal stimulus =
getPolicies()[i]->computeDesirability(phero_in, phero_out, dispersion_in, dispersion_out);
1106 SUMOReal thetaStimulus = pow(stimulus, 2) / (pow(stimulus, 2) + pow(
getPolicies()[i]->getThetaSensitivity(), 2));
1108 thetaStimuli.push_back(thetaStimulus);
1109 thetaSum += thetaStimulus;
1113 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());)
1123 for (
int i = 0; i < (int)
getPolicies().size(); i++) {
1124 partialSum += thetaStimuli[i];
1128 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());)
1130 if (partialSum >= r) {
1150 std::string laneState =
"";
1154 laneState += state[*it];
void initScaleFactorDispersionOut(int lanes_out)
virtual std::string getMessage()=0
MSSOTLSensors * getSensors()
MSEdge & getEdge() const
Returns the lane's edge.
Builds detectors for microsim.
const std::string & getState() const
Returns the state within this phase.
std::map< std::string, CircularBuffer< SUMOReal > * > m_derivativeHistory
SUMOReal getScaleFactorDispersionOut()
static SUMOReal _2SUMOReal(const E *const data)
converts a char-type array into the SUMOReal value described by it
int getReinforcementMode()
Class for low-level platoon policy.
std::map< std::string, CircularBuffer< SUMOReal > * > m_meanSpeedHistory
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()
SUMOReal getLearningCox()
std::string getPoliciesParam()
bool isWalkingArea() const
return whether this edge is walking area
bool allowLine(MSLane *)
Check if a lane is allowed to be added to the maps pheromoneInputLanes and pheromoneOutputLanes Contr...
static SUMOReal rand()
Returns a random real number in [0, 1)
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()
SUMOReal getDispersionForInputLanes(SUMOReal average_phero_in)
SUMOTime congestion_steps
LaneIdVector targetLanes
A copy of the target lanes of this phase.
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
int getPhaseIndexWithMaxCTS()
virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed, const MSPhaseDefinition *stage, int vehicleCount)=0
SUMOReal getPheromoneForInputLanes()
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...
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...
virtual void setThetaSensitivity(SUMOReal val)
MSSOTLPolicyDesirability * getDesirabilityAlgorithm()
const std::string & getID() const
Returns the id.
MSSOTLPolicy * currentPolicy
SUMOReal calculatePhi(int factor)
Method that should calculate the valor of phi a coefficient to amplify/attenuate eta based on a facto...
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)
const LinkVector & getLinksAt(int i) const
Returns the list of links that are controlled by the signals at the given position.
MSSOTLE2Sensors * getCountSensors()
Return the sensors that count the passage of vehicles in and out of the tl.
int getCurrentPhaseIndex() const
Returns the current index within the program.
SUMOReal calculateEtaRatio()
std::map< std::string, SUMOReal > MSLaneId_PheromoneMap
std::map< std::string, std::string > m_pheroLevelLog
SUMOReal getPheromoneForOutputLanes()
SUMOReal m_derivativeAlpha
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
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.
bool skipEta
When true indicates that we can skip the evaluation of eta since we've a congestion policy that is la...
void decidePolicy()
Decide the current policy according to pheromone levels The decision reflects on currentPolicy value...
SUMOReal getScaleFactorDispersionIn()
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
bool gotTargetLane
When true indicates that we've already acquired the target lanes for this particular phase...
SUMOReal getForgettingCox()
virtual SUMOReal meanVehiclesSpeed(MSLane *lane)=0
SUMOReal getDispersionForOutputLanes(SUMOReal average_phero_out)
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 participate in this tl-light.
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 SUMOReal getMaxSpeed(std::string laneId)=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...
const LaneIdVector & getTargetLaneSet() const
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)
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
Class for low-level phase policy.
void inform(std::string msg, bool addType=true)
adds a new error to the list
SUMOReal getPheroMaxVal()
void choosePolicy(SUMOReal phero_in, SUMOReal phero_out, SUMOReal dispersion_in, SUMOReal dispersion_out)
MSLaneId_PheromoneMap pheromoneInputLanes
This pheronome is an indicator of congestion on input lanes. Its levels refer to the average speed of...
SUMOReal getDistanceOfMaxPheroForInputLanes()
Class for a low-level policy.
SUMOTime lastThetaSensitivityUpdate
Class for low-level congestion policy.
bool isCrossing() const
return whether this edge is a pedestrian crossing
bool m_useVehicleTypesWeights
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.
std::vector< std::string > LaneIdVector
#define WRITE_MESSAGE(msg)
SUMOReal calculateEtaDiff()
Method that should calculate the valor of eta a coefficient to evaluate the current policy's work...
virtual SUMOReal getThetaSensitivity()
std::pair< std::string, SUMOReal > MSLaneId_Pheromone
Representation of a lane in the micro simulation.
bool isPushButtonPressed()
std::map< std::string, std::vector< int > > m_laneIndexMap
void addPolicy(MSSOTLPolicy *policy)
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
void resetPheromone()
Resets pheromone levels.
SUMOReal getDistanceOfMaxPheroForOutputLanes()
SUMOReal getChangePlanProbability()
int countVehicles(MSPhaseDefinition phase)