course detail

2 downloads 0 Views 2MB Size Report
Piecewise linear approximation of a nonlinear function. 1. 6 ..... practice though, answers that make good sense in terms of the underlying physical or economic ...... Similarly, at maxima and points of inflection as the slope is zero, the .... 3 / 2. x x x x. +. −. +. −. 1 and x2 are variables based on cement and concrete ratios.
COURSE DETAIL Module 1. Introduction and Basic Concepts

Sub-Module

Module Hours

Historical Development; Engineering applications of Optimization; Art of Modeling

1

Objective function; Constraints and Constraint surface; Formulation of design problems as mathematical programming problems

2 6

2. Optimization using Calculus

3. Linear Programming

Classification of optimization problems

1

Optimization techniques – classical and advanced techniques

2

Stationary points; Functions of single and two variables; Global Optimum

1

Convexity and concavity of functions of one and two variables

1

Optimization of function of one variable and multiple variables; Gradient vectors; Examples

1

Optimization of function of multiple variables subject to equality constraints; Lagrangian function

1

Optimization of function of multiple variables subject to equality constraints; Hessian matrix formulation; Eigen values

1

Kuhn-Tucker Conditions; Examples

1

Standard form of linear programming (LP) problem; Canonical form of LP problem; Assumptions in LP Models; Elementary operations

1

Graphical method for two variable optimization problem; Examples

1

Motivation of simplex method, Simplex algorithm and construction of simplex tableau; Simplex criterion; Minimization versus maximization problems

2

Revised simplex method; Duality in LP; Primal-dual relations; Dual Simplex method; Sensitivity or post optimality analysis

1

6

6

2

4. Linear Programming Applications

5. Dynamic Programming

6. Dynamic Programming Applications

7. Integer Programming

8. Advanced Topics in Optimization

Other algorithms for solving LP problems – Karmarkar’s projective scaling method

1

Use of software for solving linear optimization problems using graphical and simplex methods

2

Examples for transportation, assignment, water resources, structural and other optimization problems

3

Sequential optimization; Representation of multistage decision process; Types of multistage decision problems; Concept of sub optimization and the principle of optimality

2

Recursive equations – Forward and backward recursions; Computational procedure in dynamic programming (DP)

2

Discrete versus continuous dynamic programming; Multiple state variables; curse of dimensionality in DP

2

Problem formulation and application in Design of continuous beam and Optimal geometric layout of a truss

2

Water allocation as a sequential process

2

Capacity expansion and Reservoir operation

2

Integer linear programming; Concept of cutting plane method

2

Mixed integer programming; Solution algorithms; Examples

2

Piecewise linear approximation of a nonlinear function

1

Multi objective optimization – Weighted and constrained methods; Multi level optimization

2

Direct and indirect search methods

1

Evolutionary algorithms for optimization and search

1

Applications in civil engineering

1

Total

5

6

6

4

6

45

3

Optimization Methods: Introduction and Basic Concepts

1

Module – 1 Lecture Notes – 1 Historical Development and Model Building Introduction In this lecture, historical development of optimization methods is glanced through. Apart from the major developments, some recently developed novel approaches, such as, goal programming for multi-objective optimization, simulated annealing, genetic algorithms, and neural network methods are briefly mentioned tracing their origin. Engineering applications of optimization with different modeling approaches are scanned through from which one would get a broad picture of the multitude applications of optimization techniques.

Historical Development The existence of optimization methods can be traced to the days of Newton, Lagrange, and Cauchy. The development of differential calculus methods for optimization was possible because of the contributions of Newton and Leibnitz to calculus. The foundations of calculus of variations, which deals with the minimization of functions, were laid by Bernoulli, Euler, Lagrange, and Weistrass. The method of optimization for constrained problems, which involve the addition of unknown multipliers, became known by the name of its inventor, Lagrange. Cauchy made the first application of the steepest descent method to solve unconstrained optimization problems. By the middle of the twentieth century, the high-speed digital computers made implementation of the complex optimization procedures possible and stimulated further research on newer methods. Spectacular advances followed, producing a massive literature on optimization techniques. This advancement also resulted in the emergence of several well defined new areas in optimization theory.

Some of the major developments in the area of numerical methods of unconstrained optimization are outlined here with a few milestones. •

Development of the simplex method by Dantzig in 1947 for linear programming problems



The enunciation of the principle of optimality in 1957 by Bellman for dynamic programming problems,

M1L1 4

Optimization Methods: Introduction and Basic Concepts •

2

Work by Kuhn and Tucker in 1951 on the necessary and sufficient conditions for the optimal solution of programming problems laid the foundation for later research in non-linear programming.



The contributions of Zoutendijk and Rosen to nonlinear programming during the early 1960s have been very significant.



Work of Carroll and Fiacco and McCormick facilitated many difficult problems to be solved by using the well-known techniques of unconstrained optimization.



Geometric programming was developed in the 1960s by Duffin, Zener, and Peterson.



Gomory did pioneering work in integer programming, one of the most exciting and rapidly developing areas of optimization. The reason for this is that most real world applications fall under this category of problems.



Dantzig and Charnes and Cooper developed stochastic programming techniques and solved problems by assuming design parameters to be independent and normally distributed.

The necessity to optimize more than one objective or goal while satisfying the physical limitations led to the development of multi-objective programming methods. Goal programming is a well-known technique for solving specific types of multi-objective optimization problems. The goal programming was originally proposed for linear problems by Charnes and Cooper in 1961. The foundation of game theory was laid by von Neumann in 1928 and since then the technique has been applied to solve several mathematical, economic and military problems. Only during the last few years has game theory been applied to solve engineering problems.

Simulated annealing, genetic algorithms, and neural network methods represent a new class of mathematical programming techniques that have come into prominence during the last decade. Simulated annealing is analogous to the physical process of annealing of metals and glass. The genetic algorithms are search techniques based on the mechanics of natural selection and natural genetics. Neural network methods are based on solving the problem using the computing power of a network of interconnected ‘neuron’ processors.

M1L1 5

Optimization Methods: Introduction and Basic Concepts

3

Engineering applications of optimization To indicate the widespread scope of the subject, some typical applications in different engineering disciplines are given below. •

Design of civil engineering structures such as frames, foundations, bridges, towers, chimneys and dams for minimum cost.



Design of minimum weight structures for earth quake, wind and other types of random loading.



Optimal plastic design of frame structures (e.g., to determine the ultimate moment capacity for minimum weight of the frame).



Design of water resources systems for obtaining maximum benefit.



Design of optimum pipeline networks for process industry.



Design of aircraft and aerospace structure for minimum weight



Finding the optimal trajectories of space vehicles.



Optimum design of linkages, cams, gears, machine tools, and other mechanical components.



Selection of machining conditions in metal-cutting processes for minimizing the product cost.



Design of material handling equipment such as conveyors, trucks and cranes for minimizing cost.



Design of pumps, turbines and heat transfer equipment for maximum efficiency.



Optimum design of electrical machinery such as motors, generators and transformers.



Optimum design of electrical networks.



Optimum design of control systems.



Optimum design of chemical processing equipments and plants.



Selection of a site for an industry.



Planning of maintenance and replacement of equipment to reduce operating costs.



Inventory control.



Allocation of resources or services among several activities to maximize the benefit.



Controlling the waiting and idle times in production lines to reduce the cost of production.



Planning the best strategy to obtain maximum profit in the presence of a competitor. M1L1 6

Optimization Methods: Introduction and Basic Concepts •

4

Designing the shortest route to be taken by a salesperson to visit various cities in a single tour.



Optimal production planning, controlling and scheduling.



Analysis of statistical data and building empirical models to obtain the most accurate representation of the statistical phenomenon.

However, the list is incomplete.

Art of Modeling: Model Building Development of an optimization model can be divided into five major phases. •

Data collection



Problem definition and formulation



Model development



Model validation and evaluation of performance



Model application and interpretation

Data collection may be time consuming but is the fundamental basis of the model-building process. The availability and accuracy of data can have considerable effect on the accuracy of the model and on the ability to evaluate the model.

The problem definition and formulation includes the steps: identification of the decision variables; formulation of the model objective(s) and the formulation of the model constraints. In performing these steps the following are to be considered. •

Identify the important elements that the problem consists of.



Determine the number of independent variables, the number of equations required to describe the system, and the number of unknown parameters.



Evaluate the structure and complexity of the model



Select the degree of accuracy required of the model

Model development includes the mathematical description, parameter estimation, input development, and software development. The model development phase is an iterative process that may require returning to the model definition and formulation phase. The model validation and evaluation phase is checking the performance of the model as a whole. Model validation consists of validation of the assumptions and parameters of the M1L1 7

Optimization Methods: Introduction and Basic Concepts

5

model. The performance of the model is to be evaluated using standard performance measures such as Root mean squared error and R2 value. A sensitivity analysis should be performed to test the model inputs and parameters. This phase also is an iterative process and may require returning to the model definition and formulation phase. One important aspect of this process is that in most cases data used in the formulation process should be different from that used in validation. Another point to keep in mind is that no single validation process is appropriate for all models. Model application and implementation include the use of the model in the particular area of the solution and the translation of the results into operating instructions issued in understandable form to the individuals who will administer the recommended system. Different modeling techniques are developed to meet the requirements of different types of optimization problems. Major categories of modeling approaches are: classical optimization techniques, linear programming, nonlinear programming, geometric programming, dynamic programming, integer programming, stochastic programming, evolutionary algorithms, etc. These modeling approaches will be discussed in subsequent modules of this course.

M1L1 8

Optimization Methods: Introduction and Basic concepts

1

Module – 1 Lecture Notes – 2 Optimization Problem and Model Formulation Introduction In the previous lecture we studied the evolution of optimization methods and their engineering applications. A brief introduction was also given to the art of modeling. In this lecture we will study the Optimization problem, its various components and its formulation as a mathematical programming problem. Basic components of an optimization problem: An objective function expresses the main aim of the model which is either to be minimized or maximized. For example, in a manufacturing process, the aim may be to maximize the profit or minimize the cost. In comparing the data prescribed by a user-defined model with the observed data, the aim is minimizing the total deviation of the predictions based on the model from the observed data. In designing a bridge pier, the goal is to maximize the strength and minimize size. A set of unknowns or variables control the value of the objective function. In the manufacturing problem, the variables may include the amounts of different resources used or the time spent on each activity. In fitting-the-data problem, the unknowns are the parameters of the model. In the pier design problem, the variables are the shape and dimensions of the pier. A set of constraints are those which allow the unknowns to take on certain values but exclude others. In the manufacturing problem, one cannot spend negative amount of time on any activity, so one constraint is that the "time" variables are to be non-negative. In the pier design problem, one would probably want to limit the breadth of the base and to constrain its size. The optimization problem is then to find values of the variables that minimize or maximize the objective function while satisfying the constraints.

Objective Function As already stated, the objective function is the mathematical function one wants to maximize or minimize, subject to certain constraints. Many optimization problems have a single M1L2 9

Optimization Methods: Introduction and Basic concepts

2

objective function. (When they don't they can often be reformulated so that they do) The two exceptions are: •

No objective function. In some cases (for example, design of integrated circuit layouts), the goal is to find a set of variables that satisfies the constraints of the model. The user does not particularly want to optimize anything and so there is no reason to define an objective function. This type of problems is usually called a feasibility problem.



Multiple objective functions. In some cases, the user may like to optimize a number of different objectives concurrently. For instance, in the optimal design of panel of a door or window, it would be good to minimize weight and maximize strength simultaneously. Usually, the different objectives are not compatible; the variables that optimize one objective may be far from optimal for the others. In practice, problems with multiple objectives are reformulated as single-objective problems by either forming a weighted combination of the different objectives or by treating some of the objectives as constraints.

Statement of an optimization problem An optimization or a mathematical programming problem can be stated as follows:

⎛ x1 ⎞ ⎜ ⎟ ⎜ x2 ⎟ To find X = ⎜ . ⎟ which minimizes f(X) ⎜ ⎟ ⎜ . ⎟ ⎜x ⎟ ⎝ n⎠

(1.1)

Subject to the constraints gi(X) ≤ 0 ,

i = 1, 2, …., m

lj(X) = 0 ,

j = 1, 2, …., p

where X is an n-dimensional vector called the design vector, f(X) is called the objective function, and gi(X) and lj(X) are known as inequality and equality constraints, respectively. The number of variables n and the number of constraints m and/or p need not be related in any way. This type problem is called a constrained optimization problem.

M1L2 10

Optimization Methods: Introduction and Basic concepts

3

If the locus of all points satisfying f(X) = a constant c, is considered, it can form a family of surfaces in the design space called the objective function surfaces. When drawn with the constraint surfaces as shown in Fig 1 we can identify the optimum point (maxima). This is possible graphically only when the number of design variables is two. When we have three or more design variables because of complexity in the objective function surface, we have to solve the problem as a mathematical problem and this visualization is not possible.

C1 > C2 > C3 >C4 …..> Cn

.

f = C1 f = C2 f = C3

f= C4 f = C5

Optimum point

Fig 1

Optimization problems can be defined without any constraints as well. ⎛ x1 ⎞ ⎜ ⎟ ⎜ x2 ⎟ To find X = ⎜ . ⎟ which minimizes f(X) ⎜ ⎟ ⎜ . ⎟ ⎜x ⎟ ⎝ n⎠

(1.2)

Such problems are called unconstrained optimization problems. The field of unconstrained optimization is quite a large and prominent one, for which a lot of algorithms and software are available. M1L2 11

Optimization Methods: Introduction and Basic concepts

4

Variables

These are essential. If there are no variables, we cannot define the objective function and the problem constraints. In many practical problems, one cannot choose the design variable arbitrarily. They have to satisfy certain specified functional and other requirements. Constraints

Constraints are not essential. It's been argued that almost all problems really do have constraints. For example, any variable denoting the "number of objects" in a system can only be useful if it is less than the number of elementary particles in the known universe! In practice though, answers that make good sense in terms of the underlying physical or economic criteria can often be obtained without putting constraints on the variables. Design constraints are restrictions that must be satisfied to produce an acceptable design. Constraints can be broadly classified as: 1) Behavioral or Functional constraints: These represent limitations on the behavior performance of the system. 2) Geometric or Side constraints: These represent physical limitations on design variables such as availability, fabricability, and transportability. For example, for the retaining wall design shown in the Fig 2, the base width W cannot be taken smaller than a certain value due to stability requirements. The depth D below the ground level depends on the soil pressure coefficients Ka and Kp. Since these constraints depend on the performance of the retaining wall they are called behavioral constraints. The number of anchors provided along a cross section Ni cannot be any real number but has to be a whole number. Similarly thickness of reinforcement used is controlled by supplies from the manufacturer. Hence this is a side constraint.

M1L2 12

Optimization Methods: Introduction and Basic concepts

5

Ni no. of anchors

D

W Fig. 2 Constraint Surfaces

Consider the optimization problem presented in eq. 1.1 with only the inequality constraint gi(X) ≤ 0 . The set of values of X that satisfy the equation gi(X) ≤ 0 forms a boundary surface in the design space called a constraint surface. This will be a (n-1) dimensional subspace where n is the number of design variables. The constraint surface divides the design space into two regions: one with gi(X) < 0 (feasible region) and the other in which gi(X) > 0 (infeasible region). The points lying on the hyper surface will satisfy gi(X) =0. The collection of all the constraint surfaces gi(X) = 0, j= 1, 2, …, m, which separates the acceptable region is called the composite constraint surface. Fig 3 shows a hypothetical two-dimensional design space where the feasible region is denoted by hatched lines. The two-dimensional design space is bounded by straight lines as shown in the figure. This is the case when the constraints are linear. However, constraints may be nonlinear as well and the design space will be bounded by curves in that case. A design point that lies on more than one constraint surface is called a bound point, and the associated constraint is called an active constraint. Free points are those that do not lie on any constraint surface. The design points that lie in the acceptable or unacceptable regions can be classified as following: 1. Free and acceptable point 2. Free and unacceptable point M1L2 13

Optimization Methods: Introduction and Basic concepts

6

3. Bound and acceptable point 4. Bound and unacceptable point. Examples of each case are shown in Fig. 3.

Infeasible region

Side constraint g3 ≥ 0

.

Feasible region Bound acceptable point.

Free unacceptable point

Bound unacceptable point.

Behavior constraint g2 ≤ 0

Behavior constraint g1 ≤0

.

Free acceptable point

Fig. 3

Formulation of design problems as mathematical programming problems

In mathematics, the term optimization, or mathematical programming, refers to the study of problems in which one seeks to minimize or maximize a real function by systematically choosing the values of real or integer variables from within an allowed set. This problem can be represented in the following way Given: a function f : A

R from some set A to the real numbers

Sought: an element x0 in A such that f(x0) ≤ f(x) for all x in A ("minimization") or such that f(x0) ≥ f(x) for all x in A ("maximization"). Such a formulation is called an optimization problem or a mathematical programming problem (a term not directly related to computer programming, but still in use for example,

M1L2 14

Optimization Methods: Introduction and Basic concepts

7

in linear programming – (see module 3)). Many real-world and theoretical problems may be modeled in this general framework. Typically, A is some subset of the Euclidean space Rn, often specified by a set of constraints, equalities or inequalities that the members of A have to satisfy. The elements of A are called candidate solutions or feasible solutions. The function f is called an objective function, or cost function. A feasible solution that minimizes (or maximizes, if that is the goal) the objective function is called an optimal solution. The domain A of f is called the search space. Generally, when the feasible region or the objective function of the problem does not present convexity (refer module 2), there may be several local minima and maxima, where a local minimum x* is defined as a point for which there exists some δ > 0 so that for all x such that ; and

that is to say, on some region around x* all the function values are greater than or equal to the value at that point. Local maxima are defined similarly. A large number of algorithms proposed for solving non-convex problems – including the majority of commercially available solvers – are not capable of making a distinction between local optimal solutions and rigorous optimal solutions, and will treat the former as the actual solutions to the original problem. The branch of applied mathematics and numerical analysis that is concerned with the development of deterministic algorithms that are capable of guaranteeing convergence in finite time to the actual optimal solution of a non-convex problem is called global optimization. Problem formulation

Problem formulation is normally the most difficult part of the process. It is the selection of design variables, constraints, objective function(s), and models of the discipline/design. Selection of design variables

A design variable, that takes a numeric or binary value, is controllable from the point of view of the designer. For instance, the thickness of a structural member can be considered a design variable. Design variables can be continuous (such as the length of a cantilever beam),

M1L2 15

Optimization Methods: Introduction and Basic concepts

8

discrete (such as the number of reinforcement bars used in a beam), or Boolean. Design problems with continuous variables are normally solved more easily. Design variables are often bounded, that is, they have maximum and minimum values. Depending on the adopted method, these bounds can be treated as constraints or separately. Selection of constraints

A constraint is a condition that must be satisfied to render the design to be feasible. An example of a constraint in beam design is that the resistance offered by the beam at points of loading must be equal to or greater than the weight of structural member and the load supported. In addition to physical laws, constraints can reflect resource limitations, user requirements, or bounds on the validity of the analysis models. Constraints can be used explicitly by the solution algorithm or can be incorporated into the objective, by using Lagrange multipliers. Objectives

An objective is a numerical value that is to be maximized or minimized. For example, a designer may wish to maximize profit or minimize weight. Many solution methods work only with single objectives. When using these methods, the designer normally weights the various objectives and sums them to form a single objective. Other methods allow multi-objective optimization (module 8), such as the calculation of a Pareto front. Models

The designer has to also choose models to relate the constraints and the objectives to the design variables. These models are dependent on the discipline involved. They may be empirical models, such as a regression analysis of aircraft prices, theoretical models, such as from computational fluid dynamics, or reduced-order models of either of these. In choosing the models the designer must trade-off fidelity with the time required for analysis. The multidisciplinary nature of most design problems complicates model choice and implementation. Often several iterations are necessary between the disciplines’ analyses in order to find the values of the objectives and constraints. As an example, the aerodynamic loads on a bridge affect the structural deformation of the supporting structure. The structural deformation in turn changes the shape of the bridge and hence the aerodynamic loads. Thus, it can be considered as a cyclic mechanism. Therefore, in analyzing a bridge, the

M1L2 16

Optimization Methods: Introduction and Basic concepts

9

aerodynamic and structural analyses must be run a number of times in turn until the loads and deformation converge. Representation in standard form

Once the design variables, constraints, objectives, and the relationships between them have been chosen, the problem can be expressed as shown in equation 1.1 Maximization problems can be converted to minimization problems by multiplying the objective by -1. Constraints can be reversed in a similar manner. Equality constraints can be replaced by two inequality constraints. Problem solution

The problem is normally solved choosing the appropriate techniques from those available in the field of optimization. These include gradient-based algorithms, population-based algorithms, or others. Very simple problems can sometimes be expressed linearly; in that case the techniques of linear programming are applicable. Gradient-based methods •

Newton's method



Steepest descent



Conjugate gradient



Sequential quadratic programming

Population-based methods •

Genetic algorithms



Particle swarm optimization

Other methods •

Random search



Grid search



Simulated annealing

Most of these techniques require large number of evaluations of the objectives and the constraints. The disciplinary models are often very complex and can take significant amount of time for a single evaluation. The solution can therefore be extremely time-consuming. M1L2 17

Optimization Methods: Introduction and Basic concepts

10

Many of the optimization techniques are adaptable to parallel computing. Much of the current research is focused on methods of decreasing the computation time. The following steps summarize the general procedure used to formulate and solve optimization problems. Some problems may not require that the engineer follow the steps in the exact order, but each of the steps should be considered in the process. 1) Analyze the process itself to identify the process variables and specific characteristics of interest, i.e., make a list of all the variables. 2) Determine the criterion for optimization and specify the objective function in terms of the above variables together with coefficients. 3) Develop via mathematical expressions a valid process model that relates the inputoutput variables of the process and associated coefficients. Include both equality and inequality constraints. Use well known physical principles such as mass balances, energy balance, empirical relations, implicit concepts and external restrictions. Identify the independent and dependent variables to get the number of degrees of freedom. 4) If the problem formulation is too large in scope: ƒ

break it up into manageable parts, or

ƒ

simplify the objective function and the model

5) Apply a suitable optimization technique for mathematical statement of the problem. 6) Examine the sensitivity of the result, to changes in the values of the parameters in the problem and the assumptions.

M1L2 18

Module – 1 Lecture Notes – 3 Classification of Optimization Problems Introduction In the previous lecture we studied the basics of an optimization problem and its formulation as a mathematical programming problem. In this lecture we look at the various criteria for classification of optimization problems. Optimization problems can be classified based on the type of constraints, nature of design variables, physical structure of the problem, nature of the equations involved, deterministic nature of the variables, permissible value of the design variables, separability of the functions and number of objective functions. These classifications are briefly discussed below. Classification based on existence of constraints. Under this category optimizations problems can be classified into two groups as follows: Constrained optimization problems: which are subject to one or more constraints. Unconstrained optimization problems: in which no constraints exist. Classification based on the nature of the design variables. There are two broad categories in this classification. (i) In the first category the objective is to find a set of design parameters that makes a prescribed function of these parameters minimum or maximum subject to certain constraints. For example to find the minimum weight design of a strip footing with two loads shown in Fig 1 (a) subject to a limitation on the maximum settlement of the structure can be stated as follows. b  Find X =   which minimizes d 

f(X) = h(b,d) Subject to the constraints

 s ( X )   max ; b  0 ; d  0

where  s is the settlement of the footing. Such problems are called parameter or static optimization problems.

19

It may be noted that, for this particular example, the length of the footing (l), the loads P1 and P2 and the distance between the loads are assumed to be constant and the required optimization is achieved by varying b and d. (ii) In the second category of problems, the objective is to find a set of design parameters, which are all continuous functions of some other parameter that minimizes an objective function subject to a set of constraints. If the cross sectional dimensions of the rectangular footings are allowed to vary along its length as shown in Fig 3.1 (b), the optimization problem can be stated as :

 b (t )  Find X(t) =   which minimizes  d (t )  f(X) = g( b(t), d(t) ) Subject to the constraints

 s ( X(t) )   max

0 t l

b(t)  0

0 t l

d(t)  0

0 t l

The length of the footing (l) the loads P1 and P2 , the distance between the loads are assumed to be constant and the required optimization is achieved by varying b and d along the length l. Here the design variables are functions of the length parameter t. this type of problem, where each design variable is a function of one or more parameters, is known as trajectory or dynamic optimization problem. P1

t

P1 P2

P2

b

b(t) d

d(t)

l

l (a)

(b) Figure 1

20

Classification based on the physical structure of the problem Based on the physical structure, optimization problems are classified as optimal control and non-optimal control problems. (i) Optimal control problems An optimal control (OC) problem is a mathematical programming problem involving a number of stages, where each stage evolves from the preceding stage in a prescribed manner. It is defined by two types of variables: the control or design and state variables. The control variables define the system and controls how one stage evolves into the next. The state variables describe the behavior or status of the system at any stage. The problem is to find a set of control variables such that the total objective function (also known as the performance index, PI) over all stages is minimized, subject to a set of constraints on the control and state variables. An OC problem can be stated as follows: l

Find X which minimizes f(X) =

 f (x , y ) i 1

i

i

i

Subject to the constraints

qi ( xi , yi )  yi  yi 1

i = 1, 2, …., l

g j (x j )  0 ,

j = 1, 2, …., l

hk ( y k )  0 ,

k = 1, 2, …., l

Where xi is the ith control variable, yi is the ith state variable, and fi is the contribution of the ith stage to the total objective function. gj, hk, and qi are the functions of xj, yj ; xk, yk and xi and yi, respectively, and l is the total number of states. The control and state variables xi and yi can be vectors in some cases. (ii) Problems which are not optimal control problems are called non-optimal control problems. Classification based on the nature of the equations involved Based on the nature of equations for the objective function and the constraints, optimization problems can be classified as linear, nonlinear, geometric and quadratic programming problems. The classification is very useful from a computational point of view since many

21

predefined special methods are available for effective solution of a particular type of problem. (i) Linear programming problem If the objective function and all the constraints are ‘linear’ functions of the design variables, the optimization problem is called a linear programming problem (LPP). A linear programming problem is often stated in the standard form :

 x1  x   2  Find X =  .  .    x n  n

Which maximizes f(X) =

c x i 1

i

i

Subject to the constraints n

a i 1

ij

xi  b j ,

j = 1, 2, . . . , m

xi  0 ,

j = 1, 2, . . . , m

where ci, aij, and bj are constants.

(ii) Nonlinear programming problem If any of the functions among the objectives and constraint functions is nonlinear, the problem is called a nonlinear programming (NLP) problem. This is the most general form of a programming problem and all other problems can be considered as special cases of the NLP problem. (iii) Geometric programming problem A geometric programming (GMP) problem is one in which the objective function and constraints are expressed as polynomials in X. A function h(X) is called a polynomial (with

m terms) if h can be expressed as h( X )  c1 x1a11 x2a21  xnan1  c2 x1a12 x2a22  xnan 2    cm x1a1m x2a2 m  xnanm

22

where cj ( j  1,, m ) and aij ( i  1,, n and j  1,, m ) are constants with c j  0 and

xi  0 . Thus GMP problems can be posed as follows: Find X which minimizes  n aij c  j   xi j 1  i 1 N0

f(X) =

 , 

cj > 0,

xi > 0

ajk > 0,

xi > 0, k = 1,2,…..,m

subject to  n qijk a  jk    xi j 1  i 1 Nk

gk(X) =

   0, 

where N0 and Nk denote the number of terms in the objective function and in the kth constraint function, respectively. (iv) Quadratic programming problem A quadratic programming problem is the best behaved nonlinear programming problem with a quadratic objective function and linear constraints and is concave (for maximization problems). It can be solved by suitably modifying the linear programming techniques. It is usually formulated as follows:

n

n

n

F(X) = c   qi xi   Qij xi x j i 1

i 1 j 1

Subject to n

a i 1

ij

xi  b j ,

j = 1,2,….,m

xi  0 ,

i = 1,2,….,n

where c, qi, Qij, aij, and bj are constants. Classification based on the permissible values of the decision variables Under this classification, objective functions can be classified as integer and real-valued programming problems.

23

(i) Integer programming problem If some or all of the design variables of an optimization problem are restricted to take only integer (or discrete) values, the problem is called an integer programming problem. For example, the optimization is to find number of articles needed for an operation with least effort. Thus, minimization of the effort required for the operation being the objective, the decision variables, i.e. the number of articles used can take only integer values. Other restrictions on minimum and maximum number of usable resources may be imposed. (ii) Real-valued programming problem A real-valued problem is that in which it is sought to minimize or maximize a real function by systematically choosing the values of real variables from within an allowed set. When the allowed set contains only real values, it is called a real-valued programming problem. Classification based on deterministic nature of the variables Under this classification, optimization problems can be classified as deterministic or stochastic programming problems. (i) Stochastic programming problem In this type of an optimization problem, some or all the design variables are expressed probabilistically (non-deterministic or stochastic). For example estimates of life span of structures which have probabilistic inputs of the concrete strength and load capacity is a stochastic programming problem as one can only estimate stochastically the life span of the structure. (ii) Deterministic programming problem In this type of problems all the design variables are deterministic. Classification based on separability of the functions Based on this classification, optimization problems can be classified as separable and nonseparable programming problems based on the separability of the objective and constraint functions. (i) Separable programming problems In this type of a problem the objective function and the constraints are separable. A function is said to be separable if it can be expressed as the sum of n single-variable functions,

f1 xi , f 2 x2 ,... f n xn  , i.e.

24

n

f ( X )   f i  xi  i 1

and separable programming problem can be expressed in standard form as : n

Find X which minimizes f ( X )   f i  xi  i 1

subject to n

g j ( X )   g ij  xi   b j ,

j = 1,2,. . . , m

i 1

