java.lang.OutOfMemoryError: Java heap space
by vdelbart
Hello,
In my tests of the 4.0.3, I have some : java.lang.OutOfMemoryError.
So, I try a simple test with 10.000 sequential execution of 1 rule with no
context and just a workingmemorylogger and I have the error :
java.lang.OutOfMemoryError: Java heap space
My code is :
public class ExecReglesMemotyTest
{
private static final Reader DRL = new
InputStreamReader(ExecReglesMemotyTest.class
.getResourceAsStream("/rules/exemple.drl"));
private static final String FICHIER_LOG = "session";
/**
* @param args
*/
public static void main(String[] args)
{
try
{
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(DRL);
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
for (int i = 0; i < 10000; i++)
{
StatefulSession session = ruleBase.newStatefulSession();
WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(session);
logger.setFileName(FICHIER_LOG);
session.fireAllRules();
logger.writeToDisk();
session.dispose();
}
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
with this rule (doesn't matter):
#created on: Fri Nov 09 15:48:45 CET 2007
package initPackage
#list any import classes here.
rule "ERG9"
when
then
end
I try this in 4.0.1, and it's working (no OutOfMemoryError)
What's the problem ?
thanks for any information,
V.
--
View this message in context: http://www.nabble.com/java.lang.OutOfMemoryError%3A-Java-heap-space-tf477...
Sent from the drools - user mailing list archive at Nabble.com.
13 years, 5 months
getting mismatched '==' error
by zeeshan
Hi !
Please find my attached Decision Table. I am getting following error...
log4j:WARN No appenders could be found for logger (com.sample.RuleRunner).
log4j:WARN Please initialize the log4j system properly.
Warning: Cell at E20 not present - adding a blank
Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 -
setting to empty
Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 -
setting to empty
Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 -
setting to empty
Exception in thread "main" org.drools.rule.InvalidRulePackage: [10,9]: [ERR
102] Line 10:9 mismatched input '==' in rule "Distribution Cost Rules_11"
[23,9]: [ERR 102] Line 23:9 mismatched input '==' in rule "Distribution Cost
Rules_12"
[36,9]: [ERR 102] Line 36:9 mismatched input '==' in rule "Distribution Cost
Rules_13"
[49,9]: [ERR 102] Line 49:9 mismatched input '==' in rule "Distribution Cost
Rules_14"
[62,9]: [ERR 102] Line 62:9 mismatched input '==' in rule "Distribution Cost
Rules_15"
[75,9]: [ERR 102] Line 75:9 mismatched input '==' in rule "Distribution Cost
Rules_16"
[88,9]: [ERR 102] Line 88:9 mismatched input '==' in rule "Distribution Cost
Rules_17"
[101,9]: [ERR 102] Line 101:9 mismatched input '==' in rule "Distribution
Cost Rules_18"
[114,9]: [ERR 102] Line 114:9 mismatched input '==' in rule "Distribution
Cost Rules_19"
[127,9]: [ERR 102] Line 127:9 mismatched input '==' in rule "Distribution
Cost Rules_20"
[140,9]: [ERR 102] Line 140:9 mismatched input '==' in rule "Distribution
Cost Rules_21"
[153,9]: [ERR 102] Line 153:9 mismatched input '==' in rule "Distribution
Cost Rules_22"
[166,9]: [ERR 102] Line 166:9 mismatched input '==' in rule "Distribution
Cost Rules_23"
[179,9]: [ERR 102] Line 179:9 mismatched input '==' in rule "Distribution
Cost Rules_24"
[192,9]: [ERR 102] Line 192:9 mismatched input '==' in rule "Distribution
Cost Rules_25"
[205,9]: [ERR 102] Line 205:9 mismatched input '==' in rule "Distribution
Cost Rules_26"
[218,9]: [ERR 102] Line 218:9 mismatched input '==' in rule "Distribution
Cost Rules_27"
[231,9]: [ERR 102] Line 231:9 mismatched input '==' in rule "Distribution
Cost Rules_28"
[244,9]: [ERR 102] Line 244:9 mismatched input '==' in rule "Distribution
Cost Rules_29"
[257,9]: [ERR 102] Line 257:9 mismatched input '==' in rule "Distribution
Cost Rules_30"
[270,9]: [ERR 102] Line 270:9 mismatched input '==' in rule "Distribution
Cost Rules_31"
[283,9]: [ERR 102] Line 283:9 mismatched input '==' in rule "Distribution
Cost Rules_32"
[296,9]: [ERR 102] Line 296:9 mismatched input '==' in rule "Distribution
Cost Rules_33"
[309,9]: [ERR 102] Line 309:9 mismatched input '==' in rule "Distribution
Cost Rules_34"
[0,0]: Parser returned a null Package
at org.drools.rule.Package.checkValidity(Package.java:471)
at
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:481)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:436)
at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:443)
at com.sample.RuleRunner.loadRules(RuleRunner.java:70)
at com.sample.RuleRunner.runStatelessRules(RuleRunner.java:185)
at com.sample.RuleMain.main(RuleMain.java:132)
http://drools.46999.n3.nabble.com/file/n4017627/Distribution_Factor.xls
Distribution_Factor.xls
--
View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Re: [rules-users] [Drools Fusion] Accessing Events' time (read-only) with Drools in STREAM mode, REALTIME clock
by Davide Sottara
Stefano Bragaglia wrote
> Hi guys,
> I just realised that it is not possible to take advantage of the
> default time handling and access the timestamp value at the same time.
Agreed, one may want to write both qualitative ( A after B ) and
quantitative constraints ( A.time > x ) on an event. While this is possible
when the even timestamp is assigned externally, this is very hard to do with
the fusion-managed timestamp. Unfortunately, what you propose won't work,
since that particular configuration (setting a @timestamp field) would break
the assumption of immutable events.
We would need something like:
//operator-like, even better with implicit unification
Event( this happensAt $t ) // timestamp
Event( this lasts $d ) // duration
//accessor-like
Event( $t := happensAt, lasts > 100 )
Probably this needs to be taken to the dev channel or to the jira feature
requests
Best
Davide
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Fusion-Accessing-Events-time-rea...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Iterating facts
by Phani Saripalli
Hi.
1) I could list all the facts via knowledge session.facthandle.iterator.
2) I could iterate over the objects contained in a fact. For example:
List<FactField> fFields =
ksession.getKnowledgeBase().getFactType(pckg, "Project").getFields();
3) I could get the name of the object and retrieve the contained value as a
string if it is a primitive datatype - int, real, boolean.
4) The problem for me is I am not able to retrieve the values of the inner
fields of an object.
For example, fFields.get(0).get(projIns) - yields me C( a=1, bool=false,
cc=0 ), I could retrieve this particular objects' name and also the inner
fields' names, but not the contained values for a, bool and cc.
I have tried java reflection, but no positive result so far.
I am using declared types, with no metadata. Any other nice way to tackle
this problem.
Thank you.
--
View this message in context: http://drools.46999.n3.nabble.com/Iterating-facts-tp4020214.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Re: [rules-users] Loading a large number of rules is too slow.
by Davide Sottara
There seem to be two issues here..
- one is that loading is "too slow" for a "large number" of rules --> could
you provide some figures? :)
There may also be ways to reduce the number of rules, but we'd need to know
more about your usecase.
Please also consider that Drools is optimized for execution, so the tradeoff
is a heavier startup phase,
where many optimizations are pre-calculated
- the other is that you don't want to restart the application server when
you change the rule --> please read the manual at the "KnowledgeAgent"
section and see if that helps
Best
Davide
--
View this message in context: http://drools.46999.n3.nabble.com/Loading-a-large-number-of-rules-is-too-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Re: [rules-users] Drools Planner for purchasing optimization - good fit for problem?
by Schneider, Bill
Geoffrey,
Thanks for the quick response.
As I'm learning more about my scenario, it feels more like a mixed-integer problem than a combinatorial problem. The objective function is linear in the decision variables. I would model the decision variables as the quantities of each item from each vendor. The conditional offers I could model as a separate vendor/bid, with a binary decision variable for "condition met?" and inequalities to constrain the quantities that depend on the binary variable. Some of the global constraints can be modeled in the same way, like "at most two vendors."
It sounds like there are some advantages to using Drools Planner in terms of readability and maintainability of the relationships and constraints - you have the full expressive power of DRL (or Java), and are not limited to inequalities. That could make it easier to program for new types of rules or constraints later.
Are there any advantages to using Drools Planner from a computational-complexity standpoint as well? Would it *hurt* to use in terms of CPU/memory, or even learning curve, for a problem that is possibly not combinatorial, and might be solvable with other means?
Also - are you aware of any case studies or examples of Drools Planner being used in the purchasing domain like this?
Thanks again!
--Bill
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Geoffrey De Smet
Sent: Thursday, October 11, 2012 10:35 AM
To: Rules Users List
Subject: Re: [rules-users] Drools Planner for purchasing optimization - good fit for problem?
[...]
- If you want to upscale, go Metaheuristics (for example with Planner). If you want to downscale, linear programming might be a better fit. (Compo's like ROADEF 2012 assert this statement).
- LP will require you to write your constraints as mathematical equitations based on arrays and primitives, for example "x < y * 1.21". Planner uses a declarative OO approach using drools rules (or even just plain Java), for example "Invoice ($x < yWithVAT)".
- If you have different conditional price types, you might want to look into using a drools decision table to easily declare that conditional logic - and use that as in Planner. Especially if those rules change often.
Thanks for any help you can give.
--Bill
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org<mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users
13 years, 5 months
Drools Planner for purchasing optimization - good fit for problem?
by Schneider, Bill
I'm trying to understand whether Drools Planner is a good fit for a purchasing optimization problem.
The problem is something like this: there are X different items, each of which can be purchased from Y different vendors at different prices. The objective variable/function to minimize is the total amount purchased (sum(qty_i * price_i)).
Some vendor prices are conditional - only valid if you purchase more than some minimum threshold, or if you purchase more than some total quantity from that vendor. There are some additional constraints like dual-sourcing
- for some item x_i, exactly two vendors must be selected.
I feel like you *could* probably solve this problem in Drools Planner, but I'm not sure if it's the best way, or if a more traditional solver approach would be better. It feels more like a linear programming problem at its core, and I'm having a hard time figuring out where the boundary is - what kind of constraint would make the problem "non-convex" or "non-smooth" to the point where a local search (tabu, evolutionary etc.) is required?
Thanks for any help you can give.
--Bill
13 years, 5 months
2 problems with the keyword contains in HashMaps
by raffi
Hy.
I have problems, filtering data with the help of /contains/. I have a
HashMap with /long/-values as keys. In my rules I filter data in the
following way:
FilterCriteria(categories_slot1 contains $cid)
HashMap categories_slot1 is initialized with HashMap<Long, Double>. $cid is
set as long value in the corresponding class, too. Does this work in
general?
Second problem is that there is another HashMap with Strings as key values.
FilterCriteria(brands contains $brand)
The problem is, that /brands/-key value strings are not identical to $brand.
But $brand can contain the key value string. But contains only checks if
they are identical right?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/2-problems-with-the-keyword-contains-in...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months