added introduction to tex

This commit is contained in:
toni
2016-04-14 13:03:16 +02:00
parent de8783b9ca
commit 00fca03a73
14 changed files with 1913 additions and 38 deletions

View File

@@ -64,7 +64,7 @@ ADD_DEFINITIONS(
-fstack-protector-all
-g
-O0
-O2
-DWITH_TESTS
-DWITH_ASSERTIONS

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.6.0, 2016-04-11T10:29:08. -->
<!-- Written by QtCreator 3.6.0, 2016-04-14T12:59:26. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@@ -28,7 +28,9 @@ public:
const std::vector<MyGridNode>& getAllNodes() const {return grid.getNodes();}
decltype(grid.neighbors(MyGridNode())) getNeighbors(const MyGridNode& node) const {return grid.neighbors(node);}
float getHeuristic(const MyGridNode& n1, const MyGridNode& n2) const {return std::abs(n1.x_cm - n2.x_cm) + std::abs(n1.y_cm - n2.y_cm);}
float getHeuristic(const MyGridNode& n1, const MyGridNode& n2) const {return ((Point3)n1 - (Point3)n2).length(2) ;}
//std::abs(n1.x_cm - n2.x_cm) + std::abs(n1.y_cm - n2.y_cm)
};
/**

View File

@@ -111,7 +111,7 @@ public:
bf->setEstimation(std::unique_ptr<K::ParticleFilterEstimationWeightedAverageWithAngle<MyState>>(new K::ParticleFilterEstimationWeightedAverageWithAngle<MyState>()));
if(smoothing_resample)
bf->setResampling( std::unique_ptr<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental) );
}
// ============================================================ Dijkstra ============================================== //
@@ -174,7 +174,7 @@ public:
bf->setEstimation(std::unique_ptr<K::ParticleFilterEstimationWeightedAverage<MyState>>(new K::ParticleFilterEstimationWeightedAverage<MyState>()));
if(smoothing_resample)
bf->setResampling( std::unique_ptr<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental()) );
bf->setTransition(std::unique_ptr<MySmoothingTransition>( new MySmoothingTransition(&grid)) );
}
void bergwerk_path1_nexus_simple() {
@@ -242,7 +242,7 @@ public:
bf->setEstimation(std::unique_ptr<K::ParticleFilterEstimationWeightedAverage<MyState>>(new K::ParticleFilterEstimationWeightedAverage<MyState>()));
if(smoothing_resample)
bf->setResampling( std::unique_ptr<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental()) );
bf->setTransition(std::unique_ptr<MySmoothingTransition>( new MySmoothingTransition(&grid)) );
}
void bergwerk_path2_nexus_simple() {
@@ -311,7 +311,7 @@ public:
bf->setEstimation(std::unique_ptr<K::ParticleFilterEstimationWeightedAverage<MyState>>(new K::ParticleFilterEstimationWeightedAverage<MyState>()));
if(smoothing_resample)
bf->setResampling( std::unique_ptr<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental()) );
bf->setTransition(std::unique_ptr<MySmoothingTransition>( new MySmoothingTransition(&grid)) );
}
void bergwerk_path3_nexus_simple() {
@@ -379,7 +379,7 @@ public:
bf->setEstimation(std::unique_ptr<K::ParticleFilterEstimationWeightedAverage<MyState>>(new K::ParticleFilterEstimationWeightedAverage<MyState>()));
if(smoothing_resample)
bf->setResampling( std::unique_ptr<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental()) );
bf->setTransition(std::unique_ptr<MySmoothingTransition>( new MySmoothingTransition(&grid)) );
}
void bergwerk_path4_nexus_simple() {
@@ -448,7 +448,7 @@ public:
bf->setEstimation(std::unique_ptr<K::ParticleFilterEstimationWeightedAverage<MyState>>(new K::ParticleFilterEstimationWeightedAverage<MyState>()));
if(smoothing_resample)
bf->setResampling( std::unique_ptr<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental()) );
bf->setTransition(std::unique_ptr<MySmoothingTransition>( new MySmoothingTransition(&grid)) );
}
void bergwerk_path1_galaxy_simple() {
@@ -499,7 +499,7 @@ public:
bf->setEstimation(std::unique_ptr<K::ParticleFilterEstimationWeightedAverage<MyState>>(new K::ParticleFilterEstimationWeightedAverage<MyState>()));
if(smoothing_resample)
bf->setResampling( std::unique_ptr<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental()) );
bf->setTransition(std::unique_ptr<MySmoothingTransition>( new MySmoothingTransition(&grid)) );
}
void bergwerk_path2_galaxy_simple() {
@@ -550,7 +550,7 @@ public:
bf->setEstimation(std::unique_ptr<K::ParticleFilterEstimationWeightedAverage<MyState>>(new K::ParticleFilterEstimationWeightedAverage<MyState>()));
if(smoothing_resample)
bf->setResampling( std::unique_ptr<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental()) );
bf->setTransition(std::unique_ptr<MySmoothingTransition>( new MySmoothingTransition(&grid)) );
}
void bergwerk_path3_galaxy_simple() {
@@ -603,7 +603,7 @@ public:
bf->setEstimation(std::unique_ptr<K::ParticleFilterEstimationWeightedAverage<MyState>>(new K::ParticleFilterEstimationWeightedAverage<MyState>()));
if(smoothing_resample)
bf->setResampling( std::unique_ptr<K::ParticleFilterResamplingSimple<MyState>>(new K::ParticleFilterResamplingSimple<MyState>()) );
bf->setTransition(std::unique_ptr<MySmoothingTransitionExperimental>( new MySmoothingTransitionExperimental()) );
bf->setTransition(std::unique_ptr<MySmoothingTransition>( new MySmoothingTransition(&grid)) );
}
void bergwerk_path4_galaxy_simple() {

View File

@@ -1,5 +1,5 @@
#!/bin/bash
FILES=$(find ../../measurements/bergwerk/path*/{galaxy,nexus}/ -name "*.csv")
FILES=$(find ../../measurements/bergwerk/ -name "*.csv")
for f in $FILES
do