where bj is a constant. Classification based on the number of objective functions Under this classification, objective functions can be classified as single-objective and multiobjective programming problems. (i) Single-objective programming problem in which there is only a single objective function. (ii) Multi-objective programming problem A multiobjective programming problem can be stated as follows: Find X which minimizes f1  X , f 2  X ,... f k  X  Subject to gj(X)  0 ,

j = 1, 2, . . . , m

where f1, f2, . . . fk denote the objective functions to be minimized simultaneously. For example in some design problems one might have to minimize the cost and weight of the structural member for economy and, at the same time, maximize the load carrying capacity under the given constraints.

25

Optimization Methods: Introduction and Basic Concepts

1

Module – 1 Lecture Notes – 4 Classical and Advanced Techniques for Optimization In the previous lecture having understood the various classifications of optimization problems, let us move on to understand the classical and advanced optimization techniques.

Classical Optimization Techniques

The classical optimization techniques are useful in finding the optimum solution or unconstrained maxima or minima of continuous and differentiable functions. These are analytical methods and make use of differential calculus in locating the optimum solution. The classical methods have limited scope in practical applications as some of them involve objective functions which are not continuous and/or differentiable. Yet, the study of these classical techniques of optimization form a basis for developing most of the numerical techniques that have evolved into advanced techniques more suitable to today’s practical problems. These methods assume that the function is differentiable twice with respect to the design variables and that the derivatives are continuous. Three main types of problems can be handled by the classical optimization techniques, viz., single variable functions, multivariable functions with no constraints and multivariable functions with both equality and inequality constraints. For problems with equality constraints the Lagrange multiplier method can be used. If the problem has inequality constraints, the Kuhn-Tucker conditions can be used to identify the optimum solution. These methods lead to a set of nonlinear simultaneous equations that may be difficult to solve. These classical methods of optimization are further discussed in Module 2. The other methods of optimization include •

Linear programming: studies the case in which the objective function f is linear and the set A is specified using only linear equalities and inequalities. (A is the design variable space)



Integer programming: studies linear programs in which some or all variables are constrained to take on integer values.



Quadratic programming: allows the objective function to have quadratic terms, while the set A must be specified with linear equalities and inequalities.

M1L4 26

Optimization Methods: Introduction and Basic Concepts •

2

Nonlinear programming: studies the general case in which the objective function or the constraints or both contain nonlinear parts.



Stochastic programming: studies the case in which some of the constraints depend on random variables.



Dynamic programming: studies the case in which the optimization strategy is based on splitting the problem into smaller sub-problems.



Combinatorial optimization: is concerned with problems where the set of feasible solutions is discrete or can be reduced to a discrete one.



Infinite-dimensional optimization: studies the case when the set of feasible solutions is a subset of an infinite-dimensional space, such as a space of functions.



Constraint satisfaction: studies the case in which the objective function f is constant (this is used in artificial intelligence, particularly in automated reasoning).

Most of these techniques will be discussed in subsequent modules.

Advanced Optimization Techniques •

Hill climbing Hill climbing is a graph search algorithm where the current path is extended with a successor node which is closer to the solution than the end of the current path.

In simple hill climbing, the first closer node is chosen whereas in steepest ascent hill climbing all successors are compared and the closest to the solution is chosen. Both forms fail if there is no closer node. This may happen if there are local maxima in the search space which are not solutions. Steepest ascent hill climbing is similar to best first search but the latter tries all possible extensions of the current path in order, whereas steepest ascent only tries one.

Hill climbing is used widely in artificial intelligence fields, for reaching a goal state from a starting node. Choice of next node starting node can be varied to give a number of related algorithms.

M1L4 27

Optimization Methods: Introduction and Basic Concepts •

3

Simulated annealing The name and inspiration come from annealing process in metallurgy, a technique involving heating and controlled cooling of a material to increase the size of its crystals and reduce their defects. The heat causes the atoms to become unstuck from their initial positions (a local minimum of the internal energy) and wander randomly through states of higher energy; the slow cooling gives them more chances of finding configurations with lower internal energy than the initial one. In the simulated annealing method, each point of the search space is compared to a state of some physical system, and the function to be minimized is interpreted as the internal energy of the system in that state. Therefore the goal is to bring the system, from an arbitrary initial state, to a state with the minimum possible energy.



Genetic algorithms A genetic algorithm (GA) is a search technique used in computer science to find approximate solutions to optimization and search problems. Specifically it falls into the category of local search techniques and is therefore generally an incomplete search. Genetic algorithms are a particular class of evolutionary algorithms that use techniques inspired by evolutionary biology such as inheritance, mutation, selection, and crossover (also called recombination).

Genetic algorithms are typically implemented as a computer simulation. in which a population of abstract representations (called chromosomes) of candidate solutions (called individuals) to an optimization problem, evolves toward better solutions. Traditionally, solutions are represented in binary as strings of 0s and 1s, but different encodings are also possible. The evolution starts from a population of completely random individuals and occur in generations. In each generation, the fitness of the whole population is evaluated, multiple individuals are stochastically selected from the current population (based on their fitness), and modified (mutated or recombined) to form a new population. The new population is then used in the next iteration of the algorithm.

M1L4 28

Optimization Methods: Introduction and Basic Concepts •

4

Ant colony optimization In the real world, ants (initially) wander randomly, and upon finding food return to their colony while laying down pheromone trails. If other ants find such a path, they are likely not to keep traveling at random, but instead follow the trail laid by earlier ants, returning and reinforcing it, if they eventually find any food.

Over time, however, the pheromone trail starts to evaporate, thus reducing its attractive strength. The more time it takes for an ant to travel down the path and back again, the more time the pheromones have to evaporate. A short path, by comparison, gets marched over faster, and thus the pheromone density remains high as it is laid on the path as fast as it can evaporate. Pheromone evaporation has also the advantage of avoiding the convergence to a local optimal solution. If there was no evaporation at all, the paths chosen by the first ants would tend to be excessively attractive to the following ones. In that case, the exploration of the solution space would be constrained.

Thus, when one ant finds a good (short) path from the colony to a food source, other ants are more likely to follow that path, and such positive feedback eventually leaves all the ants following a single path. The idea of the ant colony algorithm is to mimic this behavior with "simulated ants" walking around the search space representing the problem to be solved.

Ant colony optimization algorithms have been used to produce near-optimal solutions to the traveling salesman problem. They have an advantage over simulated annealing and genetic algorithm approaches when the graph may change dynamically. The ant colony algorithm can be run continuously and can adapt to changes in real time. This is of interest in network routing and urban transportation systems.

M1L4 29

Optimization Methods: Introduction and Basic Concepts

5

References / Further Reading:

1. Deb K., Multi-Objective Optimization using Evolutionary Algorithms, First Edition, John Wiley & Sons Pte Ltd, 2002. 2. Deb K., Optimization for Engineering Design – Algorithms and Examples, Prentice Hall of India Pvt. Ltd., New Delhi, 1995. 3. Dorigo M., and T. Stutzle, Ant Colony Optimization, Prentice Hall of India Pvt. Ltd., New Delhi, 2005. 4. Hillier F.S. and G.J. Lieberman, Operations Research, CBS Publishers & Distributors, New Delhi, 1987. 5. Jain S.K. and V.P. Singh, Water Resources Systems Planning and Management, Elsevier B.V., The Netherlands, 2003. 6. Loucks, D.P., J.R. Stedinger, and D.A. Haith, Water Resources Systems Planning and Analysis, Prentice – Hall, N.J., 1981. 7. Mays, L.W. and K. Tung, Hydrosystems Engineering and Management, McGraw-Hill Inc., New York, 1992. 8. Rao S.S., Engineering Optimization – Theory and Practice, Third Edition, New Age International Limited, New Delhi, 2000 9. Ravindran A., D.T. Phillips and J.J. Solberg, Operations Research – Principles and Practice, John Wiley & Sons, New York, 2001. 10. Taha H.A., Operations Research – An Introduction, Prentice-Hall of India Pvt. Ltd., New Delhi, 2005. 11. Vedula S., and P.P. Mujumdar, Water Resources Systems: Modelling Techniques and Analysis, Tata McGraw Hill, New Delhi, 2005.

M1L4 30

Optimization Methods: Optimization using Calculus-Stationary Points

1

Module - 2 Lecture Notes – 1 Stationary points: Functions of Single and Two Variables Introduction In this session, stationary points of a function are defined. The necessary and sufficient conditions for the relative maximum of a function of single or two variables are also discussed. The global optimum is also defined in comparison to the relative or local optimum. Stationary points For a continuous and differentiable function f(x) a stationary point x* is a point at which the slope of the function vanishes, i.e. f ’(x) = 0 at x = x*, where x* belongs to its domain of definition.

minimum

maximum

inflection point

Fig. 1 A stationary point may be a minimum, maximum or an inflection point (Fig. 1). Relative and Global Optimum A function is said to have a relative or local minimum at x = x* if f ( x* ) ≤ f ( x* + h) for all sufficiently small positive and negative values of h, i.e. in the near vicinity of the point x*. Similarly a point x* is called a relative or local maximum if f ( x* ) ≥ f ( x* + h) for all values of h sufficiently close to zero. A function is said to have a global or absolute minimum at x = x* if f ( x* ) ≤ f ( x) for all x in the domain over which f(x) is defined. Similarly, a function is

M2L1 1

Optimization Methods: Optimization using Calculus-Stationary Points

2

said to have a global or absolute maximum at x = x* if f ( x* ) ≥ f ( x) for all x in the domain over which f(x) is defined. Figure 2 shows the global and local optimum points.

A1, A2, A3 = Relative maxima A2 = Global maximum B1, B2 = Relative minima B1 = Global minimum

.

A2

f(x)

. .. .

f(x)

A3

A1

Relative minimum is also global optimum (since only one minimum point is there)

.

B2

B1

a

b

x

a

b

x

Fig. 2

Functions of a single variable Consider the function f(x) defined for a ≤ x ≤ b . To find the value of x* ∈ [ a, b] such that x = x* maximizes f(x) we need to solve a single-variable optimization problem. We have the following theorems to understand the necessary and sufficient conditions for the relative maximum of a function of a single variable. Necessary condition: For a single variable function f(x) defined for x ∈ [ a, b] which has a relative maximum at x = x* , x* ∈ [ a, b] if the derivative f '( X ) = df ( x) / dx exists as a finite number at x = x* then f ‘(x*) = 0. This can be understood from the following.

M2L1 2

Optimization Methods: Optimization using Calculus-Stationary Points

3

Proof. Since f ‘(x*) is stated to exist, we have

f ' ( x*) = lim h →0

f ( x * + h) − f ( x*) h

(1)

From our earlier discussion on relative maxima we have f ( x*) ≥ f ( x * + h) for h → 0 . Hence f ( x * + h) − f ( x*) ≥0 h

h0

(3)

which implies for substantially small negative values of h we have f ( x*) ≥ 0 and for substantially small positive values of h we have f ( x*) ≤ 0 . In order to satisfy both (2) and (3), f ( x*) = 0. Hence this gives the necessary condition for a relative maxima at x = x* for f ( x) .

It has to be kept in mind that the above theorem holds good for relative minimum as well. The theorem only considers a domain where the function is continuous and differentiable. It cannot indicate whether a maxima or minima exists at a point where the derivative fails to exist. This scenario is shown in Fig 3, where the slopes m1 and m2 at the point of a maxima are unequal, hence cannot be found as depicted by the theorem by failing for continuity. The theorem also does not consider if the maxima or minima occurs at the end point of the interval of definition, owing to the same reason that the function is not continuous, therefore not differentiable at the boundaries. The theorem does not say whether the function will have a maximum or minimum at every point where f ‘(x) = 0, since this condition f ‘(x) = 0 is for stationary points which include inflection points which do not mean a maxima or a minima. A point of inflection is shown already in Fig.1

M2L1 3

Optimization Methods: Optimization using Calculus-Stationary Points

4

f(x) f(x*)

m2

m1

a

x* Fig. 3

x

b

Sufficient condition: For the same function stated above let f ’(x*) = f ”(x*) = . . . = f (n-1)(x*) = 0, but f (n)(x*) ≠ 0, then it can be said that f (x*) is (a) a minimum value of f (x) if f (n)(x*) > 0 and n is even; (b) a maximum value of f (x) if f

(n)

(x*) < 0 and n is even; (c) neither a

maximum or a minimum if n is odd. Proof Applying the Taylor’s theorem with remainder after n terms, we have

f ( x * + h) = f ( x*) + hf '( x*) +

h2 h n −1 hn n f ''( x*) + ... + f ( n −1) ( x*) + f ( x * +θ h) 2! (n − 1)! n!

(4)

for 0< θ x 4 − 3x3 + 2 x 2 = 0 x = 0,1, 2

Consider the point x =x* = 0 f '' ( x* ) = 240( x* )3 − 540( x* ) 2 + 240 x* = 0 at x * = 0 f ''' ( x* ) = 720( x* ) 2 − 1080 x* + 240 = 240 at x * = 0 Since the third derivative is non-zero, x = x* = 0 is neither a point of maximum or minimum but it is a point of inflection. Consider x = x* = 1 f '' ( x* ) = 240( x* )3 − 540( x* )2 + 240 x* = −60 at x* = 1 Since the second derivative is negative the point x = x* = 1 is a point of local maxima with a maximum value of f(x) = 12 – 45 + 40 + 5 = 12

M2L1 6

Optimization Methods: Optimization using Calculus-Stationary Points

7

Consider x = x* = 2 f '' ( x* ) = 240( x* )3 − 540( x* ) 2 + 240 x* = 240 at x* = 2 Since the second derivative is positive, the point x = x* = 2 is a point of local minima with a minimum value of f(x) = -11 Example 4.

The horse power generated by a Pelton wheel is proportional to u(v-u) where u is the velocity of the wheel, which is variable and v is the velocity of the jet which is fixed. Show that the efficiency of the Pelton wheel will be maximum at u = v/2. Solution f = K.u (v − u ) ∂f = 0 => Kv − 2Ku = 0 ∂u v or u = 2 where K is a proportionality constant (assumed positive).

∂2 f ∂u 2

= −2K which is negative. u=

v 2

Hence, f is maximum at u =

v 2

Functions of two variables

This concept may be easily extended to functions of multiple variables. Functions of two variables are best illustrated by contour maps, analogous to geographical maps. A contour is a line representing a constant value of f(x) as shown in Fig.4. From this we can identify maxima, minima and points of inflection.

M2L1 7

Optimization Methods: Optimization using Calculus-Stationary Points

8

Necessary conditions

As can be seen in Fig. 4 and 5, perturbations from points of local minima in any direction result in an increase in the response function f(x), i.e. the slope of the function is zero at this point of local minima. Similarly, at maxima and points of inflection as the slope is zero, the first derivatives of the function with respect to the variables are zero.

Which gives us

∂f ∂f = 0; = 0 at the stationary points, i.e., the gradient vector of f(X), Δ x f ∂x1 ∂x2

at X = X* = [x1, x2] defined as follows, must equal zero: ⎡ ∂f ⎤ ⎢ ∂x ( Χ*) ⎥ ⎥=0 Δx f = ⎢ 1 ⎢ ∂f ⎥ ⎢ ∂x ( Χ*) ⎥ ⎣ 2 ⎦ This is the necessary condition.

x2

x1 Fig. 4

M2L1 8

Optimization Methods: Optimization using Calculus-Stationary Points

9

Global maxima Relative maxima

Relative minima Global minima

Fig. 5 Sufficient conditions

Consider the following second order derivatives: ∂2 f ∂2 f ∂2 f ; ; ∂x12 ∂x22 ∂x1∂x2 The Hessian matrix defined by H is made using the above second order derivatives.

M2L1 9

Optimization Methods: Optimization using Calculus-Stationary Points ⎛ ∂2 f ⎜ ∂x 2 H = ⎜ 21 ⎜ ∂ f ⎜⎜ ⎝ ∂x1∂x2

10

∂2 f ⎞ ⎟ ∂x1∂x2 ⎟ ∂2 f ⎟ ⎟ ∂x22 ⎟⎠[ x , x ] 1 2

a) If H is positive definite then the point X = [x1, x2] is a point of local minima. b) If H is negative definite then the point X = [x1, x2] is a point of local maxima. c) If H is neither then the point X = [x1, x2] is neither a point of maxima nor minima. A square matrix is positive definite if all its eigen values are positive and it is negative definite if all its eigen values are negative. If some of the eigen values are positive and some negative then the matrix is neither positive definite or negative definite. To calculate the eigen values λ of a square matrix then the following equation is solved.

A − λI = 0

The above rules give the sufficient conditions for the optimization problem of two variables. Optimization of multiple variable problems will be discussed in detail in lecture notes 3 (Module 2). Example 5.

Locate the stationary points of f(X) and classify them as relative maxima, relative minima or neither based on the rules discussed in the lecture. f(X) =

+5

M2L1 10

Optimization Methods: Optimization using Calculus-Stationary Points

11

Solution

From

∂f (X) = 0 , x1 = 2 x2 + 2 ∂x2

From

∂f (X) = 0 ∂x1

8 x22 + 14 x2 + 3 = 0

(2 x2 + 3)(4 x2 + 1) = 0 x2 = −3 / 2

or x2 = −1/ 4

so the two stationary points are X1 = [-1,-3/2] and X2 = [3/2,-1/4] The Hessian of f(X) is ∂2 f ∂2 f ∂2 f ∂2 f = 4 x1 ; 2 = 4; = = −2 ∂x12 ∂x2 ∂x1∂x2 ∂x2 ∂x1 M2L1 11

Optimization Methods: Optimization using Calculus-Stationary Points

12

⎡ 4 x −2 ⎤ H=⎢ 1 ⎥ ⎣ −2 4 ⎦

λI - H =

λ − 4 x1 2

2 λ −4

At X1= [-1,-3/2],

λI - H =

λ+4 2

2 = (λ + 4)(λ − 4) − 4 = 0 λ −4

λ 2 − 16 − 4 = 0 λ 2 = 20

λ1 = + 12

λ2 = − 12

Since one eigen value is positive and one negative, X1 is neither a relative maximum nor a relative minimum. At X2 = [3/2,-1/4]

λI - H =

λ −6 2

2 = (λ − 6)(λ − 4) − 4 = 0 λ −4

λ 2 − 10λ + 20 = 0

λ1 = 5 + 5

λ2 = 5 − 5

Since both the eigen values are positive, X2 is a local minimum. Minimum value of f(x) is -0.375.

M2L1 12

Optimization Methods: Optimization using Calculus-Stationary Points

13

Example 6

The ultimate strength attained by concrete is found to be based on a certain empirical relationship between the ratios of cement and concrete used. Our objective is to maximize strength attained by hardened concrete, given by f(X) = 20 + 2 x1 − x12 + 6 x2 − 3 x22 / 2 , where x1 and x2 are variables based on cement and concrete ratios. Solution Given f(X) = 20 + 2 x1 − x12 + 6 x2 − 3 x22 / 2 ; where X = [ x1 , x2 ]

The gradient vector

⎡ ∂f ⎤ ⎢ ∂x ( Χ*) ⎥ ⎡ 2 − 2 x ⎤ ⎡0 ⎤ 1 ⎥=⎢ Δx f = ⎢ 1 = ⎢ ⎥ , to determine stationary point X*. ⎥ ⎢ ∂f ⎥ ⎣6 − 3x2 ⎦ ⎣0 ⎦ ⎢ ∂x ( Χ*) ⎥ ⎣ 2 ⎦

Solving we get X* = [1,2] ∂2 f ∂2 f ∂2 f = − 2; = − 3; =0 ∂x12 ∂x2 2 ∂x1∂x2 ⎡ −2 0 ⎤ H=⎢ ⎥ ⎣ 0 −3 ⎦

λI - H =

λ+2 0

0 = (λ + 2)(λ + 3) = 0 λ +3

Here the values of λ do not depend on X and λ1 = -2, λ2 = -3. Since both the eigen values are negative, f(X) is concave and the required ratio x1:x2 = 1:2 with a global maximum strength of f(X) = 27 units.

M2L1 13

Optimization Methods: Optimization using Calculus-Convexity and Concavity

1

Module – 2 Lecture Notes – 2 Convexity and Concavity of Functions of One and Two Variables Introduction In the previous class we studied about stationary points and the definition of relative and global optimum. The necessary and sufficient conditions required for a relative optimum in functions of one variable and its extension to functions of two variables was also studied. In this lecture, determination of the convexity and concavity of functions is discussed. The analyst must determine whether the objective functions and constraint equations are convex or concave. In real-world problems, if the objective function or the constraints are not convex or concave, the problem is usually mathematically intractable.

Functions of one variable Convex function A real-valued function f defined on an interval (or on any convex subset C of some vector space) is called convex, if for any two points a and b in its domain C and any t in [0,1], we have

f (ta + (1 − t )b) ≤ tf (a ) + (1 − t ) f (b)

Fig. 1 In other words, a function is convex if and only if its epigraph (the set of points lying on or above the graph) is a convex set. A function is also said to be strictly convex if

M2L2 14

Optimization Methods: Optimization using Calculus-Convexity and Concavity

2

f (ta + (1 − t )b) < tf ( a ) + (1 − t ) f (b)

for any t in (0,1) and a line connecting any two points on the function lies completely above the function. These relationships are illustrated in Fig. 1. Testing for convexity of a single variable function A function is convex if its slope is non decreasing or ∂ 2 f / ∂x 2 ≥ 0. It is strictly convex if its slope is continually increasing or

> 0 throughout the function.

Properties of convex functions A convex function f, defined on some convex open interval C, is continuous on C and differentiable at all or at most, countable many points. If C is closed, then f may fail to be continuous at the end points of C. A continuous function on an interval C is convex if and only if ⎛ a + b ⎞ f (a ) + f (b) f⎜ ⎟≤ 2 ⎝ 2 ⎠

for all a and b in C. A differentiable function of one variable is convex on an interval if and only if its derivative is monotonically non-decreasing on that interval. A continuously differentiable function of one variable is convex on an interval if and only if the function lies above all of its tangents: f (b) ≥ f ( a ) + f '( a )(b − a ) for all a and b in the interval. A twice differentiable function of one variable is convex on an interval if and only if its second derivative is non-negative in that interval; this gives a practical test for convexity. If its second derivative is positive then it is strictly convex, but the converse does not hold, as shown by f(x) = x4. More generally, a continuous, twice differentiable function of several variables is convex on a convex set if and only if its Hessian matrix is positive semi definite on the interior of the convex set.

M2L2 15

Optimization Methods: Optimization using Calculus-Convexity and Concavity

3

If two functions f and g are convex, then so is any weighted combination a f + b g with nonnegative coefficients a and b. Likewise, if f and g are convex, then the function max{f,g} is convex. A strictly convex function will have only one minimum which is also the global minimum. Examples •

The second derivative of x2 is 2; it follows that x2 is a convex function of x.



The absolute value function |x| is convex, even though it does not have a derivative at x = 0.



The function f with domain [0,1] defined by f(0)=f(1)=1, f(x)=0 for 0 x0 it is non-increasing. x0 can also be ±∞ , making the function non-decreasing (non-increasing) for all x. The opposite of quasiconcave is quasiconvex. Example 1 Consider the example in lecture notes 1 for a function of two variables. Locate the stationary points of f ( x) = 12 x 5 − 45 x 4 + 40 x 3 + 5 and find out if the function is convex, concave or neither at the points of optima based on the testing rules discussed above. Solution

f '( x) = 60 x 4 − 180 x3 + 120 x 2 = 0 or

=> x 4 − 3x3 + 2 x 2 = 0 x = 0,1, 2

Consider the point x =x* = 0 f ''( x*) = 240( x*)3 − 540( x*) 2 + 240 x* = 0 at x * = 0 f '''( x*) = 720( x*) 2 − 1080 x * +240 = 240 at x * = 0 Since the third derivative is non-zero x = x* = 0 is neither a point of maximum or minimum but it is a point of inflection. Hence the function is neither convex nor concave at this point. Consider x = x* = 1 f ''( x*) = 240( x*)3 − 540( x*) 2 + 240 x* = −60 at x* = 1 Since the second derivative is negative, the point x = x* = 1 is a point of local maxima with a maximum value of f(x) = 12 – 45 + 40 + 5 = 12. At this point the function is concave since ∂ 2 f / ∂x 2 < 0.

Consider x = x* = 2 f ''( x*) = 240( x*)3 − 540( x*)2 + 240 x* = 240 at x* = 2 Since the second derivative is positive, the point x = x* = 2 is a point of local minima with a minimum value of f(x) = -11. At this point the function is convex since ∂ 2 f / ∂x 2 > 0. M2L2 18

Optimization Methods: Optimization using Calculus-Convexity and Concavity

6

Functions of two variables A function of two variables, f(X) where X is a vector = [x1,x2], is strictly convex if

f (t Χ1 + (1 − t ) Χ 2 ) < tf ( Χ1 ) + (1 − t ) f ( Χ 2 ) where X1 and X2 are points located by the coordinates given in their respective vectors. Similarly a two variable function is strictly concave if

f (t Χ1 + (1 − t ) Χ 2 ) > tf ( Χ1 ) + (1 − t ) f ( Χ 2 ) Contour plot of a convex function is illustrated in Fig. 3

340

x2

70 120

450

x1 Fig. 3 Contour plot of a convex function is shown in Fig. 4

x2

305 210

40 110

x1 Fig. 4

M2L2 19

Optimization Methods: Optimization using Calculus-Convexity and Concavity

7

To determine convexity or concavity of a function of multiple variables, the eigenvalues of its Hessian matrix are examined and the following rules apply. (a) If all eigenvalues of the Hessian are positive the function is strictly convex. (b) If all eigenvalues of the Hessian are negative the function is strictly concave. (c) If some eigenvalues are positive and some are negative, or if some are zero, the function is neither strictly concave nor strictly convex.

Example 2 Consider the example in lecture notes 1 for a function of two variables. Locate the stationary points of f(X) and find out if the function is convex, concave or neither at the points of optima based on the rules discussed in this lecture. f(X) = 2 x13 / 3 − 2 x1 x2 − 5 x1 + 2 x22 + 4 x2 + 5 Solution ⎡ ∂f ⎤ ⎢ ∂x ( Χ*) ⎥ ⎡ 2 x 2 − 2 x − 5 ⎤ ⎡0 ⎤ 1 2 ⎥=⎢ 1 Δx f = ⎢ ⎥= ⎢ ∂f ⎥ ⎣ −2 x1 + 4 x2 + 4 ⎦ ⎢⎣0 ⎥⎦ ⎢ ∂x ( Χ*) ⎥ ⎣ 2 ⎦ Solving the above the two stationary points are X1 = [-1,-3/2] and X2 = [3/2,-1/4] The Hessian of f(X) is ∂2 f ∂2 f ∂2 f ∂2 f = 4 x ; = 4; = = −2 1 ∂x12 ∂x2 2 ∂x1∂x2 ∂x2 ∂x1 ⎡ 4 x −2 ⎤ H=⎢ 1 ⎥ ⎣ −2 4 ⎦

λI - H =

λ − 4 x1 2

2 λ −4

At X1

λI - H =

λ+4 2

2 = (λ + 4)(λ − 4) − 4 = 0 λ −4

λ 2 − 16 − 4 = 0 M2L2 20

Optimization Methods: Optimization using Calculus-Convexity and Concavity

8

λ 2 = 12

λ1 = + 12

λ2 = − 12

Since one eigen value is positive and one negative, X1 is neither a relative maximum nor a relative minimum. Hence at X1 the function is neither convex nor concave. At X2 = [3/2,-1/4]

λI - H =

λ −6 2

2 = (λ − 6)(λ − 4) − 4 = 0 λ −4

λ 2 − 10λ + 20 = 0

λ1 = 5 + 5

λ2 = 5 − 5

Since both the eigen values are positive, X2 is a local minimum, and the function is convex at this point as both the eigen values are positive.

M2L2 21

Optimization Methods: Optimization using Calculus - Unconstrained Optimization

1

Module – 2 Lecture Notes – 3 Optimization of Functions of Multiple Variables: Unconstrained Optimization Introduction In the previous lectures we learnt how to determine the convexity and concavity of functions of single and two variables. For functions of single and two variables we also learnt determining stationary points and examining higher derivatives to check for convexity and concavity, and tests were recommended to evaluate stationary points as local minima, local maxima or points of inflection. In this lecture functions of multiple variables, which are more difficult to be analyzed owing to the difficulty in graphical representation and tedious calculations involved in mathematical analysis, will be studied for unconstrained optimization. This is done with the aid of the gradient vector and the Hessian matrix. Examples are discussed to show the implementation of the technique.

Unconstrained optimization If a convex function is to be minimized, the stationary point is the global minimum and analysis is relatively straightforward as discussed earlier. A similar situation exists for maximizing a concave variable function. The necessary and sufficient conditions for the optimization of unconstrained function of several variables are given below. Necessary condition In case of multivariable functions a necessary condition for a stationary point of the function f(X) is that each partial derivative is equal to zero. In other words, each element of the gradient vector defined below must be equal to zero. i.e. the gradient vector of f(X), Δ x f at X=X*, defined as follows, must be equal to zero: ⎡ ∂f ⎤ ⎢ ∂x ( Χ*) ⎥ ⎢ 1 ⎥ ⎢ ∂f ⎥ ⎢ ∂x ( Χ*) ⎥ 2 ⎥= 0 Δx f = ⎢ ⎢ ⎥ M ⎢ ⎥ M ⎢ ⎥ ⎢ ∂f ⎥ ( Χ*) ⎥ ⎢ ⎣ ∂dxn ⎦

M2L3 22

Optimization Methods: Optimization using Calculus - Unconstrained Optimization

2

The proof given for the theorem on necessary condition for single variable optimization can be easily extended to prove the present condition.

Sufficient condition For a stationary point X* to be an extreme point, the matrix of second partial derivatives (Hessian matrix) of f(X) evaluated at X* must be: (i)

positive definite when X* is a point of relative minimum, and

(ii)

