
#include <Indoor/grid/walk/GridWalkLightAtTheEndOfTheTunnel.h>
#include <Indoor/grid/walk/GridWalkRandomHeadingUpdate.h>
#include <Indoor/grid/walk/GridWalkRandomHeadingUpdateAdv.h>
#include <Indoor/grid/walk/GridWalkPushForward.h>

#include "Vis.h"
#include "Helper.h"
#include "MyGridNode.h"
#include "Helper.h"
#include "DijkstraMapper.h"

#include "eval/Eval.h"
#include "eval/Eval1.h"
#include "eval/EvalBase.h"
#include "eval/SmoothingEvalBase.h"
#include "eval/SmoothingEval1.h"

#include "eval/PaperVisImportance.h"
#include "eval/PaperVisDijkstra.h"
#include "eval/PaperVisGrid.h"


float BarometerEvaluation::barometerSigma = NAN;

Settings settings;

void testModelWalk() {

	Grid<MyGridNode> grid(MiscSettings::gridSize_cm);

	Helper::FHWSFloors floors = Helper::getFloors(grid);
	Helper::buildTheGrid(grid, floors);

	MyGridNode& start = (MyGridNode&)grid.getNodeFor(GridPoint(500,300,floors.h0.cm()));
	//MyGridNode& end = (MyGridNode&)grid.getNodeFor(GridPoint(7000,5000,floors.h3.cm()));

	Vis vis;
	vis.addFloor(floors.f0, floors.h0);
	vis.addFloor(floors.f1, floors.h1);
	vis.addFloor(floors.f2, floors.h2);
	vis.addFloor(floors.f3, floors.h3);


	vis.gp << "set xrange [1100:1800]\n";
	vis.gp << "set yrange [4500:5200]\n";

//	vis.gp << "set xrange [1000:4000]\n";
//	vis.gp << "set yrange [1000:4000]\n";
//	vis.gp << "set zrange [0:600]\n";

	// switch between different grid-walkers
	GridWalkRandomHeadingUpdate<MyGridNode> walk;
	//GridWalkRandomHeadingUpdateAdv<MyGridNode> walk;
	//GridWalkPushForward<MyGridNode> walk;
	//GridWalkLightAtTheEndOfTheTunnel<MyGridNode> walk(grid, DijkstraMapper(grid), end);


	std::vector<GridWalkState<MyGridNode>> states;
//	for (int i = 0; i < 1000; ++i) { states.push_back(GridWalkState<MyGridNode>(&start, Heading::rnd())); }

//	track the number-of-visits for each node to draw something like a particle-heat-map?

	// show the importance factors
	vis.addGrid(grid);
	vis.show();
	sleep(100);
	vis.removeGrid();

	Distribution::Normal<float> wDist(0.3, 0.3);
	Distribution::Normal<float> wHead(0.3, 0.3);

	while(true) {
		for (GridWalkState<MyGridNode>& state : states) {
            state = walk.getDestination(grid, state, std::abs(wDist.draw()), wHead.draw(), Activity::UNKNOWN);
		}
		usleep(1000*80);
		vis.showStates(states);
		vis.show();
	}

	sleep(1000);

}



int main(void) {

    {SmoothingEval1 eval;
    eval.fixedIntervallSimpleTransPath4();
    eval.run();}


//    for(int i = 0; i < 10; ++i){

//        //nexus
//        std::string name = "bergwerk_path1_nexus_simple_interval_" + std::to_string(i);
//        {SmoothingEval1 eval; eval.bergwerk_path1_nexus_multi(name);    eval.run();}

//        name = "bergwerk_path2_nexus_simple_interval" + std::to_string(i);
//        {SmoothingEval1 eval; eval.bergwerk_path2_nexus_multi(name);    eval.run();}

//        name = "bergwerk_path3_nexus_simple_interval" + std::to_string(i);
//        {SmoothingEval1 eval; eval.bergwerk_path3_nexus_multi(name);    eval.run();}

//        name = "bergwerk_path4_nexus_simple_interval" + std::to_string(i);
//        {SmoothingEval1 eval; eval.bergwerk_path4_nexus_multi(name);    eval.run();}


//        //galaxy
//        name = "bergwerk_path1_galaxy_simple_interval" + std::to_string(i);
//        {SmoothingEval1 eval; eval.bergwerk_path1_galaxy_multi(name);	eval.run();}

//        name = "bergwerk_path2_galaxy_simple_interval" + std::to_string(i);
//        {SmoothingEval1 eval; eval.bergwerk_path2_galaxy_multi(name);	eval.run();}

//        name = "bergwerk_path3_galaxy_simple_interval" + std::to_string(i);
//        {SmoothingEval1 eval; eval.bergwerk_path3_galaxy_multi(name);	eval.run();}

//        name = "bergwerk_path4_galaxy_simple_interval" + std::to_string(i);
//        {SmoothingEval1 eval; eval.bergwerk_path4_galaxy_multi(name);	eval.run();}

//        std::cout << "We are in loop number: " << i << "of " << 10 << std::endl;
//    }


	return 0;

}


