Lecture8 Floorplan2
Lecture8 Floorplan2
10/22/08 1
Linear Programming Approach
“An Analytical Approach to Floorplan Design and
Optimization”, Sutanthavibul, Shragowitz and Rosen,
IEEE Transaction on CAD, 10:761-769, June 1991.
2
Mixed Integer Linear Program
• A mathematical program such that:
– The objective is a linear function.
– All constraints are linear functions.
– Some variables are real numbers and some are integers, i.e.,
“mixed integer”.
• It is almost like a linear program, except that some
variables are integers.
• Can you think of which variables may be integer?
3
Problem Formulation
• Minimize the packing area:
– Assume that one dimension W is fixed.
– Minimize the other dimension Y.
• Need to have constraints W
so that blocks do not overlap.
• Associate each block Bi with 4
Y
variables:
– xi and yi: coordinates of its lower left
corner.
– wi and hi: width and height.
4
Non-overlapping Constraints
hi Bi hj Bj
(xi, yi) wi (xj, yj) wj
5
Integer Variables
• Use integer (0 or 1) variables xij and yij:
xij=0 and yij =0 if (1) is true.
xij=0 and yij =1 if (2) is true.
xij=1 and yij =0 if (3) is true.
xij=1 and yij =1 if (4) is true.
• Let W and H be upper bounds on the total width and
height. Non-overlapping constraints:
(1' ) xi + wi ≤ x j + W ( xij + yij )
(2' ) xi − w j ≥ x j − W (1 + xij − yij )
(3' ) yi + hi ≤ y j + H (1 − xij + yij )
(4' ) yi − h j ≥ y j − H (2 − xij − yij )
6
Formulation
Min. Y
s.t. 0 ≤ xi , xi + wi ≤ W 1≤ i ≤ n
0 ≤ yi , yi + hi ≤ Y 1≤ i ≤ n
xi + wi ≤ x j + W ( xij + yij ) 1≤ i < j ≤ n
xi − w j ≥ x j − W (1 + xij − yij ) 1≤ i < j ≤ n
yi + hi ≤ y j + H (1 − xij + yij ) 1≤ i < j ≤ n
yi − h j ≥ y j − H (2 − xij − yij ) 1≤ i < j ≤ n
xij = 0 or 1 1≤ i < j ≤ n
yij = 0 or 1 1≤ i < j ≤ n
7
Formulation with Hard Blocks
If the blocks can be rotated, use a 0-1 integer variable zi for each
block Bi s.t. zi = 0 if Bi is in the original orientation and zi = 1 if Bi is
rotated 90o .
Min. Y
s.t. 0 ≤ x i , x i + z i hi + (1 − z i ) wi ≤ W 1≤ i ≤ n
0 ≤ y i , y i + z i wi + (1 − z i )hi ≤ Y 1≤ i ≤ n
x i + z i hi + (1 − z i ) wi ≤ x j + W ( x ij + y ij ) 1≤ i < j ≤ n
x i − z j h j − (1 − z j ) w j ≥ x j − W (1 + x ij − y ij ) 1≤ i < j ≤ n
y i + z i wi + (1 − z i )hi ≤ y j + H (1 − x ij + y ij ) 1≤ i < j ≤ n
y i − z j w j − (1 − z j )h j ≥ y j − H (2 − x ij − y ij ) 1 ≤ i < j ≤ n
x ij = 0 or 1 1≤ i < j ≤ n
y ij = 0 or 1 1≤ i < j ≤ n
8
Formulation with Soft Blocks
9
Formulation with Soft Blocks
• If Bi is soft and Bj is hard:
11
Solving Linear Program
12
Complexity
13
Successive Augmentation
A classical greedy approach to keep the problem size
small: repeatedly pick a small subset of blocks to
formulate a MILP, solve it together with the previously
picked blocks with fixed locations and shapes:
Next subset
Y Partial Solution
14
Floorplan Representations
• Slicing
– Normalized Polish Expression: Wong & Liu [DAC-86]
• Mosaic (and General)
– Corner Block List (CBL): Hong et al. [ICCAD-00]
– Q-Sequence: Sakanushi & Kajitani [APCCAS-00]
– Twin Binary Sequence (TBS): Young, Chu, Shen [ISPD-02]
• General
– Polar graphs: Ohtsuki et al. [ICCST-70]
– Sequence pair: Murata et al. [ ICCAD-95]
– Bounded Slicing Grid (BSG): Nakatake [ICCAD-96]
– Transitive Closure Graph (TCG): Lin & Chang [DAC-01]
• Compacted
– O-tree: Guo et al. [DAC-99]
– B*-tree: Chang et al. [DAC-00]
15
General Floorplanning
by Simulated Annealing:
Sequence-Pair Representation
10/22/08 16
Sequence-Pair vs. Polish Expression
• Sequence-Pair is a succinct representation of non-
slicing floorplans of rectangles
– Just like Polish Expression for slicing floorplans
• Represent a non-slicing floorplan by a pair of sequences
of blocks.
• Using Simulated Annealing to find a good sequence-pair
• Can only handle hard blocks
– i.e., cannot do things like shape-curve computation
• Essentially macro placement
• Techniques for soft block shaping exist (e.g.,
Lagrangian Relaxation) but are very slow
17
Sequence Pair
18
Positive Locus and Negative Locus
Positive Locus
of Block b
Negative Locus
of Block b
19
Sequence-Pair
20
Geometric Info of Sequence-Pair
Given a placement and the corresponding
sequence-pair (P, N):
• a is right to b iff a is after b in both P and N.
• a is left to b iff a is before b in both P and N.
• a is above b iff a is before b in P and after b in N.
• a is below b iff a is after b in P and before b in N.
21
From Sequence-Pair to a Placement
Labeled grid for
(abdecf, cbfade)
• Given a sequence-pair,
e the placement with
d smallest area can be
a found in O(n2) time.
f
b • Algorithms of time O(n
c log log n) or O(n log n)
exist. But faster than
a O(n2) algorithm only
b when n is quite large.
d
e
c
f
22
From Sequence-Pair to Placement
• Distance from left (bottom) edge can be found using
the longest path algorithm on the horizontal (vertical)
constraint graph.
24
Sequence Pair
25
Example
2
1 3
5
4
26
Floorplan Realization
• Floorplan realization is the step to construct a floorplan
from its representation.
• How to construct a floorplan from a sequence pair?
• We can make use of the horizontal and vertical
constraint graphs (Gh and Gv).
27
Floorplan Realization
28
Example
Gh 3 1.1 2
1.2
1.1 1 1.2 1.1
1.2 1
0 1.2
2 1.2 5
2 1 3 s 0
4 2.4
5 2 Gv 3 2
1 4 1 2
2.4 1.2 1 1
1
5
(13245,41352 ) 4 0 0
s
29
Constraint Graphs
30
Moves
31
Pros and Cons of SP
• Advantages:
– Simple representation
– All floorplans can be represented.
– The solution space is finite. (How big?)
• Disadvantages:
– Redundant representation. The representation is not 1-to-1.
– The size of the constraint graphs, and thus the runtime to
construct the floorplan is quadratic
32
Questions
• Can we improve the runtime to realize a floorplan from
its SP representation? (“FAST-SP: A Fast Algorithm for
Block Placement on Sequence Pair”, X. Tang and D.F. Wong,
ASP-DAC 2001, pp. 521-526.)
33
Summary of Floorplanning
• Stockmeyer
– Slicing with given set of modules
– Dynamic programming (only keep irredundant solutions)
• Wong-Liu
– Slicing floorplan
– Nice polish expression
• Sequence pair
– Nonslicing
– Nice compact representation
• Mixed Integer Linear Programming
– Nonslicing
– Not scalable
34