institute of information science academia sinica 1 1 introduction to geomtric computing d. t. lee...
TRANSCRIPT
1Institute of Information Science Academia Sinica
1
Introduction to Geomtric Introduction to Geomtric ComputingComputing
D. T. LeeInstitute of Information Science
Academia Sinica
October 14, 2002
October 14, 2002 2
2
What is Computer Science about?What is Computer Science about? Not about programming But about problem solving Basic disciplinary areas include• Software & Programming-related• Hardware-related• Computer systems• Theory • Mathematics of computer science• Applications• etc.
October 14, 2002 3
3
MinMax Problem MinMax Problem 44
Min&Max Problem
Input: A set S of N numbers on the real line
Output: The Minimum and Maximum of S• Simple method: Finding the min. or max. of N
numbers requires N-1 comparisons.• Reduce Min&Max to 2 Min or Max problems!
2N-3 comparisons
October 14, 2002 4
4
min
min
maxSimple comparator
MIN min
MinMax Problem MinMax Problem 33
October 14, 2002 5
5
MinMax Problem MinMax Problem 22
But finding both Maximun and Minimum can be done with 3N/2 2 comparisons
October 14, 2002 6
6
min
max
MIN min
MAX max
MinMax Problem MinMax Problem 11
October 14, 2002 7
7
Sorting ProblemSorting Problem Sorting N numbers• Simple method: find Min repeatedly
(N-1) + (N-2) + … + 2 + 1 = (N-1)N/2• Selection method:
–Smallest can be found in (N-1) comparisons
– 2nd smallest found in log2 N additional comp.
– 3rd smallest found in log2 N additional comp.
(N-1)+ (N-1)log2 N
October 14, 2002 8
8
min
1st round 3rd round2nd round
Total number of matches for 8 competitors is 7N/2 + N/4 + … + 4 + 2 + 1 = N-1
Total number of rounds is log2 N
Knockout TournamentKnockout Tournament
October 14, 2002 9
9
Geometric ComputingGeometric Computing Design and Analysis of Algorithms for
geometric problems Theory: Computational Complexities• Time, Space, Degree• Lower and Upper Bounds of Computation
Applications: • VLSI CAD, Computer-Aided Geometric Design, Computer
Graphics, Operations Research, Pattern Recognition, Robotics, Geographical Information Systems, Statistics, Cartography, Metrology, etc.
October 14, 2002 10
10
Theory of ComputationTheory of Computation
Models of Computation Real arithmetic, RAM Computation Tree Model - Unit Cost Off-line, On-line, Real-time Parallel Computation vs Serial Computation Problem Complexity vs Algorithm Complexity Decision vs Computation Problems• Output Sensitive Algorithms
October 14, 2002 11
11
Checking if a Polygon is Convex Checking if a Polygon is Convex 44
A polygon P is represented by a sequence of points v0,v1,v2, …,vn-1 where (vi, vi+1) is an edge, i=0,1,..,n-1, vn = v0.
Theorem: A polygon P is convex if segments connecting any two points inside the polygon always lie inside P.
October 14, 2002 12
12
Problem: There are infinitely many possibleSegments to check!
Checking if a Polygon is Convex Checking if a Polygon is Convex 33
October 14, 2002 13
13
Checking if a Polygon is Convex Checking if a Polygon is Convex 22
Theorem: A polygon is convex if every diagonal lies inside the polygon.• It takes O(N3) time to check O(N2)
diagonals against every edge of P.• Very inefficient!
Theorem: A polygon is convex if every interior angle of each vertex is less than 180o.
•This result would imply an O(N) time algorithm!
October 14, 2002 14
14
Consider three vertices vi,vj,vk and determinant
det(vi,vj,vk ) = xi yi 1xj yj 1xk yk 1
where (xi yi ) are the x- and y-coordinates of v i
det(vi,vj,vk ) = 0 when vi,vj,vk are collinear
det(vi,vj,vk ) < 0 when vi,vj,vk form a right turn
det(vi,vj,vk ) > 0 when vi,vj,vk form a left turn
vi
vj
vk
left turn
Checking if a Polygon is ConvexChecking if a Polygon is Convex11
vi
vj
vk
right turnvi
vj
vk
collinear
October 14, 2002 15
15
Checking if a Polygon is SimpleChecking if a Polygon is Simple
v1
v2
v3
v4
v0
v5
How do you check if the input polygon is simple??
October 14, 2002 16
16
Art Gallery Problem Art Gallery Problem
Consider an art gallery room whose floor plan is modeled by a simple polygon with N sides.
How many stationary guards are needed to guard the room?
Assumption: Each guard is considered to have 360o unlimited visibility.
Two points p and q are said to be visible to each other, if the line segment (p,q) does not intersect any edge of the polygon.
October 14, 2002 17
17
Art Gallery ProblemArt Gallery Problem
p and q are visible
q
r
r and q are not visible
pq
October 14, 2002 18
18
Art Gallery ProblemArt Gallery Problem
Visibility polygon of q & r
q r
October 14, 2002 19
19
Art Gallery TheoremArt Gallery Theorem Theorem: Given a simple polygon with
N sides, stationary guards are sufficient, and sometimes necessary to cover the entire polygon.
N/3
Theorem: Given a simple polygon with N sides, the problem of finding a minimumnumber of stationary guards to cover the entire polygon is intractable.
October 14, 2002 20
20
Lower Bound of Art Gallery ProblemLower Bound of Art Gallery Problem
A comb with 8 prongs (N=24) requiresN/3 = 8 guards
October 14, 2002 21
21
Upper Bound of Art Gallery ProblemUpper Bound of Art Gallery ProblemTriangulation of a Simple PolygonTriangulation of a Simple Polygon
October 14, 2002 22
22
Coloring of a GraphColoring of a Graph
Coloring of a graph: an assignment of colors to nodes of the graph such that no two adjacent nodes are assigned the same color.
Chromatic number: The minimum number of colors required to color a graph.
Theorem: Every triangulation of a simple polygon is 3-colorable.
October 14, 2002 23
23
N = 14
Art Gallery Problem: ExampleArt Gallery Problem: Example
Triangulation
Select red color to place guards
3 N/3 = 4
October 14, 2002 24
24
Art Gallery TheoremArt Gallery Theorem
Theorem: In a 3-coloring of a triangulation of a simple polygon with N vertices, there exists a color that is used no more than N/3 times.
Proof: Pigeon-hole principle• If n pigeons are placed into k pigeon-holes,
at least one of the holes must have no more than n/k pigeons.
• Since N is an integer, there exists at least one color that is used in no more than N/3 times.
October 14, 2002 25
25
Variations of Art Gallery ProblemVariations of Art Gallery Problem
Shapes of Art Gallery:• Rectilinear polygon• Polygon with holes
Capabilities of Guard• Mobile guards moving along a track• Guards with limited visibility (angle and dist
ance)
October 14, 2002 26
26
Rectilinear PolygonRectilinear Polygon
October 14, 2002 27
27
Polygons with HolesPolygons with Holes
October 14, 2002 28
28
Guard CapabilitiesGuard Capabilities
Mobile GuardLimited visibility
Mobile guard with limited visibility
October 14, 2002 29
29
Map Coloring Map Coloring 22
Given a planar graph (planar map), find a coloring of the regions so that no two adjacent regions are assigned the same color.
How many colors are sufficient?• 4-color theorem!
Find an algorithm that colors the map.
October 14, 2002 30
30
Map Coloring Map Coloring 11
October 14, 2002 31
31
ProximityProximity
Closest Pair Problem: Consider N points in the plane, find the pair of points whose Euclidean distance is the smallest.• Brute force: Enumerate all N2 pairwise
distances and find the minimum.• Can one do better?
October 14, 2002 32
32
Closet Pair on the Real LineCloset Pair on the Real Line
Consider N numbers x0, x1, x2, …, xn-1 on the real line, find the two numbers xi and xj such that |xi – xj | is the smallest.
Lemma: The two numbers xi and xj such that |xi – xj | is the smallest must be adjacent to each other, when these numbers are sorted.
xi+1xi
Closest pair
October 14, 2002 33
33
Closest Pair in the Plane Closest Pair in the Plane
2
1
= 2
October 14, 2002 34
34
Voronoi DiagramVoronoi Diagram
Delaunay TriangulationClosest pair must beVoronoi neighbors
Circumcircle of a triangle
October 14, 2002 35
35
Closest Pair ProblemClosest Pair Problem
Theorem: Given N points in k-dimensional space, the closest pair of points can be determined in O(N log N) time, which is asymptotically optimal.
October 14, 2002 36
36
Geometric OptimizationGeometric Optimization Shortest Path Problem• Given a polygonal domain (obstacles),
and two points s and t, find a shortest path between s and t avoiding these obstacles.
Homotopic Routing• Given a layout and the homotopy of k 2-
terminal nets, find a detailed routing of minimum wire length.
October 14, 2002 37
37
Homotopic RoutingHomotopic Routing
Input: A sketch S=(F, M, W), a planar drawing of a physical layout of modules M in the grid and a finite set W of nets connecting point features F, each represented by a vertex-disjoint simple path.
Output: A detailed routing on the grid without overlapping of these nets of minimum total length among those that are homotopic to the given sketch.
Net p is homotopic to net q, if they have the same terminals, and one can be transformed continuously into the other without crossing features.
October 14, 2002 38
38
October 14, 2002 39
39
October 14, 2002 40
40
October 14, 2002 41
41
AfterCompaction
October 14, 2002 42
42
Topological Via Minimization Topological Via Minimization 44
Given a set of n 2-terminal nets in a two-layer bounded routing region, find a layer assignment of wire segments so as to minimize the number of vias used.
layer1
layer2
via
October 14, 2002 43
43
Layer 1
Layer 2
Via
Layer 1
Layer 2
Via
# of Vias = 4
# of Vias = 1
Topological Via Minimization Topological Via Minimization 33
October 14, 2002 44
44
Layer 1
Layer 2
Via
# of Vias : 1
Topological Via Minimization Topological Via Minimization 22
October 14, 2002 45
45
Topological Via Minimization Topological Via Minimization 11
Lemma: There exists an optimal solution to the two-layer bounded region TVM problem such that each net uses at most one via.
October 14, 2002 46
46
Definition: A set of chords is said to be 2-independent if it can be partitioned into two subsets of independent chords
Circle Graph Circle Graph 22
October 14, 2002 47
47
Theorem: Given n chords in a circle and an integer k, the problem of deciding if there exists a 2-independent set of chords of size k or more (2-independent set in circle graphs) is NP-complete.
Proof (Sketch): The 2-independent set problem is in NP. Planar 3SAT is polynomially reducible to
the 2-independent set problem.
Circle Graph Circle Graph 11
October 14, 2002 48
48
Permutation graphs:
Given n chords in a two-sided channel in which each chord connects one point in each side, find a 2-independent set of chords of maximum cardinality.
2-Independent Set Problem2-Independent Set Problem
Circle graphs:
Given n chords in a circle, find a 2- independent set of chords of maximum cardinality.
NP-hard
O(n log n) time
October 14, 2002 49
49
Permutation GraphPermutation Graph
October 14, 2002 50
50
Geometric OptimizationGeometric Optimization
Minimum Covering• Given a set of N points, find the smallest di
sk covering the entire set.• Smallest enclosing circle, rectangle, squar
e, annulus, parallel strip, etc.• P-center problem• minimum covering with fixed-size disk,
square,etc. • weighted version
October 14, 2002 51
51
Minimum Covering Minimum Covering 33
1-center problem (smallest circle)
October 14, 2002 52
52
Minimum Covering Minimum Covering 22
1-center problem (smallest rectangle)
October 14, 2002 53
53
Minimum Covering Minimum Covering 11
p-center problem (fixed-size disk covering)
October 14, 2002 54
54
Matching Matching 22
Pattern matching: Given a target pattern P, and A test pattern Q, find if Q is a sub-pattern in P.
PQ
October 14, 2002 55
55
Matching Matching 11
P
Q
October 14, 2002 56
56
Inexact MatchingInexact Matching
PQ
October 14, 2002 57
57
Bipartite MatchingBipartite Matching Bi-chromatic matching: Given two sets,
P and Q of points, find a one-to-one mapping such that the sum of distances of matched pairs of points is minimized.
October 14, 2002 58
58
SearchingSearching
Searching Problems:• Given a set S of objects (points, line segments,
etc.), determine if there exists any object with certain properties.
• Given a set S of objects, report objects that satisfy certain properties.
• With preprocessing allowed, how fast can we find objects in S satisfying certain properties?
• What if S is subject to updates?• Memory requirement, query time, update time
October 14, 2002 59
59
Searching and Retrieval Searching and Retrieval Exact Match (membership problem) Given a set S of objects pi(x1,x2,,…, xn), is
(q1,q2,,…, qn) in S? Range Search Given a set S of objects pi(x1,x2,,…, xn), find
those whose xk lies within a range interval [qk1,qk2] for each k=1,2,..,n.• In 2D, the problem is solvable in O(log2 N + K)
optimal time;• In higher dimensions, it is solvable in O((log2 N)d-1
+ K) time, where K is the output size.
October 14, 2002 60
60
Example of Range SearchExample of Range Search
salary
Date of birth
19,500,000 19,559,999
3,000
4,000
G. Ometer
born: Aug 19, 1954
Salary: 3500
19,500,000
19,559,999
3,000
4,000
24
October 14, 2002 61
61
ConclusionConclusion
Computer Science is a discipline addressing areas ranging from theory to applications.
Mathematics is a fundamental to theoretical computer science.
Geometric computing is a very rich area with many applications
Cryptography (one-way function, security) Number theory, combinatorics Packing Problem, Trapezoid Problem, etc.
October 14, 2002 62
62
Trapezoid Construction ProblemTrapezoid Construction Problem
c
a
bde f
Given d, b, e, f construct a trapezoid as shown
Given a,c, e, f construct a trapezoid as shown:Solved.
October 14, 2002 63
63
The EndThe End
Thank you for your attention!