Package org.optaplanner.core.impl.solver

## Class DefaultSolverFactory<Solution_>

- java.lang.Object
- - org.optaplanner.core.api.solver.SolverFactory<Solution_>
  - - org.optaplanner.core.impl.solver.DefaultSolverFactory<Solution_>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation

      public final class DefaultSolverFactory<Solution_>
      extends SolverFactory<Solution_>

  See Also:
    `SolverFactory`

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultSolverFactory​(SolverConfig solverConfig)` |
    `DefaultSolverFactory​(SolverConfig solverConfig, SolverConfigContext solverConfigContext)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Solver<Solution_>` | `buildSolver()` | Creates a new `Solver` instance.
    `SolverFactory<Solution_>` | `cloneSolverFactory()` | Deprecated.
    `ScoreDirectorFactory<Solution_>` | `getScoreDirectorFactory()` | Useful to reuse the `Score` calculation (for example in a UI) and to explain the `Score` to the user with the `ConstraintMatchTotal` and `Indictment` API.
    `SolverConfig` | `getSolverConfig()` | Deprecated.
    `SolverConfigContext` | `getSolverConfigContext()` |

    - ### Methods inherited from class org.optaplanner.core.api.solver.SolverFactory

      `create, createEmpty, createEmpty, createEmptyFromKieContainer, createEmptyFromKieContainer, createFromKieContainer, createFromKieContainerXmlResource, createFromKieContainerXmlResource, createFromKieContainerXmlResource, createFromXmlFile, createFromXmlFile, createFromXmlInputStream, createFromXmlInputStream, createFromXmlReader, createFromXmlReader, createFromXmlResource, createFromXmlResource`

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

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

- - ### Constructor Detail

    - #### DefaultSolverFactory

          public DefaultSolverFactory​(SolverConfig solverConfig)

    - #### DefaultSolverFactory

          public DefaultSolverFactory​(SolverConfig solverConfig,
                                      SolverConfigContext solverConfigContext)

  - ### Method Detail

    - #### buildSolver

          public Solver<Solution_> buildSolver()

      Description copied from class: `SolverFactory`
      Creates a new `Solver` instance.
      Specified by:
        `buildSolver` in class `SolverFactory<Solution_>`
      Returns:
        never null

    - #### getScoreDirectorFactory

          public ScoreDirectorFactory<Solution_> getScoreDirectorFactory()

      Description copied from class: `SolverFactory`
      Useful to reuse the `Score` calculation (for example in a UI) and to explain the `Score` to the user with the `ConstraintMatchTotal` and `Indictment` API.
      Specified by:
        `getScoreDirectorFactory` in class `SolverFactory<Solution_>`
      Returns:
        never null

    - #### getSolverConfig

          @Deprecated
          public SolverConfig getSolverConfig()

      Deprecated.
      Description copied from class: `SolverFactory`
      Deprecated. To configure a `SolverFactory` dynamically (without parsing XML each time), use `SolverFactory.create(SolverConfig)` instead.

      This method is not thread-safe. To configure a `SolverConfig` differently for parallel requests, build a template `SolverFactory` from XML and clone it `SolverFactory.cloneSolverFactory()` for each request, before before calling this method.

      Specified by:
        `getSolverConfig` in class `SolverFactory<Solution_>`
      Returns:
        never null

    - #### cloneSolverFactory

          @Deprecated
          public SolverFactory<Solution_> cloneSolverFactory()

      Deprecated.
      Description copied from class: `SolverFactory`
      Deprecated. To configure a `SolverFactory` dynamically (without parsing XML each time), use `SolverConfig(SolverConfig)` and `SolverFactory.create(SolverConfig)` instead.

      Build a `SolverFactory` quickly (without parsing XML) that builds the exact same `Solver` with `SolverFactory.buildSolver()`, but can also be modified with `SolverFactory.getSolverConfig()` to build a different `Solver` without affecting the original `SolverFactory`.

      Specified by:
        `cloneSolverFactory` in class `SolverFactory<Solution_>`
      Returns:
        never null, often a different `SolverFactory` subclass implementation than this instance

    - #### getSolverConfigContext

          public SolverConfigContext getSolverConfigContext()