For unlimited access to Class Notes, a Class+ subscription is required.

MGOC10 Analysis for Decision Making

Lecture 03

Chapter 2 – Solving LP Models with LINDO Solver Suite

Can download LINGO - www.lindo.com student/demo version or from the course

website.

Can also solve Linear Programs with Excel – see textbook Appendix 2.3.

LINGO does not work on MAC.

Some LINGO syntax

There is an “=” after the MAX or MIN in objective. Min = 6*V11+ 2*V12;

LINGO statements end with semicolon

Start program with “MODEL:” end of program with “END”

Arithmetic Operators: Power “^”, Multiply “*”, Division “/”, Addition “+”, Subtraction “-“.

Order of operations applies

Limit of 32 characters in variable name, must begin with A-Z.

To enter £ type “<=”, to enter ³ type “>=”.

Comments may be placed anywhere, comments are denoted by “!” and end with “;”

@FREE(x1) - allows variable x1 to be unrestricted in sign.

@BIN(x1) – specifies that x1 is 0 or 1 (binary)

@GIN(x1) - specifies that x1 is integer

Example - Giapetto’s Woodcarving

LP model

x1 = # soldiers produced each week

x2 = # trains produced each week

Max z = 3x1 + 2x2

ST 2x1 + 1 x2 ≤ 100

1x1 + 1x2 ≤ 80

x1 ≤ 40

x1 ≥ 0 and x2 ≥ 0

LINGO code

MODEL:

! MGTC74 LINGO example;

[OBJ] MAX = 3*X1 + 2*X2;

[FINISH] 2*X1 + X2 <= 100;

[CARPENTRY] X1 + X2 <= 80;

[DEMAND] X1 <= 40;

END

What is the optimal number of soldiers and trains to produce? Profits?

LINGO Output:

Global optimal solution found.

Objective value: 180.0000

Total solver iterations: 2

Variable Value Reduced Cost

X1 20.00000 0.000000

X2 60.00000 0.000000

Row Slack or Surplus Dual Price

OBJ 180.0000 1.000000

FINISH 0.000000 1.000000

CARPENTRY 0.000000 1.000000

DEMAND 20.00000 0.000000

# of soldiers produced = X1 = 20, # of trains produced = X2 = 60, Profits=objective value =$180

1

find more resources at oneclass.com

find more resources at oneclass.com

Chapter 3 - Sensitivity Analysis using LINGO

Example – 2 product 3 machine problem

A company produces two products using three machines. The profits from each product, the time each

product takes to produce and the amount of time available for each machine is given in the table below.

The objective is to max revenue.

Machine Product 1 Product 2 Hours Available

1 1 0 4

2 0 2 12

3 3 2 18

Revenue $3 $5

LP model

Let Xi = # of product i to produce

Max Z = 3X1 + 5X2

ST X1 £ 4

2X2 £ 12

3X1 + 2X2 £ 18

X1, X2 ³ 0

LINGO code

MODEL:

[OBJ] MAX = 3*X1 + 5*X2;

[MACH1] X1 <= 4;

[MACH2] 2*X2 <= 12;

[MACH3] 3*X1 + 2*X2 <= 18;

END

LINGO output

Global optimal solution found at step: 2

Objective value: 36.00000

Variable Value Reduced Cost

X1 2.000000 0.0000000

X2 6.000000 0.0000000

Row Slack or Surplus Dual Price

OBJ 36.00000 1.000000

MACH1 2.000000 0.0000000

MACH2 0.0000000 1.500000

MACH3 0.0000000 1.000000

(a) What is the optimal solution (revenue? number of product 1 and 2 made?)

What does the slack or surplus mean?

For machine 1, slack or surplus = 2 means there are 2 unused hours

For machine 2, slack or surplus = 0 means there are 0 unused hours

What does dual Price mean?

Dual price for machine 1 = 0, increasing mach 1 hours by 1, Z increase by $0

Dual price for machine 2 = 3/2, increasing mach 2 hours by 1, Z increases by $1.5

Dual price for machine 3 = 1, increasing mach 3 hours by 1, Z increases by $1.

How much would you be willing to pay for 4 more hrs on machine 2?

2

find more resources at oneclass.com

find more resources at oneclass.com