Class MaxCoverDistance
java.lang.Object
org.ddolib.examples.maximumcoverage.MaxCoverDistance
- All Implemented Interfaces:
StateDistance<MaxCoverState>
Distance function for
MaxCoverState used to measure similarity
between states in the context of the Maximum Coverage problem.
This class implements StateDistance and provides several distance
computations:
- a distance between two states based on the covered item sets
- a distance between two search nodes combining state similarity and cost difference
- a distance between a state and the root, used for diversification purposes
Distances are normalized with respect to the number of items in the problem instance and may rely on weighted or unweighted set-based metrics.
-
Constructor Summary
ConstructorsConstructorDescriptionMaxCoverDistance(MaxCoverProblem instance) Constructs a distance measure associated with a given MaxCover problem instance. -
Method Summary
Modifier and TypeMethodDescriptiondoubleComputes the distance between two search nodes.doubleComputes the distance between two MaxCover states.doubledistanceWithRoot(MaxCoverState state) Computes the distance between a state and the root of the search tree.
-
Constructor Details
-
MaxCoverDistance
Constructs a distance measure associated with a given MaxCover problem instance.- Parameters:
instance- the MaxCover problem instance providing problem-specific parameters
-
-
Method Details
-
distanceWithRoot
Computes the distance between a state and the root of the search tree.This distance is proportional to the fraction of items covered by the state.
- Specified by:
distanceWithRootin interfaceStateDistance<MaxCoverState>- Parameters:
state- the state for which the distance to the root is computed- Returns:
- a normalized distance to the root
-
distance
Computes the distance between two search nodes.The distance is a convex combination of:
- a weighted Jaccard distance between the covered item sets
- a normalized difference between the node objective values
- Specified by:
distancein interfaceStateDistance<MaxCoverState>- Parameters:
a- first nodeb- second node- Returns:
- the combined distance between the two nodes
-
distance
Computes the distance between two MaxCover states.The distance is based on the size of the symmetric difference between the sets of covered items, normalized by the total number of items.
- Specified by:
distancein interfaceStateDistance<MaxCoverState>- Parameters:
a- first stateb- second state- Returns:
- a normalized symmetric difference distance
-