inria-UFF / VRPSolverEasy

A simple Python interface for VRPSolver, a state-of-the-art Branch-Cut-and-Price exact solver for vehicle routing problems
https://vrpsolvereasy.readthedocs.io/en/latest/
MIT License
111 stars 10 forks source link

How do I get HFVRP to run? #4

Closed mventura00 closed 1 year ago

mventura00 commented 1 year ago

I'm fairly new to this, although I was able to get CVRP to run well on my laptop.

For HFVRP, at the botton in main() , it requires : -time -solver name -instance path -path solver

BUt I have no idea what this means? What is an instance path? How can I get the program to run? Thanks!! Marta

rrsadykov commented 1 year ago

Dear Marta,

Thank you for the interest in our solver!

Time is the time limit you want to impose to the solver (by default is 30 seconds, but you may give your own), indication of Solver name is optional, you may skip it, you may also skip Path solver. The only compulsory parameter is instance path, you just need to give the path to the instance file. Examples of the instance files are given in VRPSolverEasy/demos/data/HFVRP/. Your instance files should be in the same format. If not, you need to implement your own data file parsing function.

mventura00 commented 1 year ago

Thank you @rrsadykov Ruslan! I will try...not sure if I am going to be able to get it to run. I'll keep you posted. This code is quite difficult to understand know what part of the 'instance path' I need to modify in order to get it to run :( Is there any chance I can meet on zoom with you to walk through it?

For instance, for me to run 'CVRP, I had to change the main() part (at bottom) quite a bit. Originally, it had this code: if name == "main": if len(sys.argv) > 1: solve_demo(sys.argv[1:]) else: print("""Please indicates the path of your instance like this : \n python CVRP.py -i INSTANCE_PATH/NAME_INSTANCE \n -t TIME_RESOLUTION -s SOLVER_NAME (-p PATH_SOLVER (WINDOWS only)) """)

And, instead, I had to replace it with the following (the data file name to read is: 'data_philly.vrp' so that is set equal to 'instance_name': if name == "main": instance_name = "data_philly.vrp" time_resolution = 30 solver_name_input = "CLP" solver_path = "" solve_demo(instance_name, time_resolution, solver_name_input, solver_path)

mventura00 commented 1 year ago

@rrsadykov Also, how do we do a VRP that can handle combinations of these variants like multi-depot, heterogeneous vehicles, closed routes, etc? I read it in the HAL open science paper (the main one that you guys cite on the GitHub) that we can do that! That is great, but wish I knew how!

najibprog commented 1 year ago

Dear Marta,

Thank you for your interest in our solver. If you want to run an instance of HFVRP, you can

Screenshot 2023-06-22 150834

najibprog commented 1 year ago

@rrsadykov Also, how do we do a VRP that can handle combinations of these variants like multi-depot, heterogeneous vehicles, closed routes, etc? I read it in the HAL open science paper (the main one that you guys cite on the GitHub) that we can do that! That is great, but wish I knew how!

If you would like to handle combinations of these variants, you can start from this example in the documentation: https://vrpsolvereasy.readthedocs.io/en/latest/Example/index.html . All you have to do is configure the customers, depots, and vehicles differently, and the rest is done automatically. 🙂

mventura00 commented 1 year ago

sampledata.txt I was able to get VRPsolvereasy to run using a high-performance computing cluster at my university. I tried putting 30,000 (time limit) which is 8hr 20 min, but it was not enough. Now I am trying double that time and hopefully it will be enough... How long is a normal time for it to run (I know it depends on computer processing power etc)?

Another question. I used this dataset (that I pulled from your GitHub : demo/data/HFVRP). See file attached. In the first line, the '100' represents the 100 cities to deliver goods to, correct? I can see (lines 2 - lines 102) shows: id#, lat, long, and demand # .... where the first one on (line 2) is for the depot, and (lines 3-102) are the 100 other cities. Is this correct? Then the last few lines, where line 103: shows '3' means there are 3 different sized trucks. (Lines 104-106) , where each line has the capacity at the truck in the beginning, but what are the other 3 numbers. For instance, on line 104: I see truck capacity = 100. Or, is the capacity 500? What are the other numbers 1.0, 0, 100, represent? Is this all defined somewhere in some document? I did not see it specified in detail in the HAL open science paper.

rrsadykov commented 1 year ago

Dear Marta @mventura00,

One cannot predict the solution time, as the underlying problem is NP-hard. Some instances will be solved to optimality within your time limit, some will not. Some instances will be simply unsolvable within any reasonable time limit.

About the format of data files for the HFVRP, you description of the first line and the customer lines are correct. For the last three lines (they indeed describe the vehicle types), we have:

<vehicle capacity> <fixed cost for using one vehicle of this type> <variable cost factor> <min number of vehicles of this type to use> <max number of vehicles of this type to use>

where variable cost factor is the multiplier for the distance covered by vehicles of this type in the objective function (i.e., the larger is the vehicle, the larger will be its fuel consumption).

Hope this helps, Ruslan

mventura00 commented 1 year ago

Dear @rrsadykov Thank you so very much! You are the best! This is exactly the answer I was looking for in terms of what information I need to provide for the heterogenous Freight VRP (the last few lines) of the input code. Thank you for taking the time and patience to explain even what the 'variable cost factor' considers (is the multiplier for the distance covered - I imagine related to the gas mileage consuption $ cost per mile) and how the larger is the vehicle, the larger will be it's fuel consumption (for this, I will look online for some specific data or information related to this!). Thanks again and yes, this did help me so much. Marta