[Drools Planner] Multi depot CVRP / CVRPTW
by Mats Norén
Hi,
I've been looking at the VRP example in Drools and I'm thinking about using
it for multi depot cvrp and / or capacitated vrp with time windows.
Has anyone else tried planner for these use cases and can maybe shed some
light on their implementation?
Regards,
Mats
11 years, 7 months
Upgrade options and considerations
by Lance Leverich
My company started out using Drools/Guvnor v5.1.1, for a single
product/project. Later, we decided to start building an enterprise oriented
service, which was partially completed and is based upon Drools/Guvnor
v5.3.0.
Recently, the decision has been made to get all of our Drools/Guvnor
instances running the same version. I ran into issues (mostly related to
dependencies and the use of rule-flows) when I initially attempted to just
get everything running on v5.3.0. But those issues seem to have all gone
away when I replaced my rule-flows with BPMN's and moved everything to a
v5.3.5 instance.
My question, for this group, is whether there are good reasons to move even
further forward and upgrade everything to v5.4.x? If so, what might those
reasons be? Are there any known, significant, issues in one or more of the
5.4 versions? Is there any consensus on which patch version of the 5.4 tree
would be best? I have already been told by upper management that they would
not support moving to v5.5.x, so that's not even on the table.
Any feedback would be appreciated.
Lance Leverich
11 years, 7 months
Drools and Hadoop
by gboro54
We basically have a batch application which needs to be able to pump through
2 billion records and apply a relatively small ruleset(say a couple hundred
rules). My thought is to look at doing something with Drools and Hadoop but
I am wondering if anyone else has done a large dataset such as this(I have
watched the video on large data drools and it has some good ideas but I am
wondering if there is any other experiences).
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-and-Hadoop-tp4023329.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
newbie: getWorkingMemoryEntryPoint returns NULL
by Itai Frenkel
Hello,
I've got the following basic code that sets up drools in STREAM mode, with a pseudo clock.
And it fails on the last line that asserts there is an entrypoint named "testEntryPoint".
The DRL file references the entry-point which according to the documentation is enough.
What am I missing?
Itai
declare Message
@role(event)
@timestamp(timestamp)
end
declare AppInfo
@role(event)
@timestamp(timestamp)
end
rule "Change message type after one minute"
dialect "mvel"
when
$appinfo:AppInfo() from entry-point "testEntryPoint"
$message:Message( type == "before", $msgtext : msgtext, this after[ 1m ] $appinfo )
from entry-point "testEntryPoint"
then
System.out.println( $msgtext );
modify ( $message ) {
type = "after"
}
end
private void initDrools() {
KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
// Stream mode allows interacting with the clock (Drools Fusion)
config.setOption(EventProcessingOption.STREAM);
kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
// this will parse and compile in one step
kbuilder.add(ResourceFactory.newClassPathResource(RULE_FILE, DroolsExpertTest.class), ResourceType.DRL);
// Check the builder for errors
assertThat(kbuilder.hasErrors())
.overridingErrorMessage(kbuilder.getErrors().toString())
.isFalse();
// get the compiled packages (which are serializable)
Collection<KnowledgePackage> pkgs = kbuilder.getKnowledgePackages();
// add the packages to a knowledgebase (deploy the knowledge packages).
kbase.addKnowledgePackages(pkgs);
KnowledgeSessionConfiguration conf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
conf.setOption(ClockTypeOption.get("pseudo"));
ksession = kbase.newStatefulKnowledgeSession(conf,null);
clock = ksession.getSessionClock();
entryPoint = ksession.getWorkingMemoryEntryPoint("testEntryPoint");
assertThat(entryPoint).isNotNull();
}
11 years, 7 months
Drools beginner - unable to resolve method using strict-mode
by Stefan Schuster
Hi,
I'm new to drools, and I made my first steps using the very nice
video-tutorial "Build Pong in 13 minutes using JBoss Drools" found here:
http://www.youtube.com/watch?v=Omj4PR3v-nI
Eclipse shows building errors, but Pong start anyway. What does this error
mean?
in move.drl there is following rule:
*<rule "Move Bat Up" timer(expr: bat.speed, bat.speed) no-loop when*
* ui : PongUI( ready == true )*
* ( KeyPressed( keyText == "A" ) and bat : Bat( playerId ==
PlayerId.PlayerOne, y > pconf.padding + pconf.sideLineWidth )*
* or*
* KeyPressed( keyText == "K" ) and bat : Bat( playerId ==
PlayerId.PlayerTwo, y > pconf.padding + pconf.sideLineWidth ) ) *
* td : TableDirty( ) *
*then *
* tableG = ui.getTablePanel().getTableG();*
* tableG.setColor( Color.BLACK ); // background*
* tableG.fillRect( bat.x, bat.y, bat.width, bat.height );*
* *
* modify( bat ) { y = bat.y - 2 };*
* tableG.setColor( Color.WHITE ); // background*
* tableG.fillRect( bat.x, bat.y, bat.width, bat.height ); *
* modify( td ) { dirty = true };*
*end*
the error message is:
[Error: unable to resolve method using strict-mode:
org.drools.spi.KnowledgeHelper.td<http://org.drools.spi.knowledgehelper.td/>
()]
[Near : {... @Modify with( td ) { dirty = true }; ....}]
in another File (ui.drl) TableDirty is defined:
*declare TableDirty*
* @propertyReactive*
* dirty : boolean*
*end*
Any ideas what this error message means? And why can I start pong despite
this error?
Thanks a lot for helping me
Stefan
11 years, 7 months
"Rule-Id" for a Drools Rule
by harishtejwani
All:
We are using Drools to detect specific events/conditions in our system.
In the 'then' condition of Drools rule, we would like to persist the "Rule
Id" of the rule that created the specific event/condition
This is because all our reporting is based on "rules" as filters, where
users can look at exceptions by specific rules.
Is there a suggestion or sample as how can the "Rule Id" be persisted or
indicated in the then condition that is immutable or can be long-lived. The
current approach of using Rule Name itself as the ID is brittle as this can
be changed and suddenly all reports would break.
If we assign ID's to rules, where do we keep the mapping of RULE ID to
Rules. If we store rules in GUVRNOR is there a way we can get Rule Id's for
Rules?
Best regards
Harish Tejwani
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-Id-for-a-Drools-Rule-tp2914385p291...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Fire specific rules deployed in guvnor that reside in the same package
by ciberg2
Hi, I have Guvnor running with a package that has several BPMN processes and
now I'm adding rules to it.
The rules are made in Excel files and built into the package.
I have a web application in JAVA that fires the rules and if I have only one
rule in the package it works fine.
But if I deploy more than one rule to the package the result is a list with
the result of applying the input to all the rules that exist in the package.
I tried using this as URL with no success, drools applies the input to all
the rules in the package:
http://127.0.0.1:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/mera...
How should I organize the rules? One package for each? It doesn't seem a
good solution to me.
Is it possible to fire only a specific rule? If yes, how?
I use this code:
public static KnowledgeBase readKnowledgeBase()
throws Exception {
UrlResource resource = (UrlResource) ResourceFactory
.newUrlResource("http://127.0.0.1:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/myPa...");
resource.setBasicAuthentication("enabled");
resource.setUsername("guest");
resource.setPassword("guest");
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder();
kbuilder.add(resource, ResourceType.PKG);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
Thank you
--
View this message in context: http://drools.46999.n3.nabble.com/Fire-specific-rules-deployed-in-guvnor-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
General doubts about Drools capacity and tools
by Alan
Hi guys,
I have to do my final work to graduate at collage and I have some doubts
that I need to make clear about Drools before going on deep on it.
So, the project will have 3 main topics:
-Basic CRUD(maintenance) of rules
-Inference of data to those rules
-Filtering processed data based on statistical rules
I would like to know if Drools and it extensions projects can handle those
topics?
Also I had planned to develop my interface and other middle parts on .NET
based solutions such as C# as MVC.
Would Drools provide enough integration to this?
I would really appreciate any help and guides(topics,books,example projects)
that cover those topics.
Thanks,
Alan Araya
--
View this message in context: http://drools.46999.n3.nabble.com/General-doubts-about-Drools-capacity-an...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Error using 5.5.1 built with 5.5.0 Final jars
by abhinay_agarwal
M getting the following error when i try to connect to guvnor repository, is
this because of the jar conflict or the problem is something else ?
Caused by: java.io.InvalidClassException:
org.drools.rule.constraint.MvelConstraint; local class incompatible: stream
classdesc serialVersionUID = 148857042101396396, local class
serialVersionUID = 8537626313322861096
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.ArrayList.readObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.drools.rule.Pattern.readExternal(Pattern.java:115)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.ArrayList.readObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.drools.rule.GroupElement.readExternal(GroupElement.java:63)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.drools.rule.Rule.readExternal(Rule.java:185)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.IdentityHashMap.readObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.drools.rule.MVELDialectRuntimeData.readExternal(MVELDialectRuntimeData.java:90)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.HashMap.readObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:58)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.drools.rule.Package.readExternal(Package.java:208)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readArray(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:205)
at
org.drools.core.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:189)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:769)
... 7 more
--
View this message in context: http://drools.46999.n3.nabble.com/Error-using-5-5-1-built-with-5-5-0-Fina...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Abstracting Rules using extends
by Arul Prashanth
I have a Rule implementation as below which works as expected, here
Vehicles() and RuleConstant are facts.
/rule "Rule|1"
no-loop true
when
$CONSTANT : RuleConstant();
$vehicles : Vehicles();
$vehicle:Vehicle(modelYear > 2000, type = $CONSTANT.SEDAN) from
$vehicles.Vehicle;
then
$vehicle.setValue(100);
update($vehicles);
end /
But am planning to abstract the rules in the below fashion so that we can
reuse the LHS conditions which doesn't work and throws the below said Null
Pointer Exception
*BaseRule.drl*
/package com.xyz.base
rule "Base|1"
no-loop true
enabled false
when
$CONSTANT : RuleConstant();
$vehicles : Vehicles();
then
end /
*CustomRule.drl*
/package com.xyz.custom
rule "Custom|1" extends "Base|1"
no-loop true
enabled true
when
$vehicle:Vehicle(modelYear > 2000, type = $CONSTANT.SEDAN) from
$vehicles.Vehicle;
then
$vehicle.setValue(100);
update($vehicles);
end
rule "Custom|2" extends "Base|1"
no-loop true
enabled true
when
$vehicle:Vehicle(modelYear > 2000, type = $CONSTANT.COUPE) from
$vehicles.Vehicle;
then
$vehicle.setValue(100);
update($vehicles);
end/
*Exception:*
Caused by: [Error: drools.update($vehicles): null]
[Line: 1, Column: 1]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:416)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:143)
at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:123)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:116)
at org.mvel2.MVEL.executeExpression(MVEL.java:930)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:101)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1273)
... 33 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1105)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:987)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:377)
... 42 more
Caused by: java.lang.NullPointerException
at org.drools.common.DefaultAgenda.createActivation(DefaultAgenda.java:569)
at
org.drools.reteoo.RuleTerminalNode.modifyLeftTuple(RuleTerminalNode.java:297)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:246)
at org.drools.reteoo.JoinNode.modifyLeftTuple(JoinNode.java:363)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:272)
at
org.drools.reteoo.EvalConditionNode.modifyLeftTuple(EvalConditionNode.java:213)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:259)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:337)
at org.drools.reteoo.FromNode.modifyLeftTuple(FromNode.java:281)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateModifyChildLeftTuple(CompositeLeftTupleSinkAdapter.java:316)
at org.drools.reteoo.JoinNode.modifyRightTuple(JoinNode.java:273)
at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:531)
at org.drools.reteoo.JoinNode.modifyObject(JoinNode.java:446)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:507)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:432)
at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:314)
at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:265)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:470)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:370)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:317)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:329)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:325)
... 49 more
-----
- Prashanth
--
View this message in context: http://drools.46999.n3.nabble.com/Abstracting-Rules-using-extends-tp40232...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months