MATSIM
Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
org.matsim.core.replanning.modules.SubtourModeChoice Class Reference
Inheritance diagram for org.matsim.core.replanning.modules.SubtourModeChoice:
Inheritance graph
[legend]

Classes

enum  Behavior
 

Public Member Functions

 SubtourModeChoice (GlobalConfigGroup globalConfigGroup, SubtourModeChoiceConfigGroup subtourModeChoiceConfigGroup, PermissibleModesCalculator permissibleModesCalculator)
 
final void setBehavior (Behavior behavior)
 
PlanAlgorithm getPlanAlgoInstance ()
 
void prepareReplanning (ReplanningContext replanningContext)
 
void handlePlan (Plan plan)
 
void handlePlan (T plan)
 
void finishReplanning ()
 

Protected Member Functions

String [] getModes ()
 

Private Attributes

final double probaForChangeSingleTripMode
 
final double coordDist
 
Behavior behavior = Behavior.fromSpecifiedModesToSpecifiedModes
 
final PermissibleModesCalculator permissibleModesCalculator
 
final String [] chainBasedModes
 
final String [] modes
 

Detailed Description

Changes the transportation mode of all legs of one randomly chosen subtour in a plan to a randomly chosen different mode given a list of possible modes.

A subtour is a consecutive subset of a plan which starts and ends at the same link.

Certain modes are considered only if the choice would not require some resource to appear out of thin air. For example, you can only drive your car back from work if you have previously parked it there. These are called chain-based modes.

The assumption is that each chain-based mode requires one resource (car, bike, ...) and that this resource is initially positioned at home. Home is the location of the first activity in the plan.

If the plan initially violates this constraint, this module may (!) repair it.

Author
michaz

Definition at line 49 of file SubtourModeChoice.java.

Constructor & Destructor Documentation

◆ SubtourModeChoice()

org.matsim.core.replanning.modules.SubtourModeChoice.SubtourModeChoice ( GlobalConfigGroup  globalConfigGroup,
SubtourModeChoiceConfigGroup  subtourModeChoiceConfigGroup,
PermissibleModesCalculator  permissibleModesCalculator 
)

Definition at line 83 of file SubtourModeChoice.java.

References org.matsim.core.replanning.modules.SubtourModeChoice.coordDist, org.matsim.core.config.groups.SubtourModeChoiceConfigGroup.getBehavior(), org.matsim.core.config.groups.SubtourModeChoiceConfigGroup.getChainBasedModes(), org.matsim.core.config.groups.SubtourModeChoiceConfigGroup.getCoordDistance(), org.matsim.core.config.groups.SubtourModeChoiceConfigGroup.getModes(), org.matsim.core.config.groups.GlobalConfigGroup.getNumberOfThreads(), org.matsim.core.config.groups.SubtourModeChoiceConfigGroup.getProbaForRandomSingleTripMode(), org.matsim.core.replanning.modules.SubtourModeChoice.permissibleModesCalculator, org.matsim.core.replanning.modules.SubtourModeChoice.probaForChangeSingleTripMode, and org.matsim.core.replanning.modules.SubtourModeChoice.setBehavior().

84  {
85  this(globalConfigGroup.getNumberOfThreads(),
86  subtourModeChoiceConfigGroup.getModes(),
87  subtourModeChoiceConfigGroup.getChainBasedModes(),
88  subtourModeChoiceConfigGroup.getProbaForRandomSingleTripMode(),
89  permissibleModesCalculator, subtourModeChoiceConfigGroup.getCoordDistance()
90  );
91  this.setBehavior(subtourModeChoiceConfigGroup.getBehavior());
92  }
final PermissibleModesCalculator permissibleModesCalculator
Here is the call graph for this function:

Member Function Documentation

◆ setBehavior()

final void org.matsim.core.replanning.modules.SubtourModeChoice.setBehavior ( Behavior  behavior)

◆ getModes()

String [] org.matsim.core.replanning.modules.SubtourModeChoice.getModes ( )
protected

Definition at line 114 of file SubtourModeChoice.java.

114  {
115  return modes.clone();
116  }

◆ getPlanAlgoInstance()

PlanAlgorithm org.matsim.core.replanning.modules.SubtourModeChoice.getPlanAlgoInstance ( )

Definition at line 119 of file SubtourModeChoice.java.

