-
Notifications
You must be signed in to change notification settings - Fork 180
faq 235536385
by wdg on 2018-03-19 13:51:46
Hi, all
The question happened when I ran "RunCarsharing" and used "RunCarsharingIT" (path:matsim\contribs\carsharing\test\input\org\matsim\contrib\carsharing\runExample\RunCarsharingIT) as input, if I changed the first person's traffic mode from "car" to "oneway" (which is in the 10persons.xml). The program would proceed with errors, just as shown below. The matsim I used is matsim-0.9.
2018-03-19 21:34:13,484 ERROR AbstractController:203 Mobsim did not complete normally! afterMobsimListeners will be called anyway. java.lang.ClassCastException: org.matsim.core.population.routes.LinkNetworkRouteImpl cannot be cast to org.matsim.contrib.carsharing.router.CarsharingRoute at org.matsim.contrib.carsharing.manager.CarsharingManagerNew.reserveAndrouteCarsharingTrip(CarsharingManagerNew.java:72) at org.matsim.contrib.carsharing.qsim.CarsharingPersonDriverAgentImpl.endActivityAndComputeNextState(CarsharingPersonDriverAgentImpl.java:76) at org.matsim.core.mobsim.qsim.ActivityEngine.doSimStep(ActivityEngine.java:118) at org.matsim.core.mobsim.qsim.QSim.doSimStep(QSim.java:364) at org.matsim.core.mobsim.qsim.QSim.run(QSim.java:238) at org.matsim.core.controler.NewControler.runMobSim(NewControler.java:111) at org.matsim.core.controler.AbstractController$7.run(AbstractController.java:192) at org.matsim.core.controler.AbstractController.iterationStep(AbstractController.java:224) at org.matsim.core.controler.AbstractController.mobsim(AbstractController.java:188) at org.matsim.core.controler.AbstractController.iteration(AbstractController.java:147) at org.matsim.core.controler.AbstractController.doIterations(AbstractController.java:114) at org.matsim.core.controler.AbstractController.access$000(AbstractController.java:28) at org.matsim.core.controler.AbstractController$1.run(AbstractController.java:84) at org.matsim.core.controler.MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:48) at org.matsim.core.controler.MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:31) at org.matsim.core.controler.AbstractController.run(AbstractController.java:92) at org.matsim.core.controler.NewControler.run(NewControler.java:75) at org.matsim.core.controler.Controler.run(Controler.java:202) at runCarsharing.runCarsharing.main(runCarsharing.java:73)
by Milos Balac on 2018-03-19 16:36:13
Hi wdg,
That is a known issue in the carsharing contrib as it does not allow carsharing modes in the initial input. This is solved in one of the branches by adding a CarsharingRouteFactory:
https://github.com/matsim-org/matsim/blob/carsharingRelocation/contribs/carsharing/src/main/java/org/matsim/contrib/carsharing/router/CarsharingRouteFactory.java
Which is then added in the RunCarsharing script like this:
final Scenario sc = ScenarioUtils.loadScenario(config);
sc.getPopulation().getFactory().getRouteFactories().setRouteFactory(CarsharingRoute.class,
new CarsharingRouteFactory());
Alternatively you can use the code in the carsharingRelocation branch.
Hope this helps.
Milos
You are viewing an archive of the previous MATSim Q&A site. The real site is now at https://matsim.org/faq