mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
bugfix issue #23
This commit is contained in:
parent
4dc9385219
commit
13a9122df1
1 changed files with 10 additions and 3 deletions
|
|
@ -28,12 +28,14 @@ import org.apache.commons.math.stat.descriptive.moment.Mean;
|
||||||
import org.apache.commons.math.stat.descriptive.moment.StandardDeviation;
|
import org.apache.commons.math.stat.descriptive.moment.StandardDeviation;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import util.Solutions;
|
||||||
|
|
||||||
import basics.VehicleRoutingAlgorithm;
|
import basics.VehicleRoutingAlgorithm;
|
||||||
import basics.VehicleRoutingProblem;
|
import basics.VehicleRoutingProblem;
|
||||||
import basics.VehicleRoutingProblemSolution;
|
import basics.VehicleRoutingProblemSolution;
|
||||||
import basics.algo.SearchStrategy.DiscoveredSolution;
|
import basics.algo.SearchStrategy.DiscoveredSolution;
|
||||||
|
|
||||||
public class VariationCoefficientBreaker implements PrematureAlgorithmBreaker, AlgorithmStartsListener, IterationEndsListener{
|
public class VariationCoefficientBreaker implements PrematureAlgorithmBreaker, IterationStartsListener, AlgorithmStartsListener, IterationEndsListener{
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(VariationCoefficientBreaker.class);
|
private static Logger logger = Logger.getLogger(VariationCoefficientBreaker.class);
|
||||||
|
|
||||||
|
|
@ -70,7 +72,7 @@ public class VariationCoefficientBreaker implements PrematureAlgorithmBreaker, A
|
||||||
if(lastAccepted != null){
|
if(lastAccepted != null){
|
||||||
solutionValues[currentIteration]=lastAccepted.getCost();
|
solutionValues[currentIteration]=lastAccepted.getCost();
|
||||||
}
|
}
|
||||||
else solutionValues[currentIteration]=Double.MAX_VALUE;
|
else solutionValues[currentIteration]=Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
if(lastAccepted !=null) {
|
if(lastAccepted !=null) {
|
||||||
// logger.info(lastAccepted.getCost());
|
// logger.info(lastAccepted.getCost());
|
||||||
|
|
@ -107,6 +109,11 @@ public class VariationCoefficientBreaker implements PrematureAlgorithmBreaker, A
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||||
|
if(lastAccepted == null) lastAccepted = Solutions.getBest(solutions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue