SearchStrategyManager stratManager = mock(SearchStrategyManager.class);
VehicleRoutingAlgorithm algorithm = new VehicleRoutingAlgorithm(mock(VehicleRoutingProblem.class),stratManager);
when(stratManager.getRandomStrategy()).thenReturn(mock(SearchStrategy.class));
when(stratManager.getProbabilities()).thenReturn(Arrays.asList(1.0));
algorithm.setMaxIterations(1000);
PrematureAlgorithmTermination termination = new PrematureAlgorithmTermination() {
private int nuOfIterations = 1;
@Override
public boolean isPrematureBreak(DiscoveredSolution discoveredSolution) {
if(nuOfIterations == 50) return true;
nuOfIterations++;
return false;
}
};
PrematureAlgorithmTermination termination2 = new PrematureAlgorithmTermination() {
private int nuOfIterations = 1;
@Override
public boolean isPrematureBreak(DiscoveredSolution discoveredSolution) {