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
4be49a4e
Commit
4be49a4e
authored
Apr 29, 2020
by
Julian Zobel
Browse files
WIP: More parameters for GH alternative routes
parent
c72090d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/local/RealWorldStreetsMovement.java
View file @
4be49a4e
...
...
@@ -219,8 +219,10 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
req
.
getHints
().
put
(
Routing
.
BLOCK_AREA
,
blockedAreas
);
}
if
(
allowAlternativeRoutes
)
{
req
.
setAlgorithm
(
Parameters
.
Algorithms
.
ALT_ROUTE
);
req
.
getHints
().
put
(
Parameters
.
Algorithms
.
AltRoute
.
MAX_PATHS
,
"5"
);
// see: https://discuss.graphhopper.com/t/alternative-routes/424/11
req
.
setAlgorithm
(
Parameters
.
Algorithms
.
ALT_ROUTE
);
req
.
getHints
().
put
(
Parameters
.
Algorithms
.
AltRoute
.
MAX_WEIGHT
,
"2.0"
);
// how much longer can alternatives be?
req
.
getHints
().
put
(
Parameters
.
Algorithms
.
AltRoute
.
MAX_PATHS
,
"5"
);
// how much alternatives should be returned at max?
}
...
...
@@ -247,9 +249,11 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
if
(
random
.
nextDouble
()
<=
probabilityForAlternativeRoute
)
{
List
<
PathWrapper
>
paths
=
rsp
.
getAll
();
System
.
out
.
println
(
paths
.
size
());
pointList
=
rsp
.
getAll
().
get
(
1
).
getPoints
();
int
pick
=
random
.
nextInt
(
paths
.
size
()
-
1
)
+
1
;
System
.
out
.
println
(
pick
+
" / "
+
paths
.
size
());
pointList
=
rsp
.
getAll
().
get
(
pick
).
getPoints
();
}
}
...
...
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