https://github.com/wzieba/qap-genetic-algorithm
Resolving quadratic assignment problem with genetic algorithm
https://github.com/wzieba/qap-genetic-algorithm
assignment-cost genetic-algorithm qap
Last synced: 3 days ago
JSON representation
Resolving quadratic assignment problem with genetic algorithm
- Host: GitHub
- URL: https://github.com/wzieba/qap-genetic-algorithm
- Owner: wzieba
- Created: 2018-03-29T22:14:39.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-31T16:50:04.000Z (about 7 years ago)
- Last Synced: 2025-03-31T09:41:20.778Z (about 1 month ago)
- Topics: assignment-cost, genetic-algorithm, qap
- Language: Python
- Homepage:
- Size: 2.5 MB
- Stars: 14
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# QAP with GA 🐒 [](https://travis-ci.org/wzieba/QAP-Genetic-Algorithm) [](https://codecov.io/gh/wzieba/QAP-Genetic-Algorithm)
Resolving Quadratic Assignment Problem with Genetic Algorithm
## 🚀 Getting Started
To run clone repo, go to `src` folder and run
```
python main.py
```## 🔧 Config
In `config.py` you can find following configuration options:
```
INPUT_FILE = "had12.dat"
CROSSOVER_PROBABILITY = 0.7
MUTATION_PROBABILITY = 0.08
POPULATION_SIZE = 100
NUMBER_OF_GENERATIONS = 100
DRAW_VISUALIZATION = True
DRAW_CHART = True
```
Feel free to experiment with them.## 📈 Visualization
### Simulation

#### Legend (how to read)
- Red color of line means long distance, green one - short
- Thick line means big value of flow (aka cost), thin one - smallBoth values are in context of particular distance and flow matrices
In short: thin green is better than thick red
### Charts

## 🚚 Quadratic Assignment Problem
The objective of the Quadratic Assignment Problem (QAP) is to assign n facilities to n locations in such a way as to minimize the assignment cost. The assignment cost is the sum, over all pairs, of the flow between a pair of facilities multiplied by the distance between their assigned locations.
Source and more information: [neos-guide.org](https://neos-guide.org/content/quadratic-assignment-problem)
### Dataset
Dataset available in `res/data` are taken from [http://anjos.mgi.polymtl.ca/qaplib/inst.html#HRW](http://anjos.mgi.polymtl.ca/qaplib/inst.html#HRW)
Authors: S.W. Hadley, F. Rendl and H. Wolkowicz
## Genetic Algorithm
In computer science and operations research, a genetic algorithm (GA) is a metaheuristic inspired by the process of natural selection. [More](https://en.wikipedia.org/wiki/Genetic_algorithm)
### Important note
Some fragments of this implementation were inspired by code of mgr Filip Bachura from Wroclaw University of Science and Technology