Artificial-Intelligence-aka-Uniwa/Genetic-Algorithms
Artificial Intelligence project implementing a real-valued Genetic Algorithm in C to solve combinatorial optimization problems, featuring roulette-wheel selection, crossover, mutation, and fitness evaluation (Artificial Intelligence, UNIWA).
UNIVERSITY OF WEST ATTICA
SCHOOL OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING AND INFORMATICS
University of West Attica · Department of Computer Engineering and Informatics
Artificial Intelligence
Real Genetic Algorithm Application
Vasileios Evangelos Athanasiou
Student ID: 19390005
Supervision
Supervisor: Paris Mastorokostas, Professor
Co-supervisor: Panagiota Tselenti, Laboratory Teaching Staff
Athens, January 2023
README
Real Genetic Algorithm Application
This repository contains a Genetic Algorithm (GA) implementation in C for solving combinatorial optimization problems involving settlements in Halkidiki.
The program simulates the GA process across a specified number of generations, using:
- Population Initialization
- Selection (Roulette Wheel / Proportional)
- Crossover (Single-Point)
- Mutation (Random within bounds)
- Fitness Evaluation (Euclidean Distance to points)
Two problem cases are provided:
- 25 settlements (
Halkidiki_25.txt) - 12 settlements (
Halkidiki_12.txt)
The results include best solutions, fitness values, and performance metrics over multiple experiments.
Table of Contents
| Section | Folder | Description |
|---|---|---|
| 1 | assign/ |
Assignment material for the Artificial Intelligence course |
| 1.1 | assign/Assignment_2_AI.pdf |
Assignment description in English |
| 1.2 | assign/Εργασία_2_ΤΝ.pdf |
Assignment description in Greek |
| 2 | docs/ |
Project documentation for genetic algorithms |
| 2.1 | docs/Genetic-Algorithms.pdf |
English documentation covering genetic algorithms |
| 2.2 | docs/Γενετικοί-Αλγόριθμοι.pdf |
Greek documentation covering genetic algorithms |
| 3 | res/ |
Execution results and outputs |
| 3.1 | res/results_12.txt |
Results for parameter set 12 |
| 3.2 | res/results_25.txt |
Results for parameter set 25 |
| 4 | src/ |
Source code and input files |
| 4.1 | src/Halkidiki_12.txt |
Input data for parameter set 12 |
| 4.2 | src/Halkidiki_25.txt |
Input data for parameter set 25 |
| 4.3 | src/project_GA_new.c |
Main C implementation of the genetic algorithm |
| 4.4 | src/simpleGA_new.c |
Supporting C code for genetic algorithm |
| 4.5 | src/simpleGA_new.h |
Header file for supporting functions |
| 4.6 | src/Project1.dev |
Development or IDE project file |
| 5 | README.md |
Repository overview |
| 6 | INSTALL.md |
Usage instructions |
1. Contents
-
The World of the Problem
Defines coordinates of settlements and problem objectives. -
The Genetic Algorithm in Application for 25 Settlements
GA parameterization and initial population setup. -
The Final State of the Problem for 25 Settlements
Best solutions and corresponding fitness after GA convergence. -
Commenting on the Genetic Algorithm Solutions
Analysis of solution quality and convergence behavior. -
Show Paradoxical Solutions?
Discussion of unexpected or non-intuitive GA outcomes. -
The Genetic Algorithm in Application for 12 Settlements
Implementation for a smaller problem instance. -
The Final State of the Problem for 12 Settlements
GA results and performance metrics for 12 settlements. -
Differences in the Solutions of the Two Problems
Comparative analysis highlighting insights between problem sizes.
2. Technologies Used
- Programming Language: C
- Algorithm: Genetic Algorithm (SGA)
- Key Concepts:
- Population Initialization
- Fitness Evaluation (Euclidean distance)
- Selection (Roulette Wheel)
- Single-Point Crossover
- Random Mutation
- Data Files:
Halkidiki_12.txt– Coordinates for 12 settlementsHalkidiki_25.txt– Coordinates for 25 settlements
- Platform: Cross-platform C compiler (GCC recommended)
- Output: Log file (
results_12.txtorresults_25.txt) for analysis

