org.eclipse.viatra.dse.evolutionary

## Class EvolutionaryStrategy

- java.lang.Object
- - org.eclipse.viatra.dse.evolutionary.EvolutionaryStrategy

- All Implemented Interfaces:
    IStrategy

      public class EvolutionaryStrategy
      extends java.lang.Object
      implements IStrategy

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `EvolutionaryStrategy.EvolutionaryStrategySharedObject`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<IEvolutionaryStrategyAdapter>` | `adapters`
    `protected ThreadContext` | `context`
    `protected java.util.List<ICrossover>` | `crossovers`
    `protected DesignSpaceManager` | `dsm`
    `protected boolean` | `isFirstThread`
    `protected java.util.concurrent.atomic.AtomicBoolean` | `isInterrupted`
    `protected IParentSelectionStrategy` | `localParentSelector`
    `protected org.apache.log4j.Logger` | `logger`
    `protected java.util.List<IMutation>` | `mutations`
    `protected java.util.Random` | `random`
    `protected EvolutionaryStrategy.EvolutionaryStrategySharedObject` | `so`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EvolutionaryStrategy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `addToChildren(TrajectoryFitness child)`
    `void` | `explore()` This method explores the design space as the implementation specifies.
    `protected void` | `generateChildren()`
    `void` | `initStrategy(ThreadContext context)` Initializes the strategy with a specific `ThreadContext`.
    `void` | `interruptStrategy()` The implementation of this interface should be ready to be interrupted.
    `protected void` | `mainThread()`
    `protected void` | `savePopulationsAsSolutions(java.util.List<TrajectoryFitness> survivedPopulation)`
    `protected void` | `startThreads()`

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

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

- - ### Field Detail

    - #### so

          protected EvolutionaryStrategy.EvolutionaryStrategySharedObject so

    - #### crossovers

          protected java.util.List<ICrossover> crossovers

    - #### mutations

          protected java.util.List<IMutation> mutations

    - #### adapters

          protected java.util.List<IEvolutionaryStrategyAdapter> adapters

    - #### context

          protected ThreadContext context

    - #### dsm

          protected DesignSpaceManager dsm

    - #### isInterrupted

          protected java.util.concurrent.atomic.AtomicBoolean isInterrupted

    - #### random

          protected java.util.Random random

    - #### localParentSelector

          protected IParentSelectionStrategy localParentSelector

    - #### isFirstThread

          protected boolean isFirstThread

    - #### logger

          protected org.apache.log4j.Logger logger

  - ### Constructor Detail

    - #### EvolutionaryStrategy

          public EvolutionaryStrategy()

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

    - #### mainThread

          protected void mainThread()
                             throws java.lang.InterruptedException,
                                    java.util.concurrent.BrokenBarrierException

      Throws:
        `java.lang.InterruptedException`
        `java.util.concurrent.BrokenBarrierException`

    - #### startThreads

          protected void startThreads()

    - #### generateChildren

          protected void generateChildren()

    - #### addToChildren

          protected boolean addToChildren(TrajectoryFitness child)

      Parameters:
        `child` -
      Returns:
        True, if children population is full.

    - #### savePopulationsAsSolutions

          protected void savePopulationsAsSolutions(java.util.List<TrajectoryFitness> survivedPopulation)

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