Giter VIP home page Giter VIP logo

goodenoughalgs's Introduction

Good Enough Algorithms

Evolutionary algorithms and other heuristic optimizers

This is code associated with talks, workshops, and a blog post I have written about heuristic optimization algorithms. This repository contains the code needed to run four algorithms -- a hill climber, simulated annealing, Metropolis-coupled MCMC, and a genetic algorithm -- to find good solutions to the travelling salesperson problem. The code is written in a modular way that is meant to make it easy to adapt to other optimization problems. This code is written in Python3; for a Python2 implementation, see this repository.

An overview of the directory:

  • InitMutFit.py contains functions to initialize, mutate, select, and calculate fitness for solutions.
  • HC.py, SA.py, MCMCMC.py, and GA.py contain implementations of a hill climber, simulated annealing, MCMCMC, and a genetic algorithm, respectively.
  • TravelingSalesperson.py is a wrapper for all of the specific implementations of the problem. This is a fairly generic wrapper that can be fitted to different optimization problems.
  • TSPcommandline.py is a command line wrapper for TravelingSalesperson.py.
  • Visualizations.py provides some functions to display how the different algorithms performed. All .txt files in the ExampleOutput folder can be used in these visualizations.

This code requires the following modules:

  • copy
  • math
  • os
  • pylab
  • random
  • scipy
  • sys

If you run into any problems, please submit an issue!

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.