SkillAgentSearch skills...

CVRPLIB.jl

Download and read data from CVRPLIB: http://vrp.atd-lab.inf.puc-rio.br/index.php/en/

Install / Use

/learn @chkwon/CVRPLIB.jl
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

CVRPLIB.jl

Build Status codecov

This downloads and reads data files from CVRPLIB. This package is inspired by and built upon TSPLIB.jl

Installation

] add CVRPLIB

Usage

For example, to download the X-n242-k48 instance:

cvrp, vrp_file, sol_file = readCVRPLIB("X-n242-k48")

It returns three values. vrp_file is the path for the downloaded .vrp file and sol_file is the path for the .sol file. cvrp is the main data of the following struct:

    mutable struct CVRP
        name            :: String
        dimension       :: Int
        weight_type     :: String
        weights         :: Matrix{Int}
        capacity        :: Int 
        distance        :: Float64
        service_time    :: Float64
        coordinates     :: Matrix{Float64}    
        demand          :: Vector{Int}
        depot           :: Int
        dummy           :: Int
        customers       :: Vector{Int}
    end

Note:

  • weights, capacity, and demand are integer valued.
  • distance is the distance limit for each route. If no duration constraint, it is set to Inf.
  • service_time is the time for service at each customer node. It is set to 0.0, when the service time is not presented.
  • dimension is the number of nodes in the data, including the depot.
  • The index depot is usually 1.
<!-- If `add_dummy=true` is provided, this package automatically adds a dummy depot node to the end of the list, i.e., `dimension + 1`. ```julia cvrp, vrp_file, sol_file = readCVRPLIB("X-n242-k48", add_dummy=true) @assert size(cvrp.weights) == (cvrp.dimension + 1, cvrp.dimension +1) @assert size(cvrp.coordinates) == (cvrp.dimension + 1, 2) @assert length(cvrp.demands) == cvrp.dimension + 1 ``` -->

Related Data Packages

View on GitHub
GitHub Stars13
CategoryDevelopment
Updated1mo ago
Forks2

Languages

Julia

Security Score

90/100

Audited on Feb 2, 2026

No findings