3 Questions: Endlocation and Multiple Vehicles

Hi to all!

I am working for a short time with jsprit and i find it very nice and helpfull! I am working on a MDVRP and i have two questions that i have to ask you:

I want to plan a MDVRP for multiple days. For example a week. So that I have for example 100 services in a city and 2 vehicles from different locations and each vehicle can make 10 services at one day. So there are enough services to plan them for 5 days. My first idea was to make for every day a new vehicle at the same spot so jsprit would plan each of them seperate. Is there a way to make this better? Can i tell the programm that the vehicle can drive 5 times?

Is it possible that a vehicle sets its endlocation on his last location of his route? So that the driver makes after his workingday an rest (for example in a hotel) and works at the next day from this location? This question references to the first because it requires a depot that i can say it has a vehicle that can drive multiple times. And so I need a depot with no fix location.

(Sorry I had a new idea for a question :slight_smile: )
Is it possible to make somekind of constraint, that an vehicle is set for making an round trip? For example I have a depot with many services in the region but I have also some regions far away were an vehicle could make a round trip.
This question references again to 2. and 1. so the vehicle needs to start from new from his last service location.

I hope my questions are understandable and you can help me somehow :slightly_smiling:

Greets

If nobody has an idea i will post mine maybe you could give me some response if you think it works.

What about giveing an vehicle multiple breaks? The working timewindow is relative so (for example) i want to calculate a MRVRP for 10 days, i could say that the vehicle is working 240(for 24h) * 10 = 2400 as a “latestArival”. Now i could give the vehicle multiple. Each are after a work from 8(80 for system) to 18(180 for system) oclock so for the program it would be the breaks: 180-320, 420-560, 660-800, and so on…

So each break would be at (180 + (i x 240) | 80 + (i x 240)) for i > 0 and i as a counter for the days.
I think this should work and the vehicle would begin driving each time after the break in the hotel.

So on one hand we have the normal vehicles that drive at a normal timewindow (80|180) and there are some “chosen” vehicles that make some round trips.

Hi,

ad 1) just add 5 drivers and solve the problem. Each driver can then be assigned to a specific day.

ad 2) set returnToDepot to false, then routes will be open.

Does this solve your problem?

Best,
Stefan

Hi.
Thanks for the advice I will look if this helps! Would it be somehow possible to build an constraint to tell the vehicle to return to the depot after some time?

I have another question.

