org.eclipse.viatra.dse.api.strategy.impl

## Class BreadthFirstStrategy

- java.lang.Object
- - org.eclipse.viatra.dse.api.strategy.impl.BreadthFirstStrategy

- All Implemented Interfaces:
    IStrategy

      public class BreadthFirstStrategy
      extends java.lang.Object
      implements IStrategy

  A breadth-first search algorithm implementation, that
  - can work with multiple threads,
  - indeterministic,
  - saves all states (trajectories) as solutions that fulfill all the hard objectives,
  - can have a depth limit,
  - will backtrack when a model satisfies the hard objectives (after saving it as a solution) and will not explore beyond that state.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BreadthFirstStrategy()` Creates a new breadth-first search algorithm without depth limit.
    `BreadthFirstStrategy(int maxDepth)` Creates a new breadth-first search algorithm with depth limit.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `explore()` This method explores the design space as the implementation specifies.
    `void` | `initStrategy(ThreadContext context)` Initializes the strategy with a specific `ThreadContext`.
    `void` | `interruptStrategy()` The implementation of this interface should be ready to be interrupted.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BreadthFirstStrategy

          public BreadthFirstStrategy()

      Creates a new breadth-first search algorithm without depth limit.

    - #### BreadthFirstStrategy

          public BreadthFirstStrategy(int maxDepth)

      Creates a new breadth-first search algorithm with depth limit.
      Parameters:
        `maxDepth` - A negative `maxDepth` means no depth limit, zero means the checking of the initial state.

  - ### Method Detail

    - #### initStrategy

          public void initStrategy(ThreadContext context)

      Description copied from interface: `IStrategy`
      Initializes the strategy with a specific `ThreadContext`.
      Specified by:
        `initStrategy` in interface `IStrategy`
      Parameters:
        `context` - The context.

    - #### explore

          public void explore()

      Description copied from interface: `IStrategy`
      This method explores the design space as the implementation specifies. It will be called only once, hence the exploration loop is run by the implementation. The termination condition is also specified by the implementation and when it returns the exploration thread will be disposed.
      Specified by:
        `explore` in interface `IStrategy`

    - #### interruptStrategy

          public void interruptStrategy()

      Description copied from interface: `IStrategy`
      The implementation of this interface should be ready to be interrupted. If this method is called, the `IStrategy.explore()` method should return ASAP. This method is also called by the `SolutionStore` class if enough solutions are found.
      Specified by:
        `interruptStrategy` in interface `IStrategy`