2023-10-03 Dominik Krupke
This folder contains an exact solver for the Dispersive AGP (with vertex guards). It has been developed on inquiry of Christian Rieck to make the results viable for the CG:SHOP grant. It uses an iterative SAT-model and lazy constraints for coverage via witnesses to solve the problem. The minimal distance is incrementally increased until the formula becomes infeasible, which indicates that the previous distance was the optimal one.
Optimization Dispersive Art Gallery Problem (Vertex Guarding)
Input:
- A polygon ( P ) with vertices ( V(P) ).
Objective: Determine the maximum distance ( \ell^* ) such that there exists a set of guards, ( G ), positioned on the vertices of the polygon ( P ) (i.e., ( G \subseteq V(P) )) with the following properties:
- Every point inside ( P ) is visible to at least one guard in ( G ).
- The pairwise geodesic distances between any two guards in ( G ) are at least ( \ell^* ).
Note: The visibility between a point and a guard is determined by a straight line segment that does not intersect the exterior of the polygon ( P ).
This problem was introduced by Rieck and Scheffer.
You can easily install and use the solver via pip:
pip install --verbose git+https://github.com/d-krupke/dispersive_agp_solver
We put some effort into making the installation as easy as possible. However, you will need to have a modern C++-compiler installed. There may also be some problems with Windows. The installation of the dependencies can take a while as CGAL will be locally installed (and compiled). Depending on your system, this can take up to 30 minutes.
You could also try to install the visibility polygon dependency pyvispoly before installing this package. This dependency is probably the most difficult to install. If you manage to install it, the installation of this package should be easy.
For a given polygon
- There is an infinite number of witnesses and corresponding visibility constraints.
- A notorious
$\max\min$ -objective.
The first problem can be handled by introducing a finite set of witnesses
The second problem requires different techniques for different solvers. We can solve it by rectified constraints:
Rectified constraints are usually inefficient for MIP solvers, but some constraint programming solvers such as CP-SAT can often handle them reasonably well.
If an upper bound
This model can be solved by a MIP solver such as Gurobi or CPLEX. However, the
performance can be poor if not tight
An important observation is that there are only
Building a formula that decides the existence of a solution with objective value
at least
Decide(
Note that increasing
The algorithm is based on an incremental SAT-model, in which we
- incrementally ensure full coverage of the polygon by adding witnesses for missing areas
- incrementally increase the minimal distance between guards until the formula becomes infeasible
Input: A polygon ( P ) Output: A set of guards ensuring maximum dispersion
- Initialize
vertices = P.vertices
- Initialize
SATFormula
as an empty SAT instance - For
v
invertices
:- Introduce a new Boolean variable
$x_v$ intoSATFormula
representing the placement of a guard at vertexv
- Introduce a new Boolean variable
- Add a clause to
SATFormula
to enforce at least one guard:$\bigvee_{v \in \text{vertices}} x_v$ -
while True:
solution = Solve(SATFormula)
-
if not
solution
:- Return
LastFeasibleSolution
- Return
guards = { v | v in vertices and solution(x_v) is True }
missingArea = ComputeMissingArea(P, guards)
-
if
missingArea
is empty:LastFeasibleSolution = guards
-
$g_1, g_2$ =FindClosestGuardsPair(guards)
- Add a new clause to
SATFormula
to prevent$g_1$ and$g_2$ from being chosen simultaneously:$\neg x_{g_1} \vee \neg x_{g_2}$
-
else:
- For
witness
inFindWitnessesForMissingArea(missingArea)
:visibleGuards = FindVisibleGuards(witness, guards)
- Add a new clause to
SATFormula
:$\bigvee_{g \in \text{visibleGuards}} x_g$
- For
Most of the time is used by the geometric operations, while the SAT-formulas remain harmless. Thus, one could try another approach by always computing an optimal solution for each witness set and only then start to extend it. This would drastically reduce the number of geometric operations. A lot of the data can be reused. Would require some changes in the code architecture.
Alternative approaches could be based on a MIP or CP-SAT model. They would probably not be competitive. However, they could minimize the number of guards in parallel and, thus, potentially make larger optimization steps.
While this code is licensed under the MIT license, it has a dependency on CGAL, which is licensed under GPL. This may have some implications for commercial use.