1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

clean up test and mvn stuff

This commit is contained in:
oblonski 2016-08-11 11:13:33 +02:00
parent a96719fde2
commit 1cf21293d2
19 changed files with 16 additions and 210 deletions

View file

@ -1,25 +0,0 @@
/*
* Licensed to GraphHopper GmbH under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* GraphHopper GmbH licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.graphhopper.jsprit.core;
/**
* Created by schroeder on 17/09/15.
*/
public interface IntegrationTest {
}

View file

@ -17,7 +17,6 @@
*/
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.acceptor.GreedyAcceptance;
import com.graphhopper.jsprit.core.algorithm.module.RuinAndRecreateModule;
import com.graphhopper.jsprit.core.algorithm.recreate.BestInsertionBuilder;
@ -98,7 +97,6 @@ public class BuildCVRPAlgoFromScratch_IT {
}
@Test
@Category(IntegrationTest.class)
public void testVRA() {
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
assertEquals(530.0, Solutions.bestOf(solutions).getCost(), 50.0);

View file

@ -17,7 +17,6 @@
*/
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.Jsprit;
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
@ -34,7 +33,6 @@ import static org.junit.Assert.assertEquals;
public class CVRPwithDeliveries_IT {
@Test
@Category(IntegrationTest.class)
public void whenSolvingVRPNC1withDeliveriesWithJsprit_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new ChristofidesReader(vrpBuilder).setJobType(JobType.DELIVERY).read(getClass().getResourceAsStream("vrpnc1.txt"));

View file

@ -17,7 +17,6 @@
*/
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.Jsprit;
import com.graphhopper.jsprit.core.analysis.SolutionAnalyser;
import com.graphhopper.jsprit.core.problem.Location;
@ -45,7 +44,6 @@ public class CVRPwithMatrix_IT {
@Test
@Category(IntegrationTest.class)
public void whenReturnToDepot_itShouldWorkWithMatrix() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new ChristofidesReader(vrpBuilder).setJobType(JobType.DELIVERY).read(getClass().getResourceAsStream("vrpnc1.txt"));
@ -58,7 +56,6 @@ public class CVRPwithMatrix_IT {
}
@Test
@Category(IntegrationTest.class)
public void whenNotReturnToDepot_itShouldWorkWithMatrix() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new ChristofidesReader(vrpBuilder).setJobType(JobType.DELIVERY).read(getClass().getResourceAsStream("vrpnc1.txt"));
@ -74,7 +71,6 @@ public class CVRPwithMatrix_IT {
}
@Test
@Category(IntegrationTest.class)
public void whenCalcTimeWithSolutionAnalyser_itShouldWork() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new ChristofidesReader(vrpBuilder).setJobType(JobType.DELIVERY).read(getClass().getResourceAsStream("vrpnc1.txt"));

View file

@ -17,7 +17,6 @@
*/
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.Jsprit;
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
@ -34,7 +33,6 @@ import static org.junit.Assert.assertEquals;
public class CVRPwithPickups_IT {
@Test
@Category(IntegrationTest.class)
public void whenSolvingVRPNC1WithPickups_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new ChristofidesReader(vrpBuilder).setJobType(JobType.PICKUP).read(getClass().getResourceAsStream("vrpnc1.txt"));

View file

@ -29,7 +29,6 @@ import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute;
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl;
import com.graphhopper.jsprit.core.reporting.SolutionPrinter;
import com.graphhopper.jsprit.core.util.ManhattanCosts;
import com.graphhopper.jsprit.core.util.Solutions;
import org.junit.Assert;
@ -92,7 +91,6 @@ public class CapacityConstraint_IT {
vra.setMaxIterations(2000);
VehicleRoutingProblemSolution solution = Solutions.bestOf(vra.searchSolutions());
SolutionPrinter.print(vrp,solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser sa = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {

View file

@ -25,8 +25,8 @@ import com.graphhopper.jsprit.core.problem.job.Service;
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl;
import com.graphhopper.jsprit.core.reporting.SolutionPrinter;
import com.graphhopper.jsprit.core.util.Solutions;
import junit.framework.Assert;
import org.junit.Test;
import java.util.Arrays;
@ -54,10 +54,13 @@ public class ExternalInitialSolutionIsInValidTest {
vra.addInitialSolution(new VehicleRoutingProblemSolution(Arrays.asList(route1), 20.));
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
SolutionPrinter.print(vrp, Solutions.bestOf(solutions), SolutionPrinter.Print.VERBOSE);
try {
vra.searchSolutions();
Assert.assertTrue(true);
}
catch (Exception e){
Assert.assertFalse(true);
}
}

View file

@ -17,7 +17,6 @@
*/
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.Jsprit;
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
@ -33,7 +32,6 @@ import static org.junit.Assert.assertEquals;
public class PickupsAndDeliveries_IT {
@Test
@Category(IntegrationTest.class)
public void whenSolvingLR101InstanceOfLiLim_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new LiLimReader(vrpBuilder).read(getClass().getResourceAsStream("lr101.txt"));

View file

@ -17,7 +17,6 @@
*/
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.GreedySchrimpfFactory;
import com.graphhopper.jsprit.core.problem.Location;
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
@ -26,7 +25,6 @@ import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolutio
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl;
import com.graphhopper.jsprit.core.reporting.SolutionPrinter;
import com.graphhopper.jsprit.core.util.Solutions;
import com.graphhopper.jsprit.core.util.VehicleRoutingTransportCostsMatrix;
import org.junit.Test;
@ -44,7 +42,6 @@ import static org.junit.Assert.assertEquals;
public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT {
@Test
@Category(IntegrationTest.class)
public void testAlgo() {
@ -90,8 +87,6 @@ public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_IT {
// vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
SolutionPrinter.print(vrp, Solutions.bestOf(solutions), SolutionPrinter.Print.VERBOSE);
assertEquals(2. * 397., Solutions.bestOf(solutions).getCost(), 0.01);
assertEquals(2, Solutions.bestOf(solutions).getRoutes().size());
}

View file

@ -16,8 +16,6 @@
* limitations under the License.
*/
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.GreedySchrimpfFactory;
import com.graphhopper.jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
import com.graphhopper.jsprit.core.problem.Location;
@ -27,8 +25,6 @@ import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolutio
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl;
import com.graphhopper.jsprit.core.reporting.SolutionPrinter;
import com.graphhopper.jsprit.core.reporting.SolutionPrinter.Print;
import com.graphhopper.jsprit.core.util.Solutions;
import com.graphhopper.jsprit.core.util.VehicleRoutingTransportCostsMatrix;
import org.junit.Test;
@ -46,7 +42,6 @@ import static org.junit.Assert.assertEquals;
public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndDistanceCosts_IT {
@Test
@Category(IntegrationTest.class)
public void testAlgo() {
@ -92,8 +87,6 @@ public class RefuseCollectionWithCostsHigherThanTimesAndFiniteFleet_withTimeAndD
vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
SolutionPrinter.print(vrp, Solutions.bestOf(solutions), Print.VERBOSE);
assertEquals(2. * 397. + 397., Solutions.bestOf(solutions).getCost(), 0.01);
assertEquals(2, Solutions.bestOf(solutions).getRoutes().size());
}

View file

@ -17,7 +17,7 @@
*/
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.Jsprit;
import com.graphhopper.jsprit.core.algorithm.box.SchrimpfFactory;
import com.graphhopper.jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
@ -29,7 +29,7 @@ import com.graphhopper.jsprit.core.problem.job.Service;
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl;
import com.graphhopper.jsprit.core.reporting.SolutionPrinter;
import com.graphhopper.jsprit.core.util.Solutions;
import com.graphhopper.jsprit.core.util.VehicleRoutingTransportCostsMatrix;
import org.junit.Assert;
@ -47,7 +47,6 @@ public class RefuseCollection_IT {
@Test
@Category(IntegrationTest.class)
public void whenReadingServices_itShouldCalculateCorrectly() {
/*
@ -85,14 +84,11 @@ public class RefuseCollection_IT {
vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
SolutionPrinter.print(vrp, Solutions.bestOf(solutions), SolutionPrinter.Print.VERBOSE);
Assert.assertEquals(397.0, Solutions.bestOf(solutions).getCost(), 40.);
Assert.assertEquals(2, Solutions.bestOf(solutions).getRoutes().size());
}
@Test
@Category(IntegrationTest.class)
public void whenReadingServices_usingJsprit_itShouldCalculateCorrectly() {
/*
@ -130,14 +126,11 @@ public class RefuseCollection_IT {
vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
SolutionPrinter.print(vrp, Solutions.bestOf(solutions), SolutionPrinter.Print.VERBOSE);
Assert.assertEquals(397.0, Solutions.bestOf(solutions).getCost(), 40.);
Assert.assertEquals(2, Solutions.bestOf(solutions).getRoutes().size());
}
@Test
@Category(IntegrationTest.class)
public void whenReadingPickups_itShouldCalculateCorrectly() {
/*
@ -175,14 +168,11 @@ public class RefuseCollection_IT {
vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
SolutionPrinter.print(vrp, Solutions.bestOf(solutions), SolutionPrinter.Print.VERBOSE);
Assert.assertEquals(397.0, Solutions.bestOf(solutions).getCost(), 40.);
Assert.assertEquals(2, Solutions.bestOf(solutions).getRoutes().size());
}
@Test
@Category(IntegrationTest.class)
public void whenReadingDeliveries_itShouldCalculateCorrectly() {
/*
@ -220,8 +210,6 @@ public class RefuseCollection_IT {
vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
SolutionPrinter.print(vrp, Solutions.bestOf(solutions), SolutionPrinter.Print.VERBOSE);
Assert.assertEquals(397.0, Solutions.bestOf(solutions).getCost(), 40.);
Assert.assertEquals(2, Solutions.bestOf(solutions).getRoutes().size());
}

View file

@ -18,7 +18,6 @@
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.Jsprit;
import com.graphhopper.jsprit.core.problem.Skills;
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
@ -45,7 +44,6 @@ import static org.junit.Assert.*;
public class SolomonSkills_IT {
@Test
@Category(IntegrationTest.class)
public void itShouldMakeCorrectAssignmentAccordingToSkills() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new SolomonReader(vrpBuilder).read(getClass().getResourceAsStream("C101.txt"));

View file

@ -18,7 +18,6 @@
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.Jsprit;
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
@ -36,7 +35,6 @@ import java.util.Collection;
public class Solomon_IT {
@Test
@Category(IntegrationTest.class)
public void itShouldFindTheBestKnownSolution() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new SolomonReader(vrpBuilder).read(getClass().getResourceAsStream("C101.txt"));

View file

@ -18,7 +18,7 @@
package com.graphhopper.jsprit.core.algorithm;
import com.graphhopper.jsprit.core.IntegrationTest;
import com.graphhopper.jsprit.core.algorithm.box.Jsprit;
import com.graphhopper.jsprit.core.algorithm.state.StateManager;
import com.graphhopper.jsprit.core.analysis.SolutionAnalyser;
@ -97,7 +97,6 @@ public class VariableDepartureAndWaitingTime_IT {
}
@Test
@Category(IntegrationTest.class)
public void plainSetupShouldWork() {
VehicleImpl v = VehicleImpl.Builder.newInstance("v").setStartLocation(Location.newInstance(0, 0)).build();
Service s1 = Service.Builder.newInstance("s1").setLocation(Location.newInstance(10, 0)).build();
@ -114,7 +113,6 @@ public class VariableDepartureAndWaitingTime_IT {
}
@Test
@Category(IntegrationTest.class)
public void withTimeWindowsShouldWork() {
VehicleImpl v = VehicleImpl.Builder.newInstance("v").setStartLocation(Location.newInstance(0, 0)).build();
Service s1 = Service.Builder.newInstance("s1").setTimeWindow(TimeWindow.newInstance(1010, 1100)).setLocation(Location.newInstance(10, 0)).build();

View file

@ -39,7 +39,6 @@ import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute;
import com.graphhopper.jsprit.core.problem.solution.route.activity.ActivityVisitor;
import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity;
import com.graphhopper.jsprit.core.problem.vehicle.*;
import com.graphhopper.jsprit.core.reporting.SolutionPrinter;
import com.graphhopper.jsprit.core.util.Coordinate;
import com.graphhopper.jsprit.core.util.Solutions;
import junit.framework.Assert;
@ -241,7 +240,6 @@ public class RegretInsertionTest {
.buildAlgorithm();
VehicleRoutingProblemSolution solution = Solutions.bestOf(vra.searchSolutions());
SolutionPrinter.print(vrp,solution, SolutionPrinter.Print.VERBOSE);
for(VehicleRoute route : solution.getRoutes()){
if(route.getTourActivities().servesJob(s1)){
if(!route.getTourActivities().servesJob(s2)){
@ -283,7 +281,6 @@ public class RegretInsertionTest {
.buildAlgorithm();
VehicleRoutingProblemSolution solution = Solutions.bestOf(vra.searchSolutions());
SolutionPrinter.print(vrp,solution, SolutionPrinter.Print.VERBOSE);
for(VehicleRoute route : solution.getRoutes()){
if(route.getTourActivities().servesJob(s1)){
if(!route.getTourActivities().servesJob(s2)){

View file

@ -35,7 +35,6 @@ import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleType;
import com.graphhopper.jsprit.core.problem.vehicle.VehicleTypeImpl;
import com.graphhopper.jsprit.core.reporting.SolutionPrinter;
import com.graphhopper.jsprit.core.util.Coordinate;
import com.graphhopper.jsprit.core.util.ManhattanCosts;
import com.graphhopper.jsprit.core.util.TestUtils;
@ -1322,7 +1321,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationOnRoute_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1338,7 +1336,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAtEnd_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1402,7 +1399,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAfterAct1_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1418,7 +1414,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAfterAct2_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1434,7 +1429,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAfterAct3_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1450,7 +1444,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAfterAct4_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1466,7 +1459,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAfterAct5_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1482,7 +1474,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAfterAct6_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1498,7 +1489,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAfterAct7_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1514,7 +1504,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAfterAct8_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1530,7 +1519,6 @@ public class SolutionAnalyserTest {
@Test
public void capacityViolationAfterEnd_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1639,7 +1627,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolation_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1655,7 +1642,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtStart_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1671,7 +1657,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtAct1_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1687,7 +1672,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtAct2_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1703,7 +1687,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtAct3_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1719,7 +1702,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtAct4_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1735,7 +1717,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtAct5_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1751,7 +1732,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtAct6_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1767,7 +1747,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtAct7_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1783,7 +1762,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtAct8_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1799,7 +1777,6 @@ public class SolutionAnalyserTest {
@Test
public void timeWindowViolationAtEnd_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1815,8 +1792,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolation_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
@ -1831,8 +1806,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolationAtStart_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
@ -1848,7 +1821,6 @@ public class SolutionAnalyserTest {
public void backhaulViolationAtAct1_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1864,7 +1836,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolationAtAct2_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1880,7 +1851,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolationAtAct3_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1896,7 +1866,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolationAtAct4_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1912,7 +1881,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolationAtAct5_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1928,7 +1896,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolationAtAct6_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1944,7 +1911,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolationAtAct7_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1960,7 +1926,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolationAtAct8_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1976,7 +1941,6 @@ public class SolutionAnalyserTest {
@Test
public void backhaulViolationAtEnd_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -1992,7 +1956,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtStart_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2008,7 +1971,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtAct1_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2024,7 +1986,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtAct2_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2040,7 +2001,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtAct3_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2056,7 +2016,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtAct4_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2072,7 +2031,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtAct5_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2088,7 +2046,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtAct6_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2104,7 +2061,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtAct7_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2120,7 +2076,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtAct8_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2136,7 +2091,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolationAtEnd_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2152,7 +2106,6 @@ public class SolutionAnalyserTest {
@Test
public void shipmentViolation_shouldWork() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2169,10 +2122,8 @@ public class SolutionAnalyserTest {
public void shipmentViolation_shouldWorkWhenViolated() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
VehicleRoute route = solution.getRoutes().iterator().next();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
TourActivity deliverShipment = route.getActivities().get(2);
route.getTourActivities().removeActivity(deliverShipment);
// SolutionPrinter.print(vrp,solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2189,11 +2140,8 @@ public class SolutionAnalyserTest {
public void shipmentViolationAtActivity_shouldWorkWhenRemovingDelivery() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
VehicleRoute route = solution.getRoutes().iterator().next();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
TourActivity deliverShipment = route.getActivities().get(2);
route.getTourActivities().removeActivity(deliverShipment);
// assertFalse(route.getTourActivities().hasActivity(pickupShipment));
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2210,11 +2158,9 @@ public class SolutionAnalyserTest {
public void shipmentViolation_shouldWorkWhenRemovingDelivery() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
VehicleRoute route = solution.getRoutes().iterator().next();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
TourActivity deliverShipment = route.getActivities().get(2);
route.getTourActivities().removeActivity(deliverShipment);
assertFalse(route.getActivities().contains(deliverShipment));
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2231,11 +2177,9 @@ public class SolutionAnalyserTest {
public void shipmentViolationAtActivity_shouldWorkWhenRemovingPickup() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
VehicleRoute route = solution.getRoutes().iterator().next();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
TourActivity pickupShipment = route.getActivities().get(1);
route.getTourActivities().removeActivity(pickupShipment);
assertFalse(route.getActivities().contains(pickupShipment));
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2252,11 +2196,9 @@ public class SolutionAnalyserTest {
public void shipmentViolationOnRoute_shouldWorkWhenRemovingPickup() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
VehicleRoute route = solution.getRoutes().iterator().next();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
TourActivity pickupShipment = route.getActivities().get(1);
route.getTourActivities().removeActivity(pickupShipment);
assertFalse(route.getActivities().contains(pickupShipment));
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override
@ -2273,11 +2215,9 @@ public class SolutionAnalyserTest {
public void shipmentViolationOnSolution_shouldWorkWhenRemovingPickup() {
buildAnotherScenarioWithOnlyOneVehicleAndWithoutAnyConstraintsBefore();
VehicleRoute route = solution.getRoutes().iterator().next();
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
TourActivity pickupShipment = route.getActivities().get(1);
route.getTourActivities().removeActivity(pickupShipment);
assertFalse(route.getActivities().contains(pickupShipment));
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
@Override

View file

@ -26,8 +26,8 @@ import java.util.HashSet;
import java.util.Set;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsCollectionContaining.hasItem;
import static org.junit.Assert.*;
import static org.junit.internal.matchers.IsCollectionContaining.hasItem;
public class ServiceTest {

View file

@ -25,8 +25,8 @@ import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsCollectionContaining.hasItem;
import static org.junit.Assert.*;
import static org.junit.internal.matchers.IsCollectionContaining.hasItem;
public class ShipmentTest {