版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
AMPL编程主讲人:贾海成任意选修课IntroductionAMPL:AModelingLanguageforMathematicalProgrammingWebsite:解决最优化问题模型的计算机软件(30多种)IntroductionLINDO/LINGOExcelAMPL解决最优化问题模型的计算机软件IntroductionIntroductionIntroduction什么是最优化问题?所谓最优化问题一般是指按照给定的标准在某些约束条件下选取最优的解集。主要分支:线性规划、整数规划、二次规划、非线性规划、随机规划、动态规划、组合最优化、无限维最优化IntroductionAsimpletwo-variablelinearprogramASteelcompanytwoproducts:BandsandCoilsproductionrate(Tonsperhour):Bands200;Coils140.Profitmargin(Profitperton):Bands$25;Coils$30.
IntroductionIntroductionMathematicmodelIntroductionMaximizeSubjecttoSubjecttoSubjecttoHowtosolveit?Method1IntroductionMethod2IntroductionMethod2IntroductionMethod2IntroductionThetwo-variablelinearprograminAMPLProd0.modprod0.runIntroductionAddingonevariableASteelcompanyThreeproducts:Bands,CoilsandPlateProductionrate(Tonsperhour):Bands200;Coils140;Plate160.Profitmargin(Profitperton):Bands$25;Coils$30;Plate$29.
IntroductionIntroductionMathematicmodelIntroductionMaximizeSubjectto
Subjectto
Subjectto
Subjectto
varXB;varXC;varxp;maximizeProfit:25*XB+30*XC+29*xp;subjecttoTime:(1/200)*XB+(1/140)*XC+(1/160)*xp<=40;subjecttoB_limit:0<=XB<=6000;subjecttoC_limit:0<=XC<=4000;subjecttop_limit:0<=xp<=3500;Prod1.modIntroductionmodelprod1.mod;solve;displayXB,XC,xp;quit;Prod1.runIntroductionMINOS5.5:optimalsolutionfound.2iterations,objective196400XB=6000XC=0xp=1600ToolcompletedsuccessfullyresultsIntroductionIntroductionIntroductionIntroductionmodelprod.mod;dataprod.dat;solve;displayx;quit;prod.runIntroductionIntroductionContinuepreviousexample生产这三种钢材的工艺分为2个阶段:reheat/rolling,这2个阶段最大的可利用时间为每周35hours和40hours。Introduction数学模型Sets:P–asetofproductsS–asetofprocessesinproductionParameters
=profitperunitofproductj,=unitproductiontimeinstageJforproducti,=worktimeinweekly,=upperlimitonamountofproductjsoldinperiod,数学模型Variables:Xi=unitsofproductjtobeproducedJanuary,数学模型数学模型(1)
st(2)
(3)
IntroductionSteel2.modIntroductionSteel2.datDietproblem:minimizingcostsChapter2Dietproblem:minimizingcosts每包的单价Thedinnerprovidethefollowingpercentages,perpackage,oftheminimumdailyrequirementsforvitaminsA,C,B1andB2.Dietproblem:minimizingcostsTheproblemistofindthecheapestcombinationofpackagesthatwillmeetaweek’srequirements.Dietproblem:minimizingcostsDietproblem:minimizingcostsDietproblem:minimizingcostsDietproblem:minimizingcosts数学模型Dietproblem:minimizingcostsSets:P–asetofproductsI–asetofingredientsParameters:=unitcostforproductj,=percentageoftheminimumdailyrequirementforingredientiinoneunitofproductj,
Dietproblem:minimizingcosts=minimumweek’srequirement(inpercentage)foringredientiintheblend,=maximumweek’srequirement(inpercentage)foringredientiintheblend,
=lowerlimitonamountofproductjpurchasedperweek,
=upperlimitonamountofproductjpurchasedperweek,Dietproblem:minimizingcostsVariables:Xj=numberofunitsofproductjtobepurchasedperweek,Formulation:(1)
st(2)
(3)
AMPL程序Dietproblem:minimizingcostsDietproblem:minimizingcostsParamn_mindefault700;Paramn_maxdefault10000;Dietproblem:minimizingcosts计算结果?扩展:限定每种食物一周只能吃2-10包。同时增加对2种元素的考查:钠(Na)和热量(calories)各食物中Na的含量为:beef938,chk2180,fish945,ham278,mch1182,mtl896,spg1329,tur1397.Dietproblem:minimizingcosts扩展:1、限定每种食物一周只能吃2-10包。2、增加对2种元素的考查:钠(Na)和热量(calories)各食物中calories的含量为:beef295,chk770,fish440,ham430,mch315,mtl400,spg370,tur450.Dietproblem:minimizingcosts钠(Na)的最高摄取量为40000热量(calories)的摄取量范围为16000-24000。Dietproblem:minimizingcostsDietproblem:minimizingcostsVarbuy{jinFOOD}integer>=f_min[j],<=f_max[j];Dietproblem:minimizingcostsSupposethatwehavetoproducesteelcoilsatthreemilllocation,inthefollowingamounts:TransportationModelsTheseproductsmustbeshippedinvariousamountstomeetordersatsevenlocationsofautomobilefactories.TransportationModelsTransportationModelsShippingcostspertonisgiveninbelowTransportationModelsWhatistheleastexpensiveplanforshippingthecoilsfrommillstoplans?TransportationModelsTransportationModelsTransportationModelsTransportationModelsMathematicmodelTransportationModels
supposethatweareshippingseveraldifferentproducts:bands,coils,plate.AmulticommoditytransportationmodelTheseproductsareproducedatthreemilllocationsGARYCLEVPITTBands400700800Coils80016001800plate200300300AmulticommoditytransportationmodelAmulticommoditytransportationmodelThedemandsofsevenautomobilefactoriesFRADETLANWINSTLFRELAFbands30030010075650225250Coils500750400250950850500plate100100050200100250AmulticommoditytransportationmodelTotalamountsofshipmentsfromoriginstodestinationsofallproductsmaynotexceed625tons.AmulticommoditytransportationmodelShippingcostspertonsTobandsFRADETLANWINSTLFRELAFGARY301081011716CLEV227107218213PITT19111210258315AmulticommoditytransportationmodelShippingcostspertonsTocoilsFRADETLANWINSTLFRELAFGARY3914111416828CLEV279129269517PITT24141713289920AmulticommoditytransportationmodelShippingcostspertonsToplateFRADETLANWINSTLFRELAFGARY4115121617868CLEV299139289918PITT261417133110420MathematicmodelAmulticommoditytransportationmodelAddanewparameterThefixcostoftransportationfromorigintodestinationAmulticommoditytransportationmodel线性规划模型的敏感性分析例1.某工厂在计划期内要安排I、II两种产品的生产,已知生产单位产品所需的设备台时及A、B两种原材料的消耗,以及资源的限制,如下表所示。III资源限制设备11300台时原料A21400kg原料B01250kg线性规划模型的敏感性分析该工厂每生产一单位产品I可获利50元,每生产一单位产品II可获利100元,问工厂应分别生产多少个I产品和II产品才能使工厂获利最多?线性规划模型的敏感性分析1、加载CPLEX组建,(敏感性分析和binary变量都可以用)optionsolvercplex;2、敏感性分析:optioncplex_options'sensitivity';线性规划模型的敏感性分析5、敏感性分析的各值:变量:
*.lb——指该值(变量或限制条件)的下限(lowerbound)*.ub——指该值(变量或限制条件)的上限(upperbound)*.slack——指当前值与上限或下限的差值。(thedifferenceofavariable’svaluefromitsnearerbound)线性规划模型的敏感性分析5、敏感性分析的各值:变量:*.rc——指变量的影子价格,(reducecost)。当变量值提高一个unit,则目标函数值objective将提高*.rc的值;反之亦然。(theroleofthedualvalueisplayedbythevariable’sso-calledreducedcost.)线性规划模型的敏感性分析5、敏感性分析的各值:限制条件:*.up,*.down——指限制方程的值在up和down之间波动,将遵循影子价格(*.dual)的变化规律。*.dual——影子价格,指限制条件的影子价格,即当限制条件提高一个unit,目标函数指objective将提高*.dual的值;反之亦然。
线性规划模型的敏感性分析5、敏感性分析的各值:*.current——指限制条件的右端值。*.body——指限制条件的左端值值。线性规划模型的敏感性分析setProd;setMaterials;paramprofit{iinProd};paramrate{iinProd};paramarm{iinProd,jinMaterials};paramavail_time;paramavail_res{jinMaterials};varMake{iinProd}>=0;maximizetotal_profit:sum{iinProd}profit[i]*Make[i];subjecttoman_hour:sum{iinProd}rate[i]*Make[i]<=avail_time;subjecttoresource{jinMaterials}:sum{iinProd}arm[i,j]*Make[i]<=avail_res[j];线性规划模型的敏感性分析setProd:=Prod1Prod2;setMaterials:=MAMB;paramprofit:=Prod150Prod2100;paramrate:=Prod11Prod21;paramarm:MAMB:=Prod120Prod211;paramavail_time:=300;paramavail_res:=MA400MB250;线性规划模型的敏感性分析modelsensitivity.mod;datasensitivity.dat;optionsolvercplex;optioncplex_options'sensitivity';solve;displaytotal_profit>sensitivity.sol;displayMake.lb,Make,Make.ub,Make.rc,Make.slack>sensitivity.sol;displayman_hour.up,man_hour.body,man_hour.current,man_hour.down,man_hour.dual>sensitivity.sol;displayresource.up,resource.body,resource.current,resource.down,resource.dual>sensitivity.sol;quit;线性规划模型的敏感性分析:Make.lbMakeMake.ubMake.rcMake.slack:=Prod1050Infinity050Prod2025025000线性规划模型的敏感性分析Aggregateplanningmodel某公司预测的市场需求如下表所示。每件产品需加工20小时,工人每天工作8小时。招收工人需支出广告费、考试费和培训费,折合一个工人300元,裁减一个工人需付解雇费200元。公司必须付给每名工人25元/小时的工资。假设生产中无废品和返工。为了应付需求波动,有1000件产品作为安全库存。单位维持库存费为6元/件.月。设每年的需求类型相同。因此,在计划年度开始时的工人数等于计划年度结束时的工人数。Aggregateplanningmodel预测需求量和每月工作天数月份123456789101112需求160014001200100015002000250025003000300025002000工作天212222212321212020201922参数:T—周期数;Dt—每周期的需求,t=1…T;K—每件产品需要加工的时间;h—每个工人每天工作时间;综合生产计划数学模型
参数:Ch—雇佣工人成本;Cf—解雇工人成本;I0—计划期开始时的库存;Ci—每单位产品维持库存费用;nt—每月的工作天数;W0—期初工人人数;S-工人每小时工资;综合生产计划数学模型
变量:Wt=每一周期的在职工人数,Ht=每一周期的雇佣工人数,Ft=每一周期的解雇工人数,Pt=每一周期生产产品数,It=每一周期的库存水平,综合生产计划数学模型
综合生产计划数学模型
目标函数:约束条件:,
,
,
,
综合生产计划数学模型
约束条件:,
,
,
,
AMPL语音对“时间参数”的定义:mod文件paramT;paramdemand{tin1..T};data文件paramT:=12;paramdemand:=116002140031200综合生产计划数学模型
paraminvcost;paramworkdays{tin1..T};paramworkhours;paramdemand{tin1..T};paramK
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026中国智能轨道交通信号系统行业市场发展供需分析及投资评估规划分析研究报告
- 2026中国涡流泵行业原材料价格波动风险与供应链管理对策
- 2026Fast芯片组行业人才需求与培养策略分析报告
- 2026中国新材料产业市场现状竞争格局及发展前景分析报告
- 2026中国物流地产投资热点及开发模式与回报周期分析报告
- 2026中国智能车载智能研发行业市场现状供需分析及投资评估规划分析研究报告
- 2026中国消费金融行业风险控制与场景化营销策略研究报告
- 2026中国影视文化传播行业市场现状供给分析及发展评估规划分析研究报告
- 2026中国汽车MCU芯片缺货危机下的供应链重组机会研究
- 2026眼科屈光晶体植入术市场教育现状与患者接受度调研报告
- 初中物理新课程标准解读
- 政法维稳工作课件
- 基层网格员安全监管培训课件
- 卡西欧手表OCW-T400(5054)说明书
- 蔬菜大棚现场管理制度
- 啤酒市场营销策略考核试卷
- DB32T 761-2022生活饮用水管道分质直饮水卫生规范
- 钻探安全技术操作规程(2020新版)
- 《SSD固态硬盘介绍》课件
- 《事业单位财务规则》专题培训
- 工程施工项目部专项施工方案(机组主变压器平移就位)项目主变卸车及就位方案
评论
0/150
提交评论