收藏 分销(赏)

AMPL编程说课讲解.ppt

上传人:精**** 文档编号:9300678 上传时间:2025-03-20 格式:PPT 页数:92 大小:724KB 下载积分:18 金币
下载 相关 举报
AMPL编程说课讲解.ppt_第1页
第1页 / 共92页
AMPL编程说课讲解.ppt_第2页
第2页 / 共92页


点击查看更多>>
资源描述
Click to edit Master title style,Click to edit Master text styles,Second level,Third level,Fourth level,Fifth level,*,AMPL编程,主讲人:贾海成,任意选修课,Introduction,AMPL:A Modeling Language for Mathematical Programming,Website:,解决最优化问题模型的计算机软件(30多种),Introduction,LINDO/LINGO,Excel,AMPL,解决最优化问题模型的计算机软件,Introduction,Introduction,Introduction,什么是最优化问题?,所谓最优化问题一般是指按照给定的标准在某些约束条件下选取最优的解集。,主要分支:,线性规划、整数规划、二次规划、非线性规划、随机规划、动态规划、组合最优化、无限维最优化,Introduction,A simple two-variable linear program,A Steel company,two products:Bands and Coils,production rate(Tons per hour):,Bands 200;Coils 140.,Profit margin(Profit per ton):,Bands$25;Coils$30.,Introduction,The following weekly production amounts are the most that can be justified in light of the currently booked orders:,Maximum tons:Bands 6000;Coils 4000,If 40 hours of production time are available this week,how many tons of bands and how many tons of coils should be produced to bring in the greatest total profit?,Introduction,Mathematic model,Introduction,Maximize,Subject to,Subject to,Subject to,How to solve it?,Method 1,Introduction,Method 2,Introduction,Method 2,Introduction,Method 2,Introduction,The two-variable linear program in AMPL,Prod0.mod prod0.run,Introduction,Adding one variable,A Steel company,Three products:Bands,Coils and Plate,Production rate(Tons per hour):,Bands 200;Coils 140;Plate 160.,Profit margin(Profit per ton):,Bands$25;Coils$30;Plate$29.,Introduction,The following weekly production amounts are the most that can be justified in light of the currently booked orders:,Maximum tons:,Bands 6000;Coils 4000;Plate 3500,If 40 hours of production time are available this week,how many tons of bands and how many tons of coils should be produced to bring in the greatest total profit?,Introduction,Mathematic model,Introduction,Maximize,Subject to,Subject to,Subject to,Subject to,var XB;,var XC;,var xp;,maximize Profit:25*XB+30*XC+29*xp;,subject to Time:(1/200)*XB+(1/140)*XC+(1/160)*xp=40;,subject to B_limit:0=XB=6000;,subject to C_limit:0=XC=4000;,subject to p_limit:0=xp=f_minj,=0;,maximize total_profit:sumi in Prodprofiti*Makei;,subject to man_hour:sumi in Prodratei*Makei=avail_time;,subject to resourcej in Materials:sumi in Prodarmi,j*Makeisensitivity.sol;,display Make.lb,Make,Make.ub,Make.rc,Make.slacksensitivity.sol;,display man_hour.up,man_hour.body,man_hour.current,man_hour.down,man_hour.dualsensitivity.sol;,display resource.up,resource.body,resource.current,resource.down,resource.dualsensitivity.sol;,quit;,线性规划模型的敏感性分析,:Make.lb Make Make.ub Make.rc Make.slack :=,Prod1 0 50 Infinity 0 50,Prod2 0 250 250 0 0,线性规划模型的敏感性分析,Aggregate planning model,某公司预测的市场需求如下表所示。每件产品需加工,20,小时,工人每天工作,8,小时。招收工人需支出广告费、考试费和培训费,折合一个工人,300,元,裁减一个工人需付解雇费,200,元。,公司必须付给每名工人,25,元,/,小时的工资。,假设生产中无废品和返工。为了应付需求波动,有,1000,件产品作为安全库存。单位维持库存费为,6,元,/,件,.,月。设每年的需求类型相同。因此,在计划年度开始时的工人数等于计划年度结束时的工人数。,Aggregate planning model,预测需求量和每月工作天数,月份,1,2,3,4,5,6,7,8,9,10,11,12,需求,1600,1400,1200,1000,1500,2000,2500,2500,3000,3000,2500,2000,工作天,21,22,22,21,23,21,21,20,20,20,19,22,参数:,T,周期数;,D,t,每周期的需求,,t=1T,;,K,每件产品需要加工的时间;,h,每个工人每天工作时间;,综合生产计划数学模型,参数:,C,h,雇佣工人成本;,C,f,解雇工人成本;,I,0,计划期开始时的库存;,C,i,每单位产品维持库存费用;,n,t,每月的工作天数;,W,0,期初工人人数;,S,工人每小时工资;,综合生产计划数学模型,变量:,W,t,每一周期的在职工人数,,H,t,每一周期的雇佣工人数,,F,t,每一周期的解雇工人数,,P,t,每一周期生产产品数,,I,t,每一周期的库存水平,,综合生产计划数学模型,综合生产计划数学模型,目标函数:,约束条件:,,,,,,,,,综合生产计划数学模型,约束条件:,,,,,,,,,AMPL语音,对“时间参数”的定义:,mod文件,param T;,param demandt in 1.T;,data文件,param T:=12;,param demand:=1 1600 2 1400 3 1200,综合生产计划数学模型,param invcost;,param workdayst in 1.T;,param workhours;,param demandt in 1.T;,param K;,param stinv;,param begworkers;,param salary;,var Maket in 1.T=0 integer;,var Invt in 0.T=1000;,var Hir t in 1.T=0;,var Firt in 1.T=0;,var Workt in 0.T=0 integer;,minimize total_cost:sumt in 1.T(invcost*Invt+hircost*Hirt+fircost*Firt+workdayst*workhours*salary*Workt);,subject to balancet in 1.T:Invt=Invt-1+Maket-demandt;,subject to workforcet in 1.T:Workt=Workt-1+Hirt-Firt;,subject to productiont in 1.T:Maketplanning.sol;,display Make,Inv,Hir,Fir,Workplanning.sol;,
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服