# qap

From qap v0.1-0
0th

Percentile

##### Solve Quadratic Assignment Problems (QAP)

This function implements Quadratic Assignment Problems (QAP) heuristics. Currently there is only a simulated annealing heuristic available, but more will be added in the future.

Keywords
optim
##### Usage
qap(A, B, method = NULL, ...)
qap.obj(A, B, o)
##### Arguments
A
a symmetric matrix with positive weights/flows between pairs facilities.
B
a symmetric matrix with positive distances between pairs of locations.
method
a character string indicating the used solver. Defaults to "SA", the currently only available method.
...
further arguments are passed on to the solver (see details).
o
a permutation vector for the assignment of facilities to locations.
##### Details

The objective of the QAP is to find the best facility to location assignment. The assignment is represented by a permutation matrix $X$ and the objective is

$$\mathrm{min}_{X \in \Pi}\; tr(AXBX^T)$$

qap.obj calculates the objective function for A and B with the permutation o.

The QAP is known to be NP-hard. This function implements the simple simulated annealing heuristic described by Burkard and Rendl (1984). The code is based on Rendl's FORTRAN implementation of the algorithm available at the QAPLIB Web site.

The solver has the additional arguments rep = 1L, miter = 2 * nrow(A), fiter = 1.1, ft = 0.5 and maxsteps = 50L

rep
integer; number of restarts.

miter
integer; number of iterations at fixed temperature.

fiter
multiplication factor for miter after miter random transposition trials.

ft
multiplication factor for t after miter random transposition trials (between 0 and 1).

maxsteps
integer; maximal number of allowed cooling steps.

##### Value

Returns an integer vector with facility to location assignments. The objective function value is provided as attribute "obj".

##### References

R.E. Burkard and F. Rendl. A thermodynamically motivated simulation procedure for combinatorial optimization problems. European Journal of Operations Research, 17(2):169-174, 1984.

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

• qap
• qap.obj
##### Examples
## load the had12 QAPLIB problem
p

## run 1 repetitions verbose
a <- qap(p$A, p$B, verbose = TRUE)
a

## compare with known optimum (gap, % above optimum)
(attr(a, "obj") - p$opt)/p$opt * 100

## run more repetitions quietly
a <- qap(p$A, p$B, rep = 100)
a

## compare with known optimum (gap, % above optimum)
(attr(a, "obj") - p$opt)/p$opt * 100

Documentation reproduced from package qap, version 0.1-0, License: GPL-3

### Community examples

Looks like there are no examples yet.