Class SolverConfig
java.lang.Object
org.optaplanner.core.config.AbstractConfig<SolverConfig>
org.optaplanner.core.config.solver.SolverConfig
To read it from XML, use 
createFromXmlResource(String).
 To build a SolverFactory with it, use SolverFactory.create(SolverConfig).- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Booleanprotected DomainAccessTypeprotected EnvironmentModeprotected Map<String,MemberAccessor> protected Map<String,SolutionCloner> protected MonitoringConfigstatic final Stringstatic final Stringprotected Integerprotected Stringprotected List<PhaseConfig>protected Class<? extends RandomFactory>protected Longprotected RandomTypeprotected ScoreDirectorFactoryConfigprotected Class<?>protected Class<? extends ThreadFactory>static final Stringstatic final Stringstatic final String - 
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty solver config.SolverConfig(ClassLoader classLoader) SolverConfig(SolverConfig inheritedConfig) Allows you to programmatically change theSolverConfigper concurrent request, based on a template solver config, by building a separateSolverFactorywithSolverFactory.create(SolverConfig)and a separateSolverper request to avoid race conditions. - 
Method Summary
Modifier and TypeMethodDescriptionTypically implemented by constructing a new instance and callingAbstractConfig.inherit(AbstractConfig)on it.static SolverConfigcreateFromXmlFile(File solverConfigFile) Reads an XML solver configuration from the file system.static SolverConfigcreateFromXmlFile(File solverConfigFile, ClassLoader classLoader) As defined bycreateFromXmlFile(File).static SolverConfigstatic SolverConfigcreateFromXmlInputStream(InputStream in, ClassLoader classLoader) As defined bycreateFromXmlInputStream(InputStream).static SolverConfigcreateFromXmlReader(Reader reader) static SolverConfigcreateFromXmlReader(Reader reader, ClassLoader classLoader) As defined bycreateFromXmlReader(Reader).static SolverConfigcreateFromXmlResource(String solverConfigResource) Reads an XML solver configuration from the classpath.static SolverConfigcreateFromXmlResource(String solverConfigResource, ClassLoader classLoader) As defined bycreateFromXmlResource(String).Class<? extends RandomFactory>Class<?>Class<? extends ThreadFactory>inherit(SolverConfig inheritedConfig) Do not use this method, it is an internal method.voidofferRandomSeedFromSubSingleIndex(long subSingleIndex) voidsetClassLoader(ClassLoader classLoader) voidvoidsetDomainAccessType(DomainAccessType domainAccessType) voidsetEntityClassList(List<Class<?>> entityClassList) voidsetEnvironmentMode(EnvironmentMode environmentMode) voidsetGizmoMemberAccessorMap(Map<String, MemberAccessor> gizmoMemberAccessorMap) voidsetGizmoSolutionClonerMap(Map<String, SolutionCloner> gizmoSolutionClonerMap) voidsetMonitoringConfig(MonitoringConfig monitoringConfig) voidsetMoveThreadBufferSize(Integer moveThreadBufferSize) voidsetMoveThreadCount(String moveThreadCount) voidsetPhaseConfigList(List<PhaseConfig> phaseConfigList) voidsetRandomFactoryClass(Class<? extends RandomFactory> randomFactoryClass) voidsetRandomSeed(Long randomSeed) voidsetRandomType(RandomType randomType) voidsetScoreDirectorFactoryConfig(ScoreDirectorFactoryConfig scoreDirectorFactoryConfig) voidsetSolutionClass(Class<?> solutionClass) voidsetTerminationConfig(TerminationConfig terminationConfig) voidsetThreadFactoryClass(Class<? extends ThreadFactory> threadFactoryClass) voidvisitReferencedClasses(Consumer<Class<?>> classVisitor) Call the class visitor on each (possibly null) Class instance provided to this config by the user (including those provided in child configs).withConstraintProviderClass(Class<? extends ConstraintProvider> constraintProviderClass) As defined byScoreDirectorFactoryConfig.withConstraintProviderClass(Class), but returns this.withConstraintStreamImplType(ConstraintStreamImplType constraintStreamImplType) withDaemon(Boolean daemon) withDomainAccessType(DomainAccessType domainAccessType) withEasyScoreCalculatorClass(Class<? extends EasyScoreCalculator> easyScoreCalculatorClass) As defined byScoreDirectorFactoryConfig.withEasyScoreCalculatorClass(Class), but returns this.withEntityClasses(Class<?>... entityClasses) withEntityClassList(List<Class<?>> entityClassList) withEnvironmentMode(EnvironmentMode environmentMode) withGizmoMemberAccessorMap(Map<String, MemberAccessor> memberAccessorMap) withGizmoSolutionClonerMap(Map<String, SolutionCloner> solutionClonerMap) withMonitoringConfig(MonitoringConfig monitoringConfig) withMoveThreadBufferSize(Integer moveThreadBufferSize) withMoveThreadCount(String moveThreadCount) withPhaseList(List<PhaseConfig> phaseConfigList) withPhases(PhaseConfig... phaseConfigs) withRandomFactoryClass(Class<? extends RandomFactory> randomFactoryClass) withRandomSeed(Long randomSeed) withRandomType(RandomType randomType) withScoreDirectorFactory(ScoreDirectorFactoryConfig scoreDirectorFactoryConfig) withSolutionClass(Class<?> solutionClass) withTerminationConfig(TerminationConfig terminationConfig) withTerminationSpentLimit(Duration spentLimit) As defined byTerminationConfig.withSpentLimit(Duration), but returns this.withThreadFactoryClass(Class<? extends ThreadFactory> threadFactoryClass) Methods inherited from class org.optaplanner.core.config.AbstractConfig
toString 
- 
Field Details
- 
XML_ELEMENT_NAME
- See Also:
 
 - 
