版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第一步:创建新模型(具体方法参照之前的模型)如图1所示:图并命名为Demand,点击Next。图publicpublicclassOrderimplementsjava.io.Serializable{Order(inta,Port<?,?>dest){ amount= destination=intPort<?,?>publicStringtoString() return"Order["+Utilities.format(amount)+"]from"+*Thisnumberishereformodelsnapshotstoring*Itneedstobechangedwhenthisclassgets }publicclassShipmentimplementspublicclassShipmentimplementsjava.io.SerializableShipment(inta) amount=intpublicStringtoString() return"Shipment["+Utilities.format(amount)+*Thisnumberishereformodelsnapshotstoring*ItneedstobechangedwhenthisclassgetsprivatestaticfinallongserialVersionUID }intbd=for(Demandd:demandsbd+=returnRetailerGeneralVariable,命名为demands,用来每天的需求,在Collectionclass处选择intbd=for(Demandd:demandsbd+=returntoStringReturCodeStringStringstr=getFullName()+"-Retailer\n";str+="Inventoryparameters:\n";str+="s:\t"+format(s)+"\n";str+="S:\t"+format(S)+"\n";str+="Currentstate:\n";str+="Inventory:\t"+format(I)+str+="Orderbacklog["+format(demands.size())+"]:\n";for(inti=0;i<demands.size();i++)str+=" "+format(i)+":"+demands.get(i)+"\n";returnstr;从General中拖入六个Parameter,分别命名为s、S、OrderSetCost、sSTypeint,Defaultvalue2080,用来表示库存策shortageCostorderingCostDiscrete,Value为空。其余两个Continuousalue*ShortageCostPerItemPerDay图//前需要在Main里面创建一个HistogramData,名为histWaitingTime)//I-=在checkDemands下的whileLoop的Condition中写入demands.isEmpty(),LocalVariabledemandTypeotherDemandIniti//前需要在Main里面创建一个HistogramData,名为histWaitingTime)//I-=demand.amount-=demand.amount-=I=0;portWholesaler.send(newOrder(O,portWholesaler));expected+=O;orderingCost.add(OrderSetupCost+O*OrderCostPerItem在orderFromWholesaler下的LocalVariableIEBType选择intInitialvalueportWholesaler.send(newOrder(O,portWholesaler));expected+=O;orderingCost.add(OrderSetupCost+O*OrderCostPerItem利用Presentation中的部件在两个Port之间画出如图7的图案,并勾中图Object,Onreceivedemands.addLastmsgI+=msg.amount;expectedmsg.amount;在portWholesaler中,InI+=msg.amount;expectedmsg.amount;shipmentypedetintionypeActiondestination.receive(shipment);General700Collectionorders,Collectionclassintbo=0;for(Ordero:ordersbo+=o.amount;returnbo;General中拖入三个Functionintbo=0;for(Ordero:ordersbo+=o.amount;returnbo;Stringstr=getFullName()+"-Stringstr=getFullName()+"-Wholesaler\n";str+="Inventoryparameters:\n";str+="s:\t"+format(s)+"\n";str+="S:\t"+format(S)+"\n";str+="Currentstate:\n";str+="Inventory:\t"+format(I)+str+="Orderbacklog["+format(orders.size())+"]:\n";for(inti=0;i<orders.size();i++)str+=" "+format(i)+":"+orders.get(i)+"\n";returnstr;getAmountBeingShipedReturntypeint,Codereturn0;inta=for(DynamicEventde:getDynamicEvents()a+=((Delivery)de).shipment.amount;returna;GeneralParameters、S、OrderSetupCost、其中s和S的Type为intDefaultvalue为20和80,其余的Type为double,Defaultvalue为40、4、1.25、6。再从ysis中拖入三个statistics,分别命名为orderingCostholdingCostshortageCostorderingCostDiscrete,Value为空。其余的选Continuous,ValueI*HoldingCostPerItemPerDaybacklog()*图Shipmentshipment=newShipment(order.amount);create_Delivery(uniform(0.25,0.5)*day(),shipment,order.destination);I-=checkOrderwhileLoop里面,Condition为orders.isEmpty(),下面LocalVariableorderShipmentshipment=newShipment(order.amount);create_Delivery(uniform(0.25,0.5)*day(),shipment,order.destination);I-=LocalVariableIEBTypeint,InitialvalueIexpected////portFactory.send(newOrder(O,portFactory)expectedO;orderingCost.add(OrderSetupCost+O*OrderCostPerItem若为False,则和True一起进入下段代码,在Code处写入RetailerGeneralPort图在portRetailers中Inmessagetype选择Order,Outmessagetype选择在portFactory中,Inmessagetype选择Shipment,Outmessagetype选择Order,Onreceive中写入I+=msg.amount;expected-=msg.amount;点击General,拖入两个DynamicEvent,分别命名为Delivery和destination.receiveshipment在Manufacturing中,Parameters下的Name下面写入amount,Type为int,Action处写入I+=amount;和从General中拖入一个Variable,命名为I,Type选择int,Initialvalue为70。再拖入一个CollectionVariable,命名为orders,Collectionclass选择java.util.LinkedList,Elementsclass选择Obo=0;for(for(Ordero:ordersbo+=o.amount;returnbo;StringStringstr=getFullName()+"-Factory\n";str+="Inventory parameters:\n";str+="s:\t"+format(s)+"\n";str+="S:\t"+format(S)+"\n";str+="Currentstate:\n";str+="Inventory:\t"+format(I)+str+="Orderbacklog["+format(orders.size())+"]:\n";for(inti=0;i<orders.size();i++)str+=" "+format(i)+":"+orders.get(i)+"\n";returnstr;return0;inta=for(DynamicEventde:getDynamicEvents()if(deinstanceofDeliverya+=((Delivery)de).shipment.amount;returna;ShortageCostPerItemPerDay。s和S的Type选择int,Defaultvalue分别为20空。其余的选择Continuous,Value处写入I*HoldingCostPerItemPerDay和backlog()*ShortageCostPerItemPerDay。图Shipmentshipment=newShipment(order.amount);create_Delivery(uniform(0.5,Shipmentshipment=newShipment(order.amount);create_Delivery(uniform(0.5,1)*day(),shipment,order.destination);I-=M的Initialvalue处写入IBsSIB0,第二个Decision判断的Condition为doubletM=1*hour()+M*0.01*hour();if(tM>=day())error("Manufacturingwilltakemorethan1day");create_Manufacturing(tM,M);manufacturingCost.add(ManufacturingSetupCost+M*ManufacturingCostPerItem);图在port中,Inmessagetype选择Order,Outmessagetype选择Shipement,Onreceive中写入orders.addLast(msg);和shortageCost.update();。从General中拖入六个Parameter,分别命名为sLoRetailer、SHiRetailer、Defaultvalue分别为、、、、80.MainMain的编辑区域,在左侧模型下,点Retailer、WholesalerFactoryMain的编辑区域,并双击结构将其连接起来,如图12:图填入SHiRetailer、SHiWholesaler和SHiFactory。General中拖入两个Event,分别命名为beginningOfDay和TimeoutMode十四点,Recurrencetime写入1*day(),Action中写入选择Rate,Rate10/day(),Action处写入Demand((int)demandSizeDitsribution.get(),time())GeneralTableFunctiondemandSizeProbability,勾StaticInterpolationNone,OutofRangeError,TableData的具体数据如图13:图GeneralVariabledemandSizeDitsribution,Type选other,文本框内写入CustomDistribution,InitialvaluenewCustomDistributiondemandSizeProbabilitygetDefaultRandomGenerator()。从ysis中拖入一个HistogramData,命名为histWaitingTime,Numberintervalsize为0.01。doublecost=cost+=retailer.orderingCost.sum();cost+=retailer.holdingCegral();cost+=doublecost=cost+=retailer.orderingCost.sum();cost+=retailer.holdingCegral();cost+=retailer.shortageCegral();cost+=wholesaler.orderingCost.sum();cost+=wholesaler.holdingCegral();cost+=wholesaler.shortageCegral();cost+=factory.manufacturingCost.sum();cost+=factory.holdingCegral();cost+=factory.shortageCegral();returncost/365;图15Grou处选择)Dynamic的Replicationretailer.demands.size(),X处写入-index*3,InventoryRectangleReplicationretailer.I,X-1)/20*3–1,下面的红线的Y写入-((retailer.s+1)/20*3-2)。 的Orders 处的rectangle 的Replication 处填写wholesaler.orders.size(),X处填写-index*3,Inventory处的rectangle的Replication写入wholesaler.I,X写入(index%20)*3,Y写入-(index/20*3Dynamic的Y写入wholesaler.S120*31,下Y写入-((wholesaler.s+1)/20*3-2)。FactoryOrderrectangleReplication处写入factory.orders.size()X处写入-index*3InventoryRectangle的Replicationfactory.I,X写index20*3,Y写index20*3,上方的红线的Y写factory.S120*31Y写入factory.s120*32图从Controls中拖入一个Button,Label处写Closerun,Action处写getEngine().stop();Dynamic中的Visiable中写入getEngine().getState(从ysis中,拖入一个TimePlot,命名为plot,需要加入三个Data,Value,TitleRetailer、WholesalerFactory,Value分别factor.ITime365DislatestsamplesGeneralEventplotUpdateEvent,TimeoutModeCyclicFirst选择第二个,时间选择上面选择的某一天的23:59:59。Recurrencetime写入1*day(),Action为plot.updateData()。从ysis拖入一HistogramShowPDF,加入一个数据,Title为WaitingTime(days),HistogramhistWaitingTime。再从ysis拖入StackChartdata,ScaleFixed,to1000。dataTitleOrdering、HoldingShortage,Value分别为retailer.orderingCost.sum()/365、retailer.holdingCost.mean()和retailer.shortageCost.mean()dataTitle分别为Ordering、HoldingShortage,Valuewholesaler.orderingCost.sum()/365、wholesaler.holdingCost.mean()wholesaler.shortageCost.mean()。第三个factory.manufacturingCost.sum()/365factory.holdingCost.mean()和<sLoRetailer||SHiWholesaler<sLoWholesaler||SHiFactory<sLoFactory)error("Invalidparametervalues!");SimulationMain从General中拖入六个Variable,分别命名为sLoRetailer、SHiRetailer、Defaultvalue分别为 、、、、和80。再从General中拖入五个Collection,分别命名为retailerParamertersHistory、meanDailyCostHistory和waitingTimeHistory,Collectionclass都选择图六个Slider的Minimumvalue都为1, sLoWholesaler、SHiFactory和sLoFactory。在Slider右边相应的Text的Dynamic的Text处分别写入format(SHiRetailer)、format(sLoRetailer)、sLoRetailerSHiRetailersLoWholesalerSHiWholesalersLoFactorygetState()getState()==IDLEsLoRetailer<=SHiRetailer&&sLoWholesaler<=SHiWholesaler&&sLoFactory<=SHiFactory&&oot());oot());在右边的警示及文本的Group的Dynamic的Visible中写入sLoRetailer>SHiRetailer||sLoWholesalerSHiWholesaler||sLoFactorySHiFactory图案:并通过右键Grou将其创建一个Group。图+"."。RetailerTextDynamicReplication处写入retailerParamertersHistory.size(),Y处写入index*20,Text处写入retailerParamertersHistory.get(index)。WholesalerTextDynamic*20,TextwholeasalerParamertersHistory.get(index)。Factory下面Yindex*20,TextfactoryParamertersHistory.get(index)。再TextDynamicReplicationwaitingTimeHistory.size(),X490-min(150,waitingTimeHistory.get(index)*500)–5,Y处写入index*20,Text处写入format(waitingTimeHistory.get(index))。Meanwaitingtime下面的RectangleDynamicReplication处写入waitingTimeHistory.size(),X处写入490-min(150,waitingTimeHistory.get(index*500,Yindex*201,Width处写min(150,waitingTimeHistory.get(index)*500),上面的闪电状的Polyline的Dynamic的ReplicationwaitingTimeHistory.size()Y处填入index*204,LinecolorwaitingTimeHistory.get(index*500150whitenull。SupplychainmeandailycostRectangleDynamic的ReplicationmeanDailyCostHistory.size(),Yindex*201,Widthmin(240,meanDailyCostHistory.get(index)10),上面的闪电状的Polyline的Dynamic的ReplicationmeanDailyCostHistory.size()Y处填入index*4Linenull。最后一个TextDynamicReplication处写入meanDailyCostHistory.size()、X处写入500+min(240,format(meanDailyCostHistory.get(indexretailerParamertersHistory.add("("+sLoRetailer+","+SHiRetailer+")");wholeasalerParamertersHistory.add("("+sLoWholesaler+","+SHiWholesaler+")");retailerParamertersHistory.add("("+sLoRetailer+","+SHiRetailer+")");wholeasalerParamertersHistory.add("("+sLoWholesaler+","+SHiWholesaler+")");+")"ModeltimeStopStopatspecifieddateUseCalendar,在timeunit处选择Day。图Experimenttype下面选择OptimizationFinish从ysis向新创建的OptimizationSimulation的区域内拖入三个DataSet,分别命名为datasetCurrentObjective、datasetBestInfeasibleObjective和datasetBestFeasibleObjective,都选中Usei tionnumberashorizontalaxisvalue,并keepupto600latestsamples。在Verticalaxisvalue处分别填入getCurrentObjectiveValue()、bestInfeasibleObjective和getBestObjectiveValue(),其中只有datasetCurrentObjective选择Autoupdateaftereveryi 19:图format(sLoWholesaler)、format(SHiFactory)format(sLoFactory),并在Visible处都写入doesOptimizationExist()&&getCurrentItion()>0,在Best下面的Text的Dynamic的Text处从上到下从左到次写入format(getBestParamValue(_oqvar_SHiRetailer))、format(getBestParamValue(_oqvar_sLoRetailer))、format(getBestParamValue(_oqvar_SHiFactory))和((()Strings=s+="s[Retailer]\t"format(getBestParamValue(_oqvar_sLoRetailer))+"\n";s+="S[Retailer]\t"+format(getBestParamValue(_oqvar_SHiRetailer))+"\n";s+="s[Wholesaler]\t"+format(Strings=s+="s[Retailer]\t"format(getBestParamValue(_oqvar_sLoRetailer))+"\n";s+="S[Retailer]\t"+format(getBestParamValue(_oqvar_SHiRetailer))+"\n";s+="s[Wholesaler]\t"+format(getBestParamValue(_oqvar_sLoWholesaler))+"\n";s+="S[Wholesaler]\t"+format(getBestParamValue(_oqvar_SHiWholesaler))+"\n";s+="s[Factory]\t"+format(getBestParamValue(_oqvar_sLoFactory))+"\n";s+="S[Factory]\t"+format(getBestParam
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 简单公司场地租用合同
- 货车转让合同范本
- 消防维保合同书
- 购销日化用品的合同
- 氨-柴油双燃料发动机性能仿真及优化研究
- 一种新型义齿修复材料JSAM的生物相容性评价
- 2025年人教版拓展型课程化学下册阶段测试试卷含答案
- 2025年浙教版九年级历史下册月考试卷含答案
- 2025年湘师大新版七年级历史上册月考试卷含答案
- 2025年人教新起点必修3物理上册月考试卷
- 主题一:人文之美 第7课《天下第一大佛-乐山大佛》 课件
- 印度与阿拉伯的数学
- 口腔科院感知识培训针刺伤
- 会阴切开伤口裂开的护理查房
- 《钢铁是怎样炼成的》选择题100题(含答案)
- 2024年国新国际投资有限公司招聘笔试参考题库含答案解析
- 食堂餐厅服务方案投标方案(技术标)
- Creo-7.0基础教程-配套课件
- 六年级人教版上册数学计算题练习题(及答案)100解析
- 超声科质量控制制度及超声科图像质量评价细则
- 初中物理沪粤版八年级下册《第六章 力和机械》章节练习(含答案)
评论
0/150
提交评论