Hello!
I have constructed a specific VRP with one vehicle and two shipments and both shipments are nearly identical.
The problem I have is:
If I request a solution for this VRP, jsprit will find a solution (weirdProblem.xml)
If I execute a test with the acceptance criteria, that a solution must be found, the test succeeds when called via JUnit (weirdProblemJUnit.xml) and fails if gradle (also configured to use JUnit) is running this test (weirdProblemGradle.xml)
Did you encounter such behaviour in the past or have any advice how to go forward here?
This is the used algorithm without any custom constraints:
private void buildAlgorithm(StateManager stateManager, ConstraintManager constraintManager) {
int numberOfProcessors = Runtime.getRuntime().availableProcessors();
Long numberOfThreads = Math.round(numberOfProcessors * 1.5);
algorithm = Jsprit.Builder.newInstance(vrp)
.setProperty(Jsprit.Parameter.VEHICLE_SWITCH, "false")
.setProperty(Jsprit.Parameter.FAST_REGRET, "true")
.setProperty(Jsprit.Parameter.THREADS, numberOfThreads.toString())
.buildAlgorithm();
weirdProblem.xml:
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
</problemType>
<vehicles>
<vehicle>
<id>vehicle1</id>
<typeId>myVehicleType</typeId>
<startLocation>
<id>vehicle1:location</id>
<coord x="13.38718" y="52.53635"/>
</startLocation>
<endLocation>
<id>vehicle1:location</id>
<coord x="13.38718" y="52.53635"/>
</endLocation>
<timeSchedule>
<start>1.46305572E12</start>
<end>1.7976931348623157E308</end>
</timeSchedule>
<returnToDepot>false</returnToDepot>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>myVehicleType</id>
<capacity-dimensions>
<dimension index="0">3</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>1.0</distance>
<time>0.0</time>
<service>0.0</service>
<wait>0.0</wait>
</costs>
</type>
</vehicleTypes>
<shipments>
<shipment id="shipment1">
<pickup>
<location>
<id>shipment1:pickup</id>
<coord x="13.38718" y="52.52635"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>1.4630559E12</start>
<end>1.4630565986E12</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<location>
<id>shipment1:dropoff</id>
<coord x="13.3489" y="52.54232"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>1.4630573656E12</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
</shipment>
<shipment id="shipment2">
<pickup>
<location>
<id>shipment2:pickup</id>
<coord x="13.387181" y="52.526351"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>1.46305596E12</start>
<end>1.4630565986E12</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<location>
<id>shipment2:dropoff</id>
<coord x="13.34891" y="52.542318"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>1.4630573656E12</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
</shipment>
</shipments>
<solutions>
<solution>
<cost>1345600.0</cost>
<routes>
<route>
<driverId>noDriver</driverId>
<vehicleId>vehicle1</vehicleId>
<start>1.46305572E12</start>
<act type="pickupShipment">
<shipmentId>shipment1</shipmentId>
<arrTime>1.4630562986E12</arrTime>
<endTime>1.4630563586E12</endTime>
</act>
<act type="pickupShipment">
<shipmentId>shipment2</shipmentId>
<arrTime>1.4630563586E12</arrTime>
<endTime>1.4630564186E12</endTime>
</act>
<act type="deliverShipment">
<shipmentId>shipment1</shipmentId>
<arrTime>1.4630571856E12</arrTime>
<endTime>1.4630572456E12</endTime>
</act>
<act type="deliverShipment">
<shipmentId>shipment2</shipmentId>
<arrTime>1.4630572456E12</arrTime>
<endTime>1.4630573056E12</endTime>
</act>
<end>1.4630573056E12</end>
</route>
</routes>
</solution>
<solution>
<cost>1345600.0</cost>
<routes>
<route>
<driverId>noDriver</driverId>
<vehicleId>vehicle1</vehicleId>
<start>1.46305572E12</start>
<act type="pickupShipment">
<shipmentId>shipment1</shipmentId>
<arrTime>1.4630562986E12</arrTime>
<endTime>1.4630563586E12</endTime>
</act>
<act type="pickupShipment">
<shipmentId>shipment2</shipmentId>
<arrTime>1.4630563586E12</arrTime>
<endTime>1.4630564186E12</endTime>
</act>
<act type="deliverShipment">
<shipmentId>shipment1</shipmentId>
<arrTime>1.4630571856E12</arrTime>
<endTime>1.4630572456E12</endTime>
</act>
<act type="deliverShipment">
<shipmentId>shipment2</shipmentId>
<arrTime>1.4630572456E12</arrTime>
<endTime>1.4630573056E12</endTime>
</act>
<end>1.4630573056E12</end>
</route>
</routes>
</solution>
</solutions>
</problem>
weirdProblemJUnit.xml:
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
</problemType>
<vehicles>
<vehicle>
<id>vehicle1</id>
<typeId>myVehicleType</typeId>
<startLocation>
<id>vehicle1:location</id>
<coord x="13.38718" y="52.53635"/>
</startLocation>
<endLocation>
<id>vehicle1:location</id>
<coord x="13.38718" y="52.53635"/>
</endLocation>
<timeSchedule>
<start>1.46305572E12</start>
<end>1.7976931348623157E308</end>
</timeSchedule>
<returnToDepot>false</returnToDepot>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>myVehicleType</id>
<capacity-dimensions>
<dimension index="0">3</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>1.0</distance>
<time>0.0</time>
<service>0.0</service>
<wait>0.0</wait>
</costs>
</type>
</vehicleTypes>
<shipments>
<shipment id="shipment1">
<pickup>
<location>
<id>shipment1:pickup</id>
<coord x="13.38718" y="52.52635"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>1.4630559E12</start>
<end>1.4630565986E12</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<location>
<id>shipment1:dropoff</id>
<coord x="13.3489" y="52.54232"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>1.4630573656E12</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
</shipment>
<shipment id="shipment2">
<pickup>
<location>
<id>shipment2:pickup</id>
<coord x="13.387181" y="52.526351"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>1.46305596E12</start>
<end>1.4630565986E12</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<location>
<id>shipment2:dropoff</id>
<coord x="13.34891" y="52.542318"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>1.4630573656E12</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
</shipment>
</shipments>
<solutions>
<solution>
<cost>1345600.0</cost>
<routes>
<route>
<driverId>noDriver</driverId>
<vehicleId>vehicle1</vehicleId>
<start>1.46305572E12</start>
<act type="pickupShipment">
<shipmentId>shipment1</shipmentId>
<arrTime>1.4630562986E12</arrTime>
<endTime>1.4630563586E12</endTime>
</act>
<act type="pickupShipment">
<shipmentId>shipment2</shipmentId>
<arrTime>1.4630563586E12</arrTime>
<endTime>1.4630564186E12</endTime>
</act>
<act type="deliverShipment">
<shipmentId>shipment1</shipmentId>
<arrTime>1.4630571856E12</arrTime>
<endTime>1.4630572456E12</endTime>
</act>
<act type="deliverShipment">
<shipmentId>shipment2</shipmentId>
<arrTime>1.4630572456E12</arrTime>
<endTime>1.4630573056E12</endTime>
</act>
<end>1.4630573056E12</end>
</route>
</routes>
</solution>
<solution>
<cost>1345600.0</cost>
<routes>
<route>
<driverId>noDriver</driverId>
<vehicleId>vehicle1</vehicleId>
<start>1.46305572E12</start>
<act type="pickupShipment">
<shipmentId>shipment1</shipmentId>
<arrTime>1.4630562986E12</arrTime>
<endTime>1.4630563586E12</endTime>
</act>
<act type="pickupShipment">
<shipmentId>shipment2</shipmentId>
<arrTime>1.4630563586E12</arrTime>
<endTime>1.4630564186E12</endTime>
</act>
<act type="deliverShipment">
<shipmentId>shipment1</shipmentId>
<arrTime>1.4630571856E12</arrTime>
<endTime>1.4630572456E12</endTime>
</act>
<act type="deliverShipment">
<shipmentId>shipment2</shipmentId>
<arrTime>1.4630572456E12</arrTime>
<endTime>1.4630573056E12</endTime>
</act>
<end>1.4630573056E12</end>
</route>
</routes>
</solution>
</solutions>
</problem>
weirdProblemGradle.xml:
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
</problemType>
<vehicles>
<vehicle>
<id>vehicle1</id>
<typeId>myVehicleType</typeId>
<startLocation>
<id>vehicle1:location</id>
<coord x="13.38718" y="52.53635"/>
</startLocation>
<endLocation>
<id>vehicle1:location</id>
<coord x="13.38718" y="52.53635"/>
</endLocation>
<timeSchedule>
<start>1.46305572E12</start>
<end>1.7976931348623157E308</end>
</timeSchedule>
<returnToDepot>false</returnToDepot>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>myVehicleType</id>
<capacity-dimensions>
<dimension index="0">3</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>1.0</distance>
<time>0.0</time>
<service>0.0</service>
<wait>0.0</wait>
</costs>
</type>
</vehicleTypes>
<shipments>
<shipment id="shipment1">
<pickup>
<location>
<id>shipment1:pickup</id>
<coord x="13.38718" y="52.52635"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>1.4630559E12</start>
<end>1.4630565986E12</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<location>
<id>shipment1:dropoff</id>
<coord x="13.3489" y="52.54232"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>1.4630573656E12</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
</shipment>
<shipment id="shipment2">
<pickup>
<location>
<id>shipment2:pickup</id>
<coord x="13.387181" y="52.526351"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>1.46305596E12</start>
<end>1.4630565986E12</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<location>
<id>shipment2:dropoff</id>
<coord x="13.34891" y="52.542318"/>
</location>
<duration>60000.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>1.4630573656E12</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
</shipment>
</shipments>
<solutions>
<solution>
<cost>1.7976931348623157E308</cost>
<unassignedJobs>
<job id="shipment2"/>
<job id="shipment1"/>
</unassignedJobs>
</solution>
<solution>
<cost>1.7976931348623157E308</cost>
<unassignedJobs>
<job id="shipment1"/>
<job id="shipment2"/>
</unassignedJobs>
</solution>
</solutions>
</problem>