Editing DefaultAgenda.java file from org.drools.common
by Mallory
Hello,
I would be grateful to receive some help regarding editing Drools engine
source code. I am looking at making the drools engine execute rules parallel
so I went ahead and changed the DefaultAgenda.java source file. On running
this file everything worked perfectly well. I tried to run two different for
loops from 1 to 500 in two different rules and I saw that both threads were
working together.
On the other hand when I make a jar file of this by using the class file for
DefaultAgenda and try to run in a new project I am getting the error below:
java.lang.NoSuchMethodError:
org.drools.RuleBaseConfiguration.getComponentFactory()Lorg/drools/reteoo/ReteooComponentFactory;
at org.drools.common.DefaultAgenda.setWorkingMemory(DefaultAgenda.java:215)
at
org.drools.reteoo.ReteooWorkingMemory.<init>(ReteooWorkingMemory.java:110)
at
org.drools.reteoo.ReteooStatefulSession.<init>(ReteooStatefulSession.java:81)
at
org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:402)
at
org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:387)
at
org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:176)
at
org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:163)
at drools.main.DroolsApi.createKnowledgeBase(DroolsApi.java:38)
at drools.main.TestMain.main(TestMain.java:8)
Can someone please help me fix this issue?
Thanks in advance:)
--
View this message in context: http://drools.46999.n3.nabble.com/Editing-DefaultAgenda-java-file-from-or...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
GC Overhead Limit Exceeded and 1B JoinLeftNode Objects
by Julian Klein
Hi all,
I trying to run Drools Expert with varying sizes of memory, but no matter
how large I go the system continues to thrown OoM Exceptions. As my
application runs memory slowly, but steadily dries up. Perhaps this is
related to the other recent thread regarding memory leaks? I have searched
high and low in the forums with no luck on what could cause this problem.
It seems like a memory leak to me at this point as I have profiled and
found no problems in my code.
How My App Works:
Anyway, my application creates a StatefulKnowledgeSession with ~100 rules,
inserts a 1000 facts, fires all rules, inserts new facts created from the
first run, changes the agenda, fires rules again and then disposes the
session and related resources. It does this in tight loops, thousands of
times. This means there should not be 1B objects floating around in memory
from Drools.
I have thought of a few ways out:
1) reduce the speed at which I create and dispose rule sessions; not ideal
for performance
2) re-using the session though this seems it will cause more memory issues
3) move to stateless knowledge sessions, but for some reason some of my
utility functions fail with this approach.
Any insight would be appreciated.
Thanks,
Julian
11 years, 9 months
Event insert to session with 'not( after this..)'
by RichardAmbridge
If I declare an event like:
declare Signature
@role ( event )
@timestamp(timestamp)
end
where timestamp is a long value set to the System.currentTimestamp()
and if I have a rule that has in it
$s : Signature(name=="YYYY")
not(Signature(name=="XXX", this after [0s,50h] $s))
If i insert a Signature that has name=YYYY, then after 50 hours this rule
will fire.. which is great.
However, we have a situation where sometimes we need to reload all our
rules.
Today, I grab all the Objects from the session
engine.getKsession().getObjects()
and store them in a file (serialize), then recreate the session and reinsert
all the objects again.
However, this resets the time window for the event...
So if i insert Signature with name=YYYY, wait 48 hours, reload the session
then the rule will not fire for another 50 hours, instead of in 2 hours
time.
The value of @timestamp is still set to the original time (48 hours ago) and
if I check
EventFactHandle handle=(EventFactHandle) ksession.insert(s);
handle.getStartTimestamp();
the value of StartTimestamp is set to 48 hours ago..
Is there anyway I can get the rule to fire at the correct time?
Many thanks
Ric
Running Drools 5.3.0
--
View this message in context: http://drools.46999.n3.nabble.com/Event-insert-to-session-with-not-after-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Decision table layouts
by vamsi goli
Hello,
We are trying to incorporate Drools to our architecture and make sure all
rules are separated from our current code base. So I am totally new and I
am working on creating a decision table using the Guvnor Web guided editor.
So my question: I am trying to create a decision table with vertical
layout, I cannot find anywhere in the documentation on how to do it, Our
company has given us some training documentation from redhat which has
sample examples of different decision table layouts but I am unable to find
a way of doing that way.
Please help.
thanks
11 years, 9 months
SimpleScoreCalculator
by André Fróes
Hello, since i'm not moving a step from where I am at dsl rule, I'm trying
to do it with SimpleScoreCalculator, but the same is happening.
------------
public HardAndSoftScore calculateScore(Distributor distributor) {
int hardScore = 0;
int softScore = 0;
for (Engineer e : distributor.getEngineerList()){
long skill = e.getSkillEngineerList().get(0).getSkill().getId();
int requiredWorktime = 0;
long requiredSkill = 0l;
for (WorkOrder o : distributor.getWorkOrderList()){
if (e.equals(o.getEngineer())){
requiredWorktime += o.getRequiredWorktime();
requiredSkill = o.getRequiredSkills().get(0).getSkill().getId();
}
}
int engineerAvailableTime = e.getWorktime() - requiredWorktime;
if (engineerAvailableTime < 0 ){
hardScore += engineerAvailableTime;
}
if (requiredSkill == skill){
softScore += requiredSkill;
}
}
return DefaultHardAndSoftScore.valueOf(hardScore, softScore);
}
------------
wouldn't that have to fit since i'm comparing the 1st attribute of each
skill list from engineers and workorders? And how can I weight which
engineer would be better to a determined workorder if the workorder have
more skills and so does the engineer?
11 years, 9 months
Comparing 2 Lists [Planner]
by André Fróes
Hello everyone!
How can I compare 2 lists with a rule?
I upgraded my basic model to a more complex one now, but now I hit a wall.
My WorkOrder have a List of skills, and my Engineer also have a list of
Skills and I have to compare one with another.
Example:
Engineer A have skill ABC 1
Engineer B have skill ABC 2
Engineer C have skill ABC 3
WorkOrder A needs an engineer with skill ABC 3
WorkOrder B needs an engineer with skill ABC 1
WorkOrder C needs an engineer with skill ABC 2
The result should be this:
Engineer A will receive WorkOrder B
Engineer B will receive WorkOrder C
Engineer C will receive WorkOrder A
---------------
I am able to sort it by time, but not by skill, and I don't know how to
loop over each list to find if one have the skills needed to fulful the
other. These are my classes involved:
WorkOrder attributes:
--------
private int requiredWorktime;
private Priority priority;(enum)
private Severity severity;(enum)
private List<SkillWorkOrder> requiredSkills;
--------
Engineer attributes:
--------
private int worktime;
private String name;
private List<SkillEngineer> skillEngineerList;
--------
Skill attributes:
--------
private String name;
--------
both SkillEngineer and SkillWorkOrder are classes that simple receives the
named class and a Skill:
Eg:
private Engineer engineer; //Or WorkOrder
private Skill skill;
Is it possible to iterate over these 2 lists, by drool rule, to check wich
engineer have most coincidences with an workorder? (Eg: if and Engineer
have skill ABC1, ABC2 and a WorkOrder needs an engineer with skill ABC1,
ABC2 and ABC3 he would be choseng among the others because his skills)
11 years, 9 months