Skip to content

Commit bd80d4e

Browse files
committed
Remove comments and format
1 parent 94ae4d7 commit bd80d4e

File tree

4 files changed

+9
-45
lines changed

4 files changed

+9
-45
lines changed

src/dsm/headers/Dynamics.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -842,17 +842,11 @@ namespace dsm {
842842
meanDensity_streets /= nStreets;
843843
}
844844
}
845-
//std::cout << '\t' << " -> Mean network density: " << std::setprecision(7) << meanDensityGlob << '\n';
846-
//std::cout << '\t' << " -> Mean density of 4 outgoing streets: " << std::setprecision(7) << meanDensity_streets << '\n';
847845
const auto ratio = meanDensityGlob / meanDensity_streets;
848846
// densityTolerance represents the max border we want to consider
849847
const auto dyn_thresh = std::tanh(ratio) * densityTolerance;
850-
//std::cout << '\t' << " -> Parametro ratio: " << std::setprecision(7) << ratio << '\n';
851-
//std::cout << '\t' << " -> Parametro dyn_thresh: " << std::setprecision(7) << dyn_thresh << '\n';
852848
if (meanDensityGlob * (1. + dyn_thresh) > meanDensity_streets) {
853-
//std::cout << '\t' << " -> I'm on the cluster's border" << '\n';
854849
if (meanDensityGlob > meanDensity_streets) {
855-
//std::cout << '\t' << " -> LESS than max density" << '\n';
856850
if (!(redTime > greenTime) && (redSum > greenSum) && (greenTime > delta)) {
857851
greenTime -= delta;
858852
redTime += delta;
@@ -862,14 +856,9 @@ namespace dsm {
862856
redTime -= delta;
863857
tl.setDelay(std::make_pair(greenTime, redTime));
864858
} else {
865-
//std::cout << '\t' << " -> NOT entered into previous ifs" << '\n';
866859
tl.setDelay(std::make_pair(greenTime, redTime));
867860
}
868-
//std::cout << '\t' << " -> greenTime: " << static_cast<unsigned int>(greenTime) << '\n';
869-
//std::cout << '\t' << " -> redTime: " << static_cast<unsigned int>(redTime) << '\n';
870-
//std::cout << '\t' << " -> modTime: " << tl.modTime() << '\n';
871861
} else {
872-
//std::cout << '\t' << " -> GREATER than max density" << '\n';
873862
if (!(redTime > greenTime) && (redSum > greenSum) &&
874863
(greenTime > ratio * delta)) {
875864
greenTime -= dyn_thresh * delta; //
@@ -890,16 +879,9 @@ namespace dsm {
890879
redTime += dyn_thresh * delta; //
891880
tl.setDelay(std::make_pair(greenTime, redTime));
892881
} else {
893-
//std::cout << '\t' << " -> NON sono entrato negli if precedenti" << '\n';
894882
tl.setDelay(std::make_pair(greenTime, redTime));
895883
}
896-
//std::cout << '\t' << " -> greenTime: " << static_cast<unsigned int>(greenTime) << '\n';
897-
//std::cout << '\t' << " -> redTime: " << static_cast<unsigned int>(redTime) << '\n';
898-
//std::cout << '\t' << " -> modTime: " << tl.modTime() << '\n';
899884
}
900-
} else {
901-
//std::cout << '\t' << " -> I'm INTO the cluster" << '\n';
902-
//std::cout << '\t' << " -> modTime: " << tl.modTime() << '\n';
903885
}
904886
}
905887
for (auto& [id, element] : m_streetTails) {

src/dsm/headers/Graph.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,7 @@ namespace dsm {
207207
}
208208
/// @brief Get the graph's street map
209209
/// @return A std::unordered_map containing the graph's streets
210-
std::unordered_map<Id, std::unique_ptr<Street>>& streetSet() {
211-
return m_streets;
212-
}
210+
std::unordered_map<Id, std::unique_ptr<Street>>& streetSet() { return m_streets; }
213211
/// @brief Get a street from the graph
214212
/// @param source The source node
215213
/// @param destination The destination node

src/dsm/headers/Node.hpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,19 @@ namespace dsm {
5252
void setId(Id id) { m_id = id; }
5353
/// @brief Set the node's coordinates
5454
/// @param coords A std::pair containing the node's coordinates (lat, lon)
55-
void setCoords(std::pair<double, double> coords) {
56-
m_coords = std::move(coords);
57-
}
55+
void setCoords(std::pair<double, double> coords) { m_coords = std::move(coords); }
5856
/// @brief Set the node's capacity
5957
/// @param capacity The node's capacity
6058
virtual void setCapacity(Size capacity) { m_capacity = capacity; }
6159
/// @brief Set the node's transport capacity
6260
/// @param capacity The node's transport capacity
63-
virtual void setTransportCapacity(Size capacity) {
64-
m_transportCapacity = capacity;
65-
}
61+
virtual void setTransportCapacity(Size capacity) { m_transportCapacity = capacity; }
6662
/// @brief Get the node's id
6763
/// @return Id The node's id
6864
Id id() const { return m_id; }
6965
/// @brief Get the node's coordinates
7066
/// @return std::optional<std::pair<double, double>> A std::pair containing the node's coordinates
71-
const std::optional<std::pair<double, double>>& coords() const {
72-
return m_coords;
73-
}
67+
const std::optional<std::pair<double, double>>& coords() const { return m_coords; }
7468
/// @brief Get the node's capacity
7569
/// @return Size The node's capacity
7670
Size capacity() const { return m_capacity; }
@@ -146,9 +140,7 @@ namespace dsm {
146140
/// If a street has priority, it means that the agents that are on that street
147141
/// have priority over the agents that are on the other streets.
148142
/// @return std::set<Id> A std::set containing the node's street priorities
149-
virtual const std::set<Id>& streetPriorities() const {
150-
return m_streetPriorities;
151-
};
143+
virtual const std::set<Id>& streetPriorities() const { return m_streetPriorities; };
152144
/// @brief Get the node's agent ids
153145
/// @return std::set<Id> A std::set containing the node's agent ids
154146
const std::multimap<int16_t, Id>& agents() { return m_agents; };

src/dsm/headers/Street.hpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ namespace dsm {
110110
/// @brief Set the street's node pair
111111
/// @param node1 The source node of the street
112112
/// @param node2 The destination node of the street
113-
void setNodePair(Id node1, Id node2) {
114-
m_nodePair = std::make_pair(node1, node2);
115-
}
113+
void setNodePair(Id node1, Id node2) { m_nodePair = std::make_pair(node1, node2); }
116114
/// @brief Set the street's node pair
117115
/// @param node1 The source node of the street
118116
/// @param node2 The destination node of the street
@@ -158,14 +156,10 @@ namespace dsm {
158156
const std::set<Id>& waitingAgents() const { return m_waitingAgents; }
159157
/// @brief Get the street's queue
160158
/// @return dsm::queue<Size>, The street's queue
161-
const dsm::queue<Size>& queue(size_t index) const {
162-
return m_exitQueues[index];
163-
}
159+
const dsm::queue<Size>& queue(size_t index) const { return m_exitQueues[index]; }
164160
/// @brief Get the street's queues
165161
/// @return std::vector<dsm::queue<Size>> The street's queues
166-
const std::vector<dsm::queue<Size>>& exitQueues() const {
167-
return m_exitQueues;
168-
}
162+
const std::vector<dsm::queue<Size>>& exitQueues() const { return m_exitQueues; }
169163
/// @brief Get the street's node pair
170164
/// @return std::pair<Id, Id>, The street's node pair
171165
const std::pair<Id, Id>& nodePair() const { return m_nodePair; }
@@ -177,9 +171,7 @@ namespace dsm {
177171
double density() const { return nAgents() / (m_len * m_nLanes); }
178172
/// @brief Get the street's normalized density
179173
/// @return double, The street's normalized density
180-
double normDensity() const {
181-
return nAgents() / static_cast<double>(m_capacity);
182-
}
174+
double normDensity() const { return nAgents() / static_cast<double>(m_capacity); }
183175
/// @brief Check if the street is full
184176
/// @return bool, True if the street is full, false otherwise
185177
bool isFull() const { return nAgents() == m_capacity; }

0 commit comments

Comments
 (0)