1 package org.opentrafficsim.road.gtu.generator.od;
2
3 import org.djunits.value.vdouble.scalar.Acceleration;
4 import org.opentrafficsim.base.parameters.ParameterTypes;
5 import org.opentrafficsim.core.gtu.GTUException;
6 import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterFactoryByType;
7 import org.opentrafficsim.core.network.Node;
8 import org.opentrafficsim.road.gtu.lane.tactical.LaneBasedTacticalPlanner;
9 import org.opentrafficsim.road.gtu.lane.tactical.LaneBasedTacticalPlannerFactory;
10 import org.opentrafficsim.road.gtu.lane.tactical.following.IDMPlusFactory;
11 import org.opentrafficsim.road.gtu.lane.tactical.lmrs.DefaultLMRSPerceptionFactory;
12 import org.opentrafficsim.road.gtu.lane.tactical.lmrs.LMRSFactory;
13 import org.opentrafficsim.road.gtu.strategical.LaneBasedStrategicalPlannerFactory;
14 import org.opentrafficsim.road.gtu.strategical.od.Category;
15 import org.opentrafficsim.road.gtu.strategical.route.LaneBasedStrategicalRoutePlannerFactory;
16 import org.opentrafficsim.road.gtu.strategical.route.RouteGeneratorOD;
17
18 import nl.tudelft.simulation.jstats.streams.StreamInterface;
19
20
21
22
23
24
25
26
27
28
29
30
31 public interface StrategicalPlannerFactorySupplierOD
32 {
33
34
35
36
37
38
39
40
41
42
43 LaneBasedStrategicalPlannerFactory<?> getFactory(Node origin, Node destination, Category category,
44 StreamInterface randomStream) throws GTUException;
45
46
47
48
49
50 static StrategicalPlannerFactorySupplierOD lmrs()
51 {
52 return new StrategicalPlannerFactorySupplierOD()
53 {
54
55 @Override
56 public LaneBasedStrategicalPlannerFactory<?> getFactory(final Node origin, final Node destination,
57 final Category category, final StreamInterface randomStream) throws GTUException
58 {
59 ParameterFactoryByType params = new ParameterFactoryByType();
60 params.addParameter(ParameterTypes.A, Acceleration.createSI(0.4));
61 return new LaneBasedStrategicalRoutePlannerFactory(
62 new LMRSFactory(new IDMPlusFactory(randomStream), new DefaultLMRSPerceptionFactory()), params,
63 RouteGeneratorOD.getDefaultRouteSupplier(randomStream));
64 }
65 };
66 }
67
68
69
70
71
72
73
74
75
76 static StrategicalPlannerFactorySupplierOD route(final TacticalPlannerFactorySupplierOD tacticalPlannerFactorySupplierOD)
77 {
78 return new StrategicalPlannerFactorySupplierOD()
79 {
80
81 @Override
82 public LaneBasedStrategicalPlannerFactory<?> getFactory(final Node origin, final Node destination,
83 final Category category, final StreamInterface randomStream) throws GTUException
84 {
85 return new LaneBasedStrategicalRoutePlannerFactory(
86 tacticalPlannerFactorySupplierOD.getFactory(origin, destination, category, randomStream));
87 }
88 };
89 }
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104 public interface TacticalPlannerFactorySupplierOD
105 {
106
107
108
109
110
111
112
113
114 LaneBasedTacticalPlannerFactory<? extends LaneBasedTacticalPlanner> getFactory(Node origin, Node destination,
115 Category category, StreamInterface randomStream);
116 }
117
118 }