P. 1


|Views: 9|Likes:
Published by Fehim Tüfekçi

More info:

Published by: Fehim Tüfekçi on Dec 22, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less






Lingo is a software that helps you to model and solve some kinds of optimization problems, such as: o Linear o Nonlinear o Integer Not only you can enter each term of each constraint explicitly (separately and clearly), but also you can express a whole series of similar constraints in a single compact statement. For those problems which involve large number of similar variables and constraints, using set-base model is a powerful approach.

What is an optimization model?
It consists of 3 parts: Variables (quantities that can be changed to find the optimum value of objective function) Objective Function (a formula to optimize the model, for example: maximize profit, maximize products, minimize cost, minimize working hours) Constraints (define the limits of the variables)

Linear Programming
f(x1, x2, …,xn) = c1x 1± c2x2 ± … ± cnxn is a linear function. Note that we have no power of 2 or 3 or … (for example x2 is not acceptable). f(x1, x2, …,xn) ≥ b or f(x1, x2, …,xn) ≤ b is a linear inequality. A linear programming problem (LP) is an optimization problem: - To max. or min. a linear function of decision variables (objective function) - The values of decision variables should satisfy a set of constraints.

Comments are initiated with (!) (exclamation point). Each statement (line) must be end in a (;) (semi-colon). Variable names must begin with a letter (A-Z) (They are not case sensitive). (*) (Asterisk) used to denote multiplication. Parentheses should use to define the order of mathematical operations. 1


In Lingo. 5* x2 + 2*x1 <= 60. A simple example (exp-01) A company produces product A and B. 2* x2 + 1*x1 <= 25. END (Raw material 1 constraint) (Raw material 2 constraint) Solving a LINGO Model IENG313 LAB NOTE 2 . Formulate an LP that can be used to maximize revenue. Producing a unit of product B requires 5 unit of raw material 1 and 2 unit of raw material 2. Product B sells for $5 per unit. 60 units of raw material 1 and 25 unit of raw material 2 are available. and product A sells for $3 per unit. Producing a unit of product A requires 2 unit of raw material 1 and 1 unit of raw material 2. Variables: x1: units of product A that should be produced x2: units of product B that should be produced Objective Function: Max Z= 5x2 + 3x1 Subject to (constraints): 5x2 + 2x1 ≤ 60 2x2 + 1x1 ≤ 25 x1 ≥ 0 x2 ≥ 0 Changing model for LINGO: MODEL: MAX = 5* x2 + 3*x1. the lower bound for variables is zero. The last statement should be: END Type the constraints after the objective function without: o St o Such that o Subject to - You can use (^) (carat sign) as a power symbol (In nonlinear programming).- To start entering a new optimization problem type: MODEL: Enter the objective function by typing: MIN=…. Or MAX= … . .

LINGO Solver Status Window If no errors are found.Each model can be solved by: Clicking the solve button Selecting Solve from the LINGO menu Using Ctrl+S keyboard shortcut. the LINGO solver status window appears: LINGO Solution Report Window Close the Solver Status window to see the Solution Report window. Error (if any) will be reported. IENG313 LAB NOTE 3 .

Slack or Surplus: (for information) - Zero: if a constraint is completely satisfied equality (3re row or 2nd constraint). so it is a Compulsory Constraint.(2*25)= 10) - Negative: Constraint has been violated! Example (exp-02) Maximize Subject to -5/36Q2 + 160/9Q – 125/9 10 ≤Q ≤ 100 LINGO Model LINGO Solver Status Window IENG313 LAB NOTE 4 . so the objective function will be: (5*1) + (3*23) = 74. then the objective function increase (or decrease) 3 units. Then the reduced cost will be: 75 – 74 = 1 Dual Price: (for information) If for example we increase (or decrease) one unit to the 2nd constraint (It is 25 now). how much the objective function will degrade (decrease)? For example. Positive: shows that how many more units of the variable could be added to the optimal solution before the constraint becomes an equality (2nd row: 60.Reduced Cost: (for information) If we increase one unit of a non-basic variable. Note: The second constraint is satisfied equally. if we want to produce one unit of x2 then we have to produce 23 units of x1.

LINGO Solution Report Window Example (exp-03) Minimize Subject to 50S+100F 5 S + 17 F ≥ 40 20 S + 7 F ≥ 60 S.F ≥ 0 IENG313 LAB NOTE 5 .

LINGO Model LINGO Solver Status Window LINGO Solution Report Window IENG313 LAB NOTE 6 .

32 Vegetable 150 120 130 70 $ 0. j=1.6(90X1+190X2+90X3+130X4) IENG313 LAB NOTE 7 .2.68 Bread 120 110 90 75 $ 0. 4(vegetables)). MODEL: Objective Function: Subject to: Min Z= 0. Formulate as an LP model.17 Total Daily Requirement ≤ 2700 Calories ≥ 300 grams ≥ 250 grams ≥ 60 grams Calories Carbohydrates Protein Vitamins Cots Per Unit Consider that each student may eat at most 16 units of food stuff per day and the amount of protein taken from animal sources should not be more than the 60% of the total protein intake. and the cost and the nutritional contents of general food types are given in the following table.17X4 160X1+210X2+120X3+150X4 ≤ 2700 110X1+130X2+110X3+120X4 ≥ 300 90X1+190X2+90X3+130X4 50X1+50X2+75X3+70X4 36X1+76X2-54X3-78X4 X1+X2+X3+X4 Xj ≥ 0 ≤ 16 .Problem 1 A least cost diet has to be planned for the kitchen of the Strong Boys High School. The total daily requirements of the nutritional elements for healthy young boys.68X2+0. Required Nutritional Element Units of Nutritional Elements Per Unit of Food Type Milk 160 110 90 50 $ 0.3. 3(bread).4 ≥ 250 ≥ 60 ≤0 Calories: Carbohydrate: Protein: Vitamins: Protein balance: Or: Eating Capacity: Non-negativity: Lingo Model: 90X1+190X2 ≤ 0. Solution: Objective: To obtain minimum cost daily diet which satisfying the Nutritional requirements and eating capacity Decision Variables: Xj number of units of food type j into the daily diet of the student (where j=1 (milk).42X1+0. 2(meat).42 Meat 210 130 190 50 $ 0.32X3+0.

Lingo Model: IENG313 LAB NOTE 8 .Problem 2 Steelco manufactures two types of steel at three different steel mills.2. each steel mill has 200 hours of blast furnace time available.3 and j=1. Steelco must manufacture at least 500 tons of steel 1 and 600 tons of steel 2. Because of differences in the furnaces at each mill.2. the time and cost to produce a ton of steel differs for each mill. During a given month. Formulate an LP to minimize the cost of manufacturing the desired steel. The time and cost for each mill are shown in the bellow table. xij: tons of steel j that reached from mill i. Steel Cost ($) Mill 1 Mill 2 Mill 3 10 12 14 Time (Minutes) 20 24 28 Cost ($) 11 9 10 Steel 2 Time (Minutes) 22 18 30 Each month. where i=1.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->