On 22-08-13 00:01, Adam Hirsch wrote:
Hey, folks -- I'm trying to wrap my head around Optaplanner by extending the nurse-rostering example (for my wife, who's a nurse in a group that needs a rostering solution, as it happens).

I've got a couple of approach/philosophy questions I haven't yet found addressed in the docs, and I'm hoping someone could help direct me.
  • How best to constrain a problem: Say I've got six people to schedule and Employee A *must* work every Tuesday night and alternate Friday nights, while the other five people should fill in the remaining shifts as best they can with the other soft constraints I'm specifying. From my initial reading, I'm thinking the best approach will be to specify an "only Tuesday and alt Fridays" <Contract> in the scoreRules.xml (with an accompanying DRL rule to match whether or not the particular employee is working shifts other than those) and then specify it as a "hard" constraint for that particular employee. Do I have that right, or is there some way to remove those shifts entirely from the problem space, since we already know ahead of time how they'll be allocated?
    • A similar question would come up around Christmas, New Years, Arbor Day, etc, to wit: if we know before the problem ever runs which employees are supposed to be working those, what's the recommended approach to pre-setting an employee into those particular shifts before trawling the solution space?
I think you can reuse "immovable planning entities" for this, especially for the second requirement:
  http://docs.jboss.org/drools/release/latest/optaplanner-docs/html_single/index.html#d0e8539
This is of course if you're a 100% sure about specific assignments before the planning starts.
That presumes that those specific assignments are hard constraints. As soon as your business changes it minds and they become soft constraints instead, this way won't work (and you'll need to go your original way).

Apologies if these are naive questions -- I suppose I could/should have started with one of the easier examples, but, well, real world needs and all.

Thanks!

Adam


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users