negative definite when X* is a relative maximum point.

Proof (Formulation of the Hessian matrix) The Taylor’s theorem with reminder after two terms gives us n

f ( Χ * + h) = f ( Χ*) + ∑ hi i =1

df 1 n n ∂2 f ( Χ*) + ∑∑ hi h j dxi 2! i =1 j =1 ∂xi ∂x j

Χ=Χ*+θ h

0< θ n then the problem becomes an over defined one and there will be no solution. Of the many available methods, the method of constrained variation and the method using Lagrange multipliers are discussed. Solution by method of Constrained Variation For the optimization problem defined above, let us consider a specific case with n = 2 and

m=1 before we proceed to find the necessary and sufficient conditions for a general problem using Lagrange multipliers. The problem statement is as follows: Minimize f(x1,x2), subject to g(x1,x2) = 0 For f(x1,x2) to have a minimum at a point X* = [x1*,x2*], a necessary condition is that the total derivative of f(x1,x2) must be zero at [x1*,x2*]. df =

∂f ∂f dx1 + dx2 = 0 ∂x1 ∂x2

(1)

M2L4 26

Optimization Methods: Optimization using Calculus - Equality constraints

2

Since g(x1*,x2*) = 0 at the minimum point, variations dx1 and dx2 about the point [x1*, x2*] must be admissible variations, i.e. the point lies on the constraint:

g(x1* + dx1 , x2* + dx2) = 0

(2)

assuming dx1 and dx2 are small the Taylor series expansion of this gives us g ( x1 * + dx1 , x2 * + dx2 ) = g ( x1*, x2 *) +

∂g ∂g (x1*,x 2 *) dx1 + (x1*,x 2 *) dx2 = 0 ∂x1 ∂x2

(3)

or dg =

∂g ∂g dx1 + dx2 = 0 at [x1*,x2*] ∂x1 ∂x2

(4)

which is the condition that must be satisfied for all admissible variations. Assuming ∂g / ∂x2 ≠ 0 (4) can be rewritten as dx2 = −

∂g / ∂x1 ( x1*, x2 *) dx1 ∂g / ∂x2

(5)

which indicates that once variation along x1 (d x1) is chosen arbitrarily, the variation along x2 (d x2) is decided automatically to satisfy the condition for the admissible variation. Substituting equation (5) in (1)we have: ⎛ ∂f ∂g / ∂x1 ∂f ⎞ df = ⎜ dx1 = 0 − ⎟ ⎝ ∂x1 ∂g / ∂x2 ∂x2 ⎠ (x1 *, x 2 *)

(6)

The equation on the left hand side is called the constrained variation of f. Equation (5) has to be satisfied for all dx1, hence we have ⎛ ∂f ∂g ∂f ∂g ⎞ − =0 ⎜ ⎟ ⎝ ∂x1 ∂x2 ∂x2 ∂x1 ⎠ (x1 *, x 2 *)

(7)

This gives us the necessary condition to have [x1*, x2*] as an extreme point (maximum or minimum) Solution by method of Lagrange multipliers Continuing with the same specific case of the optimization problem with n = 2 and m = 1 we define a quantity λ , called the Lagrange multiplier as

λ=−

∂f / ∂x2 ∂g / ∂x2

(8) (x1 *, x 2 *)

Using this in (6)

M2L4 27

Optimization Methods: Optimization using Calculus - Equality constraints

3

⎛ ∂f ∂g ⎞ +λ =0 ⎜ ⎟ ∂x1 ⎠ (x *, x *) ⎝ ∂x1 1 2

(9)

⎛ ∂f ∂g ⎞ +λ =0 ⎜ ⎟ ∂x2 ⎠ (x *, x *) ⎝ ∂x2 1 2

(10)

And (8) written as

Also, the constraint equation has to be satisfied at the extreme point g ( x1 , x2 ) ( x *, x *) = 0 1

(11)

2

Hence equations (9) to (11) represent the necessary conditions for the point [x1*, x2*] to be an extreme point. Note that λ could be expressed in terms of ∂g / ∂x1 as well and ∂g / ∂x1 has to be non-zero. Thus, these necessary conditions require that at least one of the partial derivatives of g(x1, x2) be non-zero at an extreme point. The conditions given by equations (9) to (11) can also be generated by constructing a function L, known as the Lagrangian function, as

L( x1 , x2 , λ ) = f ( x1 , x2 ) + λ g ( x1 , x2 )

(12)

Alternatively, treating L as a function of x1,x2 and λ , the necessary conditions for its extremum are given by

∂L ∂f ∂g ( x1 , x2 , λ ) = ( x1 , x2 ) + λ ( x1 , x2 ) = 0 ∂x1 ∂x1 ∂x1 ∂L ∂f ∂g ( x1 , x2 , λ ) = ( x1 , x2 ) + λ ( x1 , x2 ) = 0 ∂x2 ∂x2 ∂x2

(13)

∂L ( x1 , x2 , λ ) = g ( x1 , x2 ) = 0 ∂λ The necessary and sufficient conditions for a general problem are discussed next. Necessary conditions for a general problem

For a general problem with n variables and m equality constraints the problem is defined as shown earlier Maximize (or minimize) f(X), subject to gj(X) = 0, j = 1, 2, … , m

where

⎧ x1 ⎫ ⎪x ⎪ ⎪ ⎪ X = ⎨ 2⎬ ⎪M⎪ ⎩⎪ xn ⎭⎪ M2L4 28

Optimization Methods: Optimization using Calculus - Equality constraints

4

In this case the Lagrange function, L, will have one Lagrange multiplier λ j for each constraint g j (X) as L ( x1 , x2 ,..., xn , λ1 , λ2 ,..., λm ) = f ( X) + λ1 g1 ( X) + λ2 g 2 ( X) + ... + λm g m ( X)

(14)

L is now a function of n + m unknowns, x1 , x2 ,..., xn , λ1 , λ2 ,..., λm , and the necessary conditions

for the problem defined above are given by m ∂g j ∂L ∂f = ( X) + ∑ λ j ( X) = 0, ∂xi ∂xi ∂xi j =1

∂L = g j ( X) = 0, ∂λ j

i = 1, 2,..., n

j = 1, 2,..., m

(15)

j = 1, 2,..., m

which represent n + m equations in terms of the n + m unknowns, xi and λ j . The solution to this set of equations gives us

⎧ λ1 * ⎫ ⎧ x1 * ⎫ ⎪ x *⎪ ⎪ λ *⎪ ⎪ ⎪ ⎪ 2 ⎪ X = ⎨ ⎬ and λ* = ⎨ 2 ⎬ ⎪ M ⎪ ⎪ M ⎪ ⎪⎩ xn *⎪⎭ ⎩⎪λm *⎭⎪

(16)

The vector X corresponds to the relative constrained minimum of f(X) (subject to the verification of sufficient conditions). Sufficient conditions for a general problem

A sufficient condition for f(X) to have a relative minimum at X* is that each root of the polynomial in ∈ , defined by the following determinant equation be positive. L11 − ∈

L12

L21 M

L22 − ∈

Ln1

Ln 2

g11

g12

g 21

g 22

M g m1

gm2

L

L1n

g11

g 21 L g m1

g12 M

g 22

O

L2 n M

L Lnn − ∈ g1n L O L

gm2 O M

g 2 n L g mn

g1n

0

L

L

g2n

M

O

M

M g mn

M 0

L

M 0

L

=0

(17)

0

M2L4 29

Optimization Methods: Optimization using Calculus - Equality constraints

5

where Lij =

∂2 L ( X*, λ*), ∂xi ∂x j

g pq =

∂g p ∂xq

( X*),

for i = 1, 2,..., n

j = 1, 2,..., m

(18)

where p = 1, 2,..., m and q = 1, 2,..., n

Similarly, a sufficient condition for f(X) to have a relative maximum at X* is that each root of the polynomial in ∈ , defined by equation (17) be negative. If equation (17), on solving yields roots, some of which are positive and others negative, then the point X* is neither a maximum nor a minimum.

Example

Minimize f ( X) = −3 x12 − 6 x1 x2 − 5 x22 + 7 x1 + 5 x2

Subject to x1 + x2 = 5 Solution g1 ( X) = x1 + x2 − 5 = 0 L( x1 , x2 ,..., xn , λ1 , λ2 ,..., λm ) = f ( X) + λ1 g1 ( X) + λ2 g 2 ( X) + ... + λm g m ( X) with n = 2 and m = 1

L = −3 x12 − 6 x1 x2 − 5 x22 + 7 x1 + 5 x2 + λ1 ( x1 + x2 − 5) ∂L = −6 x1 − 6 x2 + 7 + λ1 = 0 ∂x1 1 => x1 + x2 = (7 + λ1 ) 6 1 => 5 = (7 + λ1 ) 6 or

λ1 = 23

∂L = −6 x1 − 10 x2 + 5 + λ1 = 0 ∂x2 1 => 3x1 + 5 x2 = (5 + λ1 ) 2 1 => 3( x1 + x2 ) + 2 x2 = (5 + λ1 ) 2

M2L4 30

Optimization Methods: Optimization using Calculus - Equality constraints

x2 =

x1 =

and,

6

−1 2

11 2

⎡ −1 11 ⎤ Hence X* = ⎢ , ⎥ ; λ* = [ 23] ⎣ 2 2⎦

L12 g11 ⎞ ⎛ L11 − ∈ ⎜ ⎟ L22 − ∈ g 21 ⎟ = 0 ⎜ L21 ⎜ g g12 0 ⎟⎠ ⎝ 11 L11 =

∂ 2L = −6 ∂x12 ( X*,λ*)

L12 = L21 =

∂ 2L ∂x1∂x2

= −6 ( X*,λ* )

L22 =

∂ 2L = −10 ∂x22 ( X*,λ*)

g11 =

∂g1 ∂x1

=1 ( X*,λ* )

g12 = g 21 =

∂g1 ∂x2

=1 ( X*,λ* )

The determinant becomes −6 1⎞ ⎛ −6− ∈ ⎜ ⎟ −10− ∈ 1 ⎟ = 0 ⎜ −6 ⎜ 1 1 0 ⎟⎠ ⎝ or

(−6− ∈)[−1] − (−6)[−1] + 1[−6 + 10+ ∈] = 0 =>∈= −2

Since ∈ is negative, X*, λ * correspond to a maximum.

M2L4 31

Optimization Methods: Optimization using Calculus – Kuhn-Tucker Conditions

1

Module - 2 Lecture Notes – 5 Kuhn-Tucker Conditions Introduction In the previous lecture the optimization of functions of multiple variables subjected to equality constraints using the method of constrained variation and the method of Lagrange multipliers was dealt. In this lecture the Kuhn-Tucker conditions will be discussed with examples for a point to be a local optimum in case of a function subject to inequality constraints.

Kuhn-Tucker Conditions It was previously established that for both an unconstrained optimization problem and an optimization problem with an equality constraint the first-order conditions are sufficient for a global optimum when the objective and constraint functions satisfy appropriate concavity/convexity conditions. The same is true for an optimization problem with inequality constraints. The Kuhn-Tucker conditions are both necessary and sufficient if the objective function is concave and each constraint is linear or each constraint function is concave, i.e. the problems belong to a class called the convex programming problems. Consider the following optimization problem: Minimize f(X) subject to gj(X) ≤ 0 for j = 1,2,…,p ; where X = [x1 x2 . . . xn] Then the Kuhn-Tucker conditions for X* = [x1* x2* . . . xn*] to be a local minimum are m ∂f ∂g + ∑λj =0 ∂xi j =1 ∂xi

i = 1, 2,..., n

λj g j = 0

j = 1, 2,..., m

gj ≤ 0

j = 1, 2,..., m

λj ≥ 0

j = 1, 2,..., m

(1)

M2L5 32

Optimization Methods: Optimization using Calculus – Kuhn-Tucker Conditions

2

In case of minimization problems, if the constraints are of the form gj(X) ≥ 0, then λ j have to be nonpositive in (1). On the other hand, if the problem is one of maximization with the constraints in the form gj(X) ≥ 0, then λ j have to be nonnegative. It may be noted that sign convention has to be strictly followed for the Kuhn-Tucker conditions to be applicable. Example 1 Minimize f = x12 + 2 x22 + 3 x32 subject to the constraints g1 = x1 − x2 − 2 x3 ≤ 12 g 2 = x1 + 2 x2 − 3 x3 ≤ 8 using Kuhn-Tucker conditions. Solution: The Kuhn-Tucker conditions are given by

a)

∂f ∂g ∂g + λ1 1 + λ2 2 = 0 ∂xi ∂xi ∂xi

i.e. 2 x1 + λ1 + λ2 = 0

(2)

4 x2 − λ1 + 2λ2 = 0

(3)

6 x3 − 2λ1 − 3λ2 = 0

(4)

b) λ j g j = 0 i.e.

λ1 ( x1 − x2 − 2 x3 − 12) = 0 λ2 ( x1 + 2 x2 − 3x3 − 8) = 0

(5) (6)

c) g j ≤ 0

M2L5 33

Optimization Methods: Optimization using Calculus – Kuhn-Tucker Conditions

3

i.e.,

x1 − x2 − 2 x3 − 12 ≤ 0

(7)

x1 + 2 x2 − 3 x3 − 8 ≤ 0

(8)

d) λ j ≥ 0 i.e.,

λ1 ≥ 0 λ2 ≥ 0

(9) (10)

From (5) either λ1 = 0 or, x1 − x2 − 2 x3 − 12 = 0 Case 1: λ1 = 0 From (2), (3) and (4) we have x1 = x2 = −λ2 / 2 and x3 = λ2 / 2 . Using these in (6) we get λ22 + 8λ2 = 0, ∴ λ2 = 0 or − 8 From (10), λ2 ≥ 0 , therefore, λ2 =0, X* = [ 0, 0, 0 ], this solution set satisfies all of (6) to (9) Case 2: x1 − x2 − 2 x3 − 12 = 0

Using (2), (3) and (4), we have

−λ1 − λ2 λ1 − 2λ2 2λ1 + 3λ2 − − − 12 = 0 or, 2 4 3

17λ1 + 12λ2 = −144 . But conditions (9) and (10) give us λ1 ≥ 0 and λ2 ≥ 0 simultaneously, which cannot be possible with 17λ1 + 12λ2 = −144 . Hence the solution set for this optimization problem is X* = [ 0 0 0 ]

M2L5 34

Optimization Methods: Optimization using Calculus – Kuhn-Tucker Conditions

4

Example 2 Minimize f = x12 + x22 + 60 x1 subject to the constraints g1 = x1 − 80 ≥ 0 g 2 = x1 + x2 − 120 ≥ 0 using Kuhn-Tucker conditions. Solution The Kuhn-Tucker conditions are given by a)

∂g ∂f ∂g ∂g + λ1 1 + λ2 2 + λ3 3 = 0 ∂xi ∂xi ∂xi ∂xi

i.e. 2 x1 + 60 + λ1 + λ2 = 0

(11)

2 x2 + λ2 = 0

(12)

λ1 ( x1 − 80) = 0 λ2 ( x1 + x2 − 120) = 0

(13)

x1 − 80 ≥ 0

(15)

x1 + x2 + 120 ≥ 0

(16)

b) λ j g j = 0 i.e. (14)

c) g j ≤ 0 i.e.,

d) λ j ≤ 0 i.e., M2L5 35

Optimization Methods: Optimization using Calculus – Kuhn-Tucker Conditions

λ1 ≤ 0 λ2 ≤ 0

5 (17) (18)

From (13) either λ1 = 0 or, ( x1 − 80) = 0 Case 1: λ1 = 0 From (11) and (12) we have x1 = −

λ2

2

− 30 and x2 = −

λ2

2

Using these in (14) we get λ2 ( λ2 − 150 ) = 0 ; ∴ λ2 = 0 or − 150 Considering λ2 = 0 , X* = [ 30, 0]. But this solution set violates (15) and (16) For λ2 = −150 , X* = [ 45, 75]. But this solution set violates (15) . Case 2: ( x1 − 80) = 0 Using x1 = 80 in (11) and (12), we have

λ2 = −2 x2 λ1 = 2 x2 − 220

(19)

Substitute (19) in (14), we have

−2 x2 ( x2 − 40 ) = 0 . For this to be true, either x2 = 0 or x2 − 40 = 0 For x2 = 0 , λ1 = −220 . This solution set violates (15) and (16)

M2L5 36

Optimization Methods: Optimization using Calculus – Kuhn-Tucker Conditions

6

For x2 − 40 = 0 , λ1 = −140 and λ2 = −80 . This solution set is satisfying all equations from (15) to (19) and hence the desired. Therefore, the solution set for this optimization problem is X* = [ 80 40 ]. References / Further Reading:

1. Rao S.S., Engineering Optimization – Theory and Practice, Third Edition, New Age International Limited, New Delhi, 2000. 2. Ravindran A., D.T. Phillips and J.J. Solberg, Operations Research – Principles and Practice, John Wiley & Sons, New York, 2001. 3. Taha H.A., Operations Research – An Introduction, Prentice-Hall of India Pvt. Ltd., New Delhi, 2005. 4. Vedula S., and P.P. Mujumdar, Water Resources Systems: Modelling Techniques and Analysis, Tata McGraw Hill, New Delhi, 2005.

M2L5 37

Optimization Methods: Linear Programming- Preliminaries

1

Module – 3 Lecture Notes – 1 Preliminaries Introduction Linear Programming (LP) is the most useful optimization technique used for the solution of engineering problems. The term ‘linear’ implies that the objective function and constraints are ‘linear’ functions of ‘nonnegative’ decision variables. Thus, the conditions of LP problems (LPP) are 1. Objective function must be a linear function of decision variables 2. Constraints should be linear function of decision variables 3. All the decision variables must be nonnegative For example,

Maximize subject to

Z = 6x + 5 y 2x − 3y ≤ 5 x + 3 y ≤ 11 4 x + y ≤ 15

π Objective Function π 1st Constraint π 2nd Constraint π 3rd Constraint

x, y ≥ 0

π Nonnegativity Condition

is an example of LP problem. However, example shown above is in “general” form. Standard form of LPP

Standard form of LPP must have following three characteristics: 1. Objective function should be of maximization type 2. All the constraints should of equality type 3. All the decision variables should be nonnegative The procedure to transform a general form of a LPP to its standard form is discussed below. Let us consider the following example. Minimize

Z = −3x1 − 5x2

subject to

2x1 − 3x2 ≤ 15 x1 + x2 ≤ 3 4x1 + x2 ≥ 2 x1 ≥ 0 x2 unrestricted

M3L1

Optimization Methods: Linear Programming- Preliminaries

2

The above LPP is violating the following criteria of standard form: 1. Objective function is of minimization type 2. Constraints are of inequality type 3. Decision variable x 2 is unrestricted, i.e., it can take negative values also, thus violating the non-negativity criterion. However, a standard form for this LPP can be obtained by transforming it as follows: Objective function can be rewritten as Maximize

Z ′ = − Z = 3 x1 + 5x2

The first constraint can be rewritten as: 2x1 − 3x2 + x3 = 15. Note that, a new nonnegative variable x3 is added to the left-hand-side (LHS) to make both sides equal. Similarly, the second constraint can be rewritten as: x1 + x 2 + x 4 = 3 . The variables x3 and x4 are known as slack variables. The third constraint can be rewritten as: 4x1 + x2 − x5 = 2 . Again, note that a

new nonnegative variable x5 is subtracted form the LHS to make both sides equal. The variable x5 is known as surplus variable. Decision variable x2 can expressed by introducing two extra nonnegative variables as x2 = x′2 − x2′′

Thus, x 2 can be negative if x 2′ < x 2′′ and positive if x 2′ > x 2′′ depending on the values of x 2′ and x 2′′ . x 2 can be zero also if x 2′ = x 2′′ .

Thus, the standard form of above LPP is as follows: Maximize subject to

Z ′ = −Z = 3x1 + 5(x2′ − x2′′ ) 2x1 − 3(x2′ − x2′′ ) + x3 = 15 x1 + (x2′ − x2′′ ) + x4 = 3 4x1 + (x2′ − x2′′ ) − x5 = 2

x1 , x2′ , x2′′ , x3 , x4 , x5 ≥ 0

After obtaining solution for x 2′ and x 2′′ , solution for x 2 can be obtained as, x 2 = x 2′ − x 2′′ .

M3L1

Optimization Methods: Linear Programming- Preliminaries

3

Canonical form of LPP

Canonical form of standard LPP is a set of equations consisting of the ‘objective function’ and all the ‘equality constraints’ (standard form of LPP) expressed in canonical form. Understanding the canonical form of LPP is necessary for studying simplex method, the most popular method of solving LPP. Simplex method will be discussed in some other class. In this class, canonical form of a set of linear equations will be discussed first. Canonical form of LPP will be discussed next. Canonical form of a set of linear equations

Let us consider a set of three equations with three variables for ease of discussion. Later, the method will be generalized. Let us consider the following set of equations,

3x + 2 y + z = 10

(A0)

x − 2 y + 3z = 6

(B0)

2x + y − z = 1

(C0)

The system of equations can be transformed in such a way that a new set of three different equations are obtained, each having only one variable with nonzero coefficient. This can be achieved by some elementary operations. The following operations are known as elementary operations. 1. Any equation Er can be replaced by kEr, where k is a nonzero constant. 2. Any equation Er can be replaced by Er + kEs, where Es is another equation of the system and k is as defined above. Note that the transformed set of equations through elementary operations is equivalent to the original set of equations. Thus, solution of the transformed set of equations will be the solution of the original set of equations too.

M3L1

Optimization Methods: Linear Programming- Preliminaries

4

Now, let us transform the above set of equation (A0, B0 and C0) through elementary operations (shown inside bracket in the right side). x+

2 1 10 y+ z= 3 3 3

0−

8 8 8 y+ z = 3 3 3

0−

1 5 17 y− z =− 3 3 3

1 A0 ) 3

(A1 =

(B1 = B0 – A1) (C1 = C0 – 2 A1)

Note that variable x is eliminated from equations B0 and C0 to obtain B1 and C1 respectively. Equation A0 in the previous set is known as pivotal equation. Following similar procedure, y is eliminated from A1 and C1 as follows, considering B1 as pivotal equation. x+0+ z = 4 0 + y − z = −1

0 + 0 − 2 z = −6

2 B2) 3

(A2 = A1 -

3 (B2 = − B1) 8 1 B2) 3

(C2 = C1 +

Finally, z is eliminated form A2 and B2 as follows, considering C2 as pivotal equation. x + 0+ 0 =1

(A3 = A2 – C3)

0+ y+0 = 2

(B3 = B2 + C3)

0+0+z =3

(C3 = −

1 C2) 2

Thus we end up with another set of equations which is equivalent to the original set having one variable in each equation. Transformed set of equations, (A3, B3 and C3), thus obtained are said to be in canonical form. Operation at each step to eliminate one variable at a time, from all equations except one, is known as pivotal operation. It is obvious that the number of pivotal operations is the same as the number of variables in the set of equations. Thus we did three pivotal operations to obtain the canonical form of the set of equations having three variables each.

It may be noted that, at each pivotal operation, the pivotal equation is transformed first and using the transformed pivotal equation, other equations in the system are transformed. For M3L1

Optimization Methods: Linear Programming- Preliminaries

5

example, while transforming, A1, B1 and C1 to A2, B2 and C2, considering B1 as pivotal equation, B2 is obtained first. A2 and C2 are then obtained using B2. Transformation can be obtained by some other elementary operations also but will end up in the same canonical form. The procedure explained above is used in simplex algorithm which will be discussed later. The elementary operations involved in pivotal operations, as explained above, will help the reader to follow the analogy while understanding the simplex algorithm. To generalize the procedure explained above, let us consider the following system of n equations with n variables. a11 x1 + a12 x 2 + Λ Λ Λ + a1n x n = b1

( E1 )

a 21 x1 + a 22 x 2 + Λ Λ Λ + a 2 n x n = b2

(E2 )

Μ Μ a n1 x1 + a n 2 x 2 + Λ Λ Λ + a nn x n = bn

Μ Μ (En )

Canonical form of above system of equations can be obtained by performing n pivotal operations through elementary operations. In general, variable xi (i = 1Λ n ) is eliminated from all equations except j th equation for which a ji is nonzero.

General procedure for one pivotal operation consists of following two steps,

1. Divide j th equation by a ji . Let us designate it as ( E ′j ) , i.e., E ′j =

2. Subtract a ki times of equation ( E ′j ) from k

th

Ej a ji

equation (k = 1, 2, Λ j − 1, j + 1, Λ , n ) , i.e.,

E k − a ki E ′j

M3L1

Optimization Methods: Linear Programming- Preliminaries

6

Above steps are repeated for all the variables in the system of equations to obtain the canonical form. Finally the canonical form will be as follows: 1x1 + 0 x 2 + Λ Λ Λ + 0 x n = b1′′

( E1c )

0 x1 + 1x 2 + Λ Λ Λ + 0 x n = b2′′

( E 2c )

Μ Μ

Μ Μ

0 x1 + 0 x 2 + Λ Λ Λ + 1x n = bn′′

( E nc )

It is obvious that solution of the system of equations can be easily obtained from canonical form, such as: xi = bi′′ which is the solution of the original set of equations too as the canonical form is obtained through elementary operations. Now let us consider more general case for which the system of equations has m equations with n variables ( n ≥ m ). It is possible to transform the set of equations to an equivalent canonical form from which at least one solution can be easily deduced.

Let us consider the following general set of equations. a11 x1 + a12 x 2 + Λ Λ Λ + a1n x n = b1

( E1 )

a 21 x1 + a 22 x 2 + Λ Λ Λ + a 2 n x n = b2

( E2 )

Μ Μ a m1 x1 + a m 2 x 2 + Λ Λ Λ + a mn x n = bm

Μ Μ ( Em )

M3L1

Optimization Methods: Linear Programming- Preliminaries

7

By performing n pivotal operations (described earlier) for any m variables (say, x1 , x 2 , Λ x m , called pivotal variables), the system of equations reduced to canonical form will be as follows:

1x1 + 0 x 2 + Λ Λ Λ + 0 x m + a1′′,m +1 x m +1 + Λ Λ Λ + a1′′n x n = b1′′

( E1c )

0 x1 + 1x 2 + Λ Λ Λ + 0 x m + a 2′′,m +1 x m +1 + Λ Λ Λ + a 2′′n x n = b2′′

( E 2c )

Μ Μ

Μ Μ

′′ x n = bm′′ 0 x1 + 0 x 2 + Λ Λ Λ + 1x m + a m′′ ,m +1 x m +1 + Λ Λ Λ + a mn

( E mc )

Variables, x m +1 , Λ , x n , of above set of equations are known as nonpivotal variables or independent variables. One solution that can be obtained from the above set of equations is xi = bi′′ for i = 1Λ m and xi = 0 for i = (m + 1)Λ n . This solution is known as basic solution. Pivotal variables, x1 , x 2 , Λ x m , are also known as basic variables. Nonpivotal variables, x m +1 , Λ , x n , are known as nonbasic variables. Canonical form of a set of LPP

Similar procedure can be followed in the case of a standard form of LPP. Objective function and all constraints for such standard form of LPP constitute a linear set of equations. In general this linear set will have m equations with n variables ( n ≥ m ). The set of canonical form obtained from this set of equations is known as canonical form of LPP. If the basic solution satisfies all the constraints as well as non-negativity criterion for all the variables, such basic solution is also known as basic feasible solution. It is obvious that, there can be n c m numbers of different canonical forms and corresponding basic feasible solutions. Thus, if there are 10 equations with 15 variables there exist

15

c10 = 3003 solutions, a huge

number to be inspected one by one to find out the optimal solution. This is the reason which motivates for an efficient algorithm for solution of the LPP. Simplex method is one such popular method, which will be discussed after graphical method.

M3L1

Optimization Methods: Linear Programming- Graphical Method

1

Module – 3 Lecture Notes – 2 Graphical Method

Graphical method to solve Linear Programming problem (LPP) helps to visualize the procedure explicitly. It also helps to understand the different terminologies associated with the solution of LPP. In this class, these aspects will be discussed with the help of an example. However, this visualization is possible for a maximum of two decision variables. Thus, a LPP with two decision variables is opted for discussion. However, the basic principle remains the same for more than two decision variables also, even though the visualization beyond twodimensional case is not easily possible. Let us consider the same LPP (general form) discussed in previous class, stated here once again for convenience. Maximize subject to

Z = 6x + 5 y 2x − 3 y ≤ 5 x + 3 y ≤ 11 4 x + y ≤ 15 x, y ≥ 0

(C − 1) (C − 2) (C − 3) (C − 4) & (C − 5)

First step to solve above LPP by graphical method, is to plot the inequality constraints oneby-one on a graph paper. Fig. 1a shows one such plotted constraint. 5 4 3 2 1 0 -2

-1

0

1

2

3

4

5

-1 -2

2x − 3y ≤ 5

Fig. 1a Plot showing first constraint ( 2 x − 3 y ≤ 5 ) Fig. 1b shows all the constraints including the nonnegativity of the decision variables (i.e., x ≥ 0 and y ≥ 0 ).

M3L2

Optimization Methods: Linear Programming- Graphical Method

5

2

x + 3 y ≤ 11 4 x + y ≤ 15

4 3 x≥0

2

y≥0

1 0 -2

-1

0

1

2

3

4

5

-1

2x − 3y ≤ 5

-2

Fig. 1b Plot of all the constraints Common region of all these constraints is known as feasible region (Fig. 1c). Feasible region implies that each and every point in this region satisfies all the constraints involved in the LPP. 5 4 3 2

Feasible region

1 0 -2

-1

0

1

2

3

4

5

-1 -2

Fig. 1c Feasible region

Once the feasible region is identified, objective function ( Z = 6 x + 5 y ) is to be plotted on it. As the (optimum) value of Z is not known, objective function is plotted by considering any constant, k (Fig. 1d). The straight line, 6 x + 5 y = k (constant), is known as Z line (Fig. 1d). This line can be shifted in its perpendicular direction (as shown in the Fig. 1d) by changing the value of k. Note that, position of Z line shown in Fig. 1d, showing the intercept, c, on the

M3L2

Optimization Methods: Linear Programming- Graphical Method

y axis is 3. If, c=

6 x + 5 y = k => 5 y = −6 x + k => y =

3

k −6 x + , i.e., 5 5

m=

−6 5

and

k = 3 => k = 15 . 5 5 4 3 2 1 0 -2

-1

0

1

2

3

4

5

-1 Z Line

-2

Fig. 1d Plot of Z line and feasible region 5 Z Line

4

Optimal Point

3 2 1 0 -2

0

-1

1

2

3

4

5

-1 -2

Fig. 1e Location of Optimal Point Now it can be visually noticed that value of the objective function will be maximum when it passes through the intersection of x + 3 y = 11 and 4 x + y = 15 (straight lines associated with the second and third inequality constraints). This is known as optimal point (Fig. 1e). Thus the optimal point of the present problem is x * = 3.091 and y * = 2.636 . And the optimal solution is = 6 x * + 5 y * = 31.727

M3L2

Optimization Methods: Linear Programming- Graphical Method

4

Visual representation of different cases of solution of LPP

A linear programming problem may have i) a unique, finite solution, ii) an unbounded solution iii) multiple (or infinite) number of optimal solutions, iv) infeasible solution and v) a unique feasible point. In the context of graphical method it is easy to visually demonstrate the different situations which may result in different types of solutions. Unique, finite solution

