Op 22-08-12 03:25, zjg_robin schreef:
Thank you, Geoffrey.
But it seems in Choco and similar solvers, I only need to encode the
constraints and the solvers do the rest things for me, while, in Drools, I
need to write the constraints with skills maybe plus other object data
structures which may be complicated to design. Is this concept right?
You only need those other object data structures if your constraints
need them. They make your constraints readable and object orientated.
Think about it, for example defining the dayOffRequest constraint:
In Planner you base it on a DayOffRequest class and a ShiftAssignment
class, by using DayOffRequest.getEmployee() and
DayOffRequest.getShiftDate().
In LP based solvers, there is no DayOffRequest class and a
ShiftAssignment class, instead they are represented as ints, int arrays
or even arrays of arrays of ints. No code encapsulation, no OO.
In fact, you have to manually translate id's into indexes (because id's
have gaps and indexes can't have gaps).
For example, in Planner you write it like this. Notice that you can read it.
// Requested day on/off
rule "dayOffRequest"
when
$dayOffRequest : DayOffRequest($e : employee, $d : shiftDate)
$assignment : ShiftAssignment(employee == $e, shiftDate == $d)
then
... // dayOffPenalty = $dayOffRequest.getWeight()
end
Notice how $dayOffRequest and $assignment are typed variables.
In LP you have to write:
dayOffPenalty <- sum[dayOffRequestArray in
dayOffRequestArrays](shiftAssignmentArray[employeeIndexFromId[dayOffRequestArray[0]]][dayOffRequestArray[1]]
* dayOffRequestArray[2]);
Notice how the "dayOffRequestArray[2]" magically means it's the weight.
What do "dayOffRequestArray[1]" and "dayOffRequestArray[0]" mean? What
if the weight is a BigDecimal instead of an int?
And despite lacking that mathematical equation, Planner has better
results (as shown in the competitions :)
--
View this message in context:
http://drools.46999.n3.nabble.com/What-s-the-difference-between-Drools-an...
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