MATSIM
RunPlanSelectorForRemovalExample.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * *
4  * *********************************************************************** *
5  * *
6  * copyright : (C) 2015 by the members listed in the COPYING, *
7  * LICENSE and WARRANTY file. *
8  * email : info at matsim dot org *
9  * *
10  * *********************************************************************** *
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * See also COPYING, LICENSE and WARRANTY file *
17  * *
18  * *********************************************************************** */
19 
20 package tutorial.programming.planStrategyForRemoval;
21 
22 import org.matsim.core.config.Config;
27 
32 
33  private static final String SELECTOR_NAME = "selectorName";
34 
35  public static void main(String[] args) {
36 
37  Config config = ConfigUtils.createConfig();
38  config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists);
39  config.controler().setLastIteration(1);
40 
41  config.strategy().setPlanSelectorForRemoval( SELECTOR_NAME );
42 
43  Controler controler = new Controler(config);
44 
45  controler.addOverridingModule(new AbstractModule(){
46 
47  @Override
48  public void install() {
49  if (getConfig().strategy().getPlanSelectorForRemoval().equals(SELECTOR_NAME)) {
50  bindPlanSelectorForRemoval().toProvider(MyExpBetaPlanChangerForRemovalProvider.class);
51  }
52  }
53  });
54 
55  controler.run();
56 
57  }
58 
59 }
60 
final void addOverridingModule(AbstractModule abstractModule)
Definition: Controler.java:410
StrategyConfigGroup strategy
Definition: Config.java:98
void setPlanSelectorForRemoval(String planSelectorForRemoval)
ControlerConfigGroup controler
Definition: Config.java:87
static Config createConfig(final String filename)