decision tables conditional matching
by Atul Bhatia
We are using drools decision tables and have a quite a few scenarios where
there are three conditions: A, B, and C.
The behavior we want is:
if A is true, then B and C must be true (if B and C are true, we want to
output true, otherwise we want to output false)
if A is not true, then B and C don't matter, the output should be true.
Currently the way we are doing it is the following:
0 (priority), A is true (CONDITION), B is true (CONDITION), C is true
(CONDITION), set eligibility to TRUE (ACTION)
0 (priority), NOT A (CONDITION), set eligibility to TRUE (ACTION)
-1 (priority), A is true (CONDITION), set eligibility to FALSE (ACTION)
We are using decision tables and we are dealing with more complex
conditions than this simple example. For example, there are scenarios like
if A and B are true then C and D must be true, in which we'd have to check
if NOT (A and B) which can get messy.
Any suggestions around best practices?
11 years, 3 months
New user: reducing the problem space
by Adam Hirsch
Hey, folks -- I'm trying to wrap my head around Optaplanner by extending
the nurse-rostering example (for my wife, who's a nurse in a group that
needs a rostering solution, as it happens).
I've got a couple of approach/philosophy questions I haven't yet found
addressed in the docs, and I'm hoping someone could help direct me.
- How best to constrain a problem: Say I've got six people to schedule
and Employee A *must* work every Tuesday night and alternate Friday nights,
while the other five people should fill in the remaining shifts as best
they can with the other soft constraints I'm specifying. From my initial
reading, I'm thinking the best approach will be to specify an "only Tuesday
and alt Fridays" <Contract> in the scoreRules.xml (with an accompanying DRL
rule to match whether or not the particular employee is working shifts
other than those) and then specify it as a "hard" constraint for that
particular employee. Do I have that right, or is there some way to remove
those shifts entirely from the problem space, since we already know ahead
of time how they'll be allocated?
- A similar question would come up around Christmas, New Years, Arbor
Day, etc, to wit: if we know before the problem ever runs which employees
are supposed to be working those, what's the recommended approach to
pre-setting an employee into those particular shifts before trawling the
solution space?
Apologies if these are naive questions -- I suppose I could/should have
started with one of the easier examples, but, well, real world needs and
all.
Thanks!
Adam
11 years, 3 months
unable to resolve method using strict-mode:
by Roopa
RuleBaseTask failed: [Error: unable to resolve method using strict-mode:
This is the error I am getting while compiling drl file.
I am calling a method in the when clause.
The same code works fine in eclipse. Error is when I am compiling using ant
script.
Eclipse is doing some settings, that even I got to do in ant script.
I am using drools 5.5.0 and eclipse indigo.
Code :
function String updateQuery(Query querie, AOCCRuleKnobConfig
aoccRuleKnobConfig, String advPgmExclude, Logger log){
}
rule "ExecuteQuery"
//include attributes such as "salience" here...
no-loop true
salience 9
when
//conditions
$aoccRuleKnobConfig : AOCCRuleKnobConfig($commissionThreshold :
commissionThreshold)
$query : Query(name == "Account-Eligibility-Criteria" , $statement :
statement)
Query(name == "AdvisoryProgramExclusion" , $advPgmExclude :
statement)
$order : Order() from
hibernateSession.createSQLQuery(updateQuery($query, $aoccRuleKnobConfig,
$advPgmExclude, log))
.addScalar("id",LongType.INSTANCE)
.addScalar("totalCommission", BigDecimalType.INSTANCE)
.setResultTransformer(Transformers.aliasToBean(com.nph.radar.rule.operands.Order.class)).list();
then
end
Please do help me with this.
--
View this message in context: http://drools.46999.n3.nabble.com/unable-to-resolve-method-using-strict-m...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
Process Compilation Error: Drools can not be resolved
by V Vignesh
Hi guys,
I am new new to Rule Flow.
I am using eclipse for rule flow.
In a new Drools-Project
in ProcessTest.java
I tried to insert a HashMap in a knowledge base session
-------------------------------------------------------
HashMap hMap = new HashMap();
hMap.put("Id", "10");
hMap.put("RollNumber", "456");
FactHandle qMapHandle = ksession.insert(hMap);
ksession.startProcess("sample.ruleflow");
ksession.fireAllRules();
------------------------------------------------------
but in my ruleflow.rf
I added a script Task
when in its Action, i tried accessing this fact Handle i get an error
"Drools cannot be resolved"
---------------------------------------------
if(drools.getWorkingMemory().getFactHandles()){
System.out.println("Inside the Script Task");
}
---------------------------------------------
Can you please help me to figure out the Reasons for Compilation Error
--
View this message in context: http://drools.46999.n3.nabble.com/Process-Compilation-Error-Drools-can-no...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
How to get Parameters in Script Task
by V Vignesh
Hi guys,
I am new new to Rule Flow.
I am use eclipse for rule flow.
In a new Drools-Project
in ProcessTest.java
I tried to insert a HashMap in a knowledge base session
-------------------------------------------------------
HashMap hMap = new HashMap();
hMap.put("Id", "10");
hMap.put("RollNumber", "456");
FactHandle qMapHandle = ksession.insert(hMap);
ksession.startProcess("sample.ruleflow");
ksession.fireAllRules();
------------------------------------------------------
but in my ruleflow.rf
I added a script Task
when in its Action, i tried accessing this HashMap i am unable to get it
----------------------------------------------------
if(hMap.get("Id"){
System.out.println("Student exists");
}
---------------------------------------------------
Can you please help me to figure out retrieving the HashMap from my Process
Test.java inside the Script Task of rule-flow.rf?
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-get-Parameters-in-Script-Task-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
[OptaPlanner] conflict Resolver 'org.drools.core.conflict.DepthConflictResolver' not found
by Sandeep Bandela
Hi,
I am using planner 6.0.0.beta5. to schedule some kind of events like in
curriculum example, and created web front end for this using Vaadin.
but for some reason some users (only few) from this web client get this
exception (at the end) and scheduler fails.
What could have been the cause for this? the code I have is as follows.
SolverFactory solverFactory = new XmlSolverFactory(
"/org/optaplanner/examples/curriculumcourse/solver/curriculumCourseSolverConfig.xml");
TerminationConfig tc =
solverFactory.getSolverConfig().getTerminationConfig();
tc.setMaximumSecondsSpend(120L);
Solver solver = solverFactory.buildSolver();
creating the solver is throwing the exception.
log:
*java.lang.IllegalArgumentException: conflict Resolver
'org.drools.core.conflict.DepthConflictResolver' not found
at
org.drools.core.RuleBaseConfiguration.determineConflictResolver(RuleBaseConfiguration.java:866)
~[drools-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.drools.core.RuleBaseConfiguration.init(RuleBaseConfiguration.java:455)
~[drools-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.drools.core.RuleBaseConfiguration.init(RuleBaseConfiguration.java:411)
~[drools-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.drools.core.RuleBaseConfiguration.<init>(RuleBaseConfiguration.java:262)
~[drools-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieBaseConfiguration(KieServicesImpl.java:146)
~[drools-compiler-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildKieBase(ScoreDirectorFactoryConfig.java:330)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildDroolsScoreDirectorFactory(ScoreDirectorFactoryConfig.java:280)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:187)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:175)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:145)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]
at
org.optaplanner.core.config.solver.XmlSolverFactory.buildSolver(XmlSolverFactory.java:104)
~[optaplanner-core-6.0.0.Beta5.jar:6.0.0.Beta5]*
--
Regards,
Sandeep Bandela.
11 years, 3 months