Skip to content

Commit

Permalink
chore: minor tweaks to Kotlin quickstart after nullity annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
triceo committed Nov 11, 2024
1 parent 1cf3720 commit 5c7f4e8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ 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
) :
ConstraintJustification {

constructor(
room: Room?,
room: Room,
lesson1: Lesson,
lesson2: Lesson
) : this(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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<Timetable> = SolverFactory.create(updatedConfig)

// Solve the problem
Expand Down

0 comments on commit 5c7f4e8

Please sign in to comment.