The methods MTPTracker::write_trajectories now writes first the number of trajectories.
[mtp.git] / mtp_tracker.cc
index af97ca5..825b4d1 100644 (file)
@@ -132,6 +132,7 @@ void MTPTracker::read(istream *is) {
 }
 
 void MTPTracker::write_trajectories(ostream *os) {
+  (*os) << nb_trajectories() << endl;
   for(int t = 0; t < nb_trajectories(); t++) {
     (*os) << t
          << " " << trajectory_entrance_time(t)
@@ -168,11 +169,11 @@ MTPTracker::~MTPTracker() {
 }
 
 int MTPTracker::early_pair_node(int t, int l) {
-  return 1 + (2 * (t + 0) + 0) * _nb_locations + l;
+  return 1 + (2 * t + 0) * _nb_locations + l;
 }
 
 int MTPTracker::late_pair_node(int t, int l) {
-  return 1 + (2 * (t + 0) + 1) * _nb_locations + l;
+  return 1 + (2 * t + 1) * _nb_locations + l;
 }
 
 void MTPTracker::build_graph() {