求教关于 Arena simulation

艾嘎嘎  •   •  70519 次浏览

请问初始排队人数要在哪里赋值呢?
我们现在碰到的问题是service time 时间间隔>=new comer进来排队的时间间隔,如果不加初始排队人数,server utilisation就会总是0。和小伙伴找了一圈都没找到哪里赋这个值。
求指点~
---

40 条回复
  • lm787
    #1

    Attributes 或 Variables 那找一找ATTRIBUTES:andVARIABLES:These elements provide general information about the symbolic names and properties of the attributes and variables. The operands of the elements includeNumber(optional),Name (index), Initial Values.The second operand is used to specify an array with certain index values. Each element in the array has a unique index value, which is stored in a common array name. The third variable is used to initialize a variable to a certain value.ATTRIBUTES:andVARIABLES:These elements provide general information about the symbolic names and properties of the attributes and variables. The operands of the elements includeNumber(optional),Name (index), Initial Values.The second operand is used to specify an array with certain index values. Each element in the array has a unique index value, which is stored in a common array name. The third variable is used to initialize a variable to a certain value.

  • lm787
    #2

    如初始排队人数=6,CREATE Module - Entity per Arrival: 6, Max Arrival: 6

    那这个extra的CREATE Module只在0.0时产生6个排队人数。看看可以么?

     

    那这个extra的CREATE Module只在0.0时产生6个排队人数。看看可以么?

     

  • 艾嘎嘎 楼主
    #3

    本来想上来回说entity per arrival不是产生初始值的设置,突然秒懂你的思路了。貌似可行,容我再试试。
    你用的是basic process,我们现在用的是common,我对他们之间确切的gap和替换关系还不是很熟,囧
    貌似可行,容我再试试。
    你用的是basic process,我们现在用的是common,我对他们之间确切的gap和替换关系还不是很熟,囧

  • lm787
    #4

    ARRIVAL Module - Batch Size: 6, Max Batchs: 6?


  • 艾嘎嘎 楼主
    #5

    谢谢~好详细~想确认一下你在3楼所讲的思路,是不是:
    Arrival (新队列)-->arrival(初始队列)-->station/server(depend on system)?
    如果是的话,嗯,我昨天也试着给这个多加的arrival赋值了。不过我试的data是:
    Batch size: 30 (assume initial queue is 30 persons)
    Time between arrival: any distribution sice this is a one-time figure (?) like expo(5,0)
    Max. batches: 1 (bcoz of one-time figure)
    Leave time data:
    station: station name
    (Seems your version is different from my student version. Mine has station input in the leave time data.)
    不过发现arrival是单向连接,本来我们根据排队人数就有个arrival,这样两个arrival 就无法连接起来了。用两个create也有这个问题。
    想了下,不知是不是可以用station或queue或别的东东?那么系统就会是这样:
    New comer (arrival)-->initial Q(Q/station or?)-->station/server-->process--> departure。
    或者有没有什么可以设priority的地方,让系统先处理arrival 1(假设此队优先,或当成是之前遗留的任务),完了再处理新来的队列?
    Arena tool 里有个Q 功能,不过我还没用过,得回家再研究下是不是可以用在这里,我们用common的时候Q会自动出现在server的。想确认一下你在3楼所讲的思路,是不是:
    Arrival (新队列)-->arrival(初始队列)-->station/server(depend on system)?
    如果是的话,嗯,我昨天也试着给这个多加的arrival赋值了。不过我试的data是:
    Batch size: 30 (assume initial queue is 30 persons)
    Time between arrival: any distribution sice this is a one-time figure (?) like expo(5,0)
    Max. batches: 1 (bcoz of one-time figure)
    Leave time data:
    station: station name
    (Seems your version is different from my student version. Mine has station input in the leave time data.)
    不过发现arrival是单向连接,本来我们根据排队人数就有个arrival,这样两个arrival 就无法连接起来了。用两个create也有这个问题。
    想了下,不知是不是可以用station或queue或别的东东?那么系统就会是这样:
    New comer (arrival)-->initial Q(Q/station or?)-->station/server-->process--> departure。
    或者有没有什么可以设priority的地方,让系统先处理arrival 1(假设此队优先,或当成是之前遗留的任务),完了再处理新来的队列?
    Arena tool 里有个Q 功能,不过我还没用过,得回家再研究下是不是可以用在这里,我们用common的时候Q会自动出现在server的。

  • lm787
    #6

    好像多个Create Module/Arrival Module可以连到同一个Queue

     

    Youtube: http://www.youtube.com/watch?v=StRBwpi2Flk

     

    Youtube: http://www.youtube.com/watch?v=StRBwpi2Flk

  • 艾嘎嘎 楼主
    #7

    嗯,看起来是可以连不过还是没法设置初始值或优先级别。level 1~5 = type 1~5不过还是没法设置初始值或优先级别。level 1~5 = type 1~5

  • lm787
    #8

    请看这个

    Student version是不是没有Common Process?  刚下了这个软件,只有Basic Module。  用Create和Process modules做了一个。Queue附加在Process里。Create1可作为初始设置(Entities per Arrival: 5, Max Arrival: 1).  Create2(Entities per Arrival: 1, Max Arrival: infinite).  那在time=0的时候,Create1产生5个arrival, Create产生1个arrival,总共6个。

     

     

     

    用Step(F10)跑一下,确实在time=0时产生了6个arrival (5 from Create 1 and 1 from Create 2).

    Student version是不是没有Common Process?  刚下了这个软件,只有Basic Module。  用Create和Process modules做了一个。Queue附加在Process里。Create1可作为初始设置(Entities per Arrival: 5, Max Arrival: 1).  Create2(Entities per Arrival: 1, Max Arrival: infinite).  那在time=0的时候,Create1产生5个arrival, Create产生1个arrival,总共6个。

     

     

     

    用Step(F10)跑一下,确实在time=0时产生了6个arrival (5 from Create 1 and 1 from Create 2).

  • 艾嘎嘎 楼主
    #9

    对,就是要这个,太感谢了~好聪明的点子~
    还能再问吗?我还有好多疑问啊,这几天做得脸青青的还是跑不出来,真是痛苦。
    是这样的,我们的系统是一条队列3个resource,哪个resource有空就到哪个。
    有两个小伙伴做了模型,但我觉得他们做的不太对,因为他们都把队列按百分比分配到resource,而我认为应该是随机,或者cyclicly seize available resources,这样才能反映真正的系统运作。另外百分比很可能会随人数和时间的不同有所变化,所以不该假设分配的百分比。
    我想象中的模型应该有/显示这些:
    1,到达:初始人数若干,新来的人服从采集数据的distribution
    ---这个用你的办法解决了。
    2,共享队列:
    试过用Queue,不过没法和create/process连接,放弃。
    试过用Process,选择delay,那delay的分布该用什么呢?试用constant=1好像也不对。不知是不是这个想法不对?
    3,分别显示3个resource:
    试用过一个process with 3 resources, but only one distribution can be applied. This is not the fact. Because each resource has its own processing time distribution.而且也只能看到一个process在跑,看不到3个resource.
    Also tried using 3 processes to represent the 3 resources, then the connection is problem again: each process can connect to one module only,e.g.,Create--process-disposal, no Create--processes--disposals can be accepted.
    Have you any idea? Thks~

    BTW,in student version the common template is not default one but can be added by going to: file--template --attach--select the common template.好聪明的点子~
    还能再问吗?我还有好多疑问啊,这几天做得脸青青的还是跑不出来,真是痛苦。
    是这样的,我们的系统是一条队列3个resource,哪个resource有空就到哪个。
    有两个小伙伴做了模型,但我觉得他们做的不太对,因为他们都把队列按百分比分配到resource,而我认为应该是随机,或者cyclicly seize available resources,这样才能反映真正的系统运作。另外百分比很可能会随人数和时间的不同有所变化,所以不该假设分配的百分比。
    我想象中的模型应该有/显示这些:
    1,到达:初始人数若干,新来的人服从采集数据的distribution
    ---这个用你的办法解决了。
    2,共享队列:
    试过用Queue,不过没法和create/process连接,放弃。
    试过用Process,选择delay,那delay的分布该用什么呢?试用constant=1好像也不对。不知是不是这个想法不对?
    3,分别显示3个resource:
    试用过一个process with 3 resources, but only one distribution can be applied. This is not the fact. Because each resource has its own processing time distribution.而且也只能看到一个process在跑,看不到3个resource.
    Also tried using 3 processes to represent the 3 resources, then the connection is problem again: each process can connect to one module only,e.g.,Create--process-disposal, no Create--processes--disposals can be accepted.
    Have you any idea? Thks~

    BTW,in student version the common template is not default one but can be added by going to: file--template --attach--select the common template.

  • lm787
    #10

    参考这个,共享队列可用Seize-Delay(with delay 0)实现

    Multiple resources with different service time distribution要今晚再想想 - 不知Basic Module能做么,需要用比较Advanced的么。

     

     

    Multiple resources with different service time distribution要今晚再想想 - 不知Basic Module能做么,需要用比较Advanced的么。

     

     

  • 艾嘎嘎 楼主
    #11

    共享队列搞定~上张图

     

    现在的关键就是怎么定decide的规则了.

    这张图里我用的是entity type为条件进行分流,全部设为entity 2, 这是不对的。结果只有一个人进入服务柜台,其他人一直在等。

    查了一圈,我觉得decide里的attribute和variable 可能是突破口。现在能想到的是,能不能设3 attributes and let them equal to each counter's queue no.. 

    E.g. attribute 1=counter 1.queue; attribute 2=counter 2.queue;attribute 3=counter 3.queue

    In decide conditions, if attribute 1 =0, the queuing element will go to counter 1.

    Do likewise for the counter 2 & counter 3.

    可是我不懂怎么去设一个全新的attribute和counter 1.queue连接起来:-(   你有办法吗?

    或者有别的更简单易行的法子?

    上张图

     

    现在的关键就是怎么定decide的规则了.

    这张图里我用的是entity type为条件进行分流,全部设为entity 2, 这是不对的。结果只有一个人进入服务柜台,其他人一直在等。

    查了一圈,我觉得decide里的attribute和variable 可能是突破口。现在能想到的是,能不能设3 attributes and let them equal to each counter's queue no.. 

    E.g. attribute 1=counter 1.queue; attribute 2=counter 2.queue;attribute 3=counter 3.queue

    In decide conditions, if attribute 1 =0, the queuing element will go to counter 1.

    Do likewise for the counter 2 & counter 3.

    可是我不懂怎么去设一个全新的attribute和counter 1.queue连接起来:-(   你有办法吗?

    或者有别的更简单易行的法子?

  • 艾嘎嘎 楼主
    #12

    更正试了一下可能用expression是其中一个方法。Attribute & variable not sure. 不过它的expression有专门的语法,比如柜台1队列长度小于1是 NQ(Counter 2.Queue).LE.1 (注意不是和attribute/variable一样用 if x<=y 的格式)。 不懂语法抓瞎中,到底哪里有这些语法啊,expression builder里面也不是这种啊

  • lm787
    #13

    我的student version好像比你的新我的Common Module已经被outdated了,改用Advanced Module. 设计图站短你了。你看看这个idea行不行。

  • lm787
    #14

    忘了贴一个有启发性的链接你们课本的这一章挺不错的:Intermediate Modeling and Terminating Statistical Analysis

    http://nsl.pnu.edu/lecture/MAutomation/simulation06.pdf

    主要思路就是:
    1。3 Resources are defined in the same Set
    2. Seize module acts as a queue waiting for a resource in the set
    3. Once one or more resources are available, seize one either randomly or cyclically
    4. Save the resource No. in an Attribute
    5. Decide through the attribute related to the resource No.
    6. Delay then release the seized resource

    详情看看站短你的设计图。
    你们课本的这一章挺不错的:Intermediate Modeling and Terminating Statistical Analysis

    http://nsl.pnu.edu/lecture/MAutomation/simulation06.pdf

    主要思路就是:
    1。3 Resources are defined in the same Set
    2. Seize module acts as a queue waiting for a resource in the set
    3. Once one or more resources are available, seize one either randomly or cyclically
    4. Save the resource No. in an Attribute
    5. Decide through the attribute related to the resource No.
    6. Delay then release the seized resource

    详情看看站短你的设计图。

  • 艾嘎嘎 楼主
    #15

    耶~~跑出来了~~万分感谢~!

    我的student version确实没有advanced module, 不过我用basic module 修修改改一下貌似也还行

    现在还有个疑问是run time设不好的话会有个 error,用你随便设的 expo( )或用我们采集数据fit出来的分布都有这个问题。

    请看图:

     

     

    比如说设置run time=60mins 就出现这个error, run time=30mins就可以过关。

    你跑的时候会有这个问题吗?不会是因为我的basic module设置有局限造就的吧?还是因为seize resource时间太长?因为明明看到队列很长,空出来的resource也没有马上被新entity seized掉,这个可以在step run里看得很清楚。

    另外,Delay 1/2/3不应该再出现排队情况,可是在查看step时还是会看到有2个在同一个Delay(resource)的情况,这是怎么回事呢?

     

  • 艾嘎嘎 楼主
    #16

    谢谢~~呆会要好好看看,说不定晚上就会用到。
    扫了一眼,sets功能好像很不错啊,你贴的视频里提到很强大,你的solution也用了这个,可是我们老师都没讲过:( 而且上课的例题用common module, 书里的例题是basic module, 把我搞得一愣一愣的。
    还好有你~谢谢啊~呆会要好好看看,说不定晚上就会用到。
    扫了一眼,sets功能好像很不错啊,你贴的视频里提到很强大,你的solution也用了这个,可是我们老师都没讲过:( 而且上课的例题用common module, 书里的例题是basic module, 把我搞得一愣一愣的。
    还好有你~谢谢啊~

  • lm787
    #17

    我的可以一直跑没有error, delay module没有看到排队排队都在Seize module. 你的delay module是在Basic还是Common template选的?我的是Advanced里的。要不你把Delay的Setting贴上来,我晚上看看。

  • 艾嘎嘎 楼主
    #18

    不好意思,下课回来晚了。。。

    我的Delay是在 Basic Template选的。

    请看:

     

    考虑到红框里可以看到delay的设置,我只把seize的细节窗口打开了。no “seize” in basic template, so "seize & delay" was usedcould it be the reason? but the delay has been set to constant 0.

    不大会编辑图片而且时间也有点晚,凑合看看,不好意思啊

     

  • lm787
    #19

    有可能其中一个Release的Resource没选对,那两个Release+Delay可以用一个Process代替你的设计图上没发现问题,可能其中一个Release的Resource没选对。

    刚发现你用Basic Template里面的Process implement了我现在version的Advanced Template里的Delay和Release, 好办法。想一下可以用一个Process (with action as Delay and Release)代替这两个。

     

  • 艾嘎嘎 楼主
    #20

    查了一下选择是对的

    一到第52分钟就出问题,不知怎么回事。

     两个人排在同一个Delay的图(还没合起来)

     

    用common template做了个,跑出来倒是没问题,就是动画显示不出,讨厌~不知道是不是太快了,即使调到最慢也还是飞快。图:

     

    更怪的是,两个模型跑同样的分布同样的时间,basic模型下dispose 43人,common模型下dispose 38人,晕了~

    一开始还觉得挺好玩,多玩两次新鲜劲都被磨光光了,哎。。。。 (你一定觉得更烦吧

  • lm787
    #21

    没事的,只差一点点了

    其实simulation很有用的,我特别喜欢simulation. 可以debug一下。你熟悉debug后就不会frustrated了。

     

     1。Enable Runtime Element Bar

     

    2. Error message是“Attempt to release non-busy resource 1" at time 59.462612.  有两种可能:

    1。有两个Release  block在release Resource 1.

    2. Decide block连接的Delay-Release block跟condition不一致。

     

    你可以用Step然后观察发生error前在什么情况下Resource 1被release了。

     

     

     

  • lm787
    #22

    你可以把Create Entities的Exp()的时间调小那产生Entity的速度加快, 系统比较busy. 在出错时只会有一个idle的Delay block. 跟在这个Delay block的Release block在release Resource 1.

  • lm787
    #23

    debug方法 - breakpoints

     

     

     

     

     

     因为程序问题出在Delay 1有两个Entities,

     

     

    Run Simulation

     

     

     

     

    可以看出Delay Release 2: number in process = 0, Delay Release 1: number in process = 2, Resource 2: Busy.

  • 艾嘎嘎 楼主
    #24

    好详细啊,非常有用,感谢~~既然出错的原因是因为Resource和Delay Release状况不一致,那为什么会出现这样的不一致呢?带着这个问题仔细又查了一下,总算知道根源了。总结一下碰到的会出现这种error的情况:1,一个Decide时里面条件设置出错:在昨天那个模型里粗心地把Attribute设错了,应该是Resourc#==2, but set wrongly to Resource#<=2 居然查不出(汗2,两个Decide时,以下图为例(我们今天碰头时修改过的模型)

    第一层条件下只有两个选择,如果条件为True时去Counter 1~3,那么应该选2-way condition instead of 2-way by chance with condition setting of Resource#<=3,选2-way by chance会出错。

    第二层条件下有多项选择,那么就要注意else在Decide图标的哪里,一般是在最下面的分支,但不知为什么下图的模型中它跑到平时第二个选择的位置了(可能是因为曾经增删过条件导致默认顺序改变?),从数据的位置来说else一般指向的是自然次序最后一位数据,所以要相应地改变condition的次序,比如正常情况下设置Resource#==1 & Resource#==2,现在就要改成Resource#==1 & Resource#==3,否则出错。

    总而言之,出现这个问题的原因是pointer指向不对,所以会出现一个资源的element跑到另一个资源去,然后系统就混乱了。

  • 艾嘎嘎 楼主
    #25

    Entity creation follows the distribution我觉得不能改。你觉得呢?

  • 艾嘎嘎 楼主
    #26

    握手~同觉得很有用而且是我喜欢玩的东东~~虽然一开始看也没看过纯粹觉得好奇和感兴趣就选了~~ 其实有时间的话也很喜欢分析和解决这种问题,只是最近工作和生活都出现了变动作业又做不完然后鸭梨山大一紧张就没耐心了。。。不过想想被我追着问好像烦的该是你就不大好意思了 :PPP 谢谢啊~现在basic模板做出来的模型搞定了(今天才发现原来也可以通过attach添加advance模板的,之前我眼睛到底喵的哪里啊汗。。。),只是common模板做出来的模型animation 跑不出而且没法把速度调下来,还在皱眉中 内个,有木有兴趣做做我们的测验题啊?:)

  • lm787
    #27

    是的,这个办法帮助不大。原来只是想偷懒不研究debug function[…]。把interarrival time减少,系统越快出错而已。。。

  • lm787
    #28

    你们的测验题是MAE-specific的么? 我不是这个专业,不在行啊。[…]但如果是课上遇到不行业-specific的问题,我可以尝试一下看懂不懂。

  • 艾嘎嘎 楼主
    #29

    啊,我不是想到这个这是分布收敛方面的考虑吧?这么高深的事情我哪里懂(瀑布汗。。。。 我想到的只是Create Entity的分布式子是采集数据合成出来的,不能随便改,否则会和现实系统不一样,结果也会有偏差,而已。。。

  • 艾嘎嘎 楼主
    #30

    不是行业的,是Arena simulation这门课的测验题周四考的,我做不出来,出来问了一圈还没问到做出来的人。 好想知道要怎么做呀~可是我没时间研究了,要去赶别的作业囧。。。。

  • lm787
    #31

    那可以,你贴上来我看看

  • 艾嘎嘎 楼主
    #32

    更正一下2-way by chance 也是可能发生的情况,不应该通过抛弃这个选项消除错误信息。能想到的是也许应该通过设置多一层set来进行选择并进行相应调整,可是还试不出来。 另外一直在想为什么多重选择中既然每个counter有独立的process time那为什么不可以在Delay时随便调换,总算想出来了,主要还是次序的问题,在seize的时候已经设置好set,除非调整index去适应连接,否则指向就会不一致。 回头看看其实都是很白痴的问题,可是对于电脑小白来说不懂系统规则就只能抓瞎,没人指点根本找不到头绪。

  • lm787
    #33

    你碰到的这个问题主要是Arena这个程序的设计引起的,用户只能在错误中学习适应每个人在用新程序是都会遇到的。最主要的是你通过这个学习到simulation的design, debug, analysis的精髓. 以后即便换个程序,你也可以迅速上手分析。我看你在这方面做得很好的啊。

  • lm787
    #34

    然后就是我们设计时就是“不管白猫黑猫”2-way by chance是basic setting, N-way by chance是advanced setting, 让你有更多flexibility. 你用N-way by chance是说明你比较熟悉这个程序了。

  • 艾嘎嘎 楼主
    #35

    (脸红能想通这些问题都是你的功劳啊~~没有你的详细解答和启发我根本不知道怎么入手。 谢谢啊谢谢~~(除了说谢真不知道要怎么表达感激了,要不哪天请你吃饭?:)) 对了,题目已短,谢谢~

  • 艾嘎嘎 楼主
    #36

    我还差好远。。。。第一个decide改成2-way by chance我还没能把系统改出来,等有空再研究了。 除了看得见的simulation部分,其实我对成本控制部分也很感兴趣,不过老师没讲到这部分运用,不知道做起来怎么样。玩这个的时候再找你请教下。

  • lm787
    #37

    每个人开头时都找不到清晰方向,别的人只是帮忙指个方向,省下起步时间融会贯通都是靠自己。看你学得确实是很快。 你们的题目好像很大啊,我一下子没时间研究。给你一个链接参考一下:http://www.courses.vcu.edu/MATH-jrm/OPER641/Slides/Chapter%2005.ppt PS. 不用谢,我是刚好做simulation的,喜欢研究这类问题。我也不在新加坡。

  • lm787
    #38

    OK

  • lm787
    #39

    站短你几个参考图了。

狮城帮

狮城帮是关于分享和探索新加坡的地方

马上注册

已注册用户请 登录