The example demonstrated above is an example of LPP having a unique, finite solution. In such cases, optimum value occurs at an extreme point or vertex of the feasible region. Unbounded solution

If the feasible region is not bounded, it is possible that the value of the objective function goes on increasing without leaving the feasible region. This is known as unbounded solution (Fig 2). 5 4 3

Z Line 2 1 0 -2

-1

0

1

2

3

4

5

-1 -2

Fig. 2 Unbounded Solution

M3L2

Optimization Methods: Linear Programming- Graphical Method

5

Multiple (infinite) solutions

If the Z line is parallel to any side of the feasible region all the points lying on that side constitute optimal solutions as shown in Fig 3.

5

Parallel

4 3 2 1 0 -2

-1

0

1

2

3

4

5

-1

Z Line

-2

Fig. 3 Multiple (infinite) Solution Infeasible solution

Sometimes, the set of constraints does not form a feasible region at all due to inconsistency in the constraints. In such situation the LPP is said to have infeasible solution. Fig 4 illustrates such a situation.

5 4 3 2 1

Z Line

0 -2

-1

0

1

2

3

4

5

-1 -2

Fig. 4 Infeasible Solution

M3L2

Optimization Methods: Linear Programming- Graphical Method

6

Unique feasible point

This situation arises when feasible region consist of a single point. This situation may occur only when number of constraints is at least equal to the number of decision variables. An example is shown in Fig 5. In this case, there is no need for optimization as there is only one solution.

5 4

Unique feasible point

3 2 1 0 -2

-1

0

1

2

3

4

5

-1 -2

Fig. 5 Unique feasible point

M3L2

Optimization Methods: Linear Programming- Simplex Method-I

1

Module – 3 Lecture Notes – 3 Simplex Method - I Introduction It is already stated in a previous lecture that the most popular method used for the solution of Linear Programming Problems (LPP) is the simplex method. In this lecture, motivation for simplex method will be discussed first. Simplex algorithm and construction of simplex tableau will be discussed later with an example problem. Motivation for Simplex method Recall from the second class that the optimal solution of a LPP, if exists, lies at one of the vertices of the feasible region. Thus one way to find the optimal solution is to find all the basic feasible solutions of the canonical form and investigate them one-by-one to get at the optimal. However, again recall the example at the end of the first class that, for 10 equations with 15 variables there exists a huge number ( 15 c10 = 3003) of basic feasible solutions. In such a case, inspection of all the solutions one-by-one is not practically feasible. However, this can be overcome by simplex method. Conceptual principle of this method can be easily understood for a three dimensional case (however, simplex method is applicable for any higher dimensional case as well). Imagine a feasible region (i.e., volume) bounded by several surfaces. Each vertex of this volume, which is a basic feasible solution, is connected to three other adjacent vertices by a straight line to each being the intersection of two surfaces. Being at any one vertex (one of the basic feasible solutions), simplex algorithm helps to move to another adjacent vertex which is closest to the optimal solution among all the adjacent vertices. Thus, it follows the shortest route to reach the optimal solution from the starting point. It can be noted that the shortest route consists of a sequence of basic feasible solutions which is generated by simplex

algorithm. The basic concept of simplex algorithm for a 3-D case is shown in Fig 1.

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

2

Fig 1. The general procedure of simplex method is as follows: 1. General form of given LPP is transformed to its canonical form (refer Lecture note 1). 2. A basic feasible solution of the LPP is found from the canonical form (there should exist at least one). 3. This initial solution is moved to an adjacent basic feasible solution which is closest to the optimal solution among all other adjacent basic feasible solutions. 4. The procedure is repeated until the optimum solution is achieved. Step three involves simplex algorithm which is discussed in the next section. Simplex algorithm Simplex algorithm is discussed using an example of LPP. Let us consider the following problem. Maximize

Z = 4 x1 − x 2 + 2 x3

subject to

2 x1 + x 2 + 2 x3 ≤ 6 x1 − 4 x 2 + 2 x3 ≤ 0 5 x1 − 2 x 2 − 2 x3 ≤ 4 x1 , x 2 , x3 ≥ 0

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

3

Simplex algorithm is used to obtain the solution of this problem. First let us transform the LPP to its standard form as shown below. Maximize

Z = 4 x1 − x 2 + 2 x3

subject to

2 x1 + x 2 + 2 x3 + x 4 = 6 x1 − 4 x 2 + 2 x3 + x5 = 0 5 x1 − 2 x 2 − 2 x3 + x 6 = 4 x1 , x 2 , x3 , x 4 , x5 , x6 ≥ 0

It can be recalled that x 4 , x5 and x6 are slack variables. Above set of equations, including the objective function can be transformed to canonical form as follows:

− 4 x1 + x 2 − 2 x3 + 0 x 4 + 0 x5 + 0 x6 + Z

=0

2 x1 + x 2 + 2 x3 + 1x 4 + 0 x5 + 0 x6

=6

x1 − 4 x 2 + 2 x3 + 0 x 4 + 1x5 + 0 x6

=0

5 x1 − 2 x 2 − 2 x3 + 0 x 4 + 0 x5 + 1x6

=4

The basic solution of above canonical form is x 4 = 6 , x5 = 0 , x6 = 4 , x1 = x 2 = x3 = 0 and Z = 0 . It can be noted that, x 4 , x5 and x6 are known as basic variables and x1 , x 2 and x3 are

known as nonbasic variables of the canonical form shown above. Let us denote each equation of above canonical form as:

(Z )

− 4 x1 + x 2 − 2 x3 + 0 x 4 + 0 x5 + 0 x6 + Z

=0

(x4 )

2 x1 + x 2 + 2 x3 + 1x 4 + 0 x5 + 0 x6

=6

( x5 )

x1 − 4 x 2 + 2 x3 + 0 x 4 + 1x5 + 0 x 6

=0

(x6 )

5 x1 − 2 x 2 − 2 x3 + 0 x 4 + 0 x5 + 1x 6

=4

For the ease of discussion, right hand side constants and the coefficients of the variables are symbolized as follows:

(Z ) (x4 ) ( x5 ) ( x6 )

c1 x1

+ c2 x2

+ c3 x3 + c 4 x 4 + c5 x5 + c 6 x5

+Z

=b

c 41 x1 + c 42 x 2 + c 43 x3 + c 44 x 4 + c 45 x5 + c 46 x5

= b4

c51 x1 + c52 x 2 + c53 x3 + c54 x 4 + c55 x5 + c56 x5

= b5

c61 x1 + c62 x 2 + c63 x3 + c64 x 4 + c65 x5 + c66 x5

= b6

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

4

The left-most column is known as basis as this is consisting of basic variables. The coefficients in the first row ( c1 Λ c6 ) are known as cost coefficients. Other subscript notations are self explanatory and used for the ease of discussion. For each coefficient, first subscript indicates the subscript of the basic variable in that equation. Second subscript indicates the subscript of variable with which the coefficient is associated. For example, c52 is the coefficient of x 2 in the equation having the basic variable x5 with nonzero coefficient (i.e., c55 is nonzero). This completes first step of calculation. After completing each step (iteration) of calculation, three points are to be examined: 1. Is there any possibility of further improvement? 2. Which nonbasic variable is to be entered into the basis? 3. Which basic variable is to be exited from the basis? The procedure to check these points is discussed next.

1. Is there any possibility of further improvement? If any of the cost coefficients is negative, further improvement is possible. In other words, if all the cost coefficients are nonnegative, the basic feasible solution obtained in that step is optimum.

2. Which nonbasic variable is to be entered? Entering nonbasic variable is decided such that the unit change of this variable should have maximum effect on the objective function. Thus the variable having the coefficient which is minimum among all the cost coefficients is to be entered, i.e., x S is to be entered if cost coefficient c S is minimum.

3. Which basic variable is to be exited? After deciding the entering variable x S , x r (from the set of basic variables) is decided to be the exiting variable if

br is minimum for all possible r, provided c rs

c rs is positive.

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

5

It can be noted that, c rs is considered as pivotal element to obtain the next canonical form. In this example, c1 (= −4 ) is the minimum. Thus, x1 is the entering variable for the next step of calculation. r may take any value from 4, 5 and 6. It is found that

b4 6 = = 3, c 41 2

b5 0 b b 4 = = 0 and 6 = = 0.8 . As, 5 is minimum, r is 5. Thus x5 is to be exited and c51 is c51 1 c61 5 c51

the pivotal element and x5 is replaced by x1 in the basis. Set of equations are transformed through pivotal operation to another canonical form considering c51 as the pivotal element. The procedure of pivotal operation is already explained in first class. However, as a refresher it is explained here once again. 1. Pivotal row is transformed by dividing it with the pivotal element. In this case, pivotal element is 1. 2. For other rows: Let the coefficient of the element in the pivotal column of a particular row be “l”. Let the pivotal element be “m”. Then the pivotal row is multiplied by l / m and then subtracted from that row to be transformed. This operation ensures that the coefficients of the element in the pivotal column of that row becomes zero, e.g., Z row: l = -4 , m = 1. So, pivotal row is multiplied by l / m = -4 / 1 = -4, obtaining

− 4 x1 + 16 x 2 − 8 x3 + 0 x 4 − 4 x5 + 0 x6 = 0 This is subtracted from Z row obtaining, 0 x1 − 15 x2 + 6 x3 + 0 x4 + 4 x5 + 0 x6 + Z

=0

The other two rows are also suitably transformed. After the pivotal operation, the canonical form obtained is shown below.

(Z ) (x4 ) (x1 ) ( x6 )

0 x1 − 15 x 2 + 6 x3 + 0 x 4 + 4 x5 + 0 x6 + Z

=0

0 x1 + 9 x 2 − 2 x3 + 1x 4 − 2 x5 + 0 x6

=6

1x1 − 4 x 2 + 2 x3 + 0 x 4 + 1x5 + 0 x6

=0

0 x1 + 18 x 2 − 12 x3 − 0 x 4 − 5 x5 + 1x6

=4

The basic solution of above canonical form is x1 = 0 , x 4 = 6 , x6 = 4 , x3 = x 4 = x5 = 0 and Z = 0 . However, this is not the optimum solution as the cost coefficient c 2 is negative. It is

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

6

observed that c 2 (= -15) is minimum. Thus, s = 2 and x 2 is the entering variable. r may take

any value from 4, 1 and 6. However, c12 (= −4 ) is negative. Thus, r may be either 4 or 6. It is found that,

b b b4 6 4 = = 0.667 , and 6 = = 0.222 . As 6 is minimum, r is 6 and x6 is to c62 c 42 9 c62 18

be exited from the basis. c62 (=18) is to be treated as pivotal element. The canonical form for next iteration is as follows:

(Z )

0 x1 + 0 x 2 − 4 x3 + 0 x 4 −

(x4 )

0 x1 + 0 x 2 + 4 x3 + 1x 4 +

(x1 )

1x1 + 0 x 2 −

(x2 )

0 x1 + 1x 2 −

1 1 x5 − x6 2 2

=

10 3

=4

2 1 2 x3 + 0 x 4 − x5 + x6 3 9 9

=

8 9

2 5 1 x3 + 0 x 4 − x5 + x6 3 18 18

=

2 9

The basic solution of above canonical form is x1 = Z=

1 5 x5 + x6 + Z 6 6

8 2 , x 2 = , x 4 = 4 , x 2 = x3 = x5 = 0 and 9 9

10 . 3

It is observed that c3 (= -4) is negative. Thus, optimum is not yet achieved. Following similar procedure as above, it is decided that x3 should be entered in the basis and x 4 should be exited from the basis. Thus, x 4 is replaced by x3 in the basis. Set of equations are transformed to another canonical form considering c 43 (= 4) as pivotal element. By doing so, the canonical form is shown below. 1 1 x5 + x 6 + Z 3 3

22 3

(Z )

0 x1 + 0 x 2 + 0 x3 + 1x 4 +

( x3 )

0 x1 + 0 x 2 + 1x3 +

1 1 1 x 4 + x5 − x6 4 8 8

=1

(x1 )

1x1 + 0 x 2 + 0 x3 +

1 1 5 x4 − x5 + x6 6 36 36

=

14 9

(x2 )

0 x1 + 1x 2 + 0 x3 +

=

8 9

1 7 1 x4 − x5 − x6 6 36 36

=

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

The basic solution of above canonical form is x1 =

Z=

7

8 14 , x 2 = , x3 = 1 , x 4 = x5 = x6 = 0 and 9 9

22 . 3

It is observed that all the cost coefficients are positive. Thus, optimum is achieved. Hence, the optimum solution is Z=

22 = 7.333 3

x1 =

14 = 1.556 9

x2 =

8 = 0.889 9

x3 = 1 The calculation shown above can be presented in a tabular form, which is known as Simplex Tableau. Construction of Simplex Tableau will be discussed next. Construction of Simplex Tableau

Same LPP is considered for the construction of simplex tableau. This helps to compare the calculation shown above and the construction of simplex tableau for it. After preparing the canonical form of the given LPP, simplex tableau is constructed as follows.

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

8

Variables Iteration

Basis

Z x1

x2

x3

x4

x5

x6

br

br c rs

Z

1

-4

1

-2

0

0

0

0

--

x4

0

2

1

2

1

0

0

6

3

x5

0

1

-4

2

0

1

0

0

0

x6

0

5

-2

-2

0

0

1

4

4 5

1

Pivotal Column

Pivotal Row

Pivotal Element After completing each iteration, the steps given below are to be

followed.

Logically, these steps are exactly similar to the procedure described earlier. However, steps described here are somewhat mechanical and easy to remember! Check for optimum solution:

1. Investigate whether all the elements in the first row (i.e., Z row) are nonnegative or not. Basically these elements are the coefficients of the variables headed by that column. If all such coefficients are nonnegative, optimum solution is obtained and no need of further iterations. If any element in this row is negative, the operation to obtain simplex tableau for the next iteration is as follows:

Operations to obtain next simplex tableau:

2. The entering variable is identified (described earlier). The corresponding column is marked as Pivotal Column as shown above. 3. The exiting variable from the basis is identified (described earlier). The corresponding row is marked as Pivotal Row as shown above. 4. Coefficient at the intersection of Pivotal Row and Pivotal Column is marked as Pivotal Element as shown above.

5. In the basis, the exiting variable is replaced by entering variable.

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

9

6. All the elements in the pivotal row are divided by pivotal element. 7. For any other row, an elementary operation is identified such that the coefficient in the pivotal column in that row becomes zero. The same operation is applied for all other elements in that row and the coefficients are changed accordingly. A similar procedure is followed for all other rows. For example, say, (2 x pivotal element + pivotal coefficient in first row) produce zero in the pivotal column in first row. The same operation is applied for all other elements in the first row and the coefficients are changed accordingly. Simplex tableaus for successive iterations are shown below. Pivotal Row, Pivotal Column and Pivotal Element for each tableau are marked as earlier for the ease of understanding.

Variables Iteration

Basis

Z x1

x2

x3

x4

x5

x6

br

br c rs

Z

1

0

-15

6

0

4

0

0

--

x4

0

0

9

-2

1

-2

0

6

13

x1

0

1

-4

2

0

1

0

0

--

x6

0

0

18

-12

0

-5

1

4

29

2

……continued to next page

Note: devided eq of x6 by pivotal element (18 in iteration 2) to be eq of x2 then subtract Z-eq x2 to be instead of Z then subtract eq x2 frm other equation before each subtraction process multiply eq x2 by the parameter of x2 in each equation.

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

10

……continued from previous page Variables Iteration

Basis

Z x1

x2

x3

x4

x5

x6

1 6

5 6



Z

1

0

0

-4

0

x4

0

0

0

4

1

x1

0

1

0



2 3

0



x2

0

0

1



2 3

0



0

0

0

3

Z

1

1 2



1 2

br

br c rs

10 3

--

4

1

1 9

2 9

8 9

--

5 18

1 18

2 9

--

1

1 3

1 3

22 3

1 8

x3

0

0

0

1

1 4

x1

0

1

0

0

1 6



1 36

x2

0

0

1

0

1 6



7 36



1 8

1

4



2 9

14 9

1 36

8 9

Optimum value of Z All the coefficients are nonnegative. Thus optimum solution is achieved.

Value of x3 Value of x1 Value of x 2

M3L3

Optimization Methods: Linear Programming- Simplex Method-I

11

As all the elements in the first row (i.e., Z row), at iteration 4, are nonnegative, optimum solution is achieved. Optimum value of Z is values of basic variables are x1 =

22 = 7.333 as shown above. Corresponding 3

14 8 = 1.556 , x 2 = = 0.889 , x3 = 1 and those of nonbasic 9 9

variables are all zero (i.e., x 4 = x5 = x6 = 0 ).

It can be noted that at any iteration the following two points must be satisfied: 1. All the basic variables (other than Z) have a coefficient of zero in the Z row. 2. Coefficients of basic variables in other rows constitute a unit matrix. If any of these points are violated at any iteration, it indicates a wrong calculation. However, reverse is not true.

M3L3

Optimization Methods: Linear Programming- Simplex Method - II

1

Module – 3 Lecture Notes – 4 Simplex Method – II Introduction In the previous lecture the simplex method was discussed with required transformation of objective function and constraints. However, all the constraints were of inequality type with ‘less-than-equal-to’ ( ≤ ) sign. However, ‘greater-than-equal-to’ ( ≥ ) and ‘equality’ ( = ) constraints are also possible. In such cases, a modified approach is followed, which will be discussed in this lecture. Different types of LPP solutions in the context of Simplex method will also be discussed. Finally, a discussion on minimization vs maximization will be presented. Simplex Method with ‘greater-than-equal-to’ ( ≥ ) and equality ( = ) constraints The LP problem, with ‘greater-than-equal-to’ ( ≥ ) and equality ( = ) constraints, is transformed to its standard form in the following way. 1. One ‘artificial variable’ is added to each of the ‘greater-than-equal-to’ ( ≥ ) and equality ( = ) constraints to ensure an initial basic feasible solution. 2. Artificial variables are ‘penalized’ in the objective function by introducing a large negative (positive) coefficient M for maximization (minimization) problem. 3. Cost coefficients, which are supposed to be placed in the Z-row in the initial simplex tableau, are transformed by ‘pivotal operation’ considering the column of artificial variable as ‘pivotal column’ and the row of the artificial variable as ‘pivotal row’. 4. If there are more than one artificial variable, step 3 is repeated for all the artificial variables one by one. Let us consider the following LP problem Maximize

Z = 3x1 + 5 x2

subject to

x1 + x2 ≥ 2 x2 ≤ 6 3 x1 + 2 x2 = 18 x1 , x2 ≥ 0

After incorporating the artificial variables, the above LP problem becomes as follows:

M3L4

Optimization Methods: Linear Programming- Simplex Method - II

2

Maximize

Z = 3x1 + 5 x2 − Ma1 − Ma2

subject to

x1 + x2 − x3 + a1 = 2 x2 + x4 = 6 3 x1 + 2 x2 + a2 = 18 x1 , x2 ≥ 0

where x3 is surplus variable, x 4 is slack variable and a1 and a2 are the artificial variables. Cost coefficients in the objective function are modified considering the first constraint as follows: Z − 3 x1 − 5 x2 + Ma1 + Ma2 = 0 x1 + x2 − x3 + a1

=2

( E1 ) ( E2 )

Pivotal Row

Pivotal Column

Thus, pivotal operation is E1 − M × E 2 , which modifies the cost coefficients as follows: Z − (3 + M )x1 − (5 + M )x 2 + Mx3 + 0 a1 + Ma 2 = −2 M Next, the revised objective function is considered with third constraint as follows:

Z − (3 + M )x1 − (5 + M ) x 2 + Mx3 + 0 a1 + Ma 2 = −2 M 3 x1

+ 2 x2

+ a 2 = 18

(E 3 ) (E 4 )

Pivotal Row

Pivotal Column Obviously pivotal operation is E3 − M × E 4 , which further modifies the cost coefficients as follows: Z − (3 + 4 M )x1 − (5 + 3M )x 2 + Mx3 + 0 a1 + 0 a 2 = −20 M The modified cost coefficients are to be used in the Z-row of the first simplex tableau. Next, let us move to the construction of simplex tableau. Pivotal column, pivotal row and pivotal element are marked (same as used in the last class) for the ease of understanding.

M3L4

Optimization Methods: Linear Programming- Simplex Method - II

3

Variables Iteration

Basis

1

Note

that

Z

x1

x2

x3

x4

a1

a2

br

br c rs

Z

1

− 3 − 4M

− 5 − 3M

M

0

0

0

− 20 M

--

a1

0

1

1

-1

0

1

0

2

2

x4

0

0

1

0

1

0

0

6

--

a2

0

3

2

0

0

0

1

18

6

while

(− 3 − 4M )

comparing

(− 3 − 4M ) < (− 5 − 3M ) as

and

(− 5 − 3M ) ,

it

is

decided

that

M is any arbitrarily large number.

Successive iterations are shown as follows:

Variables Iteration

Basis

Z

x1

x2

x3

x4

a1

a2

br

br c rs

Z

1

0

−2+M

− 3 − 3M

0

3 + 4M

0

6 − 12 M

--

x1

0

1

1

-1

0

1

0

2

--

x4

0

0

1

0

1

0

0

6

--

a2

0

0

-1

3

0

-3

1

12

4

2

……continued to next page

M3L4

Optimization Methods: Linear Programming- Simplex Method - II

4

……continuing from previous page Variables Iteration

Basis

Z x1

x2

x3

x4

a1

a2

br

br c rs

Z

1

0

-3

0

0

M

1+ M

18

--

x1

0

1

2 3

0

0

0

1 3

6

9

x4

0

0

1

0

1

0

0

6

6

x3

0

0

1

0

-1

1 3

4

--

Z

1

0

0

0

3

M

1+ M

36

--

x1

0

1

0

0

0

1 3

2

--

x2

0

0

1

0

1

0

0

6

--

x3

0

0

0

1

1 3

-1

1 3

6

--

3



1 3



2 3

4

It is found that, at iteration 4, optimality has reached. Optimal solution is Z = 36 with x1 = 2 and x2 = 6 . The methodology explained above is known as Big-M method. Hope, reader has already understood the meaning of the terminology!

‘Unbounded’, ‘Multiple’ and ‘Infeasible’ solutions in the context of Simplex Method As already discussed in lecture notes 2, a linear programming problem may have different type of solutions corresponding to different situations. Visual demonstration of these different types of situations was also discussed in the context of graphical method. Here, the same will be discussed in the context of Simplex method.

M3L4

Optimization Methods: Linear Programming- Simplex Method - II

5

Unbounded solution If at any iteration no departing variable can be found corresponding to entering variable, the value of the objective function can be increased indefinitely, i.e., the solution is unbounded.

Multiple (infinite) solutions If in the final tableau, one of the non-basic variables has a coefficient 0 in the Z-row, it indicates that an alternative solution exists. This non-basic variable can be incorporated in the basis to obtain another optimal solution. Once two such optimal solutions are obtained, infinite number of optimal solutions can be obtained by taking a weighted sum of the two optimal solutions. Consider the slightly revised above problem, Maximize

Z = 3x1 + 2 x2

subject to

x1 + x2 ≥ 2 x2 ≤ 6 3 x1 + 2 x2 = 18

x1 , x2 ≥ 0 Curious readers may find that the only modification is that the coefficient of x2 is changed from 5 to 2 in the objective function. Thus the slope of the objective function and that of third constraint are now same. It may be recalled from lecture notes 2, that if the Z line is parallel to any side of the feasible region (i.e., one of the constraints) all the points lying on that side constitute optimal solutions (refer fig 3 in lecture notes 2). So, reader should be able to imagine graphically that the LPP is having infinite solutions. However, for this particular set of constraints, if the objective function is made parallel (with equal slope) to either the first constraint or the second constraint, it will not lead to multiple solutions. The reason is very simple and left for the reader to find out. As a hint, plot all the constraints and the objective function on an arithmetic paper. Now, let us see how it can be found in the simplex tableau. Coming back to our problem, final tableau is shown as follows. Full problem is left to the reader as practice.

M3L4

Optimization Methods: Linear Programming- Simplex Method - II

6

Final tableau: Variables Iteration

Basis

3

Z x1

x2

x3

x4

a1

a2

0 2 3 1 1 − 3

0

0

M

0

0

0

0

1

0

1

0

-1

1+ M 1 3 0 1 3

Z

1

0

x1

0

1

x4

0

0

x3

0

0

br

br c rs

18

--

6

9

6

6

4

--

Coefficient of non-basic variable x2 is zero

As there is no negative coefficient in the Z-row the optimal is reached. The solution is Z = 18 with x1 = 6 and x2 = 0 . However, the coefficient of non-basic variable x2 is zero as shown in the final simplex tableau. So, another solution is possible by incorporating x2 in the basis. Based on the

br , x4 will be the exiting variable. The next tableau will be as follows: c rs

Variables Iteration

4

Basis

Z x1

x2

x3

x4

a1

a2

0 2 − 3 1 1 3

M

1+ M 1 3 0 1 3

Z

1

0

0

0

x1

0

1

0

0

x2

0

0

1

0

x3

0

0

0

1

0 0 -1

br

br c rs

18

--

2

--

6

6

6

18

Coefficient of non-basic variable x4 is zero

Thus, another solution is obtained, which is Z = 18 with x1 = 2 and x2 = 6 . Again, it may be noted that, the coefficient of non-basic variable x4 is zero as shown in the tableau. If one more similar step is performed, same simplex tableau at iteration 3 will be obtained.

M3L4

Optimization Methods: Linear Programming- Simplex Method - II

7

⎧⎪6 ⎫⎪ ⎧⎪2 ⎫⎪ Thus, we have two sets of solutions as ⎨ ⎬ and ⎨ ⎬ . Other optimal solutions will be obtained ⎩⎪0 ⎭⎪ ⎩⎪6 ⎭⎪ ⎧⎪6 ⎫⎪ ⎧⎪2 ⎫⎪ as β ⎨ ⎬ + (1 − β ) ⎨ ⎬ where, β ∈ [ 0,1] . For example, let β = 0.4 , corresponding solution is ⎩⎪0 ⎭⎪ ⎩⎪6 ⎭⎪ ⎪⎧3.6 ⎪⎫ ⎨ ⎬ , i.e., x1 = 3.6 and x2 = 3.6 . Note that values of the objective function are not changed ⎪⎩3.6 ⎪⎭ for different sets of solution; for all the cases Z = 18 .

Infeasible solution If in the final tableau, at least one of the artificial variables still exists in the basis, the solution is indefinite. Reader may check this situation both graphically and in the context of Simplex method by considering following problem: Maximize

Z = 3x1 + 2 x2

subject to

x1 + x2 ≤ 2 3 x1 + 2 x2 ≥ 18

x1 , x2 ≥ 0 Minimization versus maximization problems As discussed earlier, standard form of LP problems consist of a maximizing objective function. Simplex method is described based on the standard form of LP problems, i.e., objective function is of maximization type. However, if the objective function is of minimization type, simplex method may still be applied with a small modification. The required modification can be done in either of following two ways. 1. The objective function is multiplied by −1 so as to keep the problem identical and ‘minimization’ problem becomes ‘maximization’. This is because of the fact that minimizing a function is equivalent to the maximization of its negative. 2. While selecting the entering nonbasic variable, the variable having the maximum coefficient among all the cost coefficients is to be entered. In such cases, optimal

M3L4

Optimization Methods: Linear Programming- Simplex Method - II

8

solution would be determined from the tableau having all the cost coefficients as nonpositive ( ≤ 0 ) Still one difficulty remains in the minimization problem. Generally the minimization problems consist of constraints with ‘greater-than-equal-to’ ( ≥ ) sign. For example, minimize the price (to compete in the market); however, the profit should cross a minimum threshold. Whenever the goal is to minimize some objective, lower bounded requirements play the leading role. Constraints with ‘greater-than-equal-to’ ( ≥ ) sign are obvious in practical situations. To deal with the constraints with ‘greater-than-equal-to’ ( ≥ ) and = sign, Big-M method is to be followed as explained earlier.

M3L4

Optimization Methods: Linear Programming- Revised Simplex Method

1

