read_qaplib: Read QAPLIB Files

View source: R/read_qaplib.R

read_qaplibR Documentation

Read QAPLIB Files

Description

Read a problem instance and, when available, its solution from QAPLIB files.

Usage

read_qaplib(file)

Arguments

file

Path to a QAPLIB problem file with a .dat extension.

Details

If a .sln file with the same base name exists in the same directory, the function also reads its solution and objective value. Zero-based solutions are converted to R's one-based indexing. The package includes QAPLIB instances and solutions in its qaplib directory.

Value

A list with A (the flow matrix), B (the distance matrix), solution (a known solution, if available), and opt (its objective value, if available). The last two components are NULL when no solution file exists.

References

Burkard, R. E., Çela, E., Karisch, S. E., and Rendl, F. QAPLIB: A Quadratic Assignment Problem Library.

Examples

p <- read_qaplib(system.file("qaplib", "had12.dat", package = "qap"))
p
dir(system.file("qaplib", package = "qap"), pattern = "\\.dat$")

qap documentation built on Oct. 1, 2026, 5:10 p.m.