[planner] The presumed score is corrupted
by Guilherme Kunigami
Hi,
I've implemented a very simple application using drools planner consisting
of a bunch of activities. My rule file is very simple too and just counts
the number of activities not assigned. When I run Solver.solve(), I get the
following error message:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: The
presumedScore (-10hard/0soft) is corrupted because it is not the realScore
(0hard/0soft).
Presumed workingMemory:
Score rule (remainingActivitiesCount) has count (1) and weight total (11).
Real workingMemory:
Score rule (remainingActivitiesCount) has count (1) and weight total (0).
I've tracked down this message and found this piece of code
@DefaultLocalSearchSolver.solveImplementation():
// there is no need to recalculate the score, but we still need to set it
localSearchSolverScope.getWorkingSolution().setScore(localSearchStepScope.getScore());
if (assertStepScoreIsUncorrupted) {
localSearchSolverScope.assertWorkingScore(localSearchStepScope.getScore());
}
It seems that the working score is never updated along the algorithm, but
the score in the working memory changes. Thus, when we use the DEBUG
environment, assertStepScoreIsUncorrupted is turned on and the assertion
fails.
Should the score be updated or am I using the library incorrectly?
Thanks,
14 years, 9 months
[planner] Problem setting configuration file
by Guilherme Kunigami
Hi,
I'm trying to load a configuration file (namely SolverConf.xml) into
XmlSolver with the code below:
XmlSolverConfigurer configurer = new XmlSolverConfigurer();
configurer.configure(SOLVER_CONFIG);
Solver solver = configurer.buildSolver();
If I bundle SolverConf.xml file with the application .jar file, then using
SOLVER_CONFIG as /path/to/xml/file/SolverConf.xml works fine.
But I want to use SolverConf.xml outside the .jar, so I can easiliy edit it,
but I don't know what path should I pass to it.
I know it's a Java related question, but I was wondering if anyone had a
similar problem when configuring drools planner. (I've asked on
stackoverflow, but none of the answers worked for me:
http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-f...
)
(Supposing my .jar is in /some/path and the SolverConf.xml will be on
/some/path/conf for example)
Thanks,
14 years, 9 months
Fusion appears to be working properly, but...
by slyfox
It seems like I have fusion working correctly, yet the rules are not firing.
I have a quote object
class Quote {
private String symbol;
private double bid;
private double ask;
//eclipse generated getters and setter
}
in my drl I have the following:
import path.to.quote;
declare entry-point "Incoming Quotes"
@doc ("incoming quotes")
end
declare Quote
@role (event)
//@expires(2s)
end
rule "show something"
when
FXQuote(symbol == "EUR/USD", s:symbol) from entry-point "Incoming Quotes"
then
System.out.println("euro quote");
end
in my code I am inserting manually:
quoteStream = ksession.getWorkingMemoryEntryPoint("Incoming Quotes");
...
quoteStream.insert(quote);
I have verified I am getting quote objects with symbol == "EUR/USD" yet the
rule is not firing
I only say that it *appears* that I have the stream set up properly because
everything compiles and runs and in my log file I see the incoming quotes:
<org.drools.audit.event.ObjectLogEvent>
<type>1</type>
<factId>6</factId>
<objectToString>com.trendfx.fxlib.FXQuote@103ec0d</objectToString>
</org.drools.audit.event.ObjectLogEvent>
<org.drools.audit.event.ObjectLogEvent>
<type>3</type>
<factId>2</factId>
<objectToString>com.trendfx.fxlib.FXQuote@145f918</objectToString>
</org.drools.audit.event.ObjectLogEvent>
<org.drools.audit.event.ObjectLogEvent>
<type>3</type>
<factId>3</factId>
<objectToString>com.trendfx.fxlib.FXQuote@184843c</objectToString>
</org.drools.audit.event.ObjectLogEvent>
<org.drools.audit.event.ObjectLogEvent>
<type>3</type>
<factId>5</factId>
<objectToString>com.trendfx.fxlib.FXQuote@1912b66</objectToString>
</org.drools.audit.event.ObjectLogEvent>
etc..
simple rule but no output, tried debugging but since I can only add
breakpoints to RHS this doesnt really help me
Thanks,
Bobby
--
View this message in context: http://drools.46999.n3.nabble.com/Fusion-appears-to-be-working-properly-b...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 9 months
Fwd: Ocassional Refresh of Knowledgeagent (Only If There is any Change)
by Michael Anstis
Open for comment.
---------- Forwarded message ----------
From: <ayon.chakraborty(a)genworth.com>
Date: 14 October 2011 12:43
Subject: Ocassional Refresh of Knowledgeagent (Only If There is any Change)
Hi Michael,
I am using ResourceChangeScannerService to scan the resources in our
application. But it seems that after every specified interval we get a new
KnowledgeAgent(whether it is changed or not). Is there any way where I can
check using some Listener only if there is any change or the package is
built in guvnor only then we can get a new Knowledgeagent.
Thanks,
Ayon
14 years, 9 months
Regession in 5.3.0-CR1: .drl file ending in a single line comment w/o EOL not accepted
by Swindells, Thomas
While in the process of upgrading to the latest version of drools I've just been hit by a regression where .drl file ending in a single line comment w/o EOL not accepted (https://issues.jboss.org/browse/JBRULES-2041)
This was fixed and works in 5.1.1 but appears to be broken again :( The original Jira appears to be an exactly the same as what I'm experiencing now.
Thomas
________________________________
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster(a)nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
14 years, 9 months
Guvnor5.1.1 resource local cache
by DroolersEye
Hi,
I am trying to cache the remote guvnor resource locally for guvnor down time
availability to rules engine, I am confusing with two system properties...
1) drools.resource.urlcache
2) localCache
which one is applicable? guvnor documentation points to
"drools.resource.urlcache" than what is the use of localCache?
KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.resource.urlcache", "/local/dir/path");
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("test
agent", null, aconf);
is anything wrong in the above code?
when I run I dont see any locally cached resource in referenced folder,
please help me to clear?
Thanks lot....
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor5-1-1-resource-local-cache-tp3241...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 9 months
StatefulKnowledgeSession construction executes sequentially (no multithread)
by Juan Carlos Fernández
Hi all,
Try to execute many threads with the next source code (simple simple code).
You will see that only one CPU-thread is used in a mutithreaded CPU system.
It seems to be a system lock inside newStatefulKnowledgeSession().
This is a big disappoint because we can't use StatefulKnowledgeSession in
multithreaded environment. All is executing sequentially because of this
problem. Yes, we can asure newStatefulKnowledgeSession() is multithread (no
error is returned) but we can't asure newStatefulKnowledgeSession() executes
in parallel.
Do you know any problem about this?
Thank's in advance
PROBLEMATIC SOURCE CODE:
public class KnowledgeSessionThread extends Thread {
private static final int ITERATIONS = 1000000;
private KnowledgeBase kbase;
public KnowledgeSessionThread() throws Exception {
kbase = readKnowledgeBase();
}
public void run() {
try {
for( int i = 0; i < ITERATIONS; i++ ) {
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
session.dispose();
}
System.out.println("Thread finished");
} catch( Exception e ) {
e.printStackTrace();
}
}
private KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"),
ResourceType.DRL);
kbuilder.add(ResourceFactory.newClassPathResource("Sample.bpmn"),
ResourceType.BPMN2);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse
knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
}
--
View this message in context: http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-construction-e...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 9 months
7x slower .DRL compilation after switching 5.1.1 to 5.2.0
by Victor Cv
Hi,
while we used on Drools 5.1.1 our rules compiled in approx 1 min, after
switching to 5.2.0 the compilation time increased to approx 7 mins.
Our compilation is performed programmatically via KnowledgeBuilder by the
user application itself.
What we are possibly doing wrong?
Just to mention that after the switch our .DRL code that compiled
successfully under 5.1.1 needed much fixing, because it completely broke
under the 5.2.0 (more strict type casting, "||" became "or", access to
static Java methods and fields requires now explicit class imports instead
of the package imports as before, etc.).
I searched but didn't find any "migration guide". Is something like that
available?
Regards,
Victor
--
View this message in context: http://drools.46999.n3.nabble.com/7x-slower-DRL-compilation-after-switchi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 9 months
Need comprehensible drools examples
by Martin A
Hello, guys,
I've been looking for nice and clear drools examples for the whole day so
far, but can't find any. The several examples projects I found are full of
improper project configuration.
Would you please refer me to a reliable drools examples source projects?
Thanks in advance!
14 years, 9 months