A mental module
You can write your own mental module and plug it into MATSim.
Essentially:
public class MyModule implements PlanStrategyModule {
MyModule() {
}
public void prepareReplanning() {
}
public void handlePlan(Plan plan) {
// when given a plan, decide here what to do with it
}
public void finishReplanning() {
}
}
public class MyStrategy extends PlanStrategy {
public MyStrategy(Scenario s) {
this.addStrategyModule(new MyModule());
}
}Additional options can be found from the examples (see below).
You can then specify the class name of your module in the config-file as a replanning strategy, e.g.
<module name="strategy"> <param name="ModuleProbability_1" value="0.1" /> <param name="Module_1" value="your.package.MyStrategy" /> ...add other modules here... </module>
If you run a simulation with the default MATSim-Controler, it will then load your mental module and use it to modify the plans. This API is not yet complete, in the sense that it only offers limited functionality. We are working on a more powerful way to add your mental modules, but this may take quite some time.
Notes:
One example is under tutorial.programming.example10PluggablePlanStrategy in the source repository (under "matsim").