Abstract
The Hausdorff distance between two closed sets has important theoretical and practical applications. Yet apart from finite point clouds, there appear to be no generic algorithms for computing this quantity. Because many infinite sets are defined by algebraic equalities and inequalities, this a huge gap. The current paper constructs Frank–Wolfe and projected gradient ascent algorithms for computing the Hausdorff distance between two compact convex sets. Although these algorithms are guaranteed to go uphill, they can become trapped by local maxima. To avoid this defect, we investigate a homotopy method that gradually deforms two balls into the two target sets. The Frank–Wolfe and projected gradient algorithms are tested on two pairs of compact convex sets, where: (1) A is the box translated by and B is the intersection of the unit ball and the non-negative orthant; and (2) A is the probability simplex and B is the unit ball translated by . For problem (2), we find the Hausdorff distance analytically. Projected gradient ascent is more reliable than the Frank–Wolfe algorithm and finds the exact solution of problem (2). Homotopy improves the performance of both algorithms when the exact solution is unknown or unattained.
1. Introduction
The Hausdorff distance [1,2] between two compact sets A and B in a Euclidean space is defined as
where
, and . Here, denotes the standard Euclidean norm in . The Blaschke formula
serves as an alternative definition of Hausdorff distance [3]. Wikipedia has a helpful entry on Hausdorff distance with a two-dimensional illustration. The theoretical value of Hausdorff distance stems from the fact that it turns the collection of compact sets into a complete separable metric space. In general, Hausdorff distance is challenging to compute.
Hausdorff distance has many applications. For instance, it is instrumental in defining continuity, compactness, and completeness for integral operators, differential operators, and Fourier transforms in functional analysis [4,5]. These concepts are in turn relevant to the analysis of the existence, uniqueness, and stability of solutions to various equations in mathematics and physics [6]. In computer vision, Hausdorff distance enables object recognition [7] and allows one to quantify the difference between two different representations of the same object [8]. Edge detection and pixelization are usually necessary preprocessing steps. Other applications include robotics [9], the fractal modeling of biological structures [10], and the numerical computation of attractors in dynamical systems [11].
The current paper derives and tests two new algorithms for computing the distance between two compact convex sets. The previous work on this intrinsically interesting problem is mostly limited to finite point clouds, usually in two and three dimensions [12,13,14,15,16]. The formulas
can be naively implemented for finite sets A and B. The naive implementation benefits from fast software such as the Julia Distances package, which exploits matrix multiplication to find all Euclidean distances between the column vectors of two matrices. The ImageDistances.jl package (github.com/JuliaImages/Images.jl) appears to rely on the naive method [12] for computing Hausdorff distances. Once the distances are computed, the computational complexity of the naive method is , where m and n equal the number of points and , respectively. This complexity can be reduced by various devices, as suggested in the cited references.
The algorithms for computing the Hausdorff distance between two polygons [17], two curves [18] in the plane, and a curve and a surface [19] represent exceptions to the discrete point-cloud method. More complicated sets defined by algebraic formulas can be attacked by pixelating the sets or sampling them at a dense set of random points. The methods of continuous optimization offer an attractive alternative to the various current methods. Although the calculation of takes us outside the comfortable realm of convex optimization, the tools of convex calculus are highly pertinent. To their credit, these tools perform well in higher dimensions. It remains to be seen whether the Hausdorff distance will have practical value in shape recognition in this regime. It would be prudent to keep the possibility in mind.
To calculate , it clearly suffices to calculate and separately and take the maximum. For many sets B, is explicitly known or can be computed by an efficient algorithm [20,21]. The Euclidean distance can be expressed as
where is the projection of onto B. When B is convex, the projection operator is single-valued. For closed nonconvex sets, the projection is multiple-valued for some , but these points are very rare; indeed, they are of Lebesgue measure 0 [22]. The scaled squared distance function is smoother than . One can show that the former function is differentiable with gradient
at all points where is single-valued [23].
The support function and the corresponding support set also play key roles in our algorithm development. The maximum of exists and necessarily occurs on the boundary of A. In fact, Bauer’s maximum principle [24,25] implies that the maximum is achieved at an extreme point of A. The point of B corresponding to occurs on the boundary of B, but not necessarily at an extreme point of B. The supporting set is a singleton if and only if is differentiable at .
Our first algorithm for computing ,
is a Frank–Wolfe algorithm [26,27]. Our second algorithm,
is a projected gradient algorithm [21,28]. Both algorithms force the objective function uphill and are iterated until convergence. Because the algorithms can become trapped by local maxima, they are not infallible in finding a global maximum. To overcome this tendency, we introduce a homotopy method that gradually transitions the calculation of the Hausdorff distance from the simple case of two balls to the actual problem of finding . Homotopy is one of several heuristics for maximizing multi-modal functions [29]. The crucial difference between projected gradient ascent and the Frank–Wolfe algorithm is that one depends on projection while the other depends on both projection and supporting sets. This difference obviously favors projected gradient ascent.
As a roadmap to the rest of this paper, Section 2 presents (a) the basic notation, (b) a brief overview of the minorization–maximization principle that stands behind the new iterative algorithms (2) and (3), (c) a summary of the support functions and supporting sets, (d) the derivation of both algorithms, (e) a description of the homotopy method, and (f) an explanation of relevant convergence theory. Section 3 tests our two iterative algorithms and the point-cloud method on two representative problems. Both iterative algorithms are orders of magnitude faster than the point-cloud method and benefit from the homotopy heuristic. Projected gradient ascent is also more accurate than the point-cloud method. Section 4 summarizes our conclusions, mentions limitations, and suggests new avenues for research. Appendix A, proves some of the mathematical assertions made in the text and provides the full Julia code for our numerical examples. Note that the code is organized from bottom to top, with the main program occurring at the bottom.
2. Materials and Methods
As a prelude to the derivation of the two algorithms, it would be helpful to clarify our notation and make a few remarks about MM algorithms, support functions, and supporting sets. For projected gradient ascent and its homotopy modification, we provide algorithm flowcharts.
2.1. Notation
Here are the notational conventions used throughout this article. All vectors appear in boldface. All entries of the vectors and equal 0 or 1, respectively. The superscript indicates a vector transpose. The Euclidean norm of a vector is denoted by . For a smooth real-valued function , we write its gradient (column vector of partial derivatives) as and its first differential (row vector of partial derivatives) as . Finally, we denote the directional derivative of in the direction by . When is differentiable, .
2.2. MM Algorithms
The algorithms explored here are minorization–maximization (MM) algorithms [23,30]. They depend on surrogate functions that minorize the original objective around the current iterate in the sense of satisfying the tangency condition and the domination condition for all . The surrogate balances the two goals of hugging the objective tightly and simplifying maximization. Maximizing the surrogate produces the next iterate and drives the objective uphill because
In minimization, the surrogate majorizes the objective and is instead minimized. The tangency condition remains the same, but the domination condition is now reversed. The celebrated EM (expectation–maximization) principle for maximum likelihood estimation with missing data [31] is a special case of minorization–maximization. In the EM setting, Jensen’s inequality supplies the surrogate as the expectation of the complete data log-likelihood conditional on the observed data.
2.3. Support Functions and Supporting Sets
The set of supporting points determines the support function . For instance, the unit ball has equal to the convex hull of the vertices where is largest. For the unit simplex, equals the convex hull of the vertices where is largest. For a Minkowski sum , . If S is either a convex cone or a compact convex set that is symmetric about the origin with a non-empty interior, then its support function has a special form. In the former case, is the indicator of the dual cone, and in the latter case, is a norm. The support function of a Cartesian product is the Cartesian product of the separate support functions. For instance, the support function of rectangle reduces to the one-dimensional case, where is a when , b when , and all of when . There are many other known support functions. For instance, one-sided penalties such as and asymmetric penalties such as are covered by the current theory. Indeed, the former is the support function generated by the interval . The latter is the tilted absolute value equal to for and to for . The support function of a singleton is the linear function . More generally, the support function of the convex hull of the set is . The support function of the line segment from to is the absolute value . Adding a constant vector to a set S produces the support function . It is trivial to project onto if one can project onto S. For any non-negative scalar c, the set has support function . Again, it is trivial to project onto if one can project onto S.
2.4. Derivation of the Algorithms
When B is convex, the supporting hyperplane inequality
for generates our first algorithm. Maximizing this minorization over is equivalent to calculating the support function . If denotes the set of points in A where is attained, then the Frank–Wolfe algorithm just described can be phrased as
The MM principle guarantees that the next iterate will tend to increase the objective unless . This exception occurs when . Fortunately, when the iterates begin in , they remain in . Indeed, if but , then the obtuse angle condition [23] requires
contradicting the optimality of . To achieve the requirement of the Frank–Wolfe method, we put for a random vector and then check that .
If B is closed and convex, then the gradient of the function is Lipschitz with constant 1 [23]. This fact plus the outcome of completing the square entails the minorization
Hence, the MM principle implies that defining
also increases . This second of our two algorithms is a special case of projected gradient ascent. Its flowchart (Algorithm 1) summarizes this straightforward strategy started from many random points .
| Algorithm 1 Computation of by Projected Gradient Ascent |
|
2.5. A Homotopy Method
Although both algorithms are guaranteed to increase the objective, they both suffer from the danger of being trapped by local maxima. One obvious remedy is to launch the algorithms from different random points. A more systematic alternative is to exploit homotopy. The idea is to gradually deform both sets A and B from the unit ball U at the origin, where is known, into the target sets A and B. In practice, we follow the solution path along the family of set pairs from to . This strategy is viable for projected gradient ascent because we can project points onto the Minkowski convex combination by three devices. First, it is well known that when A and B are balls with radii and and centers and , respectively, the distance is maximized by taking , unless , in which case the maximum is 0 [32]. For the convenience of the reader, Proposition A1 of Appendix A proves this assertion. Second, one can exploit the projection identity for any . Third, there is an effective algorithm for projecting onto a Minkowski sum [33]. The idea is to alternate the minimization of with respect to and . The iteration scheme and is guaranteed to converge at a linear rate when either set is strongly convex. Recall that a convex K is strongly convex if there exists an such that
for all and in K, , and unit vectors [34]. In particular, is strongly convex when . Furthermore, the Cartesian product of two strongly convex sets is strongly convex [35]. The homotopy method succeeds because the early sets are more rounded and the objective generates fewer local maxima. The price for better performance is iterations within iterations and an overall slower algorithm. Algorithms 2 and 3 summarize our homotopy strategy for projected gradient ascent.
| Algorithm 2 Minkowski Set Projection |
|
| Algorithm 3 Homotopy Modification of Projected Gradient Ascent |
|
For the Frank–Wolfe algorithm, similar homotopy tactics apply. For a Minkowski sum , . This fact plus the identity for makes it possible to carry out the homotopy method.
2.6. Convergence
Because this topic has been covered in previous studies [21,36,37,38,39], we give an abbreviated treatment here. Each algorithm is summarized by a closed algorithm map that increases the objective . The limit points of the map occur among the stationary points of . By definition, a stationary point satisfies for all tangent vectors at . The set of tangent vectors is the closure of the set of points with and . This is a place where the convexity of C comes into play. Hence, is a stationary point if and only if for all . With this distinction in mind, we state our basic theoretical findings for the Frank–Wolfe method. Homotopy is omitted in these considerations.
Proposition 1.
The limit points of the Frank–Wolfe iterates (2) are stationary points of the objective on A. Furthermore, the bound
holds. Thus, the stationary condition is reasonable to expect at a limit point of the Frank–Wolfe algorithm.
Here is the corresponding finding for projected gradient ascent.
Proposition 2.
The limit points of the projected gradient ascent iterates (3) are also stationary points of the objective on A. Furthermore, the bound
holds.
Although the convergence rate of projected gradient ascent is slower than the corresponding slow convergence rate of the Frank–Wolfe method, in practice, both algorithms usually converge in fewer than 100 iterations. In the case of the Frank–Wolfe algorithm, each iterate is an extreme point. Many convex sets possess only a finite number of extreme points, and convergence to one of them is guaranteed. Unfortunately, the converged point often provides just a local maximum.
3. Results
We tested the Frank–Wolfe and projected gradient ascent algorithms on two pairs of compact convex sets: (1) where A is the box translated by and B is the intersection of the unit ball and the non-negative orthant; and (2) where A is the probability simplex and B is the unit ball translated by . These examples are representative, and for the second pair one can show that , where p is the dimension of the ambient space. See Proposition A2 of Appendix A. Table 1 presents our findings. The computation times are in seconds per trial across 100 random initializations and appear to scale affinely (a constant plus linear) in p. The columns Maximum, Mean, and Std convey summary statistics of the converged values of the Hausdorff distance. The point-cloud method generated random points to mimic each continuous set. Because the point-cloud method is non-iterative, a single run captured its performance. For the record, all computations were carried out on a MacBook Pro with a 2.3 GHz 8-core i9 chip and 16 GB of memory. Although the algorithms were embarrassingly parallel across trials, our Julia code is completely serial.
Table 1.
Computation of by various methods.
The random point-cloud method was not remotely competitive with projected gradient ascent in either accuracy or speed on these sample problems. It did produce approximate distances that confirmed the best results of the iterative methods. As measured by the quality of its solution, projected gradient ascent also outperformed the Frank–Wolfe algorithm. The Frank–Wolfe method was probably too aggressive, perhaps because it moved directly to an extreme point of A in computing . On the second problem, projected gradient ascent attained the global maximum across all trials. When the standard deviation of the converged values is positive, it follows that some trials were trapped by inferior local maxima. Both iterative algorithms benefit from the homotopy heuristic, which is fully deterministic. Accordingly, the standard deviations under homotopy equaled 0. Homotopy increased the computation times by less than an order of magnitude for 11 evenly spaced homotopy points. Finally, as p increased, both problems appeared easier to solve by the iterative methods. This behavior was particularly evident when . In contrast, the random point-cloud solutions deteriorated as p increased.
4. Discussion
The Hausdorff distance problem is intrinsically interesting, with theoretical applications throughout mathematics and practical applications in image processing. Given the non-convexity of the problem, it has not received nearly the attention in the mathematical literature as the closest point problem. Exact values of are available in a few special cases such as the two highlighted in our appendix. Research on fast algorithms tends to be limited to random point clouds. Infinite sets defined by mathematical formulas have been largely ignored. The current paper partially rectifies this omission and demonstrates the value of continuous optimization techniques. The Frank–Wolfe and projected gradient ascent algorithms are relatively easy to code and extremely fast, even in high dimensions. Our preliminary experiments tilt toward projected gradient ascent as the more reliable of the two options. A naive implementation of the point-cloud method is not remotely competitive with projected gradient ascent. More exhaustive studies are warranted beyond the proof of principle examples presented here.
The standard convergence arguments covered in Section 2.6 guarantee that all limit points of the two algorithm classes are stationary points. In practice, convergence appears much faster than the slow rates mentioned in Propositions 1 and 2. We suspect, but have not proved, that full convergence to a stationary point always occurs. This exercise would require a foray into the difficult terrain of real algebraic geometry [40]. In any event, convergence to a global maximum is not guaranteed. Fortunately, safeguards can be put in place to improve the chances of successful convergence. The homotopy method capitalizes on the exact distance between two balls. Minkowski set rounding smooths the boundary of the target sets and steers iterates in a productive direction.
The computation of the Hausdorff distance is apt to be much more challenging when either A or B is non-convex. Many sets can be represented as finite unions of compact convex sets. If and , then the computation of reduces to the computation of for each index i and for each index j. The identities and make this claim obvious. The further identity implies that
In general, saddlepoint problems of this sort are hard to solve. One possible line of attack is to minorize and then maximize the minorization.
The validation and implementation of this strategy will require substantial effort beyond the introduction to the problem pursued in the current paper. Let us merely add that the fast implementation of a more general Hausdorff distance algorithm will depend on the nature of the candidate sets and . In the plane, triangles are appealing [41,42]. It is straightforward to project onto a triangle, and a triangle by definition possesses exactly three extreme points. Furthermore, a great deal of research under the heading of finite elements has identified good algorithms for triangulating complicated regions of the plane. The software Triangle for generating two-dimensional meshes and Delaunay triangulations is surely pertinent [43]. The triangularization of surfaces forms part of the MESH software for Hausdorff distance estimation [44].
We hope this paper will provoke a greater focus on the Hausdorff distance problem. As a prototype non-convex problem, it is worthy of far more attention. Continuous optimization tools can be brought to bear on the problem and may ultimately generate more efficient algorithms than the discrete algorithms designed for finite point clouds. The fact that our algorithms scale well in higher dimensions is a plus. We would also like to highlight the illumination that the MM principle brings to the construction of new high-dimensional optimization algorithms, including those considered here. Although neglected in the past, MM may well be the single most unifying principle of algorithm construction in continuous optimization.
Funding
Research supported in part by USPHS grants GM53275 and HG006139.
Data Availability Statement
Not applicable.
Conflicts of Interest
The author declares no conflict of interest.
Appendix A
Appendix A.1. Proofs
Proposition A1.
If A and B are balls with radii and and centers and , respectively, then for , and , unless , in which case the maximum is 0.
Proof.
The first assertion is obvious. To maximize over A, we form the Lagrangian
The stationary condition
implies that
and determines through
It follows that
and that
Geometrically, should hold, so gives the correct sign. □
Proposition A2.
If A is the probability simplex in and B is the ball U translated by , then .
Proof.
Consider first . The maximum of occurs at an extreme point of A, say by symmetry. On U the convex function
achieves its minimum value when all are equal for . The common value z should satisfy , while can have either sign. For , we accordingly minimize subject to . We can decrease z until and solve for . Thus, we must minimize over . Now the stationary point of falls outside , so the minimum occurs at either 0 or 1. Because and , the point 0 wins, and .
Next, consider . The maximum of occurs at an extreme point of B, say by symmetry. On A the convex function
is maximized by taking . We make this choice and again assume for . Now , and we increase z until . This gives and reduces to the quadratic
Now the stationary point of falls outside , so the minimum occurs at either 0 or 1. Thus, and , and the point 1 wins. Finally, . □
Appendix A.2. Julia Computer Code
using LinearAlgebra, Distances, Random, StatsBase
"""Generates a random point in the box [a,b]."""
function RandomBox(a, b)
n = length(a)
return a + rand(n) .* (b - a)
end
"""Generates a random point in a Euclidean ball."""
function RandomBall(radius, center)
n = length(center)
x = randn(n)
x = x / norm(x)
r = rand()^(1 / n)
return (radius * r) * x + center
end
"""Generates a random point in the intersection of a ball centered
at the origin and the nonnegative orthant."""
function RandomBallOrthant(radius, n)
x = RandomBall(radius, zeros(n))
return abs.(x)
end
"""Generates a random point in the probability simplex."""
function RandomSimplex(n)
x = -log.(rand(n))
return x / sum(x)
end
"""Generates a random point in an L1 ball."""
function RandomL1Ball(radius, center)
n = length(center)
x = -log.(rand(n))
x = x / sum(x)
for i = 1:n
if rand() < 1 / 2
x[i] = - x[i]
end
end
r = rand()^(1 / n)
return (radius * r) * x + center
end
"""Computes the Hausdorff distance between the point sets A and B."""
function hausdorff(A, B)
D = pairwise(Euclidean(), A, B)
dAB = maximum(minimum(D, dims = 2))
dBA = maximum(minimum(D, dims = 1))
return max(dAB, dBA)
end
"""Projects the point y onto a re-centered set."""
function RecenterProjection(Proj, y::Vector{T}, c::Vector{T}) where T <: Real
return Proj(y - c) + c # set is translated by c
end
"""Projects the point y onto a scaled set."""
function ScaleProjection(Proj, y::Vector{T}, s::T) where T <: Real
return s * Proj(y / s) # s > 0 is the scaling factor
end
"""Projects the point y onto the closed ball with radius r."""
function BallProjection(y::Vector{T}, r = one(T)) where T <: Real
#
distance = norm(y)
if distance > r
return (r / distance) * y
else
return y
end
end
"""Projects the point y onto the closed box with bounds a and b."""
function BoxProjection(y::Vector{T}, a = -ones(T, length(y)),
b = ones(T, length(y))) where T <: Real
#
return clamp.(y, a, b)
end
"""Projects the point y onto the simplex {x | x >= 0, sum(x) = r}."""
function SimplexProjection(y::Vector{T}, r = one(T)) where T <: Real
#
n = length(y)
z = sort(y, rev = true)
(s, lambda) = (zero(T), zero(T))
for i = 1:n
s = s + z[i]
lambda = (s - r) / i
if i < n && lambda < z[i] && lambda >= z[i + 1]
break
end
end
return max.(y .- lambda, zero(T))
end
"""Projects the point y onto the ell_1 ball with radius r."""
function L1BallProjection(y::Vector{T}, r = one(T)) where T <: Real
#
p = abs.(y)
if norm(p, 1) <= r
return y
else
x = SimplexProjection(p, r)
return sign.(y) .* x
end
end
"""Projects the point y onto the intersection of the ball of
radius r and the nonnegative orthant."""
function BallAndOrthantProjection(y::Vector{T}, r = one(T)) where T <: Real
#
x = copy(y)
x = max.(x, zero(T)) # project onto orthant
return (r / max(norm(x), r)) .* x
end
"""Finds the support point for y on the inflated unit ball."""
function BallSupp(y::Vector{T}, r = one(T)) where T <: Real
#
return (r / norm(y)) * y
end
"""Finds the support point for y on the box [a, b]."""
function BoxSupp(y::Vector{T}, a = -ones(T, length(y)),
b = ones(T, length(y))) where T <: Real
#
n = length(y)
x = zeros(T, n)
for i = 1:n
if y[i] > zero(T)
x[i] = b[i]
elseif y[i] < zero(T)
x[i] = a[i]
else
x[i] = (a[i] + b[i]) / 2
end
end
return x
end
"""Finds the support point for y on the simplex {x | x >= 0, sum(x) = r}."""
function SimplexSupp(y::Vector{T}, r = one(T)) where T <: Real
#
x = zeros(T, length(y))
(v, m) = findmax(y)
x[m] = r
return x
end
"""Finds the support point for y on the L1 ball."""
function L1BallSupp(y::Vector{T}, r = one(T)) where T <: Real
#
x = zeros(T, length(y))
(v, m) = findmax(abs, y)
x[m] = sign(y[m]) * r
return x
end
"""Finds the support point for y on the intersection of the ball of
radius r and the nonnegative orthant."""
function BallAndOrthantSupp(y::Vector{T}, r = one(T)) where T <: Real
#
x = max.(y, zero(T))
if sum(x) <= zero(T)
return zeros(T, length(y))
else
return (r / norm(x)) * x
end
end
"""Projects the point y onto the Minkowski rounded set
R = c * S + (1 - c) * B. Here B is the unit ball, Proj
is projection onto S, and Proj_R(y) = a + b."""
function MinkowskiNear(Proj, y, c, conv)
#
n = length(y)
(aold, bold) = (zeros(n), zeros(n))
(anew, bnew) = (zeros(n), zeros(n))
for iter = 1:100
anew = c .* Proj((y - bold) ./ c) # project onto c * S
bnew = (1 - c) .* BallProjection((y - anew) ./ (1 - c))
if norm(aold - anew) + norm(bold - bnew) < conv
break
else
@. aold = anew
@. bold = bnew
end
end
return anew + bnew
end
"""Finds the farthest point on A from B by Frank-Wolfe."""
function FrankWolfe(SuppA, PB, x0)
(xold, xnew) = (copy(x0), similar(x0))
for iter = 1:100
xnew = SuppA(xold - PB(xold))
if norm(xnew - xold) < 1.0e-10
break
else
xold .= xnew
end
end
far = norm(xnew - PB(xnew))
return (far, xnew)
end
"""Finds the farthest point on A from B by projected gradient ascent."""
function farthest(PA, PB, x0)
(xold, xnew) = (copy(x0),copy(x0))
for iter = 1:100
xnew = PA(2xold - PB(xold))
if norm(xnew - xold) < 1.0e-10
break
else
xold .= xnew
end
end
far = norm(xnew - PB(xnew))
return (far, xnew)
end
"""Finds the farthest point on A from B by homotopy."""
function farthest_homotopy(PA, PB, SA, CenterA, CenterB, x0, n, method)
x = BallProjection(x0)
(far, homotopy_points, conv) = (0.0, 10, 1.0e-10)
for iter = 0:homotopy_points
if iter == 0 # ball to ball
d = norm(CenterA - CenterB)
(far, x) = (d, (1 + 1 / d) * CenterA - CenterB / d)
elseif iter == homotopy_points # d(A, B)
if method == "proj grad"
(far, x) = farthest(PA, PB, x)
elseif method == "Frank-Wolfe"
(far, x) = FrankWolfe(SA, PB, x)
end
else # intermediate case
t = iter / homotopy_points
PMB(z) = MinkowskiNear(PB, z, t, conv)
if method == "proj grad"
PMA(z) = MinkowskiNear(PA, z, t, conv)
(far, x) = farthest(PMA, PMB, x)
elseif method == "Frank-Wolfe"
SM(z) = SA(t * z) + BallSupp((1 - t) * z)
(far, x) = FrankWolfe(SM, PMB, x)
end
end
end
return (far, x)
end
"""Orchestrates Hausdorff distance estimation."""
function master(ProjA, ProjB, SuppA, SuppB, CenterA, CenterB, method,
homotopy, n, trials, io)
#
(count, tries, optimum, obj) = (0, 100, 0.0, zeros(trials))
x0 = zeros(n)
PA(z) = RecenterProjection(ProjA, z, CenterA)
PB(z) = RecenterProjection(ProjB, z, CenterB)
for trial = 1:trials
success = false
for i = 1:tries # find a point in A \ B
x0 = PA(randn(n))
if norm(PB(x0) - x0) > 1.0e-10
success = true
break
end
end
if homotopy # solve for d(A, B)
(objA, xA) = farthest_homotopy(PA, PB, SuppA, CenterA, CenterB,
x0, n, method)
else
if method == "proj grad" && success # solve for d(A, B)
(objA, xA) = farthest(PA, PB, x0)
elseif method == "Frank-Wolfe" && success
(objA, xA) = FrankWolfe(SuppA, PB, x0)
else
objA = 0.0
end
end
success = false
for i = 1:tries # find point in B \ A
x0 = PB(randn(n))
if norm(PA(x0) - x0) > 1.0e-10
success = true
break
end
end
if homotopy # solve for d(B, A)
(objB, xB) = farthest_homotopy(PB, PA, SuppB, CenterB, CenterA,
x0, n, method)
else
if method == "proj grad" && success
(objB, xB,) = farthest(PB, PA, x0)
elseif method == "Frank-Wolfe" && success
(objB, xB) = FrankWolfe(SuppB, PA, x0)
else
objB = 0.0
end
end
obj[trial] = max(objA, objB) # Hausdorff distance
if obj[trial] > optimum + 10.0e-10 # update count of maximum distance
count = 1
optimum = obj[trial]
elseif obj[trial] > optimum - 10.0e-8
count = count + 1
end
end
(avg, stdev) = (mean(obj), std(obj))
if stdev < 1.0e-10 stdev = 0.0 end
return (fraction = count / trials, optimum, avg, stdev)
end
outfile = "Hausdorff.out";
io = open(outfile, "w");
trials = 100;
points = 10000
println(io,"Set Pair"," & ","p"," & ","Method"," & ","Homotopy"," & ",
"Maximum"," & ","Mean"," & ","Std"," & ","Seconds"," \\ ")
for n in [2, 3, 10, 100, 1000]
for i = 1:2
if i == 1
CenterA = ones(n)
CenterB = zeros(n)
ProjA = BoxProjection
ProjB = BallAndOrthantProjection
SuppA = BoxSupp
SuppB = BallAndOrthantSupp
title = "dH(box, ball and orthant)"
elseif i == 2
CenterA = zeros(n)
CenterB = ones(n)
ProjA = SimplexProjection
ProjB = L1BallProjection
SuppA = SimplexSupp
SuppB = L1BallSupp
title = "dH(simplex, L1 ball)"
end
#
(method, homotopy) = ("proj grad", false);
Random.seed!(1234)
time = @elapsed (fraction, optimum, avg, stdev) = master(ProjA,
ProjB, SuppA, SuppB, CenterA, CenterB, method, homotopy, n,
trials, io)
println(io,title," & ",n," & ",method," & ",homotopy," & ",
round(optimum, sigdigits=5)," & ",round(avg, sigdigits=5)," & ",
round(stdev, sigdigits=5)," & ",round(time/trials, sigdigits=3)," \\ ")
#
(method, homotopy) = ("proj grad", true);
Random.seed!(1234)
time = @elapsed (fraction, optimum, avg, stdev) = master(ProjA,
ProjB, SuppA, SuppB, CenterA, CenterB, method, homotopy, n,
trials, io)
println(io,title," & ",n," & ",method," & ",homotopy," & ",
round(optimum, sigdigits=5)," & ",round(avg, sigdigits=5)," & ",
round(stdev, sigdigits=5)," & ",round(time/trials,sigdigits=3)," \\ ")
#
(method, homotopy) = ("Frank-Wolfe", false);
Random.seed!(1234)
time = @elapsed (fraction, optimum, avg, stdev) = master(ProjA,
ProjB, SuppA, SuppB, CenterA, CenterB, method, homotopy, n,
trials, io)
println(io,title," & ",n," & ",method," & ",homotopy," & ",
round(optimum, sigdigits=5)," & ",round(avg, sigdigits=5)," & ",
round(stdev, sigdigits=5)," & ",round(time/trials,sigdigits=3)," \\ ")
#
(method, homotopy) = ("Frank-Wolfe", true);
Random.seed!(1234)
time = @elapsed (fraction, optimum, avg, stdev) = master(ProjA,
ProjB, SuppA, SuppB, CenterA, CenterB, method, homotopy, n,
trials, io)
println(io,title," & ",n," & ",method," & ",homotopy," & ",
round(optimum, sigdigits=5)," & ",round(avg, sigdigits=5)," & ",
round(stdev, sigdigits=5)," & ",round(time/trials,sigdigits=3)," \\ ")
#
(method, homotopy) = ("point cloud", false);
Random.seed!(1234)
points = 10000
A = zeros(n, points)
B = zeros(n, points)
if i == 1
(a, b) = (ones(n), 2 * ones(n))
for j = 1:points
A[:, j] = RandomBox(a, b)
B[:, j] = RandomBallOrthant(1.0, n)
end
else
for j = 1:points
A[:, j] = RandomSimplex(n)
B[:, j] = RandomL1Ball(1.0, ones(n))
end
end
time = @elapsed optimum = hausdorff(A, B)
println(io,title," & ",n," & ",method," & ",homotopy," & ",
round(optimum, sigdigits=5)," & ",round(optimum, sigdigits=5)," & ",
round(0.0, sigdigits=5)," & ",round(time, sigdigits=3)," \\ ")
end
end
close(io)
References
- Aubin, J.-P. Applied Abstract Analysis; Wiley: New York, NY, USA, 1977. [Google Scholar]
- Munkres, J. Topology, 2nd ed.; Prentice Hall: Upper Saddle River, NJ, USA, 1999. [Google Scholar]
- Conci, A.; Kubrusly, C.S. Distance between sets: A survey. Adv. Math. Sci. Appl. 2017, 26, 1–18. [Google Scholar]
- Ortigosa, R.; Martínez-Frutos, J.; Mora-Corral, C.; Pedregal, P.; Periago, F. Optimal control of soft materials using a Hausdorff distance functional. SIAM J. Control. Optim. 2021, 59, 393–416. [Google Scholar] [CrossRef]
- Sendov, B. Some questions of the theory of approximations of functions and sets in the Hausdorff metric. Russ. Math. Surv. 1969, 24, 143–183. [Google Scholar] [CrossRef]
- Cornean, H.D.; Purice, R. On the regularity of the Hausdorff distance between spectra of perturbed magnetic Hamiltonians. In Spectral Analysis of Quantum Hamiltonians: Spectral Days 2010; Springer: Berlin/Heidelberg, Germany, 2012; pp. 55–66. [Google Scholar]
- Kumar, K.S.; Manigandan, T.; Chitra, D.; Murali, L. Object recognition using Hausdorff distance for multimedia applications. Multimed. Tools Appl. 2020, 79, 4099–4114. [Google Scholar] [CrossRef]
- Huttenlocher, D.P.; Klanderman, G.A.; Rucklidge, W.J. Comparing images using the Hausdorff distance. IEEE Trans. Pattern Anal. Mach. Intell. 1993, 15, 850–863. [Google Scholar] [CrossRef]
- Lertchuwongsa, N.; Gouiffes, M.; Zavidovique, B. Enhancing a disparity map by color segmentation. Integr.-Comput.-Aided Eng. 2012, 19, 381–397. [Google Scholar] [CrossRef]
- Barnsley, M.F.; Massopust, P.; Strickl, H.; Sloan, A.D. Fractal modeling of biological structures. Ann. N. Y. Acad. Sci. 1987, 504, 179–194. [Google Scholar] [CrossRef]
- Aulbach, B.; Rasmussen, M.; Siegmund, S. Approximation of attractors of nonautonomous dynamical systems. Discret. Contin. Dyn. Syst. Ser. B 2005, 5, 215–238. [Google Scholar]
- Dubuisson, M.-P.; Jain, A.K. A modified Hausdorff distance for object matching. In Proceedings of the 12th International Conference on Pattern Recognition, Jerusalem, Israel, 9–13 October 1994; Volume 1, pp. 566–568. [Google Scholar]
- Kim, I.-S.; McLean, W. Computing the Hausdorff distance between two sets of parametric curves. Commun. Korean Math. Soc. 2013, 28, 833–850. [Google Scholar] [CrossRef]
- Rote, G. Computing the minimum Hausdorff distance between two point sets on a line under translation. Inf. Process. Lett. 1991, 38, 123–127. [Google Scholar] [CrossRef]
- Taha, A.A.; Hanbury, A. An efficient algorithm for calculating the exact Hausdorff distance. IEEE Trans. Pattern Anal. Mach. Intell. 2015, 37, 2153–2163. [Google Scholar] [CrossRef]
- Zhang, D.; He, F.; Han, S.; Zou, L.; Wu, Y.; Chen, Y. An efficient approach to directly compute the exact Hausdorff distance for 3D point sets. Integr. Comput.-Aided Eng. 2017, 24, 261–277. [Google Scholar] [CrossRef]
- Atallah, M.J. A linear time algorithm for the Hausdorff distance between convex polygons. Inf. Process. Lett. 1983, 17, 207–209. [Google Scholar] [CrossRef]
- Belogay, E.; Cabrelli, C.; Molter, U.; Shonkwiler, R. Calculating the Hausdorff distance between curves. Inf. Process. Lett. 1997, 64, 17–22. [Google Scholar] [CrossRef]
- Elber, G.; Grandine, T. Hausdorff and minimal distances between parametric freeforms in R2 and R3. In Proceedings of the International Conference on Geometric Modeling and Processing, Hangzhou, China, 23–25 April 2008; pp. 191–204. [Google Scholar]
- Bauschke, H.H.; Combettes, P.L. Convex Analysis and Monotone Operator Theory in Hilbert Spaces; Springer: Berlin/Heidelberg, Germany, 2017. [Google Scholar]
- Beck, A. First-Order Methods in Optimization; SIAM: Philadelphia, PA, USA, 2017. [Google Scholar]
- Keys, K.L.; Zhou, H.; Lange, K. Proximal distance algorithms: Theory and practice. J. Mach. Learn. Res. 2019, 20, 2384–2421. [Google Scholar]
- Lange, K. MM Optimization Algorithms; SIAM: Philadelphia, PA, USA, 2016. [Google Scholar]
- Bauer, H. Minimalstellen von funktionen und extremalpunkte. Arch. Math. 1958, 9, 389–393. [Google Scholar] [CrossRef]
- Clarke, F. Functional Analysis, Calculus of Variations and Optimal Control; Springer: New York, NY, USA, 2013. [Google Scholar]
- Frank, M.; Wolfe, P. An algorithm for quadratic programming. Nav. Res. Logist. Q. 1956, 3, 95–110. [Google Scholar] [CrossRef]
- Jaggi, M. Revisiting Frank-Wolfe: Projection-free sparse convex optimization. In Proceedings of the International Conference on Machine Learning, PMLR, Atlanta, Georgia, 17–19 June 2013; pp. 427–435. [Google Scholar]
- Parikh, N.; Boyd, S. Proximal algorithms. Found. Trends Optim. 2014, 1, 127–239. [Google Scholar] [CrossRef]
- Zhou, H.; Lange, K. On the bumpy road to the dominant mode. Scand. J. Stat. 2009, 37, 612–631. [Google Scholar] [CrossRef]
- Hunter, D.R.; Lange, K. A tutorial on MM algorithms. Am. Stat. 2004, 58, 30–37. [Google Scholar] [CrossRef]
- McLachlan, G.J.; Krishnan, T. The EM Algorithm and Extensions, 2nd ed.; Wiley: Hoboken, NJ, USA, 2008. [Google Scholar]
- Marošević, T. The Hausdorff distance between some sets of points. Math. Commun. 2018, 23, 247–257. [Google Scholar]
- Won, J.-H.; Zu, J.; Lange, K. Projection onto Minkowski sums with application to constrained learning. In Proceedings of the 36th International Conference on Machine Learning 2019, Long Beach, CA, USA, 9–15 June 2019; pp. 3642–3651. [Google Scholar]
- Garber, D.; Hazan, E. Faster rates for the Frank-Wolfe method over strongly-convex sets. In Proceedings of the International Conference on Machine Learning, PMLR, Lille, France, 7–9 July 2015; pp. 541–549. [Google Scholar]
- Majeed, S.N. On strongly E-convex sets and strongly E-convex cone sets. J. AL-Qadisiyah Comput. Sci. Math. 2019, 11, 52–59. [Google Scholar]
- Beck, A. Introduction to Nonlinear Optimization: Theory, Algorithms, and Applications with MATLAB; SIAM: Philadelphia, PA, USA, 2014. [Google Scholar]
- Bertsekas, D.P. Nonlinear Programming, 2nd ed.; Athena Scientific: Belmont, MA, USA, 1999. [Google Scholar]
- Lacoste-Julien, S. Convergence rate of Frank-Wolfe for non-convex objectives. arXiv 2016, arXiv:1607.00345. [Google Scholar]
- Lange, K. Closest Farthest Widest. 2023; unpublished. [Google Scholar]
- Lange, K.; Won, J.-H.; Landeros, A.; Zhou, H. Nonconvex optimization via MM algorithms: Convergence theory. In Wiley StatsRef: Statistics Reference Online; Wiley Online Library: Hoboken, NJ, USA, 2020; pp. 1–22. [Google Scholar]
- Bartoň, M.; Hanniel, I.; Elber, G.; Kim, M.-S. Precise Hausdorff distance computation between polygonal meshes. Comput. Aided Geom. Des. 2010, 27, 580–591. [Google Scholar] [CrossRef]
- Guthe, M.; Borodin, P.; Klein, R. Fast and accurate Hausdorff distance calculation between meshes. J. WSCG 2005, 13, 41–48. [Google Scholar]
- Shewchuk, J.R. Triangle: Engineering a 2D quality mesh generator and Delaunay triangulator. In Applied Computational Geometry towards Geometric Engineering; Lin, M.C., Manocha, D., Eds.; Springer: Berlin/Heidelberg, Germany, 1996; pp. 203–222. [Google Scholar]
- Aspert, N.; Santa-Cruz, D.; Ebrahimi, T. Mesh: Measuring errors between surfaces using the Hausdorff distance. In Proceedings of the IEEE International Conference on Multimedia and Expo, Lausanne, Switzerland, 26–29 August 2002; Volume 1, pp. 705–708. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).