Skip to content

Commit 65bf7db

Browse files
committed
chore: address more comments
1 parent 78458bf commit 65bf7db

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

core/src/test/java/ai/timefold/solver/core/impl/constructionheuristic/DefaultConstructionHeuristicPhaseTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -511,27 +511,25 @@ void solvePinnedAndUnassignedWithListAndBasicVariables() {
511511
assertThat(solution.getEntityList().get(1).getValueList()).isEmpty();
512512

513513
// Pin partially the first entity list
514-
problem = TestdataUnassignedListMultiVarSolution.generateUninitializedSolution(2, 3, 2);
514+
problem = TestdataUnassignedListMultiVarSolution.generateUninitializedSolution(2, 4, 2);
515515
problem.getEntityList().get(0).setPinnedIndex(2);
516-
problem.getEntityList().get(0).setBasicValue(problem.getOtherValueList().get(0));
517-
problem.getEntityList().get(0).setSecondBasicValue(problem.getOtherValueList().get(0));
518516
problem.getEntityList().get(0).setValueList(problem.getValueList().subList(1, 3));
519517
// Block values and make the basic variable unassigned
520518
problem.getOtherValueList().get(0).setBlocked(true);
521519
problem.getOtherValueList().get(1).setBlocked(true);
522520
solution = PlannerTestUtils.solve(solverConfig, problem);
523-
// The basic value is set to null because the entire entity is not fixed.
524521
assertThat(solution.getEntityList().get(0).getBasicValue()).isNull();
525522
assertThat(solution.getEntityList().get(0).getSecondBasicValue()).isNotNull();
523+
// The pinning index fixed the values 1 and 2. The only remaining option is values are 0 and 3.
524+
// The score is bigger when the list size is 3
526525
assertThat(solution.getEntityList().get(0).getValueList()).hasSize(3);
527-
// The pinning index fixed the values 1 and 2. The only remaining option is value 0.
528526
assertThat(solution.getEntityList().get(0).getValueList())
529527
.hasSameElementsAs(
530528
List.of(problem.getValueList().get(1), problem.getValueList().get(2), problem.getValueList().get(0)));
531529
assertThat(solution.getEntityList().get(1).getBasicValue()).isNull();
532530
assertThat(solution.getEntityList().get(1).getSecondBasicValue()).isNotNull();
533-
assertThat(solution.getEntityList().get(1).getValueList()).isEmpty();
534-
531+
assertThat(solution.getEntityList().get(1).getValueList()).hasSize(1);
532+
assertThat(solution.getEntityList().get(1).getValueList()).hasSameElementsAs(List.of(problem.getValueList().get(3)));
535533
}
536534

537535
@Test

core/src/test/java/ai/timefold/solver/core/testdomain/multivar/list/singleentity/unassignedvar/TestdataUnassignedListMultiVarEasyScoreCalculator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class TestdataUnassignedListMultiVarEasyScoreCalculator
2222
}
2323
if (entity.getValueList().stream().anyMatch(TestdataUnassignedListMultiVarValue::isBlocked)) {
2424
score -= 10;
25+
} else if (entity.getValueList().size() == 3) {
26+
score += 2;
2527
} else {
2628
score++;
2729
}

0 commit comments

Comments
 (0)