org.optaplanner.benchmark.config

## Class PlannerBenchmarkConfig

- java.lang.Object
- - org.optaplanner.benchmark.config.PlannerBenchmarkConfig

-     public class PlannerBenchmarkConfig
      extends Object

  To read it from XML, use `createFromXmlResource(String)`. To build a `PlannerBenchmarkFactory` with it, use `PlannerBenchmarkFactory.create(PlannerBenchmarkConfig)`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PARALLEL_BENCHMARK_COUNT_AUTO`
    `static Pattern` | `VALID_NAME_PATTERN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PlannerBenchmarkConfig()` Create an empty benchmark config.
    `PlannerBenchmarkConfig(ClassLoader classLoader)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected List<SolverBenchmarkConfig>` | `buildEffectiveSolverBenchmarkConfigList()`
    `PlannerBenchmark` | `buildPlannerBenchmark(SolverConfigContext solverConfigContext)` Do not use this method, it is an internal method.
    `<Solution_> PlannerBenchmark` | `buildPlannerBenchmark(SolverConfigContext solverConfigContext, Solution_[] extraProblems)` Do not use this method, it is an internal method.
    `protected Long` | `calculateWarmUpTimeMillisSpentLimit()`
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlFile(File templateFile)` Reads a Freemarker XML benchmark configuration from the file system.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlFile(File templateFile, ClassLoader classLoader)` As defined by `createFromFreemarkerXmlFile(File)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlFile(File templateFile, Object model)` As defined by `createFromFreemarkerXmlFile(File)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlFile(File templateFile, Object model, ClassLoader classLoader)` As defined by `createFromFreemarkerXmlFile(File)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlInputStream(InputStream templateIn)`
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlInputStream(InputStream templateIn, ClassLoader classLoader)` As defined by `createFromFreemarkerXmlInputStream(InputStream)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlInputStream(InputStream templateIn, Object model)` As defined by `createFromFreemarkerXmlInputStream(InputStream)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlInputStream(InputStream templateIn, Object model, ClassLoader classLoader)` As defined by `createFromFreemarkerXmlInputStream(InputStream)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlReader(Reader templateReader)`
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlReader(Reader templateReader, ClassLoader classLoader)` As defined by `createFromFreemarkerXmlReader(Reader)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlReader(Reader templateReader, Object model)` As defined by `createFromFreemarkerXmlReader(Reader)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlReader(Reader templateReader, Object model, ClassLoader classLoader)` As defined by `createFromFreemarkerXmlReader(Reader)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlResource(String templateResource)` Reads a Freemarker XML benchmark configuration from the classpath.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlResource(String templateResource, ClassLoader classLoader)` As defined by `createFromFreemarkerXmlResource(String)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlResource(String templateResource, Object model)` As defined by `createFromFreemarkerXmlResource(String)`.
    `static PlannerBenchmarkConfig` | `createFromFreemarkerXmlResource(String templateResource, Object model, ClassLoader classLoader)` As defined by `createFromFreemarkerXmlResource(String)`.
    `static PlannerBenchmarkConfig` | `createFromSolverConfig(SolverConfig solverConfig)`
    `static PlannerBenchmarkConfig` | `createFromSolverConfig(SolverConfig solverConfig, File benchmarkDirectory)`
    `static PlannerBenchmarkConfig` | `createFromXmlFile(File benchmarkConfigFile)` Reads an XML benchmark configuration from the file system.
    `static PlannerBenchmarkConfig` | `createFromXmlFile(File benchmarkConfigFile, ClassLoader classLoader)` As defined by `createFromXmlFile(File)`.
    `static PlannerBenchmarkConfig` | `createFromXmlInputStream(InputStream in)`
    `static PlannerBenchmarkConfig` | `createFromXmlInputStream(InputStream in, ClassLoader classLoader)`
    `static PlannerBenchmarkConfig` | `createFromXmlReader(Reader reader)`
    `static PlannerBenchmarkConfig` | `createFromXmlReader(Reader reader, ClassLoader classLoader)`
    `static PlannerBenchmarkConfig` | `createFromXmlResource(String benchmarkConfigResource)` Reads an XML benchmark configuration from the classpath.
    `static PlannerBenchmarkConfig` | `createFromXmlResource(String benchmarkConfigResource, ClassLoader classLoader)` As defined by `createFromXmlResource(String)`.
    `protected void` | `generateSolverBenchmarkConfigNames()`
    `File` | `getBenchmarkDirectory()`
    `BenchmarkReportConfig` | `getBenchmarkReportConfig()`
    `ClassLoader` | `getClassLoader()`
    `SolverBenchmarkConfig` | `getInheritedSolverBenchmarkConfig()`
    `String` | `getName()`
    `String` | `getParallelBenchmarkCount()` Using multiple parallel benchmarks can decrease the reliability of the results.
    `List<SolverBenchmarkBluePrintConfig>` | `getSolverBenchmarkBluePrintConfigList()`
    `List<SolverBenchmarkConfig>` | `getSolverBenchmarkConfigList()`
    `Class<? extends ThreadFactory>` | `getThreadFactoryClass()`
    `Long` | `getWarmUpDaysSpentLimit()`
    `Long` | `getWarmUpHoursSpentLimit()`
    `Long` | `getWarmUpMillisecondsSpentLimit()`
    `Long` | `getWarmUpMinutesSpentLimit()`
    `Long` | `getWarmUpSecondsSpentLimit()`
    `protected int` | `resolveParallelBenchmarkCount()`
    `protected int` | `resolveParallelBenchmarkCountAutomatically(int availableProcessorCount)`
    `void` | `setBenchmarkDirectory(File benchmarkDirectory)`
    `void` | `setBenchmarkReportConfig(BenchmarkReportConfig benchmarkReportConfig)`
    `void` | `setClassLoader(ClassLoader classLoader)`
    `void` | `setInheritedSolverBenchmarkConfig(SolverBenchmarkConfig inheritedSolverBenchmarkConfig)`
    `void` | `setName(String name)`
    `void` | `setParallelBenchmarkCount(String parallelBenchmarkCount)`
    `void` | `setSolverBenchmarkBluePrintConfigList(List<SolverBenchmarkBluePrintConfig> solverBenchmarkBluePrintConfigList)`
    `void` | `setSolverBenchmarkConfigList(List<SolverBenchmarkConfig> solverBenchmarkConfigList)`
    `void` | `setThreadFactoryClass(Class<? extends ThreadFactory> threadFactoryClass)`
    `void` | `setWarmUpDaysSpentLimit(Long warmUpDaysSpentLimit)`
    `void` | `setWarmUpHoursSpentLimit(Long warmUpHoursSpentLimit)`
    `void` | `setWarmUpMillisecondsSpentLimit(Long warmUpMillisecondsSpentLimit)`
    `void` | `setWarmUpMinutesSpentLimit(Long warmUpMinutesSpentLimit)`
    `void` | `setWarmUpSecondsSpentLimit(Long warmUpSecondsSpentLimit)`
    `protected void` | `validate()`

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

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

- - ### Field Detail

    - #### PARALLEL_BENCHMARK_COUNT_AUTO

          public static final String PARALLEL_BENCHMARK_COUNT_AUTO

      See Also:
        Constant Field Values

    - #### VALID_NAME_PATTERN

          public static final Pattern VALID_NAME_PATTERN

  - ### Constructor Detail

    - #### PlannerBenchmarkConfig

          public PlannerBenchmarkConfig()

      Create an empty benchmark config.

    - #### PlannerBenchmarkConfig

          public PlannerBenchmarkConfig(ClassLoader classLoader)

      Parameters:
        `classLoader` - sometimes null

  - ### Method Detail

    - #### createFromSolverConfig

          public static PlannerBenchmarkConfig createFromSolverConfig(SolverConfig solverConfig)

      Parameters:
        `solverConfig` - never null

    - #### createFromSolverConfig

          public static PlannerBenchmarkConfig createFromSolverConfig(SolverConfig solverConfig,
                                                                      File benchmarkDirectory)

      Parameters:
        `solverConfig` - never null
        `benchmarkDirectory` - never null

    - #### createFromXmlResource

          public static PlannerBenchmarkConfig createFromXmlResource(String benchmarkConfigResource)

      Reads an XML benchmark configuration from the classpath.
      Parameters:
        `benchmarkConfigResource` - never null, a classpath resource as defined by `ClassLoader.getResource(String)`
      Returns:
        never null

    - #### createFromXmlResource

          public static PlannerBenchmarkConfig createFromXmlResource(String benchmarkConfigResource,
                                                                     ClassLoader classLoader)

      As defined by `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

    - #### createFromXmlFile

          public static PlannerBenchmarkConfig createFromXmlFile(File benchmarkConfigFile)

      Reads an XML benchmark configuration from the file system.

      Warning: this leads to platform dependent code, it's recommend to use `createFromXmlResource(String)` instead.

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

    - #### createFromXmlFile

          public static PlannerBenchmarkConfig createFromXmlFile(File benchmarkConfigFile,
                                                                 ClassLoader classLoader)

      As defined by `createFromXmlFile(File)`.
      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 PlannerBenchmarkConfig createFromXmlInputStream(InputStream in)

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

    - #### createFromXmlInputStream

          public static PlannerBenchmarkConfig 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 PlannerBenchmarkConfig createFromXmlReader(Reader reader)

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

    - #### createFromXmlReader

          public static PlannerBenchmarkConfig 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 PlannerBenchmarkConfig createFromFreemarkerXmlResource(String templateResource)

      Reads a Freemarker XML benchmark configuration from the classpath.
      Parameters:
        `templateResource` - never null, a classpath resource as defined by `ClassLoader.getResource(String)`
      Returns:
        never null

    - #### createFromFreemarkerXmlResource

          public static PlannerBenchmarkConfig createFromFreemarkerXmlResource(String templateResource,
                                                                               ClassLoader classLoader)

      As defined by `createFromFreemarkerXmlResource(String)`.
      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 PlannerBenchmarkConfig createFromFreemarkerXmlResource(String templateResource,
                                                                               Object model)

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

    - #### createFromFreemarkerXmlResource

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

      As defined by `createFromFreemarkerXmlResource(String)`.
      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 PlannerBenchmarkConfig createFromFreemarkerXmlFile(File templateFile)

      Reads a Freemarker XML benchmark configuration from the file system.

      Warning: this leads to platform dependent code, it's recommend to use `createFromFreemarkerXmlResource(String)` instead.

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

    - #### createFromFreemarkerXmlFile

          public static PlannerBenchmarkConfig createFromFreemarkerXmlFile(File templateFile,
                                                                           ClassLoader classLoader)

      As defined by `createFromFreemarkerXmlFile(File)`.
      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 PlannerBenchmarkConfig createFromFreemarkerXmlFile(File templateFile,
                                                                           Object model)

      As defined by `createFromFreemarkerXmlFile(File)`.
      Parameters:
        `templateFile` - never null
        `model` - sometimes null
      Returns:
        never null

    - #### createFromFreemarkerXmlFile

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

      As defined by `createFromFreemarkerXmlFile(File)`.
      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 PlannerBenchmarkConfig createFromFreemarkerXmlInputStream(InputStream templateIn)

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

    - #### createFromFreemarkerXmlInputStream

          public static PlannerBenchmarkConfig createFromFreemarkerXmlInputStream(InputStream templateIn,
                                                                                  ClassLoader classLoader)

      As defined by `createFromFreemarkerXmlInputStream(InputStream)`.
      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 PlannerBenchmarkConfig createFromFreemarkerXmlInputStream(InputStream templateIn,
                                                                                  Object model)

      As defined by `createFromFreemarkerXmlInputStream(InputStream)`.
      Parameters:
        `templateIn` - never null, gets closed
        `model` - sometimes null
      Returns:
        never null

    - #### createFromFreemarkerXmlInputStream

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

      As defined by `createFromFreemarkerXmlInputStream(InputStream)`.
      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 PlannerBenchmarkConfig createFromFreemarkerXmlReader(Reader templateReader)

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

    - #### createFromFreemarkerXmlReader

          public static PlannerBenchmarkConfig createFromFreemarkerXmlReader(Reader templateReader,
                                                                             ClassLoader classLoader)

      As defined by `createFromFreemarkerXmlReader(Reader)`.
      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 PlannerBenchmarkConfig createFromFreemarkerXmlReader(Reader templateReader,
                                                                             Object model)

      As defined by `createFromFreemarkerXmlReader(Reader)`.
      Parameters:
        `templateReader` - never null, gets closed
        `model` - sometimes null
      Returns:
        never null

    - #### createFromFreemarkerXmlReader

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

      As defined by `createFromFreemarkerXmlReader(Reader)`.
      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

    - #### getClassLoader

          public ClassLoader getClassLoader()

    - #### setClassLoader

          public void setClassLoader(ClassLoader classLoader)

    - #### getName

          public String getName()

    - #### setName

          public void setName(String name)

    - #### getBenchmarkDirectory

          public File getBenchmarkDirectory()

    - #### setBenchmarkDirectory

          public void setBenchmarkDirectory(File benchmarkDirectory)

    - #### getThreadFactoryClass

          public Class<? extends ThreadFactory> getThreadFactoryClass()

    - #### setThreadFactoryClass

          public void setThreadFactoryClass(Class<? extends ThreadFactory> threadFactoryClass)

    - #### getParallelBenchmarkCount

          public String getParallelBenchmarkCount()

      Using multiple parallel benchmarks can decrease the reliability of the results.

      If there aren't enough processors available, it will be decreased.

      Returns:
        null, a number, "AUTO" or a JavaScript calculation using "availableProcessorCount".

    - #### setParallelBenchmarkCount

          public void setParallelBenchmarkCount(String parallelBenchmarkCount)

    - #### getWarmUpMillisecondsSpentLimit

          public Long getWarmUpMillisecondsSpentLimit()

    - #### setWarmUpMillisecondsSpentLimit

          public void setWarmUpMillisecondsSpentLimit(Long warmUpMillisecondsSpentLimit)

    - #### getWarmUpSecondsSpentLimit

          public Long getWarmUpSecondsSpentLimit()

    - #### setWarmUpSecondsSpentLimit

          public void setWarmUpSecondsSpentLimit(Long warmUpSecondsSpentLimit)

    - #### getWarmUpMinutesSpentLimit

          public Long getWarmUpMinutesSpentLimit()

    - #### setWarmUpMinutesSpentLimit

          public void setWarmUpMinutesSpentLimit(Long warmUpMinutesSpentLimit)

    - #### getWarmUpHoursSpentLimit

          public Long getWarmUpHoursSpentLimit()

    - #### setWarmUpHoursSpentLimit

          public void setWarmUpHoursSpentLimit(Long warmUpHoursSpentLimit)

    - #### getWarmUpDaysSpentLimit

          public Long getWarmUpDaysSpentLimit()

    - #### setWarmUpDaysSpentLimit

          public void setWarmUpDaysSpentLimit(Long warmUpDaysSpentLimit)

    - #### getBenchmarkReportConfig

          public BenchmarkReportConfig getBenchmarkReportConfig()

    - #### setBenchmarkReportConfig

          public void setBenchmarkReportConfig(BenchmarkReportConfig benchmarkReportConfig)

    - #### getInheritedSolverBenchmarkConfig

          public SolverBenchmarkConfig getInheritedSolverBenchmarkConfig()

    - #### setInheritedSolverBenchmarkConfig

          public void setInheritedSolverBenchmarkConfig(SolverBenchmarkConfig inheritedSolverBenchmarkConfig)

    - #### getSolverBenchmarkBluePrintConfigList

          public List<SolverBenchmarkBluePrintConfig> getSolverBenchmarkBluePrintConfigList()

    - #### setSolverBenchmarkBluePrintConfigList

          public void setSolverBenchmarkBluePrintConfigList(List<SolverBenchmarkBluePrintConfig> solverBenchmarkBluePrintConfigList)

    - #### getSolverBenchmarkConfigList

          public List<SolverBenchmarkConfig> getSolverBenchmarkConfigList()

    - #### setSolverBenchmarkConfigList

          public void setSolverBenchmarkConfigList(List<SolverBenchmarkConfig> solverBenchmarkConfigList)

    - #### buildPlannerBenchmark

          public PlannerBenchmark buildPlannerBenchmark(SolverConfigContext solverConfigContext)

      Do not use this method, it is an internal method. Use `PlannerBenchmarkFactory.buildPlannerBenchmark()` instead.

      Will be removed in 8.0.

      Parameters:
        `solverConfigContext` - never null
      Returns:
        never null

    - #### buildPlannerBenchmark

          public <Solution_> PlannerBenchmark buildPlannerBenchmark(SolverConfigContext solverConfigContext,
                                                                    Solution_[] extraProblems)

      Do not use this method, it is an internal method. Use `PlannerBenchmarkFactory.buildPlannerBenchmark(Object[])` instead.

      Will be removed in 8.0.

      Parameters:
        `solverConfigContext` - never null
        `extraProblems` - never null
      Returns:
        never null

    - #### validate

          protected void validate()

    - #### generateSolverBenchmarkConfigNames

          protected void generateSolverBenchmarkConfigNames()

    - #### buildEffectiveSolverBenchmarkConfigList

          protected List<SolverBenchmarkConfig> buildEffectiveSolverBenchmarkConfigList()

    - #### resolveParallelBenchmarkCount

          protected int resolveParallelBenchmarkCount()

    - #### resolveParallelBenchmarkCountAutomatically

          protected int resolveParallelBenchmarkCountAutomatically(int availableProcessorCount)

    - #### calculateWarmUpTimeMillisSpentLimit

          protected Long calculateWarmUpTimeMillisSpentLimit()

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