Module – 3 Lecture Notes – 5 Revised Simplex Method, Duality and Sensitivity analysis Introduction In the previous class, the simplex method was discussed where the simplex tableau at each iteration needs to be computed entirely. However, revised simplex method is an improvement over simplex method. Revised simplex method is computationally more efficient and accurate. Duality of LP problem is a useful property that makes the problem easier in some cases and leads to dual simplex method. This is also helpful in sensitivity or post optimality analysis of decision variables. In this lecture, revised simplex method, duality of LP, dual simplex method and sensitivity or post optimality analysis will be discussed. Revised Simplex method Benefit of revised simplex method is clearly comprehended in case of large LP problems. In simplex method the entire simplex tableau is updated while a small part of it is used. The revised simplex method uses exactly the same steps as those in simplex method. The only difference occurs in the details of computing the entering variables and departing variable as explained below. Let us consider the following LP problem, with general notations, after transforming it to its standard form and incorporating all required slack, surplus and artificial variables.

(Z ) ( xi )

(x ) j

c1 x1 + c2 x2 + c3 x3 + L L L + cn xn + Z = 0 c11 x1 + c12 x2 + c13 x3 + L L L + c1n xn

= b1

c21 x1 + c22 x2 + c23 x3 + L L L + c2 n xn

= b2

M

M

M

M

M

M

( xl )

cm1 x1 + cm 2 x2 + cm3 x3 + L L L + cmn xn

= bm

As the revised simplex method is mostly beneficial for large LP problems, it will be discussed in the context of matrix notation. Matrix notation of above LP problem can be expressed as follows:

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

2

Minimize z = C T X subject to : AX = B with : X ≥ 0 ⎡ b1 ⎤ ⎡ c11 c12 ⎡ x1 ⎤ ⎡ c1 ⎤ ⎡0 ⎤ ⎢ ⎥ ⎢c ⎢x ⎥ ⎢c ⎥ ⎢ ⎥ ⎢ b2 ⎥ c 22 0⎥ 2⎥ 2⎥ ⎢ ⎢ ⎢ where X = , C= , B= ⎢ ⎥, 0 = , A = ⎢ 21 ⎢ Μ Μ ⎢ Μ⎥ ⎢ Μ⎥ ⎢ Μ⎥ ⎢ M⎥ ⎢ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ 0⎦ ⎣ ⎣c m1 c m 2 ⎣ xn ⎦ ⎣c n ⎦ ⎢⎣bm ⎥⎦

Λ Λ Ο Λ

c1n ⎤ c 2 n ⎥⎥ Μ⎥ ⎥ c mn ⎦

It can be noted for subsequent discussion that column vector corresponding to a decision ⎡ c1k ⎤ ⎢c ⎥ variable x k is ⎢ 2 k ⎥ . ⎢ Μ⎥ ⎢ ⎥ ⎣c mk ⎦

Let X S is the column vector of basic variables. Also let C S is the row vector of costs coefficients corresponding to X S and S is the basis matrix corresponding to X S . 1. Selection of entering variable

For each of the nonbasic variables, calculate the coefficient (WP − c ) , where, P is the corresponding column vector associated with the nonbasic variable at hand, c is the cost coefficient associated with that nonbasic variable and W = C S S −1 . For maximization (minimization) problem, nonbasic variable, having the lowest negative (highest positive) coefficient, as calculated above, is the entering variable. 2. Selection of departing variable

a. A new column vector U is calculated as U = S −1B . b. Corresponding to the entering variable, another vector V is calculated as V = S −1 P , where P is the column vector corresponding to entering variable. c. It may be noted that length of both U and V is same ( = m ). For i = 1, Λ , m , the ratios,

U(i ) , are calculated provided V (i ) > 0 . i = r , for which the ratio is least, is V (i )

noted. The r th basic variable of the current basis is the departing variable. If it is found that V (i ) ≤ 0 for all i , then further calculation is stopped concluding that bounded solution does not exist for the LP problem at hand.

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

3

3. Update to new basis

[

Old basis S , is updated to new basis S new , as S new = ES −1 ⎡ ⎢ ⎢ ⎢ ⎢ ⎢ where E = ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣

1

0

L

η1

L

0

0

1

L

η2

L

0

M

M

O

L

M

M

M

L

L

M

M

M

L

M

O

M

0

0

L

ηm −1

L

1

0

0

L

ηm

L

0

M

ηr

]

−1

0 ⎤ ⎥ 0 ⎥ ⎥ M⎥ ⎧ V (i ) ⎥ ⎪⎪V (r ) M ⎥ and η i = ⎨ 1 ⎥ ⎪ ⎥ M ⎩⎪V (r ) ⎥ 0 ⎥ ⎥ 1 ⎥⎦

for

i≠r

for

i=r

r th column S is replaced by S new and steps 1 through 3 are repeated. If all the coefficients calculated in

step 1, i.e., (WP − c ) is positive (negative) in case of maximization (minimization) problem, then optimum solution is reached and the optimal solution is,

X S = S −1B and z = CX S

Duality of LP problems Each LP problem (called as Primal in this context) is associated with its counterpart known as Dual LP problem. Instead of primal, solving the dual LP problem is sometimes easier when a) the dual has fewer constraints than primal (time required for solving LP problems is directly affected by the number of constraints, i.e., number of iterations necessary to converge to an optimum solution which in Simplex method usually ranges from 1.5 to 3 times the number of structural constraints in the problem) and b) the dual involves maximization of an objective function (it may be possible to avoid artificial variables that otherwise would be used in a primal minimization problem). The dual LP problem can be constructed by defining a new decision variable for each constraint in the primal problem and a new constraint for each variable in the primal. The coefficients of the j th variable in the dual’s objective function is the i th component of the primal’s requirements vector (right hand side values of the constraints in the Primal). The dual’s requirements vector consists of coefficients of decision variables in the primal objective function. Coefficients of each constraint in the dual (i.e., row vectors) are the

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

4

column vectors associated with each decision variable in the coefficients matrix of the primal problem. In other words, the coefficients matrix of the dual is the transpose of the primal’s coefficient matrix. Finally, maximizing the primal problem is equivalent to minimizing the dual and their respective values will be exactly equal. When a primal constraint is less than equal to in equality, the corresponding variable in the dual is non-negative. And equality constraint in the primal problem means that the corresponding dual variable is unrestricted in sign. Obviously, dual’s dual is primal. In summary the following relationships exists between primal and dual.

Primal

Dual

Maximization

Minimization

Minimization

Maximization

i th variable

i th constraint

j th constraint

j th variable Inequality sign of i th Constraint:

xi ≥ 0

≤ if dual is maximization ≥ if dual is minimization

i th variable unrestricted

i th constraint with = sign

j th constraint with = sign

j th variable unrestricted

RHS of j th constraint

Cost coefficient associated with j th variable in the objective function

Cost coefficient associated with

i th variable in the objective

RHS of i th constraint

function

See the pictorial representation in the next page for better understanding and quick reference:

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

5

Mark the corresponding decision variables in the dual Cost coefficients for the Objective Function

Opposite for the Dual, i.e., Minimize

Maximize Z = c1 x1 + c2 x2 + L L L + cn xn Subject to

c11 x1 + c12 x2 + L L L + c1n xn = b1 ⎯⎯ → y1 c21 x1 + c22 x2 + L L L + c2 n xn ≤ b2 ⎯⎯ → y2 M

M

Thus the Objective Function, Minimize b1 y1 + b2 y2 + L + bm ym

cm1 x1 + cm 2 x2 + L L L + cmn xn ≤ bm ⎯⎯ → ym x1 ≥ 0, x2 unrestricted, L , xn ≥ 0 Coefficients of the 1st constraint

Corresponding sign of the 1st constraint is ≤

Coefficients of the 2nd constraint

Corresponding sign of the 2nd constraint is =

M

M Determine the sign of y1

Thus, the 1st constraint, c11 y1 + c21 y2 + L + cm1 ym ≤ c1

Right hand side of the 1st constraint

Right hand side of the 2nd constraint

Thus, the 2nd constraint, c12 y1 + c22 y2 + L + cm 2 ym = c2

M

Determine the sign of y2

LL

M Determine the sign of ym

Dual Problem

Minimize Z = b1 y1 + b2 y2 + L L L + bm ym Subject to

c11 y1 + c21 y2 + L L L + cm1 ym ≤ c1 c12 y1 + c22 y2 + L L L + cm 2 ym = c2 M M c1n y1 + c2 n y2 + L L L + cmn ym ≤ cn y1 unrestricted, y2 ≥ 0, L , ym ≥ 0

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

6

It may be noted that, before finding its dual, all the constraints should be transformed to ‘lessthan-equal-to’ or ‘equal-to’ type for maximization problem and to ‘greater-than-equal-to’ or ‘equal-to’ type for minimization problem. It can be done by multiplying with −1 both sides of the constraints, so that inequality sign gets reversed. An example of finding dual problem is illustrated with the following example. Primal Z = 4 x1 + 3 x 2

Maximize

Minimize

Z ′ = 6000 y1 − 2000 y 2 + 4000 y 3

Subject to

Subject to x1 +

Dual

2 x 2 ≤ 6000 3

y1 − y 2 + y 3 = 4

x1 − x 2 ≥ 2000

2 y1 + y 2 ≤ 3 3

x1 ≤ 4000

y1 ≥ 0

x1 unrestricted

y2 ≥ 0

x2 ≥ 0

y3 ≥ 0

It may be noted that second constraint in the primal is transformed to − x1 + x2 ≤ −2000 before constructing the dual.

Primal-Dual relationships Following points are important to be noted regarding primal-dual relationship: 1. If one problem (either primal or dual) has an optimal feasible solution, other problem also has an optimal feasible solution. The optimal objective function value is same for both primal and dual. 2. If one problem has no solution (infeasible), the other problem is either infeasible or unbounded. 3. If one problem is unbounded the other problem is infeasible.

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

7

Dual Simplex Method Computationally, dual simplex method is same as simplex method. However, their approaches are different from each other. Simplex method starts with a nonoptimal but feasible solution where as dual simplex method starts with an optimal but infeasible solution. Simplex method maintains the feasibility during successive iterations where as dual simplex method maintains the optimality. Steps involved in the dual simplex method are: 1. All the constraints (except those with equality (=) sign) are modified to ‘less-thanequal-to’ ( ≤ ) sign. Constraints with greater-than-equal-to’ ( ≥ ) sign are multiplied by −1 through out so that inequality sign gets reversed. Finally, all these constraints are transformed to equality (=) sign by introducing required slack variables. 2. Modified problem, as in step one, is expressed in the form of a simplex tableau. If all the cost coefficients are positive (i.e., optimality condition is satisfied) and one or more basic variables have negative values (i.e., non-feasible solution), then dual simplex method is applicable. 3. Selection of exiting variable: The basic variable with the highest negative value is the exiting variable. If there are two candidates for exiting variable, any one is selected. The row of the selected exiting variable is marked as pivotal row. 4. Selection of entering variable: Cost coefficients, corresponding to all the negative elements of the pivotal row, are identified. Their ratios are calculated after changing ⎛ ⎞ Cost Coefficients ⎟⎟ . the sign of the elements of pivotal row, i.e., ratio = ⎜⎜ ⎝ − 1 × Elements of pivotal row ⎠

The column corresponding to minimum ratio is identified as the pivotal column and associated decision variable is the entering variable. 5. Pivotal operation: Pivotal operation is exactly same as in the case of simplex method, considering the pivotal element as the element at the intersection of pivotal row and pivotal column. 6. Check for optimality: If all the basic variables have nonnegative values then the optimum solution is reached. Otherwise, Steps 3 to 5 are repeated until the optimum is reached.

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

8

Consider the following problem:

Minimize

Z = 2 x1 + x 2

subject to

x1 ≥ 2 3 x1 + 4 x 2 ≤ 24 4 x1 + 3 x 2 ≥ 12 − x1 + 2 x 2 ≥ 1

By introducing the surplus variables, the problem is reformulated with equality constraints as follows: Minimize

Z = 2 x1 + x 2

subject to

− x1

+ x3 = −2

3 x1

+4 x 2

+ x 4 = 24

−4 x1

−3 x 2

+ x5 = −12

x1

−2 x 2

+ x6 = −1

Expressing the problem in the tableau form: Variables Iteration 1

Basis

br

Z x1

x2

x3

x4

x5

x6

Z

1

-2

-1

0

0

0

0

0

x3

0

-1

0

1

0

0

0

-2

x4

0

3

4

0

1

0

0

24

x5

0

-4

-3

0

0

1

0

-12

x6

0

1

-2

0

0

0

1

-1

0.5

1/3

--

--

0

--

Ratios Æ

Pivotal Element

Pivotal Row Pivotal Column

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

9

Tableaus for successive iterations are shown below. Pivotal Row, Pivotal Column and Pivotal Element for each tableau are marked as usual.

Iteration

2

Basis

3

4

Variables x3 x4

x5

x6

br

1

-2/3

0

0

0

-1/3

0

4

x3

0

-1

0

1

0

0

0

-2

x4

0

-7/3

0

0

1

4/3

0

8

x2

0

4/3

1

0

0

-1/3

0

4

x6

0

11/3

0

0

0

-2/3

1

7

2/3

--

--

--

--

--

x1

x2

Variables x3 x4

x5

x6

br

Basis

Z

Z

1

0

0

-2/3

0

-1/3

0

16/3

x1

0

1

0

-1

0

0

0

2

x4

0

0

0

-7/3

1

4/3

0

38/3

x2

0

0

1

4/3

0

-1/3

0

4/3

x6

0

0

0

11/3

0

-2/3

1

-1/3

--

--

--

--

0.5

--

x1

x2

Variables x3 x4

x5

x6

Ratios Æ

Iteration

x2

Z

Ratios Æ

Iteration

x1

Z

br

Basis

Z

Z

1

0

0

2.5

0

0

-0.5

5.5

x1

0

1

0

-1

0

0

0

2

x4

0

0

0

5

1

0

2

12

x2

0

0

1

-0.5

0

0

-0.5

1.5

x5

0

0

0

-5.5

0

1

-1.5

0.5

Ratios Æ

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

10

As all the br are positive, optimum solution is reached. Thus, the optimal solution is Z = 5.5

with x1 = 2 and x 2 = 1.5 .

Solution of Dual from Final Simplex Tableau of Primal Dual

Primal Maximize

Z = 4 x1 − x2 + 2 x3

subject to

2 x1 + x2 + 2 x3 ≤ 6 x1 − 4 x2 + 2 x3 ≤ 0 5 x1 − 2 x2 − 2 x3 ≤ 4 x1 , x2 , x3 ≥ 0

Minimize

Z ' = 6 y1 + 0 y 2 + 4 y3

subject to

2 y1 + y 2 + 5 y3 ≥ 4 y1 − 4 y 2 − 2 y3 ≥ −1 2 y1 + 2 y 2 − 2 y3 ≥ 2 y1 , y 2 , y3 ≥ 0

Final simplex tableau of primal:

y1 y2

Z’

y3

As illustrated above solution for the dual can be obtained corresponding to the coefficients of slack variables of respective constraints in the primal, in the Z row as, y1 = 1 , y 2 =

y3 =

1 and 3

1 and Z’=Z=22/3. 3

M3L5

Optimization Methods: Linear Programming- Revised Simplex Method

11

Sensitivity or post optimality analysis A dual variable, associated with a constraint, indicates a change in Z value (optimum) for a small change in RHS of that constraint. Thus, ∆Z = y j ∆bi

where y j is the dual variable associated with the i th constraint, ∆bi is the small change in the RHS of i th constraint, and ∆Z is the change in objective function owing to ∆bi . Let, for a LP problem, i th constraint be 2 x1 + x2 ≤ 50 and the optimum value of the objective function be 250. What if the RHS of the i th constraint changes to 55, i.e., i th constraint changes to 2 x1 + x2 ≤ 55 ? To answer this question, let, dual variable associated with the i th constraint is y j , optimum value of which is 2.5 (say). Thus, ∆bi = 55 − 50 = 5 and y j = 2.5 . So, ∆Z = y j ∆bi = 2.5 × 5 = 12.5 and revised optimum value of the objective function is

( 250 + 12.5) = 262.5 . It may be noted that ∆bi should be so chosen that it will not cause a change in the optimal basis.

M3L5

Optimization Methods: Linear Programming - Other Algorithms for Solving Linear Programming Problems

1

Module – 3 Lecture Notes – 6 Other Algorithms for Solving Linear Programming Problems Introduction So far, Simplex algorithm, Revised Simplex algorithm, Dual Simplex method are discussed. There are few other methods for solving LP problems which have an entirely different algorithmic philosophy. Among these, Khatchian’s ellipsoid method and Karmarkar’s projective scaling method are well known. In this lecture, a brief discussion about these new methods in contrast to Simplex method will be presented. However, Karmarkar’s projective scaling method will be discussed in detail. Comparative discussion between new methods and Simplex method Khatchian’s ellipsoid method and Karmarkar’s projective scaling method seek the optimum solution to an LP problem by moving through the interior of the feasible region. A schematic diagram illustrating the algorithmic differences between the Simplex and the Karmarkar’s algorithm is shown in figure 1. Khatchian’s ellipsoid method approximates the optimum solution of an LP problem by creating a sequence of ellipsoids (an ellipsoid is the multidimensional analog of an ellipse) that approach the optimal solution.

Simplex Algorithm Karmarkar’s Algorithm Optimal solution point

Feasible Region

Figure 1 Difference in optimum search path between Simplex and Karmarkar’s Algorithm

M3L6

Optimization Methods: Linear Programming - Other Algorithms for Solving Linear Programming Problems

2

Both Khatchian’s ellipsoid method and Karmarkar’s projective scaling method have been shown to be polynomial time algorithms. This means that the time required to solve an LP problem of size n by the two new methods would take at most an b where a and b are two positive numbers. On the other hand, the Simplex algorithm is an exponential time algorithm in solving LP problems. This implies that, in solving an LP problem of size n by Simplex algorithm, there exists a positive number c such that for any n the Simplex algorithm would find its solution in a time of at most c2 n . For a large enough n (with positive a , b and c ), c 2 n > an b . This means that, in theory, the polynomial time algorithms are computationally superior to exponential algorithms for large LP problems. Karmarkar’s projective scaling method Karmarkar’s projective scaling method, also known as Karmarkar’s interior point LP algorithm, starts with a trial solution and shoots it towards the optimum solution. To apply Karmarkar’s projective scaling method, LP problem should be expressed in the following form Minimize

Z = CT X

subject to :

AX = 0 1X = 1

with : X ≥ 0

⎡ c1 ⎤ ⎡ x1 ⎤ ⎡ c11 ⎢c ⎥ ⎢x ⎥ ⎢c 21 2 2 where X = ⎢ ⎥ , C = ⎢ ⎥ , 1 = [1 1 L 1] (1×n ) , A = ⎢ ⎢M⎥ ⎢M⎥ ⎢ M ⎢ ⎥ ⎢ ⎥ ⎢ ⎣c n ⎦ ⎣ xn ⎦ ⎣c m1

c12 c 22 M cm 2

L c1n ⎤ L c 2 n ⎥⎥ and n ≥ 2 . It is O M ⎥ ⎥ L c mn ⎦

⎡1 n ⎤ ⎢ ⎥ ⎢1 n ⎥ also assumed that X 0 = ⎢ ⎥ is a feasible solution and Z min = 0 . The two other variables are ⎢ M ⎥ ⎢ ⎥ ⎢⎣1 n ⎥⎦ defined as r =

1

n(n − 1)

,α=

(n − 1) . 3n

M3L6

Optimization Methods: Linear Programming - Other Algorithms for Solving Linear Programming Problems

3

Iterative steps are involved in Karmarkar’s projective scaling method to find the optimal solution. In general, k th iteration involves following computations:

[

(

a) Compute C p = I − P T PP T

)

−1

]

P CT

0 0 0 ⎤ ⎡ X k (1) ⎥ ⎢ ⎢ 0 X k (2) 0 0 ⎥ ⎛ AD k ⎞ ⎟ , C = C T D and D = ⎢ ⎥ where P = ⎜ k k ⎜ 1 ⎟ ⎢ 0 0 O 0 ⎥ ⎝ ⎠ ⎥ ⎢ ⎢⎣ 0 0 0 X k (n )⎥⎦ If C p = 0 , any feasible solution becomes an optimal solution. Further iteration is not required. Otherwise, compute the following b) Ynew = X 0 − α r c) X k +1 =

Cp Cp

,

D k Ynew DY . However, it can be shown that for k = 0 , k new = Ynew . 1D k Ynew 1Dk Ynew

Thus, X1 = Ynew . d) Z = C T X k +1 e) Repeat the steps (a) through (d) by changing k as k + 1 .

Consider the following problem:

Minimize

Z = 2 x 2 − x3

subject to :

x1 − 2 x 2 + x3 = 0 x1 + x 2 + x3 = 1 x1 , x 2 , x3 ≥ 0

⎡1 3⎤ ⎢ ⎥ ⎡0⎤ ⎢1 3⎥ ⎢ ⎥ Thus, n = 3 , C = ⎢ 2 ⎥ , A = [1 − 2 1], X 0 = ⎢ ⎥ , r = ⎢ M ⎥ ⎢ ⎥ ⎢ ⎥ ⎢⎣− 1⎥⎦ ⎢⎣1 3⎥⎦

α=

1

n(n − 1)

=

1

3(3 − 1)

=

1 6

,

(n − 1) = (3 − 1) = 2 . 3n

3× 3

9

M3L6

Optimization Methods: Linear Programming - Other Algorithms for Solving Linear Programming Problems

4

Iteration 0 (k=0): 0 ⎤ ⎡1 / 3 0 ⎢ ⎥ D0 = ⎢ 0 1/ 3 0 ⎥ ⎢ ⎥ ⎢⎣ 0 0 1 / 3⎥⎦

0 ⎤ ⎡1 / 3 0 ⎢ ⎥ C = C T D 0 = [0 2 − 1]× ⎢ 0 1 / 3 0 ⎥ = [0 2 / 3 − 1 / 3] ⎢ ⎥ ⎢⎣ 0 0 1 / 3⎥⎦ 0 ⎤ ⎡1 / 3 0 ⎢ ⎥ AD 0 = [1 − 2 1]× ⎢ 0 1 / 3 0 ⎥ = [1 / 3 − 2 / 3 1 / 3] ⎢ ⎥ ⎢⎣ 0 0 1 / 3⎥⎦ ⎛ AD 0 ⎞ ⎡1 / 3 − 2 / 3 1 / 3⎤ ⎟=⎢ P=⎜ ⎥ ⎜ 1 ⎟ ⎢ 1 ⎥⎦ 1 1 ⎠ ⎣ ⎝ ⎡ 1 / 3 1⎤ 1 / 3 − 2 / 3 1 / 3⎤ ⎢ ⎥ ⎡2 / 3 0⎤ ⎡ PP T = ⎢ ⎥ × ⎢− 2 / 3 1⎥ = ⎢ ⎥ ⎥ ⎢⎣ 0 3⎥⎦ ⎢⎣ 1 1 1 ⎥⎦ ⎢ ⎢⎣ 1 / 3 1⎥⎦

(PP )

T −1

⎡1.5 0 ⎤ =⎢ ⎥ ⎢⎣ 0 1 / 3⎥⎦

⎡0.5 0 0.5⎤ ⎢ ⎥ −1 P T PP T P = ⎢ 0 1 0 ⎥ ⎢ ⎥ ⎢⎣0.5 0 0.5⎥⎦

(

)

⎡ 1/ 6 ⎤ ⎢ ⎥ −1 C p = I − P T PP T P C T = ⎢ 0 ⎥ ⎢ ⎥ ⎢⎣− 1 / 6⎥⎦

[

(

)

]

C p = (1 / 6) 2 + 0 + (1 / 6) 2 =

2 6

M3L6

Optimization Methods: Linear Programming - Other Algorithms for Solving Linear Programming Problems

Ynew = X 0 − α r

X1 = Ynew

Cp Cp

5

⎡1 3⎤ ⎢ ⎥ 2 1 ⎡ 1 / 6 ⎤ ⎡0.2692⎤ ⎢1 3⎥ 9 × 6 ⎢ ⎥ ⎢ ⎥ =⎢ ⎥− × ⎢ 0 ⎥ = ⎢0.3333⎥ 2 ⎢ M ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎦ − 1 / 6 0 . 3974 ⎣ ⎦ ⎣ 6 ⎢⎣1 3⎥⎦

⎡0.2692⎤ ⎢ ⎥ = ⎢0.3333⎥ ⎢ ⎥ ⎢⎣0.3974⎥⎦

⎡0.2692⎤ ⎢ ⎥ Z = C T X1 = [0 2 − 1]× ⎢0.3333⎥ = 0.2692 ⎢ ⎥ ⎢⎣0.3974⎥⎦

Iteration 1 (k=1): 0 0 ⎤ ⎡0.2692 ⎢ ⎥ D1 = ⎢ 0 0.3333 0 ⎥ ⎢ ⎥ ⎢⎣ 0 0 0.3974⎥⎦ 0 0 ⎤ ⎡ 0.2692 ⎢ ⎥ C = CT D1 = [ 0 2 −1] × ⎢ 0 0.3333 0 ⎥ = [ 0 0.6667 −0.3974] ⎢ ⎥ ⎢⎣ 0 0 0.3974 ⎥⎦ 0 0 ⎤ ⎡0.2692 ⎢ 0.3333 0 ⎥⎥ = [0.2692 AD1 = [1 − 2 1]× ⎢ 0 0 0.3974⎦⎥ ⎣⎢ 0

− 0.6666 0.3974]

⎛ AD1 ⎞ ⎡ 0.2692 −0.6667 0.3974 ⎤ P=⎜ ⎟=⎢ ⎥ ⎜ 1 ⎟ ⎢ 1 1 1 ⎦⎥ ⎝ ⎠ ⎣ ⎡ 0.2692 1⎤ 0.2692 −0.6667 0.3974 ⎤ ⎢ ⎥ ⎡0.675 0 ⎤ ⎡ PP T = ⎢ ⎥ ⎥ × ⎢ −0.6667 1⎥ = ⎢ ⎥ ⎢⎣ 0 3⎦⎥ 1 1 ⎥⎦ ⎢ ⎣⎢ 1 ⎢⎣ 0.3974 1⎥⎦ 0 ⎤ ⎡1.482 T −1 PP = ⎢ ⎥ ( ) ⎢⎣ 0 0.333⎥⎦

M3L6

Optimization Methods: Linear Programming - Other Algorithms for Solving Linear Programming Problems

PT

(

6

⎡ 0.441 0.067 0.492 ⎤ ⎢ ⎥ −1 PP T P = ⎢ 0.067 0.992 −0.059⎥ ⎢ ⎥ ⎢⎣ 0.492 −0.059 0.567 ⎥⎦

)

(

C p = ⎡ I − P T PP T ⎢⎣

)

−1

⎡ 0.151 ⎤ ⎢ ⎥ P ⎤ CT = ⎢ −0.018⎥ ⎥⎦ ⎢ ⎥ ⎢⎣ −0.132 ⎥⎦

C p = (0.151) 2 + ( −0.018 ) + (−0.132) 2 = 0.2014 2

Ynew = X0 − α r

D1Ynew

Cp

0 0 ⎤ ⎡ 0.2653⎤ ⎡0.0714 ⎤ ⎡0.2692 ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ 0.3333 0 ⎥ × ⎢0.3414 ⎥ = ⎢ 0.1138⎥ =⎢ 0 ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢⎣ 0 ⎥ ⎢ ⎥ ⎢ 0 0.3974 ⎦ ⎣ 0.3928⎦ ⎣ 0.1561⎥⎦

1D1Ynew

X2 =

Cp

⎡1 3⎤ ⎢ ⎥ 2 1 ⎡ 0.151 ⎤ ⎡ 0.2653⎤ ⎢1 3⎥ 9 × 6 × ⎢⎢ −0.018 ⎥⎥ = ⎢⎢0.3414 ⎥⎥ =⎢ ⎥− ⎢ M ⎥ 0.2014 ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢⎣ −0.132 ⎥⎦ ⎢⎣ 0.3928⎥⎦ ⎢⎣1 3⎥⎦

⎡0.0714 ⎤ ⎢ ⎥ = [1 1 1] × ⎢0.1138⎥ = 0.3413 ⎢ ⎥ ⎢⎣ 0.1561⎥⎦

D1Ynew 1D1Ynew

⎡0.0714 ⎤ ⎡0.2092 ⎤ ⎢ ⎥ ⎢ ⎥ 1 = × ⎢ 0.1138⎥ = ⎢0.3334 ⎥ 0.3413 ⎢ ⎥ ⎢ ⎥ ⎢⎣ 0.1561⎥⎦ ⎢⎣0.4574 ⎥⎦

⎡ 0.2092 ⎤ ⎢ ⎥ Z = CT X 2 = [ 0 2 −1] × ⎢ 0.3334 ⎥ = 0.2094 ⎢ ⎥ ⎢⎣ 0.4574 ⎥⎦

So far, two successive iterations are shown for the above problem. Similar iterations can be followed to get the final solution upto some predefined tolerance level.

M3L6

Optimization Methods: Linear Programming - Other Algorithms for Solving Linear Programming Problems

7

It may be noted that, the efficacy of Karmarkar’s projective scaling method is more convincing for ‘large’ LP problems. Rigorous computational effort is not economical for ‘not-so-large’ problems.

References / Further Reading:

1. Rao S.S., Engineering Optimization – Theory and Practice, Third Edition, New Age International Limited, New Delhi, 2000. 2. Ravindran A., D.T. Phillips and J.J. Solberg, Operations Research – Principles and Practice, John Wiley & Sons, New York, 2001.

3. Taha H.A., Operations Research – An Introduction, Prentice-Hall of India Pvt. Ltd., New Delhi, 2005.

M3L6

Optimization Methods: Linear Programming Applications – Software

1

Module – 4 Lecture Notes – 1 Use of software for solving linear programming problems Introduction In this class, use of software to solve linear programming problem will be discussed. An MSDos based software, known as MMO, will be discussed. Apart from MMO, simplex method using optimization toolbox of MATLAB will be briefly introduced.

