Package org.ddolib.examples.mcp
Class MCPRelax
java.lang.Object
org.ddolib.examples.mcp.MCPRelax
- All Implemented Interfaces:
Relaxation<MCPState>
Implements a relaxation strategy for the Maximum Cut Problem (MCP).
This relaxation is used in dynamic programming or branch-and-bound algorithms to merge multiple states into a single optimistic state while preserving bounds.
The merging strategy works as follows:
- If all net benefits for a variable are positive, the merged state keeps the smallest value.
- If all net benefits for a variable are negative, the merged state keeps the largest value.
- If net benefits have mixed signs, the merged value is set to 0.
The relaxEdge(MCPState, MCPState, MCPState, Decision, double) method adjusts
the transition cost to ensure the relaxation remains an over-approximation of the
true cost.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMCPRelax(MCPProblem problem) Constructs a relaxation for the given MCP problem. -
Method Summary
Modifier and TypeMethodDescriptionmergeStates(Iterator<MCPState> states) Merges multiple MCP states into a single optimistic state.doubleComputes the relaxed transition cost from one state to another given a merged state.
-
Constructor Details
-
MCPRelax
Constructs a relaxation for the given MCP problem.- Parameters:
problem- the MCP problem instance
-
-
Method Details
-
mergeStates
Merges multiple MCP states into a single optimistic state.The merged state keeps a conservative estimate of net benefits for remaining decision variables in order to maintain an over-approximation of the optimal solution.
- Specified by:
mergeStatesin interfaceRelaxation<MCPState>- Parameters:
states- an iterator over states to merge- Returns:
- a new
MCPStaterepresenting the merged state
-
relaxEdge
Computes the relaxed transition cost from one state to another given a merged state.This method adjusts the cost to account for the differences between the actual net benefits in the target state and the merged state, ensuring that the relaxation remains optimistic.
- Specified by:
relaxEdgein interfaceRelaxation<MCPState>- Parameters:
from- the initial stateto- the target statemerged- the merged state used for relaxationd- the decision applied to reach the target statecost- the original transition cost- Returns:
- the relaxed transition cost
-