Class DefaultVariableHeuristic<T>
java.lang.Object
org.ddolib.ddo.core.heuristics.variable.DefaultVariableHeuristic<T>
- Type Parameters:
T- the type representing the problem state
- All Implemented Interfaces:
VariableHeuristic<T>
A default implementation of
VariableHeuristic that selects
the next variable to branch on without applying any specific strategy.
This heuristic simply returns the first element obtained from the iterator
of the provided variables set. Therefore, it does not guarantee
any particular or deterministic order, as the iteration order of a
Set depends on its concrete implementation
(e.g., HashSet is not ordered).
This class serves as a minimal or placeholder heuristic to ensure that the compilation or search process can proceed when no specific variable ordering rule has been defined by the user.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DefaultVariableHeuristic
public DefaultVariableHeuristic()
-
-
Method Details
-
nextVariable
Returns the next variable to branch on by selecting the first element from the set of remaining variables.This implementation applies no logic based on the current layer states and provides no guarantees on reproducibility unless a deterministic
Setimplementation (e.g.,LinkedHashSet) is used.- Specified by:
nextVariablein interfaceVariableHeuristic<T>- Parameters:
variables- the set of variables that have not yet been assignedstates- an iterator over the states in the current layer (unused)- Returns:
- the next variable to branch on, as given by
variables.iterator().next() - Throws:
NoSuchElementException- if thevariablesset is empty
-