Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
JPScore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
92
Issues
92
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JuPedSim
JPScore
Commits
070ceaee
Commit
070ceaee
authored
Oct 09, 2015
by
Andrijana Brkic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes in SortPositionByDensity-fix needed and voronoi-boost changes
parent
548a76e5
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
30534 deletions
+60
-30534
inputfiles/Experiment/experiment_ini.xml
inputfiles/Experiment/experiment_ini.xml
+2
-2
inputfiles/hybrid/hybrid_hall_ini.xml
inputfiles/hybrid/hybrid_hall_ini.xml
+3
-3
inputfiles/hybrid/hybrid_hall_traj.xml
inputfiles/hybrid/hybrid_hall_traj.xml
+0
-30508
pedestrian/AgentsSourcesManager.cpp
pedestrian/AgentsSourcesManager.cpp
+49
-13
voronoi-boost/VoronoiPositionGenerator.cpp
voronoi-boost/VoronoiPositionGenerator.cpp
+4
-8
voronoi-boost/VoronoiPositionGenerator.h
voronoi-boost/VoronoiPositionGenerator.h
+2
-0
No files found.
inputfiles/Experiment/experiment_ini.xml
View file @
070ceaee
...
...
@@ -5,12 +5,12 @@
<!-- seed used for initialising random generator -->
<seed>
12542
</seed>
<!-- geometry file -->
<geometry>
experiment_
traj
.xml
</geometry>
<geometry>
experiment_
geo
.xml
</geometry>
<max_sim_time>
4000
</max_sim_time>
<!-- trajectories file and format -->
<trajectories
format=
"xml-plain"
fps=
"16"
>
<file
location=
"
../../../../Documents/Documentation/Experiment/trajectories2/traj_10
.xml"
/>
<file
location=
"
experiment_traj
.xml"
/>
<socket_
hostname=
"127.0.0.1"
port=
"8989"
/>
</trajectories>
...
...
inputfiles/hybrid/hybrid_hall_ini.xml
View file @
070ceaee
...
...
@@ -19,13 +19,13 @@
<!--<hybrid_simulation server="zam597" port="9999" />-->
<!-- where to store the logs -->
<!--<logfile>outputfiles/log.txt</logfile>
-->
<!--<logfile>outputfiles/log.txt</logfile>-->
<!-- traffic information: e.g closed doors or smoked rooms -->
<traffic_constraints>
<!-- doors states are: close or open -->
<doors>
<door
trans_id=
"5"
caption=
"exit"
state=
"close
d
"
/>
<door
trans_id=
"5"
caption=
"exit"
state=
"close"
/>
</doors>
</traffic_constraints>
...
...
@@ -85,7 +85,7 @@
</agents_distribution>
<agents_sources>
<!-- frequency in persons/seconds -->
<source
id=
"1"
frequency=
"
7"
agents_max=
"1
00"
group_id=
"6"
caption=
"source 1"
/>
<source
id=
"1"
frequency=
"
6"
agents_max=
"5
00"
group_id=
"6"
caption=
"source 1"
/>
<source_
id=
"2"
frequency=
"10"
agents_max=
"50"
group_id=
"2"
caption=
"source 2"
/>
<source_
id=
"3"
frequency=
"10"
agents_max=
"50"
group_id=
"3"
caption=
"source 3"
/>
<source_
id=
"4"
frequency=
"10"
agents_max=
"50"
group_id=
"4"
caption=
"source 4"
/>
...
...
inputfiles/hybrid/hybrid_hall_traj.xml
View file @
070ceaee
This diff is collapsed.
Click to expand it.
pedestrian/AgentsSourcesManager.cpp
View file @
070ceaee
...
...
@@ -310,14 +310,18 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
double
bounds
[
4
]
=
{
0
,
0
,
0
,
0
};
dist
->
Getbounds
(
bounds
);
std
::
vector
<
Pedestrian
*>
peds_without_place
;
vector
<
Point
>
extra_positions
;
for
(
auto
&
ped
:
peds
)
std
::
vector
<
Pedestrian
*>::
iterator
iter_ped
;
for
(
iter_ped
=
peds
.
begin
();
iter_ped
!=
peds
.
end
();
)
{
//need to be called at each iteration
SortPositionByDensity
(
positions
,
extra_positions
);
int
index
=
-
1
;
double
radius
=
(
(
*
iter_ped
)
->
GetEllipse
()
).
GetBmax
()
;
//in the case a range was specified
//just take the first element
...
...
@@ -325,11 +329,31 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
{
Point
pos
=
positions
[
a
];
//cout<<"checking: "<<pos.toString()<<endl;
// for positions inside bounds, check it there is enough space
if
((
bounds
[
0
]
<=
pos
.
_x
)
&&
(
pos
.
_x
<=
bounds
[
1
])
&&
(
bounds
[
2
]
<=
pos
.
_y
)
&&
(
pos
.
_y
<
bounds
[
3
]))
{
index
=
a
;
break
;
bool
enough_space
=
true
;
//checking enough space!!
vector
<
Pedestrian
*>
neighbours
;
_building
->
GetGrid
()
->
GetNeighbourhood
(
pos
,
neighbours
);
for
(
const
auto
&
ngh
:
neighbours
)
if
(
(
ngh
->
GetPos
()
-
pos
).
NormSquare
()
<
4
*
radius
*
radius
)
{
enough_space
=
false
;
break
;
}
if
(
enough_space
)
{
index
=
a
;
break
;
}
}
}
if
(
index
==
-
1
)
...
...
@@ -341,22 +365,33 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
bounds
[
0
],
bounds
[
1
],
bounds
[
2
],
bounds
[
3
]);
Log
->
Write
(
"
\t
Specifying a subroom_id might help"
);
Log
->
Write
(
"
\t
%d positions were available"
,
positions
.
size
());
exit
(
EXIT_FAILURE
);
//
exit(EXIT_FAILURE);
}
//dump the pedestrian, move iterator
peds_without_place
.
push_back
(
*
iter_ped
);
iter_ped
=
peds
.
erase
(
iter_ped
);
}
else
else
//we found a position with enough space
{
const
Point
&
pos
=
positions
[
index
];
extra_positions
.
push_back
(
pos
);
ped
->
SetPos
(
pos
,
true
);
//true for the initial position
positions
.
erase
(
positions
.
begin
()
+
index
);
//at this point we have a position
//so we can adjust the velocity
//AdjustVelocityUsingWeidmann(ped);
AdjustVelocityByNeighbour
(
ped
);
extra_positions
.
push_back
(
pos
);
(
*
iter_ped
)
->
SetPos
(
pos
,
true
);
//true for the initial position
positions
.
erase
(
positions
.
begin
()
+
index
);
//at this point we have a position
//so we can adjust the velocity
//AdjustVelocityUsingWeidmann(ped);
AdjustVelocityByNeighbour
(
(
*
iter_ped
)
);
//move iterator
iter_ped
++
;
}
//return the pedestrians without place
}
if
(
peds_without_place
.
size
()
>
0
)
src
->
AddAgentsToPool
(
peds_without_place
);
}
void
AgentsSourcesManager
::
AdjustVelocityByNeighbour
(
Pedestrian
*
ped
)
const
...
...
@@ -477,7 +512,8 @@ void AgentsSourcesManager::SortPositionByDensity(std::vector<Point>& positions,
for
(
const
auto
&
p
:
neighbours
)
{
if
(
(
pt
-
p
->
GetPos
()).
NormSquare
()
<=
radius_square
)
//FIXME: p can be null, if deleted in the main simulation thread.
if
(
p
&&
(
pt
-
p
->
GetPos
()).
NormSquare
()
<=
radius_square
)
density
+=
1.0
;
}
...
...
voronoi-boost/VoronoiPositionGenerator.cpp
View file @
070ceaee
...
...
@@ -166,7 +166,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
temp
(
0
,
0
);
...
...
@@ -207,7 +207,7 @@ bool ComputeBestPositionVoronoiBoost(AgentsSource* src, std::vector<Pedestrian*>
voronoi_diagram
<
double
>::
const_vertex_iterator
chosen_it
=
vd
.
vertices
().
begin
();
double
dis
=
0
;
VoronoiBestVertex
Max
(
discrete_positions
,
vd
,
subroom
,
factor
,
chosen_it
,
dis
,
radius
,
goal_vector
,
*
iter_ped
);
VoronoiBestVertex
RandMax
(
discrete_positions
,
vd
,
subroom
,
factor
,
chosen_it
,
dis
,
radius
);
if
(
dis
>
4
*
radius
*
factor
*
radius
*
factor
)
// be careful with the factor!! radius*factor, 2,3,4?
{
...
...
@@ -325,13 +325,9 @@ void VoronoiBestVertexMax (const std::vector<Point>& discrete_positions, const v
//constructing the checking line
//ped->SetPos(vert_pos);
/*
Point p2 = (ped->GetExitLine()->ShortestPoint(vert_pos)-vert_pos).Normalized(); //problem: ped does not have a position
p2 = p2 + p2; //looking 2m in front
//Point p2 = nav_line->GetPoint1() - nav_line->GetPoint2() ;
//p2 = p2/ p2.Norm();
//p2 = p2+p2;
//p2 = nav_line->GetPoint1() + p2;
Line check_line(vert_pos, vert_pos + p2); //this is the first 2m of exit line
do
...
...
@@ -351,7 +347,7 @@ void VoronoiBestVertexMax (const std::vector<Point>& discrete_positions, const v
p = discrete_positions[index]/factor;
} while( edge != vertex.incident_edge() );
*/
if
(
score
>
max_score
)
{
max_score
=
score
;
...
...
voronoi-boost/VoronoiPositionGenerator.h
View file @
070ceaee
...
...
@@ -28,6 +28,8 @@ class Building;
class
Pedestrian
;
class
Point
;
// TODO: bool IsSpace(SubRoom* subroom, Point& pt,Point& v1);
/**
* Calculates if a point (which is inside the subroom) is far enough from the walls, transitions, crossings ( > radius of a person)
* @param subroom
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment