Advanced Topics in Optimization
Piecewise Linear
Approximation of a
Nonlinear Function
Introduction and Objectives
Introduction
¾ There exists no general algorithm for nonlinear programming due to its irregular behavior
¾ Nonlinear problems can be solved by first representing the nonlinear function (both objective function and constraints) by a set of linear functions and then apply simplex method to solve this using some restrictions
Objectives
¾ To discuss the various methods to approximate a nonlinear function using linear functions
¾ To demonstrate this using a numerical example
Piecewise Linearization
¾ A nonlinear single variable function f(x) can be
approximated by a piecewise linear function
¾ Geometrically, f(x) can be shown as a curve being represented as a set of connected line segments
Piecewise Linearization: Method 1
¾
Consider an optimization function having only one nonlinear term f(x)
¾
Let the x-axis of the nonlinear function f(x) be divided by ‘p’
breaking points t
1, t2, t2, …, tp¾
Corresponding function values be f(t
1), f(t2),…, f(tp)¾
If ‘x’ can take values in the interval , then the breaking points can be shown as
X x ≤
≤ 0
X t
t
t < < <
p≡
≡ ...
0
1 2Piecewise Linearization: Method 1 …contd.
¾
Express ‘x’ as a weighted average of these breaking points
¾
Function f(x) can be expressed as
where
p p
t w t
w t
w
x =
1 1+
2 2+ ... +
∑
==
pi
i i
t w x
e i
1
., .
( ) ( ) ( ) ( ) ∑ ( )
=
= +
+ +
=
pi
i i p
p
f t w f t
w t
f w t
f w x
f
1 2
2 1
1
...
∑
= p=
i
w
i 11
Piecewise Linearization: Method 1 …contd.
¾
Finally the model can be expressed as
subject to the additional constraints
( ) ∑ ( )
=
=
pi
i i
f t w x
f Min or
Max
1
∑
∑
=
=
=
=
p
i
i p
i
i i
w
x t
w
1 1
1
Piecewise Linearization: Method 1 …contd.
¾ This linearly approximated model can be solved using simplex method with some restrictions
¾ Restricted condition:
¾ There should not be more than two ‘wi’ in the basis and
¾ Two ‘wi’ can take positive values only if they are adjacent. i.e., if ‘x’ takes the value between ti and ti+1, then only wi and wi+1 (contributing weights to the value of ‘x’) will be positive, rest all weights be zero
¾ In general, for an objective function consisting of ‘n’ variables (‘n’ terms) represented as
( ) x f ( ) x f ( ) x f
n( ) x
nf Min or
Max =
1 1+
2 2+ .... +
Piecewise Linearization: Method 1 …contd.
¾ subjected to ‘m’ constraints
¾ The linear approximation of this problem is
( ) x g ( ) x g ( ) x b for j m
g
1j 1+
2j 2+ .... +
nj n≤
j= 1 , 2 ,...,
n k
for w
m j
for b
t g w to
subjected
t f w Min
or Max
p
i
ki
j n
k
p
i
ki kj ki n
k
p
i
ki k ki
,..., 2 , 1 1
,..., 2 , 1 )
( ) (
1
1 1 1 1
=
=
=
≤
∑
∑∑
∑∑
=
= =
= =
Piecewise Linearization: Method 2
¾
‘x’ is expressed as a sum, instead of expressing as the weighted sum of the breaking points as in the previous method
where ui is the increment of the variable ‘x’ in the interval i.e., the bound of ui is
¾
The function f(x) can be expressed as
¾ where represents the slope of the linear approximation between the points and
∑
−−
= +
=+ +
+ +
=
11 1
1 2
1
1
....
p
i i
p
t u
u u
u t
x
) ,
( t
it
i+1i i
i
t t
u ≤ −
≤
+10
( ) ( )
p ii
i
u t
f x
f ∑
−=
+
=
11
1
α
αi
ti +1
ti
( ) ( )
i ii
t f t
f
−
= +1 −
α
Piecewise Linearization: Method 2 …contd.
¾ Finally the model can be expressed as
subjected to additional constraints
( ) ( )
p ii
i
u t
f x
f Min or
Max ∑
−=
+
=
11
1
α
1 ,....,
2 , 1 ,
0
11
1 1
−
=
−
≤
≤
= +
+
−
∑
=p i
t t
u
x u
t
i i
i p
i i
Piecewise Linearization: Numerical Example
¾ The example below illustrates the application of method 1
¾ Consider the objective function
¾ subject to
¾ The problem is already in separable form (i.e., each term consists of only one variable).
2 3
1
x
x f
Maximize = +
0 4 0
15 2
2
2 1
2 2
1
≥
≤
≤
≤ +
x
x
x
x
Piecewise Linearization: Numerical Example
…contd.
¾ Split up the objective function and constraint into two parts
where
¾ and are treated as linear variables as they are in linear form
( ) ( ) ( )
1 12( )
211 1
2 2 1
1
x g x
g g
x f x
f f
+
=
+
=
( ) ( )
( )
1 12 12( )
2 211
2 2
2 3 1 1
1
2
; 2
;
x x
g x x
g
x x
f x x
f
=
=
=
=
( )
2 2 xf
g
12( ) x
2Piecewise Linearization: Numerical Example
…contd.
¾ Consider five breaking points for x1
¾ f1
( )
x1 can be written as,( ) ( )
64 27
8 1
0 12 13 14 15
11 5
1
1 1 1 1
1
× +
× +
× +
× +
×
=
=
∑
=
w w
w w
w
t f w x
f
i
i i
Piecewise Linearization: Numerical Example
…contd.
¾ can be written as,
¾ Thus, the linear approximation of the above problem becomes
subject to
( )
111 x g
( ) ( )
32 18
8 2
0 12 13 14 15
11 5
1
1 1 1 1
11
× +
× +
× +
× +
×
=
=
∑
=
w w
w w
w
t g w x
g
i
i i i
2 15
14 13
12
8 w 27 w 64 w x
w f
Maximize = + + + +
5 ,..., 2 , 1 0
1
15 2
32 18
8 2
15 14
13 12
11
1 2 15
14 13
12
=
≥
= +
+ +
+
= +
+ +
+ +
i for w
w w
w w
w
s x
w w
w w
Piecewise Linearization: Numerical Example
…contd.
¾ This can be solved using simplex method in a restricted basis condition
¾ The simplex tableau is shown below
Piecewise Linearization: Numerical Example
…contd.
¾ From the table, it is clear that should be the entering variable
¾ should be the exiting variable
¾ But according to restricted basis condition and cannot occur together in basis as they are not adjacent
¾ Therefore, consider the next best entering variable
¾ This also is not possible, since should be exited and and cannot occur together
¾ The next best variable , it is clear that should be the exiting variable
w
15s
1w
15w
11w
14s
1w
14w
11w
13w
11Piecewise Linearization: Numerical Example
…contd.
¾ The entering variable is . Then the variable to be exited is and this is not acceptable since is not an adjacent point to
¾ Next variable can be admitted by dropping .
¾ The simplex tableau is shown below
w
15s
1w
15w
13w
14s
1Piecewise Linearization: Numerical Example
…contd.
¾ Now, cannot be admitted since cannot be dropped
¾ Similarly and cannot be entered as cannot be dropped
¾ The simplex tableau is shown below
w
15w
14w
11w
12w
13Piecewise Linearization: Numerical Example
…contd.
¾ Since there is no more variable to be entered, the process ends
¾ Therefore, the best solution is
¾ Now,
¾ The optimum value is
¾ This may be an approximate solution to the original nonlinear problem
¾ However, the solution can be improved by taking finer breaking points
7 . 0
; 3 .
0
1413
= w =
w
7 . 2 3 2 14
13 5
1
1 1
1 =
∑
= × + × ==
w w
t w x
i
i i
2
= 0 x and
3 .
= 21
f