The problem lies with your use of "lock-on-active" with every rule in
agenda-group "Rules-Recommendation". Once one of the rules "* group"
fires,
no more activations of other rules in that group are permitted; hence, the
effect of modify to set RuleFlowId is lost.
Activations that were around *before* a "* group" fires, are in
effect, and that's why you see "Rule 0*" firings when they use
"!=",
which happily return true due to whatever ruleFlowId was set to.
Discard all of that salience and lock-on-active tangle. Constrain
facts according to the initial values (the data modelers should have
provided reasonable settings, I'm assuming null here down below) of
the properties the facts have before you set them, e.g.,
$autoPolicy : Autopolicy(randomGenId < 0.5, ruleFlowId == null )
$autoPolicy : Autopolicy(randomGenId >= 0.5, ruleFlowId == null )
$autoPolicy : Autopolicy(ruleFlowId == "control")
$autoPolicy : Autopolicy(ruleFlowId == "test")
and watch the Engine doing good.
Cheers!
Wolfgang
On 05/02/2013, BenjaminWolfe <benjamin.e.wolfe(a)gmail.com> wrote:
Background: I’m a business user. Dev wrote the fact model and the
initial
rule set. I can’t configure the fact model, the agenda groups, or the java
code that fires the rules. I can change the rules within the .drl file. My
question has to do with those rules.
The application is run as a web service. Each call has just one Autopolicy
in its own stateless session. An Autopolicy has one or more Vehicles, and a
Vehicle has one or more Package of insurance coverages. Autopolicy objects
come in with a random float (RandomGenId) between 0 and 1. Based on that
random float we assign the object to an experiment group (RuleFlowId).
Based on the experiment group we then set the value of the packages. (See
the code below.)
Below, rules 0A and 0B work when I use ruleFlowId != “test” and ruleFlowId
!=“control” respectively, but they don’t work with the much more
straightforward approach of ruleFlowId == “control” and ruleFlowId == “test”
(respectively). Does anybody have an idea why?
Thank you!
-------------------------------------------
rule "control group"
agenda-group "Rules-Recommendation"
salience 999998
no-loop true
lock-on-active true
dialect "mvel"
when
$autoPolicy : Autopolicy(randomGenId < 0.5)
then
modify($autoPolicy) {setRuleFlowId("control")}; // Default ruleFlowId is
“1”
logger.debug("control group set");
end
rule "test group"
agenda-group "Rules-Recommendation"
salience 999997
no-loop true
lock-on-active true
dialect "mvel"
when
$autoPolicy : Autopolicy(randomGenId >= 0.5)
then
modify($autoPolicy) {setRuleFlowId("test")}; // Default ruleFlowId is
“1”
logger.debug("test group set");
end
rule "Rule 0A: Set Packages for Control Group"
agenda-group "Rules-Recommendation"
no-loop true
lock-on-active true
dialect "mvel"
when
$autoPolicy : Autopolicy(ruleFlowId != "test")
$vehicles : Vehicles()
$packages : Packages()
$vehicle : Vehicle() from $vehicles.Vehicle
then
// set $packages
logger.debug("Rule 0A fired");
end
rule "Rule 0B: Set Packages for Test Group"
agenda-group "Rules-Recommendation"
no-loop true
lock-on-active true
dialect "mvel"
when
$autoPolicy : Autopolicy(ruleFlowId != "control")
$vehicles : Vehicles()
$packages : Packages()
$vehicle : Vehicle() from $vehicles.Vehicle
then
// set $packages
logger.debug("Rule 0B fired");
end
--
View this message in context:
http://drools.46999.n3.nabble.com/Can-get-not-equal-to-work-but-not-equal...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users