Hi, not sure I got all the details (seeing rules could help, I did not understand what is wrong with your approach).
As far I undertand, you already has a list containing the jov sequence, so you can update "prevJob" and "nextJob" attributes of you planning variables "Job". If yes, let's say you have 2 methods that returns "prevJobBreak" (or null if no prevJob) I would then add 2 rules for your 2 criteria : rule "min_small_breaks" when $small_breaks : Number from accumulate( Job($break : prevJobBreak != null && <= 20), sum($break) ) // not sure of exact syntax, see accumulate doc) then // insert soft with : $small_breaks end rule "max_big_breaks" when $big_breaks : Number from accumulate( Job($break : prevJobBreak != null && > 20), sum($break) ) then // insert soft with : -1 * $big_breaks (or anything else with a suitable weigth according to the other criteria) end Note that I only use prev, but nextJob can be used to add rules (contraints or criterion) over consecutives jobs (forbidden/mandatory sequences for instance). I also sum over all big breaks. I don't know if you have a constraint that limits the number of big breaks to 1. If >1, may be you have to find a formula to optimise also the number of single 'as big as possible' big breaks in a day.
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
