[jboss-svn-commits] JBL Code SVN: r36093 - in labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples: manners2009/solver and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Nov 28 10:34:57 EST 2010
Author: ge0ffrey
Date: 2010-11-28 10:34:56 -0500 (Sun, 28 Nov 2010)
New Revision: 36093
Modified:
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/examination/solver/examinationScoreRules.drl
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/manners2009/solver/manners2009ScoreRules.drl
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nqueens/solver/nQueensScoreRules.drl
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/pas/solver/patientAdmissionScheduleBaseScoreRules.drl
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/pas/solver/patientAdmissionScheduleSameBedInSameNightScoreRule.drl
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/travelingtournament/solver/simple/simpleTravelingTournamentScoreRules.drl
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/travelingtournament/solver/smart/smartTravelingTournamentScoreRules.drl
Log:
remove unnecessary ; from drl files
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/examination/solver/examinationScoreRules.drl
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/examination/solver/examinationScoreRules.drl 2010-11-28 15:15:33 UTC (rev 36092)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/examination/solver/examinationScoreRules.drl 2010-11-28 15:34:56 UTC (rev 36093)
@@ -45,9 +45,9 @@
// Two exams in the same period which share students.
rule "conflictingExamsInSamePeriod"
when
- $topicConflict : TopicConflict($leftTopic : leftTopic, $rightTopic : rightTopic);
- $leftExam : Exam(topic == $leftTopic, $period : period);
- $rightExam : Exam(topic == $rightTopic, period == $period);
+ $topicConflict : TopicConflict($leftTopic : leftTopic, $rightTopic : rightTopic)
+ $leftExam : Exam(topic == $leftTopic, $period : period)
+ $rightExam : Exam(topic == $rightTopic, period == $period)
then
insertLogical(new IntConstraintOccurrence("conflictingExamsInSamePeriod", ConstraintType.NEGATIVE_HARD,
$topicConflict.getStudentSize(),
@@ -57,7 +57,7 @@
// More time required during a period than available in that period.
rule "periodDurationTooShort"
when
- $exam : Exam(topicDuration > periodDuration);
+ $exam : Exam(topicDuration > periodDuration)
then
insertLogical(new IntConstraintOccurrence("periodDurationTooShort", ConstraintType.NEGATIVE_HARD,
$exam.getTopicStudentSize(),
@@ -67,12 +67,12 @@
// More seating required during a period in a room than available in that room.
rule "roomCapacityTooSmall" // TODO improve performance, as it takes 50% of the performance
when
- $period : Period();
- $room : Room($capacity : capacity);
+ $period : Period()
+ $room : Room($capacity : capacity)
$totalStudentSize : Number(intValue > $capacity) from accumulate(
Exam(period == $period, room == $room, $studentSize : topicStudentSize),
sum($studentSize) // Vote for http://jira.jboss.com/jira/browse/JBRULES-1075
- );
+ )
then
insertLogical(new IntConstraintOccurrence("roomCapacityTooSmall", ConstraintType.NEGATIVE_HARD,
($totalStudentSize.intValue() - $capacity),
@@ -86,9 +86,9 @@
periodHardConstraintType == PeriodHardConstraintType.EXAM_COINCIDENCE,
$leftSideTopic : leftSideTopic,
$rightSideTopic : rightSideTopic
- );
- $leftExam : Exam(topic == $leftSideTopic, $leftSidePeriod : period);
- $rightExam : Exam(topic == $rightSideTopic, period != $leftSidePeriod);
+ )
+ $leftExam : Exam(topic == $leftSideTopic, $leftSidePeriod : period)
+ $rightExam : Exam(topic == $rightSideTopic, period != $leftSidePeriod)
// LeftSide and rightSide don't share a student because those are filtered out in the InputConvertor
then
insertLogical(new IntConstraintOccurrence("periodHardConstraintExamCoincidence", ConstraintType.NEGATIVE_HARD,
@@ -101,9 +101,9 @@
periodHardConstraintType == PeriodHardConstraintType.EXCLUSION,
$leftSideTopic : leftSideTopic,
$rightSideTopic : rightSideTopic
- );
- $leftExam : Exam(topic == $leftSideTopic, $leftSidePeriod : period);
- $rightExam : Exam(topic == $rightSideTopic, period == $leftSidePeriod);
+ )
+ $leftExam : Exam(topic == $leftSideTopic, $leftSidePeriod : period)
+ $rightExam : Exam(topic == $rightSideTopic, period == $leftSidePeriod)
then
insertLogical(new IntConstraintOccurrence("periodHardConstraintExclusion", ConstraintType.NEGATIVE_HARD,
($leftSideTopic.getStudentSize() + $rightSideTopic.getStudentSize()),
@@ -115,11 +115,11 @@
periodHardConstraintType == PeriodHardConstraintType.AFTER,
$leftSideTopic : leftSideTopic,
$rightSideTopic : rightSideTopic
- );
- $leftExam : Exam(topic == $leftSideTopic, $afterSidePeriod : period);
+ )
+ $leftExam : Exam(topic == $leftSideTopic, $afterSidePeriod : period)
$rightExam : Exam(topic == $rightSideTopic, eval($afterSidePeriod.getPeriodIndex() <= period.getPeriodIndex()),
$beforeSidePeriod : period
- );
+ )
then
insertLogical(new IntConstraintOccurrence("periodHardConstraintAfter", ConstraintType.NEGATIVE_HARD,
($leftSideTopic.getStudentSize() + $rightSideTopic.getStudentSize()),
@@ -132,9 +132,9 @@
$roomHardConstraint : RoomHardConstraint(
roomHardConstraintType == RoomHardConstraintType.ROOM_EXCLUSIVE,
$topic : topic
- );
- $leftExam : Exam(topic == $topic, $room : room);
- $rightExam : Exam(room == $room, topic != $topic, $otherTopic : topic);
+ )
+ $leftExam : Exam(topic == $topic, $room : room)
+ $rightExam : Exam(room == $room, topic != $topic, $otherTopic : topic)
then
insertLogical(new IntConstraintOccurrence("roomHardConstraintExclusive", ConstraintType.NEGATIVE_HARD,
($topic.getStudentSize() + $otherTopic.getStudentSize()),
@@ -148,12 +148,12 @@
// Two exams in a row which share students
rule "twoExamsInARow"
when
- $institutionalWeighting : InstitutionalWeighting(twoInARowPenality != 0);
- $topicConflict : TopicConflict($leftTopic : leftTopic, $rightTopic : rightTopic);
- $leftExam : Exam(topic == $leftTopic, $leftPeriod : period);
- $rightExam : Exam(topic == $rightTopic, $rightPeriod : period);
- eval($leftPeriod.getDayIndex() == $rightPeriod.getDayIndex());
- eval(Math.abs($leftPeriod.getPeriodIndex() - $rightPeriod.getPeriodIndex()) == 1);
+ $institutionalWeighting : InstitutionalWeighting(twoInARowPenality != 0)
+ $topicConflict : TopicConflict($leftTopic : leftTopic, $rightTopic : rightTopic)
+ $leftExam : Exam(topic == $leftTopic, $leftPeriod : period)
+ $rightExam : Exam(topic == $rightTopic, $rightPeriod : period)
+ eval($leftPeriod.getDayIndex() == $rightPeriod.getDayIndex())
+ eval(Math.abs($leftPeriod.getPeriodIndex() - $rightPeriod.getPeriodIndex()) == 1)
then
insertLogical(new IntConstraintOccurrence("twoExamsInARow", ConstraintType.NEGATIVE_SOFT,
$topicConflict.getStudentSize() * $institutionalWeighting.getTwoInARowPenality(),
@@ -164,12 +164,12 @@
// Two exams in a day which share students
rule "twoExamsInADay"
when
- $institutionalWeighting : InstitutionalWeighting(twoInADayPenality != 0);
- $topicConflict : TopicConflict($leftTopic : leftTopic, $rightTopic : rightTopic);
- $leftExam : Exam(topic == $leftTopic, $leftPeriod : period);
- $rightExam : Exam(topic == $rightTopic, $rightPeriod : period);
- eval($leftPeriod.getDayIndex() == $rightPeriod.getDayIndex());
- eval(Math.abs($leftPeriod.getPeriodIndex() - $rightPeriod.getPeriodIndex()) > 1);
+ $institutionalWeighting : InstitutionalWeighting(twoInADayPenality != 0)
+ $topicConflict : TopicConflict($leftTopic : leftTopic, $rightTopic : rightTopic)
+ $leftExam : Exam(topic == $leftTopic, $leftPeriod : period)
+ $rightExam : Exam(topic == $rightTopic, $rightPeriod : period)
+ eval($leftPeriod.getDayIndex() == $rightPeriod.getDayIndex())
+ eval(Math.abs($leftPeriod.getPeriodIndex() - $rightPeriod.getPeriodIndex()) > 1)
then
insertLogical(new IntConstraintOccurrence("twoExamsInADay", ConstraintType.NEGATIVE_SOFT,
$topicConflict.getStudentSize() * $institutionalWeighting.getTwoInADayPenality(),
@@ -179,12 +179,12 @@
// Exams which share students have to few periods between them
rule "periodSpread"
when
- $institutionalWeighting : InstitutionalWeighting(periodSpreadPenality != 0);
- $topicConflict : TopicConflict($leftTopic : leftTopic, $rightTopic : rightTopic);
- $leftExam : Exam(topic == $leftTopic, $leftPeriod : period);
- $rightExam : Exam(topic == $rightTopic, $rightPeriod : period);
+ $institutionalWeighting : InstitutionalWeighting(periodSpreadPenality != 0)
+ $topicConflict : TopicConflict($leftTopic : leftTopic, $rightTopic : rightTopic)
+ $leftExam : Exam(topic == $leftTopic, $leftPeriod : period)
+ $rightExam : Exam(topic == $rightTopic, $rightPeriod : period)
eval(Math.abs($leftPeriod.getPeriodIndex() - $rightPeriod.getPeriodIndex())
- < ($institutionalWeighting.getPeriodSpreadLength() + 1));
+ < ($institutionalWeighting.getPeriodSpreadLength() + 1))
then
insertLogical(new IntConstraintOccurrence("periodSpread", ConstraintType.NEGATIVE_SOFT,
$topicConflict.getStudentSize() * $institutionalWeighting.getPeriodSpreadPenality(),
@@ -194,20 +194,20 @@
// Several exams in the same room and period have different durations
rule "mixedDurations"
when
- $institutionalWeighting : InstitutionalWeighting(mixedDurationPenality != 0);
- $leftExam : Exam($leftId : id, $period : period, room != null, $room : room, $leftTopic : topic);
+ $institutionalWeighting : InstitutionalWeighting(mixedDurationPenality != 0)
+ $leftExam : Exam($leftId : id, $period : period, room != null, $room : room, $leftTopic : topic)
// 4 mixed durations of 100, 150, 200 and 200 should only result in 2 penalty's (for 100&150 and 100&200)
// leftExam has lowest id of the period+room combo
- not Exam(period == $period, room == $room, id < $leftId);
+ not Exam(period == $period, room == $room, id < $leftId)
// rightExam has a different duration
$rightExam : Exam(period == $period, room == $room, id > $leftId,
eval(topic.getDuration() != $leftTopic.getDuration()),
$rightId : id, $rightTopic : topic
- );
+ )
// rightExam has the lowest id of the period+room+rightDuration combo
not Exam(period == $period, room == $room, id < $rightId,
eval(topic.getDuration() == $rightTopic.getDuration())
- );
+ )
then
insertLogical(new IntConstraintOccurrence("mixedDurations", ConstraintType.NEGATIVE_SOFT,
$institutionalWeighting.getMixedDurationPenality(),
@@ -217,10 +217,10 @@
// Larger Exams towards the beginning of the examination session
rule "frontLoad"
when
- $institutionalWeighting : InstitutionalWeighting(frontLoadPenality != 0);
- $topic : Topic(frontLoadLarge == true);
- $period : Period(frontLoadLast == true);
- $exam : Exam(topic == $topic, period == $period);
+ $institutionalWeighting : InstitutionalWeighting(frontLoadPenality != 0)
+ $topic : Topic(frontLoadLarge == true)
+ $period : Period(frontLoadLast == true)
+ $exam : Exam(topic == $topic, period == $period)
then
insertLogical(new IntConstraintOccurrence("frontLoad", ConstraintType.NEGATIVE_SOFT,
$institutionalWeighting.getFrontLoadPenality(),
@@ -230,8 +230,8 @@
// Period Penalty
rule "periodPenalty"
when
- $period : Period(penalty != 0);
- $exam: Exam(period == $period);
+ $period : Period(penalty != 0)
+ $exam: Exam(period == $period)
then
insertLogical(new IntConstraintOccurrence("periodPenalty", ConstraintType.NEGATIVE_SOFT,
$period.getPenalty(),
@@ -241,8 +241,8 @@
// Room Penalty
rule "roomPenalty"
when
- $room : Room(penalty != 0);
- $exam: Exam(room == $room);
+ $room : Room(penalty != 0)
+ $exam: Exam(room == $room)
then
insertLogical(new IntConstraintOccurrence("roomPenalty", ConstraintType.NEGATIVE_SOFT,
$room.getPenalty(),
@@ -260,7 +260,7 @@
$hardTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType == ConstraintType.NEGATIVE_HARD, $weight : weight),
sum($weight) // Vote for http://jira.jboss.com/jira/browse/JBRULES-1075
- );
+ )
then
scoreCalculator.setHardConstraintsBroken($hardTotal.intValue());
end
@@ -272,7 +272,7 @@
$softTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType == ConstraintType.NEGATIVE_SOFT, $weight : weight),
sum($weight) // Vote for http://jira.jboss.com/jira/browse/JBRULES-1075
- );
+ )
then
scoreCalculator.setSoftConstraintsBroken($softTotal.intValue());
end
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/manners2009/solver/manners2009ScoreRules.drl
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/manners2009/solver/manners2009ScoreRules.drl 2010-11-28 15:15:33 UTC (rev 36092)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/manners2009/solver/manners2009ScoreRules.drl 2010-11-28 15:34:56 UTC (rev 36093)
@@ -50,13 +50,13 @@
// 2 teachers at each table
rule "twoSameJobTypePerTable"
when
- $jobType : JobType();
- $table : Table();
+ $jobType : JobType()
+ $table : Table()
not (
SeatDesignation(guestJobType == $jobType, seatTable == $table, $firstJob : guestJob)
and SeatDesignation(guestJobType == $jobType, seatTable == $table, $secondJob : guestJob)
and (eval($jobType == JobType.SOCIALITE) or eval($jobType == JobType.TEACHER) or eval($firstJob != $secondJob))
- );
+ )
then
insertLogical(new UnweightedConstraintOccurrence("twoSameJobTypePerTable",
$jobType, $table));
@@ -67,9 +67,9 @@
// This extra rule can be avoided by weighting the broken constrainst of the other rule
rule "atLeastOneJobTypePerTableScoreGuider"
when
- $table : Table();
- $jobType : JobType();
- not SeatDesignation(guestJobType == $jobType, seatTable == $table);
+ $table : Table()
+ $jobType : JobType()
+ not SeatDesignation(guestJobType == $jobType, seatTable == $table)
then
insertLogical(new UnweightedConstraintOccurrence("tableWithoutJobTypeShouldBePunishedExtra",
$jobType, $table));
@@ -80,14 +80,14 @@
// (so also the same or another hobby with his/her right neighbour)
rule "leftHasHobbyInCommon"
when
- $leftSeat : Seat();
- $rightSeat : Seat(leftSeat == $leftSeat);
- $leftDesignation : SeatDesignation($leftGuest : guest, seat == $leftSeat);
- $rightDesignation : SeatDesignation($rightGuest : guest, seat == $rightSeat);
+ $leftSeat : Seat()
+ $rightSeat : Seat(leftSeat == $leftSeat)
+ $leftDesignation : SeatDesignation($leftGuest : guest, seat == $leftSeat)
+ $rightDesignation : SeatDesignation($rightGuest : guest, seat == $rightSeat)
not (
HobbyPractician(guest == $leftGuest, $leftHobby : hobby)
and HobbyPractician(guest == $rightGuest, hobby == $leftHobby)
- );
+ )
then
insertLogical(new UnweightedConstraintOccurrence("leftHasHobbyInCommon",
$leftDesignation, $rightDesignation));
@@ -102,7 +102,7 @@
$occurrenceCount : Number() from accumulate(
$unweightedConstraintOccurrence : UnweightedConstraintOccurrence(),
count($unweightedConstraintOccurrence)
- );
+ )
then
scoreCalculator.setScore(- $occurrenceCount.intValue());
end
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nqueens/solver/nQueensScoreRules.drl
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nqueens/solver/nQueensScoreRules.drl 2010-11-28 15:15:33 UTC (rev 36092)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nqueens/solver/nQueensScoreRules.drl 2010-11-28 15:34:56 UTC (rev 36093)
@@ -31,8 +31,8 @@
rule "multipleQueensHorizontal"
when
- $q1 : Queen($id : id, $y : y);
- $q2 : Queen(id > $id, y == $y);
+ $q1 : Queen($id : id, $y : y)
+ $q2 : Queen(id > $id, y == $y)
then
insertLogical(new UnweightedConstraintOccurrence("multipleQueensHorizontal", $q1, $q2));
end
@@ -41,16 +41,16 @@
rule "multipleQueensAscendingDiagonal"
when
- $q1 : Queen($id : id, $ascendingD : ascendingD);
- $q2 : Queen(id > $id, ascendingD == $ascendingD);
+ $q1 : Queen($id : id, $ascendingD : ascendingD)
+ $q2 : Queen(id > $id, ascendingD == $ascendingD)
then
insertLogical(new UnweightedConstraintOccurrence("multipleQueensAscendingDiagonal", $q1, $q2));
end
rule "multipleQueensDescendingDiagonal"
when
- $q1 : Queen($id : id, $descendingD : descendingD);
- $q2 : Queen(id > $id, descendingD == $descendingD);
+ $q1 : Queen($id : id, $descendingD : descendingD)
+ $q2 : Queen(id > $id, descendingD == $descendingD)
then
insertLogical(new UnweightedConstraintOccurrence("multipleQueensDescendingDiagonal", $q1, $q2));
end
@@ -64,12 +64,12 @@
$occurrenceCount : Number() from accumulate(
$unweightedConstraintOccurrence : UnweightedConstraintOccurrence(),
count($unweightedConstraintOccurrence)
- );
+ )
then
scoreCalculator.setScore(- $occurrenceCount.intValue());
end
-// Don't do this. It breaks performance and scalability!
+// Don't do this. It breaks performance and scalability! Will be fixed with set based propagation
//rule "hardConstraintsBroken"
// when
// $multipleQueensHorizontal : Number()
@@ -77,19 +77,19 @@
// $q1 : Queen($id : id, $y : y)
// and Queen(id > $id, y == $y),
// count($q1)
-// );
+// )
// $multipleQueensAscendingDiagonal : Number()
// from accumulate(
// $q1 : Queen($id : id, $ascendingD : ascendingD)
// and Queen(id > $id, ascendingD == $ascendingD),
// count($q1)
-// );
+// )
// $multipleQueensDescendingDiagonal : Number()
// from accumulate(
// $q1 : Queen($id : id, $descendingD : descendingD)
// and Queen(id > $id, descendingD == $descendingD),
// count($q1)
-// );
+// )
// then
// scoreCalculator.setScore(- $multipleQueensHorizontal.intValue()
// - $multipleQueensAscendingDiagonal.intValue() - $multipleQueensDescendingDiagonal.intValue());
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/pas/solver/patientAdmissionScheduleBaseScoreRules.drl
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/pas/solver/patientAdmissionScheduleBaseScoreRules.drl 2010-11-28 15:15:33 UTC (rev 36092)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/pas/solver/patientAdmissionScheduleBaseScoreRules.drl 2010-11-28 15:34:56 UTC (rev 36093)
@@ -62,7 +62,7 @@
when
// TODO try optimizing joins with $room : Room(genderLimitation == GenderLimitation.MALE_ONLY)
$bedDesignation : BedDesignation(roomGenderLimitation == GenderLimitation.MALE_ONLY,
- patientGender == Gender.FEMALE);
+ patientGender == Gender.FEMALE)
then
insertLogical(new IntConstraintOccurrence("femaleInMaleRoom",
ConstraintType.NEGATIVE_SOFT,
@@ -73,7 +73,7 @@
rule "maleInFemaleRoom"
when
$bedDesignation : BedDesignation(roomGenderLimitation == GenderLimitation.FEMALE_ONLY,
- patientGender == Gender.MALE);
+ patientGender == Gender.MALE)
then
insertLogical(new IntConstraintOccurrence("maleInFemaleRoom",
ConstraintType.NEGATIVE_SOFT,
@@ -86,10 +86,10 @@
when
$admissionPartConflict : AdmissionPartConflict($leftAdmissionPart : leftAdmissionPart,
$rightAdmissionPart : rightAdmissionPart,
- differentGender == true);
+ differentGender == true)
$leftBedDesignation : BedDesignation(roomGenderLimitation == GenderLimitation.SAME_GENDER,
- admissionPart == $leftAdmissionPart, $room : room);
- $rightBedDesignation : BedDesignation(room == $room, admissionPart == $rightAdmissionPart);
+ admissionPart == $leftAdmissionPart, $room : room)
+ $rightBedDesignation : BedDesignation(room == $room, admissionPart == $rightAdmissionPart)
then
insertLogical(new IntConstraintOccurrence("differentGenderInSameGenderRoomInSameNight",
ConstraintType.NEGATIVE_SOFT,
@@ -100,8 +100,8 @@
// Department's minimumAge constraint
rule "departmentMinimumAge"
when
- $department : Department(minimumAge != null, $minimumAge : minimumAge);
- $bedDesignation : BedDesignation(department == $department, patientAge < $minimumAge);
+ $department : Department(minimumAge != null, $minimumAge : minimumAge)
+ $bedDesignation : BedDesignation(department == $department, patientAge < $minimumAge)
then
insertLogical(new IntConstraintOccurrence("departmentMinimumAge",
ConstraintType.NEGATIVE_SOFT,
@@ -111,8 +111,8 @@
// Department's maximumAge constraint
rule "departmentMaximumAge"
when
- $department : Department(maximumAge != null, $maximumAge : maximumAge);
- $bedDesignation : BedDesignation(department == $department, patientAge > $maximumAge);
+ $department : Department(maximumAge != null, $maximumAge : maximumAge)
+ $bedDesignation : BedDesignation(department == $department, patientAge > $maximumAge)
then
insertLogical(new IntConstraintOccurrence("departmentMaximumAge",
ConstraintType.NEGATIVE_SOFT,
@@ -126,7 +126,7 @@
rule "preferredMaximumRoomCapacity"
when
$bedDesignation : BedDesignation(patientPreferredMaximumRoomCapacity != null,
- patientPreferredMaximumRoomCapacity < roomCapacity);
+ patientPreferredMaximumRoomCapacity < roomCapacity)
then
insertLogical(new IntConstraintOccurrence("preferredMaximumRoomCapacity",
ConstraintType.NEGATIVE_SOFT,
@@ -140,8 +140,8 @@
// DepartmentSpecialism constraint
rule "departmentSpecialism"
when
- $bedDesignation : BedDesignation($specialism : admissionPartSpecialism, $department : department);
- not DepartmentSpecialism(department == $department, specialism == $specialism);
+ $bedDesignation : BedDesignation($specialism : admissionPartSpecialism, $department : department)
+ not DepartmentSpecialism(department == $department, specialism == $specialism)
then
insertLogical(new IntConstraintOccurrence("departmentSpecialism",
ConstraintType.NEGATIVE_SOFT, 10 * $bedDesignation.getAdmissionPart().getNightCount(),
@@ -151,8 +151,8 @@
// RoomSpecialism constraint
rule "roomSpecialismNotExists"
when
- $bedDesignation : BedDesignation(admissionPartSpecialism != null, $specialism : admissionPartSpecialism, $room : room);
- not RoomSpecialism(room == $room, specialism == $specialism);
+ $bedDesignation : BedDesignation(admissionPartSpecialism != null, $specialism : admissionPartSpecialism, $room : room)
+ not RoomSpecialism(room == $room, specialism == $specialism)
then
insertLogical(new IntConstraintOccurrence("roomSpecialismNotExists",
ConstraintType.NEGATIVE_SOFT, 20 * $bedDesignation.getAdmissionPart().getNightCount(),
@@ -160,8 +160,8 @@
end
rule "roomSpecialismNotFirstPriority"
when
- $bedDesignation : BedDesignation(admissionPartSpecialism != null, $specialism : admissionPartSpecialism, $room : room);
- RoomSpecialism(priority > 1, room == $room, specialism == $specialism, $priority : priority);
+ $bedDesignation : BedDesignation(admissionPartSpecialism != null, $specialism : admissionPartSpecialism, $room : room)
+ RoomSpecialism(priority > 1, room == $room, specialism == $specialism, $priority : priority)
then
insertLogical(new IntConstraintOccurrence("roomSpecialismNotFirstPriority",
ConstraintType.NEGATIVE_SOFT, 10 * ($priority - 1) * $bedDesignation.getAdmissionPart().getNightCount(),
@@ -171,9 +171,9 @@
// RequiredPatientEquipment constraint
rule "requiredPatientEquipment"
when
- $requiredPatientEquipment : RequiredPatientEquipment($patient : patient, $equipment : equipment);
- $bedDesignation : BedDesignation(patient == $patient, $room : room);
- not RoomEquipment(room == $room, equipment == $equipment);
+ $requiredPatientEquipment : RequiredPatientEquipment($patient : patient, $equipment : equipment)
+ $bedDesignation : BedDesignation(patient == $patient, $room : room)
+ not RoomEquipment(room == $room, equipment == $equipment)
then
insertLogical(new IntConstraintOccurrence("requiredPatientEquipment",
ConstraintType.NEGATIVE_SOFT, 50 * $bedDesignation.getAdmissionPart().getNightCount(),
@@ -183,9 +183,9 @@
// PreferredPatientEquipment constraint
rule "preferredPatientEquipment"
when
- $preferredPatientEquipment : PreferredPatientEquipment($patient : patient, $equipment : equipment);
- $bedDesignation : BedDesignation(patient == $patient, $room : room);
- not RoomEquipment(room == $room, equipment == $equipment);
+ $preferredPatientEquipment : PreferredPatientEquipment($patient : patient, $equipment : equipment)
+ $bedDesignation : BedDesignation(patient == $patient, $room : room)
+ not RoomEquipment(room == $room, equipment == $equipment)
then
insertLogical(new IntConstraintOccurrence("preferredPatientEquipment",
ConstraintType.NEGATIVE_SOFT, 20 * $bedDesignation.getAdmissionPart().getNightCount(),
@@ -205,7 +205,7 @@
$hardTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType == ConstraintType.NEGATIVE_HARD, $weight : weight),
sum($weight) // Vote for http://jira.jboss.com/jira/browse/JBRULES-1075
- );
+ )
then
scoreCalculator.setHardConstraintsBroken($hardTotal.intValue());
end
@@ -217,7 +217,7 @@
$softTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType == ConstraintType.NEGATIVE_SOFT, $weight : weight),
sum($weight) // Vote for http://jira.jboss.com/jira/browse/JBRULES-1075
- );
+ )
then
scoreCalculator.setSoftConstraintsBroken($softTotal.intValue());
end
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/pas/solver/patientAdmissionScheduleSameBedInSameNightScoreRule.drl
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/pas/solver/patientAdmissionScheduleSameBedInSameNightScoreRule.drl 2010-11-28 15:15:33 UTC (rev 36092)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/pas/solver/patientAdmissionScheduleSameBedInSameNightScoreRule.drl 2010-11-28 15:34:56 UTC (rev 36093)
@@ -47,9 +47,9 @@
rule "sameBedInSameNight"
when
$admissionPartConflict : AdmissionPartConflict($leftAdmissionPart : leftAdmissionPart,
- $rightAdmissionPart : rightAdmissionPart);
- $leftBedDesignation : BedDesignation(admissionPart == $leftAdmissionPart, $bed : bed);
- $rightBedDesignation : BedDesignation(admissionPart == $rightAdmissionPart, bed == $bed);
+ $rightAdmissionPart : rightAdmissionPart)
+ $leftBedDesignation : BedDesignation(admissionPart == $leftAdmissionPart, $bed : bed)
+ $rightBedDesignation : BedDesignation(admissionPart == $rightAdmissionPart, bed == $bed)
then
insertLogical(new IntConstraintOccurrence("sameBedInSameNight",
ConstraintType.NEGATIVE_HARD, 1000 * $admissionPartConflict.getNightSize(),
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/travelingtournament/solver/simple/simpleTravelingTournamentScoreRules.drl
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/travelingtournament/solver/simple/simpleTravelingTournamentScoreRules.drl 2010-11-28 15:15:33 UTC (rev 36092)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/travelingtournament/solver/simple/simpleTravelingTournamentScoreRules.drl 2010-11-28 15:34:56 UTC (rev 36093)
@@ -37,39 +37,39 @@
rule "multipleMatchesPerTeamPerDay"
when
- $team : Team();
+ $team : Team()
$m : Match( $id : id, homeTeam == $team, $day : day )
- || $m : Match( $id : id, awayTeam == $team, $day : day );
+ || $m : Match( $id : id, awayTeam == $team, $day : day )
exists Match( id > $id, homeTeam == $team, day == $day )
- || exists Match(id > $id, awayTeam == $team, day == $day );
+ || exists Match(id > $id, awayTeam == $team, day == $day )
then
insertLogical(new UnweightedConstraintOccurrence("multipleMatchesPerTeamPerDay", $m));
end
rule "fourConsecutiveHomeMatches"
when
- $m : Match($homeTeam : homeTeam, $day1 : day);
- Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 1));
- Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 2));
- Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 3));
+ $m : Match($homeTeam : homeTeam, $day1 : day)
+ Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 1))
+ Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 2))
+ Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 3))
then
insertLogical(new UnweightedConstraintOccurrence("fourConsecutiveHomeMatches", $m));
end
rule "fourConsecutiveAwayMatches"
when
- $m : Match($awayTeam : awayTeam, $day1 : day);
- Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 1));
- Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 2));
- Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 3));
+ $m : Match($awayTeam : awayTeam, $day1 : day)
+ Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 1))
+ Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 2))
+ Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 3))
then
insertLogical(new UnweightedConstraintOccurrence("fourConsecutiveAwayMatches", $m));
end
rule "matchRepeater"
when
- $m : Match($homeTeam : homeTeam, $awayTeam : awayTeam, $day1 : day);
- Match(homeTeam == $awayTeam, awayTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 1));
+ $m : Match($homeTeam : homeTeam, $awayTeam : awayTeam, $day1 : day)
+ Match(homeTeam == $awayTeam, awayTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 1))
then
insertLogical(new UnweightedConstraintOccurrence("matchRepeater", $m));
end
@@ -80,36 +80,36 @@
rule "startToAwayHop"
when
- Match($toTeam : homeTeam, $team : awayTeam, $day : day);
- not Day(eval(index == $day.getIndex() - 1));
+ Match($toTeam : homeTeam, $team : awayTeam, $day : day)
+ not Day(eval(index == $day.getIndex() - 1))
then
insertLogical(new Hop($team, $team, $toTeam));
end
rule "homeToAwayHop"
when
- Match($team : homeTeam, $day1 : day);
- Match($toTeam : homeTeam, awayTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1));
+ Match($team : homeTeam, $day1 : day)
+ Match($toTeam : homeTeam, awayTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1))
then
insertLogical(new Hop($team, $team, $toTeam));
end
rule "awayToAwayHop"
when
- Match($fromTeam : homeTeam, $team : awayTeam, $day1 : day);
- Match($toTeam : homeTeam, awayTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1));
+ Match($fromTeam : homeTeam, $team : awayTeam, $day1 : day)
+ Match($toTeam : homeTeam, awayTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1))
then
insertLogical(new Hop($team, $fromTeam, $toTeam));
end
rule "awayToHomeHop"
when
- Match($fromTeam : homeTeam, $team : awayTeam, $day1 : day);
- Match(homeTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1));
+ Match($fromTeam : homeTeam, $team : awayTeam, $day1 : day)
+ Match(homeTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1))
then
insertLogical(new Hop($team, $fromTeam, $team));
end
rule "awayToEndHop"
when
- Match($fromTeam : homeTeam, $team : awayTeam, $day : day);
- not Day(eval(index == $day.getIndex() + 1));
+ Match($fromTeam : homeTeam, $team : awayTeam, $day : day)
+ not Day(eval(index == $day.getIndex() + 1))
then
insertLogical(new Hop($team, $fromTeam, $team));
end
@@ -124,7 +124,7 @@
$occurrenceCount : Number() from accumulate(
$unweightedConstraintOccurrence : UnweightedConstraintOccurrence(),
count($unweightedConstraintOccurrence)
- );
+ )
then
scoreCalculator.setHardConstraintsBroken($occurrenceCount.intValue());
end
@@ -135,7 +135,7 @@
$totalDistance : Double() from accumulate(
Hop($distance : distance),
sum($distance)
- );
+ )
then
scoreCalculator.setSoftConstraintsBroken($totalDistance.intValue());
end
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/travelingtournament/solver/smart/smartTravelingTournamentScoreRules.drl
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/travelingtournament/solver/smart/smartTravelingTournamentScoreRules.drl 2010-11-28 15:15:33 UTC (rev 36092)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/travelingtournament/solver/smart/smartTravelingTournamentScoreRules.drl 2010-11-28 15:34:56 UTC (rev 36093)
@@ -39,28 +39,28 @@
rule "fourConsecutiveHomeMatches"
when
- $m : Match($homeTeam : homeTeam, $day1 : day);
- Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 1));
- Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 2));
- Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 3));
+ $m : Match($homeTeam : homeTeam, $day1 : day)
+ Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 1))
+ Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 2))
+ Match(homeTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 3))
then
insertLogical(new UnweightedConstraintOccurrence("fourConsecutiveHomeMatches", $m));
end
rule "fourConsecutiveAwayMatches"
when
- $m : Match($awayTeam : awayTeam, $day1 : day);
- Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 1));
- Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 2));
- Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 3));
+ $m : Match($awayTeam : awayTeam, $day1 : day)
+ Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 1))
+ Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 2))
+ Match(awayTeam == $awayTeam, eval(day.getIndex() == $day1.getIndex() + 3))
then
insertLogical(new UnweightedConstraintOccurrence("fourConsecutiveAwayMatches", $m));
end
rule "matchRepeater"
when
- $m : Match($homeTeam : homeTeam, $awayTeam : awayTeam, $day1 : day);
- Match(homeTeam == $awayTeam, awayTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 1));
+ $m : Match($homeTeam : homeTeam, $awayTeam : awayTeam, $day1 : day)
+ Match(homeTeam == $awayTeam, awayTeam == $homeTeam, eval(day.getIndex() == $day1.getIndex() + 1))
then
insertLogical(new UnweightedConstraintOccurrence("matchRepeater", $m));
end
@@ -71,36 +71,36 @@
rule "startToAwayHop"
when
- Match($toTeam : homeTeam, $team : awayTeam, $day : day);
- not Day(eval(index == $day.getIndex() - 1));
+ Match($toTeam : homeTeam, $team : awayTeam, $day : day)
+ not Day(eval(index == $day.getIndex() - 1))
then
insertLogical(new Hop($team, $team, $toTeam));
end
rule "homeToAwayHop"
when
- Match($team : homeTeam, $day1 : day);
- Match($toTeam : homeTeam, awayTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1));
+ Match($team : homeTeam, $day1 : day)
+ Match($toTeam : homeTeam, awayTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1))
then
insertLogical(new Hop($team, $team, $toTeam));
end
rule "awayToAwayHop"
when
- Match($fromTeam : homeTeam, $team : awayTeam, $day1 : day);
- Match($toTeam : homeTeam, awayTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1));
+ Match($fromTeam : homeTeam, $team : awayTeam, $day1 : day)
+ Match($toTeam : homeTeam, awayTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1))
then
insertLogical(new Hop($team, $fromTeam, $toTeam));
end
rule "awayToHomeHop"
when
- Match($fromTeam : homeTeam, $team : awayTeam, $day1 : day);
- Match(homeTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1));
+ Match($fromTeam : homeTeam, $team : awayTeam, $day1 : day)
+ Match(homeTeam == $team, eval(day.getIndex() == $day1.getIndex() + 1))
then
insertLogical(new Hop($team, $fromTeam, $team));
end
rule "awayToEndHop"
when
- Match($fromTeam : homeTeam, $team : awayTeam, $day : day);
- not Day(eval(index == $day.getIndex() + 1));
+ Match($fromTeam : homeTeam, $team : awayTeam, $day : day)
+ not Day(eval(index == $day.getIndex() + 1))
then
insertLogical(new Hop($team, $fromTeam, $team));
end
@@ -115,7 +115,7 @@
$occurrenceCount : Number() from accumulate(
$unweightedConstraintOccurrence : UnweightedConstraintOccurrence(),
count($unweightedConstraintOccurrence)
- );
+ )
then
scoreCalculator.setHardConstraintsBroken($occurrenceCount.intValue());
end
@@ -126,7 +126,7 @@
$totalDistance : Double() from accumulate(
Hop($distance : distance),
sum($distance)
- );
+ )
then
scoreCalculator.setSoftConstraintsBroken($totalDistance.intValue());
end
More information about the jboss-svn-commits
mailing list