Optimum Design of Mechanical Elements: Class Notes For AME60661
Optimum Design of Mechanical Elements: Class Notes For AME60661
Optimum Design of Mechanical Elements: Class Notes For AME60661
I Fundamentals 9
1 Introduction 10
1.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3 Components and formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3.1 Design variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3.2 Objective function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3.3 Design constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3.4 Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4 Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4.1 Based on the objective function and the constraints . . . . . . . . . . . . . . . . . . 14
1.4.2 Based on the feasible space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4.3 Based on the design variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4.4 Based on the uncertainty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.4.5 Based on the field of application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.5 Solution methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2 Mathematical foundation 18
2.1 Vector Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.1.1 Norm of a vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.1.2 Dot product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.1.3 Cross product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.1.4 Tensor product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2 Linear Dependence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.3 Systems of linear equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.4 Eigenvalue problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.5 Quadratic forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.6 Positive definite matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.6.1 Sylvester’s criterion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1
2.6.2 Eigenvalue criterion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.7 Sets in Rn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.8 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.9 Gradient and Jacobian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.10 Hessian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.11 Taylor’s theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.11.1 Single-variable formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.11.2 Multivariate formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.12 Matrix calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3 Numerical foundation 40
3.1 Numeric differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.2 Numeric evaluation of gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.3 Numeric evaluation of Hessian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.4 Matlab programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.4.1 Derivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.4.2 Gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.4.3 Hessian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
II Single-variable optimization 46
4 Analytical elements 47
4.1 Problem formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.2 Classification of optimal points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.3 Optimality conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.3.1 Minimum-value theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.3.2 First order necessary condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.3.3 Second order sufficient conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.3.4 Higher order conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.4 Convexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.4.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.4.2 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.5 Unimodality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2
5 Basic numerical methods 54
5.1 Bracketing a three-point pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.1.2 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.2 Fibonacci’s method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.2.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.2.2 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.3 Golden section method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.3.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.3.2 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7 Numerical Analysis 73
7.1 Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.2 Fixed Point Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.3 Contraction mapping theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7.4 Error analysis and order of convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
3
III Unconstrained multivariate optimization 79
8 Analytical elements 80
8.1 Problem formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
8.2 Optimality conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.2.1 First order necessary condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.2.2 Second order sufficient conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
8.2.3 Higher order conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
8.3 Convexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
8.3.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
8.3.2 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
9 Numerical methods 86
9.1 Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
9.1.1 Descent direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
9.1.2 Line search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
9.1.3 Termination criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
9.2 Steepest descent method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
9.2.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
9.2.2 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
9.2.3 Scaling∗ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
9.3 Conjugate gradient method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
9.3.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
9.3.2 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
9.4 Newton’s method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
9.4.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
9.4.2 Modified Newton’s methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
9.4.3 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
9.5 Quasi-Newton methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
9.5.1 Davidon-Fletcher-Powell (DFP) method . . . . . . . . . . . . . . . . . . . . . . . . 102
9.5.2 Broyden-Fletcher-Goldfarb-Shanno (BFGS) method . . . . . . . . . . . . . . . . . 103
9.6 Trust regions methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
9.6.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
9.6.2 Reliability index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
9.6.3 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
9.7 Least square problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
9.8 Nelder-Mead simplex method∗ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4
9.8.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
9.8.2 Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
5
12.7 Duality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15 Modeling 187
15.1 Binary approximation of integer variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
15.2 Binary polynomial programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
6
16 Applications 189
16.1 Classic problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
16.1.1 Suitcase problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
16.1.2 Class scheduling problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
16.1.3 Traveling salesman problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
16.2 Transportation and networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
16.2.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
16.2.2 Transportation problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
16.2.3 Assignment problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
16.2.4 Minimum distance problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
7
20.2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
20.2.1 Efficiency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
20.2.2 Dominance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
20.2.3 Pareto optimal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
20.3 Generation of the Pareto frontier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
20.4 Single best compromise Pareto solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
20.4.1 Utopia point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
20.4.2 The minimax method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
8
Part I
Fundamentals
9
Chapter 1
Introduction
This manuscript contains the class notes for Optimum Design of Mechanical Elements (AME60661). This
is an introductory, graduate-level course in applied optimization offered for Engineering students at the Uni-
versity of Notre Dame, Indiana. The course is divided into five main sections: mathematical foundations,
gradient-based optimization techniques (unconstrained and constrained), binary and integer programming,
and methods for global optimization (stochastic and deterministic). The objective is to present the most
relevant optimization strategies applicable to a large variety of problems in engineering. It will also pro-
vide the necessary elements to understand relevant literature in the field and develop new optimum design
methodologies.
1.1 Definition
The word optimization comes from the Latin optimum which means the best. Design optimization is the pro-
cess of finding the design that provides the best possible value of an objective function within the available
means. Optimization occurs at all times in nature. It has been observed that ants, for example, minimize
the energy required to obtain nutrients by communicating using pheromones. Predators look for easy prey
such as the young or ill to minimize the energy required to obtain their food. The kinematic configuration
of any solid is the one that minimizes its total potential energy. Bones are thought to minimize the use of
calcium while maximizing their mechanical stability. Plants and trees maximize their sun-exposed area and
roots while maintaining their mechanical performance against the forces of the environment.
Optimization is a process that humankind has performed since their existence on Earth and perform
during their whole life. The invention of the wheel is an optimum solution to minimize the drag during
transportation. The process of learning how to walk or how to speak is an optimization process that facilitates
mobility and communication while minimizing energy.
Optimization methods in engineering are also referred to as mathematical programming techniques.
These methods comprise a large area of applied mathematics. These notes deal with the theory and applica-
tions of mathematical programming techniques suitable for the solution of design problems in engineering.
10
In a broad sense, optimization methods can be applied to any engineering problem. Some remarkable exam-
ples include the design of aerospace structures for minimum weight, civil structures for maximum reliability,
automotive structures for maximum occupant protection, electrical networks for minimum power loss, con-
sumer products for minimum cost, trajectories for minimum distance, control for maximum stability, and
machinery for maximum efficiency, among many others.
1.2 History
The history of optimization comes along with the history of mathematics and can be traced to the days
of Isaac Newton (1643–1727), Joseph-Louis Lagrange (1736–1813), Augustin Louis Cauchy (1789–1857),
and Gottfried Leibniz (1646 – 1716). The development of differential calculus for optimization is usually
credited to the contributions of Newton and Leibniz. The foundations of calculus of variations were laid
out by Bernoulli, Euler, Lagrange, and Weierstrass. The use of gradient-based methods were first presented
by Cauchy (Cauchy, 1847) and Gauss. Lagrange proposed the method to solve constrained optimization
problems with the addition of unknown variables.
Modern optimization methods were introduced in the 1940s during War World II. During those years, the
term mathematical programming was used instead of optimization. Programming made reference to military
logistics and not to computers (Dantzig, 1951). ENIAC or Electronic Numerical Integrator And Computer
was the first Turing-complete, digital computer capable of being reprogrammed (Goldstine, 1972). It was
developed at about the same year that the Simplex method was presented by George Dantzig (1914–2005)
in 1947. William Karush (1917–1997), Harold William Kuhn (1925–), and Albert William Tucker (1905 –
1995) are known for the Karush-Kuhn-Tucker (KKT) conditions, a basic result in non-linear programming
presented in 1939 by Karush and in 1951 by Kuhn and Tucker. In 1960, Land and Doig presented branch and
bound methods. In 1964, Fletcher and Reeves presented the conjugate gradient method. In 1959 and 1963,
Davidon, Fletcher and Powell presented the conjugate direction (or DFP) method. In 1960, constrained
optimization methods were pioneered by Rose’s gradient projection method and Zoutendijk’s method of
feasible directions. In 1966, Abadie, Carpentier and Hensgen presented the generalized reduced gradient
(GRG) method. In 1971, Brent and others introduced the polynomial methods that were an improvement
to the ones using the Fibonacci numbers and the golden ratio. Sequential quadratic programming (SQP)
methods were developed in the 1970s by Biggs (1975), Han (1977), and Powell (1978) among others.
A new class of probabilistic methods for global optimization has been developed in the last decades.
In 1975, Holland introduced the genetic algorithms (GAs). Simulated annealing (SA) was independently
introduced by Kirkpatrick et al. (1983) and C̆erný (1985). Later, Dorigo (1992) presented the Ant Colony
Optimization (ACO) method. More recently, Kennedy & Eberhart (1995) introduced the particle swarm
optimization (PSO).
11
1.3 Components and formulation
A design optimization problems has three basic components: an objective or merit function, a set of design
variables, and a set of constrains.
12
In the same way, equality constraints can be expressed as h(x) = 0
e e e
h1 (x)
e
h2 (x)
h(x) =
.. e . (1.3)
e e .
hm (x)
e
Constraints that represent limitations on the performance of the system are called functional constraints.
Constraints that represent limitations on the design variables are called geometric constraints. In general,
geometric constraints can be written as
xL ≤ x ≤ xU . (1.4)
e e e
The set of all constraints defines the feasible space.
1.3.4 Formulation
The design optimization process seeks to maximize or minimize the objective function by systematically
finding solutions for the design variables in the feasible space. This optimization problem can be written as
min f (x)
x e
e
s.t. g (x) ≤ 0 (1.6)
ee e
h(x) = 0
xL ≤ x ≤ xU .
e e e
e e e
In some contexts, this problem is also formulated as
min f (x)
x e (1.7)
e
s.t. x ∈ Ω,
e
where Ω represents the feasible space. A simpler notation used is referred to the optimum point x∗ as the
e
argument that minimizes the objective function f (x). This is
e
x∗ = arg min f (x)
e x e (1.8)
e
s.t. x ∈ Ω,
e
13
or simply,
x∗ = arg min f (x). (1.9)
e x∈Ω e
e
1.4 Classification
Optimization problems might be classified according to different criteria.
g2 (x) = 2x2 + x3 − 6 ≤ 0.
e
e
An example of a QP problem is
14
When the design variables are functions of an independent variable, then the problem is referred to as
a dynamic optimization problem. Otherwise, the problem is a static optimization problem (which is a term
not frequently used).
15
in the sense that no numeric sensitivity analysis is required. OC methods are very popular in structural
optimization.
Methods based on the experience of the designer are referred to as heuristic methods. Usually, these
methods lack mathematical foundation and rely on educated guesses, intuitive judgments, or common sense.
Meta-heuristic methods are mixed approaches that combine heuristics and mathematical analyses.
Exercises
1. Answer true (T) or false (F):
2. You want to find the length and height of a rectangle of perimeter P0 that has the maximum area.
3. Consider an engineering problem in which you have to design a rectangular box of volume V0 with
the smallest surface area.
4. Consider an engineering problem in which you have to design a cylindrical can (including bottom and
top) of volume V0 with the smallest surface area.
16
(a) Identify the design variables.
(b) State the objective functions.
(c) State the functional and geometric constraints.
5. You want to find the minimum distance between the points on the line y = x − 1 and the points on
the line y = x2 + 1.
17
Chapter 2
Mathematical foundation
This chapter reviews selected topics in real and numerical analysis. This material is covered in detail in texts
such as Atkinson (1978), Bartle (1976), and Greenberg (1998).
x1 T x2 = x2 T x1 . (2.9)
e e e e
Also notice that
||x||22 = x· x = xT x. (2.10)
e e e e e
Example. The dot product of x1 = (1, −2, 3) and x2 = (−4, 5, −6)T is
T
e e
x1 T x2 = (1)(−4) + (−2)(5) + (3)(−6) = −32.
e e
19
2.1.3 Cross product
The cross product (or vector product or exterior product) of two vectors x1 , x2 ∈ R3 is defined as
e e
x11 x21 x12 x23 − x13 x22
x12 × x22 = x13 x21 − x11 x23 . (2.12)
In an Euclidean space this results in another vector which is perpendicular to the plane containing the two
input vectors.
Example. The cross product of x1 = (1, −2, 3)T and x2 = (−4, 5, −6)T is x3 = (−3, −6, −3)T .
e e e
x11 x21 x11 x22 · · · x11 x2m
x12 x21 x12 x22 · · · x12 x2m
x1 ⊗ x2 = x1 xT2
=
.. .. .. .. . (2.13)
e e e e . . . .
x1n x21 x1n x22 · · · x1n x2m
Example. The outer product of xT1 = (1, −2, 3) and xT2 = (−4, 5) is
e e
−4 5
A= 8 −10 .
e
e −12 15
α1 x1 + · · · + αk xm = 0 (2.14)
e e e
implies that all αi are zero. To prove this, assume that some αk 6= 0. Then we can divide by αk and express
20
xp in terms of the other vectors, this is
e
α1 αm
xk = x1 + · · · + xm . (2.15)
e αk e αk e
Clearly, this condition prevents from linear independency. When two vectors are LD, (2.11) is an equality.
21
If det(AT A) 6= 0 then α = 0 and the system is LI, otherwise the system is LD.
e
e ee e e
For any matrix A, the number of LI row vectors is equal to the number of LI column vectors and these in
e
turn equal the rank efor A. Thus, if we wish to determine how many vectors in a given set x1 , . . . , xk are LI
e e e
one can form a matrix A e with x1 , . . . , xk as the rows (or columns) and then use elementary row operations
e e e
to determine the rank ofe A or rank(A).
e
e e
e
Example. How many LI vectors are contained in the following set of vectors
2 1 −3 4
, x2 = 4 , x3 = −2 , x4 = 5 .
2
x1 =
0 e 3 e 1 e
e 3
2 1 −3 −2
so rank(A) = 3. Hence, there are three LI vector in the set. Another way to put it is dim[span{x1 , x2 , x3 , x4 }] =
e e e e e
3. e
Ax = b. (2.16)
e
ee e
where the matrix A ∈ Rm×n applies the vector x ∈ Rn into b ∈ Rm . The system has at least one solution
e e e
when b is a linear combination
e of the column vectors of A. In other words, when b belongs to the span of A.
e e
e e e
e
22
The system is consistent if it has at least one solution. In this case
rank(A) = rank(A, b) = n.
e
e e
e e
In the special case in which m = n = rank(A) = rank(A, b), then the unique solution can be expressed
e e
e e
as e
x = A−1 b. (2.17)
e e e e
The system is said to be overdetermined when it has more equations than unknowns, this is m > n. An
overdetermined system can be consistent or inconsistent.
23
(a) rank(A) = rank(A, b) = 2 then the system is consistent. In fact, since n = 2 the system is uniquely
e e e
determined
e and theesolution is given by
! !−1 ! !
x1 1 2 1 −1
= = .
x2 3 4 1 1
(c) rank(A) = 1 and rank(A, b) = 2 then the system is inconsistent and it has no solution. This can also
e e
e e
be observed
e from row operations on the extended matrix (A, b),
e
e e
! !
1 2 2 1 2 2
→ ,
2 4 2 0 0 −1
where 0 = −1 is inconsistent.
(d) rank(A) = rank(A, b) = 2 then the system is consistent. Since n = 2 the system is uniquely deter-
e e
e e is found by row operations on the extended matrix (A, b),
minedeand the solution
e
e e
1 2 1 1 2 1
3 4 2 → 0 2 1
5 6 3 0 0 0
(e) rank(A) = 2 and rank(A, b) = 3 then the system is inconsistent and it has no solution.
e
e e
e e
24
where e is referred to as eigenvector and λ as the eigenvalue. Premultiplying (2.18) by the identity matrix I
e e
yields e
Ae = λI e, (2.19)
e
ee e
ee
therefore
(A − λI )e = 0. (2.20)
e
e e
ee e
The eigenvalue problem has a unique trivial solution e = 0 if det(A − λI ) 6= 0, and non-trivial solutions if
e e e e
and only if e e
det(A − λI ) = 0. (2.21)
e
e e
e
This algebraic equation in λ is known as the characteristic equation corresponding to the matrix A and
e
e λ,
its roots are the eigenvalues of A. The algebraic multiplicity of an eigenvalue λ, represented as mul A
e e
corresponds to the multiplicity of the corresponding root of the characteristic equation. The geometric
e e
algebraic multiplicity of an eigenvalue is greater than or equal to its geometric multiplicity, this is
mulA λ ≥ gmulA λ.
e
e e
e
this is
(2 − λ)(−1 − λ) − 4 = 0.
So the eigenvalues of A are λ1 = 3 and λ2 = −2 (or vice versa since the order is immaterial).
e
To find the eigenvectors,
e replace λ1 in (2.20), so
!
2−3 −4 e11 0
= .
−1 −1 − 3 e12 0
This system of equations is LD. The only equation to be solve can be expressed as
−e11 − 4e12 = 0.
25
The solution is e11 = α (arbitrary), and e12 = α/4, or
e e
1
e1 = α .
e − 14
The collection σA of all eigenvalues (possibly complex-valued) of A is the spectrum of A. The number
e
e e
e e
e
ρ(A) = max |λ| (2.22)
e λ∈σA
e
is the spectral radius of A. If A is symmetric, then all it eigenvalues are real numbers.
If A ∈ Rn×n , then the e norm || · || : Rn×n → R is defined as
e e
e matrix
e
e
||Ax||
||A|| = max e ee . (2.23)
e ||x||≤1 ||x||
e e e
26
or
||Ax||
||A|| = max e ee . (2.24)
e x 6=0 ||x||
e e e e
From this definition one observes that
||Ax|| ≤ ||A|| ||x|| (2.25)
e
ee e
e e
for any Lp norm. Since Ae = λe, ones has ||Ae|| = |λ| ||e||. From (2.25) follows that ||A|| ≥ |λ|.
e
ee e e
ee e e
Therefore, e
||A|| ≥ ρ(A). (2.26)
e
e e
e
p
Each L norm has a useful matrix expression (Allen & Isaacson, 1998). For instance,
27
Example. Determine if the following quadratic function is a quadratic form:
is diagonal.
By a linear change of variables, a quadratic form can be reduced to its canonical form. Consider the
following transformation
x = Qx̂. (2.30)
e ee
e
Replacing into the quadratic form (2.28),
It can be shown that the matrix Λ = QT AQ is diagonal and its (diagonal) entries are the eigenvalues of A.
e e e
The columns of the matrix Q correspond e the LI normalized eigenvectors of A. This matrix Q is referred
e etoe
e e e
e e
e e
e e
28
to as the orthogonal matrix corresponding to A. The above explains that
e
e
λ1 0
λ2
T −1
Q AQ = Q AQ = Λ =
..
. (2.32)
.
e e e
e
e ee e e
e ee e e
0 λn
det(A3 ) = det(A) = −6
e
e e
e
Clearly, A is negative definite. We can also say that the nature of A is negative definite. It can be verified
that −A e
e e
is positive definite. e
e
e
2.6.2 Eigenvalue criterion
It is also possible to verify that A and its quadratic form are xT Ax are positive (or negative) definite from
e e ee
the eigenvalues of A, λ1 , . . . , λne. If λi > 0 (or λi < 0) for all ie= 1, . . . , n then A and its quadratic form
xT Ax are positive (or
e
e negative) definite. If λ ≥ 0 (or λ ≤ 0) for i = 1, . . . , n, e ethen A and its quadratic
i i
e e
forme xT Ax are positive (or negative) semi-definite.
e e
e
e eee
Example. Determine if the following quadratic form is positive definite.
30
The symmetric matrix A is defined as
e
e
2 1 −1
A= 1 4 3 ,
e
e −1 3 4
and its eigenvalues are λ1 = 7, λ2 = 3, and λ3 = 0. Therefore, the nature of the quadratic form is positive
semi-definite. It can be observed that f (x) = 7x̂21 + 3x̂22 + 0x̂23 = 0 for x̂ = (0, 0, α)T 6= 0. Notice that the
e e e
same result is obtained using Sylvester criterion.
2.7 Sets in Rn
Let us consider a subset Ω ⊂ Rn , then:
is a closed subset of Rn .
e e
• Ω is neither closed or open if it does not satisfy one of the two previous conditions. For example,
Ω = {(x1 , x2 )T ∈ R2 : −1 < x1 ≤ 1 and − 1 < x2 ≤ 1} is neither closed or open.
• Ω is bounded if it is contained within a hypersphere of finite radius. In other words, there is a real
number M such that ||x|| ≤ M for all x ∈ Ω. For example, Ω = {(x1 , x2 )T ∈ R2 : −1 < x1 ≤
1 and − 1 < x2 ≤ 1} is bounded and Ω = {(x1 , x2 )T ∈ R2 : x1 ≥ 0 and x2 ≥ 0} is unbounded.
e e
• Ω is connected if it cannot be represented as the disjoint union of two or more nonempty open subsets
in the relative topology induced on the set. In Euclidean space, Ω is connected if every two points in
Ω be connected by a finite number of straight segments and every point within these segments belongs
to Ω. For example, Ω = Rn \{0} is disconnected for n = 1 and connected for n > 1.
e
• In Euclidean space, Ω is convex if every two points in Ω can be connected with a straight line and
every point in this line also belongs to Ω. For example, Ω = Rn is convex and Ω = Rn \{0} is
e
non-convex.
31
2.8 Functions
A function f projects every element from its domain D(f ) to an element in its range R(f ). This is
f : D(f ) → R(f )
(2.33)
: x 7→ f (x).
e e
The domain is the set of all input elements and the range is the set of all output elements. If the function
applies a vector into a scalar, i.e., D(f ) ⊂ Rn and R(f ) ⊂ R1 , then it is referred to as real or scalar
function. If the function applies a vector into another vector, i.e., D(f ) ⊂ Rn and R(f ) ⊂ Rm , then it is
referred to as vector function. In this text, scalar and vector functions will also be expressed as f (x) and
eT
f (x), respectively. For example, f (x) = x1 + x2 is a scalar function while f (x) = (x21 , x1 + x2 ) is a
e e function.
vector
e e e
A scalar function f is continuous at x0 ∈ D(f ) if and only if
e
lim f (x) = f (x0 ).
x→x0 e e
e e
A function that is continuous at every point of its domain is called a continuous function. More generally, a
function that is continuous on some subset Ω ⊂ D(f ) is said to be continuous in Ω. A function that is not
continuous is called discontinuous.
df d2 f dk f
Let Ω ⊆ R1 and f : Ω → R1 . If the derivatives dx , dx2 , . . . , dxk exist and are continuous in Ω then it is
said that f is of class C k , C k continuous, or simply f ∈ C k in Ω. The function is smooth if f ∈ C ∞ . The
function is analytic of class C ω , if it is smooth and it equals its Taylor series expansion around any point in
its domain.
∂f
Let Ω ⊆ Rn and f : Ω → R1 . If f is continuous then f ∈ C 0 in Ω. If every function ∂xi , i = 1, . . . , n,
2f
is continuous then f ∈ C 1 in Ω. If every function ∂x∂i ∂x j
, i, j = 1, . . . , n, is continuous then f ∈ C 2 in Ω.
k
In general f ∈ C k if all of the partial derivatives ∂xi1∂,...∂x
f
ik
, i = 1, . . . , n, exist and are continuous. Classes
C ∞ and C ω are defined as before.
1
f (x) = .
x−2
f (x) = |x|.
32
One can see that
x for x > 0
f (x) = 0 for x = 0
−x for x < 0
∂f ∂2f
f (x) is continuous. ∂x = 4[max(0, x − 3)]3 is continuous. ∂x2
= 12[max(0, x − 3)]2 is continuous.
∂3f ∂4f ∂4f
∂x3
= 24[max(0, x − 3)] is continuous. ∂x4
= 0 for x < 3, and ∂x4
= 24 for x ≥ 3 then f is discontinuous
in x = 3. therefore, f ∈ C 3.
33
The differential of a vector function f : Rn → Rm is defined by the Jacobian matrix
∂f1 ∂f1 ∂f1
∂x ∂x2 ... ∂xn
∂f21 ∂f2 ∂f2
∂f (x) ∂x1 ∂x2 ... ∂xn
Df (x) = e e = . .. .. .. .
(2.35)
e e ∂x .. . . .
e
∂fm ∂fm ∂fm
∂x1 ∂x1 ... ∂xn
2.10 Hessian
Given a scalar function f : Rn → R1 , such that f ∈ C 2 , the Hessian matrix (or simply, Hessian) evaluated
at x is defined as
∂2f ∂2f ∂2f
e
∂x21 ∂x1 ∂x2 ... ∂x1 ∂xn
∂ 2 f2 ∂2f
∂x22 ∂x2 ∂xn
∇2 f (x) = . (2.36)
.. ..
e
. .
∂ 2 fm
symm ∂x2n
Observe that the Hessian of a function f corresponds to the Jacobian of its gradient. This can be ex-
pressed as
∇2 f (x) = D∇f (x). (2.37)
e e
Example. Determine the Hessian of f (x) = x31 + x1 x2 − 2x22 . Let us determine the first derivatives of f
e
34
with respect to xi ,
∂f (x) 2 ∂f (x)
e = 3x1 + x2 , e = x1 − 4x2 .
∂x1 ∂x2
Therefore, the gradient f is given by !
3x21 + x2
∇f (x) =
e x1 − 4x2
The Jacobian of the gradient, or the Hessian of f , is obtained from the second derivatives,
and Rm (x) is the remainder term, which is smaller in magnitude than the previous terms if x is close enough
to x0 . Commonly the reminder is given by the Cauchy formulation, in which
x
f (m+1) (τ )
Z
Rm (x) = (x − τ )m dτ. (2.41)
x0 m!
f (m+1) (ζ)
Rm (x) = (x − x0 )(m+1) (2.42)
(m + 1)!
35
where ζ ∈ [x0 , x].
exp(2)
fQ (x) = fL (x) + 2 exp(2)(x1 − 1)2 + 3 exp(2)(x1 − 1)(x2 − 2) + (x2 − 2)2 .
e e 2
d T d T
A x= x A = AT . (2.50)
dx e e dx e e e
ee e e e
The derivative of a quadratic form is
d T
x Ax = xT (AT + A). (2.51)
dx e e e e e e
e e e e
1
U (x) = (xT K x),
e 2 e eee
where x is the nodal displacement vector and K is the stiffness matrix. The derivative of U with respect to
e e
x is given by e
e dU 1
= xT (K T + K ).
dx 2e e e e
e
e
T
since K is symmetric, then K + K = 2K and
e
e e
e e
e e
e
dU
= xT K
dx e ee
e
37
or
∇U (x) = K x.
e e
ee
Example. In finite element analysis, the equilibrium condition can be obtained by the derivation of the
potential energy Π with respect to x, where
e
1
Π = xT K x − xT f ,
2e eee e e
and f is the nodal load vector. Then,
e ∂Π
= xT K − f T .
∂x e ee e
e
When this expression is equal to 0, then
xT K = f T
e
e ee
or
Kx = f .
e
ee e
Exercises
1. For x1 T = (1, 8, 3) and x2 T = (3, −3, 1) determine the dot, cross, and tensor products. Show all your
e e
work.
2. Show that the triangle inequality is satisfied by xT1 = (1, −2, 2, 4) and xT2 = (−1, 7, −3, −5). Use L3
e e
norm.
3. Show that the following vectors are LD by expressing one of the vectors as a linear combination of
the others:
xT1 = (1, 0, 0), xT2 = (0, 1, 0), xT3 = (1, 1, 0), xT4 = (1, −1, 0)
e e e e
4. Determine if the following vectors are LI or LD. If they are LD, then give a linear relation among the
vectors:
xT1 = (2, 0, 1, 1, 0), xT2 = (1, 2, 0, 3, 1), xT3 = (4, −4, 3, −9, −2)
e e e
5. Find the eigenvalues and the eigenvectors of the following matrices. Computations must be done by
38
hand (step by step).
1 0 1 −1
−2 −1 1 −4 −4
A = 1 1 0 , B = 8 −11 −8 , C = 8 −11 −8
e e e
e 0 0 1 e −10 11 7 e −8 8 5
39
Chapter 3
Numerical foundation
df (x0 )
f (x0 + h) = f (x0 ) + h + R2 (x).
dx
Equation (3.2) is known as Newtons forward difference formula. The parameter h is referred to as the
difference parameter or perturbation. As a rule of thumb,
h = max{10−6 , 0.01x0 }.
Using the forward difference formula (3.2), the second derivative of f with respect to x evaluated at x0
40
can be expressed as
f 0 (x0 + h) − f 0 (x0 )
f 00 (x0 ) ≈ , (3.5)
h
where
f (x0 + h) − f (x0 )
f 0 (x0 ) ≈
h
and
f (x0 + 2h) − f (x0 + h)
f 0 (x0 + h) ≈ .
h
Then, (3.5) can be written as
Corresponding formulations can be also obtained for backward and central difference.
Example. Evaluate the numerical derivative of f (x) = x2 with respect to x in x0 = 10 using forward
difference. Using (3.2), this is
(10.1)2 −(10)2
f 0 (10) ≈ 0.1
≈ 20.1
where h is the difference parameter or perturbation. In (3.8) each variable is perturbed one at a time. As a
thumb rule,
h = max{10−6 , 0.01x0i }.
41
and the central difference formula is
∂f (x0 ) f (x01 , x02 , . . . , x0i + h/2, . . . , x0n ) − f (x01 , x02 , . . . , x0i − h/2, . . . , x0n )
e ≈ . (3.10)
∂xi h
Example. Numerically evaluate the gradient of f (x) = x21 − x1 x2 at xT0 = (10, 20) using forward differ-
e e
ence. From (3.8)
∂f (x0 )
∂xe1 ≈ f (10.1,20)−f
0.1
(10,20)
Example. Numerically evaluate the Hessian of f (x) = x21 − x1 x2 at xT0 = (10, 20) using forward differ-
e e
ence. From (3.11)
∂ 2 f (x0 )
f (10.2,20)−f (10.1,20)
∂x21
e ≈ 1
0.1 0.1 − f (10.1,20)−f
0.1
(10,20)
∂ 2 f (x0 )
f (10,20.4)−f (10,20.2)
∂x22
e ≈ 1
0.2 0.2 − f (10,20.2)−f
0.2
(10,20)
42
∂ 2 f (x0 )
f (10.1,20.2)−f (10,20.2)
∂x1 ∂x e
2
≈ 1
0.2 0.1 − f (10.1,20)−f
0.1
(10,20)
function [f,df,ddf]=ddfun(fun,x)
h=max(10ˆ(-6),10ˆ(-3)*x);
f=feval(fun,x);
df=Df(fun,x,h);
ddf=(Df(fun,x+h,h)-Df(fun,x,h))/h;
end
function [df]=Df(fun,x,h)
df=(feval(fun,(x+h))-feval(fun,x))/h;
end
This function returns the value of the function, the value of the first derivative, and the value of the second
derivative. Now, in the work space
>> x=-2*pi:0.01:2*pi;
>> [f,df,ddf]=ddfun(@(x) sin(x),x);
>> plot(x,f,’b’); hold on
>> plot(x,df,’r’)
>> plot(x,ddf,’g’)
The plots will show the function in blue, the first derivative in red, and the second derivative in green.
3.4.2 Gradient
The gradient of f (x) = x21 − 2x2 evaluate in xT0 = (1, 1) can be obtained analytically as
e e
!
2x1
∇f (x) =
e −2
43
so ∇T f (x0 ) = (2, −2). Numerically, a M ATLAB function to approximate the solution using central differ-
ence could
e be written as
function df=gfun(fun,x)
% central difference
for i=1:length(x)
h=max(0.001,0.01*x(i));
xp=x; xp(i)=xp(i)+h/2;
xn=x; xn(i)=xn(i)-h/2;
df(i)=(feval(fun,xp)-feval(fun,xn))/h;
end
end
function fx=myfun(x)
fx=x(1)ˆ2-2*x(2);
end
>> df=gfun(’myfun’,[1,1])
df = 2.0000 -2.0000
Smaller values of h give a better approximation. The command contour is used to represent the contour
plots of the function in the design space.
3.4.3 Hessian
Dear student, I will need your help to put something in this section. Thanks.
44
Exercises
1. Develop a M ATLAB function that returns a prescribed Lp norm, from L1 to L∞ . Hint: Use the
following syntax
normx=myfun(x,p)
2. Develop a M ATLAB function to determine if two input vectors are LI. Hint: Use the following syntax
lout=myfun(x1,x2)
3. Develop a function in M ATLAB to determine the gradient of a function f (x1 , x2 ) using forward dif-
ference, backward difference, and central difference derivatives. Compare your results with the ones
obtained by the exact (analytical) solution for f (x) = 2x1 x2 + sin(x1 x2 ). Use 10 discrete points in
the interval 0 ≤ xi ≤ π/2. Hint: Use the following e syntax
function gout=gfun(ffun,x)
where
function fx=ffun(x)
fx=2*x(1)*x(2)+sin(x(1)*x(2))
45
Part II
Single-variable optimization
46
Chapter 4
Analytical elements
min f (x)
x (4.1)
s.t. xL ≤ x ≤ xU ,
Example. Design a minimum-cost cylindrical refrigeration tank of volume 50 m3 . The circular ends cost
$10 per m2 . The cylindrical wall costs $6 per m2 . The cost to refrigerate is $80 per m2 over the useful life.
The total cost f is given by
πx2 πx2
f (x, L) = (10)(2) + (6)(πxL) + (80) 2 + πxL
4 4
= 45πx2 + 86πxL
where x is the diameter of the tank and L is the length. Since the volume is a constant, then
(50)(4) 200
L= 2
= .
πx πx2
17200
f (x) = 45πx2 + ,
x
where x > 0. The minimum cost of f (x∗ ) = 6560 is obtained for x∗ = 3.9329. Using M ATLAB, this can
be solved by
47
>> [xopt,fopt] = fminbnd(@(x) 45*pi*xˆ2+17200/x,0,1000)
xopt = 3.9329
fopt = 6.5601e+03
• x∗ is a weak local minimum point if f (x∗ ) ≤ f (x ± h) for all sufficiently small values of h.
• x∗ is a strict or strong local minimum point if f (x∗ ) < f (x ± h) for all sufficiently small values of h.
• x∗ is a weak or non-unique global minimum point if f (x∗ ) ≤ f (x) for all x in the domain of f .
• x∗ is a strict or unique global minimum point if f (x∗ ) < f (x) for all x in the domain of f .
The following example shows the importance of the closed interval [xL , xU ] in Rolle’s theorem.
Example. Let f (x) = −1/x defined in the interval Ω = {x ∈ R : x > 0}. This function is continuous
through Ω but there is no point in which f takes a minimum value.
48
4.3.2 First order necessary condition
Let f ∈ C 0 in the closed interval [xL , xU ] and f ∈ C 1 in the open interval (xL , xU ). Then the necessary
condition for x∗ ∈ (xL , xU ) to be a local minimum of f is given by
df (x∗ )
= 0. (4.2)
dx
This condition implies that the slope of f at x∗ is zero. The points that satisfy this condition are referred to
as stationary points. A stationary point can be a minimum, maximum, or inflection point. If the minimum
point is one of the bounds xL or xU , then (4.2) does not have to be satisfied.
The necessary condition in (4.2) can be demonstrated using Taylor series expansion about x∗ , this is
f (x + h) = f (x∗ ) + f 0 (x∗ )h
and
f (x − h) = f (x∗ ) − f 0 (x∗ )h.
and
f (x∗ − h) − f (x∗ ) ≥ 0 ⇒ f 0 (x∗ ) ≤ 0.
49
4.3.3 Second order sufficient conditions
Let f ∈ C 2 in the open interval (xL , xU ). Then the sufficient conditions for x∗ ∈ (xL , xU ) to be a strict
local minimum of f are given by (4.2) and
d2 f (x∗ )
> 0. (4.3)
dx2
This condition can be demonstrated using Taylor series expansion about x∗ , this is
1
f (x) = f (x∗ ) + f 0 (x∗ )(x − x∗ ) + f 00 (x∗ )(x − x∗ )2 + R2 (x).
2
1
f (x∗ ± h) = f (x∗ ) ± f 0 (x∗ )h + f 00 (x∗ )h2 .
2
which leads to
1 00 ∗ 2
f (x )h > 0
2
or simply, f 00 (x∗ ) > 0. If f 00 (x∗ ) = 0 no conclusion can be made about the type of stationary point.
1 (3) ∗ 3
f (x∗ ± h) = f (x∗ ) ± 0 + 0 ± f (x )h .
3!
If f (3) (x∗ ) 6= 0, then x∗ corresponds to a stationary or inflection point. If x∗ is local minimum, then
f (3) (x∗ ) = 0.
If f ∈ C 4 , then
1 (4) ∗ 4
f (x∗ ± h) = f (x∗ ) ± 0 + 0 ± 0 + f (x )h ,
4!
where the condition for x∗ to be a strict local minimum is satisfied if f (4) (x∗ ) > 0. It can be observed
that the sufficient optimality condition is satisfied for f ∈ C k+1 when f (k) (x∗ ) = 0 for k odd (necessary
condition) and f (k+1) (x∗ ) > 0. When f (k) (x∗ ) 6= 0 for k odd and k > 1, then x∗ corresponds to an
50
inflection point. In a weak maximum or minimum all derivatives of f vanish to zero.
Example. Determine if the stationary points of f (x) = x3 + 3x2 − 4 are minima, maxima, or inflection
points.
The stationary points of the functions are x∗1 = 0 and x∗2 = −2. The second derivative of f is
f 00 (x) = 6x + 6.
Evaluating the stationary point we see that f 00 (x∗1 ) = 6 > 0 and f 00 (x∗2 ) = −6 < 0. In conclusion, x∗1 is a
strict local minimum and x∗2 a strict local maximizer.
4.4 Convexity
4.4.1 Definition
A function f defined in a convex interval Ω ⊂ R is called convex function if for all x1 , x2 ∈ Ω the following
condition is satisfied:
Geometrically that means that the graph of the function f (x) lies below the straight line joining any two
points of the curve, f (x1 ) and f (x2 ). The function f is strictly convex if
f (αx1 + (1 − α)x2 ) < αf (x1 ) + (1 − α)f (x2 ), for 0 < α < 1. (4.5)
• f (x) = x log x in R+ .
• f (x) = xα in R+ , for 0 ≤ α ≤ 1.
• f (x) = log x in R+ .
51
4.4.2 Properties
1. If f ∈ C 1 then f is convex over a convex set Ω if and only if ∀x1 , x2 ∈ Ω,
This means that the function evaluated at x2 lies above the linear approximation of the function about
x1 evaluated in x2 .
f 00 (x) ≥ 0. (4.7)
3. If x∗ is a local minimum for a convex function f on a convex set Ω, then it is also a global minimum.
Replacing x1 = x∗ in item 1, you can see that f (x2 ) ≥ f (x∗ ), ∀x2 ∈ S which shows that the local
minimum is a global minimum. Even more, a point that satisfies the necessary f 0 (x∗ ) = 0 is a global
minimum.
4.5 Unimodality
A function f is said to be unimodal in an interval Ω ⊂ R if it exists one and only one valley point x∗ ,
referred to as the mode, and for all x1 , x2 ∈ Ω the following conditions are satisfied:
In other words, f strictly decreases for all x < x∗ and strictly increases for all x > x∗ in Ω. By
extension, a multimodal function is the one that contains more than one mode or valley.
Observe that a unimodal function is not always convex, and a convex function is not always unimodal.
However, a strictly convex function that contains the minimum point in the open interval Ω is also unimodal.
Example. The function f (x) = |x|1/2 defined in R is unimodal with a single valley at x∗ = 0. This
function is not convex.
In this case, since f ∈ C 1 for all x > 0 and for all x < 0, the unimodality can be proven as f 0 (x) > 0
for all x > 0 and f 0 (x) < 0 for all x < 0. Furthermore, since f ∈ C 2 for all x > 0 and all x < 0, the
concavity can be proven as f 00 (x) < 0 for all x > 0 and all x < 0.
Exercises
1
1. Show that the strict global maximizer of f (x) = x x is x∗ = e.
52
2. Show that the strict global maximizer of f (x) = xx is x∗ = 1e .
3. Prove that a function f in a convex set Ω is a convex function if and only if f 00 (x) ≥ 0 for all x ∈ Ω.
4. Prove that in a convex function defined in a convex set a local minimum is a global minimum. Is it a
strict global minimum?
5. Consider the function f (x) = x2 in the closed interval [3, 5]. Is this function convex? Is it unimodal?
53
Chapter 5
Numerical methods to locate the minimum point of a function of a single variable comprise two stages:
bracketing and interval reduction. Bracketing consists on establishing a unimodal interval that contains the
minimum point. In general, three points are required to establish the unimodality of the function. These
three points form what is referred to as a three-point pattern.
In the second stage, the interval is reduced so the minimum is located with a desired tolerance. Meth-
ods for interval reduction define intervals around the minimum in which the function remains unimodal.
These methods may use Fibonacci’s series, Golden ratio, or polynomial approximations. The most com-
mon polynomial methods make use of quadratic approximations. Among these ones, the two better known
approaches are Brent’s and Powell’s method.
A different approach to single-variable optimization is to find the point in which the function’s derivative
vanishes to zero. These methods include Newton’s, secant, and bisection methods.
5.1.2 Algorithm
The bracketing step algorithm is as follows:
54
Step 2. Evaluate f1 = f (x1 ) and f2 = f (x2 ).
Step 3. If f2 ≤ f1 , go to Step 5.
Step 5. Increase the step size, h = γh, find the third point, x3 = x2 + h and obtain f3 = f (x3 ).
Step 8. The points x1 , x2 y x3 satisfy the three-point pattern condition, f1 ≥ f2 < f3 or f1 > f2 ≤ f3 .
The second stage is to reduce the interval to locate the minimum. Classic interval reduction methods are
Fibonacci’s method, Golden section method, and polynomial methods.
Example. Bracket a three-point pattern for f (x) = |x − 5| starting at x = 10 and using h = 0.5 and γ = φ.
• Since f3 > f2 then the points x1 = 7.8820, x2 = 5.7641, and x3 = 2.3374 satisfy the three-point
pattern condition.
55
Table 5.1: Bracketing f (x) = |x − 5| from x = 10 and using h = 0.5 and γ = φ.
k h x f
0 10.5000 5.5000
1 −0.5000 10.0000 5.0000
2 −0.8090 9.1910 4.1910
3 −1.3090 7.8820 2.8820
4 −2.1179 5.7641 0.7641
5 −3.3374 2.3374 2.6626
of rabbits in a place surrounded on all sides by a wall. How many pairs of rabbits can be produced from
that pair in a year if it is supposed that every month each pair begets a new pair which from the second
month on becomes productive? Every month a new pair of rabbit offspring matures. Each mature couple
delivers two offspring in a month and the couple remains mature. Assuming that the rabbits never die and
do not lose their fertility, and the offspring are always couples (male and female), one obtains the Fibonacci
sequence:1, 1, 2, 3, 5, 8, 13, 21, . . . . In this sequence the numbers represent the number of couples at the end
of every month. The Fibonacci numbers are denoted as F0 , F1 , F2 , . . . , Fk , . . . , and the sequence can be
generated using the following formula
where F0 = 1 and F1 = 1.
Let us assume an interval of length I1 defined by three points, x1 , x2 and x4 that satisfy the three-point
pattern, f1 ≥ f2 < f4 . Now, introduce a fourth point, x3 , such that the distance between x1 and x3 is the
same as the distance between x2 and x4 . In other words, x2 and x3 are symmetric with respect to the center
of the interval [x1 , x4 ]. Evaluate f3 and compare with f2 . If f2 < f3 then x1 , x2 and x3 define the new
interval. If f2 > f3 then the new interval will be defined by x2 , x3 and x4 . Now, if f2 = f3 you define the
interval in either way. The length of the new interval will be reduced to I2 .
Adding a fourth point to the new interval and repeating the whole procedure, one would obtain an
interval of length In after n − 1 iterations. In the last iteration, the two possible intervals will overlap by a
small distance ε. This distance defines the required precision in the location of the minimum. The interval
56
relations followed from this procedure can be expressed as
I1 = I2 + I3
I2 = I3 + I4
..
.
Ik = Ik+1 + Ik+2 (5.2)
..
.
In−2 = In−1 + In
In−1 = 2In − ε.
Disregarding ε and replacing from bottom to top, one can see that
In−1 = 2In
In−2 = 3In
In−3 = 5In
(5.3)
In−4 = 8In
..
.
I1 = Fn In .
where the coefficients are the Fibonacci numbers. Using (5.1), one obtains
this is,
I1 = Fn In
I2 = Fn−1 In
.. (5.5)
.
In−1 = F2 In .
From (5.5) it can be observed that the length In of the final interval after n − 1 iterations is
I1
In = . (5.6)
Fn
Fn−1
I2 = I1 . (5.7)
Fn
57
From (5.2) one observes that
I3 = I1 − I2
I4 = I2 − I3
.. (5.8)
.
In = In−2 − In−1 .
Example. Consider the interval [0, 10]. Determine n such that In ≤ 0.1.
From (5.6) one obtains
1 0.1
< ;
Fn 10
this is, Fn > 100. Using Fibonacci sequence, F0 = 1, F1 = 1, F2 = 2, F3 = 3, F4 = 5, F5 = 8, F6 = 13,
F7 = 21, F8 = 34, F9 = 55, F10 = 89, F11 = 144, one obtains that n = 11. In other words, 10 iterations
(k = 10) will be required to obtain the required final interval.
Example. Reduce the initial interval I1 defined in [0, 1] with the Fibonacci method using n = 5.
F4 5
• The first interval reduction (k = 1) is I2 = F5 I1 = 8 in {0, 38 , 58 , 1}.
• For the second interval reduction (k = 2) let us pick the interval on the right, {0, 38 , 85 }. Now, I3 =
F3 3
F4 I2 = I1 − I2 = 8 defines {0, 82 , 38 , 58 }.
F2
• For the third interval reduction (k = 3), let us pick {0, 28 , 38 }. Now, I4 = F3 I3 = I2 − I3 = 2
8 defines
1 2 3
{0, 8 , 8 , 8 }.
F1
• For the fourth and final interval reduction (k = 4), let us pick {0, 81 , 28 }. Now, I5 = F2 I4 = I3 − I4 =
1 1 1 2
8 defines {0, 8 , 8 , 8 }. Since the two middle points are repeated, then one of them is shifted using a
small perturbation parameter ε, for example
ε = max{10−6 , 0.001I1 }.
For a large number of iterations, it might be useful to use Binet’s formula (derived in 1843) for Fibonacci
numbers,
√ !k+1 √ !k+1
1 1+ 5 1− 5
Fk = √ − . (5.9)
5 2 2
Example. A M ATLAB function that returns the i-th Fibonacci number can be written as
function Fk=fib(k)
Fk=floor((1/sqrt(5))*(((1+sqrt(5))/2)ˆ(k+1)-((1-sqrt(5))/2)ˆ(k+1)));
In the workspace it is possible to identify the number of iterations required to locate a minimum with a
tolerance of ε = 10−6 ,
58
>> f=1; k=0;
>> while f>10ˆ(-6)
f=1/fib(k);
k=k+1;
end
>> f = 7.4279e-07
>> k = 31
5.2.2 Algorithm
Fibonacci algorithm can be written like that:
Step 2. Specify the size of the final interval In . If In is given, find the smallest number n such that I1 /Fn ≤
In .
Step 3. Set k = 1. Determine I2 = (Fn−1 /Fn )I1 and α = I2 /I1 . Introduce the point x2 , such that
x2 = αx1 + (1 − α)x4 , and evaluate f2 .
Step 4. Introduce the point x3 , such that x3 = αx4 + (1 − α)x1 , and evaluate f3 .
Step 9. Since (x2 , f2 ) = (x3 , f3 ), set α = α + ε, x3 = αx4 + (1 − α)x1 , and evaluate f3 . If f2 < f3 the
final is [x1 , x3 ], otherwise the final interval is [x2 , x4 ]. The shifting parameter ε is a fraction of the
final interval, e.g., ε = 0.1In .
Example. Minimize the function f (x) = (x − 7)2 in the interval [0, 10] by the Fibonacci method using
n = 5.
The initial interval is defined for I1 = 10 between x1 = 0 and x4 = 10 with corresponding f1 = 49
I1 10
and f4 = 9. The final interval corresponds to I5 = F5 = 8 = 1.25. Let us review the interval reduction
procedure:
F4 I2 6.25
• For k = 1, I2 = F5 I1 = 6.25 and α = I1 = 10 = 0.6250. Then x2 = αx1 + (1 − α)x4 = 3.75
with corresponding f2 = 10.5625. Now, let us introduce x3 = αx4 + (1 − α)x1 = 6.25 with
correspondingf3 = 0.5625. Since f2 > f3 then the new interval will be defined by (x1 , f1 ) =
(3.75, 10.5625), (x2 , f2 ) = (6.25, 0.5625), and (x4 , f4 ) = (10, 9).
59
I3 3.75
• For k = 2, I3 = I1 − I2 = 3.75 and α = I2 = 6.25 = 0.6. Then, (x3 , f3 ) = (7.5, 0.25). Since
f3 < f2 then (x1 , f1 ) = (6.25, 0.5625), (x2 , f2 ) = (7.5, 0.25) and (x4 , f4 ) = (10, 9).
I4
• For k = 3, I4 = I2 − I3 = 2.5 and α = I3 = 0.6667. Then (x3 , f3 ) = (8.75, 3.0625). Since f2 < f3
then (x4 , f4 ) = (6.25, 0.5625), (x1 , f1 ) = (8.75, 3.0625), and (x2 , f2 ) = (7.5, 0.25).
I5
• For k = 4, I5 = I3 − I4 = 1.25 and α = I4 = 0.5. Then (x3 , f3 ) = (7.5, 0.25). Observe that
(x2 , f2 ) = (x3 , f3 ).
• For k = 5, and ε = 0.01, then α = 0.51, x3 = 7.4750, and f3 = 0.2256. Since f2 > f3 , the interval
that contains the minimum point is [6.25, 7.50].
Table 5.2: Minimization of f (x) = (x − 7)2 using the Fibonacci method for n = 5.
k Ik α x1 , f1 x2 , f2 x3 , f3 x4 , f4
1 10.0000 0.6250 0.0000, 49.0000 3.7500, 10.5625 6.2500, 0.5625 10.0000, 9.0000
2 6.2500 0.6000 3.7500, 10.5625 6.2500, 0.5625 7.5000, 0.2500 10.0000, 9.0000
3 3.7500 0.6667 6.2500, 0.5625 7.5000, 0.2500 8.7500, 3.0625 10.0000, 9.0000
4 2.5000 0.5000 8.7500, 3.0625 7.5000, 0.2500 7.5000, 0.2500 6.2500, 0.5625
5 1.2500 0.5100 8.7500, 3.0625 7.5000, 0.2500 7.4750, 0.2256 6.2500, 0.5625
I1 I2
= = φ,
I2 I3
where φ is the golden ratio. Substituting I1 = φI2 and I2 = φI3 into I1 = I2 + I3 yields
φ2 − φ − 1 = 0. (5.10)
60
The positive root of this polynomial is
√
1+ 5
φ= = 1.6180339887498948482045 . . . , (5.11)
2
1
which is the irrational number that defines the golden ratio. Note that φ = φ − 1. Customary, the inverse of
φ is denoted as Φ,
1
Φ= = 0.6180339887498948482045 . . .
φ
In the interval reduction strategy using this approach the ratio between two consecutive intervals is
always constant and, therefore, equal to the golden ratio. This relation can described by
I1 = I2 + I3
..
.
Ii = Ii+1 + Ii+2 (5.12)
..
.
In−2 = In−1 + In
and
I1 I2 Ik In−1
= = ··· = = ··· = = φ. (5.13)
I2 I3 Ik+1 In
Observe that
I2 = ΦI1
I3 = Φ 2 I1
I4 = Φ 3 I1 (5.14)
..
.
In = Φn−1 I1 ,
which describes the size of the final interval In . For a given initial and final interval sizes, I1 and In , the
number of interval reductions n can be expressed as
ln In − ln I1
n = int 1.5 , (5.15)
ln(1 − φ)
5.3.2 Algorithm
The golden section algorithm can be written like that:
61
Step 3. Set k = 1. Introduce the point x2 , such that x2 = Φx1 + (1 − Φ)x4 , and evaluate f2 .
Step 4. Introduce the point x3 , such that x3 = Φx4 + (1 − Φ)x1 , and evaluate f3 .
Example. Minimize the function f (x) = 2−4x+exp(x) in the interval [0.5, 2.6180] by the golden section
method. Find the minimum point within a tolerance of ε = 0.001.
Using (5.15), the number of interval reductions to achieve In ≤ 0.001 from I1 = 2.1180 is n = 17. The
results are presented in Table 5.3. For illustration, let us show the first three iterations.
• For k = 1, I1 = 2.1180, (x1 , f1 ) = (0.5000, 1.6487) and (x4 , f4 ) = (2.6180, 5.2366). Introducing
x2 = Φx1 + (1 − Φ)x4 , then (x2 , f2 ) = (1.3090, 0.4665). Introducing x3 = Φx4 + (1 − Φ)x1 ,
then (x3 , f3 ) = (1.8090, 0.8684). Since f2 < f3 , (x4 , f4 ) = (0.5000, 1.6487) and (x1 , f1 ) =
(1.8090, 0.8684).
• For k = 2, I2 = 1.3090, (x3 , f3 ) = (1.0000, 1.6487). Since f2 < f3 , (x4 , f4 ) = (1.8090, 0.8684)
and (x1 , f1 ) = (1.0000, 1.6487).
• For k = 3, I3 = 0.8090, (x3 , f3 ) = (1.5000, 0.4817). Since f2 < f3 , (x4 , f4 ) = (1.0000, 1.6487)
and (x1 , f1 ) = (1.5000, 0.4817).
Table 5.3: Interval reduction using golden section method for In ≤ 0.001, n = 17.
k Ik x1 , f1 x2 , f2 x3 , f3 x4 , f4
1 2.1180 0.5000, 1.6487 1.3090, 0.4665 1.8090, 0.8684 2.6180, 5.2366
2 1.3090 1.8090, 0.8684 1.3090, 0.4665 1.0000, 1.6487 0.5000, 1.6487
3 0.8090 1.0000, 0.7183 1.3090, 0.4665 1.5000, 0.4817 1.8090, 0.8684
.. .. .. .. .. ..
. . . . . .
17 0.0009 1.3860, 0.4582 1.3864, 0.4548 1.3870, 0.4548
62
Chapter 6
fQ (x) = a0 + a1 x + a2 x2 , (6.1)
where a0 , a1 , and a2 are unknown coefficients. Given three points, x1 , x2 , and x3 , one can determine the
three unknown coefficients from
f (x1 ) = a0 + a1 x1 + a2 x21
f (x2 ) = a0 + a1 x2 + a2 x22
f (x3 ) = a0 + a1 x3 + a2 x23 .
In matrix form,
1 x1 x21 a0 f (x1 )
1 x2 x22 a1 = f (x2 ) .
1 x3 x23 a2 f (x3 )
Solving the system of linear equations,
1 f (x3 ) − f (x1 ) f (x2 ) − f (x1 )
a2 = − (6.2)
x3 − x2 x3 − x1 x2 − x1
f (x2 ) − f (x1 )
a1 = − a2 (x1 + x2 ) (6.3)
x2 − x1
a0 = f (x1 ) − a1 x1 − a2 x21 . (6.4)
The minimum x∗Q of the quadratic approximation fQ is a good approximation of the minimum x∗ of
63
0 (x∗ ) = 0 and the sufficient condition
the function f . This minimum satisfies the necessary conditionfQ Q
00 (x∗ ) > 0. This point is defined as
fQ Q
a1
x∗Q = − , (6.5)
2a2
00 (x∗ ) = 2a > 0. Evaluating f (x∗ ) will establish a criterion to select a reduced interval that
where fQ Q 2 Q
satisfies the three-point pattern.
6.1.2 Algorithm
The algorithm to reduce the interval using Powell’s method is the following:
Step 1. Set k = 1. Specify the three-point pattern interval defined by x1 , x2 , and x3 with respective function
values f (x1 ), f (x2 ), and f (x3 ).
Step 2. Determine a1 and a2 using (6.3) and (6.2). Then introduce x∗Q using (6.5) and evaluate f (x∗Q ).
(a) If f (x2 ) < f (x∗Q ) then x1 < x∗ < x∗Q and the new interval is defined as x1 = x1 , x2 = x2
and x3 = x∗Q .
(b) If f (x2 ) > f (x∗Q ) then x2 < x∗ < x3 and the new interval is defined as x1 = x2 , x2 = x∗Q
and x3 = x3 .
(a) If f (x2 ) < f (x∗Q ) then x∗Q < x∗ < x3 and the new interval is defined as x1 = x∗Q , x2 = x2
and x3 = x3 .
(b) If f (x2 ) > f (x∗Q ) then x1 < x∗ < x2 and the new interval is defined as x1 = x1 , x3 = x2
and x2 = x∗Q .
where ∆x∗Q and ∆f (x∗Q ) represent the variations of the minimum and its image in two consecutive itera-
tions.
64
Example. Minimize f (x) = 2 − 4x + exp(x) in the interval [0.5000, 2.6180] by Powell’s method. For
illustration, let us show the first two iterations.
1. For k = 1, the initial points correspond to (x1 , f1 ) = (0.5000, 1.6487), (x3 , f3 ) = (2.6180, 5.2366).
Let us introduce (x2 , f2 ) = (1.3090, 0.4665). The coefficients of the quadratic approximation are,
a2 = 2.4100 and a1 = −5.8210. Therefore, x∗Q = 1.2077 and fQ
∗ = 0.5149. The new interval will
be defined by (x1 , f1 = 1.2077, 0.5149), (x2 , f2 ) = (1.3090, −7.8339), and (x3 = 2.6180, 5.2366)
2. For k = 2, the updated coefficients of the quadratic approximations are a2 = 2.9228 and a1 =
−7.8339. The new solution is x∗Q = 1.3401 and fQ
∗ = 0.4590. The final interval is [1.2077, 1.3401].
For this problem, one can prove that five iterations of Powell’s method give a solution as precise as the
one obtained from 17 iterations of the golden section method.
6.2.2 Algorithm
The algorithm can be written as
Step 1. Specify the three-point pattern interval {x1 , x2 , x5 } with images {f1 , f2 , f5 }, f1 ≥ f2 < f5 or
f1 > f2 ≤ f5 .
Step 4. Estimate x∗Q using golden section method of the larger of the two intervals [x1 , x2 ] or [x2 , x3 ]. Go
to Step 7.
Step 5. Try quadratic fit for x2 , x3 and x4 . If the quadratic minimum is likely to fall inside [x1 , x5 ] then
determine the minimum of this approximation,
65
Step 6. If the point x∗Q is to close to x1 , x2 or x5 then adjust x∗ into the larger of [x2 , x1 ] or [x2 , x5 ] such
that it is away from x2 by a minimum distance ε chosen on the basis of machine tolerance.
Step 9. If the length of intervals [x1 , x2 ] and [x2 , x5 ] are less than 2ε, then termination is satisfied. Other-
wise, go to 3.
6.3.1 Description
Suppose that we are confronted with the problem of minimizing f . Assuming that f ∈ C 2 , the quadratic
approximation of the function about a given point xk has the form
1
fQ (x) = f (xk ) + f 0 (xk )(x − xk ) + f 00 (xk )(x − xk )2 .
2
Instead of minimizing f we minimize its quadratic approximation fQ . The necessary condition yields
0
fQ (x) = f 0 (xk ) + f 00 (xk )(x − xk ) = 0.
00
fQ (x) = f 00 (xk ) > 0.
6.3.2 Algorithm
Step 1. Given x1 , set k = 1.
66
f 0 (xk )
Step 3. Obtain xk+1 = xk − f 00 (xk ) .
1 2
Example. Minimize f (x) = 2x − sin(x) by Newton’s method using x1 = 0.5. For illustration, let us
show the first seven iterations.
1. For k = 1, f 0 (x1 ) = −0.3776 and f 00 (x1 ) = 1.4794. The new point is x2 = 0.7552.
2. For k = 2, f 0 (x2 ) = 0.0271 and f 00 (x2 ) = 1.6854. The new point is x3 = 0.7391.
3. For k = 3, f 0 (x3 ) = 0.0001 and f 00 (x3 ) = 1.4794. The new point is x4 = 0.7391.
Observe that it only took three iterations to find the minimum within a reasonable tolerance.
6.3.3 Extension
Newton’s method can also be used as a zero-finder algorithm. Indeed, if we set g(x) = f 0 (x), then we
obtain the formula relative to g(x) = 0,
g(xk )
xk+1 = xk − . (6.12)
g 0 (xk )
Observe that this expression can be also obtained from a linear approximation of g about xk evaluated at
xk+1 . For this reason, this method is also known as Newton’s method of tangents.
Example. Find the root of the following function using Newton’s method from the point x0 = 1.0,
2x
g(x) = − sin x = 0.
3
2
g 0 (x) = − cos x.
3
67
Table 6.1: Iterations using Newton’s method, f (x) = 2x/3 − sin x, ε = 0.001
k xk fk fk0
0 1.000 -0.175 0.126
1 2.383 0.900 0.139
2 1.737 0.172 0.832
3 1.530 0.021 0.626
4 1.496 0.000
Newton’s method of tangents may fail if the first approximation to the root is such that the ratio
g(xk )/g 0 (xk ) is not small enough. Thus, an initial approximation to the root is very important.
f 0 (xk ) − f 0 (xk−1 )
f 00 (xk ) ≈ . (6.13)
xk − xk−1
If f 00 (xk ) ≤ 0 this algorithm does not converge in a minimum. Using (6.13) in (6.9) yields
xk − xk−1
xk+1 = xk − f 0 (xk ), (6.14)
f 0 (x 0
k ) − f (xk−1 )
which defines the secant method. Note that this method requires two initial points x0 and x1 . Also observe
that, like Newton’s method, the secant method does not directly involve values of f . Instead, it tries to drive
the derivative f 0 to zero.
6.4.2 Algorithm
Step 1. Given x1 , set k = 1.
68
In this method, useful termination criteria are
1 2
Example. Minimize f (x) = 2x − sin(x) by the secant method using x0 = 0.5 and x1 = 0.75. For
illustration, let us show the first three iterations.
0.75 − 0.5
x2 = 0.75 − (0.01831) = 0.7384.
0.01831 − (−0.3776)
−0.0011 − 0.01831
x3 = 0.7384 − (−0.0011) = 0.7391.
0.7384 − 0.75
Observe that it only took three iterations to find the minimum within a small tolerance.
6.4.3 Extension
The secant method can be used as a zero-finder algorithm to solve for equations of the form g(x) = 0.
Approximating the derivative of this function,
g(xk ) − g(xk−1 )
gk0 ≈ ,
xk − xk−1
xk − xk−1
xk+1 = xk − g(xk ). (6.17)
g(xk ) − g(xk−1 )
Example. Perform two iterations of the secant method to find the root of the function
starting from x−1 = 13 and x0 = 12. Using (6.17) we obtain x1 = 11.40 and x2 = 11.25.
69
6.5 Bisection method
6.5.1 Description
Assuming that f 0 (x) is available for every x, then the bisection method may be used to locate the root of
f 0 (x) = 0. This method makes use of an interval [x1 , x3 ] such that f 0 (x1 ) and f 0 (x2 ) are opposite in sign.
Then, the algorithm introduces a third point
x2 = 0.5(x1 + x3 )
right in the middle of [x1 , x3 ], and evaluates f 0 (x2 ). If the sign of f 0 (x2 ) is opposite to the sign of f 0 (x1 ),
then the interval is reduced to [x1 , x2 ]. If the sign of f 0 (x2 ) is opposite to the sign of f 0 (x3 ), then the interval
is reduced to [x2 , x3 ]. The process continues until the termination criteria are satisfied.
6.5.2 Algorithm
Step 1. Given x1 and x3 , such that x1 < x3 , determine f 0 (x1 ) and f 0 (x3 ) and verify that f 0 (x1 ) < 0 and
f 0 (x3 ) > 0. Set k = 1.
1 2
Example. Minimize f (x) = 2x − sin(x) by the bisection method using x1 = 0.5 and x3 = 5.5. For
illustration, let us show the first five iterations.
1. For k = 1, the initial interval is x1 = 0.5 and x3 = 5.5 with f 0 (x1 ) = −0.3776 < 0, f 0 (x3 ) =
4.7913 > 0. Let us introduce x2 = 3.0 and evaluate f 0 (x2 ) = 4.0000.
70
3. For k = 3, x1 = 0.5000 and x3 = 1.7500. Then, x2 = 1.1250 with f 0 (x2 ) = 0.6938.
Observe that the rate of termination of this method is considerably lower than the one of previous
derivative-based methods.
6.5.3 Extension
The bisection method is widely used as a zero-finder algorithm to solve for equations of the form g(x) = 0.
Example. Using the bisection method, determine the root of the following function
g(x) = x2 − 4 = 0,
Exercises
1. Prove that the ratio between two Fibonacci numbers can be written as
√ !
1 − si
Fi−1 5−1
= , i = 2, 3, . . . , n
Fi 2 1 − si+1
71
where √
1− 5
s= √
1+ 5
2. A string of length 1 m is used to make a rectangle. Determine the size of the rectangle with maximum
area.
3. A string of length 1 m is used to delimit an area by shaping it as a polygon in which all sides have the
same length. Determine the number of sides of the polygon of maximum area.
4. Two discs, of diameters 1 m and 2 m, are to be placed inside a rectangle. Determine: (i) the size of
the rectangle with minimum perimeter, (ii) the size of the rectangle with minimum area.
5. Three discs, each of diameter 1 m are to be placed inside a rectangle. Determine: (i) the size of the
rectangle with minimum perimeter, (ii) the size of the rectangle with minimum area.
6. An open box is made by cutting out equal squares from the corners, bending the flaps, and welding
the edges of a sheet of metal of size H × L. Determine the box dimension of maximum volume.
7. An open box is made by cutting out equal squares from the corners, bending the flaps, and welding
the edges of a sheet of metal of size 8.500 × 1000 . Every cubic inch of volume of the open box brings in
a profit of $ 0.10. Every square inch of corner waste results in a cost of $ 0.04. Every inch of welding
length costs $ 0.02. Determine the box dimensions of maximum profit.
8. A part is produced on a lathe in a machine shop. The cost of the part includes machining cost, tool-
related cost, and cost of the idle time. The cost for the machining time is inversely proportional to the
cutting speed V m/min. The tool-related costs are proportional to V 3/2 . The cost c in dollars is given
by
240
c(V ) = + 10−4 V 1.5 + 0.45.
V
Determine the cutting speed for minimum cost and the corresponding minimum cost.
9. In a solution of potassium (K) and chlorine (Cl), the equilibrium distance r in nanometers between
two atoms is obtained as the minimum of the total energy E. The total energy is given by the sum of
the energy of attraction and the energy of repulsion. The total energy in electron volts (eV) is given
by
1.44 5.9 × 10−6
E(r) = − +
r r9
Determine the equilibrium spacing and the corresponding energy.
72
Chapter 7
Numerical Analysis
7.1 Convergence
From Binmore (1982), a sequence of real numbers
{xk }∞
k=0 = {x0 , x1 , . . . , x∞ }
is said to converge to the limit x∗ if and only if the following criterion is satisfied: Given any ε > 0, there is
a (natural) number N such that for any number k > N , |xk − x∗ | < ε.
1
xk = 1 + .
k
1
lim 1 + = 1.
k→∞ k
Evidently this limit problem can be solved using l’Hôpital’s rule; however, let us used the definition of
convergence. From this definition, there should be a number N such that for any k > N ,
1
1+ − 1 < ε.
k
Since,
1 + 1 − 1 = 1 = 1 < ε
k k k
then
1
k> = N.
ε
73
For each ε > 0 one obtains a different N . For example, if ε = 0.1 then N = 10.
x0
x1 = g(x0 )
..
.
xm = g(xm−1 )
xm+1 = g(xm )
..
.
If all goes well, the sequence {xk } convergences to the optimum point x∞ = x∗ where
x∗ = g(x∗ ). (7.2)
In this case, x∗ is referred to as a fixed point of the function g and (7.1) is called a fixed point iteration.
A fixed point is a solution of the equation x = g(x). Geometrically, the fixed points of a function g are the
points of intersection of the curve y = g(x) and y = x.
x2
1+x− −x=0
3
√
or x∗ = ± 3 ≈ ±1.73205.
Example. Consider the minimization of f (x) = 12 x2 − sin(x) by Newton’s method in the interval [−3, 3].
Determine the fixed point of the corresponding fixed point iteration.
74
The fixed point iteration of Newton’s method is
f 0 (x)
g(x) = x − .
f 00 (x)
This is
x − cos(x)
g(x) = x − .
1 + sin(x)
The fixed point of g satisfy that
x − cos(x)
x=x− .
1 + sin(x)
Solving numerically, the solution of this equation is x∗ ≈ 0.739085, which also corresponds to the minimum
point of the function f .
The greatest lower bound for L is called the Lipschitz constant for g on Ω. If g has a Lipschitz constant
L < 1, then g is a contraction on Ω. Any function that satisfies a Lipschitz condition is continuous.
Lipschitz condition (7.3) can be expressed as
|g(x1 ) − g(x2 )|
≤ L.
|x1 − x2 |
If g ∈ C 1 in the closed interval [x1 , x2 ], then the Mean Value Theorem states that there is a point x ∈
[x1 , x2 ], i.e., x = αx1 + (1 − α)x2 for some value α ∈ [0, 1], such that
|g(x1 ) − g(x2 )|
= g 0 (x).
|x1 − x2 |
75
On the other hand, if |g 0 (x)| > 1 for all x ∈ (x∗ − h, x∗ + h), then the iteration xk+1 = g(xk ) will not
converge to x∗ . In this case x∗ is said to be a repelling fixed point and the iteration exhibits local divergence.
x2
g(x) = 1 + x − .
3
2x
g 0 (x) = 1 − .
3
76
and
|x∗ − xk+1 | ≤ Ck |x∗ − xk | ,
then it is said that the sequence {xk } converges superlinearly to the fixed point x∗ .
Under some circumstances one can construct iteration functions g for which successive substitutions
converges with order p ≥ 2. In a trivial case, if for all p > 0,
|xk+1 − x∗ |
lim = 0,
k→∞ |xk − x∗ |p
then we say that the order of convergence is ∞. This is the case in which all the values of the sequence are
the same.
The order of convergence p can be interpreted in terms of decimal places of accuracy. If |x∗ − xk | =
10−q , then |x∗ − xk+1 | ≤ C × 10−pq . For example, if |εk | = 103 and p = 2, then |εk+1 | = C × 10−6 .
The order of convergence of an algorithm can be checked using a convergence plot. If the fixed point x∗
is known, one can compute the sequence of errors εk = x∗ − xk . From (7.5),
Then the order of convergence can be obtained from the slope of the curve log |εk+1 | versus log |εk |. If the
function g is a contraction on some interval, then the convergence is at least linear.
|xk+1 | 1/(k + 1) kp
= = .
|xk |p 1/k p k+1
If p < 1, the above sequence convergences to 0, whereas if p > 1, it grows to ∞. If p = 1, the sequence
converges to 1. Hence, the order of convergence is 1.
|xk+1 | 0
= p =0
|xk |p 0
|xk+1 | αk+1
= = αk+1−kp .
|xk |p (αk )p
If p < 1, the above sequence converges to 0, whereas if p > 1 it grows to ∞. If p = 1 the sequence
converges to α. Hence the order of convergence of is 1.
77
Exercises
1. (From K.G. Binmore, Mathematical analysis: a straightforward approach) Prove that
k2 − 1
lim = 1.
k→∞ k2 + 1
prove that
lim αxk = αx∗ .
k→∞
5. (From J.H. Mathews, Numerical Methods for Mathematics, Science and Engineering) Find the fixed
points and determine local convergence or divergence for the following fixed point iterations:
√
• g(x) = 2x
8
• g(x) = x+2
x2 x
• g(x) = 4 + 2
2
• g(x) = − x4 − x
2 +4
78
Part III
79
Chapter 8
Analytical elements
min f (x)
x e (8.1)
e
s.t. x ∈ Ω,
e
where f is a scalar function f : Rn → R of n variables x = (x1 , . . . , xn )T , and Ω ⊂ R is the feasible space.
It is said that x∗ minimizes f if f (x∗ ) ≤ f (x) for all x ∈ Ω. A completely unconstrained optimization prob-
e
lem corresponds to the case in which Ω = Rn . However, the theory presented in this chapter is applicable
e e e e
Example. Two frictionless bodies A and B with unidimensional displacement are connected by three linear
springs. The first spring with spring constant k1 connects body B to the wall. The second spring with spring
constant k2 connects body A to the wall, and the third spring with spring constant k3 connects body A
and body B. Consider that the springs are in their natural position. Find the displacements x1 and x2 of
the bodies A and B under a static force P applied on body B. State the optimization problem using the
principle of minimum potential energy.
The potential energy of the system is given by Π = U − W , where U is the internal (strain) energy and
W is the work of the external force. The optimization problem can be stated as
where
1 1 1
U (x) = k2 x21 + k3 (x2 − x1 )2 + k1 x22
e 2 2 2
80
and
W (x) = P x2 .
e
Let us assume that every component of the vector y is zero except at the k-th position, i.e., y = (0, . . . , yk , . . . , 0)T .
Then (8.3) can be simplified as e e
∂f (x∗ )
h e yk ≥ 0.
∂xk
Since h is assumed positive and yk is unrestricted in sign, the only solution to this equation is
∂f (x∗ )
e = 0,
∂xk
81
Example. Determine the stationary points of
1
f (x) = x1 + + 2x2 .
e x1 x2
Equating ∇f (x) = 0 yields x∗1 = 1.2599 and x∗2 = 0.6300. This solution can be proven using M ATHEMAT-
ICA : e e
1
f (x) = x1 + + 2x2 .
e x1 x2
82
Also, determine if they are minima, maxima, or saddle points.
The Hessian of f (x) is !
2x2
1
e
2 1 x1
∇ f (x) = 2 2 2x1
.
e x1 x2 1 x2
Evaluating x∗ = (1.2599, 0.6300)T , one observes that ∇2 f (x∗ ) is positive definite. This can be observed
using Sylvester’s
e test or the eigenvalue test. Therefore, x∗ isea strict local minimum. This solution can be
proven using M ATHEMATICA: e
8.3 Convexity
8.3.1 Definition
A set Ω ⊂ Rn is convex if ∀x1 , x2 ∈ Ω and ∀α ∈ R, 0 ≤ α ≤ 1, the point αx1 + (1 − α)x2 ∈ Ω. In other
e e e e
words, Ω is convex if every point in the line segment joining any two points in Ω is also in Ω.
83
A function f defined in a convex set Ω is convex if for all x1 , x2 ∈ Ω, and for all α ∈ R, 0 ≤ α ≤ 1,
e e
there holds
f (αx1 + (1 − α)x2 ) ≤ αf (x1 ) + (1 − α)f (x2 ). (8.5)
e e e e
8.3.2 Properties
1. If f ∈ C 1 , then f is convex in Ω if and only if
f (x) = x1 x2
e
in S = {(x1 , x2 )T ∈ R2 : x1 > 0, x2 > 0}. Since f ∈ C 2 , one observes that
!
2 0 1
∇ f (x) = ,
e 1 0
84
Exercises
1. Consider the following functions:
where n < m. Corresponding to any choice of the approximating polynomial, there will be a set of
errors given by ei = g(xi ) − h(xi ). In order to find the optimum values for the n + 1 coefficients of
the polynomial approximation, let us define the following unconstrained optimization problem:
m
X
min f (a) = e2i .
a
e
e i=1
Qa = b.
e e e
e
85
Chapter 9
Numerical methods
Most numerical gradient-based methods require an initial design x0 , a search direction d0 , and a step size
e e
α0 . In this way, the improved design can be defined as x1 = x0 + α0 d0 . Iterativelly, these algorithms may
e e e
be written as
xk+1 = xk + αk dk . (9.1)
e e e
Gradient-based numerical methods are characterized by the different ways they determine the search direc-
tion vector dk . The step size αk is determined by single-variable optimization methods, also referred to as
e
line search methods. Therefore, αk can be expressed as
9.1 Principles
9.1.1 Descent direction
A current design xk is driven to an improved design xk+1 such that
e e
f (xk+1 ) < f (xk ); (9.3)
e e
this is,
f (xk + αk dk ) < f (xk ). (9.4)
e e e
Using Taylor series expansion about xk , the objective function f can be written as
e
f (x) = f (xk ) + ∇f (xk )T (x − xk ) + R1 (x). (9.5)
e e e e e e
Evaluating in xk+1 = xk + αk dk , one obtains that
e e e
f (xk+1 ) = f (xk ) + ∇f (xk )T (αk dk ) + R1 (αk2 ). (9.6)
e e e e
86
For αk sufficiently small, the residual term can be disregarded. Since f (xk+1 ) − f (xk ) < 0, see (9.3), one
e e
observes that
αk ∇f (xk )T dk < 0. (9.7)
e e
For any αk > 0,
∇f (xk )T dk < 0, (9.8)
e e
where dk is a descent direction and (9.8) is referred to as the descent condition. The unit direction of most
e
rapid decrease is the solution to the problem
min ∇f (xk )T d
d e e (9.9)
e
s.t. ||d|| = 1,
e
where ∇f (xk )T d = ||∇f (xk )|| ||d|| cos(θ), and θ is the angle between ∇f (xk ) and d. Since ||d|| = 1 then
∇f (xk )T d = ||∇f (xk )|| cos(θ). Therefore, the objective in (9.9) is minimized when cos(θ) = −1 at θ = π
e e e e e e e
e e e
radians. In other words, the solution to (9.9) is
∇f (xk )
dk = − .
||∇f (xk )||
e
e
e
Observe that if dk is opposite to the gradient ∇f (xk ), this is
e e
dk = −∇f (xk ), (9.10)
e e
then
∇f (xk )T dk = −||∇f (xk )||2 < 0. (9.11)
e e e
The search direction in (9.10) is referred to as the steepest descent direction. In Rn the gradient ∇f (xk ) is
e
a normal vector to the tangent hyperplane of the function isovalue at xk . The gradient vector is aligned with
e
the direction of maximum growth steepest ascent of the function f at xk .
e
87
This is
df (xk+1 ) ∂f (xk+1 ) dxk+1
= = ∇f (xk+1 )T dk = 0. (9.14)
dα ∂x dα
e e e
e e
e
In other words, the directional derivative of f (xk+1 ) along dk must be zero.
e e
Now, let us consider the particular problem of minimizing a quadratic function
df (xk +αdk )
h iT
e dα e = 1
+ αdk )T Adk + 12 dk T A(xk + αdk ) + bT dk
2 (xk
(9.17)
= (xk + αdk )T Adk + bT dk .
e e e ee e e e e e e e
e e e ee e e
The necessary and sufficient conditions for optimality are satisfied when (9.17) is equal to zero. This condi-
tion can be written as
xk T Adk + αdk T Adk + bT dk = 0, (9.18)
e e ee e e ee e e
or
αdk T Adk = −(xk T A + bT )dk . (9.19)
e e ee e e e e e
Comparing (9.19) with (9.15) one observes that
df (xk )
αdk T Adk = − e dk . (9.20)
e e ee dx e
e
or
αdk T Adk = −dk T ∇fk , (9.21)
e e ee e
where ∇fk = ∇f (xk ). Finally, solving for α allows
e
dk T ∇fk
αk = − e T . (9.22)
dk Adk
e e ee
This equation is applicable only when the objective function is quadratic. In the general case of a non-
linear function (9.12) should be used.
88
9.1.3 Termination criteria
The necessary condition for optimality is satisfied in a particular point xk if
e
||∇f (xk )|| ≤ εG , (9.23)
e
where εG is a tolerance on the gradient supplied by the user. Notice that the gradient can vanish at any
stationary point (maximum, minimum, or saddle point). However, the chances to find a maximum or a
saddle point with a steepest descent algorithm are remote.
The algorithm should also check successive reduction in the function value, for example,
89
Evaluating at x0 = (1, 2)T yields !
4
e
∇f (x0 ) = ;
e 4
therefore, ds = −(4, 4)T is the steepest descent direction of f at x0 . The descent condition for d0 =
(0.5, 0.8)T can be verified with the sign of the directional derivative of f0 along d0 . This is
e e e
e
!
0.5
4 4 = 5.2 ≮ 0,
0.8
9.2.2 Algorithm
Step 1. Estimate a reasonable initial point x0 and termination parameters εA , εG , and εR , where εA is the
e
absolute tolerance, εG and εR tolerances for the gradient and the function.
α0 = 0.25. The improved design is x1 = (0.5, 0.5)T . In this point, the gradient of the function is 0 which
e
e e
satisfies the optimality condition and the termination criterion. Therefore, this is the optimum point.
The steepest descent method is simple and robust to optimization. However, it has some drawbacks.
1. Even though this method is convergent, it is also slow even with positive definite quadratic forms.
2. The information from previous iterations is not used in the next steps.
90
3. In practice, the function is greatly reduced in the first iterations but it decreases mores slowly as the
iterations continue.
4. The steepest descent direction makes sense from a local prospective (current point) but it can be
improved in a more global sense.
9.2.3 Scaling∗
Scaling techniques are used to increase the order (or speed) of convergence in numerical methods. The
underlying idea is the transform the set of design variables to reduce the number of iterations required to
reach the minimum. Let us present some scaling procedures in the following examples.
function [xopt,fopt,aopt,ngradf]=afun(x0)
d0=-gfun(’fun’,x0);
[aopt,fopt] = fminbnd(@(a) fun(x0,d0,a),0,10);
xopt=x0+d0*aopt;
ngradf=norm(d0);
function f=fun(x0,d0,a)
if nargin==1
d0=zeros(size(x0));
a=0;
end
x=x0+a*d0;
f=25*x(1)ˆ2+x(2)ˆ2;
On the workspace,
>> [x,f,a,n]=afun([1;1])
x =
-0.0010
0.9600
f =
0.9215
a =
0.0200
n =
50.0400
91
Table 9.1 shows the iterative process.
and
√
x∗2 = x̂∗2 / 2 = 0.
92
The Hessian of the function is given by
!
2 12 −6
∇ f (x) = .
e −6 4
The eigenvalues are λ1 = 0.7889 and λ2 = 15.211 with eigenvectors e1 = (0.4718, 0.8817)T and e2 =
(−0.8817, 0.4718)T . The scaling is defined as
e e
x = Qx̂, (9.29)
e ee
e
where Q = (e1 , e2 ), this is
e e e !
0.4718 −0.8817
e
Q= .
e 0.8817 0.4718
e
Note that the Hessian of the scaled function is not the identity matrix yet. To accomplish this condition one
needs a new change of variables
ˆ,
x̂ = Dx̂ (9.30)
e e e e
where !
√ 1 0
D= 0.7889 .
0 √ 1
15.211
e
e
The Hessian of the new function x̂ˆ is, in fact, the identity matrix. Using the steepest descent method one
e
reaches the optimum in one single iteration. The minimum is x̂ ˆ ∗ = (−1.3158, −1.6142)T . Applying the
e
linear transformations, the minimum in the original space is
x = QDx̂ˆ, (9.31)
e ee e e
e
and the solution is x∗ = (−1/3, −2/3)T .
e
93
of a function of several variables. With this method it is possible to locate the minimum of a quadratic
function of n variables in n iterations. In this method the search direction dk+1 has the form
e
dk+1 = −∇fk+1 + βk dk , (9.33)
e e
where βk dk represents the deflection of the search direction with respect to the steepest descent direction. If
e
two consecutive search directions are conjugate with respect to A then
e
e
dk+1 T Adk = 0. (9.34)
e e
ee
Consider an initial design x0 and a set of conjugate directions d0 , d1 , . . . , dn−1 . Minimizing f (x) along
e e e e e
d0 leads to x1 . Then, from the point x1 , f (x) is minimized along d1 so one obtains x2 . The process
e e e e e e
continues until one reaches xn along dn−1 . Finally, the point xn minimizes (9.15). This iterative process
e e e
can be expressed as
xk+1 = xk + αk dk , (9.35)
e e e
where dk is descent direction and
e
αk = arg min f (xk + αdk ). (9.36)
α≥0 e e
Using (9.33), the conjugate condition (9.34) can be written as
Since,
∇fk = Axk + b
e
ee e
and
∇fk+1 = Axk+1 + b,
e
ee e
94
then (9.40) can be written as
∇fk+1 − ∇fk
Adk = . (9.41)
e
ee αk
Replacing (9.41) into (9.39) yields
∇fk T ∇fk
αk = . (9.47)
dk T Adk
e e ee
Substituting (9.47) into (9.39) allows to express the deflection factor
This expression is used by the Polak-Ribiere algorithm (Polak & Ribiere, 1969). On the other hand, if one
considers
∇fk+1 T ∇fk = 0, (9.49)
∇fk+1 T ∇fk+1
βk = . (9.50)
∇fk T ∇fk
95
This expression is used by the Fletcher-Reeves algorithm (Fletcher & Reeves, 1964).
9.3.2 Algorithm
Step 1. Estimate the initial design x0 . Select a termination parameter ε. The first search direction is defined
e
as the steepest descent direction,
d0 = −∇f0 .
e
If ||∇f0 || < ε, then algorithm cannot improve the current design; otherwise go to Step 5.
Step 2. Compute the gradient ∇fk . If ||∇fk || < ε the algorithm cannot improve the current design; other-
wise go to the next Step.
Step 3. Determine the deflection factor using Polak-Ribiere equation (9.48) or Fletcher-Reeves equation
(9.50). In the second case, the deflection factor can be expressed as
∇fk+1 T ∇fk+1
βk = .
∇fk T ∇fk
If the minimum is not found after n + 1 iterations, it is recommended to restart the algorithm using the
steepest descent direction.
96
Since this is a quadratic problem, we can use the Hessian to update the step size. The algorithm should
converge in three iterations. The gradient of the function is given by
2x1 + 2x2
∇f (x) = 2x1 + 4x2 + 2x3
e
2x2 + 4x3
4.8281
Using Fletcher-Reeves equation
∇f1 T ∇f1
β0 = = 0.01565.
∇f0 T ∇f0
97
The new search direction is
4.3191
d1 = −∇f1 + β0 d0 = 3.81566 .
e e
−5.5793
Iteration 3. The third (hopefully last) design is determine in the same way:
0.62534
∇f2 = −0.422104 ,
0.195419
∇f2 T ∇f2
β1 = = 0.0096,
∇f1 T ∇f1
−0.5839
d2 = −∇f2 + β1 d1 = 0.4587 ,
e e
−0.2489
∇f2 T ∇f2
α2 = = 2.4966,
d2 T Ad2
e e ee
and
0.0000
x∗ = x3 = x2 + α2 d2 = 0.0000 .
e e e e
0.0000
0.0000
98
The reader can easily prove that this corresponds to the analytical solution.
The conjugate gradient method is in essence the steepest descent with a deflected search direction. This
simple modification does not require a considerably amount of computational work; however, it substantially
improves the order of convergence.
and
2 2 0
∇2 f (x) = 2 4 2 ,
e
0 2 4
which is positive definite. Starting from x0 = (2, 4, 10)T and using 9.55, the next point is
e
−1
x11 2 2 2 0 12 0
x12 = 4 − 2 4 2 40 = 0 ,
x13 10 0 2 4 48 0
1. Each iteration in Newton’s method requires the Hessian of the objective function. In some functions
that might be impossible for certain points; however, when it is possible, the number of function calls
increases substantially with respect to the previous first-order methods. For instance, if f : Rn → R,
then the algorithm requires n(n + 1)/2 second-order derivatives.
2. The Hessian might be singular (or close to singular) in some points which makes impossible to deter-
mine a search direction.
100
descent direction method. The proposed search direction is defined as
9.4.3 Algorithm
The algorithm for the modified Newton’s method can be described as follows:
Step 5. Find the optimum step size αk by minimizing f (xk +αdk ) and update the design xk+1 = xk +αk dk .
e e e e e
Then go to Step 2.
101
Minimizing f (α) = f (x0 + αd0 ) one obtains that
e e
α0 = 1.0045.
α1 = 1.3424,
!
−0.6070
x2 = x1 + α1 d1 = .
e e e −0.6008
H k yk yk TH k sk sk T
H k+1 = Hk − e
e eT e e e +ee , (9.59)
e
e e
e yk H k yk sk T y k
e e e e e e
where sk = xk+1 − xk represents the change in the design and y k = ∇f (xk+1 ) − ∇f (xk ) represents the
e e e e e
change in the gradient. e
102
Example. Consider the function
f (x) = 5x21 + 2x1 x2 + x22 + 7
e
from x0 = (1, 2)T . Perform two iterations of the DFP method in order to improve your design.
e
H 0 = I then
e e !
14
e e
d0 = −∇f0 = − .
e 6
The norm ||∇f0 || = 15.232 > ε, then there is no convergence and the algorithm continues. The updated
design is given by
x1 = x0 + α0 d0
e e e
where α0 = arg min 1184α2 − 232α + 20 = 0.0980. Therefore
!
−0.3716
x1 = .
e 1.4122
In the second iteration, ||∇f1 || = 1.877 > ε, therefore there is no convergence. The algorithm deter-
mines s0 = x1 − x0 = (−3716, −0.5878)T and y 0 = ∇f1 − ∇f0 = (−14.8919, 3.9189)T . Then,
e e e e
!
0.148 −0.211
H1 = .
e
e −0.211 0.950
where sk = xk+1 − xk represents the change in the design variables and y k = ∇fk+1 − ∇fk represents the
e e e
change in the gradient. e
103
Example. Consider the function
f (x) = 5x21 + 2x1 x2 + x22 + 7
e
from x0 = (1, 2)T . Perform two iterations of the BFGS method to improve your design.
e
The first iteration is just like in the previous example, this is H 0 = I and
e
e e
e
!
−0.3716
x1 = .
e 1.4122
xk+1 = xk + dk (9.61)
e e e
in which the step size αk is not present. By contrast, the search direction vector dk is restricted to a prescribed
e
region referred to as the trust region. These method are also known as restricted step methods.
The key idea is to approximate the objective function f with a simpler expression fA that reasonably
reflects its behavior in the neighborhood of a current design xk . If f is highly nonlinear the approximation
e
fA will be valid in a trust region Γk around xk . This region can be described as
e
Γk = {x : ||x − xk || ≤ γk }, (9.62)
e e e
where γk is the size of the trust region, which is dynamically adjusted. Usually the Euclidean norm is used.
104
When the L∞ norm is used this method is also known as the box-step or hypercube method (Bazaraa et al.,
2006). Using (9.62) for x = xk + d, the sub-optimization problem of the search direction can be stated as
e e e
dk = arg min fA (d)
e d e (9.63)
e
s.t. ||dk || ≤ γk .
e
Using a linear approximation of the objective function,
∇f (xk )
dk = − γk . (9.64)
||∇f (xk )||
e
e
e
A more interesting trust-region algorithm is obtained by choosing a quadratic approximation
1
fA (d) = f (xk ) + ∇f (xk )T d + dT ∇2 f (xk )d.
e e e e 2 e e e
Because of the trust-region restriction ||d|| ≤ γk , there is no need for ∇2 f (xk ) to be positive definite, since
e e
(9.63) is guaranteed to have a solution dk . In this case the method is called trust-region Newton method. If
e
an approximation of the Hessian is used, the method is called trust-region quasi-Newton method (Nocedal
& Wright, 1999).
105
9.6.3 Algorithm
Given xk and an initial trial value γk , a trust-region algorithm determines xk+1 and γk+1 by using two
threshold values σ1 and σ2 with 0 ≤ σ1 ≤ σ2 ≤ 1 and two factors β1 and β2 with 0 < β1 < 1 < β2 .
e e
Step 1. Given xk and γk , obtain dk solving the sub-optimization problem (9.63). For a linear approximation
e e
of the objective function, the solution is given by (9.64). If fA (dk ) = f (d) stop (xk is a local
e e e
minimum); else go to Step 2.
Step 3. Set
β1 ||dk ||
if rk < σ1 ,
γk+1 = if σ2 ≤ rk and ||dk || = γk , (9.67)
e
β 2 γk
e
γk otherwise.
the function value, then x2 = (0.1680, 1.2247)T . The reliability index is r1 = 0.9605. Since
e e e
the function value, then x3 = (0.5009, 1.5977)T . The reliability index is r1 = 0.6849, therefore
e e e
e
γ3 = γ2 = 0.5.
Iteration 4. The process continues until ||∇f (x1 )|| ≤ ε for some small value. The optimum point is x∗ =
(1, 2)T with f x∗ = 0.
e e
e
107
Example. Solve for x in the following system of linear equations,
e
1 2 ! 1
x1
3 4 = 1 .
x2
−1 1 1
Since rank(A) = 2 and rank(A, b) = 3, the system is inconsistent and does not have a solution.
e e e
However, the solution
e that minimizesethe quadratic error is obtained using (9.71), this is
−1
! ! 1 2 1!
x∗1 1 3 −1 1 3 −1
= 3 4 1 (9.72)
x∗2 2 4 1 2 4 1
−1 1 1
!
−0.4516
= . (9.73)
0.6129
One of the most important applications of this method is the identification of the coefficients of a function
that better matches a cloud of points.
t x
0.00 1.001
0.10 1.089
0.23 1.240
0.70 1.604
0.90 1.738
1.50 2.020
2.65 1.412
3.00 1.241
Find the least square best fit coefficients a, b, and c if the assumed functional form is
(a) x = a + bt + ct2 ,
Which best fit estimate has the smallest least square error?
108
(a) The system of linear equations can be expressed as
1.000 0.000 0.000 1.001
1.000 0.100 0.010 1.089
1.000 0.230 0.053 1.240
a
1.000 0.700 0.490 1.604
1.000
b =
.
0.900 0.810 1.738
c
1.000 1.500 2.250 2.020
1.000 2.650 7.023 1.412
1.000 3.000 9.000 1.241
c −0.379
The function is x(t) = 0.982 + 1.205t − 0.379t2 . The quadratic error is 0.0224.
c −0.011
The function is x(t) = 1.017+0.960 sin(t)−0.011 sin(2t). The quadratic error is 0.0157 and, therefore,
it is a better approximation.
In some occasions, the data are weighted according to their reliability. In this case, one makes use of a
109
weighting matrix W , such that
W Ax = b.
f
f (9.74)
fe
f ee e
In this case, the optimum solution is given by
where bi represent the given data and pi are the predicted data. To illustrate this concept, let us consider the
following example.
f x1 x2
2.2 5.0 10.0
9.5 3.0 1.0
23.6 0.6 0.6
74.3 0.1 2.0
6.3 3.0 1.8
Find the least square best fit coefficients a, b, and c if the assumed functional form is
110
Using (9.71), the solution can be expressed as
a −18.17
b = 4.34 .
c 52.35
(b) In this case, the function is nonlinear and (9.71) cannot be used. In this case, the general approach in
(9.77) is utilized. The optimization problem is given by
c −0.14
The least square error is 8.08 which indicates that it is a better fit than the previous functional.
The nearly universal choices used in the standard Nelder–Mead algorithm are
1 1
ρ = 1, χ = 2, γ< , and σ= . (9.79)
2 2
This method starts with a simplex of n + 1 vertices, each of which is a point in Rn . These vertices are
labeled as x(1) , x(2) , . . . , x(n−1) , such that
e e e
f (x(1) ) ≤ f (x(2) ) ≤ · · · ≤ f (x(n+1) ). (9.80)
e e e
111
Since f is to be minimized, x(1) is the best point and x(n+1) is the worst point. At each step in the iteration,
the current worst point x(n+1) is discarded, and another point is accepted into the simplex. This process
e e
e
continues until termination conditions are satisfied.
9.8.2 Algorithm
(1) (n+1)
Given an initial point x0 the algorithm conforms a simplex x0 , . . . , x0 by adding 5% of each compo-
e e e
nent x0i to x0 , and using these n vectors as elements of the simplex in addition to x0 . If x0i = 0 then it uses
e e
0.00025 as component i. Then the algorithm modifies the simplex repeatedly according to the following
algorithm.
and evaluate f (x(e) ). If f (x(e) ) < f (x(r) ) then accept x(e) and terminate the iteration; otherwise
accept x(r) and terminate the iteration.
e e e e
e
Step 4. Contract. If f (x(r) ) ≥ f (x(n) ), perform a contraction between x̄ and the better of x(n+1) and x(r) .
e e e e e
(a) Outside contraction. If f (x(n) ) ≤ f (x(r) ) < f (x(n+1) ), i.e., x(r) is strictly better than x(n+1) ,
e e e e e
then perform an outside contraction: calculate
and evaluate f (x(c) ). If f (x(c) ) ≤ f (x(r) ) then accept x(c) and terminate the iteration; other-
e e e e
wise go to Step 5 (Shrink).
(b) Inside contraction. If f (x(r) ) ≥ f (x(n+1) ), then perform an inside contraction: calculate
e e
¯
x(cc) = x̄ + γ(x̄ − x(n+1) ), (9.84)
e e e e
and evaluate f (x(cc) ). If f (x(cc) ) < f (x(n+1) ) then accept x(cc) and terminate the iteration;
e e e e
otherwise go to Step 5 (Shrink).
112
Step 5. Shrink. Calculate the n points
and calculate f (v (i) ), for i = 2, ..., n + 1. The vertices of simplex at the next iteration are
x(1) , v (2) , ..., v (n+1) .
e
e e e
This procedure has been implemented in M ATLAB’s optimization toolbox under the function fminsearch.
113
Exercises
1. Determine if the given direction at the point is that of descent for the following functions (show all
the calculations). In each case, determine the steepest descent direction.
3. Consider the function f (x) = x1 x22 at the point x0 = (1, 2)T . (a) Obtain the expression for the
e e
quadratic approximation fQ and make a plot of f and fQ . (b) Analytically, obtain the minimum of
fQ . This is equivalent to one iteration of Newton’s method. (c) Improve this minimum by performing
a line search. This is equivalent to one iteration of a modified Newton’s method.
4. For the function f (x) = x1 x2 , determine the expression for f (α) along the line x1 = x2 and along
the line joining (0, 1)T to (1, 0)T .
e
5. Perform two iterations (by hand) using steepest descent, Fletcher-Reeves, Newtons’s, and BFGS for
the following functions:
114
and the initial point x0 = (0, 0)T . Perform three iterations using the trust region method and a linear
e
approximation of the function. Use h0 = 1 as your initial trust region size and ε = 0.0001 as
your termination criteria for the norm of the gradient. The gradient can be evaluated analytically or
numerically. In a contour plot show the initial point and the points obtained after every iteration.
8. An experiment yields the data in the following table. Find the least square best fit coefficients a, b,
x y
0 0
1 8
2 12
3 15
4 16
5 16
6 15
7 10
8 0
9 −10
Which best fit estimate has the smallest least square error? Plot your results and the data provided.
Compare your results with the ones obtained using the function lsqnonlin from the optimization
toolbox in M ATLAB.
Makes sure that your algorithm works for two and three dimensional problems.
115
Chapter 10
Numerical Analysis
The theory concerning convergence in multi-variate optimization follows the principles establishes in Chap-
ter 7. The main change is to convert absolute values of scalar quantities to norms of vectors. Since all
norms on Rn are equivalent, then the conditions that guarantee convergence of a sequence {xk } in one norm
e
suffices to guarantee convergence in any norm.
10.1 Convergence
A sequence of vectors
{xk }∞
k=0 = {x0 , x1 , . . . , x∞ }
e e e e
∗
is said to converge to the limit x if and only if the following criterion is satisfied: Given any ε > 0, there is
a (natural) number N such that for any number k > N , ||xk − x∗ || < ε.
e
e e
116
Example. Let g (x) = x − ∇f (x) and f (x) = 0.5(x1 − 2)2 + 0.5(x2 − 3)2 . Find the fixed points of g .
ee e e e e
!
x1 − 2
∇f (x) = .
e x2 − 3
or x∗ = (2, 3)T .
e
117
and σDg = {λ1 , . . . , λs } is the spectrum of Dg (x) containing all the eigenvalues of Dg (x). Hence if
ee ee
ρ(Dg (x)) < 1, (10.6)
ee
for all x ∈ Ω , then g is a contraction on Ω. If g is a contraction, for all x in some neighborhood of the fixed
point x∗ , then x∗ is esaid to be an attractive fixed
e e point and the iterationeexhibits local convergence. On the
other hand, if ρ(Dg (x)) > 1 for all x in some neighborhood of the fixed point x∗ , then x∗ is said to be a
e
e e
e and
repelling fixed point the iteration exhibits local divergence. Notice that for Eulerian norm and Dg (x)
symmetric, ee
||Dg (x)|| = ρ(Dg (x)).
ee ee
Example. Let g (x) = x − α∇f (x) and f (x) = (x1 − 2)2 − x1 x2 + x22 . Determine the condition under
e e e e
which α makesethe the fixed point(s) of g attractive.
e
!
−4 + 2x1 − x2
∇f (x) = .
e −x1 + 2x2
The fixed points of g are the roots of g (x) − x = 0. This is x∗ = (8/3, 4/3)T . The Jacobian of g is
e ee e e e e
!
1 − 2α α
Dg (x) =
ee α 1 − 2α
The eigenvalues of the Jacobian are λ1 = 1 − 3α and λ2 = 1 − α. Solving for max{|λ1 |, |λ2 |} < 1 yields
0 < α < 2/3.
x − xk+1 ≤ C x∗ − xk p
∗
(10.7)
e e e e
whenver k ≥ N . If p = 1, then 0 ≤ C < 1, and it is said that the iterative scheme converges linearly. If
p = 2, the schemes converges quadratically. If
∗
x − xk+1
lim e e p = C,
k→∞ x∗ − xk
e e
then C is referred to as the asymptotic error constant.
118
If there is a sequence {Ck } such that
lim Ck = 0
k→∞
and
∗
x − xk+1 ≤ Ck x∗ − xk ,
e e e e
then it is said that the sequence {xk } converges superlinearly to the fixed point x∗ .
e e
If the function g is a contraction on some interval, then the convergence is at least linear. Under some
circumstances one can construct iteration functions g for which successive substitutions converges with
order p ≥ 2. In a trivial case, if for all p > 0,
||xk+1 − x∗ ||
lim e = 0,
k→∞ ||xk − x∗ ||p
e
e e
then we say that the order of convergence is ∞. This is the case in which all the values of the sequence are
the same.
The order of convergence of an algorithm can be checked using a convergence plot. If the fixed point x∗
is known, one can compute the sequence of errors εk = ||x∗ − xk ||. From (10.7) one can observe that
e
e e
log εk+1 ≤ p log εk + log C. (10.8)
Then the order of convergence can be obtained from the slope of the curve log |εk+1 | versus log |εk |.
which converges to 0. The order of convergence of that series can be determined from (10.8). Let us
determine the natural logarithm of the above series:
and
{log εk+1 } = {−1.38629, −2.77259, −5.54422, −11.0942}
one determine the coefficients p and log C by a linear curve fit. In matrix form, this problem can be repre-
119
sented by
−1.38629 −0.693147 1 !
−2.77259 −1.38629 1 p
−5.54422 = −2.77259 .
1 log C
−11.0942 −5.54422 1
Using (9.71), the solution can be expressed as
! !
p 2.0012
= .
log C 0.0019
Consequently, the order of convergence is quadratic as p ≈ 2, and the asymptotic error constant is C ≈ 1.
Exercises
1. Consider the function
f (x) = 3(x21 + x22 ) + 4x1 x2 + 5x1 + 6x2 + 7.
e
Suppose we use a fixed step size gradient-based algorithm to find the minimum point of f :
3
f (x) = (x21 + x22 ) + (1 + a)x1 x2 − (x1 + x2 ) + b,
e 2
(a) Find the largest set of values of a and b such that the unique global minimum point of f exists.
Express the minimum point in terms of a and b.
(b) Consider the following algorithm:
2
xk+1 = xk − ∇f (xk ).
e e 5 e
Find the largest set of values of a and b for which the above algorithm converges to the global
minimum point of f for any initial point x0 .
e
120
Part IV
121
Chapter 11
Analytical elements
min f (x)
x e
(11.1)
e
s.t. gi (x) ≤ 0, i = 1, . . . , r
e
hj (x) = 0, j = 1, . . . , m
e
where x ∈ Rn are the design variables, f : Rn → R is the objective function, gi : Rn → R are the inequality
constraints, hj : Rn → R are the equality constraints, and m ≤ n. In vector notation, the aforementioned
e
min f (x)
x e
(11.2)
e
s.t. g (x) ≤ 0
ee e
h(x) = 0,
e e e
where g : Rn → Rr and h : Rn → Rm . In some cases it is required to modify the formulation of the
e
problem
e so it can be expressed as in (11.1). Let us consider some typical cases (Belegundu & Chandrupatla,
1999):
122
can be written as
min α
x,α
e
s.t. fi (x) ≤ α i = 1, . . . , s.
e
(d) Functions that depend on a parameter, for example 0 ≤ θ ≤ 1, can be handled by discretizing the
parameter as θi , where i = 1, . . . , d and d is the number of discrete points. For example, the inequality
constraint
max {g(x, θ)} ≤ 0,
0≤θ≤1 e
can be discretized as
max {g(x, θi )} ≤ 0,
1≤i≤d e
and, finally, expressed as
g(x, θi ) ≤ 0, i = 1, . . . , d.
e
(e) An objective function expressed in terms of absolute value,
min |f (x)|
x e
e
can be written as
min p+n
x,p,n
e
s.t. f (x) = p − n
p≥0
e
n≥0
(f) In regression analysis, one can minimize the error between given and predicted data. This error can be
defined with various norms. Consider
i=d
X
min f (x) = |ei (x)|,
x
e
e i=1 e
where ei (x) represents the error between the model and the data. This problem can be written as
e
Pi=d
min i=1 (pi + ni )
x,p,n
e e e
s.t. ei (x) = pi − ni
pi ≥ 0
e
ni ≥ 0.
123
(g) A minimax error in the objective function
can be written as
min f =α
x
e
s.t. fi (x) ≤ α
fi (x) ≥ −α.
e
e
Example. Express the following nonlinear unconstrained optimization problem as an LP problem.
min p1 + n1 + p2 + n2
x,p,n
e e e
s.t x1 − 4 − p 1 + n1 = 0
x2 − 2 − p 2 + n2 = 0
pi ≥ 0
ni ≥ 0 i = 1, 2.
124
11.2.1 Equality constraints
Consider the problem of one single equality constraint,
min f (x)
x e (11.3)
e
s.t. h(x) = 0.
e
Sometimes this problem can be converted to an unconstrained formulation by eliminating one of the design
variables using the equality constrained and replacing that into the objective function. For example
In some cases this is the right way to solve the problem, but in other cases eliminating a design variable
might be cumbersome or simply impossible. Joseph-Louis Lagrange (1736–1813) proposed a different
method that avoids this elimination and maintains all the physical meaning of the design variables.
Using the chain rule, a stationary point (minimum, maximum, or saddle point) requires that
df ∂f dx1 ∂f ∂f dxn
= + ··· + + ··· + = 0. (11.5)
dxi ∂x1 dxi ∂xi ∂xn dxi
∂f ∂f ∂f
df = dx1 + · · · + dxi + · · · + dxn = 0. (11.6)
∂x1 ∂xi ∂xn
Lagrange suggested to multiply (11.7) by a factor λ and then add it to (11.6). That results in
n
X ∂f ∂h
+λ dxi = 0. (11.8)
∂xi ∂xi
i=1
Assuming that xn will be eliminated according to (11.4), let us choose λ such that the term in dxn vanishes,
yielding
∂f ∂h
+λ = 0. (11.9)
∂xn ∂xn
Using this factor λ, (11.8) can be reduced to
n−1
X
∂f ∂h
+λ dxi = 0. (11.10)
∂xi ∂xi
i=1
125
Since every dxi in (11.10) is independent, then
∂f ∂h
+λ = 0, i = 1, . . . , n − 1. (11.11)
∂xi ∂xi
From (11.9) and (11.11), one concludes that each coefficient in (11.8) vanishes. This is
∂f ∂h
+λ = 0, i = 1, . . . , n, (11.12)
∂xi ∂xi
just like if every dxi was independent. The method of Lagrange multipliers can be described using the
following function
L(x, λ) = f (x) + λh(x). (11.13)
e e e
This function is known as the Lagrangian. The first order necessary conditions for optimality can be ex-
pressed in terms of the Lagrangian as
Example. Solve
min f (x) = (x1 − 1.5)2 + (x2 − 1.5)2
x e
e
s.t. h(x) = x1 + x2 = 0
e
One possible approach is to eliminate one of the design variables using the equality constraint. For
example, x2 = −x1 . Then this can be replaced into the objective function and solve the unconstrained
optimization problem. The second approach makes use of the Lagrangian
x1 + x2 0
126
Solving the system of linear equations yields
x∗1
0
∗
x2 = 0 .
λ∗ 3
This result can be proved in M ATLAB using the function fmincon as follows:
>> f=@(x)(x(1)-1.5)ˆ2+(x(2)-1.5)ˆ2.
>> [x,fval,exitflag,output,lambda] = fmincon(f,[1,1],[],[],[1,1],[0]);
>> x = 1.0e-007 * 0.3529 -0.3529
>> fval = 4.5000
>> lambda.eqlin = 3.0000
To understand the geometric meaning of the Lagrange multipliers, consider the Lagrangian (11.13) and
the optimality condition (11.16) expressed as
∇f + λ∇h = 0 (11.18)
e
or as
∇f = −λ∇h. (11.19)
Geometrically, the above expression means that in the stationary point the gradients of the objective function
and the equality constraints are aligned. Furthermore, the Lagrange multiplier λ is their scaling factor.
Now, let us consider a problem with multiple equality constraints,
min f (x)
x e
e
s.t. h1 (x) = 0
(11.20)
e
h2 (x) = 0
.. e
.
hm (x) = 0.
e
or, in vector form,
min f (x)
x e (11.21)
e
s.t. h(x) = 0.
e e e
In this case, the Lagrangian can be written as
m
X
L(x, λ) = f (x) + λj hj (x), (11.22)
e e e j=1 e
127
or, in vector form,
L(x, λ) = f (x) + λT h(x). (11.23)
e e e e e e
The first order necessary conditions for optimality are
m
∂L(x∗ , λ∗ ) ∂f (x∗ ) X ∗ ∂hj (x∗ )
e e = e + λj = 0, i = 1, . . . , n, (11.24)
∂xi ∂xi ∂xi
e
j=1
hj (x∗ ) = 0, j = 1, . . . , m, (11.25)
e
or, in vector form,
min f (x)
x e
e
s.t. g1 (x) ≤ 0
g2 (x) ≤ 0
e (11.28)
.. e
.
gr (x) ≤ 0.
e
or, in vector form,
min f (x)
x e (11.29)
e
s.t. g (x) ≤ 0.
ee e
Let x satisfy g (x) ≤ 0 and J(x) be the index set of active inequality constraints, this is
e ee e e
J(x) = {j : gj (x) = 0, j = 1, . . . , r}. (11.30)
e e
The point x is a regular point if the vectors ∇gj (x), j ∈ J(x), are linearly independent.
e e e
For a regular point x, a search direction d is a feasible search direction if
e e
∇gj (x)T d ≤ 0, for all j ∈ J(x). (11.31)
e e e
128
This condition ensures that gj (x + αd) ≤ 0 for a sufficiently small, positive value α. Notice that the equality
condition in (11.31), ∇gj (x)T d = 0, is permissible only for linear constraints. For any point, a direction d
e e
e e e
is a descent direction if
∇f (x)T d < 0. (11.32)
e e
A direction d that is both feasible and descent exists only if the gradient of f is a linear combination of the
e
gradients of the active constraints gj . In other words,
X
∇f (x) = µj ∇gj (x), where µj ≥ 0. (11.33)
j∈J(x)
e e
e
At a stationary point it is not possible to find a direction that is both feasible and descent. This condition can
be also proved using Farkas Lemma (Belegundu & Chandrupatla, 1999).
Let us define the Lagrangian of (11.28) as
Xr
L(x, µ) = f (x) + µj gj (x), (11.34)
e e e j=1 e
∂L(x∗ , µ∗ ) r
∂f (x∗ ) X ∗ ∂gj (x∗ )
e e = + µj = 0, i = 1, . . . , n, (11.36)
∂xi ∂xi ∂xi
e e
j=1
µ∗j gj (x∗ ) = 0, j = 1, . . . , r (11.37)
e
µ∗j ≥ 0, (11.38)
gi (x∗ ) ≤ 0, (11.39)
e
The first condition (11.36) is referred to as the optimality condition, the second condition (11.37) is the
complementary condition, the third condition (11.38) is the non-negativity, and the fourth (11.39) is the
feasibility condition. In vector form, these are
129
Example. Solve
min f (x) = (x1 − 1)2 + (x2 − 1)2
x e
(11.44)
e
s.t. g1 (x) = −2x1 − x2 + 4 ≤ 0
g2 (x) = −x1 − 2x2 + 4 ≤ 0
e
e
The Lagrangian is
∂L
= 2x1 − 2 − 2µ1 − µ2 = 0 (11.45)
∂x1
∂L
= 2x2 − 2 − µ1 − 2µ2 = 0 (11.46)
∂x2
g1 = −2x1 − x2 + 4 ≤ 0 (11.47)
g2 = −x1 − 2x2 + 4 ≤ 0 (11.48)
µ1 g1 = µ1 (−2x1 − x2 + 4) = 0 (11.49)
µ2 g2 = µ2 (−x1 − 2x2 + 4) = 0 (11.50)
µ1 ≥ 0 (11.51)
µ2 ≥ 0. (11.52)
Case 2. If µ1 = 0 and g2 = 0, then x1 = 1.2, x2 = 1.4, and µ2 = 0.4; however, g1 = 0.2 which is not
feasible.
Case 3. If g1 = 0 and µ2 = 0, then x1 = 1.4, x2 = 1.2, and µ1 = 0.4; however, g2 = 0.2 which is not
feasible.
Case 4. If g1 = 0 and g2 = 0, then x1 = 4/3, x2 = 4/3, µ1 = 2/9 and µ2 = 2/9. The value of the function
is f = 2/9.
>> [x1,x2]=meshgrid(0:0.05:2);
>> f=(x1-1).ˆ2+(x2-1).ˆ2;
>> g1=-2*x1-x2+4;
>> g2=-x1-2*x2+4;
>> contour(x1,x2,f,0:0.2:1)
>> axis equal; hold on;
130
>> contour(x1,x2,g1,[0 0])
>> contour(x1,x2,g2,[0 0])
function f=tprob2(x)
f=(x(1)-1)ˆ2+(x(2)-1)ˆ2;
In the workspace,
>> options = optimset(’LargeScale’,’off’);
>> [x,fval,exitflag,output,lambda]=...
fmincon(@tprob2,[2;2],[-2,-1;-1,-2],[-4;-4],[],[],[],[],[],options);
Optimization terminated: first-order optimality measure less
than options.TolFun and maximum constraint violation is less
than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
1
2
>> x
x =
1.3333
1.3333
>> fval
fval =
0.2222
>> lambda.ineqlin
ans =
0.2222
0.2222
∂L(x∗ , λ∗ , µ∗ ) m r
∂f (x∗ ) X ∗ ∂hi (x∗ ) X ∗ ∂gj (x∗ )
e e e = e + λi e + µj = 0, e = 1, . . . , n (11.56)
∂xe ∂xe ∂xe ∂xe
e
i=1 j=1
hi (x∗ ) = 0, i = 1, . . . , m (11.57)
e
gj (x∗ ) ≤ 0, j = 1, . . . , r (11.58)
e
µ∗j gj (x∗ ) = 0, (11.59)
e
µ∗j ≥ 0, (11.60)
132
and the necessary optimality conditions are
∂L
= 2x1 + λ + µ = 0
∂x1
∂L
= 2x2 + λ − µ = 0
∂x2
∂L
= 2x3 + λ = 0
∂x3
h = x1 + x2 + x3 − 1 = 0
g = x1 − x2 − 2 ≤ 0
µg = µ(x1 − x2 − 2) = 0
µ ≥ 0.
Case 1. If g = 0, then x1 = 4/3, x2 = −2/3, and x3 = 1/3, but µ = −2 which is not allowed.
Case 2. If µ = 0, then x1 = 1/3, x2 = 1/3, x3 = 1/3, and g = −2. This is the solution to the problem. In
this case, λ = −2/3 and f = 1/3.
• The Hessian
m
X r
X
∗ ∗ ∗ ∗
2 2
∇ L(x , λ , µ ) = ∇ f (x ) + λ∗i ∇2 hi (x∗ ) + µ∗j ∇2 gj (x∗ ) (11.67)
e e e e i=1 e j=1 e
133
In other words, the Lagrangian must be positive definite for all d lying in the constraint tangent hyperplane.
e
Example. Consider the optimization problem
• x∗ = (0, 0)T , µ∗ = 0
√ √ T
e
• x∗ = ( 3, 3) , µ∗ = 12
√ √ T
e
• x∗ = (− 3, − 3) , µ∗ = 1
2
e
The Hessian matrix of the Lagrangian is
!
2 2 + 2µ −3
∇ L(x, µ) = .
e −3 2 + 2µ
For x∗ = (0, 0)T , µ∗ = 0, the constraint is inactive so the sufficient condition requires that dT ∇2 L(x∗ , µ∗ )d >
0 for all d. Notice that this is equivalent to the condition ∇2 f (x∗ ) is positive definite (unconstraint problem).
e e e e
∇2 L(x∗ , µ∗ ) is not definite positive, so we have to show that dT ∇2 L(x∗ , µ∗ )d > 0 for all ∇g(x∗ )T d, where
e e
e e e e e e
√ 1
∇g(x∗ ) = ±2 3 .
e 1
√ √ T √ √ T
Therefore, the points x∗ = ( 3, 3) and x∗ = (− 3, − 3) satisfy the sufficient conditions and they
e e
are local minima.
134
If the problem is convex, then necessary KKT conditions are also sufficient conditions for optimality
and the positive definiteness of the Lagrangian is not required. Let us discuss that in the next section.
11.4 Convexity
According to Weierstrass Theorem on the existence of a global minimum, if f (x) is continuous on a
e
nonempty feasible set Ω that is closed and bounded, then f (x) has a global minimum in Ω (Arora, 2004).
e
The KKT conditions and second order conditions dictate are used to determine strict local minimum points.
A stronger condition, such as the convexity of the problem, is used to determine whether the minimum point
is a global. Let us define this concept for multivariate constrained optimization.
A convex optimization problem is the one defined by a convex objective function in a convex feasible
space. If all the inequality constraints are convex and all the equality constraints are linear, then the feasible
space is convex. However, the feasible space can be convex even if the inequality constraints are not convex.
These constraints only need to be convex in the feasible space. The same applies to the objective function.
If the optimization problem is convex, then we have what is known as a convex programming problem
and the KKT conditions are sufficient conditions for optimality and any local minimum is also a global
minimum. On the other hand, several minima can be found in a non-convex space.
g3 (x) ≡ −x1 ≤ 0
e
g4 (x) ≡ −x2 ≤ 0
e
e
The feasible space is convex since all the constraints are linear and, therefore, convex. Let us consider
now the Hessian of the objective function
!
−6x1 0
∇2 f (x) = .
e 0 4
Since this Hessian is positive semi-definite for all x1 ≥ 0 then, the function is convex in the feasible space
and the problem is also convex.
135
physical interpretation of the Lagrange multipliers. The multipliers show the benefit of relaxing a constraint
or the penalty associated with tightening it.
which is
∂f ∂g ∂h
= −µT e − λT e . (11.75)
∂x e ∂x e ∂x
e e e
Substituting (11.75) into (11.71),
!
df ∂g ∂h ∂x ∂f
= −µT e − λT e e+ (11.76)
dp e ∂x e ∂x ∂p ∂p
e e
∂g ∂x ∂h ∂x ∂f
= −µT e e − λT e e + . (11.77)
e ∂x
e
∂p e ∂x ∂p
e
∂p
136
Using (11.72) and (11.73),
df ∂f ∂g ∂h
= + µT e + λ T e (11.78)
dp ∂p e ∂p e ∂p
l
∂f X ∂gj X ∂hi
= + µj + λi . (11.79)
∂p ∂p ∂p
j∈J i=1
∂f (0, 0) ∂f (0, 0)
f (ai , bj ) = f (0, 0) + ai + bj . (11.83)
∂ai ∂bj
Then,
∆f = f (ai , bj ) − f (0, 0) = −µi ai − λj bj . (11.84)
This is
X l
X
∆f = − µi a i − λj bj . (11.85)
i∈I j=1
137
From (11.85),
1
∆f = −µa = − a. (11.87)
2
If a = 1, for example, f ≈ −3.5. If a = −1, then f ≈ −2.5.
Exercises
1. Consider
min 2x1 + x2
x
e
s.t. x21 + x22 − 1 = 0.
2. A box with a square base and open top is to hold 50 cm3 . Find the dimensions that require the
least material (assume uniform thickness of material) to construct the box. Solve the problem using
optimality conditions.
3. A can is to be designed to hold 315 cm3 . You are asked to find the dimensions of the can that requires
the least material (of uniform thickness). Assume that the can is completely closed.
138
4. An engineering design problem is formulated as
Write KKT necessary conditions and solve for the candidate minimum designs. Verify the solutions
graphically. Interpret the KKT conditions on the graph for the problem.
139
Chapter 12
Linear Programming
The term linear programming was introduced by George Bernard Dantzig (1914–2005) in 1947 after World
War II (Dantzig, 1959). Programming or scheduling refers to the construction of a statement of actions which
will permit the system to move from a given status toward a defined objective. Linear programming (LP) is
a special area of the broader field of mathematical programming (MP). According to Dantzig (1959), “if the
system exhibits a structure which can be represented by a mathematical equivalent, called a mathematical
model, and if the objective can also be quantified, then some computational method may be evolved for
choosing the best schedule of actions among alternatives. Such use of mathematical models is termed
mathematical programming.”
When the problem can be represented by a system of linear equations or inequalities then it is a LP
problem. Any linear function f : Rn → R can be written as
n
X
f (x) = c1 x1 + c2 x2 + · · · + cn xn = ci xi = cT x,
e i=1 e e
where ci for i = 1, . . . , n are constants (Arora, 2004). In this way, a set of linear equality constraints can be
expressed as
where aji and bj , for j = 1, . . . , m and i = 1, . . . , n, are constants. The standard form of the problem is
defined for bj ≥ 0 and xi ≥ 0. The set of linear constraints can be also expressed as
n
X
aji xi = bj , for j = 1, . . . , m,
i=1
140
or simply, Ax = b. Any linear inequality constraint can be expressed as a linear equality constraint with the
addition oresubtraction of a positive quantity. With this procedure, the condition bj ≥ 0 is maintained. Let
ee e
where xn+1 > 0 is the slack variable. In the same way, any greater-or-equal (GE) inequality constraint can
be converted into an equality constraint by subtracting a positive surplus variable. For example
where xn+1 > 0 is the surplus variable. Now, an unrestricted design variable (i.e., with no restriction in
sign), can be expressed in standard form as the difference between two nonnegative variables. For example,
141
if xn is unrestricted, then one can expressed as
xn = xn+1 − xn+2
where xn+1 ≥ 0 and xn+2 ≥ 0. Let us see this procedure in the following example.
2. The inequality constraints are converted into equality constraints by adding a positive slack variable
x5 and subtracting a positive surplus variable x6 . This is
Since all functions are linear the problem is convex. Therefore, if the problem has a local minimum, this
minimum is also a global minimum. However, the solution of a LP problem is only guaranteed when the
feasible space is bounded. But this solution might not be unique.
142
12.2 Basic solutions
The feasible space of a LP problem is defined by the set geometric constraints x ≥ 0 and the set of functional
e e
constraints Ax = b. Assuming that the geometric constraints are satisfied, a solution can be obtained by
ee e
reducing theesystem of functional constraints to some canonical with pivotal variables x1 , x2 , . . . , xm . This
is
where âij and b̂j are the reduced coefficients resulting after pivoting. The m pivotal variables are referred
to as basic variables while the remaining n − m variables are named nonbasic variables. In matrix form,
(12.9) can be written as
I xB + ÂxN = b̂, (12.10)
e
ee e
ee e
where I is the identity matrix of size m × m, xB contains the m basic variables, and xN contains the n − m
e
e variables. Solving for xB yields e e
nonbasic
e
xB = b̂ − ÂxN . (12.11)
e e e ee
Thus, the basic variables xB are dependent variables while the nonbasic variables xN are independent. One
e e
particular solution is obtained when the nonbasic variables are all zero, xN = 0. In this case the basic
e e
variables can be expressed as
xB = b̂. (12.12)
e e
This solution is referred to as a basic solution. Since basic and nonbasic variables can be exchanged, several
basic solutions can be obtained. The number of basic solution is given by
n n n!
= = . (12.13)
m n−m m!(n − m)!
It can be proven that the optimum solution is one of the basic solutions.
143
As observed, n = 5 and m = 2 therefore the number of basic solutions is 10. The following table shows
all the basic solutions to this problem.
If a one or more of the basic variables in a basic solution has value of zero, that solution is said to be a
degenerate basic solution (Luenberger & Ye, 2008).
c1 x1 + c2 x2 + · · · + cn xn = f,
144
where all xi are restricted to be nonnegative, i.e.,
xi ≥ 0 for i = 1, . . . , n.
Initially, the objective function is expressed in terms of nonbasic variables. Therefore, for the initial
point, the objective function will have a zero value. In LP problems with LE constraints only, one is required
to add slack varibles. In this case the auxiliary problem is canonical with respect to the slack variables.
Therefore, they will form the first set of basic variables. The steps involved in the simplex algorithm include
the following:
Step 1. Initial basic solution. Create an initial table or initial tableau with m columns and n rows and
the corresponding coefficients of A. Name each column with the corresponding variables xi for
e
i = i, . . . , n. Add a column with the
e coefficients of b and add an extra row with the coefficients of
e
c. Select m basic variables and add an extra column with their names. Naturally, these correspond
e
to the slack variables.
Step 2. Canonical form. Perform row operations in order to convert this problem into the Canonical form as
in (12.9). The m variables correspond to the basic variables. The remaining n − m are the nonbasic
variables. In problems with LE constraints, the initial tableau is already in canonical form.
Step 3. Test for optimality. Scan the relative cost factors ĉ which should have nonzero entries only in the
e
nonbasic columns. If all nonzero entries are positive, then the current solution is an optimum. The
reason behind that is that every nonzero coefficient ĉi is multiplying a nonbasic variable (which is
set zero). If ĉi is negative, that means that xi can be a basic variable so its values will be larger than
zero and, consequently, reduce the value of the function. If ĉi is positive, then the best scenario is
that xi remains nonbasic or zero.
Step 4. Choice of nonbasic variable to become basic. If ĉi < 0, then xi should become a basic variable.
If there are multiple negative ĉi values, then one should select the minimum value so the function
reduces faster.
Step 5. Choice of basic variable to become nonbasic. Select a basic variable to become nonbasic. For this
purpose, let us evaluate bj /aji for j = 1, . . . , m and i the index of the nonbasic variable to become
basic. The basic variable xj to become nonbasic corresponds to the one with the minimum value
of bj /aji for aji > 0. This condition prevents that the remaining basic variables reach a negative
value. Section 12.4.3 explains this condition in detail.
Step 6. With the new set of basic variables, go to Step 2 and create the next tableau.
145
Example. Solve the following LP problem:
max 2x1 + x2
x
e
s.t. 2x1 − x2 ≤ 8
x1 + 2x2 ≤ 14
−x1 + x2 ≤ 4
x1 ≥ 0, x2 ≥ 0.
The simplex method requires a LP problem in standard form. Using appropriate slack variables, the
auxiliary problem can be written as
min −2x1 − x2
x
e
s.t. 2x1 − x2 + x3 = 8
x1 + 2x2 + x4 = 14
−x1 + x2 + x5 = 4
x1 ≥ 0, x2 ≥ 0
x3 ≥ 0, x4 ≥ 0, x5 ≥ 0.
Step 1. Initial basic solution. The initial basic solution is given by x1 = 0 and x2 = 0 which are the
variables in the objective function. This solution can be written as a tableau as expressed by Table
12.2. In this initial basic solution, x1 = 0, x2 = 0, x3 = 8, x4 = 14, x5 = 5, and f = 0.
Step 3. Test for optimality. We scan the row of the objective function, which should have nonzero entries
only in the nonbasic columns, i.e., x1 and x2 . If all the nonzero entries are positive, then we have
an optimum solution because the objective function cannot be reduced any further and the Simplex
method is terminated. In this problem we have negative entries in the nonbasic columns, then the
solution is not an optimum and the objective function can be reduced.
Step 4. Choice of nonbasic variable to become basic. Two nonbasic columns have negative numbers. By
convention, one selects the most negative value. In this case, this value corresponds to x1 so this
146
nonbasic variable will become basic. See Table 12.3.
Step 5. Choice of basic variable to become nonbasic. To identify which basic variable should become non-
basic, we compare the ratios bi /ai1 for all ai1 > 0. The row having the smallest ratio corresponds
to one of the current basic variable that will become nonbasic. In this case, x3 . Then we say that the
new pivot will be a11 . See Table 12.4.
Step 6. Pivoting and second tableau. Performing row operations about the pivot, we obtain the second
tableau. The new canonical form is written in terms of the new basic variables x1 , x4 and x5 . The
cost function will be 0 = f + 8 or f = −8. See Table 12.5.
Step 7. Variables in second tableau. At this point, the algorithm returns to Step 3. Following that procedure,
let us identify the basic and nonbasic variables to be exchanged and the new pivot. See Table 12.6.
Step 8. Pivoting and third tableau. Using row operations, we obtain the third tableau. See Table 12.7.
The optimality, according to Step 3, is satisfied. The objective has nonzero entries only in the
nonbasic columns, i.e., x3 and x4 , and these entries are positive. Therefore, the optimal solution to
this problem is x1 = 6, x2 = 4, x3 = 0, x4 = 0, x5 = 6 and f = −16.
147
Table 12.6: Second tableau: New pivot
xB x1 x2 x3 x4 x5 bi bj /aj2
x
e
1 1 −1/2 1/2 0 0 4
x4 0 5/2 −1/2 1 0 10 20/5 = 4
x5 0 1/2 1/2 0 1 8 16/1 = 16
−f 0 −2 1 0 0 8
and the objective function, which is written only in terms of nonbasic variables,
148
since all the nonbasic variables are zero. If all the function coefficients cj are positive, then there is no
possible improvement since all design variables have to be nonnegative. However, a lower value of f can
be obtained by increasing the value of one of the nonbasic variables xJ and adjusting the values of the basic
variables accordingly, where xJ is any nonbasic variable whose relative factor cJ is negative. In particular,
the index J can be selected as the minimum negative value. That practice usually leads to fewer iterations.
Since xJ will be a basic variable its value will be, in a non-degerate case, greater than zero. However, its
maximum value will be limited by the condition bi − ai,J xJ ≥ 0 for all i = 1, . . . , m. Notice that if all
ai,J ≤ 0 then xJ is unbounded and can be arbitrarily large. On the other hand, if at least one ai,J > 0 then
the maximum value of xJ will be bi /ai,J . Any larger value will lead to xi < 0 for some i. If more than one
aiJ is positive then the smallest ratio bi /ai,J will determine the maximum value of xJ . This is
bI bi
xJ = = min : ai,J > 0, i = 1, . . . , m . (12.17)
aI,J ai,J
In this case, xI = 0 and will be a nonbasic variable. Notice that if the basic solution is degenerate (bI = 0)
then no improvement in the objective function will be possible.
149
inequality constraint, this methodology will give an unfeasible solution, i.e., negative surplus variable. For
equality constraints, this method would be inconsistent, e.g., zero equals to a nonzero number. To avoid
these difficulties, Dantzig (1959) stated the two phases of its Simplex method.
In the first phase, artificial variables are added to the inconsistent equations and an artificial objective
function (expressed only in terms of artificial variables) is solved. Artificial variables differ from slack
or surplus variables since they do not have physical meaning. At the end of this phase, the artificial cost
function should be zero, otherwise the problem does not have a feasible solution.
The second phase consists on the solution of the original objective function. In more detail, the steps
involved the the two phases can be described as follows:
Step 1. Standard LP form: Arrange the original system of equations so that all constant terms bj are non-
negative.
Step 2. Add artificial variables: Augment the system to include a basic set of artificial variables, xn+1 , . . . , xn+m .
In practice, artificial variables are only required for GE and equality (EQ) constraints.
Step 3. Phase I: Use the simplex algorithm to find a solution to the set of linear equations (equality con-
straints) that minimizes the sum all artificial variables denoted by w and given by
Equation (12.18) is called the unfeasibility form (Dantzig, 1959) or artificial cost or artificial ob-
jective function. After pivoting, the coefficients of (12.18) will be referred to as reduced artificial
cost coefficients. If min w > 0, no feasible solution exists and the procedure is terminated. On the
other hand, if min w = 0, Phase II initiates by: (i) dropping from further consideration all non-basic
variables xi whose corresponding reduced artificial cost coefficients are positive (not zero), and (ii)
replacing the linear form w by the linear form f .
Step 4. Phase II: Apply the simplex algorithm to the adjusted feasible canonical form to obtain a solution
that minimizes f .
150
Step 1. Standard LP form. Adding slack variable x4 and surplus variable x5 , this problem can be written in
standard form as
min −x1 − x2 − 2x3
x
e
s.t 2x1 + x2 + 2x3 + x4 = 8
x1 + x2 + x3 − x5 = 2
−x1 + x2 + 2x3 = 1
x1 ≥ 0, x2 ≥ 0, x3 ≥ 0
x4 ≥ 0, x5 ≥ 0
Step 2. Add artificial variables. Artificial variables x6 and x7 are added to GE and EQ constraints, respec-
tively.
min −x1 − x2 − 2x3
x
e
s.t. 2x1 + x2 + 2x3 + x4 = 8
x1 + x2 + x3 − x5 + x6 = 2
−x1 + x2 + 2x3 + x7 = 1
x1 ≥ 0, x2 ≥ 0, x3 ≥ 0
x4 ≥ 0, x5 ≥ 0
x6 ≥ 0, x7 ≥ 0.
x6 + x7 = w.
Initial tableau. This problem can be written as a tableau as in the first sub-table of Table 12.8. The
three basic variables in this problem are the slack variable x4 and the artificial variables x6 and x7 .
However, the objective needs to be expressed in terms of nonbasic variables only.
Canonical form. Using row operation, one obtains the canonical form of the system and, as a result,
the objective is expressed only in terms of nonbasic variables. See second sub-table in Table 12.8.
Pivoting. As before, the pivots are selected using the minimum negative function coefficient cj
and the minimum positive ratio bi /aij . This process continues until all coefficient in the objective
function are positive. When this condition is accomplished and the problem has a feasible solution,
the value of the artificial objective is zero. See Table 12.8.
151
Table 12.8: Phase I
xB x1 x2 x3 x4 x5 x6 x7 bj bj /aji
ex 2 1 2 1 0 0 0 8
4
x6 1 1 1 0 −1 1 0 2
x7 −1 1 2 0 0 0 1 1
−f −1 −1 −2 0 0 0 0 0
−w 0 0 0 0 0 1 1 0
x4 2 1 2 1 0 0 0 8 4
x6 1 1 1 0 −1 1 0 2 2
x7 −1 1 2 0 0 0 1 1 1/2
−f −1 −1 −2 0 0 0 0 0
−w 0 −2 −3 0 1 0 0 −3
x4 3 0 0 1 0 0 −1 7 7/3
x6 3/2 1/2 0 0 −1 1 −1/2 3/2 1
x3 −1/2 1/2 1 0 0 0 1/2 1/2
−f −2 0 0 0 0 0 1 1
−w −3/2 −1/2 0 0 1 0 3/2 −3/2
x4 0 −1 0 1 2 −2 0 4
x1 1 1/3 0 0 −2/3 2/3 −1/3 1
x3 0 2/3 1 0 −1/3 1/3 1/3 1
−f 0 2/3 0 0 −4/5 4/3 1/3 3
−w 0 0 0 0 0 1 1 0
Pivoting. The pivots are selecting in the usual way and the problem is solved. However, the arti-
ficial design variables should remain as nonbasic variables during the second phase. The artificial
variables are used to expand the dimension of the design domain and make the problem feasible in
the first phase, but then they become nonbasic reducing the dimension of the space to the original
(standard) size. Therefore, these variables should not be used as pivots in the second phase. The
solution for this problem is found at x1 = 7/3, x2 = 0, x3 = 5/3, and f = −17/3.
152
Table 12.9: Phase II
xB x1 x2 x3 x4 x5 x6 x7 bj bj /aji
x4 0 −1 0 1 2 −2 0 4 2
e
x1 1 1/3 0 0 −2/3 2/3 −1/3 1
x3 0 2/3 1 0 −1/3 1/3 1/3 1
−f 0 2/3 0 0 −4/5 4/3 1/3 3
x5 0 −1/2 0 1/2 1 −1 0 2
x1 1 0 0 1/3 0 0 −1/3 7/3
x3 0 1/2 1 1/6 0 0 1/3 5/3
−f 0 0 0 2/3 0 0 1/3 17/3
Example. Solve the LP problem from the previous example using the Big M method,
Step 1. Penalized standard LP problem. The standard LP problem with penalized objective can be written
as
min F (x) = −x1 − x2 − 2x3 + M (x6 + x7 )
x e
e
s.t. 2x1 + x2 + 2x3 + x4 = 8
x1 + x2 + x3 − x5 + x6 = 2 (12.20)
−x1 + x2 + 2x3 + x7 = 1
xi ≥ 0 i = 1, . . . , 7.
Step 2. Solve using Simplex. Let us take M a large enough value for M . If M is too small the result might
be inconsistent. If it is too large, rounding off will result in large errors. As a rule of thumb, let M
be ten times the sum of the absolute values of the objective function coefficients, this is M = 40.
Then, let us solve the LP problem as shown in Table 12.10. Notice that the number of iterations is
not decreased.
12.7 Duality
Every linear programming problem has a corresponding dual linear programming problem. This dual prob-
lem is constructed with the cost and constraint coefficients of the initial or primal problem. However, the
solution of the dual problem can be obtained from the solution of the primal and vice versa. In certain
occasions it might be simpler to solve the dual formulation. Duality can be used to improve the performance
153
Table 12.10: Big M method
xB x1 x2 x3 x4 x5 x6 x7 bj
ex 2 1 2 1 0 0 0 8
4
x6 1 1 1 0 −1 1 0 2
x7 −1 1 2 0 0 0 1 1
−F −1 −1 −2 0 0 40 40 0
x4 2 1 2 1 0 0 0 8
x6 1 1 1 0 −1 1 0 2
x7 −1 1 2 0 0 0 1 1
−F −1 −81 −122 0 40 0 0 −120
x4 3 0 0 1 0 0 −1 7
x6 3/2 1/2 0 0 −1 1 −1/2 3/2
x3 −1/2 1/2 1 0 0 0 1/2 1/2
−F −62 −20 0 0 40 0 61 −59
x4 0 −1 0 1 2 −2 0 4
x1 1 1/3 0 0 −2/3 2/3 −1/3 1
x3 0 2/3 1 0 −1/3 1/3 1/3 1
−F 0 2/3 0 0 −4/3 124/3 123/3 3
x5 0 −1/2 0 1/2 1 −1 0 2
x1 1 0 0 1/3 0 0 −1/3 7/3
x3 0 1/2 1 1/6 0 0 1/3 7/6
−F 0 0 0 2/3 0 40 123/3 17/3
of the simplex algorithm, and also to develop non-simplex methods to solve LP problems. Examples of
non-simplex methods include Khachiyan’s algorithm and Karmarkar’s algorithm. These algorithms are not
presented in this notes. For in-depth discussion of non-simplex methods and advanced aspects to duality,
see Luenberger (1989).
Consider a primal LP problem of the form
min cT x
x e e
e
s.t. Ax ≥ b
e
ee e
x ≥ 0.
e e
Then the corresponding dual LP problem is defined as
max λT b
λ e e
e
s.t. λT A ≤ cT
e ee e
λ ≥ 0,
e e
154
where λ ∈ Rm is the vector of dual variables. This form of duality is referred to as symmetric duality form.
e
Now, consider a primal LP problem of the form
min cT x
x e e
e
s.t. Ax = b
e
ee e
x ≥ 0.
e e
Notice that Ax = b can be expressed as
e
ee e
Ax ≥ b
e
ee e
−Ax ≥ −b.
e
ee e
Then the primal problem can be written as
min cT x
x e e
e !
A b
s.t. e e x ≥
−A e −b
e
e e
x ≥ 0.
e
e e
This problem is in the form of the primal problem in the symmetric form of duality. The corresponding dual
is
T Tb
max (u v ) e
u,v
e e
e e −b
e
A
s.t. (uT v T ) ee ≤c
T
e e −A e
e
u ≥ 0, v ≥ 0.
e
e e e e
After a simple manipulation, the above can be expressed as
max (u − v )T b
u,v e e e
e e
s.t. (u − v )T A ≤ cT
e e e e e
u ≥ 0, v ≥ 0.
e e e e
155
Let λ = u − v . Then the dual problem becomes
e e e
max λT b
λ e e
e
s.t. λT A ≤ cT .
e ee e
Notice that the vector of dual variables λ is unrestricted in sign. The above form of duality is referred to as
e
the asymmetric form of duality.
According to the complementary slackness condition, the feasible solutions x and λ to a dual pair of
e e
problems (either in symmetric or asymmetric form) are optimal if and only if the following conditions are
satisfied
max 26λ
λ
s.t. λ ≤ −2
λ ≤ −1
λ ≤ −7
λ ≤ −4.
The solution is λ = −7. By the complementary slackness condition, (−(2 1 7 4) − (−7)(1 1 1 1)) x = 0.
e
Then the solution is obtained for
Exercises
1. Convert the following problem to a linear program in standard form:
2. Design a diet of bread and milk to get at least 5 units of vitamin A and 4 units of vitamin B each day.
The amount of vitamins A and B in 1 kg of each food and the cost per kilogram of food are given
in the following table. Formulate the design optimization problem so that we get at least the basic
requirements of vitamins at the minimum cost. Solve the problem graphically and show gradients of
the cost function and active constraints on the graph. Solve the problem analytically verifying the
KKT conditions in all possible solution points (e.g., interior point, one active constraint, two active
157
Vitamin Bread Milk
A 1 2
B 3 2
Cost/kg 2 1
constraints). Solve the problem using the Simplex method. Compare your result with the one obtained
using linprog from M ATLAB.
158
Chapter 13
Nonlinear programming
min cT x + 1 xT Qx
x
e
e e 2e ee
Ax ≤ b
e
s.t.
e
ee e
x ≥ 0,
e e
where Q is a symmetric, positive definite matrix. Adding slack variables y the problem above can be written
as e e
min cT x + 1 xT Qx
x
e
e e 2e ee
e
s.t. Ax + y = b
e (13.1)
ee e e
x≥0
y ≥ 0.
e e
e e
The Lagrangian to problem (13.1) is
1
L(x, y , u, v , w) = cT x + xT Qx + uT (Ax + y − b) + v T (−x) + wT (−y ),
e e e e e e e 2e ee e e ee e e e e e e
e
159
where u, v , and w are vectors of Lagrange multipliers associated with the constraints. The corresponding
e e e
KKT conditions can be expressed as
c + Qx + AT u − v = 0 (13.2)
e ee e e e e e
u−w = 0 (13.3)
e
e e e
Ax + y − b = 0 (13.4)
e
ee e e e
x ≥ 0 (13.5)
e e
y ≥ 0 (13.6)
e e
v ≥ 0 (13.7)
e e
w ≥ 0 (13.8)
e e
v T x + wT y = 0. (13.9)
e e e e
From (13.3) and (13.8), this set of equation can be stated as
Qx + AT u − v = −c (13.10)
e e ee e e e
Ax + y = b (13.11)
e
ee e e
x ≥ 0 (13.12)
e
e e
y ≥ 0 (13.13)
e e
v ≥ 0 (13.14)
e e
u ≥ 0 (13.15)
e e
T T
v x+u y = 0. (13.16)
e e e e
Notice that the set of conditions given by (13.10) to (13.15) are linear functions of the variables x,y ,u, and
eee
v . The only nonlinear function is the complementary condition (13.16). Thus the solution to the original QP
e
problem corresponds to the nonnegative solution to (13.10) and (13.11) that also satisfies (13.16).
Since Q is positive definite, the objective function in (13.1) is strictly convex. Furthermore, the con-
straints areeall linear so the problem is strictly convex. Therefore, any local minimum of (13.1) will be the
e
strict global minimum. Hence, the solution to the system (13.10) to (13.16) must be unique.
Following the procedure presented by Wolfe (1959) and referenced by Rao (2009), phase I of the simplex
method can be used to solve the aforementioned problem. This procedure involved the introduction of
nonnegative artificial variables z into (13.10) so that
e
Qx + AT u − v + z = −c, (13.17)
e e e e e e e e
e
and the coefficients of the right hand side are all positive. Change of sign in rows maybe required before the
addition of the artificial variables. The artificial cost function to be minimized corresponds to the sum of the
160
n artificial variables zi . The LP problem to be solved can be stated as
Pn
min i=1 zi
x,y ,z ,u,v
e e e e e
s.t. Qx + AT u − v + z = −c
e e e e e e e e (13.18)
Ax + y = b
e
e
ee e e
x, y , z , u, v ≥ 0.
e e e e e e
During the solution procedure, one verifies that the nonlinear constraint (13.16) is satisfied. This additional
check is a rather simple task. It is when deciding which non-basic variable will become basic. Let us
illustrate this with the following example.
min z1 + z2
x,y ,z ,u,v
e e e e e
! ! ! !
2 −1 1 3 z1 6
s.t. x+ u−v+ =
−1 2 e 1 6 e e −z2 −5
! !
1 1 4
x+y =
3 6 e e 20
x, y , z , u, v ≥ 0,
e e e e e e
verifying that
v1 x1 + v2 x2 + u1 y1 + u2 y2 = 0. (13.19)
161
The above problem is solved using the simplex method as shown in Table 13.1. In the initial tableau all the
coefficients in the right hand side are positive and the artificial variables z1 and z2 are basic. Any other two
basic variables can be selected making sure that (13.19) is satisfied. In other words, avoiding that (v1 , x1 ) or
(v2 , x2 ) or (u1 , y1 ) or (u2 , y2 ) are simultaneously basic (non-zero) variables. The solution to this problem is
x∗1 = 3, x∗2 = 0, and f ∗ = −9. The Lagrange multipliers associated with the original inequality constraints
are zero, this isu1 = u2 = 0.
This formulation works for LE inequality constraints. If there is an EQ constraint h1 = b1 , then it can
be replaced by two inequality constraints: h1 ≤ b1 and h1 ≥ b1 . One can check that a system of m EQ
constraints
h1 = b1
h2 = b2
..
.
hm = bm
162
is equivalent to the following system of m + 1 inequality constraints:
h1 ≤ b1
h2 ≤ b2
..
.
hm ≤ bm
h1 + h2 + · · · + hm ≥ b1 + b2 + · · · + bm .
min f (x)
x e (13.20)
e
s.t. gj (x) ≤ 0, j = 1, . . . , r
e
The strategy is to find a search direction d that is descent, ∇f T d < 0, and feasible, ∇gj T d ≤ 0 for j ∈ J.
e e e
In this formulation J is the active set defined as
min −β̂
β̂,dˆ
∇f T dˆ + β̂ ≤ ni=1 ∂x∂f
e P
s.t. i
∂g
∇gj T dˆ + β̂ ≤ ni=1 ∂xji , j ∈ J.
e P
(13.24)
dˆi ≤ 2
e
dˆi ≥ 0, i = 1, . . . , n
β̂ ≥ 0.
xL ≤ xk + α1U dk ≤ xU .
e e e e
Then, one evaluates all constraints gj , j = 1, . . . , r at xk + α1U dk . If the point is feasible, then αU = α1U .
e e
164
Otherwise, one has to find the upper limit of the step size α1U using the bisection method or another zero
finding procedure.
Having determined the upper limit of the step size αU , the step size αk is the one that drives the slope of
f to zero. If f 0 (αU ) < 0 then αk = αU . If f 0 (αU ) > 0 then the minimum is located in the interval [0, αU ]
and can be found using the bisection method.
fˆ(x) = m 2
P
min
x j=1 max{(0, gj + ε) }
e
e (13.26)
s.t. xL ≤ x ≤ xU .
e e e
13.2.5 Equality constraints
To incorporate equality constraints, Vanderplaats suggests the use of penalty functions. This problem is
handled as
f (x) − r lj=1 hj (x)
P
min
x e e
(13.27)
e
s.t. gi (x) ≤ 0, i = 1, . . . , m
hj (x) ≤ 0, j = 1, . . . , l.
e
e
Another approach is to convert an equality constraint into two inequality constraints. For example,
h(x) = b
e
can be approximated to
9 10
b ≤ h(x) ≤ b.
10 e 9
13.2.6 Algorithm
Step 1. Determine a feasible starting point x0 . Use (13.26) if necessary.
e
Step 2. Determine the active set J of active constraints.
xk+1 = xk + αk dk .
e e e
165
and return to Step 2.
Example. Solve
max −x21 + 3x1 x2 − 4.5x22 + 10x1 + 6x2
x
e
s.t. x1 − x2 ≤ 3
x1 + 2x2 ≤ 12
x1 , x2 ≥ 0
from the initial point x0 = (4, 4)T . This problem can be expressed as,
e
min f (x) = x21 − 3x1 x2 + 4.5x22 − 10x1 − 6x2
x e
e
s.t. g1 (x) = x1 − x2 − 3 ≤ 0
g2 (x) = x1 + 2x2 − 12 ≤ 0
e
x1 , x2 ≥ 0
e
At the initial point, f (x0 ) = −24, g1 (x0 ) = −3, and g2 (x0 ) = 0. Then this point is feasible and g2 is
e e e
active. The gradients of the objective function and the active constraint evaluated at x0 are
e
∇f (x0 ) = (−14, 18)T ∇g2 (x0 ) = (1, 2)T
e e
A descent and feasible search direction can be obtained solving the LP problem
ˆ
d1
ˆ
min 0 0 −1 d2
β̂,dˆ
e β̂
! dˆ1
!
−14 18 1 ˆ 4
s.t. d2 ≤ (13.28)
1 2 1 3
β̂
ˆ
0 d1 2
ˆ
0 ≤ d2 ≤ 2
0 β̂ ∞
The solution to this problem is dˆ1 = 0, dˆ2 = 0, and β̂ = 3; this is d1 = −1, d2 = −1, and β = −3.
The step size is found as
which is α0 = 0.8. The candidate next point is (3.2, 3.2)T . One can check that this point is feasible,
therefore x1 = (3.2, 3.2)T . In the new point, there is no active set so one can use the steepest descent
method. The solution to this problem is x∗1 = 6, x∗2 = 3, and f ∗ = −55 with the two active constraints,
e
166
g1 = 0 and g2 = 0.
min f (x)
x e
(13.29)
e
s.t. hi (x) = 0, i = 1, . . . , m
xL ≤ x ≤ xU .
e
e e e
If there is an inequality constraint gj (x) ≤ 0, then this can be converted to an equality through the additions
e
of a slack variable,
has m linearly independent rows. In other words, rank(Dh) = m. Now, let us do the following partition:
e
∂h1 ∂h1 ∂h1 ∂h1
∂y1 . . . ∂ym ∂z1 . . . ∂zn−m
∂h ∂h2 ∂h2 ∂h2
!
∂h 2
∂y1 . . . ∂ym ∂z1 . . . ∂zn−m ∂h ∂h
= = = B C , (13.33)
∂x ... .. .. .. .. .. ∂y ∂z
e e e
. . . . . e
e ee
e e e
∂hl ∂hm ∂hl ∂hm
∂y1 . . . ∂ym ∂z1 . . . ∂zn−m
167
inverted.
Conveniently, the objective function can be expressed as f (x) = f (y , z ) and the constraints can be
e e e only on z . The gradient of
expressed as h(x) = h(y , z ) = 0. Since y is a function of z , then f and h depend
f in the (n − m) dimensional
e e ee e e e e e
z -space is e
called the reduced gradient. The reduced gradient can be expressed
e
as
df ∂f dy ∂f
RT = = e+ . (13.34)
e dz ∂y dz ∂z
e e e e
For the equality constraints, h = 0, one observes that
e e
dh ∂h dy ∂h dy
e = e e + e = B e + C = 0. (13.35)
dz ∂y dz ∂z e dze e
e e e e
e e e e
Solving for dy /dz yields
e e dy
−1
e = −B C . (13.36)
dz e
e e e
e
Substituting (13.36) into (13.34), the reduced gradient can be expressed as
∂f ∂f
RT = − B −1 C + . (13.37)
e ∂y e
e ee ∂ze
e
The search direction d is partitioned as
e dy
d= e , (13.38)
e dz
e
where dy and dz represent the components of d in the y - and z -spaces, respectively. Particularly, the direction
dz is chosen to be the steepest descent direction ine z -space. This is dz = −R. However, since each
e e e e
component zi is bounded between ziL and ziU for i = 1, . . . , n − m, then one can apply the following rule:
e e e e
0 if zi = ziL and Ri > 0
dzi = 0 if zi = ziU and Ri < 0 (13.39)
−Ri otherwise
In practice, one can implement the check zi < ziL + εz and zi > ziU − εz rather than zi = ziL and zi = ziU ,
respectively, where εz is a small value.
Given dz , then dy can be obtained from (13.36) as follows:
e e
dy = −B −1 C dz . (13.40)
e e e
e ee
If d = 0, then the current point is a KKT point and the iterations are terminated. Otherwise, the algorithm
e e
performs a line search to determine the step size along the search direction d.
e
168
13.3.2 Step size
Given a search direction dk , the step size αk is determined from the following optimization problem
e
min f (xk + αdk )
α e e (13.41)
s.t. xL ≤ xk + αdk ≤ xU .
e e e e
One procedure is to solve the unconstrained optimization problem and determined if the new point xk+1 =
e
xk + αk dk satisfies the geometric constraint. If the new point violates this constraint, then the step size is
e e
obtained from
xL ≤ xk + αk dk ≤ xU .
e e e e
Now, one has to verify that the new point satisfies the equality constraints of the original optimization
problem. If it does not, then a correction step is required.
13.3.3 Correction
If all the constraints h were linear, then xk+1 is a new improved point. However, with nonlinear constraints,
e e
xk+1 may not be a feasible point, this is
e
max {|hi (xk+1 )|} > εh ,
i=1,...,m e
where εh is a tolerance that determines the violation of the constraints. When that occurs, one has to adjust
the dependent variables y to return to the feasible region while keeping the independent variables fixed. The
problem to be solved cane be written as
h(y , z k+1 ) = 0. (13.42)
ee e e
To this end, the algorithm might use any zero-finding technique such as the Newton-Raphson method.
(0)
Starting from y k+1 , then
e (r+1) (r) (r)
y k+1 = y k+1 + ∆y k+1 , (13.43)
e e e
where
(r)
(r+1) (r)
∂h(y k+1 , z k+1 ) (r)
h(y k+1 , z k+1 ) ≈ h(y k+1 , z k+1 )
+ ee e ∆y k+1 = 0 (13.44)
ee e ee e ∂y e e
e
or " (r) #−1
(r) ∂h (r)
∆y k+1 = − ek+1 hk+1 . (13.45)
e ∂y e
e
13.3.4 Algorithm
Step 1. Choose feasible starting starting point x0 .
e
169
Step 2. Determine the basic and nonbasic variables. In general, the variables in the objective function
might be selected as basic variables. In some occasions these variables should be determined by
performing pivoted Gaussian elimination on the matrix ∇hT . Determine B and C and evaluate R.
e e
e e
e e
Step 3. Determine the direction vector dk from (13.38). If dk = 0, then stop since the current point is a
e e e
KKT point.
Step 4. Determine the step size αk form (13.41) and determine a candidate design xk+1 = xk + αk dk .
e e e
Step 5. If xk+1 is feasible, then set xk = xk+1 and go to Step 2. Otherwise, perform Newton-Raphson
e e e
correction to return to feasibility. If f (xk+1 ) < f (x) then set xk = xk+1 and go to Step 2. If
e e e e
f (xk+1 ) > f (xk ) then set αk = αk /2 to obtain a new xk and go to the beginning of this Step.
e e e
Example. Solve the following NLP problem:
x3 ≥ 0, x4 ≥ 0,
e
∂f ∂f −1
RT = − B C = −2 0
e ∂z ∂y e
e ee
e e
The search direction in the reduced z -space is
e
170
2
dz = ,
e 0
and
−1 0.5556
dy = −B C dz = .
e e
e e
ee −0.4444
For α = 1,
1 0.5556 1.5556
1 −0.4444 0.5556
x1 = +
= 2 .
e 0
2
6.2 0 6.2
(0)
Since h1 = −0.197531 and h2 = 0.246914 this point is not feasible. Using Newton-Raphson from y 2 =
(1)
(1.5556, 0.5556)T , one obtains y 2 = (1.5734, 0.409895)T . One observes that h = (−0.0212171, 0.000254688)T .
e
(2)
In the next Newton-Raphson iteration, y 2 = (1.58036, 0.401002)T and h = (0, 0)T . That would be the
e e
e
end of the first iteration, so the correctedepoint is
1.58036
0.401002
x1 =
.
e 2
6.2
171
The linearized problem about xk can be written as
e
min fL (x) = f (xk ) + ∇f (xk )T (x − xk )
x e e e e e
hLi (x) = hi (xk ) + ∇hi (xk )T (x − xk ) = 0, i = 1, . . . , m (13.47)
e
s.t.
gLj (x) = gj (xk ) + ∇gj (xk )T (x − xk ) ≤ 0, j = 1, . . . , r.
e e e e e
e e e e e
The first step of the SLP algorithm is to find the search direction dk . From the problem above, one can
e
stated dk as the solution of
e
min fL (d) = f (xk ) + ∇f (xk )T (d)
d e e e e
hLi (d) = hi (xk ) + ∇hi (xk )T (d) = 0, i = 1, . . . , m
e
s.t. (13.48)
gLj (d) = gj (xk ) + ∇gj (xk )T (d) ≤ 0, j = 1, . . . , r
e e e e
−dLk ≤ d ≤ dU
e e e e
k ,
e e e
where the bounds −dLk and dU k are referred to as move limits. Without the addition of the move limits, dk
e e e
may not be bounded or its value may be too large invalidating the linear approximation.
Usually the move limits are selected as some fraction of the current design variable values. If the
resulting LP problem turns out to be infeasible, the move limits will have to be relaxed (i.e., allow larger
changes in design) and the subproblem will have to be solved again. As in trust region methods, the move
limits might be adjusted at every iteration.
13.4.2 Algorithm
Step 1. Set k = 0. Define an initial feasible point x0 , and tolerances εc and εd for constraint violation and
e
changes in the design variables.
Step 2. Evaluate the function and the constraints and their gradients at the current design point xk .
e
Step 3. Define the LP sub-problem as in (13.48). Select the proper move limits.
172
Example. Consider the following NLP problem
Using Simplex, the new direction is d0 = (−1, −1)T the new point is x1 = (0, 0)T .
e e
173
and the KKT conditions can be stated as
∂L(x, λ) ∂f (x) T ∂h(x) T
e e = e +λ e e = 0
∂x ∂x e ∂x e
∂L(x, λ)
e e e
= h(x) = 0T ,
∂λ
e e
e e e
e
or
∇f (x) + A(x)T λ
!
∂L(x, λ) T
F (x, λ) = = e e e e =e
e 0, (13.50)
∂(x, λ)
e e
e e e h(x)
e e e e
where
∂h(x) T
T
A(x) = = ∇h(x) = ∇h1 (x), . . . , ∇hm (x) .
∂x
e e
e
e e e e e e
e
One approach to solve this problem is by using Newton’s method. The Jacobian of (13.50) is given by
T
∂F (x, λ) W (x, λ) A(x )
e e e = f
f e e e e e , (13.51)
∂(x, λ) A(x) 0
e e e
e e e
e
where W denotes the Hessian of the Lagrangian with respect to x,
f
f e
174
lowing QP problem:
1 T
min + ∇fk T d
2 d W kd
d e f f e e (13.54)
e
s.t. Ak d + hk = 0.
e
e e e e
With the assumptions about Ak and W made above, this problem has a unique solution (dk , µk ) that satisfies
e f e e
the KKT conditions e f
W k dk + ∇fk + Ak T µk = 0, (13.55)
f e
f e
e e e
Ak dk + hk = 0. (13.56)
e
e e e e
Reorganizing terms, these conditions can be written as
W k Ak T
! !
dk −∇fk
f e e
e = . (13.57)
Ak 0 µk −hk
f
e
e e
e e e
Adding the term Ak T λk from the first set of equations in (13.53), one obtains that
e
e e
W k dx + Ak T (λk + dλ ) = −∇fk .
f e
f e
e e e
By comparison with the first set of equations in (13.57), one observes that these two expressions are the
same when dx = dk and λk+1 = µk . This relationship is referred to as the equivalence between QP and
e e e
Newton’s method. e
−Ak W −1 T
k (∇fk + Ak µk ) + hk = 0,
e
e ff e
e e e e
175
−Ak W −1 −1 T
k ∇fk − Ak W k Ak µk + hk = 0.
e
e ff e
e ff e e e e e
Solving for µk
h i−1
µk = Ak W −1 −1
e
T
k A k A k W k ∇f k + h k ,
e e
e ff e e e
e f f e
h i−1 h i−1
µk = Ak W −1
k A k
T
A k W −1
k ∇f k + A k W −1
k A k
T
hk .
e e f
e f e e e
e f f e f
e f e e e
Replacing into (13.60)
dk = −W −1 −1
k ∇fk − W k Ak µk ,
T
e f
f f e
f e e
h i−1 h i−1
dk = −W −1 k ∇f k − W −1
k A k
T
A k W −1
k A k
T
A k W −1
k ∇fk − W −1
k A k
T
A k W −1
k A k
T
hk .
e f
f f e
f e e
e f f e e e
e f f f e
f e e
e f f e e e
In general, W k is not invertible; however, one can approximate W −1 k using BFGS or DFP methods and
make is invertible and also positive definite. In the case in which W −1
f f
k = I , the above equation can be
f f
f e
simplified as f e
h i−1 h i−1
dk = −∇fk − Ak T Ak Ak T Ak ∇fk − Ak T Ak Ak T hk .
e e
e e
e ee e
e e
e e
e e e e
Or simply dk = d1 + d2 where
e e e
h i−1
T T
d1 = − I − Ak Ak Ak Ak ∇fk (13.61)
e e
e e e e
e ee e
e
and h i−1
d2 = −Ak T Ak Ak T hk . (13.62)
e e
e e
e ee e
Geometrically, d1 represents the projection of the steepest descent direction onto the tangent plane to the
e
active constraints at xk and d2 is the correction direction which points towards the feasible region. One can
prove that d1 T d2 = 0.
e e
e e
Example. Consider the following NLP problem
176
The constraints can be expressed as
!
1 + x1 + x2
h(x) = ,
e e −1 + x1 − 41 x22 + x3
3 77
−40 2 −2
3 83
d0 = 40 + 2 = 2 .
− 49 − 49
e
0
min f (x)
x e
e
s.t. hi (x) = 0, i = 1, . . . , m (13.63)
gj (x) ≤ 0, j = 1, . . . , r
e
xL ≤ x ≤ xU .
e
e e e
Given a point xk and using a line search approach, a new improved design is obtained as xk+1 =
e e
xk + αk dk . The search direction vector dk can be found from the solution to the following QP subproblem:
e e e
min ∇f (xk )T d + 12 dT ∇2 f (xk )d
d e e e e e
T
e
s.t. hi (xk ) + ∇hi (xk ) d = 0, i ∈ J1 (13.64)
gj (xk ) + ∇gj (xk )T d ≤ 0, j ∈ J2
e e e
xL ≤ xk + d ≤ xU .
e e e
e e e e
The Hessian of the objective function can be approximated using the DFP or BFGS formulae. The active
sets J1 and J2 in (13.64) are defined as
177
where δ is a small number specified by the user. In the above definitions, V (xk ) represents the maximum
e
violation as defined by
For example, if g (xk ) = (−1.5, −0.3, 0.3, 1.3, 1.6, 1.7)T , then V (xk ) = {1.7}. If δ = 0.1, then
V − δ = 1.6 and the eactive set is J2 = {5, 6}.
e e
where V is defined as in (13.67). The value of the penalty parameter R is chosen such that
X
R≥ |µi |, i ∈ J1 ∪ J2 (13.69)
i
178
Part V
Integer Programming
179
Chapter 14
Numerical methods
Many problems in engineering involve the use of discrete variables. For example, binary decision variables
(e.g., turn off or turn on) or the selection of a discrete number of values (e.g., values from a sheet metal
thickness chart). Other discrete variables can be expressed in real numbers, (e.g., 0, 1, 2, 3 . . .). In some
cases it is possible to approximate a real number to an integer. For example, 4, 567.8 manufactured parts
could be rounded to any closer integer with no meaningful change in the result. However, when the variable
values are small, rounding could significantly change the result, e.g., 3.4 airplanes might not be rounded to
3 or 4 without significant change in the budget.
Most industrial applications involve the use of some integer variables. These problems are referred to
as mixed integer programming (MIP) problems. These problem could be linear, i.e., mixed-integer linear
programming (MILP), or nonlinear, i.e., mixed-integer nonlinear programming (MINLP). When the prob-
lems involve only integer variables they are called integer programming (IP) problems. In the same way,
problems involving only discrete variables are discrete programming (DP) problems. A special class of an
IP problem would be the binary integer programming (BIP) problems that only involve binary variables.
Two common methods to solve problems involving binary, integer and discrete variables are the implicit
enumeration (IE) method and the branch and bound (BB) method. These two methods are presented by
Belegundu & Chandrupatla (1999) and reviewed in this chapter.
min f (x) = cT x
x e e e
e
s.t. Ax − b ≥ 0 (14.1)
e
ee e e
xi ∈ {0, 1}, i = 1, . . . , n
180
where each coefficient ci is non-negative (ci ≥ 0). The initial design is selected as x = 0 which gives the
e e
minimum possible value to the objective function. If that design is feasible, the search is over. If it is not
feasible, then we make use of IE technique to find the solution which is described in this section.
Writing the problem in IE standard form is rather simple. A LE constraint can be multiplied by −1
to make it GE constraint. An equality constraint h(x) = b, can be replaced by two inequality constraints
h(x) ≤ b and h(x) ≥ b. A set of EQ constraints
e
e e
l1 (x) = b1
(14.2)
e
l2 (x) = b2
e
l3 (x) = b3
e
is equivalent to
l1 (x) ≤ b1
≤ b2
e
l2 (x)
(14.3)
≤ b3
e
l3 (x)
≥ b1 + b2 + b3 .
e
l1 + l2 + l3
Finally, if a coefficient ci is negative then xi is replaced by the new variable yi = 1 − xi .
x1 + x2 ≥ 1,
x1 + x2 ≤ 1.
All the LE constraints are multiplied by −1, so the problem can be written as
Finally, the negative coefficient in the cost function can be turned positive with the change of variable
181
x3 = 1 − x2 . Then, the problem can be written as
The main steps of the IE process involve fathoming and backtracking. The search process can be illus-
trated with nodes and branches. From node k we choose variable xi to be fixed at 1 and we are at node i.
Then the following possibilities exist:
If the node is in one of the first three states, then the branch is fathomed and we must attempt to back-
track. Case 4 is the default when 1, 2, and 3 are not satisfied. In this case, further search is necessary. A
new variable to be raised is to be chosen from the free variables. Backtracking refers to the step in which
one fixes xi = 0 from xi = 1. Fathoming is the step where a new variable to be brought in is chosen. Let us
illustrate this with the following example.
xi ∈ {0, 1}, i = 1, 2, 3.
e
The explicit enumeration is observed in Table 14.1 where the optimum is located at (0, 0, 1).
Using implicit enumeration, the initial point is (0, 0, 0). Since this point is not feasible, then one per-
forms fathoming, a systematic procedure to determine whether improvements could be obtained by chang-
ing the levels of the variable in succession. Increasing x1 = 1, one obtains a feasible solution with f = 4.
Adding an extra variable, e.g., x2 = 1 or x3 = 1, will only increase the value of f . Then, the search along
the branch with x1 = 1 can be terminated.
182
Table 14.1: Explicit enumeration for (14.4)
x1 x2 x3 g1 g2 g3 f Feasible
0 0 0 6 −2 −1 0 No
0 0 1 0 1 0 3 Yes
0 1 0 3 1 −1 5 No
0 1 1 −3 4 0 8 No
1 0 0 7 0 0 4 Yes
1 0 1 1 3 1 7 Yes
1 1 0 4 3 0 9 Yes
1 1 1 −2 6 1 12 No
The next step is backtracking with x1 = 0. Raising x3 = 1 brings feasibility and f = 3 which is lower
than before. Therefore, the solution is updated. Increasing another variable will increase f then the branch
with x3 can be terminated.
For x1 = 0 and x3 = 0 it is not possible to achieve feasibility by raising x2 , since g3 = −1 ≤ 0. Then
the search is complete as there are no more free nodes and the solution is (0, 0, 1) with f = 3.
2. The value of the objective function of P̂ is not worse than the one for P .
The BB method starts by solving the relaxed LP problem. If at the end of this stage all variables are
integer then that is the solution of the MILP problem. Otherwise the BB algorithm performs branching by
selecting one of the design variables xi with no integer value and creating two LP subproblems. For binary
problems one assigns xi = 0 to the design variable and the other assigns x1 = 1. If one of these two
subproblems has a integer solution, there is no need to further explore that branch. Otherwise one selects
another non integer design variable and repeats the procedure. Let us illustrate the BB method through the
following example.
183
Example. Consider the following optimization problem
xi ∈ {0, 1}, i = 1, 2, 3.
e
0 ≤ xi ≤ 1, i = 1, 2, 3.
e
The solution to this LP problem is x∗1 = (0.626, 0.625, 1)T and f1∗ = 13.5 which is the upper value for the
IP problem, f U = 13.5. For now, f L = −∞. In this node or solution there are two non-integer variables,
e
x1 and x2 . We select to branch from x1 by forcing it to be integer. Then we have two new LP problems, one
with x1 = 0 (LP2) and one with x1 = 1 (LP3). The other two variables will remain relaxed. This process is
referred to as branching. LP2 is
and the solution is x∗2 = (0, 1, 1) and f2∗ = 10 which is the new lower limit, f L = 10. The difference
e
between the upper and lower limits is known as the gap, ∆. In this case, ∆ = 13.5−10 = 3.5. Convergence
can be obtained when
∆
≤ε (14.8)
1.0 + |f L |
where ε is a proper tolerance value. The value 1.0 ensure that this condition can be evaluated when f L = 0.
For now, ∆/1.0 + |f L | = 0.318. If this value is less than the tolerance, the search is over.
184
LP3 is given by
max f (x) = 8x1 + 4x2 + 6x3
x e
e
s.t. g1 (x) = 5x1 + 3x2 + 4x3 ≤ 9
g2 (x) = 6x1 + 2x2 + 3x3 ≤ 8
e (14.9)
e
x1 = 1
0 ≤ xi ≤ 1, i = 2, 3,
and x∗3 = (1, 0.52, 0.327) with f ∗ = 12, then f U = 12, ∆ = 2. Now, ∆/1.0 + |f L | = 0.1818. If there is
e
no convergence, then we branch x1 .
LP4 will be defined by
max f (x) = 8x1 + 4x2 + 6x3
x e
e
s.t. g1 (x) = 5x1 + 3x2 + 4x3 ≤ 9
g2 (x) = 6x1 + 2x2 + 3x3 ≤ 8
e
e (14.10)
x1 = 1
x2 = 0
0 ≤ x3 ≤ 1,
and x∗4 = (1, 0, 0.667), f ∗ = 12. There is no improvement so the brach is considered explored. Now, LP5
e
is
max f (x) = 8x1 + 4x2 + 6x3
x e
e
s.t. g1 (x) = 5x1 + 3x2 + 4x3 ≤ 9
g2 (x) = 6x1 + 2x2 + 3x3 ≤ 8
e
e (14.11)
x1 = 1
x2 = 1
0 ≤ x3 ≤ 1,
and x∗5 = (1, 1, 0), f ∗ = 12. No better solution can be achieved. This is the solution to this problem.
e
xi = Ii + αi , (14.12)
xi ≥ Ii + 1 (14.13)
xi ≤ Ii . (14.14)
These constraints exclude the region where the possible non-integer answer might be and states two LP
185
sub-problems. This dichotomy is the key of the BB method. To illustrate this methods, let us consider the
following example.
x1 , x2 ≥ 0 are integer.
e
The solution of the LP1 relaxed problem (no integer constraint) is x∗1 = (2.0833, 3.6667)T with f ∗ =
e
15.167. From the two variables, one can select the variable with the minimum integer infeasibility, that is,
the variable whose value is closest to α = 0 or α = 1 but not equal to 0 or 1; or one can also select the
variable with the maximum integer infeasibility, which is the variable whose value is closest to α = 0.5. Let
us use the later selection criterion, so x2 is constrained.
In LP2, let us impose the constraint x2 ≥ 4. The solution to this relaxed problem is x∗2 = (1.25, 4)T
with f2∗ = 14.5. In LP3, x2 ≥ 4 and x1 ≥ 2, but the solution is not feasible, g1 = 48 and g2 = 24. Then,
e
for LP4, x2 ≥ 4 and y1 ≤ 1. The solution is x∗3 = (1, 4.1)T with f ∗ = 14.3.
For LP5, x1 ≤ 1 and x2 ≥ 5 and the solution is not feasible. For LP6, x1 ≤ 1 and x2 ≤ 4, the solution
e
is x∗6 = (1, 4)T with f ∗ = 14.0. This is an integer and feasible condition. This provides the lower limit
f L = 14 and this branch is completely explored.
e
For LP7, x2 ≤ 3. Exploring this branch one finds the solution x∗ = (1, 4) with f ∗ = 14.0 corresponding
e
to LP6.
186
Chapter 15
Modeling
0 ≤ z ≤ 11,
it can be expressed as
The product of binary variables can be substituted for a variable y and two constraints. One of these con-
straints makes y = 0 if any xi = 0. The other constraint makes y one if all xi are one. This can be expressed
as
x1 x2 · · · xk = y
x1 + x2 + · · · + xk − y ≤ k − 1
(15.4)
x1 + x2 + · · · + xk ≥ ky
xi , y ∈ {0, 1}, i = 1, . . . , k.
Let us illustrate this procedure with the following example.
187
Example. Using the polynomial properties presented before, state the corresponding LP expression of the
following NLP problem,
max 3x21 x2 x33
x
(15.5)
e
s.t. 4x1 + 7x22 x3 ≤ 12
x1 , x2 , x3 ∈ {0, 1}.
Using (15.3), the problem can be written as
max 3x1 x2 x3
x
(15.6)
e
s.t. 4x1 + 7x2 x3 ≤ 12
x1 , x2 , x3 ∈ {0, 1}.
max 3y1
x ,y
e e
s.t. 4x1 + 7y2 ≤ 12
x1 + x2 + x3 − y1 ≤ 2
x1 + x2 + x3 ≥ 3y1 (15.7)
x2 + x3 − y2 ≤ 1
x2 + x3 ≥ 2y2
x1 , x2 , x3 , y1 , y2 ∈ {0, 1}.
188
Chapter 16
Applications
Example. You would like to pack four items with values of $9, $12, $5, and $4, respectively. The weight
of these items are 3, 4, 2, and 1 kg, respectively. The capacity of your bag is 7 kg. Determine which items
to carry in order to maximize the value of the contents in your bag.
The answer to this problem is x∗1 = 0, x∗2 = 1, x∗3 = 1, and x∗4 = 1 for a value of $21.
189
Example. A student must register for four courses next semester: Chemistry, Physics, Mathematics, and
Design. There are three sections of Physics and two sections of each of the other courses. The following
combinations of sections are not possible because of time overlaps:
The student preference weight values from 1 to 5 for the various sections and the corresponding binary
design variables are shown in Table 16.1.
In the optimization problem xi = 1 implies that section i is chosen and xi = 0 implies that it is not. The
BIP problem can be written as
190
from city i to city j or from j to i). This problem is known as the symmetric TSP. In the asymetric TSP, the
cost to travel in one direction may differ from the cost to travel in the other, and the decision variables must
distinguish between the two directions. Clearly the asymetric problem is the more general.
The constraints of this problem include that the seller must start and finish in the same city and it must
visit all the cities and each city only once. The optimization problem can be expressed as
This is an example of a balanced transportation problem in which the total demand is equal to the total
offer. If the problem is not balanced, then one can add artificial source and/or destination nodes. The costs
associated with these artificial nodes can be made equal to zero.
191
Example. Goods manufactured at three stations are to be delivered to four locations. The supply at the
stations is s = (5, 8, 9)T while the demand is at the locations is d = (3, 9, 4, 6)T . The corresponding
e e
transportation costs are
T
3 2 6 5
c = 8 4 2 1 .
e
e 2 7 4 2
These problems can be solved using conventional simplex method; however, the size of the coefficient
matrix can be very large, i.e., (m + n) × mn. In this case, the dual formulation is a more efficient approach
(Belegundu & Chandrupatla, 1999). The dual problem can be stated as
Pm Pn
max i=1 si ui + j=1 dj vj
u,v (16.5)
e e
s.t. ui + vj ≤ cij i = 1, . . . , m, j = 1, . . . , n.
192
Part VI
Global optimization
193
Chapter 17
Genetic algorithms
17.1 Description
Genetic algorithms (GAs) are stochastic search techniques based on the principals of natural selection and
genetic recombination as observed in nature. These techniques were formally introduced in the United States
in the 1970s by John Holland at University of Michigan (Holland, 1975). Although, this search approach is
inherently an optimization process, since it searches for the fittest or optimal solution to a particular problem,
it has been used in a wide variety of applications (Chambers, 1995). In particular, genetic algorithms work
very well on mixed (continuous and discrete), combinatorial problems. They are less susceptible to getting
“stuck” at local optima than gradient search methods, but they tend to be computationally expensive. The
continuing price/performance improvements of computational systems has made them attractive for certain
applications.
This section presents an illustrative example of the use of genetic algorithms in an optimization problem,
along with the code for its implementation in M ATLAB.
17.2 Components
The three most important aspects of using genetic algorithms are:
Once these three have been defined, the generic genetic algorithm should work fairly well. Beyond
that, you can try many different variations to improve performance, find multiple optima (if they exist), or
parallelize the algorithm.
194
17.3 Algorithm
A traditional implementation of a genetic algorithm is as follows:
5. Evaluate the new individuals and insert them into the population.
6. If the convergence condition is reached, stop and return the best individuals; if not, go to 3.
The binary alphabet (0, 1) is often used to represent the members of a population, although depending
on the application integers or real numbers are used. In fact, almost any representation can be used that
enables a solution to be encoded as a finite length string.
17.4 Implementation
17.4.1 Test problem
For the specific purpose of this paper, let us explain the use of a genetic algorithm through an example. Let
us consider the following optimization problem presented by Reeves & Rowe (2003):
The conventional use of a genetic algorithm requires the representation of the design variables as a genome
or chromosome. This is nothing but a binary representation. For the optimization problem given by (17.1),
the encoding function is such that
00000 = 0
00001 = 1
.. ..
. .
11111 = 31
The genetic algorithms are stochastic in nature and require the use of a random number source. For this
problem let us use the following array of random numbers obtained from M ATLAB.
195
Table 17.2: Random numbers
0.6038 0.0153 0.9318 0.8462 0.6721 0.6813 0.5028 0.3046 0.6822
0.2722 0.7468 0.4660 0.5252 0.8381 0.3795 0.7095 0.1897 0.3028
0.1988 0.4451 ···
0.9501 0.2311 0.6068 0.4860 0.8913 0.7621 0.4565 0.0185 ···
P = (1 − (1/2)N −1 )L , (17.2)
For example, a population of 10 is enough to ensure that the required probability exceeds 99% for strings
of length 5. Initial random populations do not necessarily cover the search space uniformly, and there may
be advantages in terms of coverage if we use more sophisticated statistical methods. Let us take our genes
of 5 alleles, labeled 0,. . .,4. We choose the population size N to be a multiple of 5, and the alleles in each
“column” are generated as an independent random permutation of 0,. . .,N − 1, which is then taken module
5. For our example, let us assume that we have a initial population of 4 individuals. If we generate a random
number r, then we assign each allele of the chromosome the value 0 if r < 0.5, and a 1 otherwise. The first
five random numbers in Table 17.2 generate the chromosome 10111. Applying the decoding function from
Table 17.1, this number corresponds to
x = 1 · 24 + 0 · 23 + 1 · 22 + 1 · 21 + 1 · 20 = 23,
and its function value is f (23) = 1227. Following the same procedure with 3 more sets of random numbers
produces the first generation. This initial population is shown in Table 17.3.
196
Table 17.3: Initial population
17.4.3 Selection
The final column in Table 17.3 is the fitness-proportional selection probability. This is the fitness value
divided by the total fitness,
f (x)
s(x) = P . (17.4)
f (x)
From this column we can derive the following cumulative distribution for roulette-wheel selection:
17.4.4 Crossover
The next two random numbers, starting the fourth row of Table 17.2, are 0.9501 and 0.2311, which implies
that we select strings 4 and 2 as parents of the next generation. Now we perform crossover and mutation of
these strings. Crossover is an operation that swaps genetic material between the parent chromosomes after
some selected crosspoint. In the single one-point crossover, we choose this crosspoint with equal probability
from the numbers 1, 2, 3 and 4, so we can use the following distribution:
As the next random number is 0.6068, the selected crosspoint is 3. If we cross the strings (10000) and
(11010) at the 3rd crosspoint, the resulting strings are (10010) and (11000).
From these two children we select one with a probability of 0.5. Since the next random number is
0.4860, we choose the first one, i.e., (10010). Another criteria to choose the child is the so-called elitism.
This is nothing but selecting the child with the best fitness.
197
17.4.5 Mutation
The concept of mutation is even simpler than crossover: a gene (or subset of genes) is chosen randomly and
the allele value of the chosen genes is changed. We shall suppose that the mutation probability pm is 0.10
for each locus of the string. Since the next random number is 0.8913(> 0.10) there is no change to the allele
value at locus 1. Similarly loci 2, 3 and 4 remain the same, but at locus 5 the random number is 0.0185 so
the allele value for this gene changes from 0 to 1. The final string is (10011), which decodes to x = 19 with
fitness f (19) = 2399. This procedure can be repeated to produce a second generation as seen in Table 17.6.
The search for the maximum (i.e., x = 10) will continue until it finds the optimum point. This can
happen after several generations when all the individuals have the same value. The genetic algorithm can
run until it reaches a maximum number of generations. The next section presents the M ATLAB code used to
implement the example above.
Finally, as an optimization technique, genetic algorithms possess an implicit parallelism: different partial
effective gene combinations—or schemata, are searched in parallel manner, simultaneously for all searched
combinations. Genetic algorithms are most attractive because they are used for the purpose of global opti-
mization, where the absolute optimum of a search space is sought. This a result of the entire design space
being searched. Because of the parallel nature of the GA approach, the performance is much less sensi-
tive to initial conditions. Most gradient-based algorithm use local gradient information that confines the
optimization to that search space leading to locally optimum solutions. Though these gradient-based opti-
mizations are effective in unimodal search spaces where there exists only one optimum, they are less capable
of locating the global optimum in multi-modal search spaces with multiple optima.
function gafun
% Implementation of a maximization problem
% A. Tovar
clear ’all’
% 1) Initial population
198
% 1.1) Size of the initial population
% L=5 %length of the string
% P=.999 %desired probability
% N=round(real(1+log(-L/log(P))/log(2))) %population
% or
L=5 %length of the string
N=5 %number of individuals
P=(1-(0.5)ˆ(N-1))ˆL %probability
% 1.2) Initial population
for n=1:N
binx(n,:)=sprintf(’%d’,rand(1,L)<ones(1,L)*0.5);
end
it=0;
while it<50
it=it+1;
%2) Evaluation
x=decoding(binx);
fx=maxfun(x);
tfx=sum(fx);
%3) Fitness proportional selection probability and
% Initial cumulative distribution
sx=fx./tfx;
tsx=sum(sx);
csx=cumsum(sx);
%4) Table of the generation
disp(sprintf(’\n’))
disp([’generation ’,num2str(it)])
disp(sprintf(’%s’,’ x fx csx ’))
disp(num2str([x,fx,csx]))
%5) Parents and children
for k=1:N
parents(k,:)=getparents(rand,rand,csx);
bparents=binx(parents(1,:),:);
[cpt(k,1),binxc(k,:),binx(k,:)]=getbchild(bparents,rand);
end
pause
end
%--------------------------------------------------------------------------
function [cpt,bchild,bchildm]=getbchild(bparents,pc)
j=0;
cpt=0;
szbpar=size(bparents,2);
pt=(1:(szbpar-1));
ptn=pt/max(pt);
% Crossover point
while j<=size(ptn,2) & cpt==0
j=j+1;
if pc<ptn(j)
cpt=j;
end
end
% a) Crossover
bchild1=[bparents(1,1:cpt),bparents(2,cpt+1:szbpar)];
bchild2=[bparents(2,1:cpt),bparents(1,cpt+1:szbpar)];
% Selection of the child
199
% if rand<0.5
% bchild=bchild1;
% else
% bchild=bchild2;
% end
child1=decoding(bchild1);
fchild1=maxfun(child1);
child2=decoding(bchild2);
fchild2=maxfun(child2);
if fchild1>fchild2
bchild=bchild1;
else
bchild=bchild2;
end
% b) Mutation
i=0;pm=0.1;
bchildm=bchild;
while i<1:szbpar
i=i+1;
if rand<=pm
bchildm=str2num(bchildm);
bchildm(i)=mod(bchildm(i)+1,2);
bchildm=num2str(bchildm);
end
end
%--------------------------------------------------------------------------
function parents=getparents(p1,p2,csx)
i=0;
P1=0;P2=0;
while i<=size(csx,1) & (P1==0 | P2==0)
i=i+1;
if p1<csx(i) & P1==0
P1=i;
end
if p2<csx(i) & P2==0
P2=i;
end
end
parents=[P1,P2];
%--------------------------------------------------------------------------
function d=decoding(b)
d=bin2dec(num2str(b));
%--------------------------------------------------------------------------
function y=maxfun(x)
y=x.ˆ3-60*x.ˆ2+900*x+100;
200
Chapter 18
Simulated Annealing
18.1 Description
Simulated Annealing (SA) is a probabilistic method for global optimization. It was independently proposed
by Kirkpatrick et al. (1983) and C̆erný (1985). The inspiration of this technique comes from the annealing
process in metallurgy. This technique involves heating and controlled cooling of a material to relieve internal
stresses from a previous hardening process. Heat causes the atoms to change their initial positions (a local
minimum of the internal energy) and wander randomly through states of higher energy. The controlled
cooling gives them a chance of finding configurations with lower internal energy than the initial one.
Starting off at the maximum temperature, the annealing process can be described as follows (van
Laarhoven & Aarts, 1988). At a given temperature T , the material can reach thermal equilibrium. This
state is characterized by a probability P (E = E0 ) for the internal energy E to be in a state E0 given by the
Boltzmann distribution:
1 E0
P (E = E0 ) = exp − , (18.1)
Z(T ) kB T
where Z(T ) is a normalization factor referred to as the partition function, which depends on the temperature
T , and kB is the Boltzmann constant, kB = 1.3806505 × 10−23 Joule/Kelvin. The factor exp − kBET is
known as the Boltzmann factor. As the temperature approaches to zero, only the minimum energy states
have a non-zero probability of occurrence.
To simulate the evolution to thermal equilibrium, N. Metropolis & Teller (1953) proposed a Monte Carlo
method, which generates sequences of states of the material in the following way. Given the current state
of the solid, characterized by the positions of its atoms, a small, randomly generated perturbation is applied
by a small displacement of a randomly chosen atom. If the difference in energy ∆E1 = E1 − E0 between
the original state E0 and the slightly perturbed state E1 on is negative (i.e., the perturbed state is in a lower
energy) then the process is continued with the new state. If ∆E1 > 0, then the probability of acceptance of
201
the perturbed state is given by the Boltzmann factor, or
E1
P (∆E1 > 0) = exp − . (18.2)
kB T
This acceptance rule for new states is referred to as the Metropolis criterion. Following this criterion, the
system eventually evolves into thermal equilibrium. This property applied to an optimization problem is
referred to as the Metropolis algorithm.
18.2 Components
Let us consider an optimization problem of the form
min f (x)
x e (18.3)
e
s.t. xL ≤ x ≤ xU .
e e e
As explained by Belegundu & Chandrupatla (1999), the solution of this optimization problem initiates
at a feasible starting point x0 with a function value f0 . Let us set xmin = x0 and fmin = f0 . A vector
e e e
of step sizes s is also defined. Initially, each step size is selected equal to a value sT (e.g., sT = 1). A
e
vector of acceptance ratios a is defined such that each element ai = 1. A starting temperature T is chosen
e
(e.g. T = 10). A reduction factor rT for the temperature is selected (e.g., rT = 0.5). For each temperature
rT T there is an associated step size rs sT . At each temperature the algorithm performs NT iterations. (e.g.,
NT = 5). Each iteration consists of NC cycles (e.g., NC = 5). A cycle involves taking a random step in
each of the n directions.
A step in a direction i is taken in the following manner. A random number r in the range −1 to 1 is
generated. A new point is evaluated using
xs = x + r s i e i , (18.4)
e e e
where ei is the coordinate direction along i. If the new point xs is outside the bounds, the i-th component
of xs is adjusted to be a random point in the interval xLi to xU
e e
i . The function value fs is then evaluated. If
fs ≤ f then the point is accepted by setting x = xs . If fs < fmin then fmin and xmin are updated. If fs > f
e
e e e
then the new point is accepted with a probability of
f − fs
p = exp . (18.5)
T
To this end, a new random number r is generated. If r < p then xs is accepted. This is referred to as
e
Metropolis criterion. Whenever a rejection takes place, the acceptance ratio ai is updated. The acceptance
ratio ai is the ratio between the number of acceptances to the total number of trials for direction i. At the
202
end of NC cycles, the value of the acceptance ratio ai is used to update the step size for the direction si .
A low value implies that there are more rejections, suggesting that the step size should be reduced. A high
rate indicates more acceptances which may be due to a small step size. In this case, the step size is to be
increased. If ai = 0.5, the current step size is adequate with the number of acceptances at the same level as
that of rejections. Once again, drawing from the work of Metropolis on Monte Carlo simulations of fluids,
our idea is to adjust the steps to achieve the ratio of acceptances to rejections equals to 1.
To update the step size, a step multiplication factor is introduced such that
si = si g(ai ), (18.6)
where
−0.6
1 + c ai0.4 for ai > 0.6
1
g(ai ) = 0.4−ai for ai < 0.4 (18.7)
1+c 0.4
1 otherwise
where c = 2 (Corana et al., 1987). Sometimes the step size may take low values and may not permit a step
into the higher energy rate even at moderate temperatures. A resetting scheme is sometimes introduced.
This scheme states that at the end of each temperature step, each step size is updated to be equal to sT (e.g.
sT = 1).
For convergence one can use the variation between two minimum values of the function fmin , such that
where εa and εr are absolute and relative tolerances. Let us incorporate these elements as an algorithm
which is explained in the next section.
18.3 Algorithm
The procedure presented in the previous section can be summarized as follows:
Step 1. Select T = 10 and a feasible design x(0) with f (0) . Select NC , NT and rT . Initialize xmin = x(0) ,
fmin = f (0) , ai = 1, sT = 1, si = sT , K = 1, k = 1, and i = 1.
e e e
(k)
Step 2. Generate a new point xs using (18.4). Adjust the point if it is unfeasible by generating a random
(k)
number between xLi to xU
e
i . Compute fs .
203
Step 5. Set i = 1. If k < NC , then set k = k + 1 and go to Step 2. Otherwise, continue.
Step 6. Set k = 1. If K < NT , then set K = K + 1 and update si according to (18.6), then go to Step 2.
Otherwise, continue.
Step 7. If convergence is achieve as in (18.8), then stop. Otherwise, set K = 1, T (K) = rT T (K−1) , and
si = sT , then go to Step 2.
and the initial point x = 5 with f = 1.282. Using an interval reduction technique, i.e., function fminbnd
in M ATLAB (no initial point required), one obtains the local optimum x∗ = 2.587 with f ∗ = −1.829. A
gradient-based technique, e.g., function fmincon in M ATLAB (interior point), will find x∗ = 4.292 with
f ∗ = −1.385. Using a genetic algorithm, i.e., function ga in M ATLAB (initial population of 50 individuals
and 1000 iterations) will find x∗ = 2.587 with f ∗ = −1.829. Using the simulated annealing method (i.e.,
function simulannealbnd in M ATLAB) the solution x∗ = 9.705 with f ∗ = −1.961 is found after 1033
iterations. Let us perform the first couple iterations.
The initial minimum values will be xmin = 5 and fmin = 1.2815. Let us assume NC = 3 (number of
cycles per temperature), NT = 2 (number of iterations per temperature), and rT = 0.5. Let the step size be
s = 1 and the initial temperature T = 10.
(1)
– For k = 1 a random number could be r(1) = −0.7929. Then, the first point is xs = 4.2071
(1)
(feasible) with fs = −1.3233. This point improves the current result and updates xmin =
4.2071 and fmin = −1.3233.
(2) (2)
– For k = 2, r(2) = 0.7471, xs = 5.7471 (feasible), and fs = 0.1678. This point improves f
so it is accepted.
(3) (3)
– For k = 3, r(3) = 0.3436, xs = 5.3436 (feasible), and fs = 0.4505. This point improves f
so it is accepted.
1 − 0.6
s=1+2 1 = 3.
0.4
204
(1) (1)
– For k = 1, r(1) = 0.5322, xs = 6.5965 (feasible), and fs = −0.0213. This point improves
f so it is accepted.
(2) (2)
– For k = 2, r(2) = −0.0579, xs = 4.8262 (feasible), and fs = 0.7191. This point improves
f so it is accepted.
(3) (3)
– For k = 3, r(3) = −0.6330, xs = 3.1009 (feasible), and fs = −0.9039. This point improves
f so it is accepted.
Convergence cannot be checked yet. Now, the temperature is reduced by a factor of rT = 0.5 to T = 5.
Since no rejections the step size is updated to s = 1 + 2(3 − 0.6)/0.4 = 13. The new point is x = 4.2071
and f = −1.3233.
(1) (1)
– For k = 1, r(1) = −0.0165, xs = 4.7860 (feasible), and fs = 0.5149. This point does not
improve f . The probability of acceptance is p(1) = exp((−1.3258 − 0.5149)/5) = 0.6920. A
(1)
new random number rp = 0.5805 then the point is rejected. The acceptance ratio is updated to
a = 1 − 1/3 = 2/3.
(2)
– For k = 2, r(2) = 0.7997, xs = 15.3958 which is unfeasible and needs correction. Then a
(2) (2)
random number is generated between 0 and 10, so xs = 3.7371 and fs = −0.0629. This
(2)
point does not improve f . Then, p(2) = 0.7768, rp = 0.9779 then the point is accepted.
(3) (3)
– For k = 3, r(3) = 0.3338, xs = 9.3391 (feasible), and fs = −0.0651. This point does not
(3)
improve f . Then, p(3) = 0.7771, rp = 0.1280 then the point is rejected and a = 2/3 − 1/3 =
1/3.
The new acceptance ratio is a = 1/3 then the step size is updated to
1
s = 13 = 9.75
1+ 2 0.4−1/3
0.4
• For K = 2 at T = 5 and s = 9.75 the process continues in the same fashion until convergence is
achieved.
205
Chapter 19
2. Zooming
• Trajectory
206
• Penalty methods
• Golf methods
4. Tunneling
207
Part VII
Multiobjective Optimization
208
Chapter 20
Pareto Optimality
fm (x)
x ∈ Ω,
e
s.t.
e
or alternatively as
min f1 (x)
x e
e
min f2 (x)
x e
..
e
.. (20.2)
. .
min fm (x)
x e
e
s.t. x ∈ Ω.
e
If the objective functions fi (x) do not conflict with one another, the problem might have a single optimum
x∗ that minimizes all the objectives simultaneously. However, it is more often to find conflicting objec-
e
e
tives. In this case, there might be several good points that are a compromise of all the objective functions.
Out of all possible points, some of them will be efficient and their corresponding function vectors will be
nondominated.
Vilfredo Pareto (1848–1923), an Italian sociologist, economist, and philosopher, made important contri-
209
butions in the study of income distribution and in the analysis of individuals’ choices. In his work (Pareto,
1906) he introduced the concept of Pareto optimality. Let us define the concepts of efficiency, dominance
and Pareto optimality in the following section.
20.2 Concepts
20.2.1 Efficiency
A feasible point x∗ is efficient for (20.1) if there is no other feasible point that reduces at least one objective
e
function without increasing another one. This can be defined more precisely as follows:
A point x∗ ∈ Ω is efficient if and only if there is no other point x ∈ Ω such that
e e
fi (x) ≤ fi (x∗ ) for all i = 1, . . . , m
e e
with at least one fi (x) < fi (x∗ ). Otherwise x∗ is inefficient. The set of all efficient points is referred to as
e e e
the efficient frontier.
20.2.2 Dominance
All the function vectors f can be represented as points in a space defined by the objective functions fi . This
e criterion space or the cost space. The projection of all feasible points Ω into the
space is referred to as the
criterion space conforms the feasible criterion space Ω0 . The dominance of the different solutions can be
defined in Ω0 that space as follows:
A function vector f ∗ ∈ Ω0 is nondominated if and only if there is no other function vector f ∈ Ω0 such
that e e
fi ≤ fi∗ for all i = 1, . . . , m
210
To illustrate the main concepts involved in multi-objective optimization, let us consider the following prob-
lem from Belegundu & Chandrupatla (1999).
Example. Each unit of product Y requires two hours of machining in the first cell and one hour in the
second cell. Each unit of product Z requires three hours of machining in the first cell and four hours in the
second cell. There are 12 available machining hours in each cell. Each unit of Y yields a profit of $ 0.80
and each unit of Z yields $ 2.00. It is desired to determine the number of units of Y and Z to manufacture to
maximize both:
If x1 and x2 denote the number of units of Y and Z, respectively, then the problem can be written as
! !
f1 −0.8x1 − 2x2
min =
x f2 −x1
e
s.t. 2x1 + 3x2 ≤ 12 (20.3)
x1 + 4x2 ≤ 12
x1 , x2 ≥ 0.
In a contour plot, the feasible space is defined by the vertices (0, 0), (0, 3), (2.4, 2.4), and (6, 0). The
solution for f1 only is (2.4, 2.4) while the one for f2 only is (6, 0). Every point in the design space (x1 , x2 )
has a corresponding point in the objective space (f1 (x), f2 (x)) which is also called criterion or cost space. In
e e
particular, the feasible space will be defined by the vertices (0, 0), (6, 0), (6.72, 2.4), and s(4.8, 6). Observe
that there are no points in the line between the two optima is “better” than any other point on the line with
respect to both objectives. These points are referred to Pareto points and satisfy Pareto optimality.
211
primary objective and constrain the values of the other ones. This is
min f1 (x)
x e
e
s.t. f2 (x) ≤ c2
..e (20.5)
.
fm (x) ≤ cm
x ∈ Ω,
e
e
where ci are arbitrary values. A specific set of ωi or ci results in a solution x∗ . However, the global picture
e
of the optimum solutions is obtained for a wide range of values for ωi or ci . That global picture will help
us to find the single best compromise solution to the problem. However, the weighting approach will not
generate the entire curve for nonconvex problems (Koski, 1985). Also, for certain choices of constraint
limits there may not be no a feasible solution. Several other techniques to generate the Pareto frontier have
been proposed. Some of the evolutionary techniques presented by Arora (2004) include: Vector Evaluated
Genetic Algorithm, Ranking, Pareto Fitness Function, Pareto-Set Filter, Elitist Strategy, and Niche Tech-
niques. Other techniques include: weighted minimax, weighted global criterion, lexicographic, bounded
objective function, goal programming, homotopy methods, Normal-Boundary Intersection, and Multilevel
Programming.
212
min xn+1
x
(20.7)
e
s.t. zi − xn+1 ≤ 0, i = 1, . . . , m
x ∈ Ω.
e
Example. For the previous example, the best compromise Pareto solution can be obtained from
n o
|0.8x1 +2x2 −6.72| |x1 −6|
min max 6.72 , 6
x
e
s.t. 2x1 + 3x2 ≤ 12 (20.8)
x1 + 4x2 ≤ 12
x1 , x2 ≥ 0.
In this case the deviations are normalized. This gives x∗ = (4.84, 0.77)T with f ∗ = (5.412, 4.84)T .
e e
213
Bibliography
Allen, M.B. & E.L. Isaacson. 1998. Numerical Analysis for Applied Science. United States of America: John
Wiley & Sons, Inc.
Arora, J.S. (ed.) . 2004. Introduction to Optimum Design. Elsevier Academic Press, second edn.
Bartle, R.G. 1976. The Elements of Real Analysis. New York: Wiley, second edn.
Bazaraa, M.S., H.D. Sherali & C.M. Shetty. 2006. Nonlinear Programming. United States of America:
Wiley, third edn.
Belegundu, A.D. & T.R. Chandrupatla (eds.) . 1999. Optimization Concepts and Applications in Engineer-
ing. Prentice Hall.
Bertsekas, D.P. 2008. Nonlinear Programming. United States of America: Athena Scientific, second edn.
Biggs, M.C. 1975. Constrained Minimization Using Recursive Quadratic Programming, 341–349.
Binmore, K.G. 1982. Numerical Analysis: A Straightforward Approach. Cambridge, UK: Cambridge Uni-
versity Press, second edn.
Burden, R.L. & J.D. Faires. 2005. Numerical Analysis. United States of America: Thomson, eight edn.
Cauchy, A. 1847. Methode general pour la resolution des systemes d’equations simultanes. Comptes rendus,
Ac. Sci. Paris. 25, 536–538.
Chong, E.K.P. & S.H. Żak. 2001. An Introduction to Optimization. John Wiley & Sons, Inc., second edn.
Corana, A.M., M. Marchesi, C. Martini & S. Ridella. 1987. Minimizing multimodal functions of continuous
variables with simulated annealing algorithm. ACM Transactions on Mathematical Software 13, 262–280.
Dantzig, G.B. 1951. Maximization of a linear function of variables subject to linear inequalities. In T.C.
Koopmans (ed.) Activity Analysis of Production and Allocation, chap. 21, New York: Wiley.
214
Dantzig, G.B. 1959. Linear Programming and Extensions. Princeton University Press.
Dorigo, M. 1992. Learning and Natural Algorithms. Phd thesis, Politecnico di Milano, Italy.
Fletcher, R. & C.M. Reeves. 1964. Function minimization by conjugate-gradients. The Computer Journal 7,
149–154.
Goldstine, H.H. 1972. The Computer: from Pascal to von Neumann. Princeton. New Jersey: Princeton
University Press.
Greenberg, M.D. 1998. Advanced Engineering Mathematics. New Jersey: Prentice Hall, second edn.
Han, S.P. 1977. A globally convergent method for nonlinear programming. Optimization Theory and Appli-
cations 22, 297–309.
Holland, J. H. 1975. Adaptation in Natural and Artificial Systems. The University of Michigan Press.
Kirkpatrick, S., C.D. Gelatt & M. P. Vecchi. 1983. Optimization by simulated annealing. Science 220, 671–
680.
Lagarias, J.C., J.A. Reeds, M.H. Wright & P.E. Wright. 1998. Convergence properties of the nelder-mead
simplex method in low dimensions. SIAM Journal of Optimization 9, 112147.
Livio, M. 2002. The Golden Ratio: The Story of Phi, the World’s Most Astonishing Number. New York:
Broadway Books.
Luenberger, D.G. 1989. Linear and Nonlinear Programming. Addison-Wesley Publishing Company, second
edn.
Luenberger, D.G. & Y. Ye. 2008. Linear and Nonlinear Programming. Springer, third edn.
Marquardt, D. 1964. An algorithm for least-squares estimation of nonlinear parameters. SIAM Journal on
Applied Mathematics 11, 431441.
N. Metropolis, M.N. Rosenbluth A.H. Teller, A.W. Rosenbluth & E. Teller. 1953. Equation of state calcula-
tions by fast computing machines. Journal of Chemical Physics 21, 10871092.
Nelder, J.A. & R. Mead. 1965. A simplex method for function minimization. Computer Journal 7, 308313.
Nocedal, J. & S.J. Wright. 1999. Numerical Optimization. United States of America: Springer.
215
Pareto, V. (ed.) . 1906. Manuale di economia politica. Milan: Società editrice libraria. Revised and translated
into Frenchas Manuel dconomie politique. Paris: Giard at Brire, 1909. English translation Manual of
Political Economy. NewYork: Kelley, 1971.
Polak, E. & G. Ribiere. 1969. Note sur la convergence de methods de directions conjugres. Revue Francaise
Informat. Rechercher Operationnelle 16, 35–43.
Powell, M.J.D. 1978. The Convergence of Variable Metric Methods for Nonlinearly Constrained Optimiza-
tion Calculations. Academic Press.
Rao, S.S. 2009. Engineering Optimization: Theory and Practice. United States of America: John Wiley &
Sons, fourth edn.
Reeves, C.R. & J.E. Rowe. 2003. Genetic Algorithms—Principles and Perspectives. Kluwer Academic Pub-
lishers.
Reklaitis, G.V, A. Ravindran & K.M. Ragsdell. 1983. Engineering Optimization: Methods and Applications.
John Wiley and Sons.
Rubinstein, R.Y. 1997. Optimization of computer simulation models with rare events. European Journal of
Operations Research 99, 89–112.
C̆erný, V. 1985. A thermodynamical approach to the travelling salesman problem: an efficient simulation
algorithm. Journal of Optimization Theory and Applications 45, 41–45.
van Laarhoven, P.J.M. & E.H.L. Aarts. 1988. Simulated Annealing: Theory and Applications. The Nether-
lands: Kluwer Academic Publishers Inc.
Wolfe, P. 1959. The simplex method for quadratic programming. Econometrica 27, 382–398.
216