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
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/local/RealWorldStreetsMovement.java
View file @
99d40599
...
...
@@ -248,12 +248,21 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
// 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
();
// 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 pointList = rsp.getBest().getPoints();
pointList
=
choice
.
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