Using the GAF Docker Images

From gaframework.org
Jump to: navigation, search

Installation

Docker can be installed on any platform, however, for the GAF Images to work the platform must use an Intel processor.

Details of downloading and installing Docker for most platforms can be found https://www.docker.com/products/overview here.

The GAF Docker Image

The GAF Docker image includes working code examples for the Genetic Algorithm Framework for .Net. and is based on the official Debian image with Mono installed. The image is available from https://hub.docker.com/r/johnnewcombe/gaf/.

Running the Binary F6 Function Example in Docker

This section details how the Solving the Binary F6 Function can be run using the GAFExamples Docker image.

To download and run the docker image in interactive mode, use the command:

   docker run -it johnnewcombe/gaf bash

All GAF example binaries are stored within the image in the folder /opt/gaf and can be run from the command line using Mono, for example: to run the Binary F6 example navigate to /opt/gaf using:

   cd /opt/gaf

The example can be run by executing the the following command:

   mono Example.BinaryF6.exe

The source code for the example is located at /opt/gaf/source/BinaryF6 and can be edited using nano, for example to edit the source use:

   nano /opt/gaf/src/Example.BinaryF6/Example.BinaryF6.cs

and recompile with the Mono C# compiler with the following command:

   mcs -r:/opt/gaf/GAF.dll /opt/gaf/src/Example.BinaryF6/Example.BinaryF6.cs -out:/opt/gaf/Example.BinaryF6.exe

Running the Travelling Salesman Problem Example in Docker

This section details how the Solving the Travelling Salesman Problem example. can be run using the GAFExamples Docker image. Using the Docker image is the simplest way to run all of the GAF eaxmples.

To download and run the docker image in interactive mode, use the command:

   docker run -it johnnewcombe/gaf bash

All GAF example binaries are stored in the folder /opt/gaf and can be run from the command line using Mono, for example: to run the Travelling Salesman example navigate to /opt/gaf using:

   cd /opt/gaf

The example can be run by executing the the following command:

   mono Example.TravellingSalesman.exe

The source code for the example is located at /opt/gaf/source/TravellingSalesman and can be edited using nano, for example to edit the source use:

   nano /opt/gaf/src/Example.TravellingSalesman/Example.TravellingSalesman.cs

and recompile with the Mono C# compiler with the following command:

   mcs -r:/opt/gaf/GAF.dll /opt/gaf/src/Example.TravellingSalesman/Example.TravellingSalesman.cs /opt/gaf/src/Example.TravellingSalesman/City.cs -out:/opt/gaf/Example.TravellingSalesman.exe

See Also