Skip to content

Refactor Class Structure#150

Draft
sengels-tum wants to merge 145 commits into
mainfrom
2026-refactor-problem-instance
Draft

Refactor Class Structure#150
sengels-tum wants to merge 145 commits into
mainfrom
2026-refactor-problem-instance

Conversation

@sengels-tum
Copy link
Copy Markdown
Collaborator

Description

This PR refactors the class structure by simplifying the problem instances. Most importantly:

  • All problem instances have single time points and no time intervals -> delays are handled by the objective and not an upper bound on an interval
  • Scheduled Stops do not have an end time -> this is already implicitly given
  • The solver input can be significantly simplified by unification of the problem instance
  • The existing problem instances (stored on disk) are converted to the new class style

Moreover learnings from a recent C++ software design course are incorporated to follow more best practices.

Finally, docstrings are moved to .hpp files to follow best practices and allow autogeneration of docs.

Overall, this should simplify the class structure, follow more best practices, and be improve the understandability of the code. Also, significantly less templating will be needed.

Checklist:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8976700-2c8b-48a4-ab6a-79efedf98bd2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-refactor-problem-instance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 79.59957% with 377 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.6%. Comparing base (80bb3a2) to head (dc840f4).

Files with missing lines Patch % Lines
src/probleminstances/GeneralProblemInstance.cpp 0.0% 175 Missing ⚠️
src/datastructure/Timetable.cpp 67.3% 66 Missing ⚠️
src/datastructure/RailwayNetwork_helper.cpp 91.5% 38 Missing ⚠️
src/datastructure/Route.cpp 81.6% 36 Missing ⚠️
...nclude/probleminstances/GeneralProblemInstance.hpp 0.0% 27 Missing ⚠️
src/EOMHelper.cpp 94.5% 16 Missing ⚠️
include/datastructure/Route.hpp 78.9% 4 Missing ⚠️
include/datastructure/Timetable.hpp 95.1% 4 Missing ⚠️
src/datastructure/Train.cpp 88.2% 4 Missing ⚠️
include/datastructure/Train.hpp 94.3% 3 Missing ⚠️
... and 3 more
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #150      +/-   ##
========================================
- Coverage   96.3%   81.6%   -14.8%     
========================================
  Files         41      22      -19     
  Lines       9931    2789    -7142     
  Branches    1716     466    -1250     
