problem.rst 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. QAP problem definition
  2. ======================
  3. The quadratic assignment problem (QAP) was introduced by Koopmans and Beckman in 1957 in the context of locating "indivisible economic activities". The objective of the problem is to assign a set of facilities to a set of locations in such a way as to minimize the total assignment cost. The assignment cost for a pair of facilities is a function of the flow between the facilities and the distance between the locations of the facilities.
  4. Location assignment example
  5. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  6. Consider a **facility location problem** with **four** facilities (and **four** locations). One possible assignment is shown in the figure below: facility 4 is assigned to location 1, facility 1
  7. is assigned to location 2, facility 3 is assigned to location 3, and facility 2 is assigned to location 3. This assignment can be written as the permutation :math:`p=\{4,1,3,2\}`,
  8. which means that facility 4 is assigned to location 1, facility 1 is assigned to location 2, facility 3 is assigned to location 3, and facility 2 is assigned to location 3.
  9. In the figure, the line between a pair of facilities indicates that there is required flow between the facilities, and the thickness of the line increases with the value of the flow.
  10. .. image:: ../../_static/examples/qap/factories_qap.png
  11. :width: 50 %
  12. :align: center
  13. :alt: Example of QAP facilities to locations problem
  14. To calculate the assignment cost of the permutation, the required flows between facilities and the distances between locations are needed.
  15. .. tabularcolumns:: |p{1cm}|p{1cm}|p{1cm}|p{1cm}|
  16. .. csv-table:: flow of the current facilities
  17. :header: facility `i`, facility `j`, flow( `i`\, `j` )
  18. :widths: 2, 2, 3
  19. 1, 4, 4
  20. 3, 4, 10
  21. 3, 1, 8
  22. 2, 1, 6
  23. .. csv-table:: distances of between locations
  24. :header: location `i`, location `j`, distances( `i`\, `j` )
  25. :widths: 2, 2, 3
  26. 1, 2, 42
  27. 1, 3, 30
  28. 2, 3, 41
  29. 3, 4, 23
  30. Then, the assignment cost of the permutation can be computed as:
  31. :math:`f(1,4)⋅d(1,2)+f(3,4)⋅d(1,3)+f(1,3)⋅d(2,3)+f(3,2)⋅d(3,4)`
  32. with result :math:`4⋅42+10⋅30+8⋅41+6⋅23=934`.
  33. Note that this permutation is not the optimal solution.
  34. Mathematical definition
  35. ~~~~~~~~~~~~~~~~~~~~~~~
  36. **Sets**
  37. - :math:`N=\{1,2,⋯,n\}`
  38. - :math:`S_n=\phi:N→N` is the set of all permutations
  39. **Parameters**
  40. - :math:`F=(f_{ij})` is an :math:`n×n` matrix where :math:`f_{ij}` is the required flow between facilities :math:`i` and :math:`j`
  41. - :math:`D=(d_{ij})` is an :math:`n×n` matrix where :math:`d_{ij}` is the distance between locations :math:`i` and :math:`j`.
  42. **Optimization Problem**
  43. - :math:`min_{ϕ∈S_n}\sum_{i=1}^{n}{\sum_{j=1}^{n}{f_{ij}⋅d_{\phi(i)\phi(j)}}}`
  44. The assignment of facilities to locations is represented by a permutation :math:`\phi`, where :math:`\phi(i)` is the location to which facility :math:`i` is assigned. Each individual product :math:`f_{ij}⋅d_{\phi(i)\phi(j)}` is the cost of assigning facility :math:`i` to location :math:`\phi(i)` and facility :math:`j` to location :math:`\phi(j)`.