Problems Solved by Greedy Method
-
Upload
api-3844034 -
Category
Documents
-
view
2.302 -
download
2
Transcript of Problems Solved by Greedy Method
![Page 1: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/1.jpg)
PROBLEMS SOLVED BY GREEDY METHOD
Presented By-NEHA JAINIII-BTech CSE
The 2-terminal one to any special channel routing problem
The 2-terminal one to any special channel routing problem
DefGiven 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 thatNo two lines can intersectAll lines are either vertical or horizontal (track)
2 feasible solutions
ACTUAL PROBLEM
TO minimize the of tracks
SIMPLIFIED VERSION
At each point the local density of the solution is of lines the vertical line intersects
The problem to minimize the density The density is a lower bound of of tracks
Redrawing solutions
Optimal solution
(density =1)
Another solution
Reaching the solutionhellip
Upper row terminals P1 P2 hellip Pn from left to
right Lower row terminals Q1 Q2 hellip Qm from left to
right m gt 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 greedilyhellip
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 2: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/2.jpg)
The 2-terminal one to any special channel routing problem
The 2-terminal one to any special channel routing problem
DefGiven 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 thatNo two lines can intersectAll lines are either vertical or horizontal (track)
2 feasible solutions
ACTUAL PROBLEM
TO minimize the of tracks
SIMPLIFIED VERSION
At each point the local density of the solution is of lines the vertical line intersects
The problem to minimize the density The density is a lower bound of of tracks
Redrawing solutions
Optimal solution
(density =1)
Another solution
Reaching the solutionhellip
Upper row terminals P1 P2 hellip Pn from left to
right Lower row terminals Q1 Q2 hellip Qm from left to
right m gt 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 greedilyhellip
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 3: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/3.jpg)
The 2-terminal one to any special channel routing problem
DefGiven 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 thatNo two lines can intersectAll lines are either vertical or horizontal (track)
2 feasible solutions
ACTUAL PROBLEM
TO minimize the of tracks
SIMPLIFIED VERSION
At each point the local density of the solution is of lines the vertical line intersects
The problem to minimize the density The density is a lower bound of of tracks
Redrawing solutions
Optimal solution
(density =1)
Another solution
Reaching the solutionhellip
Upper row terminals P1 P2 hellip Pn from left to
right Lower row terminals Q1 Q2 hellip Qm from left to
right m gt 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 greedilyhellip
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 4: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/4.jpg)
2 feasible solutions
ACTUAL PROBLEM
TO minimize the of tracks
SIMPLIFIED VERSION
At each point the local density of the solution is of lines the vertical line intersects
The problem to minimize the density The density is a lower bound of of tracks
Redrawing solutions
Optimal solution
(density =1)
Another solution
Reaching the solutionhellip
Upper row terminals P1 P2 hellip Pn from left to
right Lower row terminals Q1 Q2 hellip Qm from left to
right m gt 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 greedilyhellip
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 5: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/5.jpg)
ACTUAL PROBLEM
TO minimize the of tracks
SIMPLIFIED VERSION
At each point the local density of the solution is of lines the vertical line intersects
The problem to minimize the density The density is a lower bound of of tracks
Redrawing solutions
Optimal solution
(density =1)
Another solution
Reaching the solutionhellip
Upper row terminals P1 P2 hellip Pn from left to
right Lower row terminals Q1 Q2 hellip Qm from left to
right m gt 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 greedilyhellip
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 6: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/6.jpg)
SIMPLIFIED VERSION
At each point the local density of the solution is of lines the vertical line intersects
The problem to minimize the density The density is a lower bound of of tracks
Redrawing solutions
Optimal solution
(density =1)
Another solution
Reaching the solutionhellip
Upper row terminals P1 P2 hellip Pn from left to
right Lower row terminals Q1 Q2 hellip Qm from left to
right m gt 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 greedilyhellip
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 7: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/7.jpg)
Redrawing solutions
Optimal solution
(density =1)
Another solution
Reaching the solutionhellip
Upper row terminals P1 P2 hellip Pn from left to
right Lower row terminals Q1 Q2 hellip Qm from left to
right m gt 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 greedilyhellip
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 8: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/8.jpg)
Reaching the solutionhellip
Upper row terminals P1 P2 hellip Pn from left to
right Lower row terminals Q1 Q2 hellip Qm from left to
right m gt 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 greedilyhellip
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 9: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/9.jpg)
Assumption
Suppose that we have a method to determine minimum density d of a problem instance
Now we have to solve our problem greedilyhellip
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 10: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/10.jpg)
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 Pirsquos 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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 11: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/11.jpg)
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
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 12: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/12.jpg)
Minimum cooperative guards problem for 1-spiral polygons
ART GALLERY PROBLEM
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 13: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/13.jpg)
ART GALLERY PROBLEM
Solution of the 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 at least one guard
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 14: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/14.jpg)
Minimum cooperative guards problem
The minimum cooperative guards problem puts more constraint on the art gallery problem
1048708Note 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
1048708In 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
1048708In addition to finding a minimum set of guards who can see the given polygon we further require that the visibility graph of these guards is connected
1048708In 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 problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 15: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/15.jpg)
Minimum cooperative guards problemhellip
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 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 16: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/16.jpg)
NOTATION A reflex (convex) chain denoted as
RC (CC) of a simple polygon is a chain of edges of this polygon if all 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 ldquoreflex chainrdquo always refers to a maximal reflex chain that is it is not contained in any other reflex chain
A 1-spiral polygon P is a simple polygon whose boundary contains exactly one reflex chain (Convex
polygon is 0-spiral)
Vs Ve
Ve-1
CC
RC
Vs+1
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 17: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/17.jpg)
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 18: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/18.jpg)
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
A subchain of the boundary of P from point p to point q in counterclockwise order is denoted as C[p q]
Vs Ve
Ve-1
CC
RC
Vs+1
p q
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 19: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/19.jpg)
STARTING REGION ENDING REGION
Vs Ve
Ve-1
CC
RC
Vs+1
Vs
Vs
Vs+1
Vs+1
Ve
Ve
CC
CCRC
RCVe-1
Ve-1
starting region
ending region
starting region
ending region
pq
p
q
For two points p and q on the convex (reflex) chain we define p lt 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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 20: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/20.jpg)
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
l1l2l3l4l5 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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 21: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/21.jpg)
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
abc
a
bc
c
b
RC
CC
RC
CCleft supporting line with respect to a
right supporting line with respect to a c
b
Vs Ve
a a
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 22: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/22.jpg)
ALGORITHM Input a 1-spiral polygon Output a set of points which correspond to the solution of the
minimum co-operative guards problem Step1 find the reflex chain RC and the convex chain CC of P Step 2 find the intersection points l1 and l2 of CC with the
directed lines starting from vs and ve along the first and last edges of RC respectively
Step 3 let lk=1 while lk is not in the ending region do draw the left tangent of lk with respect to RC until it hits CC at lk+1 (lklk+1 is
the left supporting line segment with respect to lk) end while
step 4 report (l1l2helliplk)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 23: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/23.jpg)
Analysishellip Since the number of guards is minimal we
conclude that our algorithm produces optimal solution
Time- complexity Analysis step 1 and step 2 can be done in O(n) time by a
linear scan of the boundary of P Step3- we conduct a linear scan on the reflex
chain counterclockwise and on the convex chain clockwise to find all the required left-supporting line-segments This can also be done in O(n) time
Thus this algorithm is linear
THANK YOU
![Page 24: Problems Solved by Greedy Method](https://reader033.fdocuments.us/reader033/viewer/2022061604/5528a7334a7959c93d8b47e4/html5/thumbnails/24.jpg)
THANK YOU