[CC'd to the user list]
Hi Samuel,
Happy new year and all the best for you and your family.
Happy
new year too :)
As you can see below, I tried posting a message on the mailing list
but
unfortunately I am not authorized.
If that doesn't work out (it should!), try
the
nabble.com forum or the
gmane.org newsgroup:
http://n3.nabble.com/Drools-User-f47000.html
I use
gmane.org myself from Thunderbird.
Geoffrey, I saw a paper on the trunk of drools planner where you
address
the issue about employee shift rostering.
There is no source, I don't know what level of thinking you're in, but I
have two questions:
I haven't made an example of employee shift rostering (or bin packaging
or vehicle routing) yet.
Employee shift rostering is closely related too curriculum course
scheduling,
so I advice to get to know the curriculum course example inside and out :)
Drools (Planner) is kinda like JPA:
you can model your domain pretty much how you like,
but how you model your domain can impact the complexity of your rules (~
JPA-QL's).
Don't make your domain too smart to help your first rules,
because it will strangle rules (and even moves) you implement later.
Keep your domain on low level details.
"Each shift has for each specialism a minimal staff size"
how do you manage the team size ?
Is there a list of people in the Shift object ? Or an accumulate function
in the rule ?
I'd say: experiment with both and let me know which works best :)
Until now, I 've always gone for the "accumulate function in a rule"
manner.
I strongly believe in keeping the domain diagram very simple:
http://beta.parleys.com/#id=1714&st=5&sl=14
So only one "red class".
Only one class that the moves change, only one class that you need to
tell the working memory that has changed.
I believe (and I think I 've seen) that this improves delta based score
calculation.
The problem is that some rules, require to check the sum of thing and
you need an accumulate,
like this rule in examinationScoreRules.drl:
rule "roomCapacityTooSmall" // TODO improve performance, as it takes 50%
of the performance
when
$period : Period();
$room : Room($capacity : capacity);
$totalStudentSize : Number(intValue > $capacity) from accumulate(
Exam(period == $period, room == $room, $studentSize :
topicStudentSize),
sum($studentSize) // Vote for
http://jira.jboss.com/jira/browse/JBRULES-1075
);
...
And Drools 5.0's forward chaining becomes backward chaining once you do
this.
Forward chaining = delta based score calculation.
Backward chaining = NO delta based score calculation.
The answer is "true modify", which mark is working on, but probably
won't make 5.1 I fear.
http://blog.athico.com/2010/01/rete-and-true-modify.html
https://jira.jboss.org/jira/browse/JBRULES-2240
Despite that, I still go for "accumulate function in a rule" each time
and take the performance hit.
Meanwhile I poke Mark :)
Remember: StartingSolutionInitializer and
relativeSelection/absoluteSelection bring far greater peformance rewards.
The "a list of people in the Shift object" approach might be better
untill "true modify"'s been solved,
but I believe it hurts your design in the long run.
But do experiment with both approaches, I 'd love to get some feed-back
on this.
"minimal 35 hours rest each week"
How do you check that constraint ? Is there a week object that you parse to
check that there are 2 consecutive days each week? Or is that the generated
movements already meet this hard constraint ?
How do you define a week? From monday to monday or any 7 days in a row?
In either case, just search for a pattern where that does _not_ happen.
It does depend on how you modeled your domain, I 'd have to see the code
in detail.
Take a look at this rule:
// CurriculumCompactness: Lectures belonging to a curriculum should be
adjacent
// to each other (i.e., in consecutive periods).
// For a given curriculum we account for a violation every time there is
one lecture not adjacent
// to any other lecture within the same day.
// Each isolated lecture in a curriculum counts as 2 points of penalty.
rule "curriculumCompactness"
when
$curriculum : Curriculum();
$lecture : Lecture(curriculumList contains $curriculum,
$day : day, $timeslotIndex : timeslotIndex
);
not Lecture(curriculumList contains $curriculum,
day == $day, timeslotIndex == ($timeslotIndex - 1)
);
not Lecture(curriculumList contains $curriculum,
day == $day, timeslotIndex == ($timeslotIndex + 1)
);
then
insertLogical(new
IntConstraintOccurrence("curriculumCompactness",
ConstraintType.NEGATIVE_SOFT,
2,
$lecture, $curriculum));
end
PS: next week I 'll be presenting Drools Planner in a Lille JUG.
With kind regards,
Geoffrey De Smet
Samuel Deballon schreef:
> Hello Geoffrey,
>
Happy new year and all the best for you and your family.
>
As you can see below, I tried posting a message on the mailing list
but
unfortunately I am not authorized.
>
> I sent an email to the administrator, but until you can answer questions in
> the email below.
>
> Note : I'll post the discussion once I have access.
> Do not worry I understand if you do not respond (I have not forgotten the
> remarks in your previous mail)
>
> If my questions aren't specific enough, let me know.
>
> In any case, thank you in advance for your response..
>
> With kind regards,
>
> Samuel Deballon
>
> CSC • This is a PRIVATE message. If you are not the intended recipient,
> please delete without copying and kindly advise us by e-mail of the mistake
> in delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit written
> agreement or government initiative expressly permitting the use of e-mail
> for such purpose • CSC Computer Sciences SAS • Registered Office: Immeuble
> Le Balzac, 10 Place des Vosges, 92072 Paris La Défense Cedex, France •
> Registered in France: RCS Nanterre B 315 268 664
> ----- Forwarded by Samuel Deballon/FRA/CSC on 14/01/2010 16:30 -----
> |------------>
> | From: |
> |------------>
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
> |rules-users-owner(a)lists.jboss.org
|
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
> |------------>
> | To: |
> |------------>
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
> |Samuel Deballon/FRA/CSC@CSC
|
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
> |------------>
> | Date: |
> |------------>
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
> |14/01/2010 10:24
|
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
> |------------>
> | Subject: |
> |------------>
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
> |[Drools-planner] : Questions about employee shift rostering example
|
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|
>
>
>
>
>
> You are not allowed to post to this mailing list, and your message has
> been automatically rejected. If you think that your messages are
> being rejected in error, contact the mailing list owner at
> rules-users-owner(a)lists.jboss.org.
>
>
> ----- Message from Samuel Deballon <sdeballon(a)csc.com> on Thu, 14 Jan 2010
> 10:26:06 +0100 -----
>
> To: rules-users(a)lists.jboss.org
>
> Subject: [Drools-planner] : Questions about employee shift
> rostering example
>
>
>
> Hi all, Hi Geoffrey,
>
> Geoffrey, I saw a paper on the trunk of drools planner where you address
> the issue about employee shift rostering.
> There is no source, I don't know what level of thinking you're in, but I
> have two questions:
>
> "Each shift has for each specialism a minimal staff size"
> how do you manage the team size ?
> Is there a list of people in the Shift object ? Or an accumulate function
> in the rule ?
>
> "minimal 35 hours rest each week"
> How do you check that constraint ? Is there a week object that you parse to
> check that there are 2 consecutive days each week? Or is that the generated
> movements already meet this hard constraint ?
>
> Thanks in advance for your answer,
>
> Samuel
>
>
> CSC • This is a PRIVATE message. If you are not the intended recipient,
> please delete without copying and kindly advise us by e-mail of the mistake
> in delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit written
> agreement or government initiative expressly permitting the use of e-mail
> for such purpose • CSC Computer Sciences SAS • Registered Office: Immeuble
> Le Balzac, 10 Place des Vosges, 92072 Paris La Défense Cedex, France •
> Registered in France: RCS Nanterre B 315 268 664
>
>