Sie sind auf Seite 1von 7

# APPENDIX

Problems

OBJECTIVE

EXAMPLE 1

## A number of available software packages can be used to solve linear programming

problems. Because of the popularity of LINDO, we have chosen to include a brief section illustrating how it can be used to solve some linear programming problems. LINDO was designed to allow users to do simple problems in an easy, cost efficient manner. At the other extreme, LINDO has been used to solve real industrial programs
involving more than 10,000 rows and several thousand variables. In solving such problems, LINDO uses a revised simplex method one that exploits the special character
of large linear programming problems. As a result, the intermediate tableaus obtained
using LINDO may differ from those obtained manually.
Using LINDO
Use LINDO to maximize
P  3x1  4x2
subject to
2x1  4x2  120
2x1  2x2  80
x1  0
x2  0

## The objective function

The constraints:
numbered 2 and 3

Instruction to begin
The initial tableau. SLK 2 is

## the slack variable associated

with constraint number 2. ROW
1 ART is the objective row. The
column for P is not written since
pivoting does not affect it. The
column on the far right is RHS.
to LINDO to represent the pivot
objective of minimizing the
sum of the infeasibilities.

LINDO SOLUTION
MAX
3 X1 + 4 X2
SUBJECT TO
2)
2 X1 + 4 X2 <=
3)
2 X1 + 2 X2 <=
END

120
80

: tabl
THE TABLEAU
ROW (BASIS)
1 ART
2 SLK
2
3 SLK
3
ART
3 ART

X1
-3.000
2.000
2.000
-3.000

X2
-4.000
4.000
2.000
-4.000

SLK

2
.000
1.000
.000
.000

SLK

3
.000
.000
1.000
.000

.000
120.000
80.000
.000

655

656

Appendix B

## Using LINDO to Solve Linear Programming Problems

Instruction to pivot
The pivot element is in row 3,
column X1. X1 will become
a basic variable.

## After pivoting, SLK 2 and

X1 are basic variables. P  120
at this stage; SLK 2  40;
X1  40; SLK 3  0; X2  0.

## The pivot element is in

row 2, column X2. After
pivoting, X2 and X1 are
basic variables.

## This is a final tableau.

The solution is P  140,
X1  20, X2  20.

## The value of the slack

variables are SLK 2  0,
SLK 3  0.

## Two pivots were used.

: piv
X1 ENTERS AT VALUE

: tabl
THE TABLEAU
ROW (BASIS)
1 ART
2 SLK
2
3
X1

40.000

X1
.000
.000
1.000

IN

X2
-1.000
2.000
1.000

ROW

OBJ. VALUE =

SLK

2
.000
1.000
.000

SLK
3
1.500
-1.000
.500

120.00

120.000
40.000
40.000

: piv
X2 ENTERS AT VALUE
: tabl
THE TABLEAU
ROW (BASIS)
1 ART
2
X2
3
X1

20.000

X1
.000
.000
1.000

IN

X2
.000
1.000
.000

: piv
LP OPTIMUM FOUND AT STEP

ROW

OBJ. VALUE =

SLK

2
.500
.500
-.500

SLK
3
1.000
-.500
1.000

140.00

140.000
20.000
20.000

## OBJECTIVE FUNCTION VALUE

1)
140.00000
VARIABLE
X1
X2
ROW
2)
3)

VALUE
20.000000
20.000000

REDUCED COST
.000000
.000000

SLACK OR SURPLUS
.000000
.000000

NO. ITERATIONS =

DUAL PRICES
.500000
1.000000

Compare the steps in Example 1, using LINDO, with the steps given in Example 1,
Section 4.2.
EXAMPLE 2

Using LINDO
Use LINDO to maximize
P  20x1  15x2
subject to

x1  x2  7
9x 1  5x 2  45
2x 1  x 2  8
x1  0
x2  0

SOLUTION
MAX
20 X1 + 15 X2
SUBJECT TO
2)
X1 + X2 >=
7
3)
9 X1 + 5 X2 <=
45
4)
2 X1 + X2 >=
8
END
: tabl
THE TABLEAU
ROW (BASIS)
X1
X2
1 ART
-20.000
-15.000
2 SLK
2
-1.000
-1.000
3 SLK
3
9.000
5.000
4 SLK
4
-2.000
-1.000
ART
4 ART
-3.000
-2.000

SLK
2
.000
1.000
.000
.000
1.000

SLK
3
.000
.000
1.000
.000
.000

SLK
4
.000
.000
.000
1.000
1.000

.000
-7.000
45.000
-8.000
-15.000

## Appendix B Using LINDO to Solve Linear Programming Problems

657

: piv
X1 ENTERS AT VALUE

5.0000

IN ROW

3 OBJ. VALUE =

100.00

: tabl
THE TABLEAU

ART

ROW
1
2
3
4
4

(BASIS)
ART
SLK
2
X1
SLK
4
ART

X1
.000
.000
1.000
.000
.000

X2
-3.889
-.444
.556
.111
-.444

SLK
2
.000
1.000
.000
.000
1.000

SLK
3
2.222
.111
.111
.222
.111

