Skip to content

Ant colony optimization workshop for solving a travelling salesman problem

License

Notifications You must be signed in to change notification settings

mgrechanik/aco-workshop-for-tsp

Repository files navigation

Ant colony optimization workshop for solving a travelling salesman problem

Русская версия

Table of contents


Introdution

This workshop gives you a web-application with user interface to work with this ACO library.

All details about aco algorithm you can find in the docs of that library.

The information about graph comes from an image file.

You can set all settings and parameters used by aco algorithm and see the result of the calculation.

This application is intended to be run locally, on user's PC.


Demo

Video demo

Ant colony optimization workshop


Installing ang running on Docker

If you are using Docker in your work then the application is ready to be run with it.

Download app's files with a Git

git clone git@github.com:mgrechanik/aco-workshop-for-tsp.git

If you do not have Git, download files from Code --> Dowload Zip at this github page and unzip it.

Go to the directory with the application

cd aco-workshop-for-tsp

You need to set rigts, you need to do it one-time.

chmod -R o+w ./web/uploads

That is all, application is ready to be launched, so do it with this command:

docker compose up -d

And by opening address http://localhost:8000 in your web browser you will see the main page of the application.

When you decide to stop working, just run

docker compose down

Installing ang running on OpenServer

If you are not familiar with Docker, you can run it on any webserver with PHP (version >= 8.0 ) and Composer. Because the application is just a PHP app on Yii2 framework.

For example, I will show you how to install and run it on OpenServer

  1. Download and install OpenServer, I have it installed in D:\OpenServer

  2. In the directory D:\OpenServer\domains create new directory, say aco.front.

  3. Download application files from Code --> Dowload Zip at this github page and unzip it. Your directory D:\OpenServer\domains\aco.front should look like:

assets
commands
config
...
  1. Now you need to set a couple of things. The steps are demonstrated on the next image. installing on OpenServer

  2. Go to Settings

  3. At modules tab you set PHP version to 8.0 or higher.

  4. At the domains tab you set new name to aco.front, and it's directory to - aco.front/web , click "Add" button.

  5. We get our domain in the list like on the image and click "Save"

  6. Go to PHP settings

  7. Set the work timeout from 30 (seconds) to 300 for example

  8. Lanch a web server

  9. Go to console

  10. Run two commands in it

cd domains\aco.front

composer install
  1. That is all, application is ready to be used, just go to the next address in your web browser:

http://aco.front/


Tips

How to create an image with a graph

There are two types of strategies how we find nodes of a graph on an image.

The first strategy is this: the color of nodes are different from background color (color of the top left pixel). Take a brush in your image editor with 10px (so they are clearly seen) diameter and draw nodes.

The second strategy is when you know the exact color, in RGB format, which is present on the node. It is handy when you have some others image and draw you nodes on it.

This application comes with two example images who represent each type.