========================================
- Hits        9570    2276    -7294     
- Misses       361     513     +152     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v18.1.8) reports: 272 concern(s)
  • include/Definitions.hpp:9:34: warning: [misc-include-cleaner]

    no header providing "size_t" is directly included

        2 | #include <cstdint>
        3 | #include <limits>
        4 | #include <unordered_set>
        5 | #include <vector>
        6 | 
        7 | namespace cda_rail {
        8 | 
        9 | using index_vector = std::vector<size_t>;
          |                                  ^
  • include/FixedSizeVector.hpp:31:19: warning: [modernize-avoid-c-arrays]

    do not declare C-style arrays, use std::array<> instead

       31 |   std::unique_ptr<T[]> m_data{
          |                   ^
  • include/FixedSizeVector.hpp:32:24: warning: [modernize-avoid-c-arrays]

    do not declare C-style arrays, use std::array<> instead

       32 |       std::make_unique<T[]>(0)}; // NOLINT(cppcoreguidelines-avoid-c-arrays)
          |                        ^
  • include/FixedSizeVector.hpp:51:33: warning: [modernize-avoid-c-arrays]

    do not declare C-style arrays, use std::array<> instead

       51 |       : m_data(std::make_unique<T[]>(
          |                                 ^
  • include/FixedSizeVector.hpp:61:33: warning: [modernize-avoid-c-arrays]

    do not declare C-style arrays, use std::array<> instead

       61 |       : m_data(std::make_unique<T[]>(
          |                                 ^
  • include/FixedSizeVector.hpp:73:33: warning: [modernize-avoid-c-arrays]

    do not declare C-style arrays, use std::array<> instead

       73 |       : m_data(std::make_unique<T[]>(
          |                                 ^
  • include/FixedSizeVector.hpp:139:26: warning: [modernize-avoid-c-arrays]

    do not declare C-style arrays, use std::array<> instead

      139 |         std::make_unique<T[]>(len); // NOLINT(cppcoreguidelines-avoid-c-arrays)
          |                          ^
  • include/GeneralHelper.hpp:86:27: warning: [misc-include-cleaner]

    no header providing "size_t" is directly included

        8 | subsets_of_size_k_indices(size_t n, size_t k);
          |                           ^
  • include/MultiArray.hpp:4:1: warning: [misc-include-cleaner]

    included header cstddef is not used directly

        4 | #include <cstddef>
          | ^~~~~~~~~~~~~~~~~~
        5 | #include <sstream>
  • include/StringHelper.hpp:31:48: warning: [readability-identifier-naming]

    invalid case style for parameter 'sView'

       31 | void to_bool_optional_inplace(std::string_view sView, std::optional<bool>& b);
          |                                                ^~~~~
          |                                                s_view
  • include/datastructure/RailwayNetwork.hpp:272:37: warning: [readability-avoid-const-params-in-decls]

    parameter 'networkName' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions

      272 |   explicit Network(std::string_view const       networkName,
          |                                     ^~~~~
  • include/datastructure/RailwayNetwork.hpp:273:49: warning: [readability-identifier-naming]

    invalid case style for parameter 'workingDirectory'

      273 |                    std::filesystem::path const& workingDirectory);
          |                                                 ^~~~~~~~~~~~~~~~
          |                                                 working_directory
  • include/datastructure/RailwayNetwork.hpp:285:43: warning: [readability-identifier-naming]

    invalid case style for parameter 'workingDirectory'

      285 |                    std::string const&     workingDirectory)
          |                                           ^~~~~~~~~~~~~~~~
          |                                           working_directory
      286 |       : Network(networkName, std::filesystem::path(workingDirectory)) {};
          |                                                    ~~~~~~~~~~~~~~~~
          |                                                    working_directory
  • include/datastructure/Route.hpp:415:32: error: [clang-diagnostic-error]

    constexpr function's return type 'const_iterator' (aka '_Node_const_iterator<std::pair<const std::basic_string<char, std::char_traits, std::allocator>, cda_rail::Route>, __constant_iterators::value, __hash_cached::value>') is not a literal type

      415 |   [[nodiscard]] constexpr auto cbegin() const { return m_routes.cbegin(); };
          |                                ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/hashtable_policy.h:471:12: note: '_Node_const_iterator<std::pair<const std::basic_string<char>, cda_rail::Route>, false, true>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors
      471 |     struct _Node_const_iterator
          |            ^
  • include/datastructure/Route.hpp:421:32: error: [clang-diagnostic-error]

    constexpr function's return type 'const_iterator' (aka '_Node_const_iterator<std::pair<const std::basic_string<char, std::char_traits, std::allocator>, cda_rail::Route>, __constant_iterators::value, __hash_cached::value>') is not a literal type

      421 |   [[nodiscard]] constexpr auto cend() const { return m_routes.cend(); };
          |                                ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/hashtable_policy.h:471:12: note: '_Node_const_iterator<std::pair<const std::basic_string<char>, cda_rail::Route>, false, true>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors
      471 |     struct _Node_const_iterator
          |            ^
  • include/datastructure/Station.hpp:9:1: warning: [misc-include-cleaner]

    included header string_view is not used directly

        9 | #include <string_view>
          | ^~~~~~~~~~~~~~~~~~~~~~
       10 | #include <unordered_map>
  • include/datastructure/Station.hpp:25:19: warning: [readability-redundant-member-init]

    initializer for member 'name' is redundant

       25 |   std::string name{};
          |                   ^~
  • include/datastructure/Station.hpp:30:29: warning: [readability-redundant-member-init]

    initializer for member 'tracks' is redundant

       30 |   cda_rail::index_set tracks{};
          |                             ^~
  • include/datastructure/Station.hpp:74:40: warning: [misc-include-cleaner]

    no header providing "std::shared_ptr" is directly included

        8 |   std::unordered_map<std::string, std::shared_ptr<Station>> stations;
          |                                        ^
  • include/datastructure/Station.hpp:152:22: warning: [misc-include-cleaner]

    no header providing "std::unordered_set" is directly included

       11 |   [[nodiscard]] std::unordered_set<std::string> get_station_names() const;
          |                      ^
  • include/datastructure/Timetable.hpp:5:1: warning: [misc-include-cleaner]

    included header json.hpp is not used directly

        5 | #include "nlohmann/json.hpp"
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        6 | #include "nlohmann/json_fwd.hpp"
  • include/datastructure/Timetable.hpp:11:1: warning: [misc-include-cleaner]

    included header stdexcept is not used directly

       11 | #include <stdexcept>
          | ^~~~~~~~~~~~~~~~~~~~
       12 | #include <string>
  • include/datastructure/Timetable.hpp:13:1: warning: [misc-include-cleaner]

    included header type_traits is not used directly

       13 | #include <type_traits>
          | ^~~~~~~~~~~~~~~~~~~~~~
       14 | #include <utility>
  • include/datastructure/Timetable.hpp:47:35: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::InvalidInputException" is directly included

        2 |       throw cda_rail::exceptions::InvalidInputException(
          |                                   ^
  • include/datastructure/Timetable.hpp:74:27: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::throw_if_negative" is directly included

       74 |     cda_rail::exceptions::throw_if_negative(m_service_time, "Service time");
          |                           ^
  • include/datastructure/Timetable.hpp:187:37: warning: [readability-redundant-member-init]

    initializer for member 'm_stops' is redundant

      187 |   std::vector<ScheduledStop> m_stops{}; // list of stops, may be empty
          |                                     ^~
  • include/datastructure/Timetable.hpp:201:31: warning: [misc-include-cleaner]

    no header providing "std::optional" is directly included

       11 |   static std::pair<bool, std::optional<cda_rail::exceptions::CustomException>>
          |                               ^
  • include/datastructure/Timetable.hpp:201:62: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::CustomException" is directly included

      201 |   static std::pair<bool, std::optional<cda_rail::exceptions::CustomException>>
          |                                                              ^
  • include/datastructure/Timetable.hpp:317:27: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::throw_if_less_than" is directly included

      317 |     cda_rail::exceptions::throw_if_less_than(newExitTime, m_entry_time,
          |                           ^
  • include/datastructure/Timetable.hpp:368:25: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::VertexNotExistentException" is directly included

      368 |       throw exceptions::VertexNotExistentException(newEntryVertex);
          |                         ^
  • include/datastructure/Timetable.hpp:442:18: warning: [misc-include-cleaner]

    no header providing "std::ranges::sort" is directly included

        8 |     std::ranges::sort(m_stops, {}, &ScheduledStop::get_service_time);
          |                  ^
  • include/datastructure/Timetable.hpp:451:39: warning: [readability-redundant-member-init]

    initializer for member 'm_station_list' is redundant

      451 |   StationList           m_station_list{};
          |                                       ^~
  • include/datastructure/Timetable.hpp:452:37: warning: [readability-redundant-member-init]

    initializer for member 'm_train_list' is redundant

      452 |   TrainList             m_train_list{};
          |                                     ^~
  • include/datastructure/Timetable.hpp:453:36: warning: [readability-redundant-member-init]

    initializer for member 'm_schedules' is redundant

      453 |   std::vector<Schedule> m_schedules{};
          |                                    ^~
  • include/datastructure/Timetable.hpp:521:59: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'train_index'

      521 |   [[nodiscard]] Schedule const& get_schedule(size_t const train_index) const {
          |                                                           ^~~~~~~~~~~
          |                                                           trainIndex
      522 |     if (!m_train_list.has_train(train_index)) {
          |                                 ~~~~~~~~~~~
          |                                 trainIndex
      523 |       throw exceptions::TrainNotExistentException(train_index);
          |                                                   ~~~~~~~~~~~
          |                                                   trainIndex
      524 |     }
      525 |     return m_schedules.at(train_index);
          |                           ~~~~~~~~~~~
          |                           trainIndex
  • include/datastructure/Timetable.hpp:523:25: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::TrainNotExistentException" is directly included

      523 |       throw exceptions::TrainNotExistentException(train_index);
          |                         ^
  • include/datastructure/Timetable.hpp:542:47: warning: [misc-include-cleaner]

    no header providing "cda_rail::index_vector" is directly included

        2 |       std::pair<size_t, std::vector<cda_rail::index_vector>>>
          |                                               ^
  • include/datastructure/Timetable.hpp:545:29: warning: [misc-include-cleaner]

    no header providing "cda_rail::index_set" is directly included

      545 |                   cda_rail::index_set const& edges_to_consider) {
          |                             ^
  • include/datastructure/Timetable.hpp:553:38: warning: [performance-unnecessary-value-param]

    the parameter 'station_name' is copied for each invocation but only used as a const reference; consider making it a const reference

      553 |   void add_empty_station(std::string station_name) {
          |                                      ^
          |                          const      &
  • include/datastructure/Timetable.hpp:554:38: warning: [performance-move-const-arg]

    passing result of std::move() as a const reference argument; no move will actually happen

      554 |     m_station_list.add_empty_station(std::move(station_name));
          |                                      ^~~~~~~~~~            ~
  • include/datastructure/Timetable.hpp:560:66: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'service_time'

      560 |                    std::string const& station_name, double const service_time,
          |                                                                  ^~~~~~~~~~~~
          |                                                                  serviceTime
      561 |                    double const service_duration) {
      562 |     insert_stop(m_train_list.get_train_index(train_name), station_name,
      563 |                 service_time, service_duration);
          |                 ~~~~~~~~~~~~
          |                 serviceTime
  • include/datastructure/Timetable.hpp:561:33: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'service_duration'

      561 |                    double const service_duration) {
          |                                 ^~~~~~~~~~~~~~~~
          |                                 serviceDuration
      562 |     insert_stop(m_train_list.get_train_index(train_name), station_name,
      563 |                 service_time, service_duration);
          |                               ~~~~~~~~~~~~~~~~
          |                               serviceDuration
  • include/datastructure/Timetable.hpp:601:26: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'max_speed'

      601 |             double const max_speed, double const acceleration,
          |                          ^~~~~~~~~
          |                          maxSpeed
      602 |             double const deceleration, bool const tim, double const entry_time,
      603 |             double const initial_velocity, std::string const& entry_vertex,
      604 |             double const exit_time, double const exit_velocity,
      605 |             std::string const& exit_vertex, Network const& network) {
      606 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
          |                                          ~~~~~~~~~
          |                                          maxSpeed
  • include/datastructure/Timetable.hpp:602:69: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'entry_time'

      602 |             double const deceleration, bool const tim, double const entry_time,
          |                                                                     ^~~~~~~~~~
          |                                                                     entryTime
      603 |             double const initial_velocity, std::string const& entry_vertex,
      604 |             double const exit_time, double const exit_velocity,
      605 |             std::string const& exit_vertex, Network const& network) {
      606 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
      607 |                      tim, entry_time, initial_velocity,
          |                           ~~~~~~~~~~
          |                           entryTime
  • include/datastructure/Timetable.hpp:603:26: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'initial_velocity'

      603 |             double const initial_velocity, std::string const& entry_vertex,
          |                          ^~~~~~~~~~~~~~~~
          |                          initialVelocity
      604 |             double const exit_time, double const exit_velocity,
      605 |             std::string const& exit_vertex, Network const& network) {
      606 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
      607 |                      tim, entry_time, initial_velocity,
          |                                       ~~~~~~~~~~~~~~~~
          |                                       initialVelocity
  • include/datastructure/Timetable.hpp:604:26: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'exit_time'

      604 |             double const exit_time, double const exit_velocity,
          |                          ^~~~~~~~~
          |                          exitTime
      605 |             std::string const& exit_vertex, Network const& network) {
      606 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
      607 |                      tim, entry_time, initial_velocity,
      608 |                      network.get_vertex_index(entry_vertex), exit_time,
          |                                                              ~~~~~~~~~
          |                                                              exitTime
  • include/datastructure/Timetable.hpp:604:50: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'exit_velocity'

      604 |             double const exit_time, double const exit_velocity,
          |                                                  ^~~~~~~~~~~~~
          |                                                  exitVelocity
      605 |             std::string const& exit_vertex, Network const& network) {
      606 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
      607 |                      tim, entry_time, initial_velocity,
      608 |                      network.get_vertex_index(entry_vertex), exit_time,
      609 |                      exit_velocity, network.get_vertex_index(exit_vertex),
          |                      ~~~~~~~~~~~~~
          |                      exitVelocity
  • include/datastructure/Timetable.hpp:624:26: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'max_speed'

      624 |             double const max_speed, double const acceleration,
          |                          ^~~~~~~~~
          |                          maxSpeed
      625 |             double const deceleration, double const entry_time,
      626 |             double const initial_velocity, std::string const& entry_vertex,
      627 |             double const exit_time, double const exit_velocity,
      628 |             std::string const& exit_vertex, Network const& network) {
      629 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
          |                                          ~~~~~~~~~
          |                                          maxSpeed
  • include/datastructure/Timetable.hpp:625:53: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'entry_time'

      625 |             double const deceleration, double const entry_time,
          |                                                     ^~~~~~~~~~
          |                                                     entryTime
      626 |             double const initial_velocity, std::string const& entry_vertex,
      627 |             double const exit_time, double const exit_velocity,
      628 |             std::string const& exit_vertex, Network const& network) {
      629 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
      630 |                      true, entry_time, initial_velocity,
          |                            ~~~~~~~~~~
          |                            entryTime
  • include/datastructure/Timetable.hpp:626:26: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'initial_velocity'

      626 |             double const initial_velocity, std::string const& entry_vertex,
          |                          ^~~~~~~~~~~~~~~~
          |                          initialVelocity
      627 |             double const exit_time, double const exit_velocity,
      628 |             std::string const& exit_vertex, Network const& network) {
      629 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
      630 |                      true, entry_time, initial_velocity,
          |                                        ~~~~~~~~~~~~~~~~
          |                                        initialVelocity
  • include/datastructure/Timetable.hpp:627:26: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'exit_time'

      627 |             double const exit_time, double const exit_velocity,
          |                          ^~~~~~~~~
          |                          exitTime
      628 |             std::string const& exit_vertex, Network const& network) {
      629 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
      630 |                      true, entry_time, initial_velocity,
      631 |                      network.get_vertex_index(entry_vertex), exit_time,
          |                                                              ~~~~~~~~~
          |                                                              exitTime
  • include/datastructure/Timetable.hpp:627:50: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'exit_velocity'

      627 |             double const exit_time, double const exit_velocity,
          |                                                  ^~~~~~~~~~~~~
          |                                                  exitVelocity
      628 |             std::string const& exit_vertex, Network const& network) {
      629 |     return add_train(train_name, length, max_speed, acceleration, deceleration,
      630 |                      true, entry_time, initial_velocity,
      631 |                      network.get_vertex_index(entry_vertex), exit_time,
      632 |                      exit_velocity, network.get_vertex_index(exit_vertex),
          |                      ~~~~~~~~~~~~~
          |                      exitVelocity
  • include/datastructure/Timetable.hpp:668:34: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'tn_inclusive'

      668 |                       bool const tn_inclusive = true) const {
          |                                  ^~~~~~~~~~~~
          |                                  tnInclusive
      669 |     return time_index_interval(m_train_list.get_train_index(train_name), dt,
      670 |                                tn_inclusive);
          |                                ~~~~~~~~~~~~
          |                                tnInclusive
  • include/datastructure/Train.hpp:131:35: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'max_speed'

      131 |   void set_max_speed(double const max_speed) {
          |                                   ^~~~~~~~~
          |                                   maxSpeed
      132 |     cda_rail::exceptions::throw_if_less_than(max_speed, MIN_NON_ZERO,
          |                                              ~~~~~~~~~
          |                                              maxSpeed
      133 |                                              "Train max speed");
      134 |     m_max_speed = max_speed;
          |                   ~~~~~~~~~
          |                   maxSpeed
  • include/datastructure/Train.hpp:196:28: warning: [readability-redundant-member-init]

    initializer for member 'trains' is redundant

      196 |   std::vector<Train> trains{}; // list of trains
          |                            ^~
  • include/datastructure/Train.hpp:198:26: warning: [readability-redundant-member-init]

    initializer for member 'train_name_to_index' is redundant

      198 |       train_name_to_index{}; // helper struct: for any train name store its
          |                          ^~
  • include/datastructure/Train.hpp:394:33: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'max_speed'

      394 |                    double const max_speed, double const acceleration,
          |                                 ^~~~~~~~~
          |                                 maxSpeed
      395 |                    double const deceleration, bool const tim = true) {
      396 |     return add_train(
      397 |         {name, length, max_speed, acceleration, deceleration, tim});
          |                        ~~~~~~~~~
          |                        maxSpeed
  • src/GeneralHelper.cpp:21:37: warning: [misc-include-cleaner]

    no header providing "size_t" is directly included

        5 | cda_rail::subsets_of_size_k_indices(size_t const n, size_t const k) {
          |                                     ^
  • src/GeneralHelper.cpp:44:26: warning: [misc-include-cleaner]

    no header providing "ptrdiff_t" is directly included

       44 |     auto i = static_cast<ptrdiff_t>(k) - 1;
          |                          ^
  • src/datastructure/RailwayNetwork.cpp:7:1: warning: [misc-include-cleaner]

    included header json.hpp is not used directly

        7 | #include "nlohmann/json.hpp"
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        8 | #include "nlohmann/json_fwd.hpp"
  • src/datastructure/RailwayNetwork.cpp:15:1: warning: [misc-include-cleaner]

    included header fstream is not used directly

       15 | #include <fstream>
          | ^~~~~~~~~~~~~~~~~~
       16 | #include <functional>
  • src/datastructure/RailwayNetwork.cpp:17:1: warning: [misc-include-cleaner]

    included header ios is not used directly

       17 | #include <ios>
          | ^~~~~~~~~~~~~~
       18 | #include <limits>
  • src/datastructure/RailwayNetwork.cpp:23:1: warning: [misc-include-cleaner]

    included header sstream is not used directly

       23 | #include <sstream>
          | ^~~~~~~~~~~~~~~~~~
       24 | #include <stack>
  • src/datastructure/RailwayNetwork.cpp:24:1: warning: [misc-include-cleaner]

    included header stack is not used directly

       24 | #include <stack>
          | ^~~~~~~~~~~~~~~~
       25 | #include <string>
  • src/datastructure/RailwayNetwork.cpp:26:1: warning: [misc-include-cleaner]

    included header tinyxml2.h is not used directly

       26 | #include <tinyxml2.h>
          | ^~~~~~~~~~~~~~~~~~~~~
       27 | #include <unordered_map>
  • src/datastructure/RailwayNetwork.cpp:38:33: warning: [misc-include-cleaner]

    no header providing "std::string_view" is directly included

       26 | #include <tinyxml2.h>
       27 | #include <unordered_map>
       28 | #include <unordered_set>
       29 | #include <utility>
       30 | #include <vector>
       31 | 
       32 | using json = nlohmann::json;
       33 | 
       34 | // -----------------------------
       35 | // CONSTRUCTORS
       36 | // -----------------------------
       37 | 
       38 | cda_rail::Network::Network(std::string_view const       networkName,
          |                                 ^
  • src/datastructure/RailwayNetwork.cpp:294:13: warning: [misc-include-cleaner]

    no header providing "cda_rail::concatenate_string_views" is directly included

        6 |             concatenate_string_views({"Edges", std::to_string(e_idx_1), " and ",
          |             ^
  • src/datastructure/RailwayNetwork.cpp:609:42: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'new_name'

      609 |     size_t index, std::string_view const new_name) {
          |                                          ^~~~~~~~
          |                                          newName
      610 |   if (!has_vertex(index)) {
      611 |     throw exceptions::VertexNotExistentException(index);
      612 |   }
      613 |   if (has_vertex(new_name)) {
          |                  ~~~~~~~~
          |                  newName
      614 |     throw exceptions::InvalidInputException("Vertex already exists");
      615 |   }
      616 |   m_vertex_name_to_index.erase(m_vertices.at(index).name);
      617 |   m_vertices.at(index).name = new_name;
          |                               ~~~~~~~~
          |                               newName
      618 |   m_vertex_name_to_index.emplace(new_name, index);
          |                                  ~~~~~~~~
          |                                  newName
  • src/datastructure/RailwayNetwork.cpp:825:25: warning: [performance-unnecessary-value-param]

    the parameter 'source_edge_ids' is copied for each invocation but only used as a const reference; consider making it a const reference

      825 |     cda_rail::index_set source_edge_ids, cda_rail::index_set target_ids,
          |                         ^
          |     const              &
  • src/datastructure/RailwayNetwork.cpp:825:62: warning: [performance-unnecessary-value-param]

    the parameter 'target_ids' is copied for each invocation but only used as a const reference; consider making it a const reference

      825 |     cda_rail::index_set source_edge_ids, cda_rail::index_set target_ids,
          |                                                              ^
          |                                          const              &
  • src/datastructure/RailwayNetwork.cpp:826:57: warning: [performance-unnecessary-value-param]

    the parameter 'edges_to_use' is copied for each invocation but only used as a const reference; consider making it a const reference

      826 |     bool only_use_valid_successors, cda_rail::index_set edges_to_use,
          |                                                         ^
          |                                     const              &
  • src/datastructure/RailwayNetwork_helper.cpp:13:61: warning: [misc-include-cleaner]

    no header providing "std::filesystem::path" is directly included

        5 | #include <functional>
        6 | #include <stack>
        7 | #include <variant>
        8 | 
        9 | using json = nlohmann::json;
       10 | 
       11 | // Import helper
       12 | 
       13 | void cda_rail::Network::read_graphml(const std::filesystem::path& p) {
          |                                                             ^
  • src/datastructure/RailwayNetwork_helper.cpp:14:13: warning: [misc-include-cleaner]

    no header providing "tinyxml2::XMLDocument" is directly included

        4 | 
        5 | #include <functional>
        6 | #include <stack>
        7 | #include <variant>
        8 | 
        9 | using json = nlohmann::json;
       10 | 
       11 | // Import helper
       12 | 
       13 | void cda_rail::Network::read_graphml(const std::filesystem::path& p) {
       14 |   tinyxml2::XMLDocument graph_xml;
          |             ^
  • src/datastructure/RailwayNetwork_helper.cpp:17:23: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::ImportException" is directly included

        1 |     throw exceptions::ImportException("graphml");
          |                       ^
  • src/datastructure/RailwayNetwork_helper.cpp:20:13: warning: [misc-include-cleaner]

    no header providing "tinyxml2::XMLElement" is directly included

       20 |   tinyxml2::XMLElement* graphml_body = graph_xml.FirstChildElement("graphml");
          |             ^
  • src/datastructure/RailwayNetwork_helper.cpp:22:8: warning: [misc-include-cleaner]

    no header providing "std::optional" is directly included

        6 |   std::optional<std::string> breakable;
          |        ^
  • src/datastructure/RailwayNetwork_helper.cpp:40:23: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::InvalidInputException" is directly included

       40 |     throw exceptions::InvalidInputException("Graph is not directed");
          |                       ^
  • src/datastructure/RailwayNetwork_helper.cpp:56:14: warning: [misc-include-cleaner]

    no header providing "std::unordered_map" is directly included

        7 |   const std::unordered_map<std::string, std::optional<std::string>*> key_map = {
          |              ^
  • src/datastructure/RailwayNetwork_helper.cpp:88:23: warning: [misc-include-cleaner]

    no header providing "std::stoi" is directly included

        7 |         v_type = std::stoi(text);
          |                       ^
  • src/datastructure/RailwayNetwork_helper.cpp:93:30: warning: [misc-include-cleaner]

    no header providing "std::stod" is directly included

       93 |         headway_value = std::stod(text);
          |                              ^
  • src/datastructure/RailwayNetwork_helper.cpp:97:10: warning: [readability-qualified-auto]

    'auto *data' can be declared as 'const auto *data'

       97 |     for (auto* data = node->FirstChildElement("data"); data != nullptr;
          |          ^
          |          const 
  • src/datastructure/RailwayNetwork_helper.cpp:106:52: warning: [misc-include-cleaner]

    no header providing "cda_rail::VertexType" is directly included

        1 |     add_vertex({node->Attribute("id"), static_cast<VertexType>(v_type.value()),
          |                                                    ^
  • src/datastructure/RailwayNetwork_helper.cpp:114:9: warning: [misc-include-cleaner]

    no header providing "size_t" is directly included

        5 |   const size_t q1 = key.find_first_of('\'');
          |         ^
  • src/datastructure/RailwayNetwork_helper.cpp:142:9: warning: [misc-const-correctness]

    variable 'tmp' of type 'std::string' (aka 'basic_string') can be declared 'const'

      142 |         std::string tmp = text;
          |         ^
          |                     const 
  • src/datastructure/RailwayNetwork_helper.cpp:143:9: warning: [misc-include-cleaner]

    no header providing "cda_rail::to_bool_optional_inplace" is directly included

        1 |         to_bool_optional_inplace(tmp, e_breakable);
          |         ^
  • src/datastructure/RailwayNetwork_helper.cpp:169:10: warning: [readability-qualified-auto]

    'auto *data' can be declared as 'const auto *data'

      169 |     for (auto* data = cur->FirstChildElement("data"); data != nullptr;
          |          ^
          |          const 
  • src/datastructure/RailwayNetwork_helper.cpp:185:8: warning: [misc-include-cleaner]

    no header providing "std::ifstream" is directly included

        5 |   std::ifstream f(p / "successors_cpp.json");
          |        ^
  • src/datastructure/RailwayNetwork_helper.cpp:203:8: warning: [misc-include-cleaner]

    no header providing "std::ofstream" is directly included

      203 |   std::ofstream file(p / "tracks.graphml");
          |        ^
  • src/datastructure/RailwayNetwork_helper.cpp:248:62: warning: [misc-include-cleaner]

    no header providing "std::boolalpha" is directly included

        6 |          << "<data key=\"" << breakable_key << "\">" << std::boolalpha
          |                                                              ^
  • src/datastructure/RailwayNetwork_helper.cpp:286:10: warning: [misc-include-cleaner]

    no header providing "std::vector" is directly included

        8 |     std::vector<std::pair<std::string, std::string>> succ_list;
          |          ^
  • src/datastructure/RailwayNetwork_helper.cpp:286:22: warning: [misc-include-cleaner]

    no header providing "std::pair" is directly included

        7 |     std::vector<std::pair<std::string, std::string>> succ_list;
          |                      ^
  • src/datastructure/RailwayNetwork_helper.cpp:322:21: warning: [misc-include-cleaner]

    no header providing "cda_rail::index_vector" is directly included

      322 | std::pair<cda_rail::index_vector, cda_rail::index_vector>
          |                     ^
  • src/datastructure/RailwayNetwork_helper.cpp:325:16: warning: [misc-include-cleaner]

    no header providing "cda_rail::vss::SeparationFunction" is directly included

        1 |     const vss::SeparationFunction& sep_func, bool new_edge_breakable) {
          |                ^
  • src/datastructure/RailwayNetwork_helper.cpp:327:23: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::ConsistencyException" is directly included

      327 |     throw exceptions::ConsistencyException("Edge is not breakable");
          |                       ^
  • src/datastructure/RailwayNetwork_helper.cpp:332:23: warning: [misc-include-cleaner]

    no header providing "cda_rail::vss::functions::max_n_blocks" is directly included

      332 |       vss::functions::max_n_blocks(sep_func, min_length / edge.length);
          |                       ^
  • src/datastructure/RailwayNetwork_helper.cpp:348:23: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::EdgeNotExistentException" is directly included

      348 |     throw exceptions::EdgeNotExistentException(edge_index);
          |                       ^
  • src/datastructure/RailwayNetwork_helper.cpp:353:21: warning: [misc-include-cleaner]

    no header providing "std::ranges::is_sorted" is directly included

        5 |   if (!std::ranges::is_sorted(distances_from_source)) {
          |                     ^
  • src/datastructure/RailwayNetwork_helper.cpp:371:21: warning: [misc-include-cleaner]

    no header providing "cda_rail::concatenate_string_views" is directly included

      371 |         add_vertex({concatenate_string_views({get_vertex(edge.source).name, "-",
          |                     ^
  • src/datastructure/RailwayNetwork_helper.cpp:373:52: warning: [misc-include-cleaner]

    no header providing "std::to_string" is directly included

      373 |                                               std::to_string(i)}),
          |                                                    ^
  • src/datastructure/RailwayNetwork_helper.cpp:489:21: warning: [misc-include-cleaner]

    no header providing "std::ranges::all_of" is directly included

      489 |   if (!std::ranges::all_of(edge_pairs,
          |                     ^
  • src/datastructure/RailwayNetwork_helper.cpp:506:35: warning: [misc-include-cleaner]

    no header providing "std::unordered_set" is directly included

        7 |   std::unordered_map<size_t, std::unordered_set<size_t>> vertex_neighbors;
          |                                   ^
  • src/datastructure/RailwayNetwork_helper.cpp:515:20: warning: [misc-include-cleaner]

    no header providing "std::ranges::find_if" is directly included

      515 |       std::ranges::find_if(std::views::iota(size_t{0}, number_of_vertices()),
          |                    ^
  • src/datastructure/RailwayNetwork_helper.cpp:515:40: warning: [misc-include-cleaner]

    no header providing "std::ranges::views::iota" is directly included

        6 |       std::ranges::find_if(std::views::iota(size_t{0}, number_of_vertices()),
          |                                        ^
  • src/datastructure/RailwayNetwork_helper.cpp:553:20: warning: [misc-include-cleaner]

    no header providing "std::ranges::any_of" is directly included

      553 |   if (std::ranges::any_of(std::views::iota(size_t{0}, number_of_vertices()),
          |                    ^
  • src/datastructure/RailwayNetwork_helper.cpp:572:23: warning: [misc-include-cleaner]

    no header providing "cda_rail::exceptions::VertexNotExistentException" is directly included

      572 |     throw exceptions::VertexNotExistentException(source);
          |                       ^
  • src/datastructure/RailwayNetwork_helper.cpp:589:27: warning: [misc-include-cleaner]

    no header providing "std::min" is directly included

      589 |   const double vel = std::min(max_v, edge.max_speed);
          |                           ^
  • src/datastructure/RailwayNetwork_helper.cpp:599:27: warning: [misc-include-cleaner]

    no header providing "cda_rail::index_set" is directly included

      599 |     std::vector<cda_rail::index_set>&     ret_val,
          |                           ^
  • src/datastructure/RailwayNetwork_helper.cpp:649:25: warning: [performance-unnecessary-value-param]

    the parameter 'edges_used_by_train' is copied for each invocation but only used as a const reference; consider making it a const reference

      649 |     cda_rail::index_set edges_used_by_train,
          |                         ^
          |     const              &
  • src/datastructure/RailwayNetwork_helper.cpp:681:26: warning: [readability-avoid-nested-conditional-operator]

    conditional operator is used as sub-expression of parent conditional operator, refrain from using nested conditional operators

      681 |       v_0.has_value() ? (reverse_direction ? in_edges(*v_0) : out_edges(*v_0))
          |                          ^
    /home/runner/work/mtct/mtct/src/datastructure/RailwayNetwork_helper.cpp:681:7: note: parent conditional operator here
      681 |       v_0.has_value() ? (reverse_direction ? in_edges(*v_0) : out_edges(*v_0))
          |       ^
  • src/datastructure/RailwayNetwork_helper.cpp:686:24: warning: [misc-include-cleaner]

    no header providing "std::move" is directly included

      686 |     start_edges = std::move(start_edges_raw);
          |                        ^
  • src/datastructure/RailwayNetwork_helper.cpp:717:16: warning: [misc-include-cleaner]

    no header providing "std::nullopt" is directly included

      717 |           std::nullopt, e_next, desired_length - e_len, reverse_direction,
          |                ^
  • src/datastructure/RailwayNetwork_helper.cpp:726:35: warning: [misc-include-cleaner]

    no header providing "std::ranges::contains" is directly included

      726 |               return std::ranges::contains(sub_path, e);
          |                                   ^
  • src/datastructure/RailwayNetwork_helper.cpp:799:14: warning: [misc-include-cleaner]

    no header providing "std::runtime_error" is directly included

        7 |   throw std::runtime_error("Invalid VertexInput variant");
          |              ^
  • src/datastructure/Route.cpp:20:1: warning: [misc-include-cleaner]

    included header numeric is not used directly

       20 | #include <numeric>
          | ^~~~~~~~~~~~~~~~~~
       21 | #include <optional>
  • src/datastructure/Route.cpp:42:23: warning: [misc-include-cleaner]

    no header providing "std::ranges::fold_left" is directly included

       12 |   return std::ranges::fold_left(edge_lengths, 0.0, std::plus{});
          |                       ^
  • src/datastructure/Route.cpp:252:42: warning: [misc-include-cleaner]

    no header providing "std::string" is directly included

       23 | cda_rail::RouteMap::get_route(const std::string& train_name) const {
          |                                          ^
  • src/datastructure/Route.cpp:582:32: warning: [misc-include-cleaner]

    no header providing "cda_rail::concatenate_string_views" is directly included

        6 |     auto const error_message = concatenate_string_views(
          |                                ^
  • src/datastructure/Station.cpp:27:18: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'tr_len'

       27 |     double const tr_len, cda_rail::Network const& network,
          |                  ^~~~~~
          |                  trLen
       28 |     cda_rail::index_set const& edges_to_consider) const {
       29 |   auto station_tracks_to_consider =
       30 |       edges_to_consider.empty() ? tracks : cda_rail::index_set{};
       31 |   for (auto const& tmp_e : edges_to_consider) {
       32 |     if (tracks.contains(tmp_e)) {
       33 |       station_tracks_to_consider.insert(tmp_e);
       34 |     }
       35 |   }
       36 | 
       37 |   std::vector<std::pair<size_t, std::vector<cda_rail::index_vector>>> ret_val;
       38 |   for (const auto& e : station_tracks_to_consider) {
       39 |     const auto stop_paths = network.all_paths_of_length_ending_in_edge(
       40 |         e, tr_len, {}, station_tracks_to_consider);
          |            ~~~~~~
          |            trLen
  • src/datastructure/Station.cpp:89:6: warning: [misc-include-cleaner]

    no header providing "std::shared_ptr" is directly included

       14 | std::shared_ptr<cda_rail::Station>
          |      ^
  • src/datastructure/Station.cpp:105:6: warning: [misc-include-cleaner]

    no header providing "std::unordered_set" is directly included

       16 | std::unordered_set<std::string>
          |      ^
  • src/datastructure/Station.cpp:109:50: warning: [misc-include-cleaner]

    no header providing "std::ranges::views::keys" is directly included

       14 |   for (const auto& name : stations | std::views::keys) {
          |                                                  ^
  • src/datastructure/Station.cpp:122:31: warning: [misc-include-cleaner]

    no header providing "std::make_shared" is directly included

      122 |   stations.emplace(name, std::make_shared<Station>(Station{.name = name}));
          |                               ^
  • src/datastructure/Station.cpp:145:53: warning: [misc-include-cleaner]

    no header providing "std::ranges::views::values" is directly included

      145 |   for (const auto& station : stations | std::views::values) {
          |                                                     ^
  • src/datastructure/Timetable.cpp:6:1: warning: [misc-include-cleaner]

    included header json_fwd.hpp is not used directly

        6 | #include "nlohmann/json_fwd.hpp"
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        7 | 
  • src/datastructure/Timetable.cpp:19:43: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'entry_time'

       19 | cda_rail::Schedule::Schedule(double const entry_time,
          |                                           ^~~~~~~~~~
          |                                           entryTime
       20 |                              double const initial_velocity,
       21 |                              size_t const entry_vertex, double const exit_time,
       22 |                              double const               exit_velocity,
       23 |                              size_t const               exit_vertex,
       24 |                              std::vector<ScheduledStop> stops)
       25 |     : m_entry_time(entry_time), m_exit_time(exit_time),
          |                    ~~~~~~~~~~
          |                    entryTime
  • src/datastructure/Timetable.cpp:20:43: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'initial_velocity'

       20 |                              double const initial_velocity,
          |                                           ^~~~~~~~~~~~~~~~
          |                                           initialVelocity
       21 |                              size_t const entry_vertex, double const exit_time,
       22 |                              double const               exit_velocity,
       23 |                              size_t const               exit_vertex,
       24 |                              std::vector<ScheduledStop> stops)
       25 |     : m_entry_time(entry_time), m_exit_time(exit_time),
       26 |       m_initial_velocity(initial_velocity), m_exit_velocity(exit_velocity),
          |                          ~~~~~~~~~~~~~~~~
          |                          initialVelocity
  • src/datastructure/Timetable.cpp:21:43: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'entry_vertex'

       21 |                              size_t const entry_vertex, double const exit_time,
          |                                           ^~~~~~~~~~~~
          |                                           entryVertex
       22 |                              double const               exit_velocity,
       23 |                              size_t const               exit_vertex,
       24 |                              std::vector<ScheduledStop> stops)
       25 |     : m_entry_time(entry_time), m_exit_time(exit_time),
       26 |       m_initial_velocity(initial_velocity), m_exit_velocity(exit_velocity),
       27 |       m_entry_vertex(entry_vertex), m_exit_vertex(exit_vertex),
          |                      ~~~~~~~~~~~~
          |                      entryVertex
  • src/datastructure/Timetable.cpp:21:70: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'exit_time'

       21 |                              size_t const entry_vertex, double const exit_time,
          |                                                                      ^~~~~~~~~
          |                                                                      exitTime
       22 |                              double const               exit_velocity,
       23 |                              size_t const               exit_vertex,
       24 |                              std::vector<ScheduledStop> stops)
       25 |     : m_entry_time(entry_time), m_exit_time(exit_time),
          |                                             ~~~~~~~~~
          |                                             exitTime
  • src/datastructure/Timetable.cpp:22:57: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'exit_velocity'

       22 |                              double const               exit_velocity,
          |                                                         ^~~~~~~~~~~~~
          |                                                         exitVelocity
       23 |                              size_t const               exit_vertex,
       24 |                              std::vector<ScheduledStop> stops)
       25 |     : m_entry_time(entry_time), m_exit_time(exit_time),
       26 |       m_initial_velocity(initial_velocity), m_exit_velocity(exit_velocity),
          |                                                             ~~~~~~~~~~~~~
          |                                                             exitVelocity
  • src/datastructure/Timetable.cpp:23:57: warning: [readability-identifier-naming]

    invalid case style for constant parameter 'exit_vertex'

       23 |                              size_t const               exit_vertex,
          |                                                         ^~~~~~~~~~~
          |                                                         exitVertex
       24 |                              std::vector<ScheduledStop> stops)
       25 |     : m_entry_time(entry_time), m_exit_time(exit_time),
       26 |       m_initial_velocity(initial_velocity), m_exit_velocity(exit_velocity),
       27 |       m_entry_vertex(entry_vertex), m_exit_vertex(exit_vertex),
          |                                                   ~~~~~~~~~~~
          |                                                   exitVertex
  • src/datastructure/Timetable.cpp:24:35: warning: [misc-include-cleaner]

    no header providing "std::vector" is directly included

       12 | 
       13 | // using directives from header
       14 | 
       15 | /*
       16 |  * SCHEDULE
       17 |  */
       18 | 
       19 | cda_rail::Schedule::Schedule(double const entry_time,
       20 |                              double const initial_velocity,
       21 |                              size_t const entry_vertex, double const exit_time,
       22 |                              double const               exit_velocity,
       23 |                              size_t const               exit_vertex,
       24 |                              std::vector<ScheduledStop> stops)
          |                                   ^

Have any feedback or feature suggestions? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants