Commit 2f25e584 authored by Pierre Kraemer's avatar Pierre Kraemer

update RVO + benchs

parent 85bdc106
TypeDeScene Nous
City70-12-20-20 6.85704
City70-18-25-25 17.7281
City70-24-30-30 39.2271
City70-27-38-38 69.8514
City70-30-45-45 112.899
City70-12-20-20 5.62116
City70-18-25-25 15.1036
City70-24-30-30 31.7666
City70-27-38-38 62.3791
City70-30-45-45 97.6921
TypeDeScene NousStatic
City70-12-20-20 9.59599
City70-18-25-25 25.23
City70-24-30-30 61.0198
City70-27-38-38 126.596
City70-30-45-45 193.317
City70-12-20-20 9.17749
City70-18-25-25 25.0335
City70-24-30-30 56.8318
City70-27-38-38 125.028
City70-30-45-45 190.780
TypeDeScene NousSubdivMax
City70-12-20-20 6.67086
City70-18-25-25 16.8238
City70-24-30-30 38.5743
City70-27-38-38 69.0952
City70-30-45-45 111.943
City70-12-20-20 5.54535
City70-18-25-25 14.415
City70-24-30-30 30.9002
City70-27-38-38 59.2478
City70-30-45-45 97.450
set terminal svg size 600,400 dynamic enhanced fname 'arial' fsize 11 butt
set output 'graphBenchCity.svg'
#set terminal svg size 600,400 dynamic enhanced fname 'arial' fsize 11 butt
#set output 'graphBenchCity.svg'
set auto x
set grid
set yrange [0.1:*]
......
......@@ -174,11 +174,11 @@
</g>
<g style = 'stroke:none; shape-rendering:crispEdges'>
<polygon fill = 'currentColor' points = '522.4,52.4 561.4,52.4 561.4,44.2 522.4,44.2 '/>
<polygon fill = 'currentColor' points = '131.2,367.2 144.5,367.2 144.5,363.1 131.2,363.1 '/>
<polygon fill = 'currentColor' points = '219.0,367.2 232.3,367.2 232.3,356.8 219.0,356.8 '/>
<polygon fill = 'currentColor' points = '306.8,367.2 320.1,367.2 320.1,344.2 306.8,344.2 '/>
<polygon fill = 'currentColor' points = '394.6,367.2 407.9,367.2 407.9,326.2 394.6,326.2 '/>
<polygon fill = 'currentColor' points = '482.4,367.2 495.7,367.2 495.7,301.0 482.4,301.0 '/>
<polygon fill = 'currentColor' points = '131.2,367.2 144.5,367.2 144.5,363.9 131.2,363.9 '/>
<polygon fill = 'currentColor' points = '219.0,367.2 232.3,367.2 232.3,358.3 219.0,358.3 '/>
<polygon fill = 'currentColor' points = '306.8,367.2 320.1,367.2 320.1,348.5 306.8,348.5 '/>
<polygon fill = 'currentColor' points = '394.6,367.2 407.9,367.2 407.9,330.6 394.6,330.6 '/>
<polygon fill = 'currentColor' points = '482.4,367.2 495.7,367.2 495.7,309.9 482.4,309.9 '/>
</g>
</g>
</a>
......@@ -190,11 +190,11 @@
</g>
<g style = 'stroke:none; shape-rendering:crispEdges'>
<polygon fill = 'currentColor' points = '522.4,68.8 561.4,68.8 561.4,60.6 522.4,60.6 '/>
<polygon fill = 'currentColor' points = '145.8,367.2 159.1,367.2 159.1,361.5 145.8,361.5 '/>
<polygon fill = 'currentColor' points = '233.6,367.2 246.9,367.2 246.9,352.4 233.6,352.4 '/>
<polygon fill = 'currentColor' points = '321.4,367.2 334.7,367.2 334.7,331.4 321.4,331.4 '/>
<polygon fill = 'currentColor' points = '409.2,367.2 422.5,367.2 422.5,292.9 409.2,292.9 '/>
<polygon fill = 'currentColor' points = '497.0,367.2 510.3,367.2 510.3,253.8 497.0,253.8 '/>
<polygon fill = 'currentColor' points = '145.8,367.2 159.1,367.2 159.1,361.8 145.8,361.8 '/>
<polygon fill = 'currentColor' points = '233.6,367.2 246.9,367.2 246.9,352.5 233.6,352.5 '/>
<polygon fill = 'currentColor' points = '321.4,367.2 334.7,367.2 334.7,333.8 321.4,333.8 '/>
<polygon fill = 'currentColor' points = '409.2,367.2 422.5,367.2 422.5,293.9 409.2,293.9 '/>
<polygon fill = 'currentColor' points = '497.0,367.2 510.3,367.2 510.3,255.3 497.0,255.3 '/>
</g>
</g>
</a>
......@@ -206,11 +206,11 @@
</g>
<g style = 'stroke:none; shape-rendering:crispEdges'>
<polygon fill = 'currentColor' points = '522.4,85.2 561.4,85.2 561.4,77.0 522.4,77.0 '/>
<polygon fill = 'currentColor' points = '160.5,367.2 173.8,367.2 173.8,363.2 160.5,363.2 '/>
<polygon fill = 'currentColor' points = '248.3,367.2 261.6,367.2 261.6,357.3 248.3,357.3 '/>
<polygon fill = 'currentColor' points = '336.1,367.2 349.4,367.2 349.4,344.5 336.1,344.5 '/>
<polygon fill = 'currentColor' points = '423.9,367.2 437.2,367.2 437.2,326.7 423.9,326.7 '/>
<polygon fill = 'currentColor' points = '511.7,367.2 525.0,367.2 525.0,301.5 511.7,301.5 '/>
<polygon fill = 'currentColor' points = '160.5,367.2 173.8,367.2 173.8,363.9 160.5,363.9 '/>
<polygon fill = 'currentColor' points = '248.3,367.2 261.6,367.2 261.6,358.7 248.3,358.7 '/>
<polygon fill = 'currentColor' points = '336.1,367.2 349.4,367.2 349.4,349.0 336.1,349.0 '/>
<polygon fill = 'currentColor' points = '423.9,367.2 437.2,367.2 437.2,332.4 423.9,332.4 '/>
<polygon fill = 'currentColor' points = '511.7,367.2 525.0,367.2 525.0,310.0 511.7,310.0 '/>
</g>
</g>
</a>
......
......@@ -32,34 +32,37 @@ public:
bool directionOpt, VEC3& result
);
bool linearProgram2(
const std::vector<Line>& lines, unsigned int num, float radius,
unsigned int linearProgram2(
const std::vector<Line>& lines, float radius,
const VEC3& optVelocity, bool directionOpt,
VEC3& result
);
void linearProgram3(
const std::vector<Line>& lines, unsigned int numObstLines,
float radius, VEC3& result
unsigned int beginLine, float radius,
VEC3& result
);
std::vector<std::pair<float, Agent*> > agentNeighbors_;
std::vector<std::pair<float, Dart> > obstacleNeighbors_;
std::vector<std::pair<float, Obstacle*> > obstacleNeighbors_;
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP> part_;
std::vector<VEC3> goals_;
unsigned int curGoal_;
static size_t maxNeighbors_;
static unsigned int maxNeighbors_;
static float maxSpeed_;
static float neighborDistSq_;
static float radius_;
static float timeHorizon_;
static float timeHorizonObst_;
static float rangeSq_;
static float timeStep ;
static unsigned int cptAgent;
static unsigned int cptAgent ;
unsigned int agentNo ;
VEC3 velocity_;
......
......@@ -145,8 +145,8 @@ void generateCity(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMar
typename PFP::VEC3 p = position[d];
float sideSize = 70.0f;
unsigned int nbSquares = 24;
unsigned int nbEmpty = 5;
unsigned int nbSquares = 12;
unsigned int nbEmpty = 3;
int emptySquareX = (nbSquares * sideSize / 2.0f) - (nbEmpty * sideSize) - 10;
int emptySquareY = (nbSquares * sideSize / 2.0f) - (nbEmpty * sideSize) - 10;
......
......@@ -27,6 +27,7 @@
using namespace CGoGN;
class Agent;
class Obstacle;
struct PFP: public PFP_STANDARD
{
......@@ -36,7 +37,7 @@ struct PFP: public PFP_STANDARD
// definition des listes d'agent
typedef std::vector<Agent*> AGENTS;
typedef std::vector<Dart> OBSTACLES;
typedef std::vector<Obstacle*> OBSTACLES;
typedef NoMathIONameAttribute<AGENTS> AGENTVECT;
typedef NoMathIONameAttribute<OBSTACLES> OBSTACLEVECT;
typedef AttributeHandler<AGENTVECT> TAB_AGENTVECT;
......
......@@ -5,6 +5,7 @@
#include "env_map.h"
#include "agent.h"
#include "obstacle.h"
#include "path_finder.h"
#include <iostream>
......@@ -35,8 +36,8 @@ public :
// Thread execution stuff goes here
for (unsigned int i = 0; i < ag_.size(); ++i)
{
ag_[i]->updateObstacleNeighbors();
ag_[i]->updateAgentNeighbors();
// ag_[i]->updateObstacleNeighbors();
// ag_[i]->updateAgentNeighbors();
ag_[i]->computePrefVelocity();
ag_[i]->computeNewVelocity();
}
......
......@@ -9,10 +9,10 @@
typedef CGoGN::Geom::Vec3f VEC3;
//static const float RVO_EPSILON = 0.0001f;
static const float RVO_EPSILON = 0.00001f;
struct Line {
struct Line
{
VEC3 point;
VEC3 direction;
};
......
This diff is collapsed.
#include "env_map.h"
#include "utils.h"
#include "agent.h"
#include "obstacle.h"
#include "Geometry/inclusion.h"
#include "Algo/MovingObjects/particle_cell_2D_memo.h"
......@@ -171,7 +172,7 @@ Dart EnvMap::getBelongingCell(const PFP::VEC3& pos)
void EnvMap::init()
{
float sideSize = 70.0f;
unsigned int nbSquares = 24;
unsigned int nbSquares = 12;
// CityGenerator::generateGrid<PFP>(map, position, nbSquares, nbSquares, sideSize, obstacleMark, buildingMark);
// CityGenerator::generateCorridor<PFP>(map, position, obstacleMark, buildingMark, 50, nbSquares);
......@@ -218,7 +219,13 @@ void EnvMap::registerObstaclesInFaces()
do
{
if(obstacleMark.isMarked(dd))
obstvect[d].push_back(map.phi2(dd));
{
Dart dd2 = map.phi2(dd);
Dart next = map.phi1(dd2);
Dart previous = map.phi_1(dd2);
Obstacle* o = new Obstacle(position[dd2], position[next], position[previous], position[map.phi1(next)]);
obstvect[d].push_back(o);
}
dd = map.phi1(dd);
} while(dd != d);
......@@ -252,12 +259,23 @@ void EnvMap::addNeighborObstacles(PFP::OBSTACLES& obst, Dart d, bool edgeNeighbo
if(obstacleMark.isMarked(dd))
{
if(buildingMark.isMarked(dd))
obst.push_back(dd);
{
Dart next = map.phi1(dd);
Dart previous = map.phi_1(dd);
Obstacle* o = new Obstacle(position[dd], position[next], position[previous], position[map.phi1(next)]);
obst.push_back(o);
}
else
obst.push_back(map.phi2(dd));
{
Dart dd2 = map.phi2(dd) ;
Dart next = map.phi1(dd2);
Dart previous = map.phi_1(dd2);
Obstacle* o = new Obstacle(position[dd2], position[next], position[previous], position[map.phi1(next)]);
obst.push_back(o);
}
}
dd = map.phi1(dd);
} while(dd != d);
} while(dd != stop);
}
//void EnvMap::agentChangeFaceThroughEdge(Agent* agent)
......
......@@ -10,12 +10,12 @@ Simulator::Simulator() : timeStep_(0.2f), globalTime_(0.0f), nbSteps_(0)
std::cout << "setup scenario" << std::endl;
// importAgents("myAgents.pos");
// setupScenario(700);
// setupCircleScenario(1000);
// setupCircleScenario(500);
setupCityScenario(
-1.0f * (24 * (70.0f / 2.0f) - 10),
-1.0f * (24 * (70.0f / 2.0f) - 10),
30,
30
-1.0f * (12 * (70.0f / 2.0f) - 10),
-1.0f * (12 * (70.0f / 2.0f) - 10),
20,
20
);
// addPathsToAgents();
......@@ -27,8 +27,8 @@ Simulator::Simulator() : timeStep_(0.2f), globalTime_(0.0f), nbSteps_(0)
agents_[i]->updateAgentNeighbors();
}
// tc1 = new ThreadUpdateInfo(agents_, 0, nbAgents / 2);
// tc2 = new ThreadUpdateInfo(agents_, nbAgents / 2, nbAgents );
// tc1 = new ThreadUpdateInfo(agents_, 0, nbAgents / 4);
// tc2 = new ThreadUpdateInfo(agents_, nbAgents / 4, nbAgents / 2);
// tc3 = new ThreadUpdateInfo(agents_, nbAgents / 2, nbAgents * 3 / 4);
// tc4 = new ThreadUpdateInfo(agents_, nbAgents * 3 / 4, nbAgents);
......@@ -61,16 +61,13 @@ void Simulator::doStep()
// boost::thread thread1(&ThreadUpdateInfo::run, tc1);
// boost::thread thread2(&ThreadUpdateInfo::run, tc2);
// std::vector<Dart> oldDarts;
// oldDarts.reserve(agents_.size());
// for (unsigned int i = 0; i < agents_.size(); ++i)
// {
// oldDarts.push_back(agents_[i]->part_.d);
// }
// boost::thread thread3(&ThreadUpdateInfo::run, tc3);
// boost::thread thread4(&ThreadUpdateInfo::run, tc4);
//
// thread1.join();
// thread2.join();
// thread3.join();
// thread4.join();
envMap_.map.setCurrentLevel(envMap_.map.getMaxLevel());
......@@ -78,11 +75,7 @@ void Simulator::doStep()
{
Dart oldFace = agents_[i]->part_.d;
// if(!envMap_.map.isDartValid(agents_[i]->part_.d))
// std::cout << " AGENT PART INVALID DART before update" << std::endl ;
agents_[i]->update();
// if(!envMap_.map.isDartValid(agents_[i]->part_.d))
// std::cout << " AGENT PART INVALID DART after update" << std::endl ;
// if(envMap_.map.getEmbedding(oldFace, FACE) != envMap_.map.getEmbedding(agents_[i]->part_.d, FACE))
if(agents_[i]->part_.crossCell != CGoGN::Algo::MovingObjects::NO_CROSS)
......@@ -90,12 +83,9 @@ void Simulator::doStep()
{
// case CGoGN::Algo::MovingObjects::CROSS_EDGE :
// envMap_.agentChangeFaceThroughEdge(agents_[i]);
// envMap_.addCoarsenCandidate(oldFace);
// envMap_.addRefineCandidate(agents_[i]->part_.d);
// break;
// case CGoGN::Algo::MovingObjects::CROSS_OTHER :
envMap_.agentChangeFace(agents_[i], oldFace);
// envMap_.agentChangeFace(agents_[i], oldDarts[i]);
// break;
}
......@@ -127,7 +117,7 @@ void Simulator::setupCircleScenario(unsigned int nbMaxAgent)
{
float pi = 3.14159265358979323846f;
float r = 800.0f;
float r = 400.0f;
for (unsigned int i = 0; i < nbMaxAgent; ++i)
{
VEC3 posagent(std::cos(i * 2.0f * pi / float(nbMaxAgent))*r,std::sin(i * 2.0f * pi / float(nbMaxAgent))*r,0);
......
......@@ -334,8 +334,8 @@ void SocialAgents::cb_redraw()
void SocialAgents::animate()
{
if(sim.nbSteps_ % sim.nbStepsPerUnit_ == 0 && (sim.nbSteps_ / sim.nbStepsPerUnit_) % 10 == 0)
std::cout << round(sim.globalTime_) << " " << sim.envMap_.mapMemoryCost() << std::endl;
// if(sim.nbSteps_ % sim.nbStepsPerUnit_ == 0 && (sim.nbSteps_ / sim.nbStepsPerUnit_) % 10 == 0)
// std::cout << round(sim.globalTime_) << " " << sim.envMap_.mapMemoryCost() << std::endl;
// std::cout << "t : " << sim.globalTime_ << std::endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment