Premium Essay

Linear

In:

Submitted By monkeyzhang318
Words 339
Pages 2
实验 1 用 LINGO 求解线性规划问题
LINGO 使用简介
LINGO 软件是美国的 LINDO 系统公司(Lindo System Inc)开发的一套用于求解最优 化问题的软件包.LINGO 除了能用于求解线性规划和二次规划外,还可以用于非线性规划求 解以及一些线性和非线性方程(组)的求解.LINGO 软件的最大特色在于它允许优化模型中 的决策变量为整数,而且执行速度快.LINGO 内置了一种建立最优化模型的语言,可以简便 地表达大规模问题,利用 LINGO 高效的求解器可快速求解并分析结果,这里简单介绍 LINGO 的使用方法. LINGO 可以求解线性规划、二次规划、非线性规划、整数规划、图论及网络优化和排 队论模型中的最优化问题等. 一个 LINGO 程序一般会包含集合段、数据输入段、优化目标和约束段、初始段和数据 预处理段等部分, 每一部分有其独特的作用和语法规则, 读者可以通过查阅相关的参考书或 者 LINGO 的 HELP 文件详细了解,这里就不展开介绍了. LINGO 的主要功能特色为:既能求解线性规划问题,也有较强的求解非线性规划问题 的能力;输入模型简练直观;运算速度快、计算能力强;内置建模语言,提供几十个内部函 数, 从而能以较少语句, 较直观的方式描述大规模的优化模型; 将集合的概念引入编程语言, 很容易将实际问题转换为 LINGO 模型;并且能方便地与 Excel、数据库等其他软件交换数 据. LINGO 的语法规定: (1)求目标函数的最大值或最小值分别用 MAX=…或 MIN=…来表示; (2)每个语句必须以分号“; ”结束,每行可以有许多语句,语句可以跨行; (3)变量名称必须以字母(A~Z)开头,由字母、数字(0~9)和下划线所组成,长度 不超过 32 个字符,不区分大小写; (4)可以给语句加上标号,例如[OBJ] MAX=200*X1+300*X2; (5)以惊叹号“! ”开头,以分号“; ”结束的语句是注释语句; (6)如果对变量的取值范围没有作特殊说明,则默认所有决策变量都非负; (7)LINGO 模型以语句“MODEL: ”开头,以“END”结束,对于比较简单的模型, 这两个语句可以省略.

实验目的
1.对于给定的实际应用问题,正确的建立线性规划问题数学模型,并用 LINGO 求解; 2.掌握灵敏度分析以及资源的影子价格的相关分析方法.

实验数据与内容
问题 1.1 利最大? 某工厂在计划期内要安排生产 A、B 两种产品,已知生产单位产品所需设备

台时及对甲、乙两种原材料的消耗,有关数据如表 1.1.问:应如何安排生产计划,使工厂获

1

A B 可利用资源 资源 1 2 设备 8 台时 4 0 甲 16 公斤 0 4 乙 12 公斤 单位利润 2元 3元 建立线性规划问题的数学模型,用 LINGO 求出最优解并做相应的分析. 问题 1.2 某公司饲养实验用的动物以供出售,已知这些动物的生长对饲料中 3 种营养 成分(蛋白质、矿物质和维生素)特别敏感,每个动物每周至少需要蛋白质 60g,矿物质 3g, 维生素 8mg,该公司能买到 5 种不同的饲料,每种饲料 1kg 所含各种营养成分和成本如表 1.2 所示,如果每个小动物每周食用饲料不超过 52kg,求既能满足动物生长需要,又使总成 本最低的饲料配方. 表 1.2 饲料 营养 蛋白质(g) 矿物质(g) 维生素(mg) 配料(食谱)问题的数据 营养最低 要 求 60 3 8

表 1.1 产品

资源配置问题的数据

A1
0.3 0.1 0.05

A2
2 0.05 0.1 0.7

A3
1 0.02 0.02 0.4

A4
0.6 0.2 0.2 0.3

A5
1.8 0.05 0.08 0.5

成本(元/ kg) 0.2

实验指导
问题 1.1 设计划生产 A, B 两种产品分别为 x1 , x2 ,则建立线性规划问题数学模型 max S = 2 x1 + 3x2 ⎧ x1 + 2 x2 ≤ 8 ⎪ 4x ≤ 16 ⎪ 1 s.t ⎨ 4 x2 ≤ 12 ⎪ ⎪ x1 , x2 ≥ 0 ⎩

在 LINGO 的 MODEL 窗口内输入如下模型: model: max=2*x1+3*x2; x1+2*x28;

Similar Documents

Free Essay

Linear

...(in connection with the planning activities of the military), linear programming and its many extensions have come into wide use. In academic circles decision scientists (operations researchers and management scientists), as well as numerical analysts, mathematicians, and economists have written hundreds of books and an uncountable number of articles on the subject. Curiously, in spite of its wide applicability today to everyday problems, it was unknown prior to 1947. This is not quite correct; there were some isolated exceptions. Fourier (of Fourier series fame) in 1823 and the wellknown Belgian mathematician de la Vallée Poussin in 1911 each wrote a paper about it, but that was about it. Their work had as much influence on Post-1947 developments as would finding in an Egyptian tomb an electronic computer built in 3000 BC. Leonid Kantorovich’s remarkable 1939 monograph on the subject was also neglected for ideological reasons in the USSR. It was resurrected two decades later after the major developments had already taken place in the West. An excellent paper by Hitchcock in 1941 on the transportation problem was also overlooked until after others in the late 1940’s and early 1950’s had independently rediscovered its properties. What seems to characterize the pre-1947 era was lack of any interest in trying to optimize. T. Motzkin in his scholarly thesis written in 1936 cites only 42 papers on linear inequality systems, none of which mentioned an objective function...

Words: 586 - Pages: 3

Premium Essay

Linear Optimization

...DECISION MODELING DECISION WITH WITH MICROSOFT EXCEL MICROSOFT Linear Optimization Linear Optimization A constrained optimization model takes the form of a constrained performance measure to be optimized over a range of feasible values of the decision variables. The feasible values of the decision variables are determined by a set of inequality constraints. constraints Values of the decision variables must be chosen such that the inequality constraints are all satisfied while either maximizing or minimizing the desired performance variable. These models can contain tens, hundreds, or thousands of decision variables and constraints. Linear Optimization Very efficient search techniques exist to optimize constrained linear models. constrained These models are historically called linear programs linear (LP). In this chapter we will: 1. Develop techniques for formulating LP models 2. Give some recommended rules for expressing LP models in a spreadsheet that facilitates application of Excel’s Solver 3. Use Solver to optimize spreadsheet LP models Formulating LP Models Every linear programming model has two important features: Objective Function Constraints A single performance measure to be maximized or minimized (e.g., maximize profit, minimize cost) Constraints are limitations or requirements on the set of allowable decisions. Constraints may be further classified into physical, economic, or policy limitations or ...

Words: 4037 - Pages: 17

Premium Essay

Linear Regression

...Linear Regression I would like to know if people who enjoy thrill seeking have tattoos. I believe thrill seeking and tattoos go hand in hand. Most people I know are adventurous, risk takers, and daredevils and all of them have tattoos. I have a strong feeling that the correlation between the two will have a strong positive relationship. X= Tattoos Y= Thrill Seeking The scatter plot shows an extremely rough linear pattern but there is an upward sloping. Line of best fit: y = 0.9148x +25.505 Analysis: 1. r = .14 little or no correlation 2. R^2 = 2% 2% of the variance in thrill seeking is accounted by tattoos. 3. Slope = 0.0196(m) For every 1 tattoo people have there is an increase we expected of 0.9148 in thrill seeking. Conclusion: Between these two variables, there are no correlations between the two. It was shocking to see there is no relationship between the two. I truly believed people who are thrill seekers have tattoo. T-Test Independent 2 Sample My gym teacher believes that males are stronger than females and that is why males have more tattoos. The scale is determine by the number of tattoos both males and females have. Eighty-four males and one hundred and eleven females responded. The males average 39 (s.d. 1.42) while the females average 38 (s.d. 0.98). At the .10 significance level, test to see if there is a difference between males having more tattoos than females? Ho: Null Hypothesis Males equal Females Ha: Null Hypothesis...

Words: 478 - Pages: 2

Premium Essay

Linear Programming

...LINEAR PROGRAMMING II 1 Linear Programming II: Minimization © 2006 Samuel L. Baker Assignment 11 is on page 16. Introduction A minimization problem minimizes the value of the objective function rather than maximizing it. Minimization problems generally involve finding the least-cost way to meet a set of requirements. Classic example -- feeding farm animals. Animals need: 14 units of nutrient A, 12 units of nutrient B, and 18 units of nutrient C. Learning Objective 1: Recognize problems that linear programming can handle. Linear programming lets you optimize an objective function subject to some constraints. The objective function and constraints are all linear. Two feed grains are available, X and Y. A bag of X has 2 units of A, 1 unit of B, and 1 unit of C. A bag of Y has 1 unit of A, 1 unit of B, and 3 units of C. A bag of X costs $2. A bag of Y costs $4. Minimize the cost of meeting the nutrient requirements. To solve, express the problem in equation form: Cost = 2X + 4Y objective function to be minimized Constraints: 2X + 1Y $ 14 nutrient A requirement 1X + 1Y $ 12 nutrient B requirement 1X + 3Y $ 18 nutrient C requirement 8 8 Read vertically to see how much of each nutrient is in each grain. X $ 0, Y $ 0 non-negativity Learning objective 2: Know the elements of a linear programming problem -- what you need to calculate a solution. The elements are (1) an objective function that shows the cost or profit depending on what choices you make, (2) constraint inequalities...

Words: 4295 - Pages: 18

Premium Essay

Linear Programming

...Linear Programming (LP) Linear programming, simply put, is the most widely used mathematical programming technique. It has a long history dating back to the 1930s. The Russian mathematical economist Leonid Kantorovich published an important article about linear programming in 1939. George Stigler published his famous diet problem in 1945 (“The Cost of Subsistence”). Of course, no one could actually solve these problems until George Dantzig developed the simplex method, which was published in 1951. Within a few years, a variety of American businesses recognized that they could save millions of dollars a year using linear programming models. And in the 1950s, that was a lot of money. In his book Methods of Mathematical Economics (Springer-Verlag, 1980), Joel Franklin talks about some of the uses of linear programming (LP). In fact, about half of his book is devoted to LP and its extensions. Today, we will analyze one of the examples provided in that book. The example comes from a 1972 article published in the Monthly Review of the Federal Reserve Bank of Richmond. Alfred Broaddus, the author, was trying to explain to bankers how Bankers Trust Company used linear programming models in investment management. His example was simple and effective. The bank has up to 100 million dollars to invest, a portion of which can go into loans (L), and a portion of which can go into securities (S). Loans earn 10%, securities 5%. The bank is required to keep 25% of its invested...

Words: 2832 - Pages: 12

Premium Essay

Linear Programming

...Linear programming solution examples Linear programming example 1997 UG exam A company makes two products (X and Y) using two machines (A and B). Each unit of X that is produced requires 50 minutes processing time on machine A and 30 minutes processing time on machine B. Each unit of Y that is produced requires 24 minutes processing time on machine A and 33 minutes processing time on machine B. At the start of the current week there are 30 units of X and 90 units of Y in stock. Available processing time on machine A is forecast to be 40 hours and on machine B is forecast to be 35 hours. The demand for X in the current week is forecast to be 75 units and for Y is forecast to be 95 units. Company policy is to maximise the combined sum of the units of X and the units of Y in stock at the end of the week. * Formulate the problem of deciding how much of each product to make in the current week as a linear program. * Solve this linear program graphically. Solution Let * x be the number of units of X produced in the current week * y be the number of units of Y produced in the current week then the constraints are: # 50x + 24y = 45 so production of X >= demand (75) - initial stock (30), which ensures we meet demand # y >= 95 - 90 # i.e. y >= 5 so production of Y >= demand (95) - initial stock (90), which ensures we meet demand The objective is: maximise (x+30-75) + (y+90-95) = (x+y-50) i.e. to maximise the number of units left in stock...

Words: 336 - Pages: 2

Free Essay

Linear Function

...Week 1 Linear Functions * As you hop into a taxicab in Kuala Lumpur, the meter will immediately read RM3.30; this is the “drop” charge made when the taximeter is activated. After that initial fee, the taximeter will add RM2.40 for each kilometer the taxi drives. In this scenario, the total taxi fare depends upon the number of kilometer ridden in the taxi, and we can ask whether it is possible to model this type of scenario with a function. As you hop into a taxicab in Kuala Lumpur, the meter will immediately read RM3.30; this is the “drop” charge made when the taximeter is activated. After that initial fee, the taximeter will add RM2.40 for each kilometer the taxi drives. In this scenario, the total taxi fare depends upon the number of kilometer ridden in the taxi, and we can ask whether it is possible to model this type of scenario with a function. An equation whose graph is a straight line is called a linear function (y = mx + c). * Consider this Example 1: * Using descriptive variables, we choose k for kilometers and R for Cost in Ringgit Malaysia as a function of miles: R(k). * We know for certain that R(0) = 3.30, since the RM3.30 drop charge is assessed regardless of how many kilometers are driven. * Since RM2.40 is added for each kilometer driven, then: R(1) = 3.30 + 2.40 = 5.70. * If we then drove a second kilometer, another RM2.40 would be added to the cost: R(2) = 3.30 + 2.40 +2.40 = 8.10. * If we drove...

Words: 3671 - Pages: 15

Premium Essay

Linear Regression

...Linear Regression deals with the numerical measures to express the relationship between two variables. Relationships between variables can either be strong or weak or even direct or inverse. A few examples may be the amount McDonald’s spends on advertising per month and the amount of total sales in a month. Additionally the amount of study time one puts toward this statistics in comparison to the grades they receive may be analyzed using the regression method. The formal definition of Regression Analysis is the equation that allows one to estimate the value of one variable based on the value of another. Key objectives in performing a regression analysis include estimating the dependent variable Y based on a selected value of the independent variable X. To explain, Nike could possibly measurer how much they spend on celebrity endorsements and the affect it has on sales in a month. When measuring, the amount spent celebrity endorsements would be the independent X variable. Without the X variable, Y would be impossible to estimate. The general from of the regression equation is Y hat "=a + bX" where Y hat is the estimated value of the estimated value of the Y variable for a selected X value. a represents the Y-Intercept, therefore, it is the estimated value of Y when X=0. Furthermore, b is the slope of the line or the average change in Y hat for each change of one unit in the independent variable X. Finally, X is any value of the independent variable that is selected. Regression...

Words: 1324 - Pages: 6

Free Essay

Linear Algebra

...SCHAUM’S outlines SCHAUM’S outlines Linear Algebra Fourth Edition Seymour Lipschutz, Ph.D. Temple University Marc Lars Lipson, Ph.D. University of Virginia Schaum’s Outline Series New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto Copyright © 2009, 2001, 1991, 1968 by The McGraw-Hill Companies, Inc. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. ISBN: 978-0-07-154353-8 MHID: 0-07-154353-8 The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-154352-1, MHID: 0-07-154352-X. All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please e-mail us at bulksales@mcgraw-hill.com. TERMS OF USE This is a copyrighted work and The McGraw-Hill Companies,...

Words: 229129 - Pages: 917

Premium Essay

Linear Programming

