From 2cb38585fe7b08e1a13dd5418d89b152a4c6037b Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 7 Sep 2012 11:44:33 +0200 Subject: [PATCH] Initial commit. --- mtp_stress_test.cc | 86 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 mtp_stress_test.cc diff --git a/mtp_stress_test.cc b/mtp_stress_test.cc new file mode 100644 index 0000000..7fa7a64 --- /dev/null +++ b/mtp_stress_test.cc @@ -0,0 +1,86 @@ + +/* + * mtp is the ``Multi Tracked Paths'', an implementation of the + * k-shortest paths algorithm for multi-target tracking. + * + * Copyright (c) 2012 Idiap Research Institute, http://www.idiap.ch/ + * Written by Francois Fleuret + * + * This file is part of mtp. + * + * mtp is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * mtp 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 selector. If not, see . + * + */ + +#include +#include +#include + +using namespace std; + +#include "mtp_tracker.h" + +////////////////////////////////////////////////////////////////////// + +int main(int argc, char **argv) { + int nb_locations = 100; + int nb_time_steps = 1000; + + MTPTracker *tracker = new MTPTracker(); + + tracker->allocate(nb_time_steps, nb_locations); + + for(int l = 0; l < nb_locations; l++) { + for(int m = 0; m < nb_locations; m++) { + tracker->allowed_motions[l][m] = (drand48() < 0.1); + } + } + + for(int t = 0; t < nb_time_steps; t++) { + for(int l = 0; l < nb_locations; l++) { + tracker->entrances[t][l] = drand48() < 0.01; + tracker->exits[t][l] = drand48() < 0.01; + } + } + + tracker->build_graph(); + + for(int t = 0; t < nb_time_steps; t++) { + for(int l = 0; l < nb_locations; l++) { + tracker->detection_scores[t][l] = drand48() - 0.95; + } + } + + // Performs the tracking per se + + tracker->track(); + + // Prints the detected trajectories + + for(int t = 0; t < tracker->nb_trajectories(); t++) { + cout << "Trajectory " + << t + << " starting at " << tracker->trajectory_entrance_time(t) + << ", duration " << tracker->trajectory_duration(t) + << ", score " << tracker->trajectory_score(t) + << ", through nodes "; + for(int u = 0; u < tracker->trajectory_duration(t); u++) { + cout << " " << tracker->trajectory_location(t, u); + } + cout << endl; + } + + delete tracker; + + exit(EXIT_SUCCESS); +} -- 2.20.1