99import jakarta .xml .bind .annotation .adapters .XmlJavaTypeAdapter ;
1010
1111import ai .timefold .solver .core .api .solver .phase .PhaseCommand ;
12+ import ai .timefold .solver .core .config .constructionheuristic .ConstructionHeuristicPhaseConfig ;
1213import ai .timefold .solver .core .config .phase .PhaseConfig ;
1314import ai .timefold .solver .core .config .util .ConfigUtils ;
1415import ai .timefold .solver .core .impl .io .jaxb .JaxbCustomPropertiesAdapter ;
1718import org .jspecify .annotations .Nullable ;
1819
1920@ XmlType (propOrder = {
21+ "inheritanceRate" ,
2022 "customPhaseCommandClassList" ,
2123 "customProperties" ,
24+ "constructionHeuristic"
2225})
2326@ NullMarked
24- public class EvolutionaryCustomPhaseConfig extends PhaseConfig <EvolutionaryCustomPhaseConfig > {
27+ public class EvolutionaryIndividualGeneratorConfig extends PhaseConfig <EvolutionaryIndividualGeneratorConfig > {
28+
29+ @ Nullable
30+ private Double inheritanceRate = null ;
2531
2632 @ XmlElement (name = "customPhaseCommandClass" )
2733 @ Nullable
@@ -31,10 +37,21 @@ public class EvolutionaryCustomPhaseConfig extends PhaseConfig<EvolutionaryCusto
3137 @ Nullable
3238 private Map <String , String > customProperties = null ;
3339
40+ @ Nullable
41+ private ConstructionHeuristicPhaseConfig constructionHeuristic = null ;
42+
3443 // ************************************************************************
3544 // Constructors and simple getters/setters
3645 // ************************************************************************
3746
47+ public @ Nullable Double getInheritanceRate () {
48+ return inheritanceRate ;
49+ }
50+
51+ public void setInheritanceRate (@ Nullable Double inheritanceRate ) {
52+ this .inheritanceRate = inheritanceRate ;
53+ }
54+
3855 public @ Nullable List <Class <? extends PhaseCommand >> getCustomPhaseCommandClassList () {
3956 return customPhaseCommandClassList ;
4057 }
@@ -52,39 +69,63 @@ public void setCustomProperties(@Nullable Map<String, String> customProperties)
5269 this .customProperties = customProperties ;
5370 }
5471
72+ public @ Nullable ConstructionHeuristicPhaseConfig getConstructionHeuristic () {
73+ return constructionHeuristic ;
74+ }
75+
76+ public void setConstructionHeuristic (@ Nullable ConstructionHeuristicPhaseConfig constructionHeuristic ) {
77+ this .constructionHeuristic = constructionHeuristic ;
78+ }
79+
5580 // ************************************************************************
5681 // With methods
5782 // ************************************************************************
5883
59- public EvolutionaryCustomPhaseConfig withCustomPhaseCommandClassList (
84+ public EvolutionaryIndividualGeneratorConfig withInheritanceRate (@ Nullable Double inheritanceRate ) {
85+ setInheritanceRate (inheritanceRate );
86+ return this ;
87+ }
88+
89+ public EvolutionaryIndividualGeneratorConfig withCustomPhaseCommandClassList (
6090 List <Class <? extends PhaseCommand >> customPhaseCommandClassList ) {
6191 setCustomPhaseCommandClassList (customPhaseCommandClassList );
6292 return this ;
6393 }
6494
65- public EvolutionaryCustomPhaseConfig withCustomProperties (Map <String , String > customProperties ) {
95+ public EvolutionaryIndividualGeneratorConfig withCustomProperties (Map <String , String > customProperties ) {
6696 setCustomProperties (customProperties );
6797 return this ;
6898 }
6999
100+ public EvolutionaryIndividualGeneratorConfig
101+ withConstructionHeuristic (@ Nullable ConstructionHeuristicPhaseConfig constructionHeuristic ) {
102+ setConstructionHeuristic (constructionHeuristic );
103+ return this ;
104+ }
105+
70106 @ Override
71- public EvolutionaryCustomPhaseConfig inherit (EvolutionaryCustomPhaseConfig inheritedConfig ) {
107+ public EvolutionaryIndividualGeneratorConfig inherit (EvolutionaryIndividualGeneratorConfig inheritedConfig ) {
72108 super .inherit (inheritedConfig );
109+ inheritanceRate = ConfigUtils .inheritOverwritableProperty (inheritanceRate , inheritedConfig .getInheritanceRate ());
73110 customPhaseCommandClassList = ConfigUtils .inheritMergeableListProperty (customPhaseCommandClassList ,
74111 inheritedConfig .getCustomPhaseCommandClassList ());
75112 customProperties = ConfigUtils .inheritMergeableMapProperty (customProperties , inheritedConfig .getCustomProperties ());
113+ constructionHeuristic = ConfigUtils .inheritConfig (constructionHeuristic , inheritedConfig .getConstructionHeuristic ());
76114 return this ;
77115 }
78116
79117 @ Override
80- public EvolutionaryCustomPhaseConfig copyConfig () {
81- return new EvolutionaryCustomPhaseConfig ().inherit (this );
118+ public EvolutionaryIndividualGeneratorConfig copyConfig () {
119+ return new EvolutionaryIndividualGeneratorConfig ().inherit (this );
82120 }
83121
84122 @ Override
85123 public void visitReferencedClasses (Consumer <@ Nullable Class <?>> classVisitor ) {
86124 if (customPhaseCommandClassList != null ) {
87125 customPhaseCommandClassList .forEach (classVisitor );
88126 }
127+ if (constructionHeuristic != null ) {
128+ constructionHeuristic .visitReferencedClasses (classVisitor );
129+ }
89130 }
90131}
0 commit comments