All Projects → softwaremill → helisa

softwaremill / helisa

Licence: Apache-2.0 license
Scala API for jenetics

Programming Languages

scala
5932 projects
HTML
75241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to helisa

vita
Vita - Genetic Programming Framework
Stars: ✭ 24 (+4.35%)
Mutual labels:  genetic-programming, genetic-algorithms
FEDOT
Automated modeling and machine learning framework FEDOT
Stars: ✭ 312 (+1256.52%)
Mutual labels:  genetic-programming
opinionMining
Opinion Mining/Sentiment Analysis Classifier using Genetic Programming
Stars: ✭ 13 (-43.48%)
Mutual labels:  genetic-programming
geppy
A framework for gene expression programming (an evolutionary algorithm) in Python
Stars: ✭ 124 (+439.13%)
Mutual labels:  genetic-programming
ptreeopt
Policy tree optimization: Heuristic policy search for control of dynamic systems. Uses genetic programming to develop binary trees relating observed indicator variables to actions, either real-valued or discrete.
Stars: ✭ 30 (+30.43%)
Mutual labels:  genetic-programming
Pac-Man
Evolutionary Pac-Man bots using Grammatical Evolution and Multi-objective Optimization. Cool GUI included (Undergraduate Thesis)
Stars: ✭ 50 (+117.39%)
Mutual labels:  genetic-programming
MAP-Elites
Python implementation of the genetic algorithm MAP-Elites with applications in constrained optimization
Stars: ✭ 38 (+65.22%)
Mutual labels:  genetic-programming
moses
MOSES Machine Learning: Meta-Optimizing Semantic Evolutionary Search. See also AS-MOSES https://github.com/opencog/asmoses but kept to guaranty backward compatibility.
Stars: ✭ 127 (+452.17%)
Mutual labels:  genetic-programming
Recipe
Automated machine learning (AutoML) with grammar-based genetic programming
Stars: ✭ 42 (+82.61%)
Mutual labels:  genetic-programming
LGP
A robust Linear Genetic Programming implementation on the JVM using Kotlin.
Stars: ✭ 14 (-39.13%)
Mutual labels:  genetic-programming
geneal
A genetic algorithm implementation in python
Stars: ✭ 47 (+104.35%)
Mutual labels:  genetic-programming
arja
Multi-Objective GP for Automated Repair of Java
Stars: ✭ 31 (+34.78%)
Mutual labels:  genetic-programming
cartesian
a lightweight implementation of Cartesian genetic programming with symbolic regression in mind.
Stars: ✭ 21 (-8.7%)
Mutual labels:  genetic-programming
binlex
A Binary Genetic Traits Lexer Framework
Stars: ✭ 303 (+1217.39%)
Mutual labels:  genetic-programming
Optimized-MDVRP
"Using Genetic Algorithms for Multi-depot Vehicle Routing" paper implementation.
Stars: ✭ 30 (+30.43%)
Mutual labels:  genetic-algorithms
EvolutionaryForest
An open source python library for automated feature engineering based on Genetic Programming
Stars: ✭ 56 (+143.48%)
Mutual labels:  genetic-programming
GeneticAlgorithmForFeatureSelection
Search the best feature subset for you classification mode
Stars: ✭ 82 (+256.52%)
Mutual labels:  genetic-programming
ruck
🧬 Modularised Evolutionary Algorithms For Python with Optional JIT and Multiprocessing (Ray) support. Inspired by PyTorch Lightning
Stars: ✭ 50 (+117.39%)
Mutual labels:  genetic-algorithms
SimpleGP
Simple Genetic Programming for Symbolic Regression in Python3
Stars: ✭ 20 (-13.04%)
Mutual labels:  genetic-programming
tiny gp
Tiny Genetic Programming in Python
Stars: ✭ 58 (+152.17%)
Mutual labels:  genetic-programming

Helisa

Latest 2.12 version

What is it?

Helisa (HEL-EE-SAH) is a Scala frontend for solving problems with genetic algorithms and genetic programming.

It’s pretty much a Scala wrapper around the excellent jenetics library [1].

How to use it

Obtaining

helisa is available on Maven central through:

"com.softwaremill" %% "helisa" % "0.8.0"

Currently only Scala 2.12 is supported.

Basic usage

The two things that are absolutely required are:

  1. A genotype, i.e. a representation of possible solutions to the problem,

  2. a fitness function, that scores the solutions generated from the genotypes.

Using an example for guessing a number between 0 and a 100, you would have:

import com.softwaremill.helisa._

case class Guess(num: Int) (1)

val genotype =
  () => genotypes.uniform(chromosomes.int(0, 100)) (2)
def fitness(toGuess: Int) =
  (guess: Guess) => 1.0 / (guess.num - toGuess).abs (3)
  1. The representation of a solution to the problem (the phenotype)

  2. A producer of genotypes.

  3. The fitness function - the closer to the target number, the higher the fitness score.

We use the code above to set up the Evolver, which encapsulates all configuration and generates fresh population streams:

val evolver =
  Evolver(fitness(Number), genotype) (1)
    .populationSize(100) (2)
    .build()

val stream = evolver.streamScalaStdLib() (3)

val best = stream.drop(1000).head.bestPhenotype (4)

println(best)
// Some(Guess(42))
  1. Initialize the Evolver with our genotype and fitness function.

  2. Set the population size.

  3. Obtain a Stream population stream (see Integrating for more information)

  4. Advance the stream and obtain the highest-scored phenotype.

Validation

You can additionally restrict the solution space by adding a phenotype validator:

val evolver =
  Evolver(fitness(Number), genotype)
    .populationSize(100)
    .phenotypeValidator(_.num % 2 == 0) (1)
    .build()
  1. We know the number is even, so we’re restricting possible solutions to only those numbers.

Operators

As a reminder, the three main elements of evolution in genetic algorithms are:

  • the selection of fittest individuals (phenotypes),

  • the recombination of selected individuals to form new individuals in the next generation of the population,

  • the mutation of the new/remaining individuals.

Selection

Standard selectors are available from helisa.selectors, you use them like this:

import com.softwaremill.helisa._

val evolver =
  Evolver(fitnessFunction, genotype)
   .offspringSelector(selectors.x) (1)
   .survivorsSelector(selectors.y) (2)
    .build()
  1. Affect just the survivors.

  2. Affects both the survivors and offspring.

You can also add a custom selector by passing the appropriate function to the survivorSelectorAsFunction or offspringSelectorAsFunction method.

Recombination and mutation

Recombination and mutation is handled are both generalized to operators, available in helisa.operators . You use them as follows:

import com.softwaremill.helisa._

val evolver =
  Evolver(fitnessFunction, genotype)
   .geneticOperators(operators.crossover.x, (1)
   operators.mutation.y) (2)
    .build()
  1. Recombination operators.

  2. Mutation operators.

You can also add a custom operator by passing the appropriate function to the geneticOperatorsAsFunctions method.

Other configuration

See the doc of EvolverBuilder for all Evolver configuration options.

Integrating

Integrations for:

  • scala.collection.Iterator

  • scala.collection.Stream

  • Akka Stream Source

  • FS2 Stream for any Async

  • Reactive Streams Publisher

In addition:

  • Monix is not supported directly, but can be taken advantage with using the other integrations,

  • Spark integration is coming up.

Genetic programming

TBD

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].