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

@@ -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);