Package org.ddolib.examples.mks
Class MKSDistance
java.lang.Object
org.ddolib.examples.mks.MKSDistance
- All Implemented Interfaces:
StateDistance<MKSState>
Computes a normalized distance between Multi-dimensional Knapsack (MKS) states.
This class implements StateDistance for MKSState objects. The distance
is based on the Euclidean distance between the remaining capacities of two states,
normalized by the maximal distance of the knapsack capacities.
This distance can be used in clustering or merging strategies in decision diagram optimization algorithms to guide state aggregation.
-
Constructor Summary
ConstructorsConstructorDescriptionMKSDistance(MKSProblem instance) Constructs a distance evaluator for the given MKS problem. -
Method Summary
Modifier and TypeMethodDescriptiondoubleComputes the normalized Euclidean distance between two MKS states.doubleComputes the normalized Euclidean distance from the given state to the initial state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ddolib.ddo.core.heuristics.cluster.StateDistance
distance
-
Constructor Details
-
MKSDistance
Constructs a distance evaluator for the given MKS problem.- Parameters:
instance- the multi-dimensional knapsack problem instance
-
-
Method Details
-
distance
Computes the normalized Euclidean distance between two MKS states.- Specified by:
distancein interfaceStateDistance<MKSState>- Parameters:
a- the first stateb- the second state- Returns:
- the normalized distance between
aandb
-
distanceWithRoot
Computes the normalized Euclidean distance from the given state to the initial state.- Specified by:
distanceWithRootin interfaceStateDistance<MKSState>- Parameters:
a- the state- Returns:
- the normalized distance from
ato the initial state
-