-
-
Notifications
You must be signed in to change notification settings - Fork 366
GSoC 2021 VRP functionality with VROOM on the database
- Proposal
- Participants
- Timeline
- Log of Pull Requests
- Slides
- Final Report
- Weekly Reports
- References
The project aims at implementing the VRP functionality in the vrprouting repository of pgrouting, using VROOM as a library in C++.
VROOM is an open-source optimization engine, that aims at providing good solutions to well-known Vehicle Routing Problems (VRP), such as:
- TSP (Travelling Salesman Problem)
- CVRP (Capacitated VRP)
- VRPTW (VRP with Time Windows)
- MDHVRPTW (Multi-Depot Heterogeneous VRPTW)
- PDPTW (Pickup-and-Delivery Problem with TW)
I propose to implement this functionality as an extension to PostGIS, the PostgreSQL geospatial database, by porting it to vrprouting, so that this functionality can be used in the PostgreSQL database
The vrprouting repository has been recently created by extracting the code of the pgrouting repository involving the VRP functions. It currently contains the functions to solve the Pickup-and-Delivery problem (vrp_pgr_pickDeliver
and vrp_pgr_pickDeliverEuclidean
) and the Single Depot VRP problem (vrp_oneDepot
). However, the VROOM functionality is not yet implemented in vrprouting, which if implemented, can provide good solutions to these problems in an efficient way.
Implementing the VROOM functionality as a postgreSQL extension will be very beneficial to those users who want to use the VROOM functionality in the database. VROOM provides a good solution to well-known vehicle routing problems within small computing times, and it can scale to handle very big instances. It is also customizable and supports user-defined cost matrices. Therefore the VROOM functionality in vrprouting can be of great use to the community, as the users can use it to solve real-world vehicle routing problems efficiently.
The deliverables at the end of GSoC period are:
- Implementation of VROOM functionality for vrprouting, as a function in postgreSQL database, where the user will provide the JSON structure expected by VROOM, and get the solution of the problem instance in GeoJSON format.
- Self-documented code in SQL, C, C++ with comments, wherever required.
- User’s Documentation for the function.
- Basic pgTAP tests to check the parameter types, parameter names, and connection with VROOM.
- Experimentation on the C++20 Modules can be done in this project.
Only if time allows:
- Additional pgTAP tests can be added, such as the server no crash tests and unit tests.
- More specific functions can be made using VROOM, where the user can give the input in the form of SQL query (instead of JSON structure), and get the result as a set of rows (instead of the GeoJSON).
Detailed Proposal in PDF format
Title | GitHub Handle | Name |
---|---|---|
1st Mentor | @cvvergara | Vicky Vergara |
2nd Mentor | @ashrafroni | Ashraf Hossain |
3rd Mentor | @rahulworld | Rahul Chauhan |
Student Developer | @krashish8 | Ashish Kumar |
- Set up the development environment.
- Interact with mentors, introduce myself to the community, and actively get involved in the discussion.
- Get familiar with pgRouting’s development style and VROOM. Understand expected coding, documentation, and testing standards set by pgRouting.
- Set up the wiki page to keep track of weekly progress.
- Develop a better understanding of PostgreSQL, PostGIS, PI/pgSQL, and how they interact with pgRouting.
- Learn to create unit tests using pgTap.
- Developing
vrp_vroom()
starts. - Create a basic skeleton for C, C++, SQL code, users documentation and pgTAP tests.
- Read data from PostgreSQL.
- Transform data to C++ containers suitable for calling the VROOM instance.
- Create the scripts for building the OSRM instance and running the OSRM server, on which VROOM runs.
- Create the necessary class wrappers for making connections to VROOM.
- Make connections to the VROOM instance, and pass the parameters.
- Transform the solution computed by VROOM to C containers suitable for passing to PostgreSQL.
- Basic testing of the function.
- Preparation of the report for the First Coding Period.
- Work on the feedback provided from the Phase 1 Evaluation.
- Create the test script and the environment for running the OSRM server before executing the pgTAP tests of the function, and the GitHub Actions script for the same.
- Create pgTAP tests to check the connection with the server.
- Create pgTAP tests for the function vrp_vroom() to check the parameter types, and parameter names.
- Fix the bugs, if any, to ensure that the pgTAP tests pass.
- Prepare user’s documentation.
- Create suitable queries using the examples of the VROOM API documentation.
- Integration to the
develop
branch of the vrpRouting repository (the branch is not yet created)
- Preparation of the final report.
Link to all the Pull Requests made in GSoC-pgRouting repository for GSoC 2021
Pull Request | Description | Date | Status |
---|---|---|---|
#11 | Updated documentation for develop | Aug 13th, 2021 | Merged |
#10 | [GSoC-2021] Experimental VROOM Category functions - vrp_vroom, vrp_vroomJobs, vrp_vroomShipments | Aug 11th, 2021 | Merged |
#189 | GSoC-2021 Week 9: vrp_vroom | Aug 8th, 2021 | Merged |
#185 | GSoC-2021 Week 8: vrp_vroom | July 31st, 2021 | Merged |
#183 | GSoC-2021 Week 7: vrp_vroom | July 24th, 2021 | Merged |
#180 | GSoC-2021 Week 6: vrp_vroom | July 18th, 2021 | Merged |
#178 | GSoC-2021 Week 5: vrp_vroom | July 10rd, 2021 | Merged |
#177 | GSoC-2021 Week 4: vrp_vroom | July 3rd, 2021 | Merged |
#174 | GSoC-2021 Week 3: vrp_vroom | June 26th, 2021 | Merged |
#170 | GSoC-2021 Week 2: vrp_vroom | June 19th, 2021 | Merged |
#167 | GSoC-2021 Week 1: vrp_vroom | June 12th, 2021 | Merged |
#165 | GSoC-2021 Bonding Period: vrp_vroom | June 5th, 2021 | Merged |
#141 | GSoC Task 2: Adding name in contributor list | February 9th, 2021 | GSoC Task Pull Request - Not to Merge |
https://docs.google.com/presentation/d/1hQeRd-BpQfaz2cMViOenhpQun6Mvi28dnislwvbG73M/edit?usp=sharing
(The below report was sent to the two mailing lists of OSGeo - SoC and pgrouting-dev)
Hello everyone,
With the GSoC period coming to an end, I hereby present the final report of my work, which I did over the past 10 weeks. It has been a great experience working twice during GSoC with the pgRouting community and the mentors. This report is in accordance with the guidelines set by Google [1] and OSGeo GSoC Admins [2].
-
(a) Title: VRP functionality with VROOM on the database for pgRouting
(b) Organization: pgRouting under OSGeo. -
Abstract:
The GSoC project dealt with the implementation of the VROOM category functions in the vrpRouting repository of pgRouting.
VROOM is an open-source optimization engine that aims at providing good solutions to various real-life vehicle routing problems (VRP) within a small computing time. It can solve several well-known types of vehicle routing problems (VRP):
- TSP (travelling salesman problem)
- CVRP (capacitated VRP)
- VRPTW (VRP with time windows)
- MDHVRPTW (multi-depot heterogeneous vehicle VRPTW)
- PDPTW (pickup-and-delivery problem with TW)
- VROOM can also solve any mix of the above problem types.
The project dealt with implementing the VROOM functionality as a PostgreSQL function so that it can be used directly in the database. It involved creating the three functions in vrpRouting - vrp_vroom, vrp_vroomJobs, and vrp_vroomShipments.
- The state of the project before GSoC:
The vrpRouting repository was created a few months before the starting of the GSoC program, by extracting the code of the pgrouting repository involving the VRP functions. It initially contained the functions to solve the Pickup-and-Delivery problem (vrp_pgr_pickDeliver and vrp_pgr_pickDeliverEuclidean) and the Single Depot VRP problem (vrp_oneDepot). However, the VROOM functionality was not implemented in vrprouting. The three functions that I created under the VROOM category did not exist before GSoC.
- The addition that my project brought to pgRouting:
My project added the code, documentation (with the docqueries), and the pgTAP tests of these three functions:
- vrp_vroom - Vehicle Routing Problem with VROOM, involving both jobs and shipments.
- vrp_vroomJobs - Vehicle Routing Problem with VROOM, involving only jobs.
- vrp_vroomShipments - Vehicle Routing Problem with VROOM, involving only shipments.
We wanted some standard external library for solving the VRP problems (similar to how the other pgRouting functions used Boost for adding the graph algorithms), and that was made available through these functions that I created during GSoC.
- Potential Future Work:
The implementation of these functions is complete. We can create more similar functions having different signatures based on the use-case, such as replacing the time with timestamps. The VROOM functionality can be tested by creating performance tests. Also, the build can be made compatible with other OS, such as macOS and Windows, as the build perhaps fails on macOS. Different applications of the functions can be studied, and specific functions can be made based on that.
- Links:
(i) Users Documentation:
- VROOM - Category (Experimental): https://vrp.pgrouting.org/dev/en/vroom-category.html
- vrp_vroom - Experimental: https://vrp.pgrouting.org/dev/en/vrp_vroom.html
- vrp_vroomJobs - Experimental: https://vrp.pgrouting.org/dev/en/vrp_vroomJobs.html
- vrp_vroomShipments - Experimental: https://vrp.pgrouting.org/dev/en/vrp_vroomShipments.html
- VROOM data section in Sample Data: https://vrp.pgrouting.org/dev/en/sampledata.html
(ii) Tag:
- VROOM Category functions: https://github.com/pgRouting/GSoC-pgRouting/releases/tag/2021-krashish8-vroom-category
(iii) Pull Requests:
- Final Pull Request: Experimental VROOM Category functions - vrp_vroom, vrp_vroomJobs, vrp_vroomShipments - https://github.com/pgRouting/vrprouting/pull/10
- Subsequent Pull Request for updating documentation: Added name in contributors list, updated release notes - https://github.com/pgRouting/vrprouting/pull/11
- Intermediate weekly Pull Requests created in GSoC-pgRouting repository: https://github.com/pgRouting/GSoC-pgRouting/pulls?q=is%3Apr+author%3Akrashish8+created%3A%3E2021-01-01
(iv) Wiki Page:
- VRP functionality with VROOM on the database: https://github.com/pgRouting/pgrouting/wiki/GSoC-2021-VRP-functionality-with-VROOM-on-the-database
-
Image:
- Example of Garbage Collection with dummy data, solved using the VROOM-category functions: https://drive.google.com/file/d/1C1povjJG5OE1aHGpLcDyetVSXDrPntI6/view?usp=sharing
-
Media:
I'm glad to participate in the GSoC program twice as a student developer. I would be happy if my code proves beneficial to the community. Thanks to everyone for the support!
Thank you,
Ashish Kumar.
[1]. https://developers.google.com/open-source/gsoc/help/work-product
[2]. https://lists.osgeo.org/pipermail/soc/2021-August/004804.html
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Merged two pull requests to the vrpRouting repository's develop branch:
- Created a tag 2021-krashish8-vroom-category in GSoC-pgRouting containing the code of the experimental VROOM Category functions: vrp_vroom, vrp_vroomJobs, vrp_vroomShipments.
-
What do I plan on doing next week?
- Make the final presentation and report of the work.
- Submit the final evaluation of my mentors.
-
Am I blocked on anything?
- No blocking issues
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Made changes in SQL, code, doc, docqueries, pgTAP tests for new signature.
- Made changes in README and CMakeLists.txt
- Added more pgTAP tests.
- Modified sampledata (vroomdata), and added constraints.
- Updated Documentation
- Made a pull request with all these changes (#189).
-
What do I plan on doing next week?
- Merge the changes to the vrprouting repository develop branch.
- Work on creating the presentation.
-
Am I blocked on anything?
- No blocking issues.
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Fixed code checker script.
- Created functions for min_version and min_lib_version
- Added and updated the documentation/docqueries.
- Updated existing pgTAP tests.
- Added vroomJobs-vroom and vroomShipments-vroom equivalence test
- Added edge cases test.
- Made a pull request with all these changes (#185).
-
What do I plan on doing next week?
- Modify the signature of the functions and make corresponding changes everywhere, so that an SQL query is not stored inside the database.
- If possible, fix the macOS build, and add more pgTAP tests.
-
Am I blocked on anything?
- No blocking issues, but need to fix the macOS GitHub Actions Build.
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Added vroomdata for pgtap tests
- Added types check
- Added no crash test
- Added inner query test for vrp_vroom
- Fixed spi_getText for NULL values
- Made a pull request with all these changes (#183).
-
What do I plan on doing next week?
- Add the remaining pgTAP tests to the function.
-
Am I blocked on anything?
- No blocking issues.
-
Meetings attended in this week
- Date: Summary of the meeting.
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Created documentation for vroom-category, vrp_vroom, vrp_vroomJobs, vrp_vroomShipments.
- Moved the documentation inside the code (sql/ or src/ directory) as comments.
- Added single docquery to each vroom function - vrp_vroom, vrp_vroomJobs, vrp_vroomShipments.
- Refactored code:
- Changed types/names of certain columns.
- Added speed_factor in vehicles SQL.
- Removed all logs statements.
- Fixed code to prevent potential server crash.
- Made a pull request with all these changes (#180).
-
What do I plan on doing next week?
- Start creating the pgTAP tests of the functions.
-
Am I blocked on anything?
- No blocking issues.
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Added VROOM matrix input in base matrix class, and removed my custom added matrix.
- Changed C++14 to C++17 [‘std::optional’ is only available from C++17 onwards]
- Added style-lint test and linted the C/C++ code.
- Changed vehicle load from BIGINT to BIGINT[].
- Adjusted vroom helper functions, and added some functions to get the result.
- Completed the basic implementation of vrp_vroom, but may need to do several improvements.
- Added one sample docquery for vroom.
- Made a pull request with all these changes (#178).
-
What do I plan on doing next week?
- Add more docqueries to the vrp_vroom function.
- Do a manual testing of the function, fix the todos, warnings or bugs.
-
Am I blocked on anything?
- No blocking issues.
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Added vroom types input in CMakeLists.
- Added functions to connect VROOM to vrprouting
- Made a pull request with all these changes (#177).
-
What do I plan on doing next week?
- Complete the implementation of the function vrp_vroom.
-
Am I blocked on anything?
- No blocking issues.
-
Meetings attended in this week
- July 2nd
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Added function to get positive int array input.
- Updated all the GitHub actions build for building VROOM with vrprouting: Ubuntu Clang, Boost versions, Check queries, Documentation, Releases. Could not get the macOS build working.
- Added functions to get columns data input - Index, MatrixIndex, Duration, Priority, Distance.
- Made a pull request with all these changes (#174).
-
What do I plan on doing next week?
- I will be adding various functions to connect VROOM with vrprouting.
-
Am I blocked on anything?
- No blocking issues. Could not get the macOS build working, but this can be fixed later on.
-
Meetings attended in this week
- June 25th: Discussion on PR#1933 regarding update scripts, and actions to check coding style.
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Added functions to get the postgres datatypes and convert them to vroom C types.
- Breaks input
- Steps input
- Time Windows input
- Jobs input
- Shipments input
- Vehicles input
- Created basic skeleton to take the inputs in
vroom.c
and pass them to the vroom driver function. - Updated CMakeLists to build and compile vrprouting with vroom.
- Updated GitHub actions scripts for Ubuntu to build VROOM.
- Made a pull request with all these changes (#170).
- Added functions to get the postgres datatypes and convert them to vroom C types.
-
What do I plan on doing next week?
- Update GitHub actions scripts for macOS and other jobs.
- Add matrix cell input function for vroom
- Add or update the functions in array input, and columns input file for taking vroom inputs.
-
Am I blocked on anything?
- No blocking issues.
-
Report Mail - [SoC], [pgrouting-dev]
-
What did I get done this week?
- Started coding the
vrp_vroom
function. - Added vrp_vroom SQL functions:
- Added vroom.c file to convert postgres datatypes to C.
- Added vroom driver file and corresponding header file.
- Added sample boilerplate for pgTAP test.
- Updated typedefs and added vroom types structures.
- Updated CMakeLists temporarily so that tests don't fail on warnings.
- Updated configuration file, for compilation to include sql and src files of vroom.
- Made a pull request with all these changes (#167).
- Started coding the
-
What do I plan on doing next week?
- Add functions to get the postgres datatypes and convert them to vroom C types.
- Pass the data after conversion to the vroom driver function.
- Add GitHub actions scripts and update CMakeLists to build and compile vrprouting with vroom.
-
Am I blocked on anything?
- No blocking issues.
-
Introduction Mail - [SoC], [pgrouting-dev]
-
Bonding Period Report Mail - [SoC], [pgrouting-dev]
-
What did I get done during the Community Bonding period?
- Set up the development environment.
- Interacted with mentors, introduce myself to the community, and actively get involved in the discussion.
- Set up a wiki page to keep track of weekly progress.
- Studied Google's GSoC students guide and the OSGeo's specific instructions.
- Added a wiki link to OSGeo's accepted student's wiki page.
- Introduced myself and my project on OSGeo's SOC mailing list.
- Got familiar with pgRouting’s development style. Understand expected coding, documentation, and testing standards set by pgRouting.
- Developed a better understanding of PostgreSQL, PostGIS, Pl/pgSQL, and how they interact with pgRouting.
- Learned to create unit tests using pgTAP.
- Got familiar with the VROOM and its codebase. Also, built VROOM locally, tested it using the sample queries, and tried to call the VROOM functions using C++ via libvroom.
- Created a new branch named ashish-2021 in the GSoC-pgRouting repository, where I will be merging weekly pull requests.
- Merged the first pull request in the Bonding Period, consisting of the proposed documentation of vrp_vroom.
-
What do I plan on doing next week?
- Start coding my function vrp_vroom.
- Create a basic skeleton for C, C++, SQL code, and for documentation and tests.
- Read the data from PostgreSQL and transform it to a suitable form, to create a basic skeleton for calling the VROOM functions.
-
Am I blocked on anything?
- No, currently I don't have any blocking issue.
-
May 21st
- Introductory meeting with the mentors for the future plans of the GSoC period.
-
June 1st
- Met with the core developer of VROOM - Julien Coupey, along with other pgRouting mentors - Daniel and Vicky, to introduce and discuss regarding the project, the VROOM, its terminologies, etc.
-
Proposal Mail - [SoC], [pgrouting-dev]
- Vehicle Routing Open-source Optimization Machine: VROOM-Project/vroom
- vrpRouting - Vehicle Routing problems on PostgreSQL: pgRouting/vrprouting
- Vehicle Routing Problems - Wikipedia
- VROOM API Documentation
- VROOM Documentation - Examples
- OpenStreetMap data for Ile-de-France: ile-de-france
- OpenStreetMap data extracts - Geofabrik
- Open Source Routing Machine (OSRM) - Backend: Project-OSRM/osrm-backend
- Vehicle Routing Functions - Category (Experimental) - vrpRouting documentation
- A sequential insertion heuristic for the initial solution to a constrained vehicle routing problem