Artificial Intelligence for planning optimization in Kotlin

For OptaPlanner (open source AI constraint solver), we created a quickstart in kotlin.
Source code:

I wondering if there are suggestions on how to make the code cleaner, like the 3 constructors in the Lesson class:


Hm, you can use kotlin-jpa to get rid of the no-arg constructor.

The 2 other constructors can be merged in a signle one which has null default values for id, timeslot, room.

Then usually one can just declare all the fields in the constructor as val/var though in this case there are those 3 lateinit properties, which look a bit off, how do those get initialized when JPA creates the class?

1 Like