Skip to content

Demonstrates a comparison between a Genetic Algorithm (GA) and a Brute Force method.

License

Notifications You must be signed in to change notification settings

SimonNyvall/Traveling-Salesman-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Genetic Algorithm vs Brute Force Comparison C++ Build Workflow

Project overview

This project, developed as part of my gymnasium (high school) studies, demonstrates a comparison between a Genetic Algorithm (GA) and a Brute Force method. The primary aim is to analyze and compare the efficiency and effectiveness of these two approaches in solving optimization problems, such as the Traveling Salesman Problem.

Features

  • Implementation of a Genetic Algorithm for optimization.
  • Brute Force approach for comparison.
  • Performance analysis between the two methods.
  • Use of high-resolution timer for accurate performance measurement.

Requirements

  • C++ Compiler (e.g., GCC, Clang, MSVC)
  • C++ Standard: C++11 or later (due to usage of and other features)

Installation

Clone the repository to your local machine:

git clone https://github.com/SimonNyvall/Traveling-Salesman-AI.git

Usage

Compile the C++ file using your preferred C++ compiler. For example, using g++:

g++ -o ga_comparison AI/SalemanAI.cpp

Run the compiled program:

./ga_comparison

Implementation Details

  • Genetic Algorithm: The GA is implemented to optimize the solution by evolving over generations.
  • Brute Force Method: A straightforward approach is implemented for comparison.
  • Timer Class: Used for measuring the execution time of both methods.
  • Population and City Initialization: Sets up the initial state for the GA.
  • Mutation and Fitness Calculation: Core components of the GA for evolving solutions.

About

Demonstrates a comparison between a Genetic Algorithm (GA) and a Brute Force method.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages