Giter Site home page Giter Site logo

fitness's Introduction

Fitness

Fitness is a Common Lisp genetic programming framework.

Usage

evolve is the central function that initiates and runs the evolution process. It returns the final generation along with the fitness, as the output.

  Mandatory arguments -
  
  primitives - Primitive functions to be used (eg., if, and, or and not).
  actions - User defined functions that operate on the user-defined world.
  conditionals - User defined 'sensors' that operate on the user-defined world.
  args - A raw list of the arguments that the 'action' functions can take.
  fargs - An evaluted list of arguments that the 'action' functions can take.
  fitness-function - The fitness function that takes a set of results and returns a fitness.
  fitness-p - Predicate function that determines if a fitness has reached 'success' state.
  max-tree-depth - Maximum allowed depth of program trees that need to be generated.
  
  Optional arguments -
  
  max-run-count - Maximum number of evolutions to be run.
  max-tree-depth - Maximum depth of program trees generated. Default 5.
  member-count - Number of programs in each generation. Default 1000.
  repeat-var - Number of evaluations needed on each program. Default 60.
  copy-percentage - Percentage of programs to evolve by direct copying.
  crossover-percentage - Percentage of programs to evolve by crossing over.
  program-count - Number of programs to be selected on each round of tournament selection.

All these parameters are defined in wall-follower.lisp, so evolve can simply be run as follows:

> (load "wall-follower.lisp")
> (load "fitness.lisp")
> (evolve primitives actions conditionals args fargs #'fitness-function #'fitness-p)
((OR
  (IF
   (OR
    (IF (E-SENSOR GRID-WORLD CURRENT-CELL) (SW-SENSOR GRID-WORLD CURRENT-CELL)
     (OR (NE-SENSOR GRID-WORLD CURRENT-CELL) (N-SENSOR GRID-WORLD CURRENT-CELL)))
    (NE-SENSOR GRID-WORLD CURRENT-CELL))
   (E GRID-WORLD CURRENT-CELL)
   (AND (SE-SENSOR GRID-WORLD CURRENT-CELL)
    (OR (SE-SENSOR GRID-WORLD CURRENT-CELL)
     (AND (W-SENSOR GRID-WORLD CURRENT-CELL) (N-SENSOR GRID-WORLD CURRENT-CELL)))))
  (N GRID-WORLD CURRENT-CELL))
 . 35)
 > (evolve primitives actions conditionals args fargs #'fitness-function #'fitness-p)
((IF
  (OR
   (OR (NE-SENSOR GRID-WORLD CURRENT-CELL)
    (AND (AND (E-SENSOR GRID-WORLD CURRENT-CELL) (SE-SENSOR GRID-WORLD CURRENT-CELL)) (N GRID-WORLD CURRENT-CELL)))
   (S-SENSOR GRID-WORLD CURRENT-CELL))
  (W GRID-WORLD CURRENT-CELL) (S GRID-WORLD CURRENT-CELL))
 . 44)

fitness's People

Contributors

pranavrc 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.