MMO Software This is an MS-Dos based software to solve various types of problems. In this lecture notes, only Graphical method and Simplex method for LP problem using MMO (Dennis and Dennis, 1993) will be discussed. It may be noted that MMO can also solve optimization problems related to integer programming, network flow models, PERT among others. For more details of MMO, refer to ‘INFOFILE.TXT’ in the folder.

Installation Download the “MMO.ZIP” file (in the ‘Module_4’ folder of the accompanying CD-ROM) and unzip it in a folder in the PC. Open this folder and double click on the application file named as “START”. It will open the MMO software. Opening screen can be seen as shown in Fig. 1. Press any key to see Main menu screen of MMO as shown in Fig. 2. Use arrow keys from keyboard to select different models.

Fig. 1. Opening Screen of MMO M4L1

Optimization Methods: Linear Programming Applications – Software

2

Fig. 2 Main Menu Screen of MMO

Select “Linear Programming” and press enter. Two options will appear as follows: SOLUTION METHOD: GRAPHIC/ SIMPLEX

Graphical Method using MMO Select GRAPHIC and press enter. You can choose a particular option using arrow keys from the keyboard. It may be noted that graphical method can be used only for two decision variables. After waiting for a few moments screen for “data entry method” will appear (Fig. 3).

Fig. 3 Screen for “Data Entry Method” M4L1

Optimization Methods: Linear Programming Applications – Software

3

Data entry may be done by either of two different ways. 1. Free Form Entry: You have to write the equation when prompted for input. 2. Tabular Entry: Data can be input in spreadsheet style. Only the coefficients are to be entered, not the variables. Note that all variables must appear in the objective function (even those with a 0 coefficient); if a variable name is repeated in the objective function, an error message will indicate that it is a duplicate and allow you to change the entry. Constraints can be entered in any order; variables with 0 coefficients do not have to be entered; if a constraint contains a variable not found in the objective function, an error message indicates this and allows you to make the correction; constraints may not have negative right-hand-sides (multiply by -1 to convert them before entering); when entering inequalities using < or >, it is not necessary to add the equal sign (=); non-negativity constraints are assumed and do not have to be entered. However, this information can be made available by selecting “Information Screen”. Let us take following problem Maximize

Z = 2 x1 + 3x 2

Subject to

x1 ≤ 5, x1 − 2 x 2 ≥ −5, x1 + x 2 ≤ 6 x1 , x 2 ≥ 0

Thus, the second constraint is to be multiplied by -1 while entering, i.e., − x1 + 2 x 2 ≤ 5 . In the MMO software, let us select ‘Free Form Entry’ and ‘max’ while it asks about ‘TYPE OF PROBLEM’ and press enter. After entering the problem the screen will appear as Fig. 4. Note that at the last line of the constraints you have to write ‘go’ and hit the enter key from the keyboard. Next screen will allow checking the proper entry of the problem. If any mistake is found, select ‘NO’ and correct the mistake. If everything is ok, select ‘YES’ and press the enter key. The graphics solution will be displayed on the screen. Different handling options will be shown on the right corner of the screen as follows:

M4L1

Optimization Methods: Linear Programming Applications – Software

4

F1: Redraw F2: Rescale F3: Move Objective Function Line F4: Shade Feasible Region F5: Show Feasible Points F6: Show Optimal Solution Point F10: Show Graphical LP Menu (GPL) We can easily make out the commands listed above. For example, F3 function can be used to move the objective function line. Subsequent function keys of F4 and F5 can be used to get the diagram as shown in Fig. 5.

Fig. 4 Screen after Entering the Problem.

M4L1

Optimization Methods: Linear Programming Applications – Software

5

Fig. 5 Feasible Region (highlighted in white), Feasible Points (white) and Optimal Solution Point (cyan)

The function key F10, i.e., Show Graphical LP Menu (GPL)’ will display the four different options as shown in Fig. 6.

Fig. 6 Graphical LP Menu ‘Display Graphical Solution’ will return to the graphical diagram, ‘List Solution Values’ will show the solution, which is Z = 15.67 with x1 = 2.33 and x 2 = 3.67 . ‘Show Extreme Points’ will show either ‘All’ or ‘Feasible’ extreme points as per the choice (Fig. 7)

M4L1

Optimization Methods: Linear Programming Applications – Software

6

Fig. 7 List of ‘Extreme Points’ and ‘Feasible Extreme Points’ SIMPLEX Method using MMO As we know, the graphical solution is is limited to two decision variables. However, simplex method can be used for any number of variables, which is discussed in this section. Select SIMPLEX in Linear Programming option of MMO software. As before, screen for “data entry method” will appear (Fig. 3). The data entry is exactly same as discussed before. Let us consider the earlier problem for discussion and easy comparison. However, we could have taken a problem with more than two decision variables also. Maximize

Z = 2 x1 + 3x 2

Subject to

x1 ≤ 5, x1 − 2 x 2 ≥ −5, x1 + x 2 ≤ 6 x1 , x 2 ≥ 0

Once you run the problem, it will show the list of slack, surplus and artificial variables as shown in Fig. 8. Note that there are three additional slack variables in the above problem. Press any key to continue.

Fig. 8 List of slack, surplus and artificial variables M4L1

Optimization Methods: Linear Programming Applications – Software

7

It will show three different options (Fig. 9): 1. No Tableau: Shows direct solutions 2. All Tableau: Shows all simplex tableau one by one 3. Final Tableau: Shows only the final simplex tableau directly

Fig. 9 Different Options for Simplex Solution

Final simplex tableau for the present problem is shown in Fig. 10 and the final solution is obtained as: Optimal Z = 15.667 with x1 = 2.333 and x 2 = 3.667 .

There is an additional option for ‘Sensitivity Analysis’. However, it is beyond the scope of this lecture notes.

M4L1

Optimization Methods: Linear Programming Applications – Software

8

Fig. 10 Final Simplex Tableau

MATLAB Toolbox for Linear Programming

Optimization toolbox of MATLAB (2001) is very popular and efficient. It includes different types of optimization techniques. In this lecture notes, we will briefly introduce the use of MATLAB toolbox for Simplex Algorithm. However, it is assumed that the users are aware of basics of MATLAB.

To use the simplex method, you have to set the option as 'LargeScale' to 'off' and 'Simplex' to 'on' in the following way.

options = optimset('LargeScale', 'off', 'Simplex', 'on')

Then a function called ‘linprog’ is to be used. A brief MATLAB documentation is shown in Fig. 11 for linear programming (linprog).

M4L1

Optimization Methods: Linear Programming Applications – Software

9

Fig. 11 MATLAB Documentation for Linear Programming

Further details may be referred from the toolbox. However, with this basic knowledge, simple LP problems can be solved. Let us consider the same problem as considered earlier. Maximize

Z = 2 x1 + 3 x 2

Subject to

x1 ≤ 5, x1 − 2 x 2 ≥ −5, x1 + x 2 ≤ 6 x1 , x 2 ≥ 0 M4L1

Optimization Methods: Linear Programming Applications – Software

10

Following MATLAB code will give the solution using simplex algorithm. clear all f=[-2 -3]; %Converted to minimization problem A=[1 0;-1 2;1 1]; b=[5 5 6]; lb=[0 0]; options = optimset('LargeScale', 'off', 'Simplex', 'on'); [x,fval]=linprog(f,A,b,[],[],lb); z=-fval %Multiplied by -1 x

Note that objective function should be converted to a minimization problem before entering as done in line 2 of the code. Finally, solution should be multiplied by -1 to the optimized (maximum) solution as done in last but one line. Solution will be obtained as Z = 15.667 with x1 = 2.333 and x 2 = 3.667 as in the earlier case.

References

Dennis T.L. and L.B. Dennis, Microcomputer Models for Management Decision Making, West Publishing Company, 1993. MATLAB – User’s Manual, The Math Works Inc., 2001.

M4L1

Optimization Methods: Linear Programming Applications – Transportation Problem

1

Module – 4 Lecture Notes – 2 Transportation Problem Introduction In the previous lectures, we discussed about the standard form of a LP and the commonly used methods of solving LPP. A key problem in many projects is the allocation of scarce resources among various activities. Transportation problem refers to a planning model that allocates resources, machines, materials, capital etc. in a best possible way so that the costs are minimized or profits are maximized. In this lecture, the common structure of a transportation problem (TP) and its solution using LP are discussed followed by a numerical example. Structure of the Problem The classic transportation problem is concerned with the distribution of any commodity (resource) from any group of 'sources' to any group of destinations or 'sinks'. While solving this problem using LP, the amount of resources from source to sink will be the decision variables. The criterion for selecting the optimal values of the decision variables (like minimization of costs or maximization of profits) will be the objective function. And the limitation of resource availability from sources will constitute the constraint set. Consider a general transportation problem consisting of m origins (sources) O1, O2,…, Om and n destinations (sinks) D1, D2, … , Dn. Let the amount of commodity available in ith source be ai (i=1,2,….m) and the demand in jth sink be bj (j=1,2,….n). Let the cost of transportation of unit amount of material from i to j be cij. Let the amount of commodity supplied from i to j be denoted as xij. Thus, the cost of transporting xij units of commodity from i to j is cij × xij .

Now the objective of minimizing the total cost of transportation can be given as m

Minimize

n

f = ∑∑ cij xij

(1)

i =1 j =1

M4L2

Optimization Methods: Linear Programming Applications – Transportation Problem

2

Generally, in transportation problems, the amount of commodity available in a particular source should be equal to the amount of commodity supplied from that source. Thus, the constraint can be expressed as n

∑x

ij

j =1

= ai ,

i= 1 ,2, … , m

(2)

Also, the total amount supplied to a particular sink should be equal to the corresponding demand. Hence, m

∑x i =1

ij

= b j,

j = 1 ,2, … , n

(3)

The set of constraints given by eqns (2) and (3) are consistent only if total supply and total demand are equal. m

n

∑a = ∑b i =1

i

j =1

j

(4)

But in real problems this condition may not be satisfied. Then, the problem is said to be unbalanced. However, the problem can be modified by adding a fictitious (dummy) source or destination which will provide surplus supply or demand respectively. The transportation costs from this dummy source to all destinations will be zero. Likewise, the transportation costs from all sources to a dummy destination will be zero. Thus, this restriction causes one of the constraints to be redundant. Thus the above problem have m x n decision variables and (m + n - 1) equality constraints. The non-negativity constraints can be expressed as

xij ≥ 0 , i= 1 ,2, … , m , j = 1 ,2, … , n

(5)

This problem formulation is elucidated through an example given below.

M4L2

Optimization Methods: Linear Programming Applications – Transportation Problem

3

Examples

Problem (1) Consider a transport company which has to supply 4 units of paper materials from each of the cities Faizabad and Lucknow to three cities. The material is to be supplied to Delhi, Ghaziabad and Bhopal with demands of four, one and three units respectively. Cost of transportation per unit of supply (cij) is indicated below in the figure. Decide the pattern of transportation that minimizes the cost.

Solution: Let the amount of material supplied from source i to sink j be xij. Here m =2; n = 3. Total supply = 8 units and total demand = 4+1+3 = 8 units. Since both are equal, the problem is balanced. The objective function is to minimize the total cost of transportation from all combinations i.e. m

Minimize

n

f = ∑∑ cij xij i =1 j =1

M4L2

Optimization Methods: Linear Programming Applications – Transportation Problem Minimize

f = 5 x11 + 3 x12 + 8 x13 + 4 x21 + x22 + 7 x23

4

(6)

subject to the constraints as explained below: (1) The total amount of material supplied from each source city should be equal to 4. 3

∑x j =1

ij

=4

i.e.

i= 1, 2

x11 + x12 + x13 = 4

for i = 1

(7)

x21 + x22 + x23 = 4

for i = 2

(8)

(2) The total amount of material received by each destination city should be equal to the corresponding demand. 2

∑x i =1

i.e.

ij

= b j,

j = 1 ,2, 3

x11 + x21 = 4

for j = 1

(9)

x12 + x22 = 1

for j = 2

(10)

x13 + x23 = 3

for j = 3

(11)

(3) Non – negativity constraints xij ≥ 0 i = 1, 2; j=1, 2, 3

(12)

Thus, the optimization problem has 6 decision variables and 5 constraints. Since the optimization model consists of equality constraints, Big M method is used to solve. The steps are shown below.

M4L2

Optimization Methods: Linear Programming Applications – Transportation Problem

5

Since there are five equality constraints, introduce five artificial variables R1, R2, R3, R4 and R5. Thus, the objective function and the constraints can be expressed as Minimize f = 5 × x11 + 3 × x12 + 8 × x13 + 4 × x 21 + 1 × x 22 + 7 × x 23 + M × R1 + M × R2 + M × R3 + M × R4 + M × R5

subject to x11 + x12 + x13 + R1

=4

x21 + x22 + x23 + R2

=4

x11 + x21+ R3

=4

x12+ x22 + R4

=1

x13+ x23+ R5

=3

Modifying the objective function to make the coefficients of the artificial variable equal to zero, the final form objective function is f + (−5 + 2M ) × x11 + (−3 + 2M ) × x12 + (−8 + 2M ) × x13 + (−4 + 2M ) × x21 + (−1 + 2M ) × x22 + (−7 + 2M ) × x23 − 0 × R1 + 0 × R2 + 0 × R3 + 0 × R4 + 0 × R5

The solution of the model using simplex method is shown

M4L2

Optimization Methods: Linear Programming Applications – Transportation Problem

6

Table 1

First iteration Basic variables

Variables RHS

Ratio

x11

x12

x13

x21

x22

x23

R1

R2

R3

R4

R5

Z

-5 +2M

-3 +2M

-8 +2M

-4 +2M

-1 +2M

-7 +2M

0

0

0

0

0

16M

R1

1

1

1

0

0

0

1

0

0

0

0

4

-

R2

0

0

0

1

1

1

0

1

0

0

0

4

4

1

0

0

1

0

0

0

0

1

0

0

4

-

R4

0

1

0

0

1

0

0

0

0

1

0

1

1

R5

0

0

1

0

0

1

0

0

0

0

1

3

-

RHS

Ratio

R3

Table 2

Second iteration

Basic variables

Variables x11

x12

x13

x21

x22

x23

R1

R2

R3

R4

R5

Z

-5+2M

-1

-8+2M

-4+2M

0

-7+2M

0

0

0

12M

0

1+14 M

-

R1

1

1

1

0

0

0

1

0

0

0

0

4

-

R2

0

-1

0

1

0

0

0

1

0

-1

0

3

3

R3

1

0

0

1

0

0

0

0

1

0

0

4

4

X22

0

1

0

0

1

1

0

0

0

1

0

1

-

R5

0

0

1

0

0

1

0

0

0

0

1

3

-

M4L2

Optimization Methods: Linear Programming Applications – Transportation Problem

7

Table 3

Third iteration

Basic variables

Variables x11

x12

x13

Z

-5+2M

-5+2M

-8+2M

0

R1

1

1

1

X21

0

-1

R3

1

X22 R5

x21 x22

RHS

Ratio

x23

R1

R2

R3 R4

R5

0

-7+2M

0

42M

0

-3

0

13+8M

-

0

0

0

1

0

0

0

0

4

4

0

1

0

0

0

1

0

-1

0

3

-

1

0

0

0

0

0

-1

1

1

0

1

1

0

1

0

0

1

1

0

0

0

1

0

1

-

0

0

1

0

0

1

0

0

0

0

1

3

-

Table 4

Fourth iteration Basic variables

Variables RHS

Ratio

0

18+6M

-

-1

0

3

-

0

-1

0

3

-

-1

1

1

0

1

-

0

0

0

1

0

1

1

0

0

0

0

1

3

3

x11

x12

x13

x21

x22

x23

R1

R2

R3

R4

R5

Z

0

0

-8+2M

0

0

-7+2M

0

-1

52M

22M

R1

0

0

1

0

0

0

1

1

-1

X21

0

-1

0

1

0

0

0

1

X11

1

1

0

0

0

0

0

X22

0

1

0

0

1

1

R5

0

0

1

0

0

1

Repeating the same procedure, we get the final optimal solution f = 42 and the optimum decision variable values as : x11 = 2.2430, x12 = 0.00, x13 = 1.7570, x21 = 1.7570, x22 = 1.00, x23 = 1.2430.

M4L2

Optimization Methods: Linear Programming Applications – Transportation Problem

8

Problem (2) Consider three factories (F) located in three different cities, producing a particular chemical. The chemical is to be transported to four different warehouses (Wh), from where it is supplied to the customers. The transportation cost per truck load from each factory to each warehouse is determined and are given in the table below. Production and demands are also given in the table below. Wh1

Wh2

Wh3

Wh4

Production

F1

523

682

458

850

60

F2

420

412

362

729

110

F3

670

558

895

695

150

Demand

65

85

80

70

Solution: Let the amount of chemical to be transported from factory i to warehouse j be xij. Total supply = 60+110+150 = 320 and total demand = 65+85+80+70 = 300. Since the total demand is less than total supply, add one fictitious ware house, Wh5 with a demand of 20. Thus, here m =3; n = 5 Wh1

Wh2

Wh3

Wh4

Wh5

Production

F1

523

682

458

850

0

60

F2

420

412

362

729

0

110

F3

670

558

895

695

0

150

Demand

65

85

80

70

20

The objective function is to minimize the total cost of transportation from all combinations. Minimize

f = 523 x11 + 682 x12 + 458 x13+ 850 x14 + 0 x15 + 420 x21 + 412 x22 + 362 x23 + 729 x24 + 0 x25 + 670 x31 + 558 x32 + 895 x33 +695 x34 + 0 x35

subject to the constraints

M4L2

Optimization Methods: Linear Programming Applications – Transportation Problem x11 + x12 + x13 + x14+ x15 = 60

9

for i = 1

x21 + x22 + x23 + x24+ x25 = 110

for i = 2

x31 + x32 + x33 + x34 + x35 = 150

for i = 3

x11 + x21+ x31 = 65

for j = 1

x12 + x22+ x32 = 85

for j = 2

x13 + x23 + x23 =90

for j = 3

x14 + x24 + x24 =80

for j = 4

x15 + x25 + x25 =20

for j = 5

xij ≥ 0 i = 1, 2,3; j=1, 2, 3,4

This optimization problem can be solved using the same procedure used for the previous problem.

M4L2

Optimization Methods: Linear Programming Applications – Assignment Problem

1

Module – 4 Lecture Notes – 3 Assignment Problem Introduction In the previous lecture, we discussed about one of the bench mark problems called transportation problem and its formulation. The assignment problem is a particular class of transportation linear programming problems with the supplies and demands equal to integers (often 1). Since all supplies, demands, and bounds on variables are integers, the assignment problem relies on an interesting property of transportation problems that the optimal solution will be entirely integers. In this lecture, the structure and formulation of assignment problem are discussed. Also, traveling salesman problem, which is a special type of assignment problem, is described. Structure of assignment problem As mentioned earlier, assignment problem is a special type of transportation problem in which 1. Number of supply and demand nodes are equal. 2. Supply from every supply node is one. 3. Every demand node has a demand of one. 4. Solution is required to be all integers. The goal of a general assignment problem is to find an optimal assignment of machines (laborers) to jobs without assigning an agent more than once and ensuring that all jobs are completed. The objective might be to minimize the total time to complete a set of jobs, or to maximize skill ratings, maximize the total satisfaction of the group or to minimize the cost of the assignments. This is subjected to the following requirements:

M4L3

Optimization Methods: Linear Programming Applications – Assignment Problem

2

1. Each machine is assigned not more than one job. 2. Each job is assigned to exactly one machine. Formulation of assignment problem Consider m laborers to whom n tasks are assigned. No laborer can either sit idle or do more than one task. Every pair of person and assigned work has a rating. This rating may be cost, satisfaction, penalty involved or time taken to finish the job. There will be N2 such combinations of persons and jobs assigned. Thus, the optimization problem is to find such man- job combinations that optimize the sum of ratings among all. The formulation of this problem as a special case of transportation problem can be represented by treating laborers as sources and the tasks as destinations. The supply available at each source is 1 and the demand required at each destination is 1.The cost of assigning (transporting) laborer i to task j is cij. It is necessary to first balance this problem by adding a dummy laborer or task depending on whether mn, respectively. The cost coefficient cij for this dummy will be zero.

⎧⎪0, if the j th job is not assigned to the i th machine Let xij = ⎨ ⎪⎩1, if the j th job is assigned to the i th machine Thus the above model can be expressed as m

Minimize

n

∑∑ c i =1 j =1

ij

xij

Since each task is assigned to exactly one laborer and each laborer is assigned only one job, the constraints are

M4L3

Optimization Methods: Linear Programming Applications – Assignment Problem

n

∑x i =1

ij

n

∑x j =1

ij

=1

for j = 1, 2,...n

=1

for i = 1, 2,...m

3

xij = 0 or 1 Due to the special structure of the assignment problem, the solution can be found out using a more convenient method called Hungarian method which will be illustrated through an example below. Example 1: (Taha, 1982)

Consider three jobs to be assigned to three machines. The cost for each combination is shown in the table below. Determine the minimal job – machine combinations. Table 1

Job

Machine 1

2

3

ai

1

5

7

9

1

2

14

10

12

1

3

15

13

16

1

bj

1

1

1

Solution: Step 1: Create zero elements in the cost matrix (zero assignment) by subtracting the smallest element in each row (column) from the corresponding row (column). After this exercise, the resulting cost matrix is obtained by subtracting 5 from row 1, 10 from row 2 and 13 from row 3.

M4L3

Optimization Methods: Linear Programming Applications – Assignment Problem

4

Table 2

1

2

3

1

0

2

4

2

4

0

2

3

2

0

3

Step 2: Repeating the same with columns, the final cost matrix is Table 3

1

2

3

1

0

2

2

2

4

0

0

3

2

0

3

The italicized zero elements represent a feasible solution. Thus the optimal assignment is (1,1), (2,3) and (3,2). The total cost is equal to 60 (5 +12+13). In the above example, it was possible to obtain the feasible assignment. But in more complicated problems, additional rules are required which are explained in the next example. Example 2 (Taha, 1982)

Consider four jobs to be assigned to four machines. The cost for each combination is shown in the table below. Determine the minimal job – machine combinations.

M4L3

Optimization Methods: Linear Programming Applications – Assignment Problem

5

Table 4

Job

Machine 1

2

3

4

ai

1

1

4

6

3

1

2

8

7

10

9

1

3

4

5

11

7

1

4

6

7

8

5

1

bj

1

1

1

1

Solution: Step 1: Create zero elements in the cost matrix by subtracting the smallest element in each row from the corresponding row. Table 5

1

2

3

4

1

0

3

5

2

2

1

0

3

2

3

0

1

7

3

4

1

2

3

0

Step 2: Repeating the same with columns, the final cost matrix is Table 6

1

2

3

4

1

0

3

2

2

2

1

0

0

2

3

0

1

4

3

4

1

2

0

0

M4L3

Optimization Methods: Linear Programming Applications – Assignment Problem

6

Rows 1 and 3 have only one zero element. Both of these are in column 1, which means that both jobs 1 and 3 should be assigned to machine 1. As one machine can be assigned with only one job, a feasible assignment to the zero elements is not possible as in the previous example. Step 3: Draw a minimum number of lines through some of the rows and columns so that all the zeros are crossed out. Table 7

1

2

3

4

1

0

3

2

2

2

1

0

0

2

3

0

1

4

3

4

1

2

0

0

Step 4: Select the smallest uncrossed element (which is 1 here). Subtract it from every uncrossed element and also add it to every element at the intersection of the two lines. This will give the following table. Table 8

1

2

3

4

1

0

2

1

1

2

2

0

0

2

3

0

0

3

2

4

2

2

0

0

This gives a feasible assignment (1,1), (2,3), (3,2) and (4,4) with a total cost of 1+10+5+5 = 21. If the optimal solution had not been obtained in the last step, then the procedure of drawing lines has to be repeated until a feasible solution is achieved.

M4L3

Optimization Methods: Linear Programming Applications – Assignment Problem

7

Formulation of Traveling Salesman Problem (TSP) as an Assignment Problem

A traveling salesman has to visit n cities and return to the starting point. He has to start from any one city and visit each city only once. Suppose he starts from the kth city and the last city he visited is m. Let the cost of travel from ith city to jth city be cij. Then the objective function is m

Minimize

n

∑∑ c i =1 j =1

ij

xij

subject to the constraints n

∑x i =1

ij

n

∑x j =1

ij

=1

for j = 1, 2,...n, i ≠ j , i ≠ m

=1

for i = 1, 2,...m, i ≠ j , i ≠ m

xmk = 1 xij = 0 or 1 Solution Procedure: Solve the problem as an assignment problem using the method used to solve the above examples. If the solutions thus found out are cyclic in nature, then that is the final solution. If it is not cyclic, then select the lowest entry in the table (other than zero). Delete the row and column of this lowest entry and again do the zero assignment in the remaining matrix. Check whether cyclic assignment is available. If not, include the next higher entry in the table and the procedure is repeated until a cyclic assignment is obtained. The procedure is explained through an example below.

M4L3

Optimization Methods: Linear Programming Applications – Assignment Problem

8

Example 3:

Consider a four city TSP for which the cost between the city pairs are as shown in the figure below. Find the tour of the salesman so that the cost of travel is minimal.

2 6

8

4 5

1

4

9

9 3

Table 9

1

2

3

4

1



4

9

5

2

6



4

8

3

9

4



9

4

5

8

9



Solution: Step 1: The optimal solution after using the Hungarian method is shown below. Table 10

1

2

3

4

1



0

5

0

2

2



0

3

3

5

0



4

4

0

3

4



M4L3

Optimization Methods: Linear Programming Applications – Assignment Problem

9

The optimal assignment is 1→ 4, 2→ 3, 3→ 2, 4→ 1 which is not cyclic. Step 2: Consider the lowest entry ‘2’ of the cell (2,1). If there is a tie in selecting the lowest entry, then break the tie arbitrarily. Delete the 2nd row and 1st column. Do the zero assignment in the remaining matrix. The resulting table is Table 11

1

2

3

4

1



0

4

0

2

2



0

3

3

5

0



4

4

0

0

0



Thus the next optimal assignment is 1→ 4, 2→1, 3→ 2, 4→ 3 which is cyclic. Thus the required tour is 1→ 4→3→ 2→ 1 and the total travel cost is 5 + 9 + 4 + 6 = 24.

M4L3

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems

1

Module – 4 Lecture Notes – 4 Structural & Water Resources Problems Introduction In the previous lectures, some of the bench mark problems which use LP were discussed. LP has been applied to formulate and solve several types of problems in engineering field also. LP finds many applications in the field of water resources and structural design which include many types like planning of urban water distribution, reservoir operation, crop water allocation, minimizing the cost and amount of materials in structural design. In this lecture, applications of LP in the plastic design of frame structures and also in deciding the optimal irrigation allocation and water quality management are discussed. Typical Example – Structural Design (1)

A beam column arrangement of a rigid frame is shown below. Moment in beam is

represented by Mb and moment in column is denoted by Mc. l = 8 units and h= 6 units and forces F1=2 units and F2=1 unit. Assuming that plastic moment capacity of beam and columns are linear functions of their weights; the objective function is to minimize the sum of weights of the beam and column materials.

F2=1

F1=2

3 2

4

5 6 h=6

1

7 l=8

l=8 Fig. 1

M4L4

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems

2

Solution: In the plastic limit design, it is assumed that at the points of peak moments, plastic hinges will be developed. The points of development of peak moments are numbered in the above figure from 1 through 7. The development of sufficient hinges makes the structure unstable known as a collapse mechanism. Thus, for the design to be safe the energy absorbing capacity of the frame (U) should be greater than the energy imparted by externally applied load (E) for the various collapse mechanisms of the structure. The objective function can be written as Minimize f = weight of beam + weight of column i.e. f = w ( 2lM b + 2hM c )

(1)

where w is weight per unit length over unit moment in material. Since w is constant, optimizing (1) is same as optimizing f = ( 2lM b + 2hM c )

(2)

= 16 M b + 12 M c

The four possible collapse mechanisms are shown in the figure below with the corresponding U and E values. Constraints are formulated from the design restriction U ≥ E for all the mechanisms.

(a)

(b)

M4L4

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems

(b)

3

(d) Fig. 2

Hence, the optimization problem can be stated as Minimize f = 16 M b + 12 M c

(2)

subject to Mc ≥ 3

(3)

Mb ≥ 2

(4)

2 M b + M c ≥ 10

(5)

Mb + Mc ≥ 6

(6)

Mb ≥ 0

(7)

,

Mc ≥ 0

Writing problem in standard format Minimize f = 16 M b + 12 M c

M4L4

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems subject to

4

-Mc ≤ -3 -Mb ≤ -2 -2Mb - M c ≤ -10 -Mb -Mc ≤ -6

Introducing slack variables X1, X2, X3, X4 all ≥ 0 , the system of equations can be written in canonical form as -Mc+X1

=-3

-Mb+ X2

=-2

-2Mb -Mc +X3

= - 10

-Mb -Mc +X4

=-6

16MB + 12MC – f

=0

This model can be solved using Dual Simplex algorithm which is explained below Starting Solution:

Basic

Variables

Variables

br MB

MC

X1

X2

X3

X4

f

-16

-12

0

0

0

0

0

X1

0

-1

1

0

0

0

-3

X2

-1

0

0

1

0

0

-2

X3

-2

-1

0

0

1

0

-10

X4

-1

-1

0

0

0

1

-6

Ratio

8

12

M4L4

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems

5

Iteration 1:

Basic

Variables

Variables

br

MB

MC

X1

X2

X3

X4

f

0

-4

0

0

-8

0

80

X1

0

-1

1

0

0

0

-3

X2

0

½

0

1



0

3

MB

1

½

0

0



0

5

X4

0



0

0



1

-1

Ratio

4

Iteration 2:

Basic

Variables

Variables

br

MB

MC

