matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
83 stars 179 forks source link

Using Cadyts to correct my own scenario #233

Open jiao1997 opened 5 years ago

jiao1997 commented 5 years ago

Dear all: I am using Cadyts in MATSim to correct my own scenario.I have imported the project from github and run RunCadyts4CarExample.java from org.matsim.comtrib.cadyts.package. Unfortunately, there are no changes in my output file that is to say there is no change in traffic flow during the iterations.If you can give me a little help, I'll appreciate it very much.My counts file , config file and other outputfile(calibration-stats file and compared file) are attached with the email.By the way, I am testing two links in the counts file.The links are like below: (image) calibration-stats (1).txt 10.countscompare.txt 10.countscompareAWTV.txt config.txt

counts5(1).txt

Janekdererste commented 4 years ago

Looking at your config file, the only strategy you provide is ChangeExpBeta. How many plans do your agents initially have?

jiao1997 commented 4 years ago

Looking at your config file, the only strategy you provide is ChangeExpBeta. How many plans do your agents initially have?

Hi ,there is only one plan my initial agents have

Janekdererste commented 4 years ago

The ChangeExpBeta strategy selects a different than the currently selected plan out of the already existing ones. If your agents only have one plan available, this strategy will re-select this very plan after each iteration.

To create more plans you need to add innovative strategies, like SubtourModeChoice or ReRoute. Check out chapter 4.6 of our userguide

Cadyts will increase the score of plans which fit the input counts distribution, and it will decrease the score of plans which don't fit the input counts distribution.

jiao1997 commented 4 years ago

Thans a lot. According to the userguide, should I set the ReRoute strategies and it's value? Do I have to add more plans in my initial plans.xml ? Or there will be more plans added to it automatically during iterations ? Best wishes!

Janekdererste commented 4 years ago

Innovative Strategies will generate new plans. You can start with one initial plan. Keep in mind to run a sufficient number of iterations. Beacuse generating enough plans will take time if you allow 20% of the agents innovate new plans.

jiao1997 commented 4 years ago

Innovative Strategies will generate new plans. You can start with one initial plan. Keep in mind to run a sufficient number of iterations. Beacuse generating enough plans will take time if you allow 20% of the agents innovate new plans.

Thanks a lot, I will try it. Best wishes!

jiao1997 commented 4 years ago

Innovative Strategies will generate new plans. You can start with one initial plan. Keep in mind to run a sufficient number of iterations. Beacuse generating enough plans will take time if you allow 20% of the agents innovate new plans.

Dear Janekdererste, I have set ReRoute=0.2 and run 100 iterations , it seems that the change is not obvious after calibration, could you give me some advice Best wishes!

Janekdererste commented 4 years ago

it seems that the change is not obvious after calibration

You could check whether most of your agents have more than one plan now. This would indicate, that the ReRoute Module was active.

jiao1997 commented 4 years ago

it seems that the change is not obvious after calibration

You could check whether most of your agents have more than one plan now. This would indicate, that the ReRoute Module was active.

There are more than one plans now , but it seems that the routes are the same. Following picture has dipicted it: image Hope to get your early reply. Best wishes!

Janekdererste commented 4 years ago

Hi @jiao1997, sorry for the late response. Now, it's getting tricky. I can have a look at your scenario set up. Please provide your input files and your run class, so I can have a look at them.

jiao1997 commented 4 years ago

Hi Janekdererste,it doesn't matter.My input files and run class are shown below.Thanks for your help.

config.txt counts.txt Network.txt plans.txt RunCadyts.txt

Best wishes!

Janekdererste commented 4 years ago

So, looking at your config file, my guess is that you still don't have your strategies right. You are only running 10 iterations but you let your agents remember nice plans, while only 30% of your population will generate new plans (through ReRoute-Strategy). After 10 Iterations most of the agents will only have one or two plans to choose from. I'd suggest you use only two strategies: ChangeExpBeta and ReRoute. You could go with a weight of 0.7 and 0.3.

You could try to run more iterations e.g. 50, and see whether this makes any difference.

Also, your countsScaleFactor is 1, while your flowCapacityFactor is 0.2 and your storageCapacityFactor is 0.3. If you are trying to run a 10%-Sample you would have to adjust your countsScaleFactor accordingly, to e.g. 10. Cadyts caps its correction terms at a certain threshold. If you miss all your calibrated items, so that for all of them the correction term is capped, the applied correction terms might cancel each other out.

Maybe this helps.

jiao1997 commented 4 years ago

So, looking at your config file, my guess is that you still don't have your strategies right. You are only running 10 iterations but you let your agents remember nice plans, while only 30% of your population will generate new plans (through ReRoute-Strategy). After 10 Iterations most of the agents will only have one or two plans to choose from. I'd suggest you use only two strategies: ChangeExpBeta and ReRoute. You could go with a weight of 0.7 and 0.3.

You could try to run more iterations e.g. 50, and see whether this makes any difference.

Also, your countsScaleFactor is 1, while your flowCapacityFactor is 0.2 and your storageCapacityFactor is 0.3. If you are trying to run a 10%-Sample you would have to adjust your countsScaleFactor accordingly, to e.g. 10. Cadyts caps its correction terms at a certain threshold. If you miss all your calibrated items, so that for all of them the correction term is capped, the applied correction terms might cancel each other out.

Maybe this helps.

Thanks for your advice. I will try it again. Best Wishes.