org.optaplanner.benchmark.api

## Class PlannerBenchmarkFactory

- java.lang.Object
- - org.optaplanner.benchmark.api.PlannerBenchmarkFactory

- Direct Known Subclasses:
    AbstractPlannerBenchmarkFactory

      public abstract class PlannerBenchmarkFactory
      extends Object

  Builds `PlannerBenchmark` instances.

  Supports tweaking the configuration programmatically before a `PlannerBenchmark` instance is build.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PlannerBenchmarkFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract PlannerBenchmark` | `buildPlannerBenchmark()` Creates a new `PlannerBenchmark` instance.
    `abstract <Solution_> PlannerBenchmark` | `buildPlannerBenchmark(List<Solution_> problemList)` Creates a new `PlannerBenchmark` instance for datasets that are already in memory.
    `abstract <Solution_> PlannerBenchmark` | `buildPlannerBenchmark(Solution_... problems)` Creates a new `PlannerBenchmark` instance for datasets that are already in memory.
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlFile(File templateFile)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlFile(File templateFile, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlFile(File templateFile, Object model)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlFile(File templateFile, Object model, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlInputStream(InputStream templateIn)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlInputStream(InputStream templateIn, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlInputStream(InputStream templateIn, Object model)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlInputStream(InputStream templateIn, Object model, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlReader(Reader templateReader)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlReader(Reader templateReader, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlReader(Reader templateReader, Object model)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlReader(Reader templateReader, Object model, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlResource(String templateResource)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlResource(String templateResource, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlResource(String templateResource, Object model)`
    `static PlannerBenchmarkFactory` | `createFromFreemarkerXmlResource(String templateResource, Object model, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromKieContainerXmlResource(org.kie.api.runtime.KieContainer kieContainer, String benchmarkConfigResource)` Creates a new `PlannerBenchmarkFactory` that uses a `KieModule` wrapped by a `KieContainer`.
    `static PlannerBenchmarkFactory` | `createFromKieContainerXmlResource(org.kie.api.builder.ReleaseId releaseId, String benchmarkConfigResource)` Creates a new `PlannerBenchmarkFactory` that uses a `KieModule` represented by its releaseId.
    `static PlannerBenchmarkFactory` | `createFromKieContainerXmlResource(String benchmarkConfigResource)` Creates a new `PlannerBenchmarkFactory` that uses `KieServices.getKieClasspathContainer()`.
    `static <Solution_> PlannerBenchmarkFactory` | `createFromSolverFactory(SolverFactory<Solution_> solverFactory)`
    `static <Solution_> PlannerBenchmarkFactory` | `createFromSolverFactory(SolverFactory<Solution_> solverFactory, File benchmarkDirectory)`
    `static PlannerBenchmarkFactory` | `createFromXmlFile(File benchmarkConfigFile)`
    `static PlannerBenchmarkFactory` | `createFromXmlFile(File benchmarkConfigFile, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromXmlInputStream(InputStream in)`
    `static PlannerBenchmarkFactory` | `createFromXmlInputStream(InputStream in, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromXmlReader(Reader reader)`
    `static PlannerBenchmarkFactory` | `createFromXmlReader(Reader reader, ClassLoader classLoader)`
    `static PlannerBenchmarkFactory` | `createFromXmlResource(String benchmarkConfigResource)`
    `static PlannerBenchmarkFactory` | `createFromXmlResource(String benchmarkConfigResource, ClassLoader classLoader)` See `createFromXmlResource(String)`.
    `abstract PlannerBenchmarkConfig` | `getPlannerBenchmarkConfig()` Allows you to programmatically change the `PlannerBenchmarkConfig` at runtime before building the `PlannerBenchmark`.

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

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

- - ### Constructor Detail

    - #### PlannerBenchmarkFactory

          public PlannerBenchmarkFactory()

  - ### Method Detail

    - #### createFromSolverFactory

          public static <Solution_> PlannerBenchmarkFactory createFromSolverFactory(SolverFactory<Solution_> solverFactory)

      Type Parameters:
        `Solution_` - the solution type, the class with the `PlanningSolution` annotation
      Parameters:
        `solverFactory` - never null, also its `ClassLoader` is reused if any was configured during creation

    - #### createFromSolverFactory

          public static <Solution_> PlannerBenchmarkFactory createFromSolverFactory(SolverFactory<Solution_> solverFactory,
                                                                                    File benchmarkDirectory)

      Type Parameters:
        `Solution_` - the solution type, the class with the `PlanningSolution` annotation
      Parameters:
        `solverFactory` - never null, also its `ClassLoader` is reused if any was configured during creation
        `benchmarkDirectory` - never null

    - #### createFromXmlResource

          public static PlannerBenchmarkFactory createFromXmlResource(String benchmarkConfigResource)

      Parameters:
        `benchmarkConfigResource` - never null, a classpath resource as defined by `ClassLoader.getResource(String)`
      Returns:
        never null

    - #### createFromXmlResource

          public static PlannerBenchmarkFactory createFromXmlResource(String benchmarkConfigResource,
                                                                      ClassLoader classLoader)

      See `createFromXmlResource(String)`.
      Parameters:
        `benchmarkConfigResource` - never null, a classpath resource as defined by `ClassLoader.getResource(String)`
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromKieContainerXmlResource

          public static PlannerBenchmarkFactory createFromKieContainerXmlResource(String benchmarkConfigResource)

      Creates a new `PlannerBenchmarkFactory` that uses `KieServices.getKieClasspathContainer()`.
      Parameters:
        `benchmarkConfigResource` - never null, a classpath resource in the `KieContainer` as defined by `ClassLoader.getResource(String)`
      Returns:
        never null

    - #### createFromKieContainerXmlResource

          public static PlannerBenchmarkFactory createFromKieContainerXmlResource(org.kie.api.builder.ReleaseId releaseId,
                                                                                  String benchmarkConfigResource)

      Creates a new `PlannerBenchmarkFactory` that uses a `KieModule` represented by its releaseId.
      Parameters:
        `releaseId` - never null
        `benchmarkConfigResource` - never null, a classpath resource in the `KieContainer` as defined by `ClassLoader.getResource(String)`
      Returns:
        never null

    - #### createFromKieContainerXmlResource

          public static PlannerBenchmarkFactory createFromKieContainerXmlResource(org.kie.api.runtime.KieContainer kieContainer,
                                                                                  String benchmarkConfigResource)

      Creates a new `PlannerBenchmarkFactory` that uses a `KieModule` wrapped by a `KieContainer`.
      Parameters:
        `kieContainer` - never null
        `benchmarkConfigResource` - never null, a classpath resource in the `KieContainer` as defined by `ClassLoader.getResource(String)`
      Returns:
        never null

    - #### createFromXmlFile

          public static PlannerBenchmarkFactory createFromXmlFile(File benchmarkConfigFile)

      Parameters:
        `benchmarkConfigFile` - never null
      Returns:
        never null

    - #### createFromXmlFile

          public static PlannerBenchmarkFactory createFromXmlFile(File benchmarkConfigFile,
                                                                  ClassLoader classLoader)

      Parameters:
        `benchmarkConfigFile` - never null
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromXmlInputStream

          public static PlannerBenchmarkFactory createFromXmlInputStream(InputStream in)

      Parameters:
        `in` - never null, gets closed
      Returns:
        never null

    - #### createFromXmlInputStream

          public static PlannerBenchmarkFactory createFromXmlInputStream(InputStream in,
                                                                         ClassLoader classLoader)

      Parameters:
        `in` - never null, gets closed
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromXmlReader

          public static PlannerBenchmarkFactory createFromXmlReader(Reader reader)

      Parameters:
        `reader` - never null, gets closed
      Returns:
        never null

    - #### createFromXmlReader

          public static PlannerBenchmarkFactory createFromXmlReader(Reader reader,
                                                                    ClassLoader classLoader)

      Parameters:
        `reader` - never null, gets closed
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromFreemarkerXmlResource

          public static PlannerBenchmarkFactory createFromFreemarkerXmlResource(String templateResource)

      Parameters:
        `templateResource` - never null, a classpath resource as defined by `ClassLoader.getResource(String)`
      Returns:
        never null

    - #### createFromFreemarkerXmlResource

          public static PlannerBenchmarkFactory createFromFreemarkerXmlResource(String templateResource,
                                                                                ClassLoader classLoader)

      Parameters:
        `templateResource` - never null, a classpath resource as defined by `ClassLoader.getResource(String)`
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromFreemarkerXmlResource

          public static PlannerBenchmarkFactory createFromFreemarkerXmlResource(String templateResource,
                                                                                Object model)

      Parameters:
        `templateResource` - never null, a classpath resource as defined by `ClassLoader.getResource(String)`
        `model` - sometimes null
      Returns:
        never null

    - #### createFromFreemarkerXmlResource

          public static PlannerBenchmarkFactory createFromFreemarkerXmlResource(String templateResource,
                                                                                Object model,
                                                                                ClassLoader classLoader)

      Parameters:
        `templateResource` - never null, a classpath resource as defined by `ClassLoader.getResource(String)`
        `model` - sometimes null
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromFreemarkerXmlFile

          public static PlannerBenchmarkFactory createFromFreemarkerXmlFile(File templateFile)

      Parameters:
        `templateFile` - never null
      Returns:
        never null

    - #### createFromFreemarkerXmlFile

          public static PlannerBenchmarkFactory createFromFreemarkerXmlFile(File templateFile,
                                                                            ClassLoader classLoader)

      Parameters:
        `templateFile` - never null
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromFreemarkerXmlFile

          public static PlannerBenchmarkFactory createFromFreemarkerXmlFile(File templateFile,
                                                                            Object model)

      Parameters:
        `templateFile` - never null
        `model` - sometimes null
      Returns:
        never null

    - #### createFromFreemarkerXmlFile

          public static PlannerBenchmarkFactory createFromFreemarkerXmlFile(File templateFile,
                                                                            Object model,
                                                                            ClassLoader classLoader)

      Parameters:
        `templateFile` - never null
        `model` - sometimes null
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromFreemarkerXmlInputStream

          public static PlannerBenchmarkFactory createFromFreemarkerXmlInputStream(InputStream templateIn)

      Parameters:
        `templateIn` - never null, gets closed
      Returns:
        never null

    - #### createFromFreemarkerXmlInputStream

          public static PlannerBenchmarkFactory createFromFreemarkerXmlInputStream(InputStream templateIn,
                                                                                   ClassLoader classLoader)

      Parameters:
        `templateIn` - never null, gets closed
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromFreemarkerXmlInputStream

          public static PlannerBenchmarkFactory createFromFreemarkerXmlInputStream(InputStream templateIn,
                                                                                   Object model)

      Parameters:
        `templateIn` - never null, gets closed
        `model` - sometimes null
      Returns:
        never null

    - #### createFromFreemarkerXmlInputStream

          public static PlannerBenchmarkFactory createFromFreemarkerXmlInputStream(InputStream templateIn,
                                                                                   Object model,
                                                                                   ClassLoader classLoader)

      Parameters:
        `templateIn` - never null, gets closed
        `model` - sometimes null
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromFreemarkerXmlReader

          public static PlannerBenchmarkFactory createFromFreemarkerXmlReader(Reader templateReader)

      Parameters:
        `templateReader` - never null, gets closed
      Returns:
        never null

    - #### createFromFreemarkerXmlReader

          public static PlannerBenchmarkFactory createFromFreemarkerXmlReader(Reader templateReader,
                                                                              ClassLoader classLoader)

      Parameters:
        `templateReader` - never null, gets closed
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### createFromFreemarkerXmlReader

          public static PlannerBenchmarkFactory createFromFreemarkerXmlReader(Reader templateReader,
                                                                              Object model)

      Parameters:
        `templateReader` - never null, gets closed
        `model` - sometimes null
      Returns:
        never null

    - #### createFromFreemarkerXmlReader

          public static PlannerBenchmarkFactory createFromFreemarkerXmlReader(Reader templateReader,
                                                                              Object model,
                                                                              ClassLoader classLoader)

      Parameters:
        `templateReader` - never null, gets closed
        `model` - sometimes null
        `classLoader` - sometimes null, the `ClassLoader` to use for loading all resources and `Class`es, null to use the default `ClassLoader`
      Returns:
        never null

    - #### getPlannerBenchmarkConfig

          public abstract PlannerBenchmarkConfig getPlannerBenchmarkConfig()

      Allows you to programmatically change the `PlannerBenchmarkConfig` at runtime before building the `PlannerBenchmark`.

      This method is not thread-safe.

      Returns:
        never null

    - #### buildPlannerBenchmark

          public abstract PlannerBenchmark buildPlannerBenchmark()

      Creates a new `PlannerBenchmark` instance.
      Returns:
        never null

    - #### buildPlannerBenchmark

          public abstract <Solution_> PlannerBenchmark buildPlannerBenchmark(Solution_... problems)

      Creates a new `PlannerBenchmark` instance for datasets that are already in memory.
      Type Parameters:
        `Solution_` - the solution type, the class with the `PlanningSolution` annotation
      Parameters:
        `problems` - never null, can be none
      Returns:
        never null

    - #### buildPlannerBenchmark

          public abstract <Solution_> PlannerBenchmark buildPlannerBenchmark(List<Solution_> problemList)

      Creates a new `PlannerBenchmark` instance for datasets that are already in memory.
      Type Parameters:
        `Solution_` - the solution type, the class with the `PlanningSolution` annotation
      Parameters:
        `problemList` - never null, can be empty
      Returns:
        never null

Copyright © 2006–2019 JBoss by Red Hat. All rights reserved.