indian institute of science - nptelnptel.ac.in/courses/105108130/module2/lecture09.pdf ·  ·...

22
Water Resources Systems: Modeling Techniques and Analysis Lecture - 9 Course Instructor : Prof. P. P. MUJUMDAR Department of Civil Engg., IISc. INDIAN INSTITUTE OF SCIENCE 1

Upload: vanthien

Post on 03-Apr-2018

219 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

Water Resources Systems:Modeling Techniques and Analysis

Lecture - 9Course Instructor : Prof. P. P. MUJUMDAR

Department of Civil Engg., IISc.

INDIAN INSTITUTE OF SCIENCE

1

Page 2: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

Summary of the previous lecture

2

• Graphical method• General form of LP• Motivation for the simplex method

Page 3: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

LP – Simplex Method

Motivation for the Simplex method

Max Z =

s.t.

3

1 26 8x x

1 25 10 60x x

1 2

1

2

4 4 40

0

0

x x

x

x

Page 4: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

4

x1

x2

LP – Simplex Method

Feasible region

O D

A

B

C

E

Page 5: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

LP – Simplex Method

In the general form of LP, the constraints are converted as

5

1 25 10 60x x

1 2

1

2

4 4 40

0

0

x x

x

x

1 2 35 10 60x x x

1 2 4

1 2

3 4

4 4 40

0; 0

0; 0

x x x

x x

x x

2 equations and 4 unknowns

x3, x4 are slack variables

Page 6: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

LP – Simplex Method• In general, m equations in n unknowns (n > m),

including slack and surplus variables• It is possible to solve for m variables in terms of the

other (n – m) variables• Basic solution: A basic solution is a solution obtained

by setting (n – m) variables to zero• The m variables whose solution is sought by setting

the remaining (n – m) variables to zero are called the basic variables

• The (n – m) variables which are set to zero are called the non-basic variables. It may so happen that some variables may take a value of zero arising out of the solution of the m equations, but they are not non-basic variables as they are not initialized to zero.

6

Page 7: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

LP – Simplex Method

• Since out of n variables, any of the (n – m) variables may be set to zero, the no. of basic solutions will correspond to the no. of ways in which m variables can be selected out of n variables i.e.,

For the problem being considered, with n = 4 and m = 2, the no. of basic solutions will be

7

mnC

!! !

nm n m

4! 6

2! 4 2 !

=

Page 8: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

8

x1

x2

LP – Simplex Method

Feasible region

O D

A

B

C

E

Page 9: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

LP – Simplex Method

• In the example, the basic solutions are

9

x1 x2 x3 x4 Point on graph Feasible0 0 60 40 O Y0 6 0 16 A Y0 10 -40 0 B N8 2 0 0 C Y10 0 10 0 D Y12 0 0 -8 E N

1 2 35 10 60x x x 1 2 44 4 40x x x

Page 10: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

10

LP – Simplex Method

• All the basic solutions need not (and, in general, will not) be feasible.

• A basic solution which is also feasible is called as the Basic Feasible Solution.

• All the corner points of the feasible space are basic feasible solutions.

Page 11: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

11

LP – Simplex Method

• As the size of a LP problem increases, the no. of basic solutions also increases.

• The possible no. of basic feasible solutions can be too large to be enumerated completely.

• The goal would be, starting with an initial basic feasible solution, to generate better and better basic feasible solutions until the optimal basic feasible solution is obtained.

Page 12: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

12

LP – Simplex MethodAlgebraic approach (Simplex algorithm):

• To solve the problem algebraically, we must be able to sequentially generate a set of basic feasible solutions

1 2 35 10 60x x x

1 2 4

1 2

3 4

4 4 40

0; 0

0; 0

x x x

x x

x x

1 2 3 46 8 0 0Z x x x x Maximize

s.t.

Page 13: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

13

LP – Simplex Method

1. Determine an initial basic feasible solution:• The best way to obtain an initial basic feasible

solution would be to put all the decision variables (n – m in no., if we have one slack/surplus variable associated with each constraint) to zero.

