Class RandomBased<T>
java.lang.Object
org.ddolib.ddo.core.heuristics.cluster.RandomBased<T>
- Type Parameters:
T- the type of states in the decision diagram
- All Implemented Interfaces:
ReductionStrategy<T>
A simple random-based reduction strategy for decision diagram layers.
This class implements ReductionStrategy and generates clusters
by randomly selecting nodes from a layer. Each selected node forms its own cluster.
The strategy is controlled by a Random object, which can be seeded
to ensure reproducible behavior.
-
Constructor Summary
ConstructorsConstructorDescriptionRandomBased(long seed) Constructs a random-based reduction strategy with a given seed. -
Method Summary
Modifier and TypeMethodDescriptionList<NodeSubProblem<T>>[]defineClusters(List<NodeSubProblem<T>> layer, int maxWidth) Defines clusters by randomly selecting up tomaxWidthnodes from the layer.voidsetSeed(long seed) Resets the seed of the random number generator.
-
Constructor Details
-
RandomBased
public RandomBased(long seed) Constructs a random-based reduction strategy with a given seed.- Parameters:
seed- the seed for the random number generator
-
-
Method Details
-
defineClusters
Defines clusters by randomly selecting up tomaxWidthnodes from the layer. Each selected node forms a separate cluster.The nodes selected for clustering are removed from the input
layer.- Specified by:
defineClustersin interfaceReductionStrategy<T>- Parameters:
layer- the list of nodes at the current layermaxWidth- the maximum number of clusters (and nodes kept)- Returns:
- an array of clusters, each cluster being a list containing a single node
-
setSeed
public void setSeed(long seed) Resets the seed of the random number generator.- Parameters:
seed- the new seed value
-