...If x2 in equation (1) =0, then 8x1 + 6(0) = 1920 X1=1920/8 X1=240 (240, 0) If x1 in equation (2) =0, then 3(0) + 6x2 = 1440 6x2 = 1440 X2 = 1440/6 X2 = 240 (0, 240) If x2 in equation (2) = 0, then 3x1 + 6(0) = 1440 3x1 = 1440 X1 = 1440/3 X1= 480 (480, 0) If x1 in equation (3) =0, then 3(0) + 2x2 = 720 2x2 =720 X2=720/2 X2=360 (0, 360) If x2 in equation (3) =0, then 3x1 + 2(0) =720 3x1 = 720 X1 =720 3 X1 = 240 (240, 0) If x1 in equation (4) = 0, then X2=288 (0, 288) If x2 in equation (4) = 0, then X1 = 288 (288, 0) Due to the multiple constraints, it is difficult to obtain the optimal solution from the graph. Therefore, the simultaneous equation would be used to the solve linear programming model. Using simultaneous equation, 8x1 + 6x2 = 1920 ounces…………………………. (1) 3x1 + 6x2 = 1440 ounces…………………………. (2) 3x1 + 2x2 = 720 ounces…………………………… (3) X1 + x2 =288 jars………………………………….. (4) Using the...

Words: 431 - Pages: 2

Premium Essay

Linear Programming

...METHODS/ APPROACH This scheduling problem can be solved most expeditiously using linear programming. Let F denote the number of full-time employ- ees. Some number, F1, of them will work one hour of overtime between 5 PM and 6 PM each day and some number, F2, of the full- time employees will work overtime between 6 PM and 7 PM. There will be seven sets of part-time employees who begin their work day at hour j=j␣1,2,...,7,withP1beingthenumberofworkers beginning at 9 AM, P2 at 10 AM, . . . , P7 at 3 PM. Note that because part-time employees must work a minimum of four hours, none can start after 3 PM because the entire operation ends at 7 PM. Similarly, some number of part-time employees, Qj, leave at the end of hour j, j 4, 5, . . . , 9. The workforce requirements for the first two hours, 9 AM and 10 AM, are: F P1 14 F P1 P2 25 At 11 AM half of the full-time employees go to lunch; the remaining half go at noon. For those hours: 0.5F P1 P2 P3 26 0.5F P1 P2 P3 P4 38 Starting at 1 PM, some of the part-time employees begin to leave. For the remainder of the straight-time day: F P1 P2 P3 P4 P5 −Q4 55 F P1 P2 P3 P4 P5 P6 −Q4 −Q5 60 F P1 P2 P3 P4 P5 P6 P7 −Q4 −Q5 −Q6 51 F P1 P2 P3 P4 P5 P6 P7 −Q4 −Q5 −Q6 −Q7 29 For the two overtime...

Words: 993 - Pages: 4

Premium Essay

Introduction to Linear Inequalities

...Week Three Linear Inequality Lynn Branham MAT221 Instructor Charlie Williams May 9, 2013 Introduction On Linear Inequalities Linear equations are special kinds of algebraic expressions that contains two variables.  The value of one variable is dependent upon the other. The functions of inequalities are expressed as a line.  The complexity of linear equations and linear equalities are sometimes compared concerning the complications of each. Unlike linear equations, linear inequalities incorporate the assessment of where to shade after a solution has been determined.  Typically, two equations collaborate to compose a linear inequality. A linear equation will be made up of a combination of constants, a set of numbers and variables. The variables must be to the first power and cannot be squared or cubed. According to Michael Judge, the most common type of linear equation is in the form y = mx + b and describes a straight line (2010). In this case, the two variables are usually x and y and the constants are m and b which are numbers giving the slope and intercept of the line. Operations of Linear Equations Two equations and two variables are needed to find specific values.  My variables are: c = # of classic maple rockers m = # modern rockers A classic maple requires 15 board feet of maple, and a total of...

Words: 769 - Pages: 4

Free Essay

Linear Algebra Controls

