Op 09-11-11 23:31, npiedeloup schreef:
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));
}
}
This is good if the number of assignments and days don't change during
planning.
And my doMove is like :
final FactHandle factHandle = workingMemory.getFactHandle(assigment);
assigment.setDay(toDay);
workingMemory.update(factHandle, assigment);
You're only updating the planning
entity (assignment) which is a good thing,
as it allows delta score calculation to work efficiently.
Notice that, during planning, you aren't updating the day or any other
problem fact, which is a good thing.
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 )
The "day.future" is
unusual. It might be ok, but to exclude it from the
possible causes, could you:
Add a method "boolean isDayFuture()" on the class Assignment and then do
$assigment: Assigment( dayFuture == true )
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.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
With kind regards,
Geoffrey De Smet