References org.matsim.core.replanning.modules.SubtourModeChoice.behavior, org.matsim.core.replanning.modules.SubtourModeChoice.chainBasedModes, org.matsim.core.replanning.modules.SubtourModeChoice.coordDist, org.matsim.core.gbl.MatsimRandom.getLocalInstance(), org.matsim.core.router.TripStructureUtils.getRoutingModeIdentifier(), org.matsim.core.replanning.modules.SubtourModeChoice.modes, org.matsim.core.replanning.modules.SubtourModeChoice.permissibleModesCalculator, and org.matsim.core.replanning.modules.SubtourModeChoice.probaForChangeSingleTripMode.

119  {
120 
121  final ChooseRandomLegModeForSubtour chooseRandomLegMode =
122  new ChooseRandomLegModeForSubtour(
123  TripStructureUtils.getRoutingModeIdentifier(),
125  this.modes,
126  this.chainBasedModes,
127  MatsimRandom.getLocalInstance(), behavior, probaForChangeSingleTripMode, coordDist);
128  return chooseRandomLegMode;
129  }
final PermissibleModesCalculator permissibleModesCalculator
Here is the call graph for this function:

◆ prepareReplanning()

void org.matsim.api.core.v01.replanning.PlanStrategyModule.prepareReplanning ( ReplanningContext  replanningContext)
inherited

Initializes this module before handling plans. Modules using an external routine could e.g. open a file here to write the plans out and pass them to the external routines. Multi-threaded modules could initialize and start their threads in this method.

Parameters
replanningContextTODO

Implements org.matsim.core.replanning.modules.GenericPlanStrategyModule< T extends BasicPlan >.

Implemented in org.matsim.core.replanning.modules.ModeAndRouteConsistencyChecker.

◆ handlePlan() [1/2]

void org.matsim.api.core.v01.replanning.PlanStrategyModule.handlePlan ( Plan  plan)
inherited

Tells this module to handle the specified plan. It is not required that the plan must immediately be handled, e.g. modules calling external routines could just collect the plans here and start the external routine in finishReplanning(), or multi-threaded modules could just add the plan to a synchronized queue for the threads.

Parameters
plan
See also
finishReplanning()

Implemented in org.matsim.core.replanning.modules.ModeAndRouteConsistencyChecker.

◆ handlePlan() [2/2]

void org.matsim.core.replanning.modules.GenericPlanStrategyModule< T extends BasicPlan >.handlePlan ( plan)
inherited

Tells this module to handle the specified plan. It is not required that the plan must immediately be handled, e.g. modules calling external routines could just collect the plans here and start the external routine in finishReplanning(), or multi-threaded modules could just add the plan to a synchronized queue for the threads.

Parameters
plan
See also
finishReplanning()

Referenced by org.matsim.core.replanning.GenericPlanStrategyImpl< Plan, Person >.run().

◆ finishReplanning()

void org.matsim.api.core.v01.replanning.PlanStrategyModule.finishReplanning ( )
inherited

Indicates that no additional plans will be handed to this module and waits until this module has finished handling all plans. Modules calling external routines can call those here, or multi-threaded modules can wait here until all threads are finished with their work.

See also
handlePlan(Plan)

Implements org.matsim.core.replanning.modules.GenericPlanStrategyModule< T extends BasicPlan >.

Implemented in org.matsim.core.replanning.modules.ModeAndRouteConsistencyChecker.

Member Data Documentation

◆ probaForChangeSingleTripMode

final double org.matsim.core.replanning.modules.SubtourModeChoice.probaForChangeSingleTripMode
private

◆ coordDist

final double org.matsim.core.replanning.modules.SubtourModeChoice.coordDist
private

◆ behavior

Behavior org.matsim.core.replanning.modules.SubtourModeChoice.behavior = Behavior.fromSpecifiedModesToSpecifiedModes
private

◆ permissibleModesCalculator

final PermissibleModesCalculator org.matsim.core.replanning.modules.SubtourModeChoice.permissibleModesCalculator
private

◆ chainBasedModes

final String [] org.matsim.core.replanning.modules.SubtourModeChoice.chainBasedModes
private

◆ modes

final String [] org.matsim.core.replanning.modules.SubtourModeChoice.modes
private

The documentation for this class was generated from the following file: