Skip to content

Commit 1bbe367

Browse files
committed
Bug and docs fixes
1 parent c265991 commit 1bbe367

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ target_include_directories(dsf PUBLIC
3535
target_link_libraries(dsf PRIVATE TBB::tbb)
3636

3737
install(TARGETS dsf
38-
EXPORT dsmConfig
38+
EXPORT dsfConfig
3939
ARCHIVE DESTINATION lib
4040
LIBRARY DESTINATION lib
4141
RUNTIME DESTINATION bin)
4242

4343
install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
4444

45-
install(EXPORT dsmConfig
46-
FILE dsmConfig.cmake
45+
install(EXPORT dsfConfig
46+
FILE dsfConfig.cmake
4747
NAMESPACE dsf::
4848
DESTINATION lib/cmake/dsf)
4949

src/dsf/dsf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
static constexpr uint8_t DSF_VERSION_MAJOR = 3;
88
static constexpr uint8_t DSF_VERSION_MINOR = 0;
9-
static constexpr uint8_t DSF_VERSION_PATCH = 0;
9+
static constexpr uint8_t DSF_VERSION_PATCH = 1;
1010

1111
static auto const DSF_VERSION =
1212
std::format("{}.{}.{}", DSF_VERSION_MAJOR, DSF_VERSION_MINOR, DSF_VERSION_PATCH);

src/dsf/headers/RoadDynamics.hpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,15 @@ namespace dsf {
233233
/// @brief Optimize the traffic lights by changing the green and red times
234234
/// @param optimizationType TrafficLightOptimization, The type of optimization. Default is DOUBLE_TAIL
235235
/// @param logFile The file into which write the logs (default is empty, meaning no logging)
236-
/// @param threshold double, The minimum difference between green and red queues to trigger the local optimization (n agents - default is 0)
237-
/// @param ratio double, The ratio between the self-density and neighbour density to trigger the non-local optimization (default is 1.3)
238-
/// @details The function cycles over the traffic lights and, if the difference between the two tails is greater than
239-
/// the threshold multiplied by the mean capacity of the streets, it changes the green and red times of the traffic light, keeping the total cycle time constant.
240-
/// The optimizationType parameter can be set to SINGLE_TAIL to use an algorith which looks only at the incoming street tails or to DOUBLE_TAIL to consider both incoming and outgoing street tails.
236+
/// @param percentage double, the maximum amount (percentage) of the green time to change (default is 0.3)
237+
/// @param threshold double, The ratio between the self-density and neighbour density to trigger the non-local optimization (default is 1.3)
238+
/// @details The local optimization is done by changing the green time of each traffic light, trying to make it proportional to the
239+
/// queue lengths at each phase. The non-local optimization is done by synchronizing the traffic lights which are congested over threshold.
241240
void optimizeTrafficLights(
242241
TrafficLightOptimization optimizationType = TrafficLightOptimization::DOUBLE_TAIL,
243242
const std::string& logFile = std::string(),
244-
double const threshold = 0.,
245-
double const ratio = 1.3);
243+
double const percentage = 0.3,
244+
double const threshold = 1.3);
246245

247246
/// @brief Get the itineraries
248247
/// @return const std::unordered_map<Id, Itinerary>&, The itineraries
@@ -1875,16 +1874,16 @@ namespace dsf {
18751874
void RoadDynamics<delay_t>::optimizeTrafficLights(
18761875
TrafficLightOptimization const optimizationType,
18771876
const std::string& logFile,
1878-
double const threshold,
1879-
double const ratio) {
1877+
double const percentage,
1878+
double const threshold) {
18801879
std::optional<std::ofstream> logStream;
18811880
if (!logFile.empty()) {
18821881
logStream.emplace(logFile, std::ios::app);
18831882
if (!logStream->is_open()) {
18841883
Logger::error(std::format("Could not open log file: {}", logFile));
18851884
}
18861885
}
1887-
this->m_trafficlightSingleTailOptimizer(threshold, logStream);
1886+
this->m_trafficlightSingleTailOptimizer(percentage, logStream);
18881887
if (optimizationType == TrafficLightOptimization::DOUBLE_TAIL) {
18891888
// Try to synchronize congested traffic lights
18901889
std::unordered_map<Id, double> densities;
@@ -1923,7 +1922,7 @@ namespace dsf {
19231922
continue;
19241923
}
19251924
auto const& neighbourDensity{densities.at(sourceId)};
1926-
if (neighbourDensity < ratio * density) {
1925+
if (neighbourDensity < threshold * density) {
19271926
continue;
19281927
}
19291928
// Try to green-wave the situation

0 commit comments

Comments
 (0)