• Stars
    star
    1
  • Language
    Ada
  • License
    GNU General Publi...
  • Created about 6 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fully functional Hungarian Algorithm implementation in Ada

screenshot

Here is the full source code and examples:

https://github.com/fastrgv/HungarianAlgorithm/releases/download/v1.0.0/hu9nov20.7z

Type "7z x filename" to extract the archive.

Note: Please ignore the "Source code" zip & tar.gz files. (They are auto-generated by GitHub). Click on the large 7z file under releases to download all source & binaries (Windows,Mac & Linux). Then, type "7z x filename" to extract the archive.

Hungarian Algorithm Implementation in Ada

  • Although written in Ada, this code could be considered an algorithmic description.

The proper command to extract the archive and maintain the directory structure is "7z x filename".

Problem Description

The Hungarian algorithm can be described as optimally solving a workers versus jobs assignment problem that minimizes total cost. This implementation assumes a square cost matrix, i.e. the number of jobs equals the number of workers to do them.

A simple example, whose solution is almost immediately obvious follows.

job #1 #2 #3

A $2 $3 $3

B $3 $2 $3

C $3 $3 $2

The Hungarian method, when applied to the above table would give the minimum cost of $6, by assigning A to job 1, B to job 2, and C to job 3.

Example

munktest.adb solves an 11 x 11 (hardcoded) job assignment problem. To compile it, type lcmp.sh on linux, ocmp.sh on OSX, or wcmp.bat on Windows.

Source

This algorithm was copied on 20sep18 from: https://users.cs.duke.edu/~brd/Teaching/Bio/asmb/current/Handouts/munkres.html and modified to correct some errors.

It is currently being used as an integral part of a highly capable sokoban solver [hbox4] that has been developed. Thusly, it has now been tested on thousands of actual testcases and seems to be working properly.

Here are the links to the sokoban solver:

* https://sourceforge.net/projects/hbox4/files/8nov2022/
* https://github.com/fastrgv/hbox4

Please send any improvements or further corrections to: [email protected]

Note

I have searched for a correct version online, but found none. I found several that "almost" worked but were all flawed, mainly, I think, due to the age and nature of the original algorithmic description. It was invented before computers were widely available, so was described in terms of hand computations, parts of which are quite confusing, possibly due to language ambiguities. [Kuhn, 1955]

See Also

I now have another project titled "hbox4", which is a sokoban puzzle solver that makes heavy use of the Hungarian Algorithm. It demonstrates its remarkable power because without it, the solver becomes severely disabled.

License

Copyright (C) 2018 [email protected]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You may read the full text of the GNU General Public License at http://www.gnu.org/licenses/.

More Repositories

1

CoTerminalApps

In December of 2022, I split these ascii puzzles & arcade games into 2 separate Apps: a) "SliderPuzzles" & b) "RetroArcade". Please get updates from there.
Ada
26
star
2

AdaGate

AdaGate is a kid-friendly 3D dungeon escape game within a Stargate fantasy setting for Windows, OSX & most Linux distros. A tribute to Narbacular Drop with mind bending spacial interconnections.
Ada
20
star
3

AdaVenture

AdaVenture is a kid-friendly retro point&click adventure game with mazes, beasts, bats, bugs & snakes. Windows, OSX & most Linux distros. Hear ancient Persian melodies played by Korla Pandit.
Ada
15
star
4

MATTA

Deciphers Morse code Audio WAV files using Ada. Use it to send secret messages to your friends as a WAV file.
Ada
8
star
5

RufasSlider

A collection of retro classic 2D slider puzzles for Windows, OSX & most Linux distros. Includes Traffic-Rush, Klotski & Get-My-Goat; written in C++
C++
5
star
6

RufasCube

RufasCube is a 3D slider puzzle for Windows, OSX & most Linux distros. It looks like a rubic cube but it's a slider, not a twister.
Ada
4
star
7

SliderPuzzles

collection of retro puzzles that run in a terminal window on Windows, OSX & linux.
Ada
3
star
8

WorldCupSokerban

This is a soccer-themed, 3D sokoban puzzle game that runs on Windows, OSX and most Linux distros; featuring voice of Andres Cantor! Includes moderately capable, interactive autosolver.
Ada
3
star
9

Reliquarium

Reliquarium is a set of unique 3D slider puzzles with a Crystal Skull theme. It runs on Windows, OSX & most Linux distros.
Ada
2
star
10

Portable-Cpp-Sound-OpenAL

cross-platform sound-playing utility for C++ apps on Windows, OSX, & linux
C++
2
star
11

RufasSwap

RufasSwap is a permuted picture puzzle for kids & adults that runs on Windows, Mac OS-X and most Linux distros.
Ada
1
star
12

Asud

Sudoku assistant tool for Windows, OSX & Linux
Ada
1
star
13

ada-sdl2

Thin Ada binding to SDL2 v2.0.9
C
1
star
14

RufasGate

Stargate themed dungeon escape for Windows, Mac OS-X and GNU-Linux. An early version of adagate written in C++, with limited support.
C++
1
star
15

hbox4

Multiple-heuristic sokoban solver algorithm implemented in Ada
Ada
1
star
16

RetroArcade

Space Invaders, Pacman, & Frogger games that run in a terminal window on Windows, OSX & linux.
Ada
1
star
17

Interval-RPN-Calculator

Terminal App that mimics an HP RPN calculator using Interval Arithmetic for Windows/OSX/Linux. Output is an interval that contains exact solution. Uses Boost Interval library.
Ada
1
star
18

Portable-OpenAL-Sound

Cross platform sound-playing utility for Ada apps with its own binding to OpenAL for Windows, OSX & linux.
C
1
star