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

## Class BestFirstStrategy

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

- All Implemented Interfaces:
    IStrategy

      public class BestFirstStrategy
      extends java.lang.Object
      implements IStrategy

  This exploration strategy eventually explorers the whole design space but goes in the most promising directions first, based on the `Fitness`. There are a few parameter to tune such as
  - maximum depth
  - continue the exploration from a state that satisfies the hard objectives (the default that it will backtrack),
  - whether to continue the exploration from the newly explored state if it is at least equally good than the previous one or only if it is better (default is "at least equally good").

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `BestFirstStrategy` | `continueIfHardObjectivesFulfilled()`
    `void` | `explore()` This method explores the design space as the implementation specifies.
    `BestFirstStrategy` | `goOnOnlyIfFitnessIsBetter()`
    `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

    - #### BestFirstStrategy

          public BestFirstStrategy()

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

    - #### BestFirstStrategy

          public BestFirstStrategy(int maxDepth)

      Creates a new best-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

    - #### continueIfHardObjectivesFulfilled

          public BestFirstStrategy continueIfHardObjectivesFulfilled()

    - #### goOnOnlyIfFitnessIsBetter

          public BestFirstStrategy goOnOnlyIfFitnessIsBetter()

    - #### 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`