... 5 0 ans = 1 1 0 0 0 3 0 0 1 0 0 -1 0 0 0 1 0 0 0 0 0 0 1 -1 3 a. 1. A=[1 -2 3 -6; 3 0 -2 5; 1 1 -2 5]; rref(A) 1 0 0 1 0 1 0 2 0 0 1 -1 Yes there is a Linear combination: p= q1+2q2-q3 2. A=[1 -2 3 1; 3 0 -2 0; 1 1 -2 0]; rref(A) 1.0000 0 0 0.6667 0 1.0000 0 1.3333 0 0 1.0000 1.0000 Yes there is a Linear Combination: p= 0.67q1 + 1.333q2 + q3 3b 1. A=[1 2 0 2; 2 0 4 1; 0 3 -3 1; 1 -1 3 1]; rref(A) 1 0 2 0 0 1 -1 0 0 0 0 1 0 0 0 0 The given p row is not a linear combination of the q vectors as they do not span all elements in p. 2. A=[1 2 0 1; 2 0 4 18; 0 3 -3 -12; 1 -1 3 13]; rref(A) 1 0 2 9 0 1 -1 -4 0 0 0 0 0 0 0 0 The given p row is a linear combination of the q vectors as they = span all elements in p 3c 1. A=[2 1 1 1; 1 -1 2 0; -3 0 0 0; 4 1 0 0]; rref(A) 1 0 0...

Words: 411 - Pages: 2

Free Essay

Linear Transformation

...Question #3 (a)Clearly T has a linear transformation Kernel of T is the set of all vectors | x1 | x2 | | | in R2 such that | (*)     | T (  | x1 | x2 | | |  ) = 0R2   | This yields the equation 1 x1 +1 x2 | 1 x1 +0x2 | | |  =  | 0 | 0 | | | The matrix equation above is equivalent to the following homogeneous system of equations 1 x1 |  +1 x2 | = | 0 | 1 x1 |  +0 x2 | = | 0 |   | | We now transform the coefficient matrix of the homogeneous system above to the reduced row echelon form to determine the solution space.  1  |  1  |  1  |  0  | | can be transformed by a sequence of elementary row operations to the matrix  1  |  0  |  0  |  1  | | The reduced row echelon form of the augmented matrix is  1  |  0  |  0  |  1  | | which corresponds to the system 1 x1 |   | = | 0 | | 1 x2 | = | 0 | The leading entries in the matrix have been highlighted in yellow. x1 | = | 0 | x2 | = | 0 | This means the kernel consists only of the zero vector, and consequently has no basis.  Comments | * The nullity of T is 0. This is the dimension of the kernel of L. * T is a one-to-one transformation since ker T = {0R2}. * T is not a one-to-one onto ransformation.Question #1 T=R3 _ R3T(x)=A(x) A X 1  2 1 | 1 -1 12 1 1 | | |  X | 2 | 1-4 | | | 0 | -31 | | | |   | | Question # 2References http://www.calcul.com/http://www...

Words: 256 - Pages: 2

Free Essay

Linear Reflection & Report

...Crystal Shanyse King Professor Starra Shermin: Algebra Course November 28th, 2014 M2 Linear Reflection & Report When a person looks in the mirror, they see a reflection of themselves. Reflections in math often involve us flipping something over a line called the line of reflection. We can create mirror images of certain figures by reflecting them over a given line. It’s so amazing to use math in a reflection of our everyday lives. As a child, we think that math is pointless and why are we learning it? We think that we’ll never use it in life. But as i have grown older and have become an adult, i’ve used math almost everyday of my life from the smallest to the biggest things. It’s very important to be attentive in class, especially when your learning about algebra, because you never know when you’ll have to use it. In this week’s small group discussion, i learned so much from my classmates. Some of my peers did a linear equation reflection on they’re personal health, losing weight, making baby food, giving medicine to a baby, paycheck vs. expenses, a pool party, shopping, personal business, and budgeting. All examples of linear equations in real life. The example i was most impressed with was making baby food and giving medicine to a little child. I do not have any children, nor have i watched any long enough to give them medicine or baby food. But i learned that as a young parent it can be pretty scary. You are always concerned about what your putting into your child’s mouth...

Words: 991 - Pages: 4