Package org.ddolib.examples.mks
Class MKSRelax
java.lang.Object
org.ddolib.examples.mks.MKSRelax
- All Implemented Interfaces:
Relaxation<MKSState>
Relaxation strategy for the multi-dimensional Knapsack problem (MKS) states.
This class implements the Relaxation interface and provides a way to
merge multiple MKS states into a single relaxed state for use in decision diagrams.
The relaxation ensures that the merged state overestimates the remaining capacities,
which is safe for optimization purposes.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
MKSRelax
public MKSRelax()
-
-
Method Details
-
mergeStates
Merges multiple MKS states into a single relaxed state.The merged state takes the maximum capacity along each dimension across all input states. This produces a relaxed state that safely overestimates the remaining capacities.
- Specified by:
mergeStatesin interfaceRelaxation<MKSState>- Parameters:
states- an iterator over the states to merge- Returns:
- a new
MKSStaterepresenting the relaxed merged state
-
relaxEdge
Returns the cost of an edge in the relaxed decision diagram.For this relaxation, the edge cost is unchanged and simply returns the original cost.
- Specified by:
relaxEdgein interfaceRelaxation<MKSState>- Parameters:
from- the source stateto- the destination statemerged- the merged state corresponding to the relaxationd- the decision taken along this edgecost- the original cost of the edge- Returns:
- the relaxed edge cost, equal to
cost
-