setId() for Location will increase the running time?

58 views
Skip to first unread message

He Huang

unread,
Sep 8, 2015, 3:22:01 AM9/8/15
to jsprit-mailing-list
Hi,

I am running Li-Lim benchmark instance lc101. I read the input file using LiLimReader and use the same config file as here. The result is good (the same as here), and the running time is around 5~6 seconds for 10,000 iterations.

However, if I add a setId() for each Location.Builder.newInstance() in LiLimReader, i.e., 

VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle")
.setEarliestStart(depotOpeningTime).setLatestArrival(depotClosingTime)
.setStartLocation(Location.Builder.newInstance().setId("v0").setCoordinate(customers.get(depotId).coord).build()).setType(type).build();

Shipment s = Shipment.Builder.newInstance(counter.toString()).addSizeDimension(0, demand)
                .setPickupLocation(Location.Builder.newInstance().setId("p" + counter).setCoordinate(customers.get(from).coord).build()).setPickupServiceTime(customers.get(from).serviceTime)
                .setPickupTimeWindow(TimeWindow.newInstance(customers.get(from).start, customers.get(from).end))
                .setDeliveryLocation(Location.Builder.newInstance().setId("d" + counter).setCoordinate(customers.get(to).coord).build()).setDeliveryServiceTime(customers.get(to).serviceTime)
                .setDeliveryTimeWindow(TimeWindow.newInstance(customers.get(to).start, customers.get(to).end)).build();

The result is still the same, but the running time increases to 60~70 seconds, even though the IDs of the locations are never used.

In summary, when I include setId() for each Location.Builder.newInstance(), the running time increases significantly. But why?

Thank you.

Best regards,
He

Stefan Schroeder

unread,
Sep 8, 2015, 3:29:11 AM9/8/15
to jsprit-ma...@googlegroups.com
Hi,

Can you send me both implementation such that I can run it myself? Otherwise it is hard to judge.

Best,
Stefan

Am 08/09/15 um 09:22 schrieb He Huang:
--
You received this message because you are subscribed to the Google Groups "jsprit-mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsprit-mailing-...@googlegroups.com.
To post to this group, send email to jsprit-ma...@googlegroups.com.
Visit this group at http://groups.google.com/group/jsprit-mailing-list.
For more options, visit https://groups.google.com/d/optout.

He Huang

unread,
Sep 8, 2015, 4:21:15 AM9/8/15
to jsprit-mailing-list
Hi Dr. Schröder,

Please kindly find attached both implementations. Each zip contains the input file (lc101.txt), the algorithm config file (vrppd_algorithmConfig_extSearch.xml), a Testing.java and a LiLimReader.java.

The only difference is in LiLimReader.java, which, in implementation_with_setId.zip, contains the setId() part I put in the original post, while, in implementation_without_setId.zip, does not contain that part.

Please let me know if you need anything more.
implementation_without_setId.zip
implementation_with_setId.zip

Stefan Schroeder

unread,
Sep 8, 2015, 5:05:46 AM9/8/15
to jsprit-ma...@googlegroups.com
Please, do not be too polite ;), and I am not even a Dr.. In Germany one has to be very careful with titles these days :).

Thanks,
Stefan

Am 08/09/15 um 10:21 schrieb He Huang:

He Huang

unread,
Sep 8, 2015, 5:51:02 AM9/8/15
to jsprit-mailing-list
Hi Stefan,

Oh sorry, I thought you were a Dr. because I saw you are a Research Associate.

Please kindly let me know if you have run my cases. Thank you.

Best regards,
He

He Huang

unread,
Sep 9, 2015, 12:20:12 AM9/9/15
to jsprit-mailing-list
Hi,

It seems it is the different Location IDs for the vehicles that make the difference. In my implementation, I made a change to the original LiLimReader in order to make the fleet FINITE. There, I set a unique ID for each of the individual vehicle locations even though they are all the same (the depot). See below:

        for (int i = 0; i < vehicleCount; i++) {
            VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle" + i)
                    .setEarliestStart(depotOpeningTime).setLatestArrival(depotClosingTime)
                    .setStartLocation(Location.Builder.newInstance().setId("v" + i).setCoordinate(customers.get(depotId).coord).build())
                    .setType(type).build();
            vrpBuilder.addVehicle(vehicle);
        }

If I change the blue highlighted part to setId("v"), i.e., set the same ID for the vehicle locations, the running time is back to 5~6 seconds. 

The different IDs for the job locations are fine because their coordinates are different anyway.

Best regards,
He
Reply all
Reply to author
Forward
0 new messages