Class BoundablePair

Hierarchy: Object , BoundablePair
All Implemented Interfaces: Comparable
class BoundablePair
implements Comparable
A pair of Boundables, whose leaf items support a distance metric between them. Used to compute the distance between the members, and to expand a member relative to the other in order to produce new branches of the Branch-and-Bound evaluation tree. Provides an ordering based on the distance between the members, which allows building a priority queue by minimum distance.
Authors:
Martin Davis
public BoundablePair(Boundable boundable1, Boundable boundable2, ItemDistance itemDistance)
public Boundable getBoundable(int i)
Gets one of the member Boundables in the pair (indexed by [0, 1]).
Parameters:
i - i the index of the member to return (0 or 1)
Returns:
the chosen member
public double maximumDistance()
Computes the maximum distance between any two items in the pair of nodes.
Returns:
the maximum distance between items in the pair
public double getDistance()
Gets the minimum possible distance between the Boundables in this pair. If the members are both items, this will be the exact distance between them. Otherwise, this distance will be a lower bound on the distances between the items in the members.
Returns:
the exact or lower bound distance for this pair
public int compareTo(Object o)
Compares two pairs based on their minimum distances
public boolean isLeaves()
Tests if both elements of the pair are leaf nodes
Returns:
true if both pair elements are leaf nodes
public static boolean isComposite(Object item)
public void expandToQueue(PriorityQueue priQ, double minDistance)
For a pair which is not a leaf (i.e. has at least one composite boundable) computes a list of new pairs from the expansion of the larger boundable with distance less than minDistance and adds them to a priority queue.

Note that expanded pairs may contain the same item/node on both sides. This must be allowed to support distance functions which have non-zero distances between the item and itself (non-zero reflexive distance).

Parameters:
priQ - priQ the priority queue to add the new pairs to
minDistance - minDistance the limit on the distance between added pairs