Академический Документы
Профессиональный Документы
Культура Документы
BY GREEDY
METHOD
Presented By:-
NEHA JAIN
III-B.Tech CSE
The 2-terminal one to
any special channel
routing problem
The 2-terminal one to any special
channel routing problem
Def:Given a set of terminals on the upper row and another set of
terminals on the lower row, we have to connect each marked
upper terminal to the marked lower row in a one to one fashion.
This connection requires that
No two lines can intersect.
All lines are either vertical or horizontal (track).
2 feasible solutions
ACTUAL PROBLEM
Another
solution
Reaching the solution…
Upper row terminals: P1 ,P2 ,…, Pn from left to
right
Lower row terminals: Q1 ,Q2 ,…, Qm from left
to right m > n.
It would never have a crossing connection:
Assumption
Suppose that we have a method to
determine minimum density, d, of a
problem instance.
Now we have to solve our problem
greedily…
If you were greedy you would always
desire to have the minimum density.
(Agreed?)
THE GREEDY ALGORITHM
Step 1: P1is connected Q1.
Step 2 : After Pi is connected to Qj, we check
whether Pi+1 can be connected to Qj+1.
If the density is increased to d+1, try to connect
Pi+1 to Qj+2.
Step 3 : Repeat Step2 until all Pi’s are connected.
How greedy method helps??
We determine a minimum value parameter
(local density)
This is the value we try to optimize and then
use the greedy method straightforwardly.
The greedy algorithm connects the terminals
greedily
At any time our algorithm ensures that the
resulting density does not exceed d
Minimum cooperative
guards problem for
1-spiral polygons
ART GALLERY PROBLEM
We are given a polygon,
which represents an art
gallery, and we are
required to place a
minimum number of
guards in the polygon
such that every point of
the polygon is visible to
Solution of the art gallery at least one guard.
problem
Minimum cooperative guards
problem
The minimum cooperative guards problem puts more constraint on the art
gallery problem.
Note that it may be quite dangerous for a guard to be stationed in an art
gallery if he cannot be seen by any other guards.
We represent the relationship among guards by a visibility graph G of the
guards.
In G, every guard is represented by a vertex and there is an edge between
two vertices if and only if the corresponding guards can see each other.
In addition to finding a minimum set of guards who can see the given polygo
we further require that the visibility graph of these guards is connected.
In other words, we require that no guard is isolated and there is a path
between every pair of guards. We call such a problem the minimum
cooperative guards problem.
Minimum cooperative guards
problem….
A solution of the
minimum
cooperative
guards problem
for the polygon
shown earlier
NOTATION
A reflex (convex) chain, denoted as
RC (CC), of a simple polygon is a
chain of edges of this polygon if all CC
of the vertices on this chain are
reflex (convex) with respect to the
interior of the polygon, except the
vertices at the end of the chain.
The term “reflex chain” always RC
refers to a maximal reflex chain;
that is, it is not contained in any
Vs Ve
other reflex chain.
Vs+1 Ve-1
A 1-spiral polygon P is a simple
polygon whose boundary contains
exactly one reflex chain. (Convex
polygon is 0-spiral.)
A typical 1-spiral polygon
NOTATION
Traversing the boundary of P counterclockwise, the starting
(ending) vertex of the reflex chain is called vs, (ve) and the
indices of vertices of P are numbered in increasing order.
p q
RC
Vs Ve
Vs+1 Ve-1
STARTING REGION, ENDING
REGION
q
CC CC
Ve
Ve-1
q
p
RC starting Vs
p region
ending Vs+1
Vs Ve region
Vs+1 Ve-1
Vs+1 RC
Ve-1
RC
starting Vs Ve CC
region ending
region
For two points p and q on the convex (reflex) chain, we define p < q
if p is closer to vs on the convex (reflex) chain than is q.
There must be a guard standing in both the starting and ending
regions.
Reaching the solution..
Place a guard at l1.
We as how much can this guard
see?
To answer this draw a tangent
line of RC starting from l1 and
hitting at l2 on CC.
Place a guard at l2.
In the adjacent figure
l1,l2,l3,l4,l5 constitute an
optimal solution for the
minimum cooperative guards
problem.
Supporting line segment
Let a be a point in P and b a point on CC of P. A line
segment ab tangent at a reflex vertex c is called a left
(right) supporting line segment with respect to a if there are
exterior points of P to the right (left) of ab in every
neighborhood of c. We call vertex c the contact vertex of
ab.
If a is in the starting (ending) region, we define the right
(left) supporting line segment with respect to a as avs (ave)
with vs (ve) as its contact vertex.