0

Can we use two planning variables with (nullable = true) for each of them?

If so, how can we deal with them in the Drools rule file?

I know that when we use one planning variable we define it with (nullable = true) and then in the rule we use $planningVariable != null as in the "pas" example, I tried this and it worked well, but what about using two planning variables?

Can we apply this on the curriculumCourse? and if so, the over constrained data should appear in the output as unassigned for the two planning variables or appear in only one of them?

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
Amr Qamar
  • 99
  • 6

1 Answers1

0

Yes, of course you can. But as usual, you 'll have to make sure your score constraints (= score rules) penalize/reward what you want to achieve.

For example on CurriculumCourse, I presume you 'd have a negative medium constraint that penalizes a Lecture if either room or period is null. If both are null, don't penalize it more, or you'll end up with a lot semi assigned entities. But despite that, you'll still probably end up with a few semi assigned entities, so to fix that:

  • Either do some post-processing to make all those not assigned at all (= both vars null) as a semi-assignment is useless.
  • Or add a hard constraint against semi assignments to avoid them entirely (even in intermediate solution states).

Additional solving efficiently can be gained from:

  • A ChangeMove selector that moves both room and period, as changing just one to/from null will never yield a better solution.
Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
  • I want to maximize the gain ( which is a property in the Lecture) of the assigned Lectures. How can I do this combined with your answer? – Amr Qamar Oct 29 '15 at 16:31