View File

@@ -89,7 +89,7 @@ int main(void) {
// testModelWalk();
SmoothingEval1 eval;
eval.fixedIntervallDijkstraTransPath4();
eval.fixedIntervallSimpleTransPath4();
eval.run();
//Eval1 eval;

View File

@@ -17,6 +17,7 @@
#include "../../toni/barometric.h"
#include <map>
#include <omp.h>
static double smoothing_walk_mu = 0.7;
static double smoothing_walk_sigma = 0.5;
@@ -79,14 +80,21 @@ public:
// p(q_490(1)|q_489(1)); p(q_490(2)|q_489(1)) ... p(q_490(M)|q_489(1))
std::vector<std::vector<double>> predictionProbabilities;
std::map<my_key_type, double> shortestPathMap;
AStar<MyGridNode> aStar;
DijkstraMapper dm(*grid);
auto p1 = particles_old.begin();
auto p2 = particles_new.begin();
omp_set_dynamic(0); // Explicitly disable dynamic teams
omp_set_num_threads(7);
#pragma omp parallel for shared(predictionProbabilities)
for (int i = 0; i < particles_old.size(); ++i) {
#pragma omp parallel for private(p2) shared(predictionProbabilities)
for (p1 = particles_old.begin(); p1 < particles_old.end(); ++p1) {
std::vector<double> innerVector;
for(p2 = particles_new.begin(); p2 < particles_new.end(); ++p2){
auto p1 = &particles_old[i];
const MyGridNode* dst = grid->getNodePtrFor(GridPoint(p1->state.pCur.x, p1->state.pCur.y, p1->state.pCur.z));
for(int j = 0; j < particles_new.size(); ++j){
auto p2 = &particles_new[j];
// find the node (square) the particle is within
// just to be safe, we round z to the nearest floor
@@ -95,7 +103,6 @@ public:
//const Node3* dst = graph->getNearestNode(p1->state.x_cm, p1->state.y_cm, std::round(p1->state.z_nr));
//const Node3* src = graph->getNearestNode(p2->state.x_cm, p2->state.y_cm, std::round(p2->state.z_nr));
const MyGridNode* dst = grid->getNodePtrFor(GridPoint(p1->state.pCur.x, p1->state.pCur.y, p1->state.pCur.z));
const MyGridNode* src = grid->getNodePtrFor(GridPoint(p2->state.pCur.x, p2->state.pCur.y, p2->state.pCur.z));
// Dijkstra<MyGridNode> dijkstra;
@@ -103,10 +110,8 @@ public:
// double distDijkstra_m = dijkstra.getNode(*src)->cumWeight;
AStar<MyGridNode> aStar;
DijkstraMapper dm(*grid);
double distDijkstra_m = 0;
std::vector<const MyGridNode*> shortestPath;
//std::vector<const MyGridNode*> shortestPath;
// check if this shortestPath was already calculated
std::map<my_key_type, double>::iterator it;
@@ -117,12 +122,14 @@ public:
else{
//Dijkstra/A* for shortest path
shortestPath = aStar.get(src, dst, dm);
//shortestPath = aStar.get(src, dst, dm);
distDijkstra_m = aStar.get(src, dst, dm);
//get distance walked and getProb using the walking model
for(int i = 0; i < shortestPath.size() - 1; ++i){
distDijkstra_m += dm.getWeightBetween(*shortestPath[i], *shortestPath[i+1]);
}
// for(int i = 0; i < shortestPath.size() - 1; ++i){
// distDijkstra_m += dm.getWeightBetween(*shortestPath[i], *shortestPath[i+1]);
// }
if(distDijkstra_m != distDijkstra_m) {throw "detected NaN";}

View File

@@ -65,19 +65,21 @@ public:
// p(q_490(1)|q_489(1)); p(q_490(2)|q_489(1)) ... p(q_490(M)|q_489(1))
std::vector<std::vector<double>> predictionProbabilities;
auto p1 = particles_old.begin(); //smoothed / backward filter p_t+1
auto p2 = particles_new.begin(); //forward filter p_t
#pragma omp parallel for private(p2) shared(predictionProbabilities)
for (p1 = particles_old.begin(); p1 < particles_old.end(); ++p1) {
omp_set_dynamic(0); // Explicitly disable dynamic teams
omp_set_num_threads(4);
#pragma omp parallel for shared(predictionProbabilities)
for (int i = 0; i < particles_old.size(); ++i) {
std::vector<double> innerVector;
for(p2 = particles_new.begin(); p2 < particles_new.end(); ++p2){
auto p1 = &particles_old[i];
for(int j = 0; j < particles_new.size(); ++j){
auto p2 = &particles_new[j];
//!!!distance kann hier zu groß werden!!!
const double distance_m = p2->state.pCur.getDistance(p1->state.pCur) / 100.0;
//get distance walked and getProb using the walking model
//double distDijkstra_m = ((GRID_DISTANCE_CM / 100.0) * (8 - 1));
const double distProb = distWalk.getProbability(distance_m);