Droold 5.4.0
by hare ram
Hi All,
I am newbie to Drools. I just downloaded drools-distribution-5.4.0.Final.
If I look at the binaries directory.
there are lots of jar files in it. I want to know what the minimum set of
jars i need to include in my classpath
to compile and run simple drl file.
Thanks
11 years, 11 months
DROOLs callback API for L-value predicate matching events
by Cotton, Ben
Hi, Can someone please point me to compelling examples/sample code of how to use a DROOLs callback API for very high-resolution logging of L-value predicate matching events?
E.g. I want to be able to log when each of these 5 L-value predicates either "MATCHES" or "FAILS TO MATCH" (at the time of the event)
rule "LCHUS_IRS_CURRENCY_RULE" //XLS Item=195
when
IRDCurrencyRuleFact(
productType == "IRS",
currency=="GBP",
upfrontFeePaymentDate < IRDCurrencyRuleFact.terminationDate,
maturity <= 18275, //unit = days, i.e. 50 Years
notional <= 99,999,999,999.99 //max Notional
)
then
System.out.println("LCHUS");
end
Ben D Cotton III
Morgan Stanley & Co.
OTC Derivatives Clearing Technology
1221 AOTA Rockefeller Ctr - Flr 27
New York, NY 10020
(212)762.9094
ben.cotton(a)ms.com<mailto:ben.cotton@ms.com>
________________________________
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
11 years, 11 months
Re: [rules-users] debug
by Kevin Kelleher
Hi,
As I see it , this is a big problem.
I was looking at drools about 10 months ago (5.3.0 Final) and debug worked
just fine ... ... so similar to earlier comment of Bruno here.
Today I downloaded drools 5.5.0 Final & eclipse Juno and debug is broken
...
Can we expect a patch? I can't see how we could proceed if this issue is not
resolved.
Any suggestions welcome.
Regards,
Kevin
--
View this message in context: http://drools.46999.n3.nabble.com/debug-tp3889772p4021012.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 11 months
Mixing Drools language and Java implementions without performance loss
by Oliver Libutzki
Hello everyone,
as I try to find the best solution for a scheduling problem Drools
Planner seems to be the perfect fit.
Instead of using drl files I want to implement the rules in Java, but I
still would like to use the power of Drools (Planner) to find the best
solution as fast as possible.
My first attempt is to use the Description API (Examples:
https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test...).
This might work, but I wonder if I really have to write the whole rule
this way. Of course I can use "eval" Expressions to integrate Java code,
but I would like to know how expensive this is in certain situations.
So, which information does Drools use to optimize the algorithm?
An example taken from the Test class I mentioned:
.lhs()
.pattern("StockTick").constraint("company ==
\"RHT\"").end()
.end()
I guess it's important to select the StockTick by using the pattern. But
what about the company criteria? Is using the constraint faster than
invoking a method like "checkType"?
.lhs().pattern("StockTick").name("myStockTick").eval().constraint(
"checkCompany(myCheese, \"RHT\"").end()
.end()
In general, I would like to know which parts can be implemented in
"secret Java" which the drools compiler doesn't know and which parts
should be implemented by using the explicit descr api elements in order
to use the full power of the Drools engine. Thanks for your answers!
Kind regards Oliver
11 years, 11 months
Different results with same fact base
by raffi
Hi,
I have a strange behavior with the Drools Expert 5.5.0. After running the
main class few times in a row, the results suddenly differ from the ones
before it. That means there are somtimes 3, 4 or 5 results shown in console.
I am using a statefulknowledgesession. Inserting of all facts is done with
normal java lists. For my last type of facts I insert one, call
fireAllRules(), and retract it again. Showing in console is solved with
queries. At the end I'm calling the dispose()-method. I added it to see if
there is a change in behavior. But with or without it there is the same
problem with different results after few directly runnings.
Rules and queries are defined in a drl-file and loaded via
knowledgebuilder's add()-method. I am working with eclipse and of course the
plugin for it.
Could it be a problem with something memory like (in a way like a cache or
similar to the garbage collection)?
I hope with this short explanation you can give me a feedback. If not its
not problem to describe in a more detailed way.
Thank you.
--
View this message in context: http://drools.46999.n3.nabble.com/Different-results-with-same-fact-base-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 11 months
drools grid or other high availability solution?
by Justin Case
Hello all,
I noticed there's not much fuss about drools-grid (anymore?). Is there something still going on there? Is it recommendable for something reliable?
Or if not, do you have any hints/links/experience on how to achieve a certain high availability level with DRools servers?
Many thanks,
JC
11 years, 11 months
DROOLs 'Guarded entry/block' tactics for Rules synchronization and ordinality?
by Cotton, Ben
Hi,
I have finally gained a tiny bit of control (and maybe even some competency) in using the DROOLs language operators 'no-loop' and 'lock-on-active' as a basis for controlling rule set firing behavior in response to Fact mutation events (during consequence processing).
I now want to (competently!) use DROOLs language tactics that give me ever finer grained control over managing rule set firing behavior on Fact mutation events. Specifically, I want to be able to implement some form of 'Guarded entry/block' controls.
E.g. let's say I have a Fact (InsertedFactPOJO) that I insert into the KS and want to have its 'fireAllRules()' AgendaSet(s) renedered in exact incremental ordinal stages and in perfect isolation. To do this, I am testing the inclusion of a 'countdownLatch' Semaphore reference as a Fact member (initialized to N=`total rule count` value). I then use this to 'Guard' individual rule entry, by generating an explicit predicate participant
(InsertedFactPOJO(countdownLatch == i) )
@ each ith Rule producedby my template.
Is this approach a valid/sound/complete way to implement 'Guarded entry/block' controls in DROOLs? Is there a better way?
As always, my sincerest gratitude to this community for its generosity (and its genius).
Ben
package com.ms.fast.triclear.eligibility.rules.drools_community.questions.posted;
import com.ms.fast.triclear.eligibility.InsertedFactPOJO;
//fact:(backed by Class 'InsertedFactPOJO' has
//- 'countdownLatch' (Semaphore) member
//- 'aList' (List)member
rule "RULE_ALL_RULES_HAVE_FIRED_ONCE_ORDINALLY"
when
fact:InsertedFactPOJO()
InsertedFactPOJO(countdownLatch == 0)
then
System.out.format("\tALL RULES have fired *EXACTLY* once, *EXACTLY* ordinally. "+
" fact.countdownLatch=%d \n\t fact.aList=%s\n\n",
fact.countdownLatch,
fact.aList.toString());
end
rule "RULE_3"
when
fact:InsertedFactPOJO()
InsertedFactPOJO(countdownLatch == 3)
//bunch of other L-Value PREDICATES
then
System.out.format("\t %20.20s"+
" \t(DROOLS agenda: consequence fired for L-value predicate match @RULE="+
"3"+" -- fact.countDownLatch=%d)\n", "Rule 3",fact.countdownLatch);
modify (fact) {
countdownLatch = fact.countdownLatch - 1,
aList.add("Rule 3 pattern-match event added to POJO 'aList' field");
}
end
rule "RULE_2"
when
fact:InsertedFactPOJO()
InsertedFactPOJO(countdownLatch == 2)
//bunch of other L-Value PREDICATES
then
System.out.format("\t %20.20s"+
" \t(DROOLS agenda: consequence fired for L-value predicate match @RULE="+
"2"+" -- fact.countDownLatch=%d)\n", "Rule 2",fact.countdownLatch);
modify (fact) {
countdownLatch = fact.countdownLatch - 1,
aList.add("Rule 2 pattern-match event added to POJO 'aList' field");
}
end
rule "RULE_1"
when
fact:InsertedFactPOJO()
InsertedFactPOJO(countdownLatch == 1)
//bunch of other L-Value PREDICATES
then
System.out.format("\t %20.20s"+
" \t(DROOLS agenda: consequence fired for L-value predicate match @RULE="+
"1"+" -- fact.countDownLatch=%d)\n", "Rule 1",fact.countdownLatch);
modify (fact) {
countdownLatch = fact.countdownLatch - 1,
aList.add("Rule 1 pattern-match event added to POJO 'aList' field");
}
end
Ben D Cotton III
Morgan Stanley & Co.
OTC Derivatives Clearing Technology
1221 AOTA Rockefeller Ctr - Flr 27
New York, NY 10020
(212)762.9094
ben.cotton(a)ms.com<mailto:ben.cotton@ms.com>
________________________________
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
11 years, 11 months
Drools Planner: Planning variable gets assigned value out of valueRange
by mr_moe
Hey,
I have a planning entity, which has one planning variable called startDate.
This variable has a defined discrete value range which is a list of numbers
of the type long. Every number represents a timestamp, which is in between
the number firstPossibleStartDate and lastPossibleStartDate.
During the planning process, the number 0 is sometimes assigned to the
planning variable which is definitely not part of the valueRange. I’ve
printed the list to the console, but all values in the list are fine.
Because every planning entity has its own valueRange, the range is defined
in the entity itself.
At the moment I’ve implemented my own mover, but the problem occurs also
with pre-configured mover.
During my research I’ve stumbled upon the following note in the Planner
Documentation:
ValueRange from planning entity is currently not yet supported by the new
MoveSelectors.
Does this has something to do with my problem?
Enclosed you will find the code of the planning entity.
@PlanningEntity
public class DroolTask {
private List<Long> startDateList;
private int id;
private String name;
private long duration;
private long firstPossibleStartDate;
private long lastPossibleStartDate;
private String nextTask = "";
private String previousTask = "";
// Planning variables: changes during planning, between score calculations.
private long startDate;
@PlanningVariable
@ValueRange(type = ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY,
planningEntityProperty = "startDateList")
public long getStartDate(){
return startDate;
}
public void setStartDate(long startDate){
this.startDate = startDate;
}
public List<Long> getStartDateList(){
return this.startDateList;
}
public void setStartDateList(){
startDateList = getPossibleStartDate();
}
public List<Long> getPossibleStartDate(){
startDateList = new ArrayList<Long>();
for(long i = firstPossibleStartDate; i<=lastPossibleStartDate; i = i +
60){
startDateList.add(i);
}
return startDateList;
}
public Long getFirstPossibleStartDate(){
return firstPossibleStartDate;
}
public void setFirstPossibleStartDate(long firstPossibleStartDate){
this.firstPossibleStartDate = firstPossibleStartDate;
}
public Long getLastPossibleStartDate(){
return lastPossibleStartDate;
}
public void setLastPossibleStartDate(long lastPossibleEndDate){
this.lastPossibleStartDate = lastPossibleEndDate;
}
[...]
public DroolTask clone(){
DroolTask clone = new DroolTask();
clone.name = name;
clone.duration = duration;
clone.firstPossibleStartDate = firstPossibleStartDate;
clone.lastPossibleStartDate = lastPossibleStartDate;
clone.startDate = startDate;
clone.nextTask = nextTask;
clone.previousTask = previousTask;
clone.startDateList = startDateList;
return clone;
}
[...]
}
It would be great, if someone could give me a hint.
Many thanks,
Moe
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-Planning-variable-gets-a...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 12 months
Re: [rules-users] Setting value in LHS for access in RHS
by Stephen Masters
You got it this time ... I'm trying to inspect the field name. As you mention there's a risk that a user could pick a mismatched RHS consequence, so I was hoping to work some DRL magic to avoid that.
So I think I'll get around it by extending my facts and populating them each with the value they should use. It means a lot more up-front calculations, but its probably the safest way.
Michael Anstis <michael.anstis(a)gmail.com> wrote:
>_______________________________________________
>rules-users mailing list
>rules-users(a)lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
11 years, 12 months