[rules-users] Can get "not equal" (!=) to work but not "equal" (==) in LHS

BenjaminWolfe benjamin.e.wolfe at gmail.com
Tue Feb 5 11:50:46 EST 2013


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-in-LHS-tp4022074.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list