Skip to content

Commit 5d7c271

Browse files
authored
Merge pull request #27774 from triceo/patch-1
PLANNER-1709 Avoid deprecated penalize/reward overloads
2 parents 4a50d50 + 38ee8be commit 5d7c271

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/src/main/asciidoc/optaplanner.adoc

+6-3
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ public class TimeTableConstraintProvider implements ConstraintProvider {
456456
// ... and the pair is unique (different id, no reverse pairs) ...
457457
Joiners.lessThan(Lesson::getId))
458458
// ... then penalize each pair with a hard weight.
459-
.penalize("Room conflict", HardSoftScore.ONE_HARD);
459+
.penalize(HardSoftScore.ONE_HARD)
460+
.asConstraint("Room conflict");
460461
}
461462

462463
Constraint teacherConflict(ConstraintFactory constraintFactory) {
@@ -466,7 +467,8 @@ public class TimeTableConstraintProvider implements ConstraintProvider {
466467
Joiners.equal(Lesson::getTimeslot),
467468
Joiners.equal(Lesson::getTeacher),
468469
Joiners.lessThan(Lesson::getId))
469-
.penalize("Teacher conflict", HardSoftScore.ONE_HARD);
470+
.penalize(HardSoftScore.ONE_HARD)
471+
.asConstraint(""Teacher conflict");
470472
}
471473

472474
Constraint studentGroupConflict(ConstraintFactory constraintFactory) {
@@ -476,7 +478,8 @@ public class TimeTableConstraintProvider implements ConstraintProvider {
476478
Joiners.equal(Lesson::getTimeslot),
477479
Joiners.equal(Lesson::getStudentGroup),
478480
Joiners.lessThan(Lesson::getId))
479-
.penalize("Student group conflict", HardSoftScore.ONE_HARD);
481+
.penalize(HardSoftScore.ONE_HARD)
482+
.asConstraint(""Student group conflict");
480483
}
481484

482485
}

0 commit comments

Comments
 (0)