最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

anylogic - How to enable or disable a specific road in road traffic library programmatically - Stack Overflow

programmeradmin4浏览0评论

Is there any way to programmatically enable or disable a road in a road network using AnyLogic road traffic library? in order to correspond "using/not using the road" to a parameter and checking what should happen in both scenarios?

Is there any way to programmatically enable or disable a road in a road network using AnyLogic road traffic library? in order to correspond "using/not using the road" to a parameter and checking what should happen in both scenarios?

Share Improve this question edited Jan 20 at 8:52 Benjamin 12.8k3 gold badges18 silver badges33 bronze badges asked Jan 20 at 8:02 Mohammad Hasan N.Mohammad Hasan N. 2242 silver badges12 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

During execution time, you cannot enable/disable a road and re-route traffic.

You could in theory place signals/stop lines before the road and set them to SIGNAL_RED which will disable traffic, but all cars will still be routed there and just wait at the signal or stop line.

It is also possible to build networks programatically during model creation. At this step, it is possible to add/remove roads from the road network. So it is possible that you have a roadNetwork1 that you clone at startup as roadNetwork2 without that one road. You could even source the cars on each road network differently to compare - but again, any manipulation on the network must be done before the simulation starts running (at the startup of the model). It is not possible to dynamically change a network after the model has started.

EDIT: You can manually control car destinations during execution, if you need, by using a SelectOutput

Not via roads directly, afaik.

Here is what you can do:

  1. Elevate your entire model into a custom agent type (whatever is on Main is moved to a new agent type MyModel)
  2. Duplicate MyModel into another agent type MyModelRoadClosed .Adjust it to have the road removed
  3. instantiate each once in Main
  4. Compare and have fun watching 2 models at once

If the manual changes are too many, start creating roads and networks programmatically at the model start, 100% possible

发布评论

评论列表(0)

  1. 暂无评论