Learn R Programming

qap (version 0.2-0)

read_qaplib: Read QAPLIB Files

Description

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

Usage

read_qaplib(file)

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.

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.

References

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

Examples

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

Run the code above in your browser using DataLab