class BoundablePair
extends java.lang.Object
implements java.lang.Comparable
Boundable
s, 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.Modifier and Type | Field and Description |
---|---|
private Boundable |
boundable1 |
private Boundable |
boundable2 |
private double |
distance |
private ItemDistance |
itemDistance |
Constructor and Description |
---|
BoundablePair(Boundable boundable1,
Boundable boundable2,
ItemDistance itemDistance) |
Modifier and Type | Method and Description |
---|---|
private static double |
area(Boundable b) |
int |
compareTo(java.lang.Object o)
Compares two pairs based on their minimum distances
|
private double |
distance()
Computes the distance between the
Boundable s in this pair. |
private void |
expand(Boundable bndComposite,
Boundable bndOther,
PriorityQueue priQ,
double minDistance) |
void |
expandToQueue(PriorityQueue priQ,
double minDistance)
For a pair which is not a leaf
(i.e.
|
Boundable |
getBoundable(int i)
Gets one of the member
Boundable s in the pair
(indexed by [0, 1]). |
double |
getDistance()
Gets the minimum possible distance between the Boundables in
this pair.
|
static boolean |
isComposite(java.lang.Object item) |
boolean |
isLeaves()
Tests if both elements of the pair are leaf nodes
|
private Boundable boundable1
private Boundable boundable2
private double distance
private ItemDistance itemDistance
public BoundablePair(Boundable boundable1, Boundable boundable2, ItemDistance itemDistance)
public Boundable getBoundable(int i)
Boundable
s in the pair
(indexed by [0, 1]).i
- the index of the member to return (0 or 1)private double distance()
Boundable
s in this pair.
The boundables are either composites or leaves.
If either is composite, the distance is computed as the minimum distance
between the bounds.
If both are leaves, the distance is computed by #itemDistance(ItemBoundable, ItemBoundable)
.public double getDistance()
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public boolean isLeaves()
public static boolean isComposite(java.lang.Object item)
private static double area(Boundable b)
public void expandToQueue(PriorityQueue priQ, double minDistance)
private void expand(Boundable bndComposite, Boundable bndOther, PriorityQueue priQ, double minDistance)