Use customized justification as well as dynamic adjust score

16 views
Skip to first unread message

Arlin zhang

unread,
Nov 22, 2023, 4:57:46 AM11/22/23
to OptaPlanner development
Hello,

In constrainProvider, I use customized justification. And I also want to have the score dynamic. But it seems we can not achieve both together.
1. penalizeConfigurable seems to be deprecated.
2. if I use penalizeConfigurable, than  I can not call justifyWith to pass my custmoized justification.

.penalizeConfigurable("Teacher Time Conflict");
// .penalize(HardSoftScore.ONE_HARD)
// .justifyWith((lesson1, lesson2, score) -> new TeacherTimeConflictJustify(lesson1, lesson2, score.toString()))
// .asConstraint("Teacher Time Conflict");

Is there solution for this?

By the way, I implement my dynamic score by this:
- In database, I create a score table to store the score for each constrain.
- In timetable constructor, pass a constrainConfiguration.
- When we call the solver to start solve, a constrainConfiguration is initialized and my data is loaded from database(using repository), and then they are passed to the timetable. And start to slove.
- constrainConfiguration is initialized in this way: load score data from the database and assign to the constrainWeight.
- User change the score data via UI.

When user starts to solve the timetable, the corresponding score data will be loaded into the initial timetable data via constrainConfiguration. And hence, we enable dynamic score.

Reply all
Reply to author
Forward
0 new messages