Accumulate / collect
by Bruno Freudensprung
Hi all,
There is something I can't express using "collect" or "accumulate" and I
would like to have your opinion.
Let's imagine I have the following types :
# a country type
* declare Country
name : String
end
*
# a city type holding a reference to its country
* declare City
name : String
country : Country
end
*
Let's imagine I have all Country and City objects into the working memory.
I want to get the set of Countries corresponding to Cities whose name
starts with "X".
I have the impression that I need a kind of (nonexistent right?)
"collect" syntax that would look like the "accumulate" syntax (a kind of
"anonymous" accumulate function):
# meaning I want to collect $country objects and not City objects
$countries : HashSet() from collect (City($name matches "X.*",
$country : country)*, $country*)
Or a home made accumulate function that builds a set of countries:
# custom "buildset" accumulate function
$countries : HashSet() from accumulate (City($name matches "X.*",
$country : country), *buildset*($country))
Do you see any other (possibly out of the box) solution?
Many thanks in advance for your answers,
Best regards,
Bruno.
14 years, 8 months
[Planner] CachedMoveFactory drive to Corrupted undo move
by npiedeloup
Hello,
I'm almost new to Drools Planner, and i run into some problems.
One of them, I really want to understand is that my Planner works well until
i try to use a CachedMoveFactory instead of my MoveFactory, then i've got
"Corrupted undo move" at step 2.
Assigment are my PlanningEntity, Day are facts
My MoveFactory is like this :
for (final Assigment assigment: mySolution.getAllAssigments()) {
for (final Day day : mySolution.getAllDays()) {
moveList.add(new PlanMove(assigment, day));
}
}
And my doMove is like :
final FactHandle factHandle = workingMemory.getFactHandle(assigment);
assigment.setDay(toDay);
workingMemory.update(factHandle, assigment);
The UndoMove is really simple (new PlanMove(assigment, fromDay)) , so I
pretty sure this part is correct.
I have add a false day(future=true) which mean "not plannified yet" and all
assigment start at this day.
I have a rule like :
rule "notPlannified"
when
$assigment: Assigment( day.future )
then
insertLogical(new IntConstraintOccurrence("notPlannified",
ConstraintType.NEGATIVE_SOFT, 50, $assigment));
end
My logs show :
INFO Phase construction heuristic finished: step total (0), time spend
(255), best score (0hard/-18750soft).
DEBUG Step index (0), time spend (2175), score (0hard/-18700soft), new
best score (0hard/-18700soft), accepted move size (1000) for picked step
([A148@[UNAFFECT]] ==> [12/11]).
Someone can explain me what I miss ?
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-CachedMoveFactory-drive-to-Corr...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
Preventing re-evaluation on modification of 'output' fact
by Jamie
We're building a fraud detection application that uses rules to analyze
orders and the buyers and recipients on those orders. As rules fire, they
modify an 'output' fact, which is an object whose only intent is to record
the results as rules fire. It's not used in the LHS of any rules other than
to get a handle to it, e.g.:
rule "Rule 001 - Operator Flagged"
enabled (FraudRuleEvaluationHelper.isRuleEnabled("Rule 001 - Operator
Flagged"))
ruleflow-group "orderAnalysis"
lock-on-active
when
$order: OrderFact(operatorFlagged==true)
$results: FraudResultsDTO()
then
modify($results) {
addOrderSuspectReason("O")
};
FraudRuleConsequenceHelper.logRuleFiring($order.getOrderId(), "001");
end
We're finding that as the number of facts increases, the processing team
increases dramatically and I'm wondering if modifying the output fact the
way we do causes the rules to get re-evaluated to see if any activations
should be created or cancelled. Would removing the modify block help
anything? Should we be thinking about this in some other way?
--
View this message in context: http://drools.46999.n3.nabble.com/Preventing-re-evaluation-on-modificatio...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
Adding a custom logo to Drools Guvnor
by LCode
In previous versions of Drools Guvnor I was able to custom brand the
application by unpacking the drools guvnor war and replacing the header logo
image in the 'images' folder.
In version 5.3 it would appear that the same is still possible since section
16.3. of the documentation reads "The parts you can customize are the style
sheet, the "shortcut icon" and the header logo."
However I cannot find the correct image for the header logo in public
images. The one in org.drools.guvnor.Guvnor\images\hdrlogo_brms.gif is not
the drools header image. Indeed it would seem that I can only replace the
logo by recompiling from source.
Is this a bug or am I missing something obvious?
--
View this message in context: http://drools.46999.n3.nabble.com/Adding-a-custom-logo-to-Drools-Guvnor-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
Guvnor 5.3 : No more "Create New ..." button in "Browse" view ?
by Vincent LEGENDRE
Hi all,
The question is in the subjec :
In 5.2 there was a "create new" button in "browse" panel, which allow business user to create new assets.
In 5.3, no more button ...
Is it on purpose ?
Is it a bug ?
Is there a way to get it back ?
Does it appears only under some conditions ?
14 years, 8 months