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 SummaryFieldsModifier 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 SummaryConstructorsConstructorDescriptionCreate 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 SummaryModifier 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.AbstractConfigtoString
- 
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- 
SolverConfigpublic SolverConfig()Create an empty solver config.
- 
SolverConfig- Parameters:
- classLoader- sometimes null
 
- 
SolverConfigAllows 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- 
createFromXmlResourceReads an XML solver configuration from the classpath.- Parameters:
- solverConfigResource- never null, a classpath resource as defined by- ClassLoader.getResource(String)
- Returns:
- never null
 
- 
createFromXmlResourcepublic static SolverConfig createFromXmlResource(String solverConfigResource, ClassLoader classLoader) As defined bycreateFromXmlResource(String).- Parameters:
- solverConfigResource- never null, a classpath resource as defined by- ClassLoader.getResource(String)
- classLoader- sometimes null, the- ClassLoaderto use for loading all resources and- Classes, null to use the default- ClassLoader
- Returns:
- never null
 
- 
createFromXmlFileReads 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
 
- 
createFromXmlFileAs defined bycreateFromXmlFile(File).- Parameters:
- solverConfigFile- never null
- classLoader- sometimes null, the- ClassLoaderto use for loading all resources and- Classes, null to use the default- ClassLoader
- Returns:
- never null
 
- 
createFromXmlInputStream- Parameters:
- in- never null, gets closed
- Returns:
- never null
 
- 
createFromXmlInputStreamAs defined bycreateFromXmlInputStream(InputStream).- Parameters:
- in- never null, gets closed
- classLoader- sometimes null, the- ClassLoaderto use for loading all resources and- Classes, null to use the default- ClassLoader
- Returns:
- never null
 
- 
createFromXmlReader- Parameters:
- reader- never null, gets closed
- Returns:
- never null
 
- 
createFromXmlReaderAs defined bycreateFromXmlReader(Reader).- Parameters:
- reader- never null, gets closed
- classLoader- sometimes null, the- ClassLoaderto use for loading all resources and- Classes, null to use the default- ClassLoader
- 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
- 
withEasyScoreCalculatorClasspublic SolverConfig withEasyScoreCalculatorClass(Class<? extends EasyScoreCalculator> easyScoreCalculatorClass) As defined byScoreDirectorFactoryConfig.withEasyScoreCalculatorClass(Class), but returns this.- Parameters:
- easyScoreCalculatorClass- sometimes null
- Returns:
- this, never null
 
- 
withConstraintProviderClasspublic SolverConfig withConstraintProviderClass(Class<? extends ConstraintProvider> constraintProviderClass) As defined byScoreDirectorFactoryConfig.withConstraintProviderClass(Class), but returns this.- Parameters:
- constraintProviderClass- sometimes null
- Returns:
- this, never null
 
- 
withConstraintStreamImplType
- 
withTerminationConfig
- 
withTerminationSpentLimitAs defined byTerminationConfig.withSpentLimit(Duration), but returns this.- Parameters:
- spentLimit- sometimes null
- Returns:
- this, never null
 
- 
withPhaseList
- 
withPhases
- 
withMonitoringConfig
- 
determineEnvironmentMode
- 
determineDomainAccessType
- 
determineMetricConfig
- 
offerRandomSeedFromSubSingleIndexpublic void offerRandomSeedFromSubSingleIndex(long subSingleIndex) 
- 
inheritDo not use this method, it is an internal method. UseSolverConfig(SolverConfig)instead.- Specified by:
- inheritin class- AbstractConfig<SolverConfig>
- Parameters:
- inheritedConfig- never null
- Returns:
- this
 
- 
copyConfigDescription copied from class:AbstractConfigTypically implemented by constructing a new instance and callingAbstractConfig.inherit(AbstractConfig)on it.- Specified by:
- copyConfigin class- AbstractConfig<SolverConfig>
- Returns:
- new instance
 
- 
visitReferencedClassesDescription 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 class- AbstractConfig<SolverConfig>
- Parameters:
- classVisitor- The visitor of classes, never null. Can accept null instances of Class.
 
 
-