Timer and AgendaFilter
by Kai Ruddies
Hi,
I have a rule with a timer and call fireAllRules(AgendaFilter agendaFilter) with an AgendaFilter. I can see the Activation is fired after the delay but accept(Activation activation) in my AgendaFilter isn't invoked. My AgendaFilter is working well for other rules without timers.
Is this a bug or wanted that ScheduledActivations aren't passed to the AgendaFilter?
I'm using drools expert 5.5.0.Final.
Thanks,
Kai
11 years, 3 months
RightTupleIndexHashTable
by Ming Fang
What is the purpose of RightTupleIndexHashTable?
We are getting the exception below but unable to come up with a self contained unit test to demonstrate the problem.
Caused by: java.lang.NullPointerException: null
at org.drools.core.util.index.RightTupleIndexHashTable.removeAdd(RightTupleIndexHashTable.java:344) ~[drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.drools.reteoo.JoinNode.modifyRightTuple(JoinNode.java:224) ~[drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.drools.reteoo.PropagationQueuingNode$ModifyToSinkAction.execute(PropagationQueuingNode.java:513) ~[drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.drools.reteoo.PropagationQueuingNode.propagateActions(PropagationQueuingNode.java:280) ~[drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.drools.reteoo.PropagationQueuingNode$PropagateAction.execute(PropagationQueuingNode.java:588) ~[drools-core-5.5.0.Final.jar:5.5.0.Final]
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:993) [drools-core-5.5.0.Final.jar:5.5.0.Final]
11 years, 3 months
OptaPlanner: score corruption when using insertLogical with custom objects
by pvandenbrink
Hi,
I've been using Drools Planner with success for a while for our Conversation
planning tool. It's used by schools to plan conversations between teachers
and parents of schoolgoing children.
Recently I checked on the new developments on Drools (the current version
we're using in production is 5.4.0.FINAL) and started to upgrade to
OptaPlanner 6.0.0.Beta5.
Everything looked fine, and seeing how it's now easier to check which
constraints are broken in a given solution, I decided to have a look at that
as well.
And that's where I noticed that we actually had an issue with score
corruption in one of our rules...
The goal of the rule in case is to minimize the amount of timeslots between
the first and last Conversation of a family (they can have conversations for
multiple children.)
The rule uses custom helper objects, like in the NurseRostering example,
which are added with insertLogical.
Conversation is the planning entity, which has the planning variable:
timeslot. FamilyStart and FamilyEnd are custom helper objects to register
the timeslot of the first and last conversation for a family.
The relevant rules are as follows:
rule "familyStart"
salience 1
when
Conversation(
family != null, $family: family,
timeslot != null, $timeslot: timeslot);
not Conversation(
family == $family,
timeslot < $timeslot);
then
insertLogical(new FamilyStart($family, $timeslot));
end
rule "familyEnd"
salience 1
when
Conversation(
family != null, $family: family,
timeslot != null, $timeslot: timeslot);
not Conversation(
family == $family,
timeslot > $timeslot);
then
insertLogical(new FamilyEnd($family, $timeslot));
end
rule "familyCompact"
when
$start: FamilyStart(
family != null, $family: family,
timeslot != null, $timeslotBegin: timeslot);
$end: FamilyEnd(
family == $family,
(timeslot.id - $timeslotBegin.id > family.minimumTimeslotsRequired),
timeslot != null, $timeslotEnd: timeslot);
then
scoreHolder.addSoftConstraintMatch(kcontext, -(($timeslotEnd.getId() -
$timeslotBegin.getId()) - $family.getMinimumTimeslotsRequired()));
end
When running one of my example schedules in FULL_ASSERT mode, the following
error appears during the LocalSearch phase:
Exception in thread "main" java.lang.IllegalStateException: Score
corruption: the workingScore (-2hard/-119soft) is not the uncorruptedScore
(-2hard/-118soft) after completedAction (Teacher 3 family 11 timeslot 2 =>
12):
The corrupted scoreDirector has 1 ConstraintMatch(s) which are in excess
(and should not be there):
defaultpkg/familyCompact/level1/[FamilyEnd Family 11, Timeslot 12,
FamilyStart Family 11, Timeslot 7]=-1
The corrupted scoreDirector has no ConstraintMatch(s) which are missing.
Check your score constraints.
I use a custom ChangeMove and SwapMove implementation. I've also tried using
the new generic Moves, these have the same problem.
It seems like when a move happens that should update an inserted FamilyStart
or FamilyEnd because of a change in timeslot, this change isn't properly
reflected in the scoreDirector.
Do you have any idea what could cause this corruption? The moves do call
beforeVariableChanged and afterVariableChanged on the scoreDirector, and the
FamilyStart and FamilyEnd classes implement an equals and hashcode based on
the Family and Timeslot fields.
(Actually, I've also tried using the default equals and hashcode of Object
for these 2 classes, which causes corruption much faster and with more
ConstraintOccurrences.)
Thanks for any insights,
Pieter
--
View this message in context: http://drools.46999.n3.nabble.com/OptaPlanner-score-corruption-when-using...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
Guvnor seems to copy assets across External RDBMS and file system
by Yuri
I set up SQL Server as the external repository, and left everything else in
guvnor and jboss AS7 configured pretty much according to defaults.
When I create assets in guvnor, I see that changes are being made in the
MSSQL db. Despite changes to the db, however, I'm still seeing changes to
the Repository and Workspace folders. It gets more interesting when I
truncate the tables in the external guvnor db, and restart guvnor, it seems
to get all of its assets back from those two folders.
Am I doing something wrong? Is it reconstructing the assets from lucene
indexes? If MSSQL is already indexing things, is the lucene index still
necessary? Are these basic JCR concepts that I am not grasping?
Thanks, Yuri
11 years, 3 months
Scheduling Application and Optaplanner
by marchias
Just started researching OptaPlanner. Loaded examples in Eclipse and got them
running. I'm interested in extending the Nurse rostering example to work
with a scheduling application I have written. I have some interesting
constraints though that wanted to reach out to the community with to make
sure they can be accomodated. My scheduling app has a hierachical entity
setup with Organizations and child locations. An employee can be configured
to work at multiple locations and are also assigned a "Primary" location
which means they should be picked up on shifts at that location before an
employee that does not have that location as primary. Also I have a priority
group or ranking (1-10) which would be considered in sorting employees as
well. Shifts are location, date/time and skill specific with a configured
amount of resources needed.
Shift Examples
Location 1 = 2 nurses, (Monday Wednesay Friday), 7AM - 11PM
Location 1 = 1 nurse, (Sunday,Tuesday,Thursday,Saturday), 7AM - 11PM
Constraints for an employee
Max Hours/Week: 0.00
Min Hours/Week: 0.00
Max Hours/Day: 0.00
Min Hours/Day: 0.00
Max Days/Week: 0.00
Max Consecutive Days: 0.00
Max Shifts/Day: 0.00
Max Shifts/Month: 2.00
Max Weekend Shifts/Month 0.00
Max Consecutive Shifts of Duration 0.00 consecutive 0.00 hr shifts
--
View this message in context: http://drools.46999.n3.nabble.com/Scheduling-Application-and-Optaplanner-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
decision and prediction based on the same set of rules
by Sean Su
Our rules will be using "Date" heavily when making decisions. When the LHS
involving dates is evaluated "true", decision will be made.
Meanwhile, from prediction point of view, we want to know when the LHS
would be evaluated to false, with the changes made to the date fields
(forward to the future). Therefore this becomes prediction - what is the
future date that would cause the LHS to be false.
Question to the list:
has anyone explored the possibility of using the same set of rules to
achieve both tasks?
If there is no tools automatically doing this in Drools (I doubt there is),
I am thinking to build a tool to parse the rules and then auto-generate the
prediction rules based on the "decision" rules. Is this the right direction?
Any inputs will be appreciated.
thanks
Sean
11 years, 4 months
uninformative rule parsing/compiling error -> org.drools.rule.Rule cannot be cast to org.drools.rule.Query
by De Rooms Brecht
Dear rules users,
I am currently writing my own Drools-server since I wanted more control
than the drools-execution server (and it never worked very well here)
where I can send rules/facts over JMS/AQMP/STOMP. Rules which are sent
are saved on the server-side in DRL files that are monitored. That way,
I can debug easily by changing the sent files. However, when I sent the
following code, the agent does not provide me with an error message at
all and hangs:
/
//rule "TrackerRemote.TrackerUpdate"//
// when//
// message:TrackerRemote.TrackerUpdate()//
// then//
// System.out.println("Tracker: " + message);//
//end/
at first I thought it was because TrackerRemote.TrackerUpdate is not in
that package anymore and thus unknown so I tried to send the rule listed
below which gives me the nice and expected error:
Unable to resolve ObjectType 'NotExistingType' : [Rule name='Foo']
/rule "Foo"//
// when //
// NotExistingType( bloe == "test")//
// then//
// System.out.println("this should not work");//
//end/
when I compile the rule myself with a KnowledgeBuilder:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
InputStream is = new ByteArrayInputStream(drlstring.getBytes());
kbuilder.add( ResourceFactory.newInputStreamResource(is),ResourceType.DRL );
I receive the error:
org.drools.rule.Rule cannot be cast to org.drools.rule.Query
which I think doesn't tell me anything about the mistake I made in my
rule, is this a Drools bug and should I post this somewhere?
Kind Regards,
De Rooms Brecht
Full Stack:
java.lang.ClassCastException: org.drools.rule.Rule cannot be cast to
org.drools.rule.Query
at
org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:175)
at
org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:118)
at
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:67)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:84)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2706)
at
org.drools.compiler.PackageBuilder.compileRules(PackageBuilder.java:930)
at
org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:839)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:831)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:467)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:673)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:45)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
at
derooms.be.server.listeners.RulesListener.processMessage(RulesListener.java:33)
at
derooms.be.server.listeners.AbstractListener.onMessage(AbstractListener.java:35)
at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1321)
at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)
at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
11 years, 4 months
NullPointerException when updating a fact
by schenka7
Hi dear drools team,
I've got a strange problem and hope someone can help me. I'm using drools
5.5.0.
I have some rules to validate user input. These will set the valid flag on a
fact to false and insert a Message fact into working memory that will
contain a message and a reference to the causing fact.
I also have a rule to retract Messages for facts which are not invalid
anymore.
I observe a NullPointerException originating at
DefaultAgenda.createActivation() when I perform following steps:
Insert a valid FirstName and call session.fireAllRules().
Change the FirstName to become invalid, call session.update() on it and call
session.fireAllRules().
The rule for retracting messages is the cause for the problem.
My question is, how can I fix it? Or is there a better way to manage error
messages?
Thank you
--
View this message in context: http://drools.46999.n3.nabble.com/NullPointerException-when-updating-a-fa...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 4 months
Controlling Rule Execution
by jking527467
All,
I'm new to Drools and I'm faced with what seems to be a pretty trivial task
that's taken a lot longer than expected.
I'm working mainly with distances and am looking for an plain English
response to this trivial problem.
Here's the problem:
- Activate all things within x miles.
- If nothing is within x miles, activate all things within y miles.
It seems pretty straight forward but here's my dilemma. If I execute on y
miles first, everything within x miles will also be activated. I need to
ensure the things between x and y miles aren't activated if anything is
within x miles of a certain fact.
Does this make any sense to anyone? I'm have a hard time grasping the
proper approach and have looked into activation groups, etc. but haven't had
any luck.
Any help is GREATLY appreciated!!!
Thanks in advance!
Jason
--
View this message in context: http://drools.46999.n3.nabble.com/Controlling-Rule-Execution-tp4025231.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 4 months