SLK
4
.000
.000
.000
1.000
.000

100.000
-2.000
5.000
2.000
-2.000

: piv
X2 ENTERS AT VALUE

4.5000

IN ROW

2 OBJ. VALUE =

117.50

SLK
3
1.250
-.250
.250
.250
1.250

SLK
4
.000
.000
.000
1.000

3 OBJ. VALUE =

117.50

: tabl
THE TABLEAU

ART

ROW (BASIS)
1 ART
2
X2
3
X1
4 SLK
4
4 ART

: piv
SLK

X1
.000
.000
1.000
.000
.000

2 ENTERS AT VALUE

X2
.000
1.000
.000
.000
.000
2.0000

SLK
2
-8.750
-2.250
1.250
.250
-8.750
IN ROW

117.500
4.500
2.500
1.500

: tabl
THE TABLEAU
ROW (BASIS)
1 ART
2
X2
3 SLK
2
4 SLK
4

X1
7.000
1.800
.800
-.200

X2
.000
1.000
.000
.000

: piv
LP OPTIMUM FOUND AT STEP

SLK

2
.000
.000
1.000
.000

SLK
3
3.000
.200
.200
.200

SLK

4
.000
.000
.000
1.000

135.000
9.000
2.000
1.000

## OBJECTIVE FUNCTION VALUE

1)
135.00000
VARIABLE
X1
X2
ROW
2)
3)
4)

VALUE
.000000
9.000000

REDUCED COST
7.000000
.000000

SLACK OR SURPLUS
2.000000
.000000
1.000000

NO. ITERATIONS =

DUAL PRICES
.000000
3.000000
.000000

Compare the final tableau found using LINDO with the final tableau of Example 1,
Section 4.4, namely,
BV P
s1
x2
s3
P

0
0
0
1

x1 x2
4
0
5
9
1
5
1
0

5
7
0

s1
1
0
0
0

s2
1
5
1
5
1
5
3

s3 RHS

135

658

Appendix B

## The solution, in both cases, is P  135, x2  9, x1  0, s1  SLK 2  2, s2  SLK 3  0,

s3  SLK 4  1. Notice also that the intermediate tableaus are different. This is because
LINDO uses a revised simplex method that requires additional computations not easily
performed manually.
EXAMPLE 3

Using LINDO
Use LINDO to minimize
z  5x1  6x2
subject to

x 1  x 2  10
x 1  2x 2  12
2x 1  x 2  12
 3
x1
x1  0
x2  0

SOLUTION
MIN
5 X1 + 6 X2
SUBJECT TO
2) X1 + X2 <= 10
3) X1 + 2 X2 >= 12
4) 2 X1 + X2 >= 12
5) X1 >= 3
END
: tabl
THE TABLEAU

ART

ROW
1
2
3
4
5
5

(BASIS)
ART
SLK
2
SLK
3
SLK
4
SLK
5
ART

X1
5.000
1.000
-1.000
-2.000
-1.000
-4.000

X2
6.000
1.000
-2.000
-1.000
.000
-3.000

SLK
2
.000
1.000
.000
.000
.000
.000

SLK
3
.000
.000
1.000
.000
.000
1.000

SLK
4
.000
.000
.000
1.000
.000
1.000

SLK
5
.000
.000
.000
.000
1.000
1.000

.000
10.000
-12.000
-12.000
-3.000
-27.000

SLK
5
.000
.000
.000
.000
1.000
.000

-30.000
4.000
-6.000
6.000
3.000
-6.000

SLK
5
.000
.000
.000
.000
1.000

-44.000
2.000
4.000
4.000
1.000

: piv
X1 ENTERS AT VALUE

6.0000

IN ROW

## 4 OBJ. VALUE = -30.000

: tabl
THE TABLEAU

ART

ROW
1
2
3
4
5
5

(BASIS)
ART
SLK
2
SLK
3
X1
SLK
5
ART

X1
.000
.000
.000
1.000
.000
.000

X2
3.500
.500
-1.500
.500
.500
-1.500

SLK
2
.000
1.000
.000
.000
.000
.000

SLK
3
.000
.000
1.000
.000
.000
1.000

SLK
4
2.500
.500
-.500
-.500
-.500
-.500

: piv
X2 ENTERS AT VALUE
: tabl
THE TABLEAU

ART

ROW
1
2
3
4
5
5

(BASIS)
ART
SLK
2
X2
X1
SLK
5
ART

X1
.000
.000
.000
1.000
.000
.000

4.0000

X2
.000
.000
1.000
.000
.000
.000

IN ROW

SLK
2
.000
1.000
.000
.000
.000
.000

SLK
3
2.333
.333
-.667
.333
.333
2.333

SLK
4
1.333
.333
.333
-.667
-.667
1.333

## Appendix B Using LINDO to Solve Linear Programming Problems

: piv
LP OPTIMUM FOUND AT STEP
OBJECTIVE FUNCTION VALUE
1)
44.000000
VARIABLE
X1
X2
ROW

VALUE
4.000000
4.000000
SLACK OR SURPLUS

2)
3)
4)
5)
NO. ITERATIONS =

