[rules-users] [Planner]

Mats Norén mats.noren at gmail.com
Mon Apr 29 11:26:06 EDT 2013


Hi,
I've got a really simple problem that I can't seem to fix. :-)
I'm trying to use a simplified model for a room planning problem.
The planning entity is a Topic and the planning variables are Room and
TimeSlot.
A Person is tied to a Topic as a moderator.
Each Person can have multiple Topics as an interest.

The hard constraints are that a Person cannot be moderator in two Topics at
the same TimeSlot and that there cannot be multiple Topics in the same Room
at the same TimeSlot.

rule "conflictingModeratorInSameTimeslot"
    when
        $leftTopic : Topic($leftId : id, $leftTimeslot : timeSlot, timeSlot
!= null, $leftModerator: moderator)
        $rightTopic : Topic(timeSlot == $leftTimeslot, moderator ==
$leftModerator, id > $leftId)
    then
        scoreHolder.addHardConstraintMatch(kcontext, -1);
end

rule "multipleTopicsInSameRoomAndTimeslot"
    when
        $leftTopic : Topic($leftId : id, $leftTimeslot : timeSlot, timeSlot
!= null, $leftRoom: room)
        $rightTopic : Topic(timeSlot == $leftTimeslot, room == $leftRoom,
id > $leftId)
    then
        scoreHolder.addHardConstraintMatch(kcontext, -1);
end

The soft constraint that I have a problem with is that a Person has
multiple Topics as interests and I would like to penalize the Solution with
the number of Topics in the Persons interests collection with the number of
Topics that are allocated at the same TimeSlot.

Any ideas on how to go about this?

Regards,
Mats
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130429/668254cd/attachment.html 


More information about the rules-users mailing list