1111import ai .timefold .solver .core .config .localsearch .LocalSearchPhaseConfig ;
1212import ai .timefold .solver .core .config .localsearch .LocalSearchType ;
1313import ai .timefold .solver .core .config .phase .PhaseConfig ;
14+ import ai .timefold .solver .core .config .solver .PreviewFeature ;
1415import ai .timefold .solver .core .config .solver .SolverConfig ;
1516
1617import org .jspecify .annotations .NonNull ;
@@ -35,20 +36,16 @@ public enum SolverBenchmarkBluePrintType {
3536 */
3637 EVERY_CONSTRUCTION_HEURISTIC_TYPE_WITH_EVERY_LOCAL_SEARCH_TYPE ;
3738
38- protected @ NonNull List <SolverBenchmarkConfig > buildSolverBenchmarkConfigList () {
39- switch (this ) {
40- case CONSTRUCTION_HEURISTIC_WITH_AND_WITHOUT_LOCAL_SEARCH :
41- return buildConstructionHeuristicWithAndWithoutLocalSearch ();
42- case EVERY_CONSTRUCTION_HEURISTIC_TYPE :
43- return buildEveryConstructionHeuristicType ();
44- case EVERY_LOCAL_SEARCH_TYPE :
45- return buildEveryLocalSearchType ();
46- case EVERY_CONSTRUCTION_HEURISTIC_TYPE_WITH_EVERY_LOCAL_SEARCH_TYPE :
47- return buildEveryConstructionHeuristicTypeWithEveryLocalSearchType ();
48- default :
49- throw new IllegalStateException ("The solverBenchmarkBluePrintType ("
50- + this + ") is not implemented." );
51- }
39+ @ NonNull
40+ List <SolverBenchmarkConfig > buildSolverBenchmarkConfigList () {
41+ return switch (this ) {
42+ case CONSTRUCTION_HEURISTIC_WITH_AND_WITHOUT_LOCAL_SEARCH ->
43+ buildConstructionHeuristicWithAndWithoutLocalSearch ();
44+ case EVERY_CONSTRUCTION_HEURISTIC_TYPE -> buildEveryConstructionHeuristicType ();
45+ case EVERY_LOCAL_SEARCH_TYPE -> buildEveryLocalSearchType ();
46+ case EVERY_CONSTRUCTION_HEURISTIC_TYPE_WITH_EVERY_LOCAL_SEARCH_TYPE ->
47+ buildEveryConstructionHeuristicTypeWithEveryLocalSearchType ();
48+ };
5249 }
5350
5451 private List <SolverBenchmarkConfig > buildConstructionHeuristicWithAndWithoutLocalSearch () {
@@ -68,28 +65,37 @@ private List<SolverBenchmarkConfig> buildEveryConstructionHeuristicType() {
6865 }
6966
7067 private List <SolverBenchmarkConfig > buildEveryLocalSearchType () {
68+ return buildEveryLocalSearchType (null );
69+ }
70+
71+ private List <SolverBenchmarkConfig > buildEveryLocalSearchType (ConstructionHeuristicType constructionHeuristicType ) {
7172 LocalSearchType [] lsTypes = LocalSearchType .getBluePrintTypes ();
7273 List <SolverBenchmarkConfig > solverBenchmarkConfigList = new ArrayList <>(lsTypes .length );
7374 for (LocalSearchType lsType : lsTypes ) {
74- solverBenchmarkConfigList .add (buildSolverBenchmarkConfig (null , true , lsType ));
75+ if (PreviewFeature .DIVERSIFIED_LATE_ACCEPTANCE != null && lsType == LocalSearchType .DIVERSIFIED_LATE_ACCEPTANCE ) {
76+ // When the preview feature is removed, this will fail at compile time
77+ // and the code will have to be adjusted.
78+ // Most likely, the preview feature will be promoted to a regular feature,
79+ // and this if statement will be removed.
80+ continue ;
81+ }
82+ solverBenchmarkConfigList .add (buildSolverBenchmarkConfig (constructionHeuristicType , true , lsType ));
7583 }
7684 return solverBenchmarkConfigList ;
7785 }
7886
7987 private List <SolverBenchmarkConfig > buildEveryConstructionHeuristicTypeWithEveryLocalSearchType () {
8088 ConstructionHeuristicType [] chTypes = ConstructionHeuristicType .getBluePrintTypes ();
8189 LocalSearchType [] lsTypes = LocalSearchType .getBluePrintTypes ();
82- List <SolverBenchmarkConfig > solverBenchmarkConfigList = new ArrayList <>(
83- chTypes .length * lsTypes .length );
90+ List <SolverBenchmarkConfig > solverBenchmarkConfigList = new ArrayList <>(chTypes .length * lsTypes .length );
8491 for (ConstructionHeuristicType chType : chTypes ) {
85- for (LocalSearchType lsType : lsTypes ) {
86- solverBenchmarkConfigList .add (buildSolverBenchmarkConfig (chType , true , lsType ));
87- }
92+ solverBenchmarkConfigList .addAll (buildEveryLocalSearchType (chType ));
8893 }
8994 return solverBenchmarkConfigList ;
9095 }
9196
92- protected @ NonNull SolverBenchmarkConfig buildSolverBenchmarkConfig (
97+ @ NonNull
98+ private SolverBenchmarkConfig buildSolverBenchmarkConfig (
9399 @ Nullable ConstructionHeuristicType constructionHeuristicType ,
94100 boolean localSearchEnabled , @ Nullable LocalSearchType localSearchType ) {
95101 SolverBenchmarkConfig solverBenchmarkConfig = new SolverBenchmarkConfig ();
0 commit comments