659

REDUCED COST
.000000
.000000
DUAL PRICES

2.000000
.000000
.000000
1.000000

.000000
-2.333333
-1.333333
.000000

Compare this result, using LINDO, to the result obtained in Example 2, Section 4.4.
Note again that the same solution is found: z  44, x1  4, x2  4, s1  SLK 2  2,
s2  SLK 3  0, s3  SLK 4  0, s4  SLK 5  1. Also, note again the different intermediate tableaus.
EXERCISE B.1

## Answers to Odd-Numbered Problems Begin on Page AN-00.

In Problems 1 24, use LINDO (or any other software package) to solve each linear programming problem.
1. Maximize

2. Maximize

P  3x1  2x2  x3
subject to

P  x1  4x2  3x3  x4
subject to

3x1  x2  x3  30

2x1  x2

5x1  2x2  x3  24

3x1  x2  x3  2x4  18

x1  x2  4x3  20

x1  x2  x3  x4  14

x1  0

x2  0

x3  0

3. Maximize

x1  0

 10

x2  0

x3  0

x4  0

4. Maximize

P  3x1  x2  x3
subject to

P  3x1  x2  x3
subject to

x1  x2  x3  6

x1  x2  x3  8

## 2x1  3x2  4x3  10

2x1  x2  4x3  6

x1  0

x2  0

x1  0

x3  0

5. Maximize

x2  0

6. Maximize

P  2x1  x2  3x3
subject to

## P  2x1  2x2  3x3

subject to

x1  x2  x3  10
x2  x3  4
x1  0

x2  0

x1  x2  x3  6
x1
4

x3  0

7. Maximize

x1  0

x2  0

x3  0

8. Maximize

P  x1  x2  x3
subject to

P  2x1  x2  3x3
subject to

x1  x2  x3  6
4x1  x2
x1  0

x2  0

 12
x3  0

x1  x2  x3  6
2x1  3x2
x1  0

x2  0

 12
x3  0

660

Appendix B

## Using LINDO to Solve Linear Programming Problems

10. Maximize

9. Maximize

P  3x1  2x2  x3

P  2x1  x2  3x3
subject to

subject to

3x1  2x2  x3  10

5x1  2x2  x3  20
6x1  x2  4x3  24

x1  x2  3x3  12

x1  x2  4x3  16

2x1  x2  x3  6

x1  0

x2  0

x1  0

x3  0

11. Maximize

x2  0

x3  0

12. Maximize

P  2x1  3x2  x3

## P  4x1  4x2  2x3

subject to

subject to
x1  x2  x3  50

3x1  x2  x3  10

3x1  2x2  x3  10
x1  0

x2  0

x1  x2  3x3  5

x3  0

13. Maximize

x1  0

x2  0

x3  0

14. Maximize

P  2x1  x2  x3

## P  4x1  2x2  5x3

subject to

subject to
2x1  x2  2x3  4

x1  3x2  2x3  30

x1  2x2  x3  2

2x1  x2  3x3  12

x1  0

x2  0

x3  0

x1  0

x2  0

x3  0

16. Maximize

15. Maximize

## P  6x1  3x2  2x3

P  2x1  x2  3x3
subject to

subject to
x1  2x2  x3  25

## 3x1  2x2  3x3  30

2x1  2x2  x3  12

x1  0

x2  0

x1  0

x3  0

x2  0

x3  0

18. Maximize

17. Maximize

P  2x1  4x2  x3

P  2x1  4x2  x3  x4
subject to

subject to
2x1  x2  2x3  3x4  12

## x1  2x2  3x3  6

2x2  x3  2x4  20

2x1  x2  4x3
x1  0

x2  0

## x1  5x2  7x3  7

 16
x3  0

x1  0

x4  0

x2  0

x3  0

20. Maximize

19. Maximize

P  x1  2x2  4x3

P  2x1  x2  x3
subject to

subject to
x1  2x2  4x3  20

## 2x1  4x2  4x3  60

2x1  6x2  x3  5

3x1  4x2  x3  90
x1  0

x2  0

x3  0

2x1  2x2  x3  15
x1  0

x2  0

x3  0

## Appendix B Using LINDO to Solve Linear Programming Problems

21. Maximize

22. Maximize

P  x1  2x2  4x3  x4

P  x1  2x2  x3  3x4

subject to

subject to
 4x3  6x4  20

5x1

x1  0

x2  0

x3  0

## 4x1  4x2  2x3  2x4  4

x4  0

23. Minimize

x1  0

x2  0

x3  0

x4  0

24. Minimize

z  x1  x2  x3  x4  x5  x6  x7

z  x1  x2  x3  x4  x5  x6  x7

subject to

subject to

4x1  2x2  x3

 2x5  x6

 75

 x6

 110

x2  2x3  3x4

4x1  x2  2x3

 2x5

 x7  180

x5  x6  2x7  50
x1  0

x2  0

x5  0

x3  0

x6  0

x4  0

x7  0

 x7  75

2x2  x3  3x4

x5  2x6  x7  50
x1  0

x2  0

x5  0

x3  0

x6  0

x4  0

x7  0

661