Class LMRSFactory
- java.lang.Object
-
- org.opentrafficsim.road.gtu.lane.tactical.AbstractLaneBasedTacticalPlannerFactory<LMRS>
-
- org.opentrafficsim.road.gtu.lane.tactical.lmrs.LMRSFactory
-
- All Implemented Interfaces:
Serializable
,LaneBasedTacticalPlannerFactory<LMRS>
,ModelComponentFactory
public class LMRSFactory extends AbstractLaneBasedTacticalPlannerFactory<LMRS> implements Serializable
Factory for a tactical planner using LMRS with any car-following model.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version Aug 2, 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LMRSFactory(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory)
Constructor using default incentives and passive synchronization.LMRSFactory(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory, Synchronization synchronization, Cooperation cooperation, GapAcceptance gapAcceptance, Tailgating tailgating, Set<MandatoryIncentive> mandatoryIncentives, Set<VoluntaryIncentive> voluntaryIncentives, Set<AccelerationIncentive> accelerationIncentives)
Constructor with full control over incentives and type of synchronization.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LMRS
create(LaneBasedGTU gtu)
Creates a new tactical planner for the given GTU.Parameters
getParameters()
Returns parameters for the given component.String
toString()
-
Methods inherited from class org.opentrafficsim.road.gtu.lane.tactical.AbstractLaneBasedTacticalPlannerFactory
getCarFollowingModelFactoryString, getCarFollowingParameters, getPerceptionFactory, nextCarFollowingModel, peekDesiredHeadway, peekDesiredSpeed
-
-
-
-
Constructor Detail
-
LMRSFactory
public LMRSFactory(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory) throws GTUException
Constructor using default incentives and passive synchronization.- Parameters:
carFollowingModelFactory
- CarFollowingModelFactory<? extends CarFollowingModel>; factory of the car-following modelperceptionFactory
- PerceptionFactory; perception factory- Throws:
GTUException
- if the supplied car-following model does not have an accessible empty constructor
-
LMRSFactory
public LMRSFactory(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory, Synchronization synchronization, Cooperation cooperation, GapAcceptance gapAcceptance, Tailgating tailgating, Set<MandatoryIncentive> mandatoryIncentives, Set<VoluntaryIncentive> voluntaryIncentives, Set<AccelerationIncentive> accelerationIncentives)
Constructor with full control over incentives and type of synchronization.- Parameters:
carFollowingModelFactory
- CarFollowingModelFactory<? extends CarFollowingModel>; factory of the car-following modelperceptionFactory
- PerceptionFactory; perception factorysynchronization
- Synchronization; type of synchronizationcooperation
- Cooperation; type of cooperationgapAcceptance
- GapAcceptance; gap-acceptancetailgating
- Tailgating; tail gatingmandatoryIncentives
- mandatory incentives; note that order may mattervoluntaryIncentives
- voluntary incentives; note that order may matteraccelerationIncentives
- Set<AccelerationIncentive>; acceleration incentives
-
-
Method Detail
-
getParameters
public final Parameters getParameters() throws ParameterException
Returns parameters for the given component. These parameters should contain, and possibly overwrite, parameters from sub-components. A parameter factory at the highest level (strategical planner) may overwrite any parameter. This combination allows that for sub-components, default factories can be used, while the parameter factory only overwrites parameters different for specific GTU types. The default implementation returns all default parameter values declared at the class.
Conventional use is:
Parameters parameters = this.subComponent1Factory.getParameters(); this.subComponent2Factory.getParameters().setAllIn(parameters); parameters.setDefaultParameters(componentClass); parameters.setDefaultParameters(staticUtilityClass); return parameters;
where all parameters used incomponentClass
are defined or forwarded incomponentClass
.
// forwarded public static final ParameterTypeAcceleration A = ParameterTypes.A; // defined public static final ParameterTypeDouble FACTOR = new ParameterTypeDouble("factor", "factor on response", 1.0);
The same holds for static utilities that are used. Parameters should be defined at the utility class, and parameters of used utilities should be included.
- Specified by:
getParameters
in interfaceModelComponentFactory
- Returns:
- Parameters; parameters for the given component
- Throws:
ParameterException
- on parameter exception
-
create
public final LMRS create(LaneBasedGTU gtu) throws GTUException
Creates a new tactical planner for the given GTU.- Specified by:
create
in interfaceLaneBasedTacticalPlannerFactory<LMRS>
- Parameters:
gtu
- LaneBasedGTU; GTU- Returns:
- tactical planner for the given GTU
- Throws:
GTUException
- if the gtu is not suitable in any way for the creation of the tactical planner
-
-