XML_NAMESPACE
- See Also:
 
 - 
XML_TYPE_NAME
- See Also:
 
 - 
MOVE_THREAD_COUNT_NONE
- See Also:
 
 - 
MOVE_THREAD_COUNT_AUTO
- See Also:
 
 - 
environmentMode
 - 
daemon
 - 
randomType
 - 
randomSeed
 - 
randomFactoryClass
 - 
moveThreadCount
 - 
moveThreadBufferSize
 - 
threadFactoryClass
 - 
solutionClass
 - 
entityClassList
 - 
domainAccessType
 - 
gizmoMemberAccessorMap
 - 
gizmoSolutionClonerMap
 - 
scoreDirectorFactoryConfig
 - 
phaseConfigList
 - 
monitoringConfig
 
 - 
 - 
Constructor Details
- 
SolverConfig
public SolverConfig()Create an empty solver config. - 
SolverConfig
- Parameters:
 classLoader- sometimes null
 - 
SolverConfig
Allows you to programmatically change theSolverConfigper concurrent request, based on a template solver config, by building a separateSolverFactorywithSolverFactory.create(SolverConfig)and a separateSolverper request to avoid race conditions.- Parameters:
 inheritedConfig- never null
 
 - 
 - 
Method Details
- 
createFromXmlResource
Reads an XML solver configuration from the classpath.- Parameters:
 solverConfigResource- never null, a classpath resource as defined byClassLoader.getResource(String)- Returns:
 - never null
 
 - 
createFromXmlResource
public static SolverConfig createFromXmlResource(String solverConfigResource, ClassLoader classLoader) As defined bycreateFromXmlResource(String).- Parameters:
 solverConfigResource- never null, a classpath resource as defined byClassLoader.getResource(String)classLoader- sometimes null, theClassLoaderto use for loading all resources andClasses, null to use the defaultClassLoader- Returns:
 - never null
 
 - 
createFromXmlFile
Reads an XML solver configuration from the file system.Warning: this leads to platform dependent code, it's recommend to use
createFromXmlResource(String)instead.- Parameters:
 solverConfigFile- never null- Returns:
 - never null
 
 - 
createFromXmlFile
As defined bycreateFromXmlFile(File).- Parameters:
 solverConfigFile- never nullclassLoader- sometimes null, theClassLoaderto use for loading all resources andClasses, null to use the defaultClassLoader- Returns:
 - never null
 
 - 
createFromXmlInputStream
- Parameters:
 in- never null, gets closed- Returns:
 - never null
 
 - 
createFromXmlInputStream
As defined bycreateFromXmlInputStream(InputStream).- Parameters:
 in- never null, gets closedclassLoader- sometimes null, theClassLoaderto use for loading all resources andClasses, null to use the defaultClassLoader- Returns:
 - never null
 
 - 
createFromXmlReader
- Parameters:
 reader- never null, gets closed- Returns:
 - never null
 
 - 
