GithubHelp home page GithubHelp logo

johnphilipp / hsg-was-ss23-exercise-7 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from scraylex/was-exercise-7

0.0 0.0 0.0 9.25 MB

Everything required for exercise 7 in the FS23 Web-based Autonomous Systems course

Python 100.00%

hsg-was-ss23-exercise-7's Introduction

Exercise 7: Stigmergic interaction for Smart Colony Optimization

This repository contains a partial implementation of an Ant System algorithm [1] for solving the att48 Travelling Salesman Problem instance.

[1] Dorigo, M., & Stützle, T. (2004). Ant colony optimization. The MIT Press.

Table of Contents

Project structure

├── ant-colony.py # the ant colony that behaves base on the Ant System algorithm
├── ant.py # an artificial ant of the ant colony
├── environment.py # the environment of the ant colony
└── att48-specs # specification of the att48 TSP
    ├── att48.tsp # the specification of the TSP instance
    ├── att48.opt.tour # the optimal solution to the TSP instance
    ├── att48.opt.png
    ├── att48_coordinates.txt
    └── att48_distance_matrix.txt

How to run the project

You can run the script ant-colony.py with Python 3:

python3 ant-colony.py

Task 1

Task 1.1

Complete the implementation of environment.py:

  • the constrcutor of the class Environment so that the environment is initialized based on the topology of the att48 TSP instance;
  • the function initialize_pheromone_map() for initializing the pheromone trails in the environment based on the Ant System algorithm.
    • HINT: The 3rd-party Python library tsplib95 enables parsing files of the TSPLIB library (e.g. TSP problem and solution files).

Task 1.2

Complete the implementation of environment.py:

  • the function update_pheromone_map() for updating the pheromone trails in the environment after each cycle based on the Ant System algorithm.

Task 2

Task 2.1

Complete the implementation of ant.py:

  • the function get_distance() for enabling an ant to compute the pseudo-euclidean distance between two cities in the environment;
  • the function select_path() for enabling an ant to select the next path to follow based on the Ant System algorithm.
    • HINT: The specification of the pseudo-euclidean distance algorithm is available in the TSPLIB95 documentation.

Task 2.2

Complete the implementation of ant.py:

  • the function run() for enabling an ant to select and visit locations until it has visited all possible locations of its environment based on the Ant System algorithm.

Task 2.3

Complete the implementation of ant-colony.py:

  • the function solve() for producing a solution for the att48 TSP instance based on the Ant System algorithm.

hsg-was-ss23-exercise-7's People

Contributors

johnphilipp avatar danaivach avatar

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.