Re: [rules-users] [planner] Questions about employee shift rostering example
by Geoffrey De Smet
[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
>
>
15 years, 11 months
[planner] taboo list question
by dmzpippo-drools@yahoo.it
Hi Geoffrey,
I'm
sorry but I have not had time to find a stable solution for
diversification, I must conclude my thesis by April and I have not
much time. For now I solved by calculating a value of penality in the move. But after graduation I will be happy to try to tackle the problem in a more efficient way :-)
Doing a bit of debugging I noticed that either do not exclude the right moves.
I try to explain better my problem. I have M vehicles and each has its own id (0, M-1). I have N customer and each of them has its own id (0,N-1). IDs are integer values.
A
move is uniquely identified by a triple of integers: the id of the
customer, the id of the source vehicle and the id of the target vehicle.
(Customer_id, source_route_id, destination_route_id)
when I make this move I would consider taboo all the moves that report the customer in the source vehicle.
If for example I have 5 vehicles and 20 customer a move could be:
(6,0,1)
so I would avoid all the moves of return, namely:
(6,1,0), (6,2,0), (6,3,0), (6,4,0);
I tried to do as you have suggested me (again if I understood correctly!)
public Collection <? extends Object> getTabuProperties () (
return Arrays. <Integer> asList (customer_id, source_route_id);
)
Only in this way excludes me all the moves that involve the customer and the vehicle source even if taken separately.
Ex: I esculde also draws (6,1,4) or
(7,0,3)
Thank you from now for all the help you gave me already.
regards,
Marco
15 years, 11 months
Usage Question
by Glenn Macgregor
Hi All,
I am in the process of evaluating Drools to use in a networks & systems management project. Some of the initial use cases are listed below.
Use Cases:
1. Simple single parameter thresholds with configurable warning and error levels.
2. Simple multi parameter thresholds from one host with configurable warning and error levels.
3. Complex multi parameter thresholds from multiple hosts with configurable warning and error levels.
4. Complex time based multi parameter thresholds from multiple hosts with configurable warning and error levels.
After reading about the Drools rules engine (Expert) and the CEP (Fusion) it seems at a glance that it would be very useful in this application. As I digging into use case 1 I am not sure Drools is actually going to fit the bill as first thought.
Imagine a small network with 300 hosts each of which is being polled for CPU data which can be massaged to produce an instantaneous CPU Utilization which I want to check against some threshold, which can be different for each host. I don't see creating 300 rules to handle this simple case as an ideal solution as I need to give control of the CPU Utilization threshold to the teams who own the hosts. Thinking about how to abstract that I imagine I could put the thresholds into a database and rebuild/reload the rules as necessary but as the thresholds could change often this seems like unnecessary overhead. I have moved on from that solution to the idea that a threshold is an attribute of the parameter as name and value are attributes. This allows me to attach the threshold value to the parameter update and potentially have a Drools rule something like (not a working rule):
rule "test rule"
when
$param : Parameter(name == someName) # comes from some map of params or something, not sure yet.
$param(value >= warningThreshold)
then
# Fire warning alert
end
Where value and warningThreshold are members of the Parameter object.
Having thought about this and discussed with some colleagues we can not impose a '>=' in the rule as some teams might what a different set of comparators. Moving on to these new requirements I thought we could have all the info encapsulated into the Parameter object as a set of functions:
* isInWarning
* isInError
rule "test rule"
when
$param : Parameter(name == someName) # comes from some map of params or something, not sure yet.
$param.isInWarning()
then
# Fire warning event
End
Questions:
* Is the above possible in Drools?
* What does Drools get me as my software is already doing all the calculation and comparison work?
* Is there a better way to handle this using Drools?
Thanks for the reply's
Glenn
15 years, 11 months
Flow Work Items - SOAP
by Swindells, Thomas
Does drools have a work item which is able to act as a client to a soap service?
Also what other work items dose flow support and where is it documented. In eclipse I just see work items for email and log but on the main drools flow page (http://jboss.org/drools/drools-flow.html) it mentions a whole list of work items (finding files, ftp, rest, rss etc) some of which are also mentioned in an old post here (http://blog.athico.com/2008/08/more-declarative-workflow.html) but I can't find any details anywhere about where to get them or how to use them.
Thanks,
Thomas
________________________________
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster(a)nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
________________________________
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster(a)nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.
To protect the environment please do not print this e-mail unless necessary.
An NDS Group Limited company. www.nds.com
15 years, 11 months
Stumped by error in rule
by Tom.E.Murphy@wellsfargo.com
After all this time working with Drools 5.0.1, I thought I'd figured out all the ways my syntax could fail, but this one has me stumped.
Any help would be appreciated.
I have the following rule:
rule "RS6051.1.2_"
dialect "mvel"
when
Applicant ( $ApplicantNumber : ApplicantNumber )
not ( ScoreCard (name == "Context test", contextId == $ApplicantNumber) )
then
ScoreCard scoreCard = functions.getScoreCardManager().newScoreCard();
scoreCard.setName("Context test");
scoreCard.setContextId($ApplicantNumber);
insert(scoreCard);
end
I'm getting the following error on this rule during compilation:
Unable to create Field Extractor for 'ApplicantNumber' : [Rule name='RS6051.1.2_']
org.drools.RuntimeDroolsException: Field/method 'ApplicantNumber' not found for class 'com.wellsfargo.service.provider.sse.decisioning.x2009.Applicant'Unable to build expression for 'consequence': null '
And here is (part of) the Applicant class in question:
package com.wellsfargo.service.provider.sse.decisioning.x2009;
public class Applicant
{
public Short getApplicantNumber()
{
return applicantNumber ;
}
public void setApplicantNumber(Short applicantNumber)
{
this.applicantNumber = applicantNumber;
}
Short applicantNumber;
}
And This is (part of) the ScoreCard class:
public class ScoreCard
{
public void setName(String name) { this.name = name; }
public String getName() { return name; }
public int getContextId(){return contextId;}
public void setContextId(int id){contextId = id;}
private String name;
private int contextId;
}
Why am I getting this error?
Help!
Thanks
Tom Murphy
15 years, 11 months
Enum in Drools 4.0.7 don't work for me
by My tria
Hi all,
I've a problem with the enumeration (combo-drop down box) in Drools 4.0.7
BRMS.
I've do this steps:
--> Create an enumeration type:
'ChannelInputMessage.priority.hardcore' : ['Error=error',
'Warning=warning', 'Fatal=fatal']
--> Create the DSL and so invoce the enumeration:
[condition][MailChannelConfiguration]Per ogni messaggio di errore con
canale
mail=$mailChannelConfiguration:MailChannelConfiguration()
[condition][ChannelInputMessage]avente: = ChannelInputMessage()
[condition] - cliente {'customerValue'} = customer=="{'customerValue'}"
[condition] - processo {'processValue'} = process=="{'processValue'}"
[condition] - categoria {'categoryValue'} esempi business,it =
category=="{'categoryValue'}"
[condition] - priorita {priorityValue:ENUM:Priority} =
priority.hardcode == "{priorityValue}"
[consequence][MailChannelConfiguration]invia al destinatario:
{'recipient'} =
$mailChannelConfiguration.addRecipient("{'recipient'}");
--> The problem accours when I try to define the rule with the guided editor
http://n3.nabble.com/file/n196342/screen-rule.png
The editor appears without the Enumeration tab, but only write in the text
field the string "priorityValue:ENUM:Priority"
PLEASE HELP ME IT'S VERY IMPORTANT
THANKS IN ADVANCE
--
View this message in context: http://n3.nabble.com/Enum-in-Drools-4-0-7-don-t-work-for-me-tp196342p1963...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
Configuring the target/language level when compiling drools.
by Brice Figureau
Hi
Is there a way to set the target level (ie jdk 1.5) when building a
rules package (especially with the drools-ant task)?
Browsing the source code, I found the drools.dialect.mvel.langLevel (and
same for java), but settings those in ant doesn't seem to do the trick:
building the rules under jdk1.6 produces 1.6 target classes which can't
be reloaded again with jdk1.5.
Thanks,
--
Brice Figureau
My Blog: http://www.masterzen.fr/
15 years, 11 months
Order process example description
by Hitoshi Ozawa
Would appreciate info on where I can find explanation of the order
process example. I've looked in the Rules Reference and Drool Flow and
it seems the explanation is not in there.
I'm not sure where the second window is being displayed from.
H.Ozawa
15 years, 11 months
Dynamic Rules
by Glenn Macgregor
Hi All,
Just getting started using Drools and I have a question about dynamic rules. I have written a simple application based on one of the tutorials.
Rule:
rule "basic rule"
when
Account($balance : balance < 100)
then
System.out.println("Account balance: " + $balance + " is less than 100");
end
This rule works fine in my test application but is there a way to replace the static 100 with a dynamic value like, AccountRulesConfig.lowBalance, basically testing against the value of another object rather than a static value?
Thanks
Glenn
15 years, 11 months