The LcVRPContest project is a C++ implementation of a local search optimization algorithm for the loading-constrained vehicle routing problem (LCVRP). The program loads an instance from the data/lcvrp directory, runs optimization, and prints the final solution fitness.
- Windows
- Visual Studio with C++ support (e.g. Visual Studio 2019 / 2022)
- Or
MSBuildavailable from the Developer Command Prompt
- Open the solution file
LcVRPContest.slnin Visual Studio. - Choose
DebugorReleaseconfiguration. - Build the solution (
Build > Build Solution).
- Open
Developer Command Prompt for VS. - Navigate to the repository root, for example:
cd <path-to-repo>\LcVRPContest
- Build the project:
msbuild LcVRPContest.sln /p:Configuration=Release
The default program configuration in LcVRPContest.cpp runs the instance:
- data folder:
Vrp-Set-D - instance:
ORTEC-n323-k21 - iterations:
10 - random permutation: enabled
- After building the project, run it in Visual Studio (
Debug > Start DebuggingorDebug > Start Without Debugging).
-
From the repository root, run the executable with optional arguments:
.\x64\Release\LcVRPContest.exe [folder_name] [instance_name] [max_iterations] [use_random_permutation]
-
Or run directly from the build output folder:
cd .\x64\Release .\LcVRPContest.exe [folder_name] [instance_name] [max_iterations] [use_random_permutation]
The program automatically searches parent directories for the data/lcvrp folder, so it works from both the repo root and the build folder.
- Default settings:
.\LcVRPContest.exe - Specify folder and instance:
.\LcVRPContest.exe Vrp-Set-A A-n32-k5
- Specify iterations and disable random permutation:
.\LcVRPContest.exe Vrp-Set-A A-n32-k5 50 0
To use a different instance or dataset, edit the StartOptimization call in LcVRPContest.cpp. The first parameter is the folder name under data/lcvrp, and the second parameter is the instance file name without the .lcvrp extension.
Example:
StartOptimization("Vrp-Set-A", "A-n32-k5", max_iterations, use_random_permutation);Input files are located under:
data/lcvrp/Vrp-Set-Adata/lcvrp/Vrp-Set-Bdata/lcvrp/Vrp-Set-CMTdata/lcvrp/Vrp-Set-D- ...
The program accepts optional command-line arguments for folder, instance, iteration count, and random permutation. It also searches parent directories for the data/lcvrp folder, so you can run the executable from the build folder or from the repository root.