Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLANNER-1709 Avoid deprecated penalize/reward overloads #1167

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion optaplanner-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>
<optaplanner-quarkus.version>8.27.0.Final</optaplanner-quarkus.version>
<optaplanner-quarkus.version>8.29.0.Final</optaplanner-quarkus.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<docker-plugin.version>0.28.0</docker-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ Constraint roomConflict(ConstraintFactory constraintFactory) {
// ... in the same room ...
Joiners.equal(Lesson::getRoom))
// ... and penalize each pair with a hard weight.
.penalize("Room conflict", HardSoftScore.ONE_HARD);
.penalize(HardSoftScore.ONE_HARD)
.asConstraint("Room conflict");
}

Constraint teacherConflict(ConstraintFactory constraintFactory) {
Expand All @@ -44,7 +45,8 @@ Constraint teacherConflict(ConstraintFactory constraintFactory) {
.forEachUniquePair(Lesson.class,
Joiners.equal(Lesson::getTimeslot),
Joiners.equal(Lesson::getTeacher))
.penalize("Teacher conflict", HardSoftScore.ONE_HARD);
.penalize(HardSoftScore.ONE_HARD)
.asConstraint("Teacher conflict");
}

Constraint studentGroupConflict(ConstraintFactory constraintFactory) {
Expand All @@ -53,7 +55,8 @@ Constraint studentGroupConflict(ConstraintFactory constraintFactory) {
.forEachUniquePair(Lesson.class,
Joiners.equal(Lesson::getTimeslot),
Joiners.equal(Lesson::getStudentGroup))
.penalize("Student group conflict", HardSoftScore.ONE_HARD);
.penalize(HardSoftScore.ONE_HARD)
.asConstraint("Student group conflict");
}

Constraint teacherRoomStability(ConstraintFactory constraintFactory) {
Expand All @@ -62,7 +65,8 @@ Constraint teacherRoomStability(ConstraintFactory constraintFactory) {
.forEachUniquePair(Lesson.class,
Joiners.equal(Lesson::getTeacher))
.filter((lesson1, lesson2) -> lesson1.getRoom() != lesson2.getRoom())
.penalize("Teacher room stability", HardSoftScore.ONE_SOFT);
.penalize(HardSoftScore.ONE_SOFT)
.asConstraint("Teacher room stability");
}

Constraint teacherTimeEfficiency(ConstraintFactory constraintFactory) {
Expand All @@ -76,7 +80,8 @@ Constraint teacherTimeEfficiency(ConstraintFactory constraintFactory) {
lesson2.getTimeslot().getStartTime());
return !between.isNegative() && between.compareTo(Duration.ofMinutes(30)) <= 0;
})
.reward("Teacher time efficiency", HardSoftScore.ONE_SOFT);
.reward(HardSoftScore.ONE_SOFT)
.asConstraint("Teacher time efficiency");
}

Constraint studentGroupSubjectVariety(ConstraintFactory constraintFactory) {
Expand All @@ -92,7 +97,8 @@ Constraint studentGroupSubjectVariety(ConstraintFactory constraintFactory) {
lesson2.getTimeslot().getStartTime());
return !between.isNegative() && between.compareTo(Duration.ofMinutes(30)) <= 0;
})
.penalize("Student group subject variety", HardSoftScore.ONE_SOFT);
.penalize(HardSoftScore.ONE_SOFT)
.asConstraint("Student group subject variety");
}

}