




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
第一步:創(chuàng)建新模型(具體方法參照之前的模型)如圖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里面創(chuàng)建一個HistogramData,名為histWaitingTime)//I-=在checkDemands下的whileLoop的Condition中寫入demands.isEmpty(),LocalVariabledemandTypeotherDemandIniti//前需要在Main里面創(chuàng)建一個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的編輯區(qū)域,在左側(cè)模型下,點Retailer、WholesalerFactoryMain的編輯區(qū)域,并雙擊結(jié)構(gòu)將其連接起來,如圖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的具體數(shù)據(jù)如圖13:圖GeneralVariabledemandSizeDitsribution,Type選other,文本框內(nèi)寫入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,加入一個數(shù)據(jù),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右邊相應(yīng)的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將其創(chuàng)建一個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向新創(chuàng)建的OptimizationSimulation的區(qū)域內(nèi)拖入三個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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 醫(yī)學(xué)影像學(xué)考試題庫及答題技巧
- 食品營養(yǎng)學(xué)食品與健康知識梳理與試題集
- 年度成果與未來計劃-CCTV未來廣告公司匯報
- 2025年征信考試題庫(征信產(chǎn)品)創(chuàng)新設(shè)計與應(yīng)用試題卷
- 2025年征信信用評級信息真實性驗證考試:專題試題
- 2025年英語翻譯資格考試筆譯模擬試卷(翻譯職業(yè)規(guī)劃)
- 2025年阿拉伯語水平測試模擬試卷:阿拉伯語專業(yè)八級模擬試題
- 2025年高壓電工實操技能考試:高壓設(shè)備維護保養(yǎng)計劃與設(shè)備維護保養(yǎng)技術(shù)標準試題
- 2025年消防執(zhí)業(yè)資格考試題庫:消防應(yīng)急救援裝備法律法規(guī)與標準試題
- 2025年帆船教練職業(yè)考試試卷:帆船航海日志與記錄規(guī)范
- 《軟件工程導(dǎo)論》期末復(fù)習(xí)考試題庫(帶答案)
- 《建筑工程計量與計價》中職全套教學(xué)課件
- 反應(yīng)釜50L驗證方案
- 2024年江蘇省宿遷市泗陽縣中考數(shù)學(xué)一模試卷
- 張偉《精彩紛呈的太空科學(xué)實驗》課件
- 政協(xié)企業(yè)走訪方案
- 110kV變電站及其配電系統(tǒng)的設(shè)計-畢業(yè)論文
- 2024年低壓電工資格考試必考重點題庫及答案(完整版)
- 湖南省張家界市慈利縣2023-2024學(xué)年三年級下學(xué)期期中考試數(shù)學(xué)試題
- 2024年北京市燕山區(qū)九年級(初三)一模英語試卷及答案
- +廣東省深圳市寶安區(qū)十校聯(lián)考2023-2024學(xué)年七年級下學(xué)期期中數(shù)學(xué)試卷+
評論
0/150
提交評論