Package org.ddolib.examples.knapsack
Class KSDominance
java.lang.Object
org.ddolib.examples.knapsack.KSDominance
Dominance relation for the Knapsack Problem (KS).
This dominance checker is used to prune the search space in a decision diagram or other solver by identifying states that are dominated and can therefore be discarded.
In this implementation:
getKey(Integer)always returns 0, indicating a single dominance key for all states.isDominatedOrEqual(Integer, Integer)considers a statecapa1dominated bycapa2ifcapa1 <= capa2, i.e., a knapsack state with less or equal remaining capacity is dominated by one with more remaining capacity.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
KSDominance
public KSDominance()
-
-
Method Details
-
getKey
Returns the key used for grouping states in the dominance checker. -
isDominatedOrEqual
Checks whether one state is dominated by another.- Specified by:
isDominatedOrEqualin interfaceDominance<Integer>- Parameters:
capa1- the first state (remaining capacity)capa2- the second state (remaining capacity)- Returns:
trueifcapa1 <= capa2, otherwisefalse
-