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
9059ec66
Commit
9059ec66
authored
Mar 26, 2020
by
Julian Zobel
Browse files
Added a 1percent chance that an alternative route is taken, if available
parent
7698d9d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/local/RealWorldStreetsMovement.java
View file @
9059ec66
...
...
@@ -26,6 +26,7 @@ import java.util.LinkedList;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.UUID
;
import
com.graphhopper.GHRequest
;
...
...
@@ -43,6 +44,7 @@ import com.graphhopper.util.DistanceCalc2D;
import
com.graphhopper.util.EdgeIteratorState
;
import
com.graphhopper.util.Instruction
;
import
com.graphhopper.util.InstructionList
;
import
com.graphhopper.util.Parameters
;
import
com.graphhopper.util.Parameters.Routing
;
import
com.graphhopper.util.PointList
;
import
com.graphhopper.util.shapes.GHPoint
;
...
...
@@ -50,6 +52,7 @@ import com.graphhopper.util.shapes.GHPoint;
import
de.tud.kom.p2psim.api.topology.Topology
;
import
de.tud.kom.p2psim.api.topology.movement.SimLocationActuator
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.GPSCalculation
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.ModularMovementModelViz
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.RouteSensorComponent
;
import
de.tud.kom.p2psim.impl.topology.util.PositionVector
;
import
de.tud.kom.p2psim.impl.util.Either
;
...
...
@@ -198,7 +201,9 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
// https://github.com/graphhopper/graphhopper/blob/master/docs/web/api-doc.md#flexible
if
(
blockedAreas
!=
null
&&
!
blockedAreas
.
isEmpty
())
{
req
.
getHints
().
put
(
Routing
.
BLOCK_AREA
,
blockedAreas
);
}
}
req
.
setAlgorithm
(
Parameters
.
Algorithms
.
ALT_ROUTE
);
GHResponse
rsp
=
hopper
.
route
(
req
);
...
...
@@ -214,7 +219,24 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
currentRoutes
.
put
(
comp
,
trajectory
);
}
else
{
PointList
pointList
=
rsp
.
getBest
().
getPoints
();
if
(
rsp
.
hasAlternatives
())
{
// System.out.println(" >>");
// for (PathWrapper pw : rsp.getAll()) {
// System.out.println(pw.getDistance());
// ModularMovementModelViz.paths.add(pw.getPoints());
// }
// System.out.println(" ");
if
(
Math
.
random
()
<
0.01
)
{
pointList
=
rsp
.
getAll
().
get
(
1
).
getPoints
();
}
}
//PointList pointList = rsp.getBest().getPoints();
if
(
isCalculateRouteSegments
())
{
/*
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/transition/InAreaRoamingTransitionStrategy.java
View file @
9059ec66
...
...
@@ -86,7 +86,7 @@ public class InAreaRoamingTransitionStrategy extends AbstractAttractionBasedAssi
this
.
roamingStates
.
put
(
comp
,
roamingTransitionState
.
PAUSE
);
// schedule roaming
Event
.
scheduleWithDelay
(
gaussianDistributionPauseTime
(
Time
.
MINUTE
,
Time
.
MINUTE
),
this
,
comp
,
EVENT_ROAMING_PAUSE_ENDED
);
Event
.
scheduleWithDelay
(
gaussianDistributionPauseTime
(
5
*
Time
.
MINUTE
,
Time
.
MINUTE
),
this
,
comp
,
EVENT_ROAMING_PAUSE_ENDED
);
}
...
...
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