Giter Site home page Giter Site logo

rmeindl / jenetics.net Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 4.0 185 KB

.Net port of Jenetics - Java Genetic Algorithm Library

Home Page: http://jenetics.io/

License: Apache License 2.0

C# 100.00%
evolutionary-algorithms genetic-algorithm optimization jenetics c-sharp dotnet artificial-intelligence

jenetics.net's Introduction

Jenetics.Net

Build Status

Jenetics.Net is a port of the popular Java Genetic Algorithm framework Jenetics to .NET Core.

Documentation

Currently the documentation is not ported, but because of the nearly identical structure, look into the Jenetics (javadoc) and the user manual (pdf).

Requirements

Build time

Build Jenetics.Net

Check out the master branch from Github.

$ git clone https://github.com/rmeindl/jenetics.net.git <builddir>

Jenetics.Net is currently not using anything thing else for building besides .Net Core projects.

Go to src/core/Jenetics for building the library

$ dotnet build

Go to src/core/Jenetics.Tests for running the xUnit Tests

$ dotnet xunit

All artifacts can be found in bin\Debug\netcoreapp2.0.

Go to src/examples/<example> for running on of the examples, e.g. src/examples/HelloWorld

$ dotnet run

If you want to publish an example including the .Net Core runtime as self-contained application, define the runtime

$ dotnet publish -r linux-x64 --self-contained

or

$ dotnet publish -r win-x64 --self-contained

All artifacts can be found in bin\Debug\netcoreapp2.0\linux-x64\publish or bin\Debug\netcoreapp2.0\win-x64\publish.

Example

Hello World (Ones counting)

The minimum evolution Engine setup needs a genotype factory, Factory<Genotype<TGene>>, and a fitness Function. The Genotype implements the Factory interface and can therefore be used as prototype for creating the initial Population and for creating new random Genotypes.

using System;
using System.Linq;
using Jenetics.Engine;

namespace Jenetics.Example
{
    public static class HelloWorld
    {
        // 2.) Definition of the fitness function.
        private static int Eval(Genotype<BitGene> gt)
        {
            return gt.GetChromosome().As<BitChromosome>().BitCount();
        }

        public static void Main()
        {
            // 1.) Define the genotype (factory) suitable
            //     for the problem.
            Genotype<BitGene> F()
            {
                return Genotype.Of(BitChromosome.Of(10, 0.5));
            }

            // 3.) Create the execution environment.
            var engine = Engine.Engine.Builder(Eval, F).Build();

            // 4.) Start the execution (evolution) and
            //     collect the result.
            var result = engine.Stream().Take(100).ToBestGenotype();

            Console.WriteLine("Hello World:\n" + result);
        }
    }
}

License

The library is licensed under the Apache License, Version 2.0.

Copyright 2007-2017 Franz Wilhelmstötter

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Release notes

All Release Notes

jenetics.net's People

Contributors

rmeindl avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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