X1

X2

X3

X4

f

0

0

-4

0

-8

0

92

MC

0

1

-1

0

0

0

3

X2

0

0

½

1



0

3/2

MB

1

0

½

0



0

7/2

X4

0

0



0



1

1

Ratio

The optimal value of decision variables are MB =7/2; MC =3 And the total weight of the material required f = 92w units.

M4L4

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems

6

Typical Example – Water Resources (2)

Consider two crops 1 and 2. One unit of crop 1 produces four units of profit and one

unit of crop 2 brings five units of profit. The demand of production of crop 1 is A units and that of crop 2 is B units. Let x be the amount of water required for A units of crop 1 and y be the same for B units of crop 2. The amount of production and the amount of water required can be expressed as a linear relation as shown below A = 0.5(x - 2) + 2 B = 0.6(y - 3) + 3 Minimum amount of water that must be provided to 1 and 2 to meet their demand is two and three units respectively. Maximum availability of water is ten units. Find out the optimum pattern of irrigation. Solution: The objective is to maximize the profit from crop 1 and 2, which can be represented as Maximize f = 4A + 5B; Expressing as a function of the amount of water, Maximize f = 4[0.5(x - 2) + 2] + 5[0.6(y - 3) + 3]= 2x + 3y + 10 subject to

x + y ≤ 10 ; Maximum availability of water x≥2

; Minimum amount of water required for crop 1

y≥3

; Minimum amount of water required for crop 2

The above problem is same as maximizing f’ = 2x + 3y subject to same constraints.

M4L4

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems

7

Changing the problem into standard form by introducing slack variables S1, S2, S3 Maximize f’ = 2x + 3y subject to x + y + S1 =10 -x + S2 = -2 -y + S3 = -3

This model is solved by forming the simplex table as below Starting Solution:

Basic Variables

Variables RHS

Ratio

x

y

S1

S2

S3

f’

-2

-3

0

0

0

0

S1

1

1

1

0

0

10

10

S2

-1

0

0

1

0

-2

-

S3

0

-1

0

0

1

-3

3

M4L4

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems

8

Iteration 1:

Basic Variables

Variables RHS

Ratio

x

y

S1

S2

S3

f’

-2

0

0

0

-3

9

-

S1

1

0

1

0

1

7

7

S2

-1

0

0

1

0

-2

2

y

0

1

0

0

-1

3

-

RHS

Ratio

Iteration 2:

Basic Variables

Variables x

y

S1

S2

S3

f’

0

0

0

-2

-3

13

-

S1

0

0

1

1

1

5

5

x

1

0

0

-1

0

2

-

y

0

1

0

0

-1

3

-3

RHS

Ratio

Iteration 3:

Basic Variables

Variables x

y

S1

S2

S3

f’

0

0

3

1

0

28

-

S3

0

0

1

1

1

5

-

x

1

0

0

-1

0

2

-

y

0

1

1

1

0

8

-

M4L4

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems

9

Hence the solution is x = 2; y = 8; f’ = 28 Therefore, f = 28+10 = 38 Thus, water allocated to crop A is 2 units and to crop B is 8 units and total profit yielded is 38 units. Typical Example – Water Quality Management

Waste load allocation for water quality management in a river system can be defined as determination of optimal treatment level of waste, which is discharged to a river; such that the water quality standards set by Pollution Control Agency (PCA) are maintained through out the river. Conventional waste load allocation involves minimization of treatment cost subject to the constraint that the water quality standards are not violated. Consider a simple problem, where, there are M dischargers, who discharge waste into the river, and I checkpoints, where the water quality is measured by PCA. Let xj is the treatment level and aj is the unit treatment cost for jth discharger (j=1,2,…,M). ci is the dissolved oxygen (DO) concentration at checkpoint i (i=1,2,…,I), which is to be controlled. Therefore the decision variables for the waste load allocation model are xj (j=1,2,…,M). Thus, the objective function can be expressed as

Maximize

M

f = ∑ aj xj j =1

The relationship between the water quality indicator, ci (DO) at a checkpoint and the treatment level upstream to that checkpoint is linear (based on Streeter-Phelps Equation) when all other parameters involved in water quality simulations are constant. Let g(x) denotes the linear relationship between ci and xj. Then,

ci = g ( x j )

∀i, j

M4L4

Optimization Methods: Linear Programming Applications – Structural & Water Resources Problems

10

Let cP be the permissible DO level set by PCA, which is to be maintained through out the river. Therefore, ci ≥ cP

∀i

Solution of the optimization model using simplex algorithm gives the optimal fractional removal levels required to maintain the water quality of the river.

M4L4

Optimization Methods: Dynamic Programming - Introduction

1

Module – 5 Lecture Notes – 1 Introduction Introduction In some complex problems, it will be advisable to approach the problem in a sequential manner in order to find the solution quickly. The solution is found out in multi stages. This is the basic approach behind dynamic programming. It works in a “divide and conquer” manner. The word "programming" in "dynamic programming" has no particular connection to computer programming at all. A program is, instead, the plan for action that is produced. In this lecture, the multistage decision process, its representation, various types and the concept of sub-optimization and principle of optimality are discussed. Sequential optimization In sequential optimization, a problem is approached by dividing it into smaller subproblems and optimization is done for these subproblems without losing the integrity of the original problem. Sequential decision problems are those in which decisions are made in multiple stages. These are also called multistage decision problems since decisions are made at a number of stages. In multistage decision problems, an N variable problem is represented by N single variable problems. These problems are solved successively such that the optimal value of the original problem can be obtained from the optimal solutions of these N single variable problems. The N single variable problems are connected in series so that the output of one stage will be the input to the succeeding stage. This type of problem is called serial multistage decision process. For example, consider a water allocation problem to N users. The objective function is to maximize the total net benefit from all users. This problem can be solved by considering each user separately and optimizing the individual net benefits, subject to constraints and then adding up the benefits from all users to get the total optimal benefit.

M5L1

Optimization Methods: Dynamic Programming - Introduction

2

Representation of multistage decision process Consider a single stage decision process as shown in the figure below. Net Benefits, NB1

Input S1

Output S2

Stage 1

Decision variable, X1 Fig 1. Let S1 be the input state variable, S2 be the output state variable, X1 be the decision variable and NB1 be the net benefits. The input and output are related by a transformation function expressed as, S2 = g(X1, S1) Also since the net benefits are influenced by the decision variables and also the input variable, the benefit function can be expressed as NB1 = h(X1, S1) Now, consider a serial multistage decision process consisting of T stages as shown in the figure below.

NB1 S1

Stage 1

X1

NBt S2

St

Stage t

Xt

NBT St+1

ST

Stage T

ST+1

XT

Fig 2.

M5L1

Optimization Methods: Dynamic Programming - Introduction

3

Here, for the tth stage the, state transformation and the benefit functions are written as, St+1 = g(Xt, St) NBt = h(Xt, St) The objective of this multistage problem is to find the optimum values of all decision variables X1, X2,…, XT such that the individual net benefits of each stage that is expressed by some objective function, f(NBt) and the total net benefit which is expressed by f(NB1, NB2,…, NBT) should be maximized. The application of dynamic programming to a multistage problem depends on the nature of this objective function i.e., the objective function should be separable and monotonic. An objective function is separable, if it can be decomposed and expressed as a sum or product of individual net benefits of each stage, i.e., T

T

t =1

t =1

either f = ∑ NBt = ∑ h( X t , S t )

or

T

T

t =1

t =1

f = ∏ NBt = ∏ h( X t , S t )

An objective function is monotonic if for all values of a and b for which the value of the benefit function is h(xt = a, St ) ≥ h( xt = b, St ) , then f (x1 , x2, ..., xt = a,..., xT , S t +1 ) ≥ f (x1 , x2, ..., xt = b,..., xT , S t +1 )

should be satisfied.

M5L1

Optimization Methods: Dynamic Programming - Introduction

4

Types of multistage decision problems A serial multistage problem such as shown, can be classified into three categories as initial value problem, final value problem and boundary value problem. 1. Initial value problem: In this type, the value of the initial state variable, S1 is given. 2. Final value problem: In this, the value of the final state variable, ST is given. A final value problem can be transformed into an initial value problem by reversing the procedure of computation of the state variable, St. 3. Boundary value problem: In this, the values of both the initial and final state variables, S1 and ST are given. Concept of sub-optimization and principle of optimality Bellman (1957) stated the principle of optimality which explains the process of suboptimality as: “An optimal policy (or a set of decisions) has the property that whatever the initial state and initial decision are, the remaining decisions must constitute an optimal policy with regard to the state resulting from the first decision.” Consider the objective function consisting of T decision variables x1, x2, …, xT, T

T

t =1

t =1

f = ∑ NBt = ∑ h( X t , S t )

and satisfying the equations, St+1 = g(Xt, St) NBt = h(Xt, St)

for t = 1,2,…,T

The concepts of suboptimization and principle of optimality are used to solve this problem through dynamic programming. To explain these concepts, consider the design of a water tank in which the cost of construction is to be minimized. The capacity of the tank to be designed is given as K.

M5L1

Optimization Methods: Dynamic Programming - Introduction

5

The main components of a water tank include (i) tank (ii) columns to support the tank and (iii) the foundation. While optimizing this problem to minimize the cost, it would be advisable to break this system into individual parts and optimizing each part separately instead of considering the system as a whole together. However, while breaking and doing suboptimization, a logical procedure should be used; otherwise this approach can lead to a poor solution. For example, consider the suboptimization of columns without considering the other two components. In order to reduce the construction cost of columns, one may use heavy concrete columns with less reinforcement, since the cost of steel is high. But while considering the suboptimization of foundation component, the cost becomes higher as the foundation should be strong enough to carry these heavy columns. Thus, the suboptimization of columns before considering the suboptimization of foundation will adversely affect the overall design. In most of the serial systems as discussed above, since the suboptimization of last component does not influence the other components, it can be suboptimized independently. For the above problem, foundation can thus be suboptimized independently. Then the last two components (columns and foundation) are considered as a single component and suboptimization is done without affecting other components. This process can be repeated for any number of end components. The process of suboptimization for the above problem is shown in the next page.

M5L1

Optimization Methods: Dynamic Programming - Introduction

Tank

Columns

6

Foundation

Original System

Tank

Columns

Foundation

Suboptimize design of Foundation component Tank

Columns

Foundation

Suboptimize design of Foundation & Columns together

Tank

Columns

Foundation

Optimize complete system

Fig 3.

M5L1

Optimization Methods: Dynamic Programming – Recursive Equations

1

Module – 5 Lecture Notes – 2 Recursive Equations Introduction In the previous lecture, we have seen how to represent a multistage decision process and also the concept of suboptimization. In order to solve this problem in sequence, we make use of recursive equations. These equations are fundamental to the dynamic programming. In this lecture, we will learn how to formulate recursive equations for a multistage decision process in a backward manner and also in a forward manner. Recursive equations Recursive equations are used to structure a multistage decision problem as a sequential process. Each recursive equation represents a stage at which a decision is required. In this, a series of equations are successively solved, each equation depending on the output values of the previous equations. Thus, through recursion, a multistage problem is solved by breaking it into a number of single stage problems. A multistage problem can be approached in a backward manner or in a forward manner. Backward recursion In this, the problem is solved by writing equations first for the final stage and then proceeding backwards to the first stages. Consider the serial multistage problem discussed in the previous lecture.

NB1 S1

Stage 1

X1

NBt S2

St

Stage t

Xt

NBT St+1

ST

Stage T

ST+1

XT

M5L2

Optimization Methods: Dynamic Programming – Recursive Equations

2

Suppose the objective function for this problem is T

T

t =1

t =1

f = ∑ NBt = ∑ ht ( X t , S t ) = h1 ( X 1 , S1 ) + h2 ( X 2 , S 2 ) + ... + ht ( X t , S t ) + ... + hT −1 ( X T −1 , S T −1 ) + hT ( X T , S T )

...(1)

and the relation between the stage variables and decision variables are gives as St+1 = g(Xt, St),

t = 1,2,…, T.

…(2)

Consider the final stage as the first subproblem. The input variable to this stage is ST. According to the principle of optimality, no matter what happens in other stages, the decision variable XT should be selected such that hT ( X T , ST ) is optimum for the input ST. Let the optimum value be denoted as fT∗ . Then, f T∗ ( S T ) = opt [hT ( X T , S T )]

...(3)

XT

Next, group the last two stages together as the second subproblem. Let fT∗−1 be the optimum objective value of this subproblem. Then, we have

f T∗−1 ( S T −1 ) = opt [hT −1 ( X T −1 , S T −1 ) + hT ( X T , S T )]

...( 4)

X T −1 , X T

From the principle of optimality, the value of X T should be to optimize hT for a given ST . For obtaining ST , we need ST −1 and X T −1 . Thus, fT∗−1 ( ST −1 ) can be written as,

[

f T∗−1 ( S T −1 ) = opt hT −1 ( X T −1 , S T −1 ) + f T∗ ( S T )

]

...(5)

X T −1

By using the stage transformation equation, fT∗−1 ( ST −1 ) can be rewritten as,

[

]

f T∗−1 ( S T −1 ) = opt hT −1 ( X T −1 , S T −1 ) + f T∗ ( g T −1 ( X T −1 , S T −1 ))

...(6)

X T −1

M5L2

Optimization Methods: Dynamic Programming – Recursive Equations

3

Thus, here the optimum is determined by choosing the decision variable X T −1 for a given input ST −1 . Eqn (4) which is a multivariate problem (second sub problem) is divided into two single variable problems as shown in eqns (3) and (6). In general, the i+1th subproblem (T-ith stage) can be expressed as, f T∗−i ( S T −i ) =

opt

[hT −i ( X T −i , ST −i ) + ... + hT −1 ( X T −1 , ST −1 ) + hT ( X T , ST )]

...(7)

X T − i ,..., X T −1 , X T

Converting this to a single variable problem,

[

]

f T∗−i ( S T −i ) = opt hT −i ( X T −i , S T −i ) + f T∗−(i −1) ( g T −i ( X T −i , S T −i ))

...(8)

X T −i

where fT∗−(i −1) denotes the optimal value of the objective function for the last i stages. Thus for backward recursion, the principle of optimality can be stated as, no matter in what state of stage one may be, in order for a policy to be optimal, one must proceed from that state and stage in an optimal manner. Forward recursion In this approach, the problem is solved by starting from the stage 1 and proceeding towards the last stage. Consider the serial multistage problem with the objective function as given below T

T

t =1

t =1

f = ∑ NBt = ∑ ht ( X t , S t ) = h1 ( X 1 , S1 ) + h2 ( X 2 , S 2 ) + ... + ht ( X t , S t ) + ... + hT −1 ( X T −1 , S T −1 ) + hT ( X T , S T )

...(9)

and the relation between the stage variables and decision variables are gives as St = g ′( X t +1 , St +1 )

t = 1,2,...., T

…(10)

where St is the input available to the stages 1 to t. Consider stage 1 as the first subproblem. The input variable to this stage is S1. The decision variable X1 should be selected such that h1 ( X 1 , S1 ) is optimum for the input S1.

M5L2

Optimization Methods: Dynamic Programming – Recursive Equations

4

The optimum value f1∗ can be written as f1∗ ( S1 ) = opt [h1 ( X 1 , S1 )]

...(11)

X1

Now, group the first and second stages together as the second subproblem. The objective function f 2∗ for this subproblem can be expressed as, f 2∗ ( S 2 ) = opt [h2 ( X 2 , S 2 ) + h1 ( X 1 , S1 )]

...(12)

X 2 , X1

But for calculating the value of S 2 , we need S1 and X 1 . Thus,

[

f 2∗ ( S 2 ) = opt h2 ( X 2 , S 2 ) + f1∗ ( S1 )

]

...(13)

X2

By using the stage transformation equation, f 2∗ ( S 2 ) can be rewritten as,

[

]

f 2∗ ( S 2 ) = opt h2 ( X 2 , S 2 ) + f1∗ ( g 2′ ( X 2 , S 2 ))

...(14)

X2

Thus, here through the principle of optimality the dimensionality of the problem is reduced from two to one. In general, the ith subproblem can be expressed as, f i ∗ ( Si ) =

opt

[hi ( X i , Si ) + ... + h2 ( X 2 , S 2 ) + h1 ( X 1 , S1 )]

…(15)

X 1 , X 2 ,..., X i

Converting this to a single variable problem,

[

]

f i ∗ ( S i ) = opt hi ( X i , Si ) + f (∗i −1) ( g i′( X i , Si ))

…(16)

Xi

where f i ∗ denotes the optimal value of the objective function for the first i stages. The principle of optimality for forward recursion is that no matter in what state of stage one may be, in order for a policy to be optimal, one had to get to that state and stage in an optimal manner.

M5L2

Optimization Methods: Dynamic Programming – Computational Procedure

1

Module – 5 Lecture Notes – 3 Computational Procedure in Dynamic Programming Introduction The construction of recursive equations for a multistage program was discussed in the previous lecture. In this lecture, the procedure to solve those recursive equations for backward recursion is discussed. The procedure for forward recursion is similar to that of backward recursion. Computational procedure Consider the serial multistage problem and the recursive equations developed for backward recursion discussed in the previous lecture. The objective function for this problem is T

T

t =1

t =1

f = ∑ NBt = ∑ ht ( X t , S t ) = h1 ( X 1 , S1 ) + h2 ( X 2 , S 2 ) + ... + ht ( X t , S t ) + ... + hT −1 ( X T −1 , S T −1 ) + hT ( X T , S T )

...(1)

Considering first subproblem i.e., the last stage, the objective function is f T∗ ( S T ) = opt [hT ( X T , S T )]

...(2)

XT

NBT ST

Stage T

ST+1

XT The input variable to this stage is ST. The decision variable XT and the optimal value of the objective function fT∗ depend on the input ST. At this stage, the value of ST is not known. ST can take a range of values depending upon the value taken by the upstream components. To

M5L3

Optimization Methods: Dynamic Programming – Computational Procedure

2

get a clear picture of the suboptimization at this stage, ST is solved for all possible range of values and the results are entered in a graph or table. This table also contains the calculated optimal values of X T∗ , ST+1 and also fT∗ . A typical table showing the results from the suboptimization of stage 1 is shown below. Table 1 Sl no

ST

X T∗

fT∗

ST+1

1

-

-

-

-

-

-

-

-

-

-

-

-

-

-

Now, consider the second subproblem by grouping the last two components. NBT-1 ST-1 Stage T-1

XT-1 The objective function can be written as

NBT ST

ST+1

Stage T

XT

f T∗−1 ( S T −1 ) = opt [hT −1 ( X T −1 , S T −1 ) + hT ( X T , S T )]

...(4)

X T −1 , X T

As shown in the earlier lecture, fT∗−1 ( ST −1 ) can also be written as,

[

f T∗−1 ( S T −1 ) = opt hT −1 ( X T −1 , S T −1 ) + f T∗ ( S T )

]

...(5)

X T −1

Here also, a range of values are considered for ST −1 . All the information of first subproblem can be obtained from Table 1. Thus, the optimal values of X T∗ −1 and fT∗−1 are found for these range of values. The results thus calculated can be shown in Table 2.

M5L3

Optimization Methods: Dynamic Programming – Computational Procedure

3

Table 2 Sl no

ST-1

X T∗ −1

ST

f T∗ ( S T )

1

-

-

-

-

-

-

-

-

-

-

-

-

-

-

fT∗−1

In general, if suboptimization of i+1th subproblem (T-ith stage) is to be done, then the objective function can be written as

f T∗−i ( S T −i ) =

opt

[hT −i ( X T −i , ST −i ) + ... + hT −1 ( X T −1 , S T −1 ) + hT ( X T , ST )]

X T − i ,..., X T −1 , X T

[

= opt hT −i ( X T −i , S T −i ) + f T∗−(i −1)

]

...(7)

X T −i

At this stage, the suboptimizaiton has been carried out for all last i components. The information regarding the optimal values of ith subproblem will be available in the form of a table. Substituting this information in the objective function and considering a range of ST −i values, the optimal values of f T∗−i and X T∗ −i can be calculated. The table showing the suboptimization of i+1th subproblem can be shown below. Table 3 Sl no

ST-i

X T∗ −i

ST-(i-1)

f T∗−(i −1) ( S T −(i −1) )

1

-

-

-

-

-

-

-

-

-

-

-

-

-

-

f T∗−i

M5L3

Optimization Methods: Dynamic Programming – Computational Procedure

4

This procedure is repeated until stage 1 is reached, i.e., Tth subproblem.

NB1 S1

Stage 1

X1

NBt S2

St

Stage t

NBT St+1

Xt

ST

Stage T

ST+1

XT

Here, for initial value problems, only one value S1 need to be analyzed. After completing the suboptimization of all the stages, we need to retrace the steps through the tables generated to find the optimal values of X. In order to do this, the Tth subproblem gives the values of X 1∗ and f1∗ for a given value of S1 (since the value of S1 is known for an initial value problem). Use the transformation equation S2 = g(X1, S1), to calculate the value of S 2∗ , which is the input to the 2nd stage ( T-1th subproblem). Then, from the tabulated results for the 2nd stage, the values of X 2∗ and f 2∗ are found out for the calculated value of S 2∗ . Again use the transformation equation to find out S 3∗ and the process is repeated until the 1st subproblem or Tth stage is reached. Finally, the optimum solution vector is given by X 1∗ , X 2∗ , ...., X T∗ .

M5L3

Optimization Methods: Dynamic Programming – Other Topics

1

Module – 5 Lecture Notes – 4 Other Topics Introduction In the previous lectures we discussed about problems with a single state variable or input variable St which takes only some range of values. In this lecture, we will be discussing about problems with state variable taking continuous values and also problems with multiple state variables. Discrete versus Continuous Dynamic Programming In a dynamic programming problem, when the number of stages tends to infinity then it is called a continuous dynamic programming problem. It is also called an infinite-stage problem. Continuous dynamic programming model is used to solve continuous decision problems. The classical method of solving continuous decision problems is by the calculus of variations. However, the analytical solutions, using calculus of variations, cannot be generally obtained, except for very simple problems. The infinite-stage dynamic programming approach, on the other hand provides a very efficient numerical approximation procedure for solving continuous decision problems. The objective function of a conventional discrete dynamic programming model is the sum of individual stage outputs. If the number of stages tends to infinity, then summation of the outputs from individual stages can be replaced by integrals. Such models are useful when infinite number of decisions have to be made in finite time interval. Multiple State Variables In the problems previously discussed, there was only one state variable St. However there will be problems in which one need to handle more than one state variable. For example, consider a water allocation problem to n irrigated crops. Let Si be the units of water available to the remaining n-i crops. If we are concerned only about the allocation of water, then this problem can be solved as a single state problem, with Si as the state variable. Now, assume that L units of land are available for all these n crops. We want to allocate the land also to each crop after

M5L4

Optimization Methods: Dynamic Programming – Other Topics

2

considering the units of water required for each unit of irrigated land containing each crop. Let Ri be the amount of land available for n-i crops. Here, an additional state variable Ri is to be included while suboptimizing different stages. Thus, in this problem two allocations need to be made: water and land. The figure below shows a single stage problem consisting of two state variables, S1 & R1.

Net Benefit, NB1

Input

Output Stage 1

S1 & R1

S2 & R2

Decision variable, X1

In general, for a multistage decision problem of T stages containing two state variables St and Rt , the objective function can be written as T

T

t =1

t =1

f = ∑ NBt = ∑ h( X t , S t , Rt )

where the transformation equations are given as

&

St+1 = g(Xt, St)

for t =1,2,…, T

Rt+1 = g’(Xt, Rt)

for t =1,2,…, T

Curse of Dimensionality Dynamic programming has a serious limitation due to dimensionality restriction. As the number of variables and stages increase, the number of calculations needed increases rapidly thereby increasing the computational effort. If the number of stage variables is increased, then more combinations of discrete states should be examined at each stage. For a problem

M5L4

Optimization Methods: Dynamic Programming – Other Topics

3

consisting of 100 state variables and each variable having 100 discrete values, the suboptimization table will contain 100100 entries. The computation of this one table may take 10096 seconds (about 10092 years) even on a high speed computer. Like this 100 tables have to be prepared, which explains the difficulty in analyzing such a big problem using dynamic programming. This phenomenon is known as “curse of dimensionality” or “Problem of dimensionality” of multiple state variable dynamic programming problems as termed by Bellman. References/ Further Reading: 1. Bellman, R., Dynamic Programming, Princeton University Press, Princeton, N.J, 1957. 2. Hillier F.S. and G.J. Lieberman, Operations Research, CBS Publishers & Distributors, New Delhi, 1987. 3. Loucks, D.P., J.R. Stedinger, and D.A. Haith, Water Resources Systems Planning and Analysis, Prentice-Hall, N.J., 1981. 4. Rao S.S., Engineering Optimization – Theory and Practice, Third Edition, New Age International Limited, New Delhi, 2000 5. Taha H.A., Operations Research – An Introduction, Prentice-Hall of India Pvt. Ltd., New Delhi, 2005. 6. Vedula S., and P.P. Mujumdar, Water Resources Systems: Modelling Techniques and Analysis, Tata McGraw Hill, New Delhi, 2005.

M5L4

Optimization Methods: Dynamic Programming Applications – Design of Continuous Beam

1

Module – 6 Lecture Notes – 1 Design of Continuous Beam Introduction In the previous lectures, the development of recursive equations and computational procedure were discussed. The application of this theory in practical situations is discussed here. In this lecture, the design of continuous beam and its formulation to apply dynamic programming is discussed. Design of continuous beam Consider a continuous beam having n spans with a set of loadings W1, W2,…, Wn at the center of each span as shown in the figure.

W1 0

W2 1

L1

Wi 2

L2

i-1

Wi+1 i

Li

Wn i+1

n-1

Li+1

n Ln

The beam rests on n+1 rigid supports. The locations of the supports are assumed to be known. The objective function of the problem is to minimize the sum of the cost of construction of all spans. It is assumed that simple plastic theory of beams is applicable. Let the reactant support moments be represented as m1, m2, …, mn. Once these support moments are known, the complete bending moment distribution can be determined. The plastic limit moment for each span and also the cross section of the span can be designed using these support moments. The bending moment at the center of the ith span is -WiLi/4. Therefore, the largest bending moment in the ith span can be computed as

M6L1

Optimization Methods: Dynamic Programming Applications – Design of Continuous Beam

⎧ m + mi Wi Li ⎫ − M i = max ⎨ mi −1 , mi , i −1 ⎬ 2 4 ⎭ ⎩

2

for i = 1, 2,...n

For a beam of uniform cross section in each span, the limit moment m_limi for the ith span should be greater than or equal to Mi. The cross section of the beam should be selected in such a way that it has the required limit moment. Since the cost of the beam depends on the cross section, which in turn depends on the limit moment, cost of the beam can be expressed as a function of the limit moments. n

If

∑C (X ) i =1

i

represents the sum of the cost of construction of all spans of the beam where X

represents the vector of limit moments

⎧m _ lim1 ⎫ ⎪m _ lim ⎪ ⎪ 2⎪ X =⎨ ⎬ ⎪M ⎪ ⎪⎩m _ lim n ⎪⎭ n

then, the optimization problem is to find X so that

∑C (X ) i =1

the constraints m _ lim i ≥ M i

i

is minimized while satisfying

for i = 1, 2, ..., n .

This problem has a serial structure and can be solved using dynamic programming.

M6L1

Optimization Methods: Dynamic Programming Applications – Optimum Geometric Layout of Truss

1

Module – 6 Lecture Notes – 2 Optimum Geometric Layout of Truss Introduction In this lecture, the optimal design of elastic trusses is discussed from a dynamic programming point of view. Emphasis is given on minimizing the cost of statically determinate trusses when the cross-sectional areas of the bars are available. Optimum geometric layout of truss Consider a planar, pin jointed cantilever multi bayed truss. Assume the length of the bays to be unity. The truss is symmetric to the x axis. The geometry or layout of the truss is defined by the y coordinates (y1, y2, …, yn). The truss is subjected to a unit load W1. The details are shown in the figure below.

y3

h3

y4

h2 y2 h1 y1

x

W1=1

1

1

1

Consider a particular bay i. Assume the truss is statically determinate. Thus, the forces in the bars of bay i depend only on the coordinates yi-1 and yi and not on any other coordinates. The

M6L2

Optimization Methods: Dynamic Programming Applications – Optimum Geometric Layout of Truss

2

cross sectional area of a bar can be determined, once the length and force in it are known. Thus, the cost of the bar can in turn be determined. The optimization problem is to find the geometry of the truss which will minimize the total cost from all the bars. For the three bay truss shown above, the relation between y coordinates can be expressed as yi+1 = yi + di

for i = 1,2,3

This is an initial value problem since the value y1 is already known. Let the y coordinate of each node is limited to a finite number of values say 0.25, 0.5, 0.75 and 1. Then, as shown in the figure below, there will be 64 different possible ways to reach y4 from y1.

1.00

0.75

0.50

0.25

y1

y2

y3

y4

This can be represented as a serial multistage initial value decision problem and can be solved using dynamic programming.

M6L2

Optimization Methods: Dynamic Programming Applications – Water Allocation

1

Module – 6 Lecture Notes – 3 Water Allocation as a Sequential Process – Recursive Equations Introduction As discussed in previous lecture notes, in dynamic programming, a problem is handled as a sequential process or a multistage decision making process. In this lecture, we will explain how a water allocation problem can be represented as sequential process and can be solved using backward recursion method of dynamic programming. Water allocation problem Consider a canal supplying water to three fields in which three different crops are being cultivated. The maximum capacity of the canal is given as Q units of water. The three fields can be denoted as i=1,2,3 and the amount of water allocated to each field as xi.

Field 3 x3

x1 Field 1

x2 Field 2

The net benefits from producing the crops in each field are given by the functions below. NB1 ( x1 ) = 5 x1 − 0.5 x1

2

