diff --git a/kotlin/school-timetabling/src/main/kotlin/org/acme/kotlin/schooltimetabling/solver/TimeTableConstraintProvider.kt b/kotlin/school-timetabling/src/main/kotlin/org/acme/kotlin/schooltimetabling/solver/TimeTableConstraintProvider.kt index 79a89e93f8..2db0a95b63 100644 --- a/kotlin/school-timetabling/src/main/kotlin/org/acme/kotlin/schooltimetabling/solver/TimeTableConstraintProvider.kt +++ b/kotlin/school-timetabling/src/main/kotlin/org/acme/kotlin/schooltimetabling/solver/TimeTableConstraintProvider.kt @@ -43,7 +43,7 @@ class TimeTableConstraintProvider : ConstraintProvider { // ... and penalize each pair with a hard weight. .penalize(HardSoftScore.ONE_HARD) .justifyWith { lesson1: Lesson, lesson2: Lesson, _ -> - RoomConflictJustification(lesson1.room, lesson1,lesson2) + RoomConflictJustification(lesson1.room!!, lesson1, lesson2) } .asConstraint("Room conflict") } diff --git a/kotlin/school-timetabling/src/main/kotlin/org/acme/kotlin/schooltimetabling/solver/justifications/RoomConflictJustification.kt b/kotlin/school-timetabling/src/main/kotlin/org/acme/kotlin/schooltimetabling/solver/justifications/RoomConflictJustification.kt index af5381d65c..1d913543b4 100644 --- a/kotlin/school-timetabling/src/main/kotlin/org/acme/kotlin/schooltimetabling/solver/justifications/RoomConflictJustification.kt +++ b/kotlin/school-timetabling/src/main/kotlin/org/acme/kotlin/schooltimetabling/solver/justifications/RoomConflictJustification.kt @@ -6,7 +6,7 @@ import org.acme.kotlin.schooltimetabling.domain.Room data class RoomConflictJustification( - val room: Room?, + val room: Room, val lesson1: Lesson, val lesson2: Lesson, val description: String @@ -14,7 +14,7 @@ data class RoomConflictJustification( ConstraintJustification { constructor( - room: Room?, + room: Room, lesson1: Lesson, lesson2: Lesson ) : this( diff --git a/kotlin/school-timetabling/src/test/kotlin/org/acme/kotlin/schooltimetabling/rest/TimetableEnvironmentTest.kt b/kotlin/school-timetabling/src/test/kotlin/org/acme/kotlin/schooltimetabling/rest/TimetableEnvironmentTest.kt index b712a394a4..94f6f749d2 100644 --- a/kotlin/school-timetabling/src/test/kotlin/org/acme/kotlin/schooltimetabling/rest/TimetableEnvironmentTest.kt +++ b/kotlin/school-timetabling/src/test/kotlin/org/acme/kotlin/schooltimetabling/rest/TimetableEnvironmentTest.kt @@ -30,7 +30,7 @@ class TimetableEnvironmentTest { solve(EnvironmentMode.FAST_ASSERT) } - fun solve(environmentMode: EnvironmentMode?) { + fun solve(environmentMode: EnvironmentMode) { // Load the problem val problem: Timetable = given() .`when`()["/demo-data/SMALL"] @@ -39,12 +39,10 @@ class TimetableEnvironmentTest { .extract() .`as`(Timetable::class.java) - // Update the environment // Update the environment val updatedConfig = solverConfig!!.copyConfig() - updatedConfig.withEnvironmentMode(environmentMode) .withTerminationSpentLimit(Duration.ofSeconds(30)) - .terminationConfig.withBestScoreLimit(null) + .withEnvironmentMode(environmentMode) val solverFactory: SolverFactory = SolverFactory.create(updatedConfig) // Solve the problem