R: Read QAPLIB Files

read_qaplib {qap} | R Documentation

## Read QAPLIB Files

### Description

Reads example file in the format used by QAPLIB.

### Usage

    read_qaplib(file)

### Arguments

`file` | file name.

### Details

Problems end with the extension `.dat` and solutions with `.sln`. The code tries to read the problem and, if available in the same directory, it also reads the solution and the known optimal value from the solution file.

The package contains a copy of the problem instances and solutions from QAPLIB. The data is stored in the package in directory `qaplib`.

### Value

Returns a list with the components

`D` | distance matrix.
`W` | weight matrix.
`solution` | a known optimal solution (if available).
`opt` | known optimal value (if available).

### Author(s)

Michael Hahsler

### References

R.E. Burkard, E. Cela, S.E. Karisch and F. Rendl, QAPLIB - A Quadratic Assignment Problem Library, http://anjos.mgi.polymtl.ca/qaplib/

### Examples

    ## load a QAPLIB problem instance
    p <- read_qaplib(system.file("qaplib", "had12.dat", package="qap"))
    p

    ## list all QAPLIB instances
    dir(system.file("qaplib", package="qap"), pattern = "*.dat")

[Package qap version 0.1-1 Index]