From e1c5fbab31023766d121f1c4296bc18b42a9d5a9 Mon Sep 17 00:00:00 2001
From: Romain BERNARD <romain.bernard@uca.fr>
Date: Tue, 12 Mar 2024 17:21:00 +0100
Subject: [PATCH] remove useless debug code

---
 .../Transit/TransitAlgorithmState.h           | 21 +++++++------------
 .../Transit/TransitShortestPathPrecompute.cpp |  3 +--
 src/instance/graph/Line.h                     | 12 +----------
 3 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/src/ShortestPath/Transit/TransitAlgorithmState.h b/src/ShortestPath/Transit/TransitAlgorithmState.h
index adbc5a3..29ad87a 100644
--- a/src/ShortestPath/Transit/TransitAlgorithmState.h
+++ b/src/ShortestPath/Transit/TransitAlgorithmState.h
@@ -16,6 +16,7 @@ private:
     int _instant;
     int _passageIndex;
     std::vector<LineStop> _connections;
+    int _precedingNodeIndex;
 
 public:
     TransitAlgorithmState(int currentNode, int currentInstant, int currentPassageIndex) {
@@ -29,9 +30,11 @@ public:
         _nodeIndex = baseState.getNodeIndex();
         _instant = baseState.getInstant();
         _passageIndex = baseState.getPassageIndex();
-        _connections.reserve(2);
+        _precedingNodeIndex = baseState.getPrecedingNodeIndex();
 
         //Copy old connections
+        _connections.clear();
+        _connections.reserve(2);
         for(auto& lineStop : baseState.getConnections()) {
             _connections.emplace_back(lineStop);
         }
@@ -43,9 +46,11 @@ public:
         _nodeIndex = baseState.getNodeIndex();
         _instant = baseState.getInstant();
         _passageIndex = baseState.getPassageIndex();
-        _connections.reserve(2);
+        _precedingNodeIndex = baseState.getPrecedingNodeIndex();
 
         //Copy old connections
+        _connections.clear();
+        _connections.reserve(2);
         for(auto& lineStop : baseState.getConnections()) {
             _connections.emplace_back(lineStop);
         }
@@ -182,18 +187,6 @@ public:
     }
 
     TransitAlgorithmState& operator=(const TransitAlgorithmState& baseState) = default;
-//    TransitAlgorithmState& operator=(const TransitAlgorithmState& baseState) {
-//        _nodeIndex = baseState.getNodeIndex();
-//        _instant = baseState.getInstant();
-//        _passageIndex = baseState.getPassageIndex();
-//        //Copy old connections
-//        _connections.clear();
-//        for(auto& lineStop : baseState.getConnections()) {
-//            _connections.emplace_back(lineStop);
-//        }
-//
-//        return *this;
-//    }
 
     [[nodiscard]] std::string toString() const {
         std::string res = "Node: " + std::to_string(_nodeIndex) + ", Instant: " + std::to_string(_instant);
diff --git a/src/ShortestPath/Transit/TransitShortestPathPrecompute.cpp b/src/ShortestPath/Transit/TransitShortestPathPrecompute.cpp
index 27db781..9759db5 100644
--- a/src/ShortestPath/Transit/TransitShortestPathPrecompute.cpp
+++ b/src/ShortestPath/Transit/TransitShortestPathPrecompute.cpp
@@ -30,8 +30,7 @@ TransitStateContainer TransitShortestPathPrecompute::executeAlgorithm(const Grap
         currentState = statePriorityQueue.top();
         statePriorityQueue.pop();
         if(!solutionsContainer.strictlyDominates(currentState)) {
-            DEBUG_MSG("\n\nComparing state " + currentState.toString() + " and \n" + solutionsContainer.getBestSolution(currentState.getNodeIndex(), currentState.getNbConnections()).toString());
-            DEBUG_MSG("State isn't dominated, trying to extend it");
+            DEBUG_MSG("\n\nComparing state " + currentState.toString() + " and " + solutionsContainer.getBestSolution(currentState.getNodeIndex(), currentState.getNbConnections()).toString());
             for (auto& lineStop : graph.getPTLinesSet(currentState.getNodeIndex()))
             {
                 int nextNode = lineStop.getNextNodeIndex();
diff --git a/src/instance/graph/Line.h b/src/instance/graph/Line.h
index 05dd657..c9bc6f7 100644
--- a/src/instance/graph/Line.h
+++ b/src/instance/graph/Line.h
@@ -17,9 +17,7 @@ private:
     std::vector<int> _nodes; //index according to Graph::_nodes, sorted according to line order (start -> terminus)
     std::vector<std::vector<int>> _timetables; //list of list of timestamps for each node start order (size of _timetables must remain constant throughout the whole vector
 public:
-    Line(){
-        _lineID = "";
-    }
+    Line() = default;
 
     [[nodiscard]] const std::string &getLineId() const;
     void setLineId(const std::string &lineId);
@@ -63,14 +61,6 @@ public:
     bool operator!=(const Line &rhs) const {
         return _lineID != rhs.getLineId();
     }
-
-//    Line& operator=(const Line &rhs) {
-//        _lineID = rhs.getLineId();
-//        _nodes = rhs.getNodes();
-//        _timetables = rhs.getTimetables();
-//        return *this;
-//    }
-
 };
 
 #include "Node.h"
-- 
GitLab