Commit 2391749f authored by Mohcine Chraibi's avatar Mohcine Chraibi

minor changes

parent e0cc4a3f
......@@ -6,7 +6,7 @@
<!-- seed used for initialising random generator -->
<seed>12542</seed>
<max_sim_time >1000</max_sim_time>
<max_sim_time >10</max_sim_time>
<!-- geometry file -->
<geometry>1.2_bottleneck.xml</geometry>
<!-- traectories file and format -->
......@@ -47,10 +47,13 @@
<!--persons information and distribution -->
<agents operational_model_id="3">
<agents_distribution>
<group group_id="1" agent_parameter_id="1" room_id="0" subroom_id="2" number="10" goal_id="0" router_id="1" />
<group group_id="1" agent_parameter_id="1" room_id="0" subroom_id="2" number="0" goal_id="0" router_id="1" />
</agents_distribution>
<!-- frequency in persons/minute -->
<agents_sources>
<source id="1" frequency="3" agents_max="30" group_id="1" caption="source 1" />
</agents_sources>
<!-- <agents_sources/> -->
</agents>
......@@ -102,7 +105,7 @@
<force_wall a="7" D="0.14"/>
</model_parameters>
<agent_parameters agent_parameter_id="1">
<v0 mu="1.34" sigma="0.001" />
<v0 mu="0" sigma="0.001" />
<bmax mu="0.15" sigma="0.00001" /> <!-- this is l/2, assuming peds are circles with constant radius-->
<bmin mu="0.15" sigma="0.001" />
<amin mu="0.15" sigma="0.00001" />
......
......@@ -73,7 +73,7 @@
<agents operational_model_id="2">
<agents_distribution>
<group group_id="0" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" x_min="3" x_max="5" y_min="3" y_max="5" />
<group group_id="1" room_id="1" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
<group group_id="1" room_id="0" subroom_id="0" number="10" router_id="1" agent_parameter_id="1" />
<group group_id="2" room_id="2" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
<group group_id="3" room_id="3" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
<group group_id="4" room_id="4" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
......@@ -84,7 +84,7 @@
</agents_distribution>
<agents_sources><!-- frequency in persons/seconds -->
<source id="1" frequency="2" agents_max="50" group_id="0" caption="source 1" />
<source id="1" frequency="2" agents_max="50" group_id="1" caption="source 1" />
<source_ id="2" frequency="2" agents_max="50" group_id="2" caption="source 2" />
<source_ id="3" frequency="2" agents_max="50" group_id="3" caption="source 3" />
<source_ id="4" frequency="2" agents_max="50" group_id="4" caption="source 4" />
......
......@@ -78,7 +78,7 @@ void AgentsSource::AddAgentsToPool(std::vector<Pedestrian*>& peds)
int AgentsSource::GetPoolSize() const
{
return _agents.size();
return (int)_agents.size();
}
void AgentsSource::AddToPool(Pedestrian* ped)
......
......@@ -106,7 +106,7 @@ bool ComputeBestPositionVoronoiBoost(AgentsSource* src, std::vector<Pedestrian*>
const Point& center_pos = subroom->GetCentroid();
temp._x = ( center_pos._x-vert._x );
temp._y = ( center_pos._y-vert._y );
temp = temp/sqrt(temp.NormSquare());
temp = temp/temp.Norm();
temp = temp*(radius*1.4); //now the norm of the vector is ~r*sqrt(2), pointing to the center
temp = temp + vert;
temp._x = (int)(temp._x*factor);
......@@ -122,7 +122,7 @@ bool ComputeBestPositionVoronoiBoost(AgentsSource* src, std::vector<Pedestrian*>
if(existing_peds.size() == 0 )
{
const Point& center_pos = subroom->GetCentroid();
const Point& center_pos = subroom->GetCentroid();
double x_coor = 3 * ( (double)rand() / (double)RAND_MAX ) - 1.5;
double y_coor = 3 * ( (double)rand() / (double)RAND_MAX ) - 1.5;
......@@ -159,7 +159,7 @@ bool ComputeBestPositionVoronoiBoost(AgentsSource* src, std::vector<Pedestrian*>
{
//it would be better to maybe have a mapping between discrete_positions and pointers to the pedestrians
//then there would be no need to remember the velocities_vector and goal_vector
std::vector<Point> discrete_positions;
std::vector<Point> discrete_positions;
std::vector<Point> velocities_vector;
std::vector<int> goal_vector;
Point tmp(0,0);
......@@ -177,19 +177,17 @@ bool ComputeBestPositionVoronoiBoost(AgentsSource* src, std::vector<Pedestrian*>
goal_vector.push_back( eped->GetFinalDestination() );
//calculating the mean, using it for the fake pedestrians
v = v + eped->GetV();
v += eped->GetV();
no++;
}
//TODO: dividing by 0 when existing_peds is empty
// -------> existing_peds is not empty because of the if statement
// sum up the weighted velocity in the loop
v = v/no; //this is the mean of all velocities
//adding fake people to the vector for constructing voronoi diagram
for (unsigned int i=0; i<subroom->GetPolygon().size(); i++ )
//for (unsigned int i=0; i<subroom->GetPolygon().size(); i++ )
for(auto fake_ped: fake_peds)
{
discrete_positions.push_back( fake_peds[i] );
discrete_positions.push_back( fake_ped );
velocities_vector.push_back( v );
goal_vector.push_back( -10 );
}
......
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