GithubHelp home page GithubHelp logo

tonykero / moe Goto Github PK

View Code? Open in Web Editor NEW
34.0 6.0 4.0 190 KB

[OLD] Moe is a C++14 header-only dependency-free library providing generic implementations of some metaheuristic algorithms

License: MIT License

CMake 4.50% C++ 95.50%
c-plus-plus genetic-algorithm fitness-score optimization metaheuristic evolutionary-algorithm library machine-learning generic c-plus-plus-14

moe's Introduction

Moe

license

GCC / Clang (Linux) VS 14/15 (Win 32/64) Coverage (g++5)
Travis branch AppVeyor branch Codecov branch

Moe is a C++14 header-only dependency-free library providing generic implementations of some metaheuristic algorithms

Quick Overview

The main goal of Moe is to provide a generic and easy way to implement fast solving systems from any complexity with C++.

Moe stands for Maybe Overpowered Entity, but isn't limited to it.

Moe gives a way for the user to completely define the behavior of algorithms, all parameters are adjustable, and the structure allows to easily add features or custom Mutations/Crossover/Algorithms.

Take a look at a base sample using Moe (examples/square_root.cpp):

This example illustrates how Differential Evolution can be used to search for the square root of a number (in this case 2261953600), the known answer is 47560.

#include <moe/moe.hpp>
#include <iostream>
#include <string>

int main()
{
    DifferentialEvolution<int> moether(20);

    long long n = 2261953600;

    moether.setFitnessFunction( [n](auto moe) -> double
    {
        long long genotype = moe.genotype[0];
                
        double error = std::abs(n - genotype*genotype);

        return 1/(error+1);
    });

    moether.run( 50 );  // run 50 generations

    long long genotype = moether.getBestMoe().genotype[0];

    std::cout   << "genotype: "     << genotype << "\n"
                << "fitness: "      << moether.getBestMoe().fitness << std::endl;
}

Examples

Examples can be found here

Features

Moe contains the following features:

  • Algorithms:

    • Genetic Algorithm
      • Crossovers:
        • One Point
        • Two Point
        • Uniform
      • Mutations:
        • Substitution
        • Insertion
        • Deletion
        • Translocation
    • Differential Evolution
    • Particle Swarm Optimization
      • Abstract Classes
  • Planned:

    • Performance:
      • Parallel Implementation
    • Better Parameters handling
      • Serialization

How To Use

Add the "include" folder to your include paths and write

#include <moe/moe.hpp>

and you're ready to go !

Building

Moe uses CMake, options are available:

Options Description Default Value
BUILD_EXAMPLES Builds Examples ON
BUILD_TESTS Builds Catch Unit Tests OFF
DEBUG Enables debugging symbols OFF

Moe is successfully tested against:

  • GCC:
    • 5 (5.4.1)
    • 6 (6.2)
    • MinGW:
      • GCC 5.3
  • Clang:
    • 3.6 (3.6.2)
    • 3.7 (3.7.1)
    • 3.8 (3.8.0)
    • 3.9 (3.9.1)
  • MSVC:
    • Visual Studio 14 2015
    • Visual Studio 15 2017

Moe does not compile anymore on GCC 4.9

Compiling:

The following clone Moe and generates with CMake

git clone https://github.com/tonykero/Moe.git
cd Moe
mkdir build && cd build && cmake ..

then under linux

make

or

cmake --build .

or (if with MSVC, and -DDEBUG=1 was not specified)

cmake --build . --config Release

Contributing

Please read Contributing

License

The MIT License

Note: 'tests' folder contains catch.hpp which comes from https://github.com/philsquared/Catch and is licensed under the Boost Software License terms.

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.