AMPL编程说课讲解

上传人:go****e 文档编号:137363924 上传时间:2020-07-07 格式:PPT 页数:92 大小:724KB
返回 下载 相关 举报
AMPL编程说课讲解_第1页
第1页 / 共92页
AMPL编程说课讲解_第2页
第2页 / 共92页
AMPL编程说课讲解_第3页
第3页 / 共92页
AMPL编程说课讲解_第4页
第4页 / 共92页
AMPL编程说课讲解_第5页
第5页 / 共92页
点击查看更多>>
资源描述

《AMPL编程说课讲解》由会员分享,可在线阅读,更多相关《AMPL编程说课讲解(92页珍藏版)》请在金锄头文库上搜索。

1、AMPL编程,主讲人: 贾海成,任意选修课,Introduction,AMPL: A Modeling Language for Mathematical Programming Website: ,解决最优化问题模型的计算机软件 (30多种),Introduction,LINDO/LINGO Excel AMPL,解决最优化问题模型的计算机软件,Introduction,Introduction,Introduction,什么是最优化问题? 所谓最优化问题一般是指按照给定的标准在某些约束条件下选取最优的解集。 主要分支: 线性规划、整数规划、二次规划、非线性规划、随机规划、动态规划、组合最优

2、化、无限维最优化,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 justifie

3、d 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,Subj

4、ect 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 (T

5、ons 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 hou

6、rs 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,var XB; var XC; var xp; maximize Profit: 25*XB+30*XC+29*xp; subject to Time: (1/20

7、0)*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=3500; Prod1.mod,Introduction,model prod1.mod; solve; display XB, XC,xp; quit; Prod1.run,Introduction,MINOS 5.5: optimal solution found. 2 iterations, objective 196400 XB = 6000 XC =

8、 0 xp = 1600 Tool completed successfully results,Introduction,Introduction,Introduction,Introduction,model prod.mod; data prod.dat; solve; display x; quit; prod.run,Introduction,Introduction,Continue previous example 生产这三种钢材的工艺分为2个阶段:reheat/rolling,这2个阶段最大的可利用时间为每周 35 hours和40 hours。,Introduction,数学

9、模型,Sets: P a set of products S a set of processes in production,Parameters = profit per unit of product j, = unit production time in stage J for product i, =work time in weekly, = upper limit on amount of product j sold in period,数学模型,Variables: Xi = units of product j to be produced January,数学模型,数学

10、模型,(1),st (2),(3),Introduction,Steel2.mod,Introduction,Steel2.dat,Diet problem: minimizing costs,Chapter2,Diet problem: minimizing costs,每包的单价,The dinner provide the following percentages, per package, of the minimum daily requirements for vitamins A, C, B1 and B2.,Diet problem: minimizing costs,The

11、 problem is to find the cheapest combination of packages that will meet a weeks requirements.,Diet problem: minimizing costs,Diet problem: minimizing costs,Diet problem: minimizing costs,Diet problem: minimizing costs,数学模型,Diet problem: minimizing costs,Sets: P a set of products I a set of ingredien

12、ts,Parameters:,= unit cost for product j,= percentage of the minimum daily requirement for ingredient i in one unit of product j,Diet problem: minimizing costs,= minimum weeks requirement (in percentage) for ingredient i in the blend,= maximum weeks requirement (in percentage) for ingredient i in th

13、e blend,= lower limit on amount of product j purchased per week,= upper limit on amount of product j purchased per week,Diet problem: minimizing costs,Variables: Xj = number of units of product j to be purchased per week,Formulation:,(1),st (2),(3),AMPL程序,Diet problem: minimizing costs,Diet problem:

14、 minimizing costs,Param n_min default 700; Param n_max default 10000;,Diet problem: minimizing costs,计算结果?,扩展: 限定每种食物一周只能吃210包。 同时增加对2种元素的考查: 钠(Na)和热量(calories) 各食物中Na的含量为: beef 938, chk 2180, fish 945, ham 278, mch 1182, mtl 896, spg 1329, tur 1397.,Diet problem: minimizing costs,扩展: 1、限定每种食物一周只能吃2

15、10包。 2、增加对2种元素的考查: 钠(Na)和热量(calories) 各食物中calories的含量为: beef 295, chk 770, fish 440, ham 430, mch 315, mtl 400, spg 370, tur 450.,Diet problem: minimizing costs,钠(Na)的最高摄取量为40000 热量(calories)的摄取量范围为1600024000。,Diet problem: minimizing costs,Diet problem: minimizing costs,Var buy j in FOOD integer=f_

16、minj,=f_maxj;,Diet problem: minimizing costs,Suppose that we have to produce steel coils at three mill location, in the following amounts:,Transportation Models,These products must be shipped in various amounts to meet orders at seven locations of automobile factories.,Transportation Models,Transportation Models,Shipping costs per ton is given in below,Transportation Models,What is the least expensive plan for shipping the

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 幼儿/小学教育 > 其它小学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号