Skip to content

Commit

Permalink
remove fail-fast that prevents default run + fix phaseEnded + simplif…
Browse files Browse the repository at this point in the history
…y CB and VRP benchmarks to run them
  • Loading branch information
ge0ffrey committed Jul 12, 2019
1 parent aad0332 commit 8a3fcf1
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ public Acceptor buildAcceptor(HeuristicConfigPolicy configPolicy) {
+ ") currently requires a simulatedAnnealingStartingTemperature ("
+ simulatedAnnealingStartingTemperature + ").");
}
acceptor.setStartingTemperature(configPolicy.getScoreDefinition()
.parseScore(simulatedAnnealingStartingTemperature));
acceptor.setStartingTemperature(
configPolicy.getScoreDefinition().parseScore(simulatedAnnealingStartingTemperature));
acceptorList.add(acceptor);
}
if ((acceptorTypeList != null && acceptorTypeList.contains(AcceptorType.LATE_ACCEPTANCE))
Expand All @@ -520,25 +520,23 @@ public Acceptor buildAcceptor(HeuristicConfigPolicy configPolicy) {
|| greatDelugeWaterLevelIncrementScore != null
|| greatDelugeWaterLevelIncrementRatio != null) {
GreatDelugeAcceptor acceptor = new GreatDelugeAcceptor();

if (greatDelugeWaterLevelIncrementScore != null && greatDelugeWaterLevelIncrementRatio != null) {
throw new IllegalArgumentException("The greatDelugeWaterLevelIncrementScore ("
+ greatDelugeWaterLevelIncrementScore + ") and greatDelugeWaterLevelIncrementRatio ("
+ greatDelugeWaterLevelIncrementRatio + ") cannot be both non null.");
}

if (greatDelugeInitialWaterLevel != null) {
acceptor.setInitialWaterLevel(configPolicy.getScoreDefinition()
.parseScore(greatDelugeInitialWaterLevel));
acceptor.setInitialWaterLevel(
configPolicy.getScoreDefinition().parseScore(greatDelugeInitialWaterLevel));
}

if (greatDelugeWaterLevelIncrementScore != null) {
acceptor.setWaterLevelIncrementScore(configPolicy.getScoreDefinition()
.parseScore(greatDelugeWaterLevelIncrementScore));
}

if (greatDelugeWaterLevelIncrementRatio != null) {
if (greatDelugeWaterLevelIncrementRatio != null) {
throw new IllegalArgumentException("The acceptor cannot have both "
+ "greatDelugeWaterLevelIncrementScore (" + greatDelugeWaterLevelIncrementScore
+ ") and greatDelugeWaterLevelIncrementRatio (" + greatDelugeWaterLevelIncrementRatio + ").");
}
acceptor.setWaterLevelIncrementScore(
configPolicy.getScoreDefinition().parseScore(greatDelugeWaterLevelIncrementScore));
} else if (greatDelugeWaterLevelIncrementRatio != null) {
acceptor.setWaterLevelIncrementRatio(greatDelugeWaterLevelIncrementRatio);
} else {
// Based on Tomas Muller's work. TODO Confirm with benchmarker across our examples/datasets
acceptor.setWaterLevelIncrementRatio(0.00_000_005);
}
acceptorList.add(acceptor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@

public class GreatDelugeAcceptor extends AbstractAcceptor {

// Good value to come out from. Source: https://github.com/UniTime/cpsolver from Tomas Muller
private static final double DEFAULT_WATER_LEVEL_INCREMENT_RATIO = 0.00_000_005;
private Score initialWaterLevel;

private Score initialWaterLevel = null;

private Score waterLevelIncrementScore = null;
private Double waterLevelIncrementRatio = DEFAULT_WATER_LEVEL_INCREMENT_RATIO;
private Score waterLevelIncrementScore;
private Double waterLevelIncrementRatio;

private Score currentWaterLevel = null;

Expand Down Expand Up @@ -50,7 +47,7 @@ public void phaseStarted(LocalSearchPhaseScope phaseScope) {
for (double initialLevelLevel : ScoreUtils.extractLevelDoubles(initialWaterLevel)) {
if (initialLevelLevel < 0.0) {
throw new IllegalArgumentException("The initial level (" + initialWaterLevel
+ ") cannot have negative level (" + initialLevelLevel + ").");
+ ") cannot have negative level (" + initialLevelLevel + ").");
}
}
currentWaterLevel = initialWaterLevel;
Expand All @@ -62,7 +59,7 @@ public void phaseStarted(LocalSearchPhaseScope phaseScope) {
@Override
public void phaseEnded(LocalSearchPhaseScope phaseScope) {
super.phaseEnded(phaseScope);
initialWaterLevel = null;
currentWaterLevel = null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,94 @@
</solver>
</inheritedSolverBenchmark>

<solverBenchmarkBluePrint>
<solverBenchmarkBluePrintType>EVERY_LOCAL_SEARCH_TYPE</solverBenchmarkBluePrintType>
</solverBenchmarkBluePrint>

<!--<solverBenchmark>-->
<!--<name>First Fit</name>-->
<!--<solver>-->
<!--<constructionHeuristic>-->
<!--<constructionHeuristicType>FIRST_FIT</constructionHeuristicType>-->
<!--</constructionHeuristic>-->
<!--</solver>-->
<!--</solverBenchmark>-->
<!--<solverBenchmark>-->
<!--<name>First Fit Decreasing</name>-->
<!--<solver>-->
<!--<constructionHeuristic>-->
<!--<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>-->
<!--</constructionHeuristic>-->
<!--</solver>-->
<!--</solverBenchmark>-->

<!--<solverBenchmark>-->
<!--<name>Tabu Search</name>-->
<!--<solver>-->
<!--<constructionHeuristic>-->
<!--<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>-->
<!--</constructionHeuristic>-->
<!--<localSearch>-->
<!--<unionMoveSelector>-->
<!--<changeMoveSelector/>-->
<!--<swapMoveSelector/>-->
<!--<pillarChangeMoveSelector/>-->
<!--<pillarSwapMoveSelector/>-->
<!--</unionMoveSelector>-->
<!--<acceptor>-->
<!--<entityTabuSize>7</entityTabuSize>-->
<!--</acceptor>-->
<!--<forager>-->
<!--<acceptedCountLimit>1000</acceptedCountLimit>-->
<!--</forager>-->
<!--</localSearch>-->
<!--</solver>-->
<!--</solverBenchmark>-->
<!--<solverBenchmark>-->
<!--<name>Simulated Annealing</name>-->
<!--<solver>-->
<!--<constructionHeuristic>-->
<!--<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>-->
<!--</constructionHeuristic>-->
<!--<localSearch>-->
<!--<unionMoveSelector>-->
<!--<changeMoveSelector/>-->
<!--<swapMoveSelector/>-->
<!--<pillarChangeMoveSelector/>-->
<!--<pillarSwapMoveSelector/>-->
<!--</unionMoveSelector>-->
<!--<acceptor>-->
<!--<simulatedAnnealingStartingTemperature>0hard/400soft</simulatedAnnealingStartingTemperature>-->
<!--</acceptor>-->
<!--<forager>-->
<!--<acceptedCountLimit>4</acceptedCountLimit>-->
<!--</forager>-->
<!--</localSearch>-->
<!--</solver>-->
<!--</solverBenchmark>-->
<!--<solverBenchmark>-->
<!--<name>Late Acceptance</name>-->
<!--<solver>-->
<!--<constructionHeuristic>-->
<!--<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>-->
<!--</constructionHeuristic>-->
<!--<localSearch>-->
<!--<unionMoveSelector>-->
<!--<changeMoveSelector/>-->
<!--<swapMoveSelector/>-->
<!--<pillarChangeMoveSelector/>-->
<!--<pillarSwapMoveSelector/>-->
<!--</unionMoveSelector>-->
<!--<acceptor>-->
<!--<lateAcceptanceSize>400</lateAcceptanceSize>-->
<!--</acceptor>-->
<!--<forager>-->
<!--<acceptedCountLimit>4</acceptedCountLimit>-->
<!--</forager>-->
<!--</localSearch>-->
<!--</solver>-->
<!--</solverBenchmark>-->

<!--<solverBenchmark>-->
<!--<name>BRANCH_AND_BOUND</name>-->
<!--<solver>-->
Expand All @@ -63,88 +151,4 @@
<!--</exhaustiveSearch>-->
<!--</solver>-->
<!--</solverBenchmark>-->

<solverBenchmark>
<name>First Fit</name>
<solver>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT</constructionHeuristicType>
</constructionHeuristic>
</solver>
</solverBenchmark>
<solverBenchmark>
<name>First Fit Decreasing</name>
<solver>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
</solver>
</solverBenchmark>

<solverBenchmark>
<name>Tabu Search</name>
<solver>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
<unionMoveSelector>
<changeMoveSelector/>
<swapMoveSelector/>
<pillarChangeMoveSelector/>
<pillarSwapMoveSelector/>
</unionMoveSelector>
<acceptor>
<entityTabuSize>7</entityTabuSize>
</acceptor>
<forager>
<acceptedCountLimit>1000</acceptedCountLimit>
</forager>
</localSearch>
</solver>
</solverBenchmark>
<solverBenchmark>
<name>Simulated Annealing</name>
<solver>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
<unionMoveSelector>
<changeMoveSelector/>
<swapMoveSelector/>
<pillarChangeMoveSelector/>
<pillarSwapMoveSelector/>
</unionMoveSelector>
<acceptor>
<simulatedAnnealingStartingTemperature>0hard/400soft</simulatedAnnealingStartingTemperature>
</acceptor>
<forager>
<acceptedCountLimit>4</acceptedCountLimit>
</forager>
</localSearch>
</solver>
</solverBenchmark>
<solverBenchmark>
<name>Late Acceptance</name>
<solver>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
<unionMoveSelector>
<changeMoveSelector/>
<swapMoveSelector/>
<pillarChangeMoveSelector/>
<pillarSwapMoveSelector/>
</unionMoveSelector>
<acceptor>
<lateAcceptanceSize>400</lateAcceptanceSize>
</acceptor>
<forager>
<acceptedCountLimit>4</acceptedCountLimit>
</forager>
</localSearch>
</solver>
</solverBenchmark>
</plannerBenchmark>
Loading

0 comments on commit 8a3fcf1

Please sign in to comment.