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>

public class RandomBased<T> extends Object implements 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 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

      public List<NodeSubProblem<T>>[] defineClusters(List<NodeSubProblem<T>> layer, int maxWidth)
      Defines clusters by randomly selecting up to maxWidth nodes from the layer. Each selected node forms a separate cluster.

      The nodes selected for clustering are removed from the input layer.

      Specified by:
      defineClusters in interface ReductionStrategy<T>
      Parameters:
      layer - the list of nodes at the current layer
      maxWidth - 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