NB2 ( x2 ) = 8 x2 − 1.5 x2 NB3 ( x3 ) = 7 x3 − x3

2

2

M6L3

Optimization Methods: Dynamic Programming Applications – Water Allocation

2

The problem is to determine the optimal allocations xi to each field that maximizes the total net benefits from all the three crops. This type of problem is readily solvable using dynamic programming. The first step in the dynamic programming is to structure this problem as a sequential allocation process or a multistage decision making procedure. The allocation to each crop is considered as a decision stage in a sequence of decisions. If the amount of water allocated from the total available water Q, to crop i is xi, then the net benefit from this allocation is NBi(xi). Let the state variable Si defines the amount of water available to the remaining (3-i) crops. The state transformation equation can be written as Si +1 = Si − xi defines the state in the next stage. The figure below shows the allocation problem as a sequential process.

Available Quantity, S1 = Q

S3 = S2- x2

S2 = S1- x1

x1

Crop 1

Net Benefits, NB1 (x1)

x2

Crop 2

Net Benefits, NB2 (x2)

Remaining Quantity, S4 = S3- x3

x3

Crop 3

Net Benefits, NB3 (x3)

The objective function for this allocation problem is defined to maximize the net benefits, 3

i.e., max ∑ NBi ( xi ) . The constraints can be written as i =1

x1 + x2 + x3 ≤ Q 0 ≤ xi ≤ Q

for i = 1,2,3

M6L3

Optimization Methods: Dynamic Programming Applications – Water Allocation

3

Let f1 (Q) be the maximum net benefits that can be obtained from allocating water to crops 1,2 and 3. Thus,

f1 (Q ) =

⎡ 3 ⎤ max ⎢ ∑ NB i ( xi ) ⎥ x1 + x 2 + x 3 ≤ Q ⎦ x1 , x 2 , x 3 ≥ 0 ⎣ i =1

Transforming this into three problems each having only one decision variable,

⎡ ⎫⎪⎤ ⎧⎪ f1 (Q) = max ⎢ NB1 ( x1 ) + max ⎨ NB2 ( x2 ) + max NB3 ( x3 )⎬⎥ x1 ⎢ x2 x3 ⎪⎭⎥⎦ 0≤ x1 ≤Q ⎣ 0≤ x2 ≤Q − x1 = S 2 ⎪ 0 ≤ x3 ≤ S 2 − x 2 = S 3 ⎩

Backward recursive equations

Considering the last term of this equation, let f 3 ( S3 ) be the maximum net benefits from crop 3. The state variable for this stage is S 3 which can vary from 0 to Q. Therefore, f 3 ( S 3 ) = max NB3 ( x3 ) x3 0≤ x3 ≤ S 3

Since S 3 = S 2 − x2 , f 3 ( S3 ) = f 3 ( S 2 − x2 ) . Thus f1 (Q) can be rewritten as ⎤ ⎡ f1 (Q) = max ⎢ NB1 ( x1 ) + max {NB2 ( x2 ) + f 3 ( S 2 − x2 )}⎥ x1 x2 ⎥⎦ 0≤ x1 ≤Q ⎢ 0 ≤ x2 ≤Q − x1 = S 2 ⎣

Now, let f 2 ( S 2 ) be the maximum benefits derived from crops 2 and 3 for a given quantity S 2 which can vary between 0 and Q. Therefore f 2 ( S 2 ) can be written as, f 2 (S2 ) =

max

x2 0≤ x2 ≤ Q − x1 = S 2

{NB2 ( x2 ) + f 3 ( S 2 − x2 )}

Again, since S 2 = Q − x1 , f1 (Q) which is the maximum total net benefit from the allocation to the crops 1, 2 and 3, can be rewritten as

M6L3

Optimization Methods: Dynamic Programming Applications – Water Allocation

4

f1 (Q) = max [NB1 ( x1 ) + f 2 (Q − x1 )] x1 0≤ x1 ≤Q

Now, once the value of f 3 ( S3 ) is calculated, the value of f 2 ( S 2 ) can be determined, from which f1 (Q) can be determined. Forward recursive equations

The procedure explained above can also be solved using a forward proceeding manner. Let the function f i ( Si ) be the total net benefit from crops 1 to i for a given input of Si which is allocated to those crops. Considering the first stage alone, f1 ( S1 ) = max NB1 ( x1 ) x1 x1 ≤ S1

Since, the value of S1 is not known (excepting that S1 should not exceed Q), the equation above has to be solved for a range of values from 0 to Q. Now, considering the first two crops together, with S 2 units of water available to these crops, f 2 ( S 2 ) can be written as, f 2 ( S 2 ) = max[NB2 ( x2 ) + f1 ( S 2 − x2 )] x2 x2 ≤ S 2

This equation also should be solved for a range of values for S 2 from 0 to Q. Finally, considering the whole system i.e., crops 1, 2 and 3, f 3 ( S3 ) can be expressed as, f 3 ( S 3 ) = max [NB3 ( x3 ) + f 2 ( S 3 − x3 )] x3 x3 ≤ S 3 = Q

Here, if it is given that the whole Q units of water should be allocated, then the value of S 3 can be taken as equal to Q. Otherwise, f 3 ( S3 ) should be solved for a range of values from 0 to Q.

M6L3

Optimization Methods: Dynamic Programming Applications – Water Allocation

5

The basic equations for the water allocation problem using both the approaches are discussed. A numerical problem and its solution will be described in the next lecture.

M6L3

Optimization Methods: Dynamic Programming Applications – Water Allocation

1

Module - 6 Lecture Notes – 4 Water Allocation as a Sequential Process – Numerical Example Introduction In the previous lecture, recursive equations for a basic water allocation problem were developed for both backward recursion and forward recursion. This lecture will further explain the water allocation problem by a numerical example. Numerical problem and solution Consider the example previously discussed with the maximum capacity of the canal as 4 units. The net benefits from producing the crops for each field are given by the functions below. NB1 ( x1 ) = 5 x1 − 0.5 x1

2

NB2 ( x2 ) = 8 x2 − 1.5 x2 NB3 ( x3 ) = 7 x3 − x3

2

2

The possible net benefits from each crop are calculated according to the functions given and are given below. Table 1 xi

NB1 ( x1 )

NB2 ( x2 )

NB3 ( x3 )

0

0.0

0.0

0.0

1

4.5

6.5

6.0

2

8.0

10.0

10.0

3

10.5

10.5

12.0

4

12.0

8.0

12.0

The problem can be represented as a set of nodes and links as shown in the figure below. The nodes represent the state variables and the links represent the decision variables.

M6L4

Optimization Methods: Dynamic Programming Applications – Water Allocation

x1

x2 0

4

x3 0

4 1

0

2

3

2

4 1

2

3

3

1 2

4

2

2

2

1

1

1

3 4

1 0

0 Crop 1

1 0

Crop 2

0

0

Crop 3

The values inside the nodes show the value of possible state variables at each stage. Number of nodes for any stage corresponds to the number of discrete states possible for each stage. The values over the links show the different values taken by decision variables corresponding to the value taken by state variables. It may be noted that link values for all links are not shown in the above figure. Solution using Backward Recursion: Starting from the last stage, the suboptimization function for the 3rd crop is given as, f 3 ( S 3 ) = max NB3 ( x3 ) with the range of S 3 from 0 to 4. x3 0≤ x3 ≤ S 3

M6L4

Optimization Methods: Dynamic Programming Applications – Water Allocation

3

The calculations for this stage are shown in the table below. Table 2 NB3 ( x3 )

State S3

x3 :

0

1

2

3

0

0

1

0

6

2

0

6

10

3

0

6

10

12

4

0

6

10

12



f 3 ( S3 )

x3

0

0

6

1

10

2

12

3

12

3,4

4

12

Next, by considering last two stages together, the suboptimization function is f 2 ( S 2 ) = max[NB2 ( x2 ) + f1 ( S 2 − x2 )] . This is solved for a range of S 2 values from 0 to 4. x2 x2 ≤ S 2

The value of f 3 ( S 2 − x2 ) is noted from the previous table. The calculations are shown below. Table 3 f 2 (S2 ) = State S 2

x2

NB2 ( x2 )

( S 2 − x2 )

f 3 ( S 2 − x2 )

NB2 ( x2 ) +



f 2 (S2 )

x2

0

0

6.5

1

12.5

1

16.5

1



f 3 ( S 2 − x2 ) 0 1

2

3

0

0

0

0

0

0

0

1

6

6

1

6.5

0

0

6.5

0

0

2

10

10

1

6.5

1

6

12.5

2

10

0

0

10

0

0

3

12

12

1

6.5

2

10

16.5

2

10

1

6

16

M6L4

Optimization Methods: Dynamic Programming Applications – Water Allocation 3

10.5

0

0

10.5

4

Table contd. on next page

4

0

0

4

12

12

1

6.5

3

12

18.5

2

10

2

10

20

3

10.5

1

6

16.5

4

8

0

0

8

20

2

Finally, by considering all the three stages together, the sub-optimization function is f1 (Q) = max [NB1 ( x1 ) + f 2 (Q − x1 )] . The value of S1 = Q = 4 . The calculations are shown in x1 0≤ x1 ≤Q

the table below. Table 4 f1 ( S1 ) =

State

S1 = Q

4

x1

NB1 ( x1 )

(Q − x1 )

f 2 (Q − x1 )

NB1 ( x1 ) +





f1 ( S1 )

x1

21

1

f 2 (Q − x1 ) 0

0

4

20

20

1

4.5

3

16.5

21

2

8

2

12.5

20.5

3

10.5

1

6.5

17

4

12

0

0

12

Now, backtracking through each table to find the optimal values of decision variables, the ∗ optimal allocation for crop 1, x1 = 1 for a S1 value of 4. This will give the value of S 2

as S 2 = S1 − x1 = 3 . From Table 3, the optimal allocation for crop 2, x2 for S 2 = 3 is 1. Again, S3 = S 2 − x2 = 2 . Thus, x3 * from Table 2 is 2. The maximum total net benefit from all the crops is 21. The optimal solution is given below

M6L4

Optimization Methods: Dynamic Programming Applications – Water Allocation

5

f ∗ = 21 ∗

x1 = 1 ∗

x2 = 1 ∗

x3 = 2 Solution using Forward Recursion: While starting to solve from the first stage and proceeding towards the final stage, the suboptimization function for the first stage is given as, f1 ( S1 ) = max NB1 ( x1 ) . The range of values for S1 is from 0 to 4. x1 x1 ≤ S1

Table 5 ∗



State S1

x1

NB1 ( x1 )

f 2 (S2 )

x1

0

0

0

0

0

0

0

4.5

1

1

4.5

0

0

1

4.5

8

2

2

8

0

0

1

4.5

2

8

10.5

3

3

10.5

0

0

1

4.5

2

8

12

4

3

10.5

4

12

1

2

3

4

M6L4

Optimization Methods: Dynamic Programming Applications – Water Allocation

6

Now, considering the first two crops together, f 2 ( S 2 ) can be written as, f 2 ( S 2 ) = max[NB2 ( x2 ) + f1 ( S 2 − x2 )] with S 2 ranging from 0 to 4. The calculations for this x2 x2 ≤ S 2

stage are shown below. Table 6

f 2 (S2 ) = State S 2

x2

NB2 ( x2 )

( S 2 − x2 )

f1 ( S 2 − x2 )

NB2 ( x2 ) +





f 2 (S2 )

x2

0

0

6.5

1

11

1

14.5

1,2

18

2

f 2 ( S 2 − x2 ) 0 1

2

3

4

0

0

0

0

0

0

0

1

4.5

4.5

1

6.5

0

0

6.5

0

0

2

8

8

1

6.5

1

4.5

11

2

10

0

0

10

0

0

3

10.5

10.5

1

6.5

2

8

14.5

2

10

1

4.5

14.5

3

10.5

0

0

10.5

0

0

4

12

12

1

6.5

3

10.5

17

2

10

2

8

18

3

10.5

1

4.5

15

4

8

0

0

8

Now, considering the whole system i.e., crops 1, 2 and 3, f 3 ( S3 ) can be expressed as, f 3 ( S 3 ) = max [NB3 ( x3 ) + f 2 ( S3 − x3 )] with the value of S3 = 4 . x3 x3 ≤ S 3 = Q

M6L4

Optimization Methods: Dynamic Programming Applications – Water Allocation

7

The calculations are shown below. Table 7

f 3 ( S3 ) = State S 3

x3

NB3 ( x3 )

S3 − x3

f 2 ( S3 − x3 )

NB3 ( x3 ) +





f 3 ( S3 )

x3

21

2

f 2 ( S3 − x3 )

4

0

0

4

18

18

1

6

3

14.5

20.5

2

10

2

11

21

3

12

1

6.5

18.5

4

12

0

0

12

In order to find the optimal solution, a backtracking is done. From Table 7, the optimal value of x3 * is given as 2 for the S 3 value of 4. Therefore, S 2 = S3 − x3 = 2 . Now, from Table 6, ∗ ∗ the value of x2 = 1 . Then, S1 = S 2 − x2 = 1 and from Table 5, for S1 = 1 , the value of x1 = 1 .

Thus, the optimal values determined are shown below.

f ∗ = 21 ∗

x1 = 1 ∗

x2 = 1 ∗

x3 = 2 These optimal values are same as those we got by solving using backward recursion method.

M6L4

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

1

Module – 6 Lecture Notes – 5 Capacity Expansion Introduction The most common applications of dynamic programming in water resources include water allocation, capacity expansion of infrastructure and reservoir operation. In this lecture, dynamic programming formulation for capacity expansion and a numerical example are discussed. Capacity expansion Consider a municipality planning to increase the capacity of its infrastructure (ex: water treatment plant, water supply system etc) in future. The increments are to be made sequentially in specified time intervals. Let the capacity at the beginning of time period t be St (existing capacity) and the required capacity at the end of that time period be Kt. Let xt be the added capacity in each time period. The cost of expansion at each time period can be expressed as a function of St and xt , i.e. Ct ( St , xt ) . The problem is to plan the time sequence of capacity expansions which minimizes the present value of the total future costs subjected to meet the capacity demand requirements at each time period. Hence, the objective function of the optimization model can be written as, T

Minimize

∑ C (S , x ) t =1

t

t

t

where Ct ( St , xt ) is the present value of the cost of adding an additional capacity xt in the time period t with an initial capacity St . Each period’s final capacity or next period’s initial capacity should be equal to the sum of initial capacity and the added capacity. Also at the end of each time period, the required capacity is fixed. Thus, for a time period t, the constraints can be expressed as S t +1 = S t + xt

for t = 1,2,..., T

S t +1 ≥ K t

for t = 1,2,..., T

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

2

In some problems, there may be constraints to the amount of capacity added xt in each time period i.e. xt can take only some feasible values. Thus, xt ∈ Ωt . The capacity expansion problem defined above can be solved in a sequential manner using dynamic programming. The solution procedure using forward recursion and backward recursion are explained below. Forward Recursion Consider the stages of the model to be the time periods in which capacity expansion is to be made and the state to be the capacity at the end of each time period t, S t +1 . Let S1 be the present capacity before expansion and f t ( S t +1 ) be the minimum present value of total cost of capacity expansion from present to the time t.

Ct

C1 S1

Stage 1

S2

x1

St

Stage t

CT St+1

xt

ST

Stage T

ST+1

xT

Considering the first stage, the objective function can be written as, f1 ( S 2 ) = min C1 ( S1 , x1 ) = min C1 ( S1 , S 2 − S1 )

The values of S 2 can be between K1 and K T where K1 is the required capacity at the end of time period 1 and K T is the final capacity required. In other words, f1 ( S 2 ) should be solved for a range of S 2 values between K1 and K T . Then considering first two stages, the suboptimization function is

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

3

f 2 ( S 3 ) = min [C 2 (S 2 , x 2 ) + f1 ( S 2 )] x2 x2 ∈Ω 2

= min [C 2 (S 3 − x 2 , x 2 ) + f1 ( S 3 − x 2 )] x2 x2 ∈Ω 2

which should be solved for all values of S 3 ranging from K 2 to K T . Hence, in general for a time period t, the suboptimization function can be represented as f t ( S t +1 ) = min [Ct (S t +1 − xt , xt ) + f t −1 ( S t +1 − xt )] xt xt ∈Ω t

with constraint as K t ≤ S t +1 ≤ K T . For the last stage, i.e. t=T, the function fT ( ST +1 ) need to be solved only for S T +1 = K T . Backward Recursion The expansion problem can also be solved using a backward recursion approach with some modifications. Consider the state S t be the capacity at the beginning of each time period t. Let fT ( ST ) be the minimum present value of total cost of capacity expansion in periods t through T. For the last period T, the final capacity should reach K T after doing the capacity expansions. Thus, the objective function can be written as, f T ( S T ) = min [CT (S T , xT )] xT xT ∈ΩT

This is solved for all ST values ranging from K T −1 to K T . In general, for a time period t, the function f t ( St ) can be expressed as f t ( S t ) = min [Ct (S t , xt ) + f t +1 ( S t + xt )] which should be solved for all discrete values of St xt xt ∈Ω t

ranging from K t −1 to K T .

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

4

For period 1, the above equation must be solved only for the actual value of S1 given. Numerical example (Loucks et al., 1981)

Consider a five stage capacity expansion problem. The minimum capacity to be achieved at the end of each time period is given below. Table 1

t

Kt

1

5

2

10

3

20

4

20

5

25

The expansion costs for each combination of expansion for each stage are shown in the corresponding links in the form of a figure below.

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

5

Solution Using Forward Recursion The capacity at the initial stage is given as S1 = 0. Consider the first stage, t =1. The final capacity for stage 1, S2 can take values between K1 to K5. Let the state variable can take discrete values of 5, 10, 15, 20 and 25. The objective function for 1st subproblem with state variable as S2 can be expressed as f1 ( S 2 ) = min C1 ( S1 , x1 ) = min C1 ( S1 , S 2 − S1 ) The computations for stage 1 are given in the table below. Table 2

Stage 1 State Variable, S2

Added Capacity, x1 = S2 – S1

C1(S2)

f1*(S2)

5

5

9

9

10

10

11

11

15

15

15

15

20

20

21

21

25

25

27

27

Considering the 1st and 2nd stages together, the state variable S3 can take values from K2 to K5. Thus, the objective function for 2nd subproblem is f 2 ( S 3 ) = min [C 2 (S 2 , x 2 ) + f1 ( S 2 )] x2 x2 ∈Ω 2

= min [C 2 (S 3 − x 2 , x 2 ) + + f 1 ( S 3 − x 2 )] x2 x2 ∈Ω 2

The value of x2 should be taken in such a way that the minimum capacity at the end of stage 2 should be 10, i.e. S3 ≥ 10 . M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

6

The computations for stage 2 are given in the table below. Table 3

Stage 2 State Variable, S3 10

15

20

25

Added Capacity, x2

C2(S3)

S2= S3 x2

f1*(S2)

f2(S3)=C2(S3)+f1*(S2)

0

0

10

11

11

5

8

5

9

17

0

0

15

15

15

5

8

10

11

19

10

10

5

9

19

0

0

20

21

21

5

7

15

15

22

10

10

10

11

21

15

13

5

9

22

0

0

25

27

27

5

7

20

21

28

10

9

15

15

24

15

14

10

11

25

20

20

5

9

29

f2*(S3)

11

15

21

24

Like this, repeat this steps till t = 5. For the 5th subproblem, state variable S6 = K5.

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

7

The computations for stages 3 to 5 are shown in tables below. Table 4

Stage 3 State Variable, S4

20

25

Added Capacity, x3

C3(S4)

S3= S4 – x3

f2*(S3)

f3(S4)=C3(S4)+f2*(S3)

f3*(S4)

0

0

20

21

21

5

6

15

15

21

10

9

10

11

20

0

0

25

24

24

5

6

20

21

27

10

9

15

15

34

15

12

10

11

23

f3*(S4)

f4(S5)=C4(S5)+f3*(S4)

f4*(S5)

20

20

23

Table 5

Stage 4 State Variable, S5 20 25

Added Capacity, x4

C4(S5)

S4= S5 – x4

0

0

20

20

20

0

0

25

23

23

5

5

20

20

25

23

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

8

Table 6

Stage 5 State Variable, S6 25

Added Capacity, x5

C5(S6)

S5= S6 – x5

f4*(S5)

f5(S6)=C5(S6)+f4*(S5)

0

0

25

23

23

5

4

20

20

24

f5*(S6)

23

The figure below shows the solutions with the cost of each addition along the links and the minimum total cost at each node.

From the figure, the optimal cost of expansion is 23 units. By doing backtracking from the last stage (farthest right node) to the initial stage, the optimal expansion to be done at 1st stage = 10 units, 3rd stage = 15 units and rest all stages = 0 units.

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

9

Solution Using Backward Recursion The capacity at the final stage is given as S6 = 25. Consider the last stage, t =5. The initial capacity for stage 5, S5 can take values between K4 to K5. The objective function for 1st subproblem with state variable as S5 can be expressed as f 5 ( S 5 ) = min xT xT ∈ΩT

[ f 5 (S 5 , x5 )]

The computations for stage 5 are given in the table below Table 7

Stage 5 State

Added

Variable,

Capacity, x5

C5(S5)

f5*(S5)

S5 20

5

4

4

25

0

0

0

Following the same procedure for all the remaining stages, the optimal cost of expansion is achieved. The computations for all stages 4 to 1 are given below. Table 8

Stage 4 State Variable, S4 20 25

Added

f5*(S5) f4(S4)=C4(S4)+f5*(S5)

C4(S4)

S5 = S4+ x4

0

0

20

4

4

5

5

25

0

5

0

0

25

0

0

Capacity, x4

f4*(S4)

4 0

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

10

Table 9

Stage 3 State Variable, S3 10

15

20 25

Added Capacity, x3

C3(S3)

S4= S3 + x3

f4*(S4)

f3(S3)=C3(S3)+ f4*(S4)

10

9

20

4

13

15

12

25

0

12

5

6

20

4

10

10

9

25

0

10

0

0

20

4

4

5

6

25

0

5

0

0

25

0

0

f3*(S3)

12

10

4 0

Table 10

Stage 2 State Variable, S2

5

10

15

20 25

Added Capacity, x2

C2(S2)

S3= S2 + x2

f3*(S3)

f2(S2)=C2(S2)+ f3*(S3)

5

8

10

12

20

10

10

15

10

20

15

13

20

4

17

20

20

25

0

20

0

0

10

12

12

5

8

15

10

18

10

10

20

4

14

15

14

25

0

14

0

0

15

10

10

5

7

20

4

11

10

9

25

0

9

0

0

20

4

4

5

7

25

0

7

0

0

25

0

0

f2*(S2)

17

12

9

4 0

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

11

Table 11

Stage 2 State Variable, S1

0

Added Capacity, x1

C1(S1)

S2= S1 + x1

f2*(S2)

f1(S1)=C1(S1)+ f2*(S2)

5

9

5

17

26

10

11

10

12

23

15

15

15

9

24

20

21

20

4

25

25

27

25

0

27

f1*(S2)

23

The solution is given by the figure below with the minimum total cost of expansion at the nodes.

M6L5

Optimization Methods: Dynamic Programming Applications – Capacity Expansion

12

The optimal cost of expansion is obtained from the node value at the first node i.e. 23 units which is the same as obtained from forward recursion. The optimal expansions at each time period can be obtained by moving forward from the first node to the last node. Thus, the optimal expansions to be made are 10 units at the first stage and 15 units at the last stage. Hence the final requirement of 25 units is achieved. Although this type of expansion problem can be solved, the future demand and the future cost of expansion are highly uncertain. Hence, the solution obtained cannot be used for making expansions till the end period, T. It can be very well used to make decisions about the expansion to be done in the current period. For this to be done, the final period T should be selected far away from the current period, so that the uncertainty on current period decisions is much less. It may be note that, generally water supply projects are planned for a period of 25-30 years to avoid undue burden to the present generation. In addition, change of value of money in time (due to inflation and other aspects) is not considered in the examples above.

M6L5

Optimization Methods: Integer Programming – Integer Linear Programming

1

Module – 7 Lecture Notes – 1 Integer Linear Programming Introduction In all the previous lectures in linear programming discussed so far, the design variables considered are supposed to take any real value. However in practical problems like minimization of labor needed in a project, it makes little sense in assigning a value like 5.6 to the number of labourers. In situations like this, one natural idea for obtaining an integer solution is to ignore the integer constraints and use any of the techniques previously discussed and then round-off the solution to the nearest integer value. However, there are several fundamental problems in using this approach: 1.

The rounded-off solutions may not be feasible.

2.

The objective function value given by the rounded-off solutions (even if some are feasible) may not be the optimal one.

3.

Even if some of the rounded-off solutions are optimal, checking all the rounded-off solutions is computationally expensive ( 2 n possible round-off values to be considered for an n variable problem)

Types of Integer Programming When all the variables in an optimization problem are restricted to take only integer values, it is called an all – integer programming problem. When the variables are restricted to take only discrete values, the problem is called a discrete programming problem. When only some variable values are restricted to take integer or discrete, it is called mixed integer or discrete programming problem. When the variables are constrained to take values of either zero or 1, then the problem is called zero – one programming problem. Integer Linear Programming Integer Linear Programming (ILP) is an extension of linear programming, with an additional restriction that the variables should be integer valued. The standard form of an ILP is of the form,

M7L1

Optimization Methods: Integer Programming – Integer Linear Programming

2

cT X AX ≤ b X ≥0

max subject to

X must be integer valued The associated linear program dropping the integer restrictions is called linear relaxation LR. Thus, LR is less constrained than ILP. If the objective function coefficients are integer, then for minimization, the optimal objective for ILP is greater than or equal to the rounded-off value of the optimal objective for LR. For maximization, the optimal objective for ILP is less than or equal to the rounded-off value of the optimal objective for LR. For a minimization ILP, the optimal objective value for LR is less than or equal to the optimal objective for ILP and for a maximization ILP, the optimal objective value for LR is greater than or equal to that of ILP. If LR is infeasible, then ILP is also infeasible. Also, if LR is optimized by integer variables, then that solution is feasible and optimal for IP. A most popular method used for solving all-integer and mixed-integer linear programming problems is the cutting plane method by Gomory (Gomory, 1957). Gomory’s Cutting Plane Method for All – Integer Programming Consider the following optimization problem. Maximize

Z = 3x1 + x 2

subject to

2 x1 − x 2 ≤ 6 3 x1 + 9 x 2 ≤ 45 x1 , x 2 ≥ 0 x1 and x2 are integers

The graphical solution for the linear relaxation of this problem is shown below.

M7L1

Optimization Methods: Integer Programming – Integer Linear Programming

x2

3

7

6

5

2 x1 − x2 ≤ 6

A

3 x1 + 9 x2 ≤ 45

(4 5 7 ,3 3 7 )

4

B

3

Z = 17 4

7

2

1

0

D 0

C 1

2

3

4

5

6

7 x 1

It can be seen that the solution is x1 = 4 5 , x 2 = 3 3 and the optimal value of Z = 17 4 . 7 7 7 The feasible solutions accounting the integer constraints are shown by red dots. These points are called integer lattice points. The original feasible region is reduced to a new feasible region by including some additional constraints such that an extreme point of the new feasible region becomes an optimal solution after accounting for the integer constraints. The graphical solution for the example previously discussed taking x1 and x2 as integers are shown below. Two additional constraints (MN and OP) are included so that the original feasible region ABCD is reduced to a new feasible region AEFGCD. Thus the solution for this ILP is x1 = 4, x2 = 3 and the optimal value is Z = 15 .

M7L1

Optimization Methods: Integer Programming – Integer Linear Programming Additional constraints

4

M

x2 7

6 O 5

A

(4 5 7 ,3 3 7 )

4 E B

F

3

Z = 17 4

7

(4,3) 2

G

Z = 15

1

0

D 0

C 1

2

3

N 4

P 5

6

7 x 1

Gomary proposed a systematic method to develop these additional constraints known as Gomory constraints. Generation of Gomory Constraints: Let the final tableau of an LP problem consist of n basic variables (original variables) and m non basic variables (slack variables) as shown in the table below. The basic variables are represented as xi (i=1,2,…,n) and the non basic variables are represented as yj (j=1,2,…,m).

M7L1

Optimization Methods: Integer Programming – Integer Linear Programming

5

Table 1 Variables Basis

Z

x1



0

xi

yj

y1

y2

0

0

c1

c2

cj

cm

b



ym

br

xn





Z

1

x1

0

1

0

0

0

c11

c12

c1j

c1m

b1

x2

0

0

1

0

0

c21

c22

c2j

c2m

b2

0

0

0

1

0

c31

c32

c3j

c3m

bi

0

0

0

0

1

c41

c42

c4j

c4m

bn



0

x2



xi

xn

Choose any basic variable xi with the highest fractional value. If there is a tie between two basic variables, arbitrarily choose any of them as xi . Then from the ith equation of table, m

xi = bi − ∑ cij y j

……..(1)

j =1

Express both bi and cij as an integer value plus a fractional part.

bi = bi + β i

........(2)

cij = cij + α ij

........(3)

where bi , cij denote the integer part and β i , α ij denote the fractional part. β i will be a

(

)

strictly positive fraction (0 < β i < 1) and α ij is a non-negative fraction 0 ≤ α ij < 1 . Substituting equations (2) and (3) in (1), equation (1) can be written as m

m

β i − ∑ α ij y j = xi − bi − ∑ cij y j j =1

…….(4)

j =1

For all the variables xi and y j to be integers, the right hand side of equation (4) should be an integer. m

β i − ∑ α ij y j = integer

……(5)

j =1

M7L1

Optimization Methods: Integer Programming – Integer Linear Programming

Since α ij are non-negative integers and y j are non-negative integers, the term

6 m

∑ α ij y j

will

j =1

always be a non-negative number. Thus we have, m ⎛ ⎞ ⎜β − α y ⎟ ≤ β