• In the example, choose the slack variables x3 and x4to be basic and x1 and x2 to be non-basic (i.e., set x1 = 0 and x2 = 0 )

Basis : 3

4

xx

1 2 35 10 60x x x

1 2 44 4 40x x x

Page 14: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

14

LP – Simplex Method

• Solve the m (=2) equations for m basic variables

1 2 35 10 60x x x

1 2 44 4 40x x x 3 60x

4 40x

Initial basic feasible solution is3

4

6040

xx

Point ‘O’ on the graph

Z = 0

Page 15: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

15

LP – Simplex Method

• Now we have to generate another basic feasible solution from the initial basic feasible solution such that there is an improvement in the objective function value, Z.

• The new solution is obtained as follows• ONE presently non-basic variable (x1 or x2) must

be selected to enter the current basis, thus becoming basic.

• ONE presently basic variable (x3 or x4) must be selected to leave the current basis, thus becoming non-basic.

Page 16: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

16

LP – Simplex Method

First operation:

• Either x1 or x2 can enter the basis.• The question now is, out of x1 and x2 which variable

should enter the basis?• Since the problem is to maximize the objective

function (OF), we must look for the variable which will increase the OF value the fastest.

• Because the coefficient of x2 in the OF is higher than that of x1, x2 increases the OF value faster than x1does. Hence x2 should enter the basis.

1 2 3 46 8 0 0Z x x x x

Current basis :3

4

xx

Page 17: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

17

LP – Simplex Method

Second operation:• As the value of newly selected basic variable x2 is

increased (x1 still being zero), the other two variables, x3 and x4 (which are currently in the basis) keep reducing.

• One of these will reach its lower limit (zero) earlier than the other

• x3 = 0 when 10x2 = 60 or x2 = 6• x4 = 0 when 4x2 = 40 or x2 = 10

3 260 10x x

4 240 4x x

1 2 35 10 60x x x

1 2 44 4 40x x x

Page 18: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

18

LP – Simplex Method• To increase the OF value, we would be interested in

increasing x2 to the greatest extent possible.• As soon as x2 reaches 6, x3 becomes zero (x4 is still

non-zero)• Therefore for x2 entering the basis, x3 must leave the

basis.• Therefore new basis is

• The new basic solution is obtained by Guass Jordan elimination method.

• The process continues until the maximum value of the function is arrived at.

4

2

xx

Page 19: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

Example – 1Maximize

s.t.

19

Constraints

Decision variables

21 53 xxZ

00

1823122

4

2

1

21

2

1

xx

xxx

x

Page 20: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

0;0;00;0

1823122

4

543

21

521

42

31

xxxxx

xxxxx

xx

Example – 1 (Contd.)The problem is converted into standard LP form

s.t.

20

n = no. of variables = 5; m = no. of constraints =3

1 2 3 4 53 5 0 0 0Z x x x x x Maximize

00

1823122

4

2

1

21

2

1

xx

xxx

x

Page 21: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

Example – 1 (Contd.)

Seek solution from m variables by setting (n – m) variables to zero

The solution is obtained by creating a table with coefficients of variables.

21

x1 and x2 are non basic variables (whose values are set to zero)

x3, x4 and x5 are basic variables (whose solution is sought)

Page 22: INDIAN INSTITUTE OF SCIENCE - NPTELnptel.ac.in/courses/105108130/module2/Lecture09.pdf ·  · 2017-08-04INDIAN INSTITUTE OF SCIENCE 1. Summary of the previous lecture 2 ... • The

Example – 1 (Contd.)Iteration-1

22

Basis Row Z x1 x2 x3 x4 x5 bi

Z 0 1 -3 -5 0 0 0 0

x3 1 0 1 0 1 0 0 4

x4 2 0 0 2 0 1 0 12

x5 3 0 3 2 0 0 1 18

1 2 3 4 53 5 0 0 0 0Z x x x x x

1 3

2 4

1 2 5

42 123 2 18

x xx xx x x