Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
99d40599
Commit
99d40599
authored
Nov 20, 2020
by
Julian Zobel
Browse files
Bugfix in alternative routing for realworld street movement.
parent
db095e8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/local/RealWorldStreetsMovement.java
View file @
99d40599
...
...
@@ -246,14 +246,23 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
// alternatives for routing are allowed for distances bigger than 50
if
(
allowAlternativeRoutes
&&
rsp
.
hasAlternatives
()
&&
rsp
.
getBest
().
getDistance
()
>
50
)
{
// alternative route is taken with a certain chance
if
(
random
.
nextDouble
()
<=
probabilityForAlternativeRoute
)
{
List
<
PathWrapper
>
paths
=
rsp
.
getAll
();
int
pick
=
random
.
nextInt
(
paths
.
size
()
-
1
)
+
1
;
pointList
=
rsp
.
getAll
().
get
(
pick
).
getPoints
();
if
(
random
.
nextDouble
()
<=
probabilityForAlternativeRoute
)
{
List
<
PathWrapper
>
paths
=
rsp
.
getAll
();
// remove the best, we do not want this!
paths
.
remove
(
rsp
.
getBest
());
PathWrapper
choice
;
if
(
paths
.
size
()
==
1
)
{
choice
=
paths
.
get
(
0
);
}
else
{
choice
=
paths
.
get
(
random
.
nextInt
(
paths
.
size
()
-
1
)
+
1
);
}
pointList
=
choice
.
getPoints
();
}
}
//PointList pointList = rsp.getBest().getPoints();
}
if
(
isCalculateRouteSegments
())
{
/*
...
...
@@ -262,7 +271,7 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
trajectory
=
new
RouteImpl
(
comp
.
getRealPosition
(),
destination
,
pointList
,
routeSensor
.
getSegmentListeners
(),
routeSensor
,
calculateSegments
(
rsp
.
getBest
()
));
calculateSegments
(
pointList
));
}
else
{
trajectory
=
new
RouteImpl
(
comp
.
getRealPosition
(),
destination
,
pointList
);
...
...
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