public class SolverConfig extends AbstractConfig<SolverConfig>
createFromXmlResource(String)
.
To build a SolverFactory
with it, use SolverFactory.create(SolverConfig)
.Modifier and Type | Field and Description |
---|---|
protected Boolean |
daemon |
protected static long |
DEFAULT_RANDOM_SEED |
protected List<Class<?>> |
entityClassList |
protected EnvironmentMode |
environmentMode |
static String |
MOVE_THREAD_COUNT_AUTO |
static String |
MOVE_THREAD_COUNT_NONE |
protected Integer |
moveThreadBufferSize |
protected String |
moveThreadCount |
protected List<PhaseConfig> |
phaseConfigList |
protected Class<? extends RandomFactory> |
randomFactoryClass |
protected Long |
randomSeed |
protected RandomType |
randomType |
protected ScanAnnotatedClassesConfig |
scanAnnotatedClassesConfig
Deprecated.
in favor of the Quarkus integration in OptaPlanner 8 or Spring Boot starter.
|
protected ScoreDirectorFactoryConfig |
scoreDirectorFactoryConfig |
protected Class<?> |
solutionClass |
protected Class<? extends ThreadFactory> |
threadFactoryClass |
Constructor and Description |
---|
SolverConfig()
Create an empty solver config.
|
SolverConfig(ClassLoader classLoader) |
SolverConfig(SolverConfig inheritedConfig)
Allows you to programmatically change the
SolverConfig per concurrent request,
based on a template solver config,
by building a separate SolverFactory with SolverFactory.create(SolverConfig)
and a separate Solver per request to avoid race conditions. |
deduceEntityDescriptor, deduceVariableDescriptor, deduceVariableDescriptorList, toString
public static final String MOVE_THREAD_COUNT_NONE
public static final String MOVE_THREAD_COUNT_AUTO
protected static final long DEFAULT_RANDOM_SEED
protected EnvironmentMode environmentMode
protected Boolean daemon
protected RandomType randomType
protected Long randomSeed
protected Class<? extends RandomFactory> randomFactoryClass
protected String moveThreadCount
protected Integer moveThreadBufferSize
protected Class<? extends ThreadFactory> threadFactoryClass
@Deprecated protected ScanAnnotatedClassesConfig scanAnnotatedClassesConfig
protected Class<?> solutionClass
protected ScoreDirectorFactoryConfig scoreDirectorFactoryConfig
protected List<PhaseConfig> phaseConfigList
public SolverConfig()
public SolverConfig(ClassLoader classLoader)
classLoader
- sometimes nullpublic SolverConfig(SolverConfig inheritedConfig)
SolverConfig
per concurrent request,
based on a template solver config,
by building a separate SolverFactory
with SolverFactory.create(SolverConfig)
and a separate Solver
per request to avoid race conditions.inheritedConfig
- never nullpublic static SolverConfig createFromXmlResource(String solverConfigResource)
solverConfigResource
- never null, a classpath resource
as defined by ClassLoader.getResource(String)
public static SolverConfig createFromXmlResource(String solverConfigResource, ClassLoader classLoader)
createFromXmlResource(String)
.solverConfigResource
- 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
public static SolverConfig createFromXmlFile(File solverConfigFile)
Warning: this leads to platform dependent code,
it's recommend to use createFromXmlResource(String)
instead.
solverConfigFile
- never nullpublic static SolverConfig createFromXmlFile(File solverConfigFile, ClassLoader classLoader)
createFromXmlFile(File)
.solverConfigFile
- never nullclassLoader
- sometimes null, the ClassLoader
to use for loading all resources and Class
es,
null to use the default ClassLoader
public static SolverConfig createFromXmlInputStream(InputStream in)
in
- never null, gets closedpublic static SolverConfig createFromXmlInputStream(InputStream in, ClassLoader classLoader)
createFromXmlInputStream(InputStream)
.in
- never null, gets closedclassLoader
- sometimes null, the ClassLoader
to use for loading all resources and Class
es,
null to use the default ClassLoader
public static SolverConfig createFromXmlReader(Reader reader)
reader
- never null, gets closedpublic static SolverConfig createFromXmlReader(Reader reader, ClassLoader classLoader)
createFromXmlReader(Reader)
.reader
- never null, gets closedclassLoader
- sometimes null, the ClassLoader
to use for loading all resources and Class
es,
null to use the default ClassLoader
public ClassLoader getClassLoader()
public void setClassLoader(ClassLoader classLoader)
public EnvironmentMode getEnvironmentMode()
public void setEnvironmentMode(EnvironmentMode environmentMode)
public Boolean getDaemon()
public void setDaemon(Boolean daemon)
public RandomType getRandomType()
public void setRandomType(RandomType randomType)
public Long getRandomSeed()
public void setRandomSeed(Long randomSeed)
public Class<? extends RandomFactory> getRandomFactoryClass()
public void setRandomFactoryClass(Class<? extends RandomFactory> randomFactoryClass)
public String getMoveThreadCount()
public void setMoveThreadCount(String moveThreadCount)
public Integer getMoveThreadBufferSize()
public void setMoveThreadBufferSize(Integer moveThreadBufferSize)
public Class<? extends ThreadFactory> getThreadFactoryClass()
public void setThreadFactoryClass(Class<? extends ThreadFactory> threadFactoryClass)
@Deprecated public ScanAnnotatedClassesConfig getScanAnnotatedClassesConfig()
@Deprecated public void setScanAnnotatedClassesConfig(ScanAnnotatedClassesConfig scanAnnotatedClassesConfig)
public Class<?> getSolutionClass()
public void setSolutionClass(Class<?> solutionClass)
public ScoreDirectorFactoryConfig getScoreDirectorFactoryConfig()
public void setScoreDirectorFactoryConfig(ScoreDirectorFactoryConfig scoreDirectorFactoryConfig)
public TerminationConfig getTerminationConfig()
public void setTerminationConfig(TerminationConfig terminationConfig)
public List<PhaseConfig> getPhaseConfigList()
public void setPhaseConfigList(List<PhaseConfig> phaseConfigList)
public SolverConfig withEnvironmentMode(EnvironmentMode environmentMode)
public SolverConfig withDaemon(Boolean daemon)
public SolverConfig withRandomType(RandomType randomType)
public SolverConfig withRandomSeed(Long randomSeed)
public SolverConfig withRandomFactoryClass(Class<? extends RandomFactory> randomFactoryClass)
public SolverConfig withMoveThreadCount(String moveThreadCount)
public SolverConfig withMoveThreadBufferSize(Integer moveThreadBufferSize)
public SolverConfig withThreadFactoryClass(Class<? extends ThreadFactory> threadFactoryClass)
public SolverConfig withSolutionClass(Class<?> solutionClass)
public SolverConfig withEntityClassList(List<Class<?>> entityClassList)
public SolverConfig withEntityClasses(Class<?>... entityClasses)
public SolverConfig withScoreDirectorFactory(ScoreDirectorFactoryConfig scoreDirectorFactoryConfig)
public SolverConfig withTerminationConfig(TerminationConfig terminationConfig)
public SolverConfig withPhaseList(List<PhaseConfig> phaseConfigList)
public SolverConfig withPhases(PhaseConfig... phaseConfigs)
public EnvironmentMode determineEnvironmentMode()
public void offerRandomSeedFromSubSingleIndex(long subSingleIndex)
public <Solution_> Solver<Solution_> buildSolver(SolverConfigContext configContext)
SolverFactory.buildSolver()
instead.
Will be removed in 8.0 (by putting it in an InnerSolverConfig).
Solution_
- the solution type, the class with the PlanningSolution
annotationconfigContext
- never nullprotected RandomFactory buildRandomFactory(EnvironmentMode environmentMode_)
protected int getAvailableProcessors()
protected Integer resolveMoveThreadCount()
public <Solution_> InnerScoreDirectorFactory<Solution_> buildScoreDirectorFactory(SolverConfigContext configContext, EnvironmentMode environmentMode)
SolverFactory.getScoreDirectorFactory()
instead.
Will be removed in 8.0 (by putting it in an InnerSolverConfig).
Solution_
- the solution type, the class with the PlanningSolution
annotationconfigContext
- never nullenvironmentMode
- never nullpublic <Solution_> SolutionDescriptor<Solution_> buildSolutionDescriptor(SolverConfigContext configContext)
Will be removed in 8.0 (by putting it in an InnerSolverConfig).
Solution_
- the solution type, the class with the PlanningSolution
annotationprotected <Solution_> List<Phase<Solution_>> buildPhaseList(HeuristicConfigPolicy configPolicy, BestSolutionRecaller bestSolutionRecaller, Termination termination)
public SolverConfig inherit(SolverConfig inheritedConfig)
SolverConfig(SolverConfig)
instead.inherit
in class AbstractConfig<SolverConfig>
inheritedConfig
- never nullpublic SolverConfig copyConfig()
AbstractConfig
AbstractConfig.inherit(AbstractConfig)
on itcopyConfig
in class AbstractConfig<SolverConfig>
Copyright © 2006–2021 JBoss by Red Hat. All rights reserved.