This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ELEC 5270/6270 Spring 2011
LowPower Design of Electronic Circuits Linear Programming – A Mathematical
Optimization Technique
Optimization
Vishwani D. Agrawal James J. Danaher Professor
Dept. of Electrical and Computer Engineering
Auburn University, Auburn, AL 36849
vagrawal@eng.auburn.edu
http://www.eng.auburn.edu/~vagrawal/COURSE/E6270_Spr11/course.html
Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 1 What is Linear Programming Linear programming (LP) is a
mathematical method for selecting the
best solution from the available solutions
of a problem. Method:
State the problem and define variables whose
values will be determined.
Develop a linear programming model: Write the problem as an optimization formula (a linear
expression to be minimized or maximized) Write a set of linear constraints
An available LP solver (computer program) gives
the values of variables. Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 2 Types of LPs LP – all variables are real. ILP – all variables are integers. MILP – some variables are integers,
others are real. A reference: S. I. Gass, An Illustrated Guide to Linear
Programming, New York: Dover, 1990. Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 3 A SingleVariable Problem Consider variable x Problem: find the maximum value of x
subject to constraint, 0 ≤ x ≤ 15. Solution: x = 15.
Constraint satisfied 0 15 x Solution
x = 15
Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 4 Single Variable Problem (Cont.) Consider more complex constraints:
Maximize x, subject to following constraints: x≥0
5x ≤ 75
6x ≤ 30
x ≤ 10 0 (1)
(2)
(3)
(4)
5 10 15
(2) (3) x
(1) (4) All constraints satisfied
Solution, x = 5
Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 5 A TwoVariable Problem Manufacture of chairs and tables: Resources available: Material: 400 boards of wood Labor: 450 manhours Profit: Chair: $45 Table: $80 Resources needed: Chair 5 boards of wood
10 manhours Table 20 boards of wood
15 manhours Problem: How many chairs and how many tables should be
manufactured to maximize the total profit? Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 6 Formulating TwoVariable Problem Manufacture x1 chairs and x2 tables to
maximize profit:
P = 45x1 + 80x2 dollars Subject to given resource constraints: 400 boards of wood, 5x1 + 20x2 ≤ 400 450 manhours of labor, 10x1 + 15x2 ≤ 450 (1)
(2) x1 ≥ 0 (3) x2 ≥ 0 (4) Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 7 Solution: TwoVariable Problem
40
Ma P = on
s tr a
int (1) 20 0 0 (24, 14)
Mate
rial co 10
(3) Best solution: 24 chairs, 14 tables
Profit = 45×24 + 80×14 = 2200 dollars nstra (4) int 0 10 20 30 40 50 60 70 80 90
Chairs, x1 increasing
(2) decresing Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 ofi
t Tables, x2 22
n
00 30 po
we
rc Pr P = 8 Change Profit of Chair to $64/Unit Manufacture x1 chairs and x2 tables to
maximize profit:
P = 64x1 + 80x2 dollars Subject to given resource constraints: 400 boards of wood, 5x1 + 20x2 ≤ 400 450 manhours of labor, 10x1 + 15x2 ≤ 450 (1)
(2) x1 ≥ 0 (3) x2 ≥ 0 (4) Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 9 Solution: $64 Profit/Chair
P = 28
8 0 40
Ma np
ow
30
e Best solution: 45 chairs, 0 tables
Profit = 64×45 + 80×0 = 2880 dollars Tables, x2 rc ain
t (1) 20 (24, 14) 10 P = (3)
0 Mate rial c
onstr
a int (4) 0 10 20 30 40 50 60 70 80 90
Chairs, x1
(2) increasing
Pr ofi
t 0 on
str Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 decresing 10 A Dual Problem Explore an alternative. Questions: Should we make tables and chairs? Or, auction off the available resources? To answer this question we need to know: What is the minimum price for the resources that
will provide us with same amount of revenue
from sale as the profits from tables and chairs? This is the dual of the original problem.
Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 11 Formulating the Dual Problem Revenue received by selling off resources: For each board, w1 For each manhour, w2 Minimize Subject
5w1 400w1 + 450w2 to constraints:
+ 10w2 20w1 ≥ 45 + 15w2 w1 ≥0 w2 ≥ 80 Resources:
Material: 400 boards
Labor: 450 manhrs
Profit:
Chair: $45
Table: $80
Resources needed:
Chair
5 boards of wood
10 manhours Table 20 boards of wood
15 manhours ≥0 Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 12 The Duality Theorem If
If the primal has a finite optimum solution,
so does the dual, and the optimum values
of the objective functions are equal.
of Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 13 PrimalDual Problems Primal problem Fixed resources
Maximize profit Variables: x1 (number of chairs) x2 (number of tables) Maximize profit 45x1+80x2
Subject to:
5x1 + 20x2 10x1 + 15x2 x1 x2 Copyright Agrawal, 2009
Copyright Minimize value 400w1+450w2
Subject to:
5w1 + 10w2 20w1 + 15w2 w1 w2 x1 = 24 chairs, x2 = 14 tables Profit = $2200 Variables: ≤ 400
≤ 450
≥0
≥0 Solution: Fixed profit
Minimize value
w1 ($ value/board of wood) w2 ($ value/manhour) Dual Problem ≥ 45
≥ 80
≥0
≥0 Solution:
w1 = $1, w2 = $4 value = $2200 ELEC5270/6270 Spring 11, Lecture 4 14 LP for n Variables
LP n Σ cj xj minimize j =1 Objective function n subject to Σ aij xj ≤ bi, i = 1, 2, . . ., m j =1 n Σ cij xj = di, i = 1, 2, . . ., p j =1
Variables: xj
Constants: cj, aij, bi, cij, di
Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 15 Algorithms for Solving LP Simplex method Ellipsoid method L. G. Khachiyan, “A Polynomial Algorithm for Linear Programming,”
L.
Soviet Math. Dokl., vol. 20, pp. 191194, 1984.
Soviet Interiorpoint method G. B. Dantzig, Linear Programming and Extension, Princeton, New
G.
Linear
Princeton,
Jersey, Princeton University Press, 1963.
Jersey, N. K. Karmarkar, “A New PolynomialTime Algorithm for Linear
N.
Programming,” Combinatorica, vol. 4, pp. 373395, 1984.
Combinatorica Course website of Prof. Lieven Vandenberghe (UCLA),
Course
http://www.ee.ucla.edu/ee236a/ee236a.html
http://www.ee.ucla.edu/ee236a/ee236a.html Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 16 Basic Ideas of Solution methods
Extreme points Constraints Extreme points Objective function Simplex: search on extreme points.
Complexity: polynomial in n, number of
variables
Copyright Agrawal, 2009
Copyright Objective function Constraints
Interiorpoint methods: Successively iterate with interior spaces of analytic convex boundaries.
Complexity: O(n3.5L), L = no. of int. values ELEC5270/6270 Spring 11, Lecture 4 17 Integer Linear Programming (ILP) Variables are integers. Complexity is exponential – higher than LP. LP relaxation Convert all variables to real, preserve ranges. LP solution provides guidance. Rounding LP solution can provide a nonoptimal solution. Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 18 Traveling Salesperson Problem (TSP)
6 4 12 5 27
1
18 12 15 19 10 3 Copyright Agrawal, 2009
Copyright 20 2
5 ELEC5270/6270 Spring 11, Lecture 4 19 Solving TSP: Five Cities
Distances (dij) in miles (symmetric TSP, general TSP is asymmetric) City j=1
j=1 j=2
j=2 j=3 j=4 j=5 i=1
i=1 0 18 10 12 27 i=2
i=2 18 0 5 12 20 i=3
i=3 10 5 0 15 19 i=4
i=4 12 12 15 0 6 i=5
i=5 27 20 19 6 0 Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 20 Search Space: No. of Tours Asymmetric TSP tours Fivecity
Fivecity problem: 4 × 3 × 2 × 1 = 24 tours
24 Tencity problem: 362,880 tours 15city problem: 87,178,291,200 tours 50city problem: 49! = 6.08×1062 tours Time for enumerative search assuming 1
Time
μs per tour evaluation
=
1.93×1055 years
Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 21 A Greedy Heuristic Solution
Tour length = 10 + 5 + 12 + 6 + 27 = 60 miles (nonoptimal) City j=1 j=2 j=3 j=4 j=5 i=1
(start) 0 18 10 12 27 i=2 18 0 5 12 20 i=3 10 5 0 15 19 i=4 12 12 15 0 6 i=5 27 20 19 6 0 Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 22 ILP Variables, Constants and Constraints
x14 ε [0,1]
d14 = 12 4
5
x15 ε [0,1]
d15 = 27
x12 ε [0,1]
d12 = 18 1 x13 ε [0,1]
d13 = 10 Integer variables:
xij = 1, travel i to j
xij = 0, do not travel i to j 2 3 Real constants:
dij = distance from i to j x12 + x13 + x14 + x15 = 1
four other similar equations
Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 23 Objective Function and ILP Solution
5
i1
Minimize ∑
∑ xij × dij
i=1 j=1
5
∑ xij = 1,
j=1
j≠i for all i, i.e., every node i has exactly one outgoing edge. xij j =1
xij
=1
i =1 0
=1
2
1 2
0 3
1 4
0 5
0 0 0 0 0 3
4 1
0 0
0 0
0 0
1 5
Copyright Agrawal, 2009
Copyright 0
0
0 0 0 1 0 ELEC5270/6270 Spring 11, Lecture 4 24 ILP Solution
d54 = 6
4
5 d45 = 6
1
d21 = 18
d13 = 10 3 Copyright Agrawal, 2009
Copyright 2
d32 = 5 ELEC5270/6270 Spring 11, Lecture 4 Total length = 45
but not a single tour
25 Additional Constraints for Single Tour Following
Following constraints prevent split tours.
For any subset S of cities, the tour must
enter and exit that subset:
enter
∑ xij ≥ 2 for all S, S < 5
iεS
jεS
Remaining
set At least two
arrows must cross
this boundary. Any subset
Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 26 ILP Solution
d41 = 12 4 d54 = 6
5 1
d25 = 20
d13 = 10 3 Copyright Agrawal, 2009
Copyright 2
d32 = 5 ELEC5270/6270 Spring 11, Lecture 4 Total length = 53 27 Characteristics of ILP Worstcase complexity is exponential in number of
Worstcase
variables.
variables.
Linear programming (LP) relaxation, where integer
Linear
variables are treated as real, gives a lower bound on the
objective function.
objective
Recursive rounding of relaxed LP solution to nearest
integers gives an approximate solution to the ILP
problem.
problem. K. R. Kantipudi and V. D. Agrawal, “A Reduced Complexity
K.
Algorithm for Minimizing NDetect Tests,” Proc. 20th International
Detect
Proc.
Conf. VLSI Design, January 2007, pp. 492497.
Conf. Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 28 Why ILP Solution is
Why
Exponential?
Exponential? Second variable Must try all
2n roundoff
points LP solution
found in
polynomial time
(bound on ILP
solution) Constraints
First variable
Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 Objective
(maximize)
29 ILP Example: Test Minimization A combinational circuit has n test vectors that detect m
combinational
faults. Each test detects a subset of faults. Find the
smallest subset of test vectors that detects all m faults.
smallest
ILP model: Assign an integer variable ti ε [0,1] to ith test vector Ti such that
Assign
tii = 1 means we select Ti, otherwise
t
ti = 0 means we eliminate Ti
Define an integer constant fij ε [0,1] such that
Define
fij = 1, if ith vector Ti detects jth fault Fj, otherwise
fij = 0, if ith vector Ti does not detect jth fault Fj
Values of constants fij are determined by fault simulation Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 30 Test Data
Test
Select test Ti if ti = 1 n tests
T2 T3 T4   Ti   Tn F1 1 1 0 0   1   0 F2 0 0 1 1   0   1 F3 0 0 0 1   0   1 F4 1 0 0 0   1   0            Fj 0 0 0 0   1   1            Fm m faults T1 1 1 0 0   0   0 fij = 1; vector Ti detects fault Fj
Copyright Agrawal, 2009 ELEC5270/6270 Spring 11, Lecture 4 31 Test Minimization by ILP n minimize Σ ti i =1 Objective function n subject to Copyright Agrawal, 2009
Copyright Σ fij ti ≥ 1,
i =1 j = 1, 2, . . . , m ELEC5270/6270 Spring 11, Lecture 4 32 FourBit ALU Circuit 74181
14 inputs, 8 outputs
Pseudorandom vectors for
Pseudorandom
100% fault coverage
100% ILP solution
Minimized vectors CPU s 285 14 0.65 400 13 1.07 500 12 4.38 1,000 12 4.17 5,000 12 12.95 10,000 12 34.61 16,384 (214, exhaustive set) 12 87.47 Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 33 Finding LP/ILP Solvers R. Fourer, D. M. Gay and B. W. Kernighan, AMPL: A Modeling
R.
Language for Mathematical Programming, South San Francisco,
Language
South
California: Scientific Press, 1993. Several of programs described in
this book are available to Auburn users.
this
B. R. Hunt, R. L. Lipsman, J. M. Rosenberg, K. R. Coombes, J. E.
B.
Osborn and G. J. Stuck, A Guide to MATLAB for Beginners and
Experienced Users, Cambridge University Press, 2006.
Experienced
Search the web. Many programs with small number of variables can
Search
be downloaded free.
be Copyright Agrawal, 2009
Copyright ELEC5270/6270 Spring 11, Lecture 4 34 A Circuit Optimization Problem
Circuit Given:
Circuit netlist
Cell library with multiple versions for each cell Select
Select cell versions to optimize a specified
characteristic of the circuit. Typical
characteristics are:
characteristics Area Power Delay Example:
Copyright Agrawal, 2009 Minimize power for given delay.
ELEC5270/6270 Spring 11, Lecture 4 35 Gate Library: NAND(X), X = 0 or 1
Gate X: an integer variable for each gate. X = 0, choose gate with small delay
= d × fo, where fo = number of fanouts for gate Power = 3 × p × fo
Power d and p are parameters of technology Delay
Delay X = 1, choose gate with low power = 2 × d × fo Power = 0.5 × p × fo
Power Delay
Delay gate delay = [(1 – X) + 2 X] × fo Normalized power = [3(1 – X) + 0.5 X] × fo
Normalized Normalization: d = 1, p = 1 Normalized
Normalized Copyright Agrawal, 2009 ELEC5270/6270 Spring 11, Lecture 4 36 Example: OneBit Full Adder
2
CO A
1
3 2
1 1
3 1 B
1
C SUM Number of fanouts, fo
Spring 2010, Feb 1
Spring ELEC 7770: Advanced VLSI Design (Agrawal) 37 Define Arrival Time Variables, Tk
Tk = Latest signal arrival time at output of gate k
2 T1 = T2 = T3 = 0
A T1 T4 B
C CO T5 1 3 T2 T9 T6
1 2 T7
T8 1 T10 3 T3 1
1 T12
SUM T11 Number of fanouts, fo
Spring 2010, Feb 1
Spring ELEC 7770: Advanced VLSI Design (Agrawal) 38 Constraint: Gate k in the Circuit
Constraint: Ti = signal arrival time at ith input of gate k Tk = signal arrival time at gate k output Tk ≥ Ti + (1 – Xk) fo(k) + 2 Xk fo(k), for all i
Tk
(1 Where, fo(k) = fanout number of gate k
Where, fo(k)
Xk = 0, choose fast cell for k
Xk = 1, choose low power cell for k Copyright Agrawal, 2009 ELEC5270/6270 Spring 11, Lecture 4 39 Arrival Time Constraints on Gate 7
T1 = T2 = T3 = 0
A T1 3 T2
B
C 2 T7 ≥ T5 + (1 – X7) 2 + 2 X7 ✕
2 7 ≥ T6 + (1 – X7) 2 + 2 X7 ✕
T
2
T5
1 T4
2
1 CO T7 T6 T8 1 T10 3 T3 T9 1
1 T12
SUM T11 Number of fanouts, fo
Spring 2010, Feb 1
Spring ELEC 7770: Advanced VLSI Design (Agrawal) 40 Clock Constraints
Clock Combinational Logic Register = 0, for all primary inputs i To ≤ Tc, clock period, for all primary outputs o
To Tc,
Register Ti Clock Copyright Agrawal, 2009 ELEC5270/6270 Spring 11, Lecture 4 41 Critical Path Constraints T9 ≤ Tc
2 T1 = T2 = T3 = 0
A T1 T5 1
3 T2
B
C CO T4 2
1 T7 T10 T6 T8 1 T12 ≤ Tc 3 T3 1
1 SUM T11 Number of fanouts, fo
Spring 2010, Feb 1
Spring ELEC 7770: Advanced VLSI Design (Agrawal) 42 Optimization Function
Optimization Minimize
Minimize ∑ 3(1 – Xk) fo(k) + 0.5 Xk fo(k)
all gates k
all Copyright Agrawal, 2009 ELEC5270/6270 Spring 11, Lecture 4 43 Typical Result
Typical
Normalized power 45 (11, 45) 35 25 15 5 (22, 7.5)
5 10 15 20 Normalized delay (Tc)
Copyright Agrawal, 2009 ELEC5270/6270 Spring 11, Lecture 4 44 ...
View
Full
Document
This note was uploaded on 09/17/2011 for the course ELEC 6970 taught by Professor Staff during the Spring '08 term at Auburn University.
 Spring '08
 Staff
 Frequency

Click to edit the document details