From c8a37f33eb29f651fed648a48918390f0da1eefb Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Thu, 23 Aug 2012 17:18:46 -0700 Subject: [PATCH] Cosmetics. --- Makefile | 2 +- misc.h | 24 ++++++++++++++++-------- mtp_graph.cc | 11 ----------- mtp_graph.h | 10 ++-------- path.cc | 30 ++++++++++++++++++++++++++++++ path.h | 30 ++++++++++++++++++++++++++++++ tracker.h | 10 ++++++++++ 7 files changed, 89 insertions(+), 28 deletions(-) create mode 100644 path.cc create mode 100644 path.h diff --git a/Makefile b/Makefile index adcff72..2264c56 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ random-graph: \ $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) mtp: \ - mtp_graph.o \ + path.o mtp_graph.o \ tracker.o \ mtp.o $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) diff --git a/misc.h b/misc.h index f9458da..51ad326 100644 --- a/misc.h +++ b/misc.h @@ -1,12 +1,20 @@ -//////////////////////////////////////////////////////////////////// -// START_IP_HEADER // -// // -// Written by Francois Fleuret // -// Contact for comments & bug reports // -// // -// END_IP_HEADER // -//////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////// +// This program is free software: you can redistribute it and/or modify // +// it under the terms of the version 3 of the GNU General Public License // +// as published by the Free Software Foundation. // +// // +// This program is distributed in the hope that it will be useful, but // +// WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // +// General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +// // +// Written by and Copyright (C) Francois Fleuret // +// Contact for comments & bug reports // +/////////////////////////////////////////////////////////////////////////// #ifndef MISC_H #define MISC_H diff --git a/mtp_graph.cc b/mtp_graph.cc index a208403..8160211 100644 --- a/mtp_graph.cc +++ b/mtp_graph.cc @@ -83,17 +83,6 @@ void Vertex::del_edge(Edge *e) { ////////////////////////////////////////////////////////////////////// -Path::Path(int l) { - length = l; - nodes = new int[length]; -} - -Path::~Path() { - delete[] nodes; -} - -////////////////////////////////////////////////////////////////////// - MTPGraph::MTPGraph(int nb_vertices, int nb_edges, int *from, int *to, int source, int sink) { diff --git a/mtp_graph.h b/mtp_graph.h index 0fad09d..7ccbfe3 100644 --- a/mtp_graph.h +++ b/mtp_graph.h @@ -25,18 +25,11 @@ using namespace std; #include "misc.h" +#include "path.h" class Vertex; class Edge; -class Path { -public: - Path(int l); - ~Path(); - int length; - int *nodes; -}; - class MTPGraph { void initialize_positivized_lengths_with_min(); void update_positivized_lengths(); @@ -54,6 +47,7 @@ class MTPGraph { public: + // These variables are filled when retrieve_disjoint_paths is called int nb_paths; Path **paths; diff --git a/path.cc b/path.cc new file mode 100644 index 0000000..d38b88b --- /dev/null +++ b/path.cc @@ -0,0 +1,30 @@ + +/////////////////////////////////////////////////////////////////////////// +// This program is free software: you can redistribute it and/or modify // +// it under the terms of the version 3 of the GNU General Public License // +// as published by the Free Software Foundation. // +// // +// This program is distributed in the hope that it will be useful, but // +// WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // +// General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +// // +// Written by and Copyright (C) Francois Fleuret // +// Contact for comments & bug reports // +/////////////////////////////////////////////////////////////////////////// + +#include "path.h" + +////////////////////////////////////////////////////////////////////// + +Path::Path(int l) { + length = l; + nodes = new int[length]; +} + +Path::~Path() { + delete[] nodes; +} diff --git a/path.h b/path.h new file mode 100644 index 0000000..11711a3 --- /dev/null +++ b/path.h @@ -0,0 +1,30 @@ + +/////////////////////////////////////////////////////////////////////////// +// This program is free software: you can redistribute it and/or modify // +// it under the terms of the version 3 of the GNU General Public License // +// as published by the Free Software Foundation. // +// // +// This program is distributed in the hope that it will be useful, but // +// WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // +// General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +// // +// Written by and Copyright (C) Francois Fleuret // +// Contact for comments & bug reports // +/////////////////////////////////////////////////////////////////////////// + +#ifndef PATH_H +#define PATH_H + +class Path { +public: + Path(int l); + ~Path(); + int length; + int *nodes; +}; + +#endif diff --git a/tracker.h b/tracker.h index f17c7a0..9d3e018 100644 --- a/tracker.h +++ b/tracker.h @@ -39,17 +39,27 @@ public: Tracker(int nb_time_steps, int nb_locations); ~Tracker(); + // Define the spatial topology + void set_allowed_motion(int from_location, int to_location, int v); void set_as_entrance(int location, int v); void set_as_exit(int location, int v); + // Build or print the graph needed for the tracking per se + void build_graph(); void print_graph_dot(ostream *os); + // Define the detection scores + void set_detection_score(int time, int location, scalar_t score); + // Compute the optimal set of trajectories + void track(); + // Read-out of the optimal trajectories + int nb_trajectories(); int trajectory_entrance_time(int k); int trajectory_duration(int k); -- 2.39.5