Stateful session marshaling on drools server
by Ramgopal Tanikella
Hi,
I am using Drools Server 5.4.0.Final as a web application deployed on JBoss AS 7.1.1.Final. I have a stateful session configured on the server, and I am able to remotely execute against it inserting facts, retracting facts, firing rules, etc. How do I marshal/unmarshal a stateful session that is on the drools server?
Thanks,
Ramgopal Tanikella
________________________________
NOTICE TO RECIPIENT: THIS E-MAIL (INCLUDING ANY ATTACHMENTS) IS MEANT FOR ONLY THE INTENDED RECIPIENT OF THE TRANSMISSION, MAY CONTAIN CONFIDENTIAL INFORMATION, AND IS PROTECTED BY LAW. IF YOU RECEIVED THIS E-MAIL IN ERROR, PLEASE IMMEDIATELY NOTIFY THE SENDER OF THE ERROR BY RETURN E-MAIL, DELETE THIS COMMUNICATION AND SHRED ANY ATTACHMENTS. UNAUTHORIZED REVIEW, USE, DISSEMINATION, DISTRIBUTION, COPYING OR TAKING OF ANY ACTION BASED ON THIS COMMUNICATION IS STRICTLY PROHIBITED.
11 years, 10 months
Planner - NurseRostering: MaxWorkingWeekendsInFourWeeks
by John Poole
The parameters for MaxWorkingWeekendsInFourWeeks is in some of the
input files for the NurseRostering example, but it doesn't seem to be
the rules(drl) file.
Is it implemented elsewhere? I've tried doing is like this, but it
doesn't work as a HARD constraint. I'm running it as SOFT now, but it
would nice to compare it to a better version.
//Rules for workingweekends
rule "insertWorkingWeekends"
when
MinMaxContractLine(contractLineType ==
ContractLineType.TOTAL_WORKING_WEEKENDS_IN_FOUR_WEEKS, enabled ==
true,
$contract : contract)
$employee : Employee(contract == $contract)
ShiftAssignment(employee == $employee, $shiftDateDayIndex :
shiftDate.dayIndex, weekend == true)
then
insertLogical(new WorkingWeekend($employee, $shiftDateDayIndex/7));
end
// Maximum working weekends in four weeks
rule "insertWorkingWeekendsInFourWeeks"
// salience 1 // Do these rules first (optional, for performance)
when
MinMaxContractLine(contractLineType ==
ContractLineType.TOTAL_WORKING_WEEKENDS_IN_FOUR_WEEKS, enabled ==
true,
$contract : contract)
$employee : Employee(contract == $contract)
WorkingWeekend(employee == $employee, $week: week)
$workingWeekendTotal : Number() from accumulate(
$workingWeekend : WorkingWeekend(employee == $employee,
week >= $week, week-$week < 3 ),
count($workingWeekend)
)
then
insertLogical(new WorkingWeekendTotalFourWeeks($employee,
$workingWeekendTotal.intValue(), $week));
end
// Maximum working weekends in four weeks
rule "maxWorkingWeekendsInFourWeeks"
when
$contractLine : MinMaxContractLine(
contractLineType ==
ContractLineType.TOTAL_WORKING_WEEKENDS_IN_FOUR_WEEKS, maximumEnabled
== true,
$contract : contract, $maximumValue : maximumValue
)
$employee : Employee(contract == $contract)
WorkingWeekendTotalFourWeeks(employeeContract == $contract,
total > $maximumValue,
employee==$employee, $total : total, $week : week)
then
insertLogical(new
IntConstraintOccurrence("maxWorkingWeekendsInFourWeeks",
ConstraintType.NEGATIVE_SOFT,
($total - $maximumValue) * $contractLine.getMaximumWeight(),
$employee, $week));
end
11 years, 10 months
Re: [rules-users] DSL Enumerations
by GPatel@tsys.com
I wish the entire rule editing context (all the sentences and user entries) was made available to enumeration providers, then this would have been possible.
----- Original Message -----
From: rjr201 [rich.j.riley(a)gmail.com]
Sent: 01/22/2013 06:59 AM PST
To: rules-users(a)lists.jboss.org
Subject: Re: [rules-users] DSL Enumerations
Ok. Thanks for letting me know.
--
View this message in context: http://drools.46999.n3.nabble.com/DSL-Enumerations-tp4021696p4021727.html
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
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
11 years, 10 months
how to analyse planner TRACE logging
by Michiel Vermandel
Hi,
I'm trying to find an issue that I expect to be a score trap.
As Geoffrey pointed out I enabled TRACE logging, which produces a rather big file.
Is there documentation on how to interpret the content?
There are some things that I do not understand:
1) I see sometimes this type of logging:
TRACE main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (249), score (-484hard/0soft), accepted (true) for move ({T= Inspect B747-AX.I#0 [P1] Kristof IV} <=> {T= Inspect A311-DX.I#1 [P1] Gerald IV}).
What does the <=> mean in this logging? What does the move actually do in this case?
2) TRACE main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (273), score (-5562hard/0soft), accepted (true) for move ({T= Inspect B747-AX.I#0 [P3] Kristof IV} => (P9) ).
This line indicates that the move is accepted. Is a move accepted before validating the rules or after? And in the same way does the score (-5562hard/0soft) indicate the score before or after the validation of the rules?
Can someone give me some directions, please?
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
11 years, 10 months
[Bug] cannot invoke method: asList
by Wolfgang Laun
Below is a self-contained DRL which, when run with 5.5.0, throws an
exception "cannot invoke method asList". Remarkably, this only happens
when a second Project fact is inserted. (Haven't I heard this before?)
-W
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
declare Project
@typesafe (false)
list1 : List
list2 : List
end
rule kickoff
salience 999999
when
then
insert( new Project() );
insert( new Project() ); // necessary to trigger the exception
end
rule " Config rule "
dialect "mvel"
no-loop true
when
P : Project()
then
modify(P) {
list1 = Arrays.asList(10, 15, 20, 25),
list2 = Arrays.asList(11, 2, 3, 4, 5, 10, 9, 8, 7)
};
end
Exception in thread "main" Exception executing consequence for rule "
Config rule " in express: java.lang.RuntimeException: cannot construct
object
at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1297)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1456)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
at express.Main.execute(Main.java:77)
at express.Main.main(Main.java:110)
Caused by: java.lang.RuntimeException: cannot construct object
at org.mvel2.optimizers.impl.refl.nodes.ConstructorAccessor.getValue(ConstructorAccessor.java:63)
at org.mvel2.ast.NewObjectNode.getReducedValueAccelerated(NewObjectNode.java:233)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
at org.mvel2.ast.WithNode$ParmValuePair.eval(WithNode.java:281)
at org.mvel2.ast.WithNode.getReducedValueAccelerated(WithNode.java:67)
at org.mvel2.ast.InterceptorWrapper.getReducedValueAccelerated(InterceptorWrapper.java:40)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
at org.mvel2.MVEL.executeExpression(MVEL.java:930)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:104)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287)
... 7 more
Caused by: java.lang.RuntimeException: cannot invoke method: asList
at org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:63)
at org.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:37)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
at org.mvel2.optimizers.impl.refl.nodes.ConstructorAccessor.executeAll(ConstructorAccessor.java:76)
at org.mvel2.optimizers.impl.refl.nodes.ConstructorAccessor.getValue(ConstructorAccessor.java:43)
... 18 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
at org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.executeAll(MethodAccessor.java:149)
at org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:48)
... 23 more
11 years, 10 months
DSL Enumerations
by rjr201
Hi,
I'm creating a DSL with dropdown boxes that are populated by enumerations. I
have so far had success in making one drop down box dependent on the value
of another dropdown box on the same [when] line:
[when]For every {objectType:ENUM:Object.type} with
{attribute:ENUM:Object.attribute} equal to {value:ENUM:Object.value} =
{objectType}({attribute} == "{value}")
In the above example whatever value is chosen for objectType will dictate
the values in the attribute dropdown which in turn dictates the values in
the Value dropdown.
My question is this: Is it possible to have a dropdown box reliant on the
value of a dropdown box on a /different / line of the rule?
I've tried a few different ways but am having no luck.
Thanks for any help anyone can give me on this.
Rich.
--
View this message in context: http://drools.46999.n3.nabble.com/DSL-Enumerations-tp4021696.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
form of accumulate in examples is depricated?
by Michiel Vermandel
Hi,
In lots of rules in the drools planner examples the accumulate function is used in this way:
rule "requiredCpuPowerTotal"
when
$computer : CloudComputer($cpuPower : cpuPower)
$requiredCpuPowerTotal : Number(intValue > $cpuPower) from accumulate(
CloudProcess(
computer == $computer,
$requiredCpuPower : requiredCpuPower),
sum($requiredCpuPower)
)
then
insertLogical(new IntConstraintOccurrence("requiredCpuPowerTotal", ConstraintType.NEGATIVE_HARD,
$requiredCpuPowerTotal.intValue() - $cpuPower,
$computer));
end
(example from cloudBalancing).
Though, documentation says (http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_...) one should this syntax:
<result pattern> from accumulate( <source pattern>,
init( <init code> ),
action( <action code> ),
reverse( <reverse code> ),
result( <result expression> ) )
Does this mean that the axemples could be optimized and that I should go for that syntaxt as well rather than using the syntax like rule "requiredCpuPowerTotal" ?
Thanks
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
11 years, 10 months
Will there be a 5.5.1 release?
by Magnus Vojbacke
I'm following a couple of specific bug fixes that have made it into the 5.5.x branch (including the serious "incorrect evaluation of LHS using Integer/Number intValue" bug from last week).
I need these bug fixes, but I'm not that eager to pull in a new major version (6.0) any time soon. Given the choice, I would definitely prefer to step up to a minor version (5.5.x).
How do you usually do it? Is there going to be a 5.5.1 release?
11 years, 10 months
hot deployment behavior
by William Guinn
Would someone be so kind to describe exactly what happens when we hot deploy a rule change to a stateful session. It looks like the old version of the rule is deleted, in turn forcing a retraction of any RHS that was logically inserted (all our inserts are logical) as a consequence of this rule (and any cascading effects) that has no other LHS to support its existence. Then the new rule is inserted, the agenda is rebuilt based on the current working memory contents, and the rule is automatically fired (in our case recreating everything it just deleted)
Do I have this right?
Is there a way to change the behavior to be less invasive? This "rebuild" can take minutes, and I am not running at high volume yet.
For example what if the updated rule logically has no impact on existing working memory contents, let's say it's a maintenance change for future facts or new conditions? If the operation did not delete and rebuild everything, rather if it determined the impact of the change, and only replaced retracted/deleted what is affected by the logic change, would this be faster?
Bottom line it would be highly desirable for this to be minimally invasive.
thanks
[cid:image001.gif@01CDF7F0.4B5CB130]
Bill Guinn | Sr. Vice President, and CTO
SUMMUS Software, Inc.
3179 Skyway Court, Fremont, CA 94539
510.780.3895 office | 916.715.6433 mobile
@summussoftware twitter
william.guinn(a)summussoftware.com<mailto:kl@summussoftware.com>
[cid:image002.png@01CDF7F0.4B5CB130] [cid:image003.jpg@01CDF7F0.4B5CB130] <http://www.summussoftware.com/pdfs/EMA_NGITM-Q4-2012_Radar_Summus-Profile...>
________________________________
NOTICE TO RECIPIENT: THIS E-MAIL (INCLUDING ANY ATTACHMENTS) IS MEANT FOR ONLY THE INTENDED RECIPIENT OF THE TRANSMISSION, MAY CONTAIN CONFIDENTIAL INFORMATION, AND IS PROTECTED BY LAW. IF YOU RECEIVED THIS E-MAIL IN ERROR, PLEASE IMMEDIATELY NOTIFY THE SENDER OF THE ERROR BY RETURN E-MAIL, DELETE THIS COMMUNICATION AND SHRED ANY ATTACHMENTS. UNAUTHORIZED REVIEW, USE, DISSEMINATION, DISTRIBUTION, COPYING OR TAKING OF ANY ACTION BASED ON THIS COMMUNICATION IS STRICTLY PROHIBITED.
11 years, 10 months