1 unstable release
0.1.0 | Jun 7, 2025 |
---|
#1163 in Parser implementations
114 downloads per month
58KB
1.5K
SLoC
Parser for the TSPLIB format in Rust
Warning: This crate is work in progress and is not comprehensively tested!
In addition to the specifications by TSPLIB95, the following features are supported:
- Maximum distance (
DISTANCE
) and service time (SERVICE_TIME
) for some instances in CVRPLIB. - Multi-dimensional demands (
DEMAND_DIMENSION
) for multi-commodity pickup-and-delivery TSP (m-PDTSP).
Examples
use std::env;
use tsplib_parser::Instance;
fn main() {
let mut args = env::args();
args.next().unwrap();
let input = args.next().unwrap();
println!("Loading instance from file: {}", input);
let instance = Instance::load(&input).unwrap();
println!("{:?}", instance);
let matrix = instance.get_full_distance_matrix().unwrap();
println!("{:?}", matrix);
}