[jboss-svn-commits] JBL Code SVN: r33563 - in labs/jbossrules/trunk/drools-planner: drools-planner-core/src/main/java/org/drools/planner/core/localsearch/decider/acceptor/simulatedannealing and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jun 19 15:09:52 EDT 2010
Author: ge0ffrey
Date: 2010-06-19 15:09:52 -0400 (Sat, 19 Jun 2010)
New Revision: 33563
Modified:
labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/config/localsearch/decider/acceptor/AcceptorConfig.java
labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/core/localsearch/decider/acceptor/simulatedannealing/SimulatedAnnealingAcceptor.java
labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/core/localsearch/decider/acceptor/simulatedannealing/TimeGradientBasedSimulatedAnnealingAcceptor.java
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/benchmark/nurseRosteringMediumSolverBenchmarkConfig.xml
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/benchmark/nurseRosteringSprintSolverBenchmarkConfig.xml
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/competition/nurseRosteringCompetitionSprintSolverConfig.xml
labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl
Log:
temperatureSurvival is configurable + comment out build in hard constraint
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/config/localsearch/decider/acceptor/AcceptorConfig.java
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/config/localsearch/decider/acceptor/AcceptorConfig.java 2010-06-19 17:44:08 UTC (rev 33562)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/config/localsearch/decider/acceptor/AcceptorConfig.java 2010-06-19 19:09:52 UTC (rev 33563)
@@ -10,6 +10,7 @@
import org.drools.planner.core.localsearch.decider.acceptor.CompositeAcceptor;
import org.drools.planner.core.localsearch.decider.acceptor.greatdeluge.GreatDelugeAcceptor;
import org.drools.planner.core.localsearch.decider.acceptor.simulatedannealing.SimulatedAnnealingAcceptor;
+import org.drools.planner.core.localsearch.decider.acceptor.simulatedannealing.TimeGradientBasedSimulatedAnnealingAcceptor;
import org.drools.planner.core.localsearch.decider.acceptor.tabu.MoveTabuAcceptor;
import org.drools.planner.core.localsearch.decider.acceptor.tabu.PropertyTabuAcceptor;
import org.drools.planner.core.localsearch.decider.acceptor.tabu.SolutionTabuAcceptor;
@@ -36,6 +37,7 @@
protected Integer partialSolutionTabuSize = null;
protected Double simulatedAnnealingStartingTemperature = null;
+ protected Double simulatedAnnealingTemperatureSurvival = null;
protected Double greatDelugeWaterLevelUpperBoundRate = null;
protected Double greatDelugeWaterRisingRate = null;
@@ -225,6 +227,9 @@
if (simulatedAnnealingStartingTemperature != null) {
simulatedAnnealingAcceptor.setStartingTemperature(simulatedAnnealingStartingTemperature);
}
+ if (simulatedAnnealingTemperatureSurvival != null) {
+ simulatedAnnealingAcceptor.setTemperatureSurvival(simulatedAnnealingTemperatureSurvival);
+ }
acceptorList.add(simulatedAnnealingAcceptor);
}
if ((acceptorTypeList != null && acceptorTypeList.contains(AcceptorType.GREAT_DELUGE))
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/core/localsearch/decider/acceptor/simulatedannealing/SimulatedAnnealingAcceptor.java
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/core/localsearch/decider/acceptor/simulatedannealing/SimulatedAnnealingAcceptor.java 2010-06-19 17:44:08 UTC (rev 33562)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/core/localsearch/decider/acceptor/simulatedannealing/SimulatedAnnealingAcceptor.java 2010-06-19 19:09:52 UTC (rev 33563)
@@ -24,16 +24,24 @@
this.startingTemperature = startingTemperature;
}
+ public void setTemperatureSurvival(double temperatureSurvival) {
+ this.temperatureSurvival = temperatureSurvival;
+ }
+
// ************************************************************************
// Worker methods
// ************************************************************************
@Override
public void solvingStarted(LocalSearchSolverScope localSearchSolverScope) {
- if (startingTemperature < 0.0) {
+ if (startingTemperature <= 0.0) {
throw new IllegalArgumentException("The startingTemperature (" + startingTemperature
- + ") cannot be negative.");
+ + ") cannot be negative or zero.");
}
+ if (temperatureSurvival <= 0.0) {
+ throw new IllegalArgumentException("The temperatureSurvival (" + temperatureSurvival
+ + ") cannot be negative or zero.");
+ }
temperature = startingTemperature;
}
@@ -63,7 +71,6 @@
public void stepTaken(StepScope stepScope) {
super.stepTaken(stepScope);
temperature *= temperatureSurvival;
-// System.out.println("temp: " + temperature);
}
}
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/core/localsearch/decider/acceptor/simulatedannealing/TimeGradientBasedSimulatedAnnealingAcceptor.java
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/core/localsearch/decider/acceptor/simulatedannealing/TimeGradientBasedSimulatedAnnealingAcceptor.java 2010-06-19 17:44:08 UTC (rev 33562)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-core/src/main/java/org/drools/planner/core/localsearch/decider/acceptor/simulatedannealing/TimeGradientBasedSimulatedAnnealingAcceptor.java 2010-06-19 19:09:52 UTC (rev 33563)
@@ -1,43 +1,64 @@
package org.drools.planner.core.localsearch.decider.acceptor.simulatedannealing;
import org.drools.planner.core.localsearch.LocalSearchSolverScope;
+import org.drools.planner.core.localsearch.StepScope;
import org.drools.planner.core.localsearch.decider.MoveScope;
import org.drools.planner.core.localsearch.decider.acceptor.AbstractAcceptor;
import org.drools.planner.core.score.Score;
/**
- * TODO Under construction. Feel free to create a patch to improve this acceptor!
* @author Geoffrey De Smet
*/
public class TimeGradientBasedSimulatedAnnealingAcceptor extends AbstractAcceptor {
- protected boolean compareToBestScore = false;
+ protected double startingTemperature = -1.0;
- public void setCompareToBestScore(boolean compareToBestScore) {
- this.compareToBestScore = compareToBestScore;
+ protected double temperature;
+
+ public void setStartingTemperature(double startingTemperature) {
+ this.startingTemperature = startingTemperature;
}
// ************************************************************************
// Worker methods
// ************************************************************************
+ @Override
+ public void solvingStarted(LocalSearchSolverScope localSearchSolverScope) {
+ if (startingTemperature < 0.0) {
+ throw new IllegalArgumentException("The startingTemperature (" + startingTemperature
+ + ") cannot be negative.");
+ }
+ temperature = startingTemperature;
+ }
+
public double calculateAcceptChance(MoveScope moveScope) {
- Score compareScore = compareToBestScore
- ? moveScope.getStepScope().getLocalSearchSolverScope().getBestScore()
- : moveScope.getStepScope().getLocalSearchSolverScope().getLastCompletedStepScope().getScore();
- // TODO Support for decision score
+ LocalSearchSolverScope localSearchSolverScope = moveScope.getStepScope().getLocalSearchSolverScope();
+ Score lastStepScore = localSearchSolverScope.getLastCompletedStepScope().getScore();
Score moveScore = moveScope.getScore();
- if (moveScore.compareTo(compareScore) > 0) {
- // It's better so accept it.
+ if (moveScore.compareTo(lastStepScore) > 0) {
return 1.0;
}
- double timeGradient = moveScope.getStepScope().getTimeGradient();
- LocalSearchSolverScope localSearchSolverScope = moveScope.getStepScope().getLocalSearchSolverScope();
- // TODO This algorithm might be nice, but the normal temperature based algorithm should also be possible
- double scoreDelta = 1.0 - localSearchSolverScope.getScoreDefinition().calculateTimeGradient(
- localSearchSolverScope.getStartingScore(), compareScore, moveScore);
- double acceptChance = Math.exp(timeGradient * scoreDelta);
- return acceptChance;
+ Score scoreDifference = lastStepScore.subtract(moveScore);
+ // TODO don't abuse translateScoreToGraphValue
+ Double diff = localSearchSolverScope.getScoreDefinition().translateScoreToGraphValue(scoreDifference);
+ if (diff == null) {
+ // more hard constraints broken, ignore it for now
+ return 0.0;
+ }
+ double acceptChance = Math.exp(-diff / temperature);
+ if (moveScope.getWorkingRandom().nextDouble() < acceptChance) {
+ return 1.0;
+ } else {
+ return 0.0;
+ }
}
+ @Override
+ public void stepTaken(StepScope stepScope) {
+ super.stepTaken(stepScope);
+ double timeGradient = stepScope.getTimeGradient();
+ temperature = startingTemperature * timeGradient;
+ }
+
}
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/benchmark/nurseRosteringMediumSolverBenchmarkConfig.xml
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/benchmark/nurseRosteringMediumSolverBenchmarkConfig.xml 2010-06-19 17:44:08 UTC (rev 33562)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/benchmark/nurseRosteringMediumSolverBenchmarkConfig.xml 2010-06-19 19:09:52 UTC (rev 33563)
@@ -6,18 +6,18 @@
<!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late01_initialized.xml</inheritedUnsolvedSolutionFile>-->
<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium01.xml</inheritedUnsolvedSolutionFile>
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium02.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium03.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium04.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium05.xml</inheritedUnsolvedSolutionFile>-->
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium02.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium03.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium04.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium05.xml</inheritedUnsolvedSolutionFile>
<!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_hint01.xml</inheritedUnsolvedSolutionFile>-->
<!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_hint02.xml</inheritedUnsolvedSolutionFile>-->
<!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_hint03.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late01.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late02.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late03.xml</inheritedUnsolvedSolutionFile>-->
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late01.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late02.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late03.xml</inheritedUnsolvedSolutionFile>
<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late04.xml</inheritedUnsolvedSolutionFile>
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late05.xml</inheritedUnsolvedSolutionFile>-->
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/medium_late05.xml</inheritedUnsolvedSolutionFile>
<inheritedLocalSearchSolver>
<scoreDrl>/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl</scoreDrl>
@@ -35,31 +35,31 @@
</termination>
</inheritedLocalSearchSolver>
+ <!--<solverBenchmark>-->
+ <!--<name>selection800PillarPart</name>-->
+ <!--<localSearchSolver>-->
+ <!--<selector>-->
+ <!--<selector>-->
+ <!--<moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.EmployeeChangeMoveFactory</moveFactoryClass>-->
+ <!--</selector>-->
+ <!--<selector>-->
+ <!--<moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.AssignmentSwitchMoveFactory</moveFactoryClass>-->
+ <!--</selector>-->
+ <!--<selector>-->
+ <!--<moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.AssignmentPillarPartSwitchMoveFactory</moveFactoryClass>-->
+ <!--</selector>-->
+ <!--</selector>-->
+ <!--<acceptor>-->
+ <!--<completeSolutionTabuSize>1000</completeSolutionTabuSize>-->
+ <!--<completePropertyTabuSize>11</completePropertyTabuSize>-->
+ <!--</acceptor>-->
+ <!--<forager>-->
+ <!--<foragerType>MAX_SCORE_OF_ALL</foragerType>-->
+ <!--<minimalAcceptedSelection>800</minimalAcceptedSelection>-->
+ <!--</forager>-->
+ <!--</localSearchSolver>-->
+ <!--</solverBenchmark>-->
<solverBenchmark>
- <name>selection800PillarPart</name>
- <localSearchSolver>
- <selector>
- <selector>
- <moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.EmployeeChangeMoveFactory</moveFactoryClass>
- </selector>
- <selector>
- <moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.AssignmentSwitchMoveFactory</moveFactoryClass>
- </selector>
- <selector>
- <moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.AssignmentPillarPartSwitchMoveFactory</moveFactoryClass>
- </selector>
- </selector>
- <acceptor>
- <completeSolutionTabuSize>1000</completeSolutionTabuSize>
- <completePropertyTabuSize>11</completePropertyTabuSize>
- </acceptor>
- <forager>
- <foragerType>MAX_SCORE_OF_ALL</foragerType>
- <minimalAcceptedSelection>800</minimalAcceptedSelection>
- </forager>
- </localSearchSolver>
- </solverBenchmark>
- <solverBenchmark>
<name>simulatedAnnealing</name>
<localSearchSolver>
<selector>
@@ -75,6 +75,7 @@
</selector>
<acceptor>
<simulatedAnnealingStartingTemperature>10.0</simulatedAnnealingStartingTemperature>
+ <simulatedAnnealingTemperatureSurvival>0.997</simulatedAnnealingTemperatureSurvival>
<completePropertyTabuSize>5</completePropertyTabuSize>
</acceptor>
<forager>
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/benchmark/nurseRosteringSprintSolverBenchmarkConfig.xml
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/benchmark/nurseRosteringSprintSolverBenchmarkConfig.xml 2010-06-19 17:44:08 UTC (rev 33562)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/benchmark/nurseRosteringSprintSolverBenchmarkConfig.xml 2010-06-19 19:09:52 UTC (rev 33563)
@@ -3,29 +3,29 @@
<benchmarkDirectory>local/data/nurserostering</benchmarkDirectory>
<solverStatisticType>BEST_SOLUTION_CHANGED</solverStatisticType>
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint01.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint02.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint03.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint04.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint05.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint06.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint07.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint08.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint09.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint10.xml</inheritedUnsolvedSolutionFile>-->
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint01.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint02.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint03.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint04.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint05.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint06.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint07.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint08.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint09.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint10.xml</inheritedUnsolvedSolutionFile>
<!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_hint01.xml</inheritedUnsolvedSolutionFile>-->
<!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_hint02.xml</inheritedUnsolvedSolutionFile>-->
<!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_hint03.xml</inheritedUnsolvedSolutionFile>-->
<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late01.xml</inheritedUnsolvedSolutionFile>
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late02.xml</inheritedUnsolvedSolutionFile>-->
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late02.xml</inheritedUnsolvedSolutionFile>
<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late03.xml</inheritedUnsolvedSolutionFile>
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late04.xml</inheritedUnsolvedSolutionFile>-->
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late04.xml</inheritedUnsolvedSolutionFile>
<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late05.xml</inheritedUnsolvedSolutionFile>
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late06.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late07.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late08.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late09.xml</inheritedUnsolvedSolutionFile>-->
- <!--<inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late10.xml</inheritedUnsolvedSolutionFile>-->
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late06.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late07.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late08.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late09.xml</inheritedUnsolvedSolutionFile>
+ <inheritedUnsolvedSolutionFile>data/nurserostering/unsolved/sprint_late10.xml</inheritedUnsolvedSolutionFile>
<inheritedLocalSearchSolver>
<scoreDrl>/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl</scoreDrl>
@@ -43,7 +43,7 @@
</inheritedLocalSearchSolver>
<solverBenchmark>
- <name>pillarPart200</name>
+ <name>pillarPart210</name>
<localSearchSolver>
<selector>
<selector>
@@ -62,32 +62,8 @@
</acceptor>
<forager>
<foragerType>MAX_SCORE_OF_ALL</foragerType>
- <minimalAcceptedSelection>200</minimalAcceptedSelection>
+ <minimalAcceptedSelection>210</minimalAcceptedSelection>
</forager>
</localSearchSolver>
</solverBenchmark>
- <solverBenchmark>
- <name>simAnn</name>
- <localSearchSolver>
- <selector>
- <selector>
- <moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.EmployeeChangeMoveFactory</moveFactoryClass>
- </selector>
- <selector>
- <moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.AssignmentSwitchMoveFactory</moveFactoryClass>
- </selector>
- <selector>
- <moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.AssignmentPillarPartSwitchMoveFactory</moveFactoryClass>
- </selector>
- </selector>
- <acceptor>
- <simulatedAnnealingStartingTemperature>10.0</simulatedAnnealingStartingTemperature>
- <completePropertyTabuSize>5</completePropertyTabuSize>
- </acceptor>
- <forager>
- <foragerType>FIRST_RANDOMLY_ACCEPTED</foragerType>
- <minimalAcceptedSelection>4</minimalAcceptedSelection>
- </forager>
- </localSearchSolver>
- </solverBenchmark>
</solverBenchmarkSuite>
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/competition/nurseRosteringCompetitionSprintSolverConfig.xml
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/competition/nurseRosteringCompetitionSprintSolverConfig.xml 2010-06-19 17:44:08 UTC (rev 33562)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/competition/nurseRosteringCompetitionSprintSolverConfig.xml 2010-06-19 19:09:52 UTC (rev 33563)
@@ -15,6 +15,9 @@
<selector>
<moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.AssignmentSwitchMoveFactory</moveFactoryClass>
</selector>
+ <selector>
+ <moveFactoryClass>org.drools.planner.examples.nurserostering.solver.move.factory.AssignmentPillarPartSwitchMoveFactory</moveFactoryClass>
+ </selector>
</selector>
<acceptor>
<completeSolutionTabuSize>1000</completeSolutionTabuSize>
@@ -22,6 +25,6 @@
</acceptor>
<forager>
<foragerType>MAX_SCORE_OF_ALL</foragerType>
- <minimalAcceptedSelection>180</minimalAcceptedSelection>
+ <minimalAcceptedSelection>210</minimalAcceptedSelection>
</forager>
</localSearchSolver>
Modified: labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl
===================================================================
--- labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl 2010-06-19 17:44:08 UTC (rev 33562)
+++ labs/jbossrules/trunk/drools-planner/drools-planner-examples/src/main/resources/org/drools/planner/examples/nurserostering/solver/nurseRosteringScoreRules.drl 2010-06-19 19:09:52 UTC (rev 33563)
@@ -49,21 +49,22 @@
// Hard constraints
// ############################################################################
+// This rule is build in
// All demanded shifts must be assigned to a nurse
-rule "requiredEmployeeSizePerShift"
- when
- $shift : Shift(requiredEmployeeSize > 0, $requiredEmployeeSize : requiredEmployeeSize)
+//rule "requiredEmployeeSizePerShift"
+// when
+// $shift : Shift(requiredEmployeeSize > 0, $requiredEmployeeSize : requiredEmployeeSize)
+//
+// $totalEmployeeSize : Number(intValue != $requiredEmployeeSize) from accumulate(
+// $assignment : Assignment(shift == $shift),
+// count($assignment)
+// )
+// then
+// insertLogical(new IntConstraintOccurrence("requiredEmployeeSizePerShift", ConstraintType.NEGATIVE_HARD,
+// Math.abs($requiredEmployeeSize - $totalEmployeeSize.intValue()),
+// $shift));
+//end
- $totalEmployeeSize : Number(intValue != $requiredEmployeeSize) from accumulate(
- $assignment : Assignment(shift == $shift),
- count($assignment)
- )
- then
- insertLogical(new IntConstraintOccurrence("requiredEmployeeSizePerShift", ConstraintType.NEGATIVE_HARD,
- Math.abs($requiredEmployeeSize - $totalEmployeeSize.intValue()),
- $shift));
-end
-
// a nurse can only work one shift per day, i.e. no two shift can be assigned to the same nurse on a day.
rule "oneShiftPerDay"
when
More information about the jboss-svn-commits
mailing list