createFromXmlReader
As defined bycreateFromXmlReader(Reader).- Parameters:
 reader- never null, gets closedclassLoader- sometimes null, theClassLoaderto use for loading all resources andClasses, null to use the defaultClassLoader- Returns:
 - never null
 
 - 
getClassLoader
 - 
setClassLoader
 - 
getEnvironmentMode
 - 
setEnvironmentMode
 - 
getDaemon
 - 
setDaemon
 - 
getRandomType
 - 
setRandomType
 - 
getRandomSeed
 - 
setRandomSeed
 - 
getRandomFactoryClass
 - 
setRandomFactoryClass
 - 
getMoveThreadCount
 - 
setMoveThreadCount
 - 
getMoveThreadBufferSize
 - 
setMoveThreadBufferSize
 - 
getThreadFactoryClass
 - 
setThreadFactoryClass
 - 
getSolutionClass
 - 
setSolutionClass
 - 
getEntityClassList
 - 
setEntityClassList
 - 
getDomainAccessType
 - 
setDomainAccessType
 - 
getGizmoMemberAccessorMap
 - 
setGizmoMemberAccessorMap
 - 
getGizmoSolutionClonerMap
 - 
setGizmoSolutionClonerMap
 - 
getScoreDirectorFactoryConfig
 - 
setScoreDirectorFactoryConfig
 - 
getTerminationConfig
 - 
setTerminationConfig
 - 
getPhaseConfigList
 - 
setPhaseConfigList
 - 
getMonitoringConfig
 - 
setMonitoringConfig
 - 
withEnvironmentMode
 - 
withDaemon
 - 
withRandomType
 - 
withRandomSeed
 - 
withRandomFactoryClass
 - 
withMoveThreadCount
 - 
withMoveThreadBufferSize
 - 
withThreadFactoryClass
 - 
withSolutionClass
 - 
withEntityClassList
 - 
withEntityClasses
 - 
withDomainAccessType
 - 
withGizmoMemberAccessorMap
 - 
withGizmoSolutionClonerMap
 - 
withScoreDirectorFactory
 - 
withEasyScoreCalculatorClass
public SolverConfig withEasyScoreCalculatorClass(Class<? extends EasyScoreCalculator> easyScoreCalculatorClass) As defined byScoreDirectorFactoryConfig.withEasyScoreCalculatorClass(Class), but returns this.- Parameters:
 easyScoreCalculatorClass- sometimes null- Returns:
 - this, never null
 
 - 
withConstraintProviderClass
public SolverConfig withConstraintProviderClass(Class<? extends ConstraintProvider> constraintProviderClass) As defined byScoreDirectorFactoryConfig.withConstraintProviderClass(Class), but returns this.- Parameters:
 constraintProviderClass- sometimes null- Returns:
 - this, never null
 
 - 
withConstraintStreamImplType
 - 
withTerminationConfig
 - 
withTerminationSpentLimit
As defined byTerminationConfig.withSpentLimit(Duration), but returns this.- Parameters:
 spentLimit- sometimes null- Returns:
 - this, never null
 
 - 
withPhaseList
 - 
withPhases
 - 
withMonitoringConfig
 - 
determineEnvironmentMode
 - 
determineDomainAccessType
 - 
determineMetricConfig
 - 
offerRandomSeedFromSubSingleIndex
public void offerRandomSeedFromSubSingleIndex(long subSingleIndex)  - 
inherit
Do not use this method, it is an internal method. UseSolverConfig(SolverConfig)instead.- Specified by:
 inheritin classAbstractConfig<SolverConfig>- Parameters:
 inheritedConfig- never null- Returns:
 - this
 
 - 
copyConfig
Description copied from class:AbstractConfigTypically implemented by constructing a new instance and callingAbstractConfig.inherit(AbstractConfig)on it.- Specified by:
 copyConfigin classAbstractConfig<SolverConfig>- Returns:
 - new instance
 
 - 
visitReferencedClasses
Description copied from class:AbstractConfigCall the class visitor on each (possibly null) Class instance provided to this config by the user (including those provided in child configs). Required to create the bean factory in Quarkus.- Specified by:
 visitReferencedClassesin classAbstractConfig<SolverConfig>- Parameters:
 classVisitor- The visitor of classes, never null. Can accept null instances of Class.
 
 -