[jboss-svn-commits] JBL Code SVN: r17560 - labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jan 4 16:03:58 EST 2008
Author: shabino
Date: 2008-01-04 16:03:57 -0500 (Fri, 04 Jan 2008)
New Revision: 17560
Modified:
labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Derivations.dslr
labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/EligibilityExclusions.dslr
labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/ScoreManagement.dslr
labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Scoring.dslr
labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/WorkerEligibility.dslr
Log:
Modified: labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Derivations.dslr
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Derivations.dslr 2008-01-04 21:03:37 UTC (rev 17559)
+++ labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Derivations.dslr 2008-01-04 21:03:57 UTC (rev 17560)
@@ -22,7 +22,6 @@
import function benchmarks.dispatch.function.Helper.distanceToPickupInMiles
import function benchmarks.dispatch.function.Helper.minutesLateToJob
-import function benchmarks.dispatch.function.Helper.minutesBetweenDates
expander dispatch.dsl
@@ -41,7 +40,6 @@
rule "Time Available for Job when already on Job"
when
w : Worker(status == Worker.Status.DISPATCHED_FOR_JOB)
-
then
DateWorkerInfo workerInfo = new DateWorkerInfo(w.getWorkerId());
workerInfo.setType(WorkerInfo.Type.TIME_AVAILABLE_FOR_DISPATCH);
@@ -73,11 +71,16 @@
end
rule "Distance to job"
+ salience 0
when
j : Job()
job dispatchable
w: Worker()
- dvi: PositionWorkerInfo(workerId == w.workerId, type == WorkerInfo.Type.POSITION_AVAILABLE_FOR_DISPATCH)
+ no exclusions
+ dvi: PositionWorkerInfo(
+ workerId == w.workerId,
+ type == WorkerInfo.Type.POSITION_AVAILABLE_FOR_DISPATCH
+ )
then
Double dist = distanceToPickupInMiles(j, dvi.getLatitude(), dvi.getLongitude());
DecimalInfo i = new DecimalInfo(j, w);
@@ -91,12 +94,14 @@
j : Job()
job dispatchable
w: Worker()
- i: DecimalInfo(jobId == j.jobId, workerId == w.workerId, type == Info.Type.DISTANCE_TO_JOB_MILES)
+ no exclusions
+ within range
then
DecimalInfo ti = new DecimalInfo(j, w);
ti.setType(Info.Type.TIME_TO_JOB_MINUTES);
#Presume 45 MPH
- ti.setValue((Double)i.getValue() / 45 * 60);
+ #dist_mr from "within range"
+ ti.setValue((Double)dist_mr.getValue() / 45 * 60);
insertLogical(ti);
end
@@ -105,6 +110,9 @@
j : Job()
job dispatchable
w: Worker()
+ no exclusions
+ #Redundant, but should be efficient given same rete network as above rule
+ within range
availDate: DateWorkerInfo(workerId == w.workerId, type == WorkerInfo.Type.TIME_AVAILABLE_FOR_DISPATCH)
timeToJob: DecimalInfo(jobId == j.jobId, workerId == w.workerId, type == Info.Type.TIME_TO_JOB_MINUTES)
then
@@ -114,6 +122,7 @@
insertLogical(ti);
end
+/*
rule "Age of Worker Position"
when
j: Job()
@@ -128,4 +137,5 @@
ti.setValue(minutesBetweenDates(wp.getPositionObservationDate(), ds.getPositionCutOff()));
insertLogical(ti);
end
+*/
Modified: labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/EligibilityExclusions.dslr
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/EligibilityExclusions.dslr 2008-01-04 21:03:37 UTC (rev 17559)
+++ labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/EligibilityExclusions.dslr 2008-01-04 21:03:57 UTC (rev 17560)
@@ -22,7 +22,7 @@
expander dispatch.dsl
rule "Retract Eligibility if job too far in future"
- salience 300
+ salience 350
when
time matters
#We refuse to waste cycles on jobs far in the future
Modified: labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/ScoreManagement.dslr
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/ScoreManagement.dslr 2008-01-04 21:03:37 UTC (rev 17559)
+++ labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/ScoreManagement.dslr 2008-01-04 21:03:57 UTC (rev 17560)
@@ -39,7 +39,6 @@
insertLogical(sc);
end
-
rule "Accumulate Score"
salience -50
when
@@ -85,7 +84,4 @@
then
mw.setMaxRadius(mw.getMaxRadius() * DispatchParameters.INCREMENTAL_SEARCH_RADIUS_MULTIPLIER);
update(mw);
-end
-
-
-
+end
\ No newline at end of file
Modified: labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Scoring.dslr
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Scoring.dslr 2008-01-04 21:03:37 UTC (rev 17559)
+++ labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Scoring.dslr 2008-01-04 21:03:57 UTC (rev 17560)
@@ -29,9 +29,9 @@
job dispatchable
w: Worker(vehicleSize == VehicleSize.EXTRA_LARGE)
no exclusions
- within range
- i: DecimalInfo(workerId == w.workerId, jobId == j.jobId,
- type == Info.Type.DISTANCE_TO_JOB_MILES, dist: value >= 100)
+
+ dist_mr: DecimalInfo(jobId == j.jobId, workerId == w.workerId, type == Info.Type.DISTANCE_TO_JOB_MILES, dist: value >= 100);
+ MaxRadius(jobId == j.jobId, maxRadius >= dist)
then
ScoreComponent sc = new ScoreComponent(j,
w,
@@ -47,8 +47,8 @@
job dispatchable
w: Worker(vehicleSize != VehicleSize.EXTRA_LARGE)
no exclusions
- i: DecimalInfo(workerId == w.workerId, jobId == j.jobId,
- type == Info.Type.DISTANCE_TO_JOB_MILES, dist: value >= 100)
+ dist_mr: DecimalInfo(jobId == j.jobId, workerId == w.workerId, type == Info.Type.DISTANCE_TO_JOB_MILES, dist: value >= 100);
+ MaxRadius(jobId == j.jobId, maxRadius >= dist)
then
ScoreComponent sc = new ScoreComponent(j,
w,
@@ -64,6 +64,7 @@
job dispatchable
w : Worker()
no exclusions
+ within range
i: DecimalInfo(jobId == j.jobId, workerId == w.workerId,
type == Info.Type.MINUTES_LATE_TO_JOB, minutesLate: value > 0)
then
Modified: labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/WorkerEligibility.dslr
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/WorkerEligibility.dslr 2008-01-04 21:03:37 UTC (rev 17559)
+++ labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/WorkerEligibility.dslr 2008-01-04 21:03:57 UTC (rev 17560)
@@ -23,44 +23,46 @@
expander dispatch.dsl
rule "Vehicle size must be sufficiently large"
+ #Most likely rule to exclude vehicles. We want to keep fact count down.
+ salience 20
when
- j : Job(vs: vehicleSizeRequired.sizeNumber)
+ j : Job(vehicleSizeRequired != VehicleSize.SMALL, vs: vehicleSizeRequired.sizeNumber)
job dispatchable
w: Worker(vehicleSize.sizeNumber < vs)
- within range
then
ineligible because of VEHICLE_SIZE
end
rule "If the job requires a wrench, the worker must have a wrench"
+ salience 10
when
j : Job(wrenchRequired == true)
job dispatchable
w : Worker(hasWrench == false)
- within range
then
- ineligible because of WRENCH_REQUIRED
+ #WRENCH_REQUIRED
+ ineligible because of VEHICLE_SIZE
end
rule "If the job requires X sticks, the worker must have X sticks"
+ salience 10
when
- j : Job(req:numberOfSticksRequired)
+ j : Job(req:numberOfSticksRequired != 0)
job dispatchable
w : Worker(numberOfSticks < req)
- within range
then
- ineligible because of NUM_STICKS
+ #NUM_STICKS
+ ineligible because of VEHICLE_SIZE
end
rule "If the job requires X rocks, the worker must have X rocks"
+ salience 10
+ activation-group "exclusions"
when
- j : Job(req:numberOfRocksRequired)
+ j : Job(req:numberOfRocksRequired !=0)
job dispatchable
w : Worker(numberOfRocks < req)
- within range
- then
- ineligible because of NUM_ROCKS
-end
-
-
-
+ then
+ #NUM_ROCKS
+ ineligible because of VEHICLE_SIZE
+end
\ No newline at end of file
More information about the jboss-svn-commits
mailing list