Hello!
I am working on task scheduling system. My system works fine, but I want to
make it faster. For my current problem we can assume that my domain consists
of:
* Worker (int id, List<TimePeriod> workingHours)
* TaskAssignment (int id, List<TimePeriod> possibleExecutionTime, Duration
leadTime, Worker worker)
I am trying to assing each Task Assignment to 1 worker. It's obvious. All I
need to do is to make my rules computing faster. For example I have a rule:
rule "ASSIGN_OUT_OF_WORKING_TIME"
when
$w : Worker($id : id != 0, $wh : workingHours)
$ta : TaskAssignment(worker != null, worker.id == $id)
not TimePeriod( isBetweenInclusive($ta.getTimeSlot()),
isBetweenInclusive($ta.getEndTimeSlot()) ) from $wh
then
insertLogical(new IntConstraintOccurrence("ASSIGN_OUT_OF_WORKING_TIME",
ConstraintType.NEGATIVE_HARD,
100, $w ));
end
This rule checks if every TaskAssignment assigned to a Worker lies in the
worker's working hours. The problem is that score calculator is trying to
pair given Worker with every TaskAssignment. So I have to make set of
TaskAssignment as small as possible. I can acquire that by storing in a
Worker any kind of Set including all assigned TaskAssignments. After this my
domain should looks like this:
* Worker (int id, List<TimePeriod> workingHours, Set<TaskAssignment>
cashedTaskAssignments)
* TaskAssignment (int id, List<TimePeriod> possibleExecutionTime, Duration
leadTime, Worker worker)
and my rule:
rule "ASSIGN_OUT_OF_WORKING_TIME"
when
$w : Worker($id : id != 0, $wh : workingHours, *$cta :
cachedTaskAssignments*)
$ta : TaskAssignment() *from $cta*
not TimePeriod( isBetweenInclusive($ta.getTimeSlot()),
isBetweenInclusive($ta.getEndTimeSlot()) ) from $wh
then
insertLogical(new IntConstraintOccurrence("ASSIGN_OUT_OF_WORKING_TIME",
ConstraintType.NEGATIVE_HARD,
ASSIGN_OUT_OF_WORKING_TIME, $w ));
end
My cloneSolution() method is cloning everything right (deep clone of every
TaskAssignment and Worker). I've checked it via many tests. Anyways I'm
getting:
*Score corruption: the workingScore (-1800hard/0soft) is not the
uncorruptedScore (-1904hard/0soft):*
or similar error.
To sum up:
* my system works fine without any changes in Worker class
* I want to make it faster by caching assigned TaskAssignments in a Worker
objects
* I'm getting 'Score corruption' error
Is my idea possible to play out?
--
View this message in context:
http://drools.46999.n3.nabble.com/Planner-DRL-Changable-problem-facts-tp4...
Sent from the Drools: User forum mailing list archive at
Nabble.com.