Chapter 2 A Superior Representation Method for Piecewise Linear Functions
2.4 Numerical Examples
Consider the following nonlinear programming problem:
P1
Min x1α1−x2β1
s.t. x1α2 −6x1+x2β2 ≤b, ,
2 8
1+ x ≤
x
, 4 . 7
1≤ x1 ≤ 1≤ x2 ≤7.4,
where α , 1 β , 1 α , 2 β and 2 b are fixed constants.
Various α , 1 β , 1 α , 2 β and 2 b values are specified in this experiment to compare the computational efficiency of expressing the piecewise linear functions by the existing method (i.e., (2.1)-(2.4)) and by our proposed method (i.e., THEOREM 2.2).
For the first experiment given, α1 =0.4, β1 =2, α2 =1.85, β2 =2, b=5, the nonlinear terms x and 10.4 − are concave and required to be linearized, while the other x22 convex terms x11.85 and x do not need linearization. Suppose 22 m+1 equal-distance break points are chosen to linearize each of x and 10.4 − , denoted as x22 a0 =1, aθ =1+6.4θ /m,
4 .
=7
am , for θ =1,K,m−1. Then existing methods (i.e., (2.1)-(2.4)) require to use 2m binary variables and 8m extra constraints to piecewisely linearize x and 10.4 − . However, x22 by piecewisely linearize the same convex terms, our proposed method (i.e., THEOREM 2.2)
only uses 2
⎡
log2m⎤
binary variables, 14+16⎡
log2m⎤
extra constraints, 4m non-negative continuous variables, and 2⎡
log2m⎤
free-signed continuous variables. The linearization of4 . 0
x by the proposed method is described below: 1
Denote f(x1)=x10.4. By THEOREM 2.2, f(x1) with m=64 is expressed by the following linear equations and inequalities:
∑
Similarly, −x22 can be piecewisely linearized by THEOREM 2.2. The original program
is then converted into a mixed 0-1 convex program. We solve this program on LINGO (2004) by both the existing methods and the proposed method. The related solutions, CPU time, number of iterations, number of binary variables, number of constraints, and gap to the upper and lower bound objective value are listed in Table 2.2.
Table 2.2 Experiment 1 (α1 =0.4, β1 =2, α2 =1.85, β2 =2, b=5) +1
m Item Proposed
method
Existing method
Gap to the upper and lower bound objective value
CPU Time (second) 28 57 Number of iterations 103,090 229,521 Number of binary variables 12 128 Number of constraints 110 514 Solution (x1,x2) (3.849203, 3.998877) 65
Objective Value –14.27649 0.00001
CPU Time (second) 329 4298 Number of iterations 452,721 5,153,692 Number of binary variables 16 512 Number of constraints 142 2050 Solution (x1,x2) (3.852642, 3.998955) 257
Objective Value –14.27648 <0.00001
* The reference upper bound solution is (x1,x2) = (3.852642, 3.998955) with objective value -14.27648
The gaps between the upper and lower bounds can be computed as follows.
(i) Solve the nonlinear program P1 directly by a nonlinear optimization software (such as LINGO). The solution is x0 =(x10,x20)=(3.852642 ,3.998955) with objective value
-14.27648. x is one of the local optima of P1. But it is unknown about the gap 0 between x and the global optimum. 0 x is regarded as the upper bound solution. 0 (ii) Divide the ranges of both x1 and x2 into 65 break points. Let (x10,x20) replace the
nearest break point (3.8, 4.0) in the existing 65 break points. Solving the program by both the proposed method and the existing method to obtain
) 998877 .
3 , 849203 .
3
=(
x∆ with objective value -14.27649. x is a lower bound ∆
solution of P1. The gap between the objective values of x and 0 x is 0.00001. ∆ (iii) Reiterate to (ii), divide the ranges of both x1 and x2 into 257 break points. Solving
the program by both methods to obtain the solution (3.852642, 3.998955), which is the same as x . ∆
Various combinations of α , 1 β , 1 α , 2 β and 2 b are specified to test the computation results of the existing methods and the proposed method. Parts of the results are displayed in Table 2.3. All these experiments demonstrate that the proposed method is much faster than the existing method especially when m becomes large.
EXAMPLE 2.2
This example, modified from Dixon and Szegö (1975), is to find the approximated global optimum of the following program:
P2
Min 12 14 16 1 2 22 0.01 1 6
081 1 . 1
2x − x + x −xx +x + x
s.t. −2≤xi ≤2, 2i=1, ,
where the object function is a non-symmetrical three-humped camelback function.
Figure 2.2 shows a contour map of this function under −2≤x1 ≤2 and −2≤x2 ≤2. Here a reference upper bound solution is (x1,x2)=(−1.802271,−0.9011357) with objective value –0.02723789. For solving this program, let x1′ x= 1+2.1>0 and x2′ x= 2 +2.1>0 to have x1x2 =x1′x2′ −2.1x1′−2.1x2′ +4.41. Replace x ′1′x2 by exp( y , P2 then becomes P3 ) below:
Table 2.3 Experiment 2 (for different combinations of α , 1 β , 1 α , 2 β and 2 b)
, , , 1 2
1 β α
α b
2,
β m+1
Item Proposed
method
Existing method
Gap to the upper and lower bound objective value
A reference upper bound solution is (x1,x2)=(2.289561, 5.710439) with objective value –0.8765232
CPU Time (second) 5 13 Number of iterations 15,616 84,036 Solution (x1,x2) (2.289561, 5.710439) 65
Objective Value –0.8765229 0.0000003 CPU Time (second) 12 54
Number of iterations 43,830 216,577 Solution (x1,x2) (2.289561, 5.710439) 129
Objective Value –0.876523 0.0000002 CPU Time (second) 69 464
Number of iterations 113,591 1,296,464 Solution (x1,x2) (2.28956, 5.71044) 5
.
1 =0
α ,
5 .
1=0
β ,
8 .
2 =0
α ,
9 .
2 =0
β ,
257
Objective Value –0.8765232 <0.0000001 A reference upper bound solution is (x1,x2)=(4.087383, 3.8) with objective value –12.68378
CPU Time (second) 15 17 Number of iterations 68,759 141,519 Solution (x1,x2) (4.153399, 3.846601) 65
Objective Value –13.03136 0.34758 CPU Time (second) 62 428
Number of iterations 207,894 1,243,751 Solution (x1,x2) (4.153402, 3.846598) 129
Objective Value –13.02896 0.34518 CPU Time (second) 299 1350
Number of iterations 557,043 2,490,405 Solution (x1,x2) (4.153401, 3.846599) 4
.
1 =0
α ,
1 =2 β ,
8 .
2 =0
α ,
2 =2
β ,
−7
= b
257
Objective Value –13.02889 0.34511
Figure 2.2 Contour map of the three-humped camelback function
P3
Min exp( ) 2.11 2.1 4.41
6 081 1 . 1
2x12 − x14 + x16 − y +x22 + x1+ x2 +
s.t. y =lnx1′+lnx2′, 1 .
1 2
1= x′−
x ,
1 .
2 2
2 = x′ −
x ,
2 2≤ ≤
− xi , 2i=1, .
The terms − , )x14 −exp( y , ln x′1 and ln x′2 in P3 are non-convex, here we use −z1,
z2
− , y1 and y2 to respectively as piecewise linear function to approximate those non-convex terms. We then obtain the following mixed-integer program:
P4
Min 2.11 2.1 4.41
6 081 1 . 1
2x12 − z1+ x16−z2+x22+ x1+ x2 +
s.t. The same constraints as in P3, but replace ln x′1 and ln x′2 by y1 and y2 respectively.
We take 41 equal-distance break points for the value range of x1 and x2 ( [-2, 2] ), denoted as a0 =−2, a1 =−1.9, .a2 =−1.8,...,a40 =2 It is clear that the break points for x′1 and x′2 are (0.1 ,0.2,...,4.1). Base on THEOREM 2.2, each of z1, y1, and y2 is linearized with 6 binary variables and 55 constrains. Since y= y1+y2 , the region of y is
] 1 . 4 ln 1 . 4 ln , 1 . 0 ln 1 . 0
[ln + + =[ln0.01, ln16.81] . We take m+1 equal-distance break points for the value range of y , denoted as b0 =ln0.01, )bθ =ln(0.01+16.8θ/m ,
81 . 16
=ln
bm , for θ =1,2,...,m−1. z2 =ey can then be piecewisely linearized under various y values.
Problem P4 is converted into a mixed 0-1 convex program. We solve this program using LINGO (2004) with the existing methods and the proposed method. The related solutions, CPU time, number of iterations, number of binary variables, number of constraints, and gaps to the upper and lower bound objective values are reported in Table 2.4.
Table 2.4 Experiment result of Example 2.2
+1
m Item Proposed
method
Existing method
Gap to the upper and lower bound objective value
CPU Time (second) 239 834
Number of iterations 2,387,868 3,675,444 Number of binary variables 17 112
Number of constraints 161 532
Solution (x1,x2) (–1.849207, –0.9925797) 33
Objective Value –0.2269442 0.19970631
CPU Time (second) 882 2,277
Number of iterations 1,610,422 7,467,149 Number of binary variables 18 144
Number of constraints 169 660 Solution (x1,x2) (–1.7657, –0.8942029) 65
Objective Value –0.08396288 0.05672499
* The reference upper bound solution is (x1,x2) = (–1.802271, –0.9011357) with objective value –0.02723789
EXAMPLE 2.3
This example is used to illustrate the process of solving discrete functions, consider following program:
Min x13 −1.8x12.8 +0.8x22.2 −x22.1+x30.5 −3.5x40.8 −0.3x15.1 s.t. x11.2 + x20.8 ≤8,
7 2
. 1 3 2 . 1
1 − x ≤
x ,
5 .
7 4
. 1 4 1 . 2
2 − x ≥
x ,
96 3
. 0 5 8 . 0
4 − x ≥−
x ,
1 .
1 0
. 1 5 2 . 2
2 − x ≥−
x ,
where xi are discrete variables for all i, xi∈{1 ,1+c ,...,1+mc}={d0,...,dm}, where c is the discreteness of xi, and m+1 is the number of discrete points.
The existing method solves this example by linearizing a nonlinear function }
,..., {
,x d0 dm
xα ∈ as
, ) (
1 0
0
∑
=
− +
=d m d d
x
θ
α θα α θ
α λ
},1, {0,1
1
∈
∑
≤= θ
θm λθ λ
where m binary variables are used.
THEOREM 2.2 can be applied to solve a discrete function xα ,x∈{d0,...,dm} where )
(x
f in (2.26) is replaced by x as α
,
∑
0=
= m d r x
θ α θ
α θ
m ,...,
=0
θ . For treating a discrete function, the proposed method uses log2(m+1) binary variables, 4+4
⎡
log2(m+1)⎤
constraints, m+1 non-negative continuous variables, and⎡
log2(m+1)⎤
free-signed continuous variables.Table 2.5 is the computational result with ILOG CPLEX 9.0. It illustrates that the proposed method needs to use more constraints than the existing method; however, the proposed method is computationally more efficient then existing method for large m.
Table 2.5 Experiment results with discrete function in ILOG CPLEX (m+1)/d Item Proposed method Existing method
CPU Time (second) 3.89 1.27
Number of iterations 17,181 2,935 Number of binary variables 40 1,275
Number of constraints 187 22
Solution (x1,x2,x ,3 x4,x ) 5 (3.725, 4.2, 1.85, 5.075, 7.2) 256 /
0.025
Objective Value –35.49859275
CPU Time (second) 3.58 7.85
Number of iterations 12,418 14,103 Number of binary variables 45 2,555
Number of constraints 207 22
Solution (x1,x2,x ,3 x4,x ) 5 (3.75, 4.1375, 1.875, 4.9625, 7.1375) 512 /
0.0125
Objective Value –35.51962643
CPU Time (second) 7.45 66.92
Number of iterations 17,671 60,603 Number of binary variables 50 5,115
Number of constraints 227 22
Solution (x1,x2,x ,3 x4,x ) 5 (3.6688, 4.35, 1.8188, 5.3688, 7.3937) 1024 /
0.00625
Objective Value –35.55043719
EXAMPLE 2.4
This example uses the same program in Example 2.3 but specifying all xi as continuous variables, where 1≤xi ≤7.4 with m+1 break points for all i. The comparison of the proposed method and the existing method, solving with ILOG CPLEX 9.0, is shown in Table 5. It demonstrates that the proposed method is also superior to the existing method for the continuous case.
Table 2.6 Experiment results with continuous function in ILOG CPLEX +1
m Item Proposed
method
Existing method
Gap to the upper and lower bound objective value CPU Time (second) 4.23 39.86
Number of iterations 47,896 155,309 Number of binary variables 25 160 Number of constraints 347 1,098 Solution (x1,x2) (3.67117699, 4.34398332) Solution (x ,3 x4,x ) 5 (1.8176404, 5.35913745, 7.4) 33
Objective Value –35.56181842 0.00766842
CPU Time (second) 40.29 919.22 Number of iterations 250,747 1,437,056 Number of binary variables 30 320 Number of constraints 407 2,186 Solution (x1,x2) (3.67115433, 4.34402387) Solution (x ,3 x4,x ) 5 (1.81765758, 5.3591112, 7.4) 65
Objective Value –35.56160283 0.00745283
CPU Time (second) 454.21 4354.26 Number of iterations 2,128,203 8,690,141 Number of binary variables 35 640 Number of constraints 467 4,362 Solution (x1,x2) (3.67116282, 4.34402387) Solution (x ,3 x4,x ) 5 (1.81767335, 5.3591112, 7.4) 129
Objective Value –35.56112235 0.00697235
* The reference upper bound solution is x1=3.668, x2 =4.352, 816x3 =1. , 373
.
4 =5
x , 4x5 =7. with objective value –35.55415