GithubHelp home page GithubHelp logo

genetics4s's Introduction

Genetics4s - A Scala library for genetic algorithms

Steps to use this library

  1. Decide how you would represent the DNA of an individual. For example, for the 0/1 Knapsack Problem where you have N items, you would like to have a Boolean for each of the item, which will mean if you take that item or not. This means your DNA will be an array of Booleans. Let's call this type GeneType.

  2. Decide the domain a gene can take values from. This domain will be used in the population generation step. For the 0/1 Knapsack Problem, the domain will be Seq(true, false).

  3. Decide the length of an individual's DNA.

  4. Write a class that extends Individual[GeneType]. For the 0/1 Knapsack Problem, GeneType will be Boolean. Let's call this class Ind.

  5. Implement the def fitnessFnc: Double method in your newly created class.

  6. Instantiate a new instance of Algorithm[GeneType, Ind]. You can give it parameters for the population size, the fitness threshold for the algorithm to stop, custom strategies for selection, crossover making or mutating.

  7. Call the run method on the algorithm. You can give it parameters for the maximum number of generations to run or for the fitness threshold.

  8. Finally, you can look at all the examples provided.

TODOS

  • Write initial version
  • Publish to maven
  • Do some code cleanup / refactor
  • Provide more examples of usage
  • Provide more strategies for crossover/selection/mutation
  • WRITE TESTS!! :)

genetics4s's People

Contributors

cizuss avatar

Stargazers

Brad Pillow avatar  avatar

Watchers

James Cloos avatar  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.