Coder Social home page Coder Social logo

alexandersobolev1990 / lap Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 11.58 MB

Linear assignment problem solving using Jonker Volgenant Castanon method (JVC), Mack and Hungarian(Munkres) method.

License: MIT License

CMake 1.06% C++ 98.94%
assignmentproblem jvc lap lapjv lapjv-algorithm hungarian jonker jonker-volgenant volgenant mack

lap's Introduction

LAP - Linear Assignment Problem / Линейная дискретная оптимизационная задача (задача о назначениях)

1. Brief / Обзор


Solving linear assignment problem using / Решение задачи о назначениях методами:

  • Jonker-Volgenant-Castanon method (JVC) for dense and sparse (CSR - compressed sparse row) matrices / Метод Джонкера-Волгенанта-Кастаньона для плотных и разреженных матриц в CSR формате
  • Mack method / Метод Мака
  • Hungarian (Munkres) method / Венгерский алгоритм

2. References / Ссылки

Papers / Статьи:

  • R.Jonker and A.Volgenant A Shortest Augmenting Path Algorithm for Dense and Sparse Linear Assignment Problems Computing 38, 325-340 (1987)
  • A.Volgenant Linear and Semi-Assignment Problems: A Core Oriented Approach
  • Банди Б. Основы линейного программирования: Пер. с англ. - М.:Радио м связь, 1989, стр 113-123

Sites / Сайты:

Repositories / Репозитории:

3. Dependencies / Зависимости


Armadillo for matrices, Boost for testing / Armadillo для работы с матрицами, Boost для тестирования.

4. Tests / Тесты

  • Сomparison of calculation speed on dense and sparse matrices / Сравнение скорости работы на плотных и разреженных матрицах
  • Simple assignment problem matrices are provided / Дополнительные тесты на простых матрицах
  • test JVC algorithm for looping / Тест алгоритма JVCdense на зацикливание

(Sparsity is ~20% / В разреженной матрице ~20% назначенных ячеек)


Results for time measuring / Результаты замеров скорости работы:

Fig.1 - Execution time for dense matrices (small dimensions)
Рис.1 - Время выполнения на плотных матрицах (малые размернсти)

Fig.2 - Execution time for sparse matrices (small dimensions)
Рис.2 - Время выполнения на разреженных матрицах (малые размернсти)

Fig.3 - Execution time for dense matrices (large dimensions)
Рис.3 - Время выполнения на плотных матрицах (большие размерности)

Fig.4 - Execution time for sparse matrices (large dimensions)
Рис.4 - Время выполнения на разреженных матрицах (большие размерности)

Fig.5 - Execution time for sparse matrices (large dimensions) for JVCsparse
Рис.5 - Время выполнения на разреженных матрицах (большие размерности) для JVCsparse

Additional graphs pics for methods of sequental extremum for dense and sparse matrices in dense and COOrdinated formats / Дополнительные графики для методов последовательного выбора экстремума для плотных и разреженных матриц в обычном плотном виде и COO-формате.


Fig.6 - Execution time for dense matrices (small dimensions)
Рис.6 - Время выполнения на плотных матрицах (малые размерности)

Fig.7 - Execution time for sparse matrices (small dimensions)
Рис.7 - Время выполнения на разреженных матрицах (малые размерности)

5. Time measurements tables for sparse matrices / Сводные таблицы замеров времени выполнения для разреженных матриц

Table 1 - Execution time, milliseconds / Таблица 1 - Время выполнения, миллисекунды

N 8 16 32 64 128 256 512 1024
Hungarian 0.007 0.046 0.369 4.358 66.083 1344.975 - -
Mack 0.002 0.014 0.143 1.863 26.124 327.440 - -
SeqExtr 0.004 0.018 0.141 1.336 16.591 238.068 - -
SeqExtrCOO 0.002 0.009 0.045 0.297 2.663 39.466 - -
JVCdense 0.002 0.005 0.020 0.083 0.418 3.185 26.182 586.341
JVCsparse 0.001 0.001 0.003 0.007 0.023 0.126 1.159 5.505

Table 2 - Increasing execution time relative to JVCsparse (times) / Таблица 2 - Возрастание времени выполнения относительно метода JVCsparse (разы)

N 8 16 32 64 128 256 512 1024
Hungarian 6.371 32.886 124.864 653.129 2908.809 10701.411 - -
Mack 2.162 10.120 48.250 279.142 1149.913 2605.306 - -
SeqExtr 3.730 13.170 47.842 200.191 730.270 1894.205 - -
SeqExtrCOO 2.141 6.424 15.241 44.439 117.197 314.015 - -
JVCdense 1.601 3.438 6.687 12.485 18.380 25.343 22.596 106.506

6. Conclusion / Вывод

JVCsparse is the fastest method from considered (for sparse matrices), cause it works with compact CSR storage and uses fast JVC algorithm. JVCdense is the fastest for dense. Method of sequental extremum is non-optimal and it's usage is not recommended. / JVCsparse самый быстрый метод среди рассмотренных (для разреженных матриц), поскольку работает с матрицами, хранящимися в компактном CSR формате и использует быстрый JVC алгоритм. Для плотных матриц самый быстрый JVCdense. Метод последовательного выбора экстремума неоптимален и его использование не рекомендуется.

lap's People

Contributors

alexandersobolev1990 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

lap's Issues

The matrix size problem

Hello,

 you assume the matrix of rows and cols are equal,  this is not always right.

Could you please Update 
   void JVCdense( const arma::mat &assigncost, int dim, TSearchParam sp, double infValue,
double resolution, arma::ivec &rowsol, double &lapcost )
  ==>
 oid JVCdense(const arma::mat& assigncost, int dim_nRows, int dim_nCols, TSearchParam sp, double infValue,
double resolution, arma::ivec& rowsol, double& lapcost)

And other functions as well?

Thanks!

-Scott

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.