Planner - IntConstraintOccurrence not being retracted
by Garf
I've been building a prototype similar to CloudBalancing.
I've got IntConstraintOccurrence objects being inserted via insertLogical()
through my rules.
For some reason, I don't think these are being retracted as expected -- the
count() of accumulated IntConstraintOccurrence's ramps up to 10x what I
expected to be (and the sum of weights is similarly 10x what I expect).
Also -- I have enabled Drools debugging, but I don't see the Audit Logs.
any ideas?
Jon
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-IntConstraintOccurrence-not-bei...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years
Simple Global Error !!
by abhinay_agarwal
global java.lang.Integer count
rule "rule1"
agenda-group "1"
when
//smething
then
count=0;
System.out.println(count); // output is 0
count = count +1;
System.out.println(count); // output is 1
drools.setFocus("2");
end
rule "rule2"
agenda-group "2"
when
//smething
then
System.out.println(count); // output is 0
end
in the rule2, the value of the global variable "count" must be 1, why m i
getting it as zero ?
--
View this message in context: http://drools.46999.n3.nabble.com/Simple-Global-Error-tp4018697.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years
How to Access Rule RHS (THEN Part) from JAVA?
by Ravikiran
Hi Drools Gurus,
One more newbie here for Drools Guvnor. I have chosen
"guvnor-distribution-5.3.0.Final" (I could see version as SNAPSHOT 5.4.0
within Guvnor-->Administration-->About) to start with. After reading through
the complete user manual, I was able to setup and deploy Drools Guvnor war
in JBoss AS 7.
My intension is to access all the rules that i have created using Guvnor
web. I have written a java test case to access my Rules which are resided in
a drools Package using REST API. I was successful to access them using
standard Authentication mechanism with charset*.xml. Even though i was able
to call fireAllRules with specific rule using "AgendaFilter" provided. But i
was not able to access the values at RHS after a specific rule got fired.
For Example, i want to access "percent value as 2.5" after the below sample
rule is successfully executed,
I have uploaded my model jar to Guvnor containing Person & LoanFormula
classes.
---Rule 1 (please do not see the syntax errors)
WHEN
Person age > 25
----
THEN
LoanFormula percent = 2.5
....
....
JAVA Code follows
---------------------
KnowledgeBase kbase = ...
FactType personType = kbase.getFactType( "org.drools.examples","Person" );
Object bob = personType.newInstance();
personType.set( bob, "name","Bob" );
personType.set( bob,"age",42 );
StatefulKnowledgeSession ksession = ...
ksession.insert( bob );
AgendaFilter filter = new ......("Rule1");
int count = ksession.fireAllRules(filter);
String name = personType.get( bob, "name" );
int age = personType.get( bob, "age" );
It would be great help if some one can show me the sample code for accessing
RHS part of the Rule. Please let me know if you need more details.
thanks
Kiru
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-Access-Rule-RHS-THEN-Part-from-J...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 1 month
Drools Guvnor - question on "mortgages" package in "guvnor-distribution-5.4.0.Final"
by Ravikiran
Hi,
I have deployed drools-guvnor.war version 5.4.0 in Jboss AS 7. When i launch
the guvnor for the first time, it also loads the defalult packages, one
package is called "mortgages" is also loaded. Mortgages package contans
totally 7 diff. rules, but when i go see the model of the mortgages i do not
see any classes displayed over there. But, i was able to build & create
deployment SNAPSHOT successfully. Even the rule DSL source contains all
classes like LoanApplication etc.,.
How is it possible? Do you mean, some kind of related drl file is uploaded
as a Model? please clarify?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Guvnor-question-on-mortgages-pac...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 1 month
Planner - Initialized solution & local search
by Garf
I'm using v5.4. I've built a prototype which uses the constructionHeuristic,
and localSearch, as the example does, and am able to run the solver (though
it still doesn't do a good job of solving at this point).
I've now added customSolverPhase, and set it to use an initializer class
which implements CustomSolverPhaseCommand.
In my changeWorkingSolution, I call scoreDirector.beforeEntityAdded(), and
then set the planning entity's planning variable, and then call
afterEntityAdded().
If I leave any entities unadded -- and let the constructionHeuristic
(BEST_FIT, etc) do the fitting (which I can verify from the logs)-- I then
get this exception:
/java.lang.IllegalStateException: Phase localSearch started with an
uninitialized Solution. First initialize the Solution. For example, run a
phase constructionHeuristic first./
For now, I can update my code to ensure that all of the entities are fitted
and bypass the constructionHeuristic, but I'm curious why this error is
getting thrown. I did hunt through the source code to look at all the
isInitialized() methods, but I haven't yet stepped through to see which one
returns false any why.
As for turning on TRACE mode, see my
http://drools.46999.n3.nabble.com/drools-planner-5-4-0-Final-java-lang-Il...
recent post .
Jon
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-Initialized-solution-local-sear...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 1 month