Would it be possible to make a “day constant” for the time window calculation in the algorithm?`

For example a day in the progam means 2400 as a number. And there are many services that have timewindows. For example there is a service with the timewindow 1000|1200. So the vehicle could visit this service between 1000 and 1200 but also between 3400 and 3600 (at the next day). So the algorithm should make a new calculation for timewindows with a modulo of 2400.

This should not be so hard i think.

Hi @patrick_wisniewski19 ,

“Multiple time windows” feature has been implemented by Stefan, but needs to be verified. I think you can use your problem to verify it.

See this post.

Best regards,
He

Try the new multiple time window feature in the master branch. Here you
can just add arbitrary time windows. Thus you should be able to model this.

Am 20/01/16 um 10:27 schrieb patrick_wisniewski19:

Yes stefan thanks this solves some of mine problems and brings me near to the goal :slightly_smiling:

So if you want i can make also an test and can post my results.

So now i have a new question so maybe you can help me with it too :smiley:

In my problems it can be, That i have a service that needs a cuple of days to be done. I will make sure for the programm that the services will be split into multiple services with normal workingdays. So for example i have a service in my database that needs 24H so i will cut them into 3*8H services with fitting timewindows.
So my question is: Is there a possibility to make an constraint or an other way to tell the programm that “these 3 services have to be done from the same vehicle”? Because in my context it does not make sence for vehicle1 to begin with service1_1(First cutted service from service1) and service1_2 is done by vehicle2. Its not necessary to have an feature that fixes but it would help me a little bit :slightly_smiling:

thanks for the help till now :smiley:

Hi @patrick_wisniewski19,

This kind of relationship between jobs (multiple jobs must go to the same route) can be modeled by making use of custom constraints at route level.

Below are a few links which might be helpful:

Stefan’s list of job relationships that can be modeled; and

A few examples on stackoverflow.

Best regards,
He

1 Like

It would be great if you could test it (multiple tw) and share your experience with us :slightly_smiling:

@jie31best Thank you i will have a look at this sites and try to make it fit to my problem.

@stefan Okay i will try to make a scenairo and help with my tests

1 Like

Hi again :slightly_smiling:
I made some “generators” that create services with random locations and multiple timewindows (for me multiple days). Its not realy realistic because it sets every tw at the same time, but normaly beginning and ending is varius. This is only made to learn a bit from the code and about the performance.

How do you want to share my excperience? Should i post my code? Its quite simple though with random locations and generating multiple tw.

I have different results of the benchmark-time with different algorithm configs.

Hi Patrick,

Great. Share your results here: Need help to verify multiple time window feature. It would be great you shared not only data but also reasoning why you think results are good or bad, and for example hyphothesises that you think multiple tws are not considered appropriately. Thanks so much.

Best,
Stefan

Hi to all!

@stefan thank you some much for the great support of jsprit. It helps me very much with my problems and is very nice implemented!

But now again, I have a question. I am trying to work with costMatrix and this feature is very nice! But somehow I am missing an feature or i can´t see it…
I would like to import an costMatrix that is pre calculated and based on this matrix i would like to have the results. But on the other hand i would like to have after the calculation a plot, some visualisation of this problem. It would be cool if every location/service/vehicle would have its own x and y coordinates and would calculate the routes by the costMatrix. Would this be possible? Or is the algorithm generating its own x and y coordinates and could plot them?

If not it is no problem. Thanks for the answer!

Patrick

You can assign xy coordinates to vehicle- and job-locations. At the same time, you can consider your own travel times and distances. This way, you should be able to plot your solution. However, if you use lon/lat, you might be better off to transform these coordinates to appropriate x-y coordinates. For example, lon/lat usually comes in WGS84. If you have coodinates in Berlin then project these coordinate for example to DHDN (EPSG:3068). I usually use GeoTools for these kind of projections.
Is this the answer of your question?

This is just how i thought. But I see that if i assign x and y coodinates the location has no ID. And for me it looks like the costMatrix is working with location-id´s or not?

Edit:

I found out that there is an ID. It is build with the coordinates. I will try out working with this ID´s. But: Would it be possible to change this ID?

try this: Location.Builder.newInstance().setCoordinate(Coordinate.newInstance(x,y)).setId(id).setIndex(index).build();

Ok thanks it worked :slightly_smiling:
I have two new questions:

For which case I need the Index of a Location? And

What is the difference between the VehicleRoutingTransportCostsMatrix
and FastVehicleRoutingTransportCostsMatrix?

VehicleRoutingTransportCostsMatrix references with the ID and
FastVehicleRoutingTransportCostsMatrix references with the Index.
Are there other differences?

Correct. FastMatrix is faster :wink: since it stores times and distances in an array based on location indeces. In contrary, VehicleRoutingTransportCostsMatrix stores data in a map based on ids which is comparably expensive.

Okay thanks :slightly_smiling:

Sorry but again, I have new questions.

In my problems it could be, that whole tours are planed by some user itself. Initial routes would be planed and may not be optimal(even with broken constraints). I thought about to may use jsprit so validate the pre-planed solution. My idea would be to run the algorithm with 0 iterations and then tell in the console: Your planed tours have a distance of 10000. 20 Time window contstraints are broken. 30 Skill constraints are broken…
I dont know the algorithm and its theory but may it be possible to get some functional information about the solution? If yes it would be great. Because then jsprit could make a normal run with no initial routes and the user can see that the calculated solution is better then the own solution.

What do you think?