GithubHelp home page GithubHelp logo

gaopt's Introduction

GAopt

A python package for genetic algorithm with parallel processing implemented

The package has the ability for parallel processing and resuming.

example of implementation

import numpy as np
from GAopt import GA
def objective(X):
    X1 = X[0]
    X2 = X[1]
    X3 = X[2]
    X4 = X[3]
    return (X1+X2)/(X3+X4+0.5)

varbound=np.array([[1,3],[1,4],[0.5,1.5],[2,20],])
vartype=np.array([['int'],['int'],['real'],['int'],])

parameters = {'max_num_iteration': None,
              'population_size': 400,
              'mutation_probability':0.1,
              'elit_ratio': 0.1,
              'crossover_probability': 0.5,
              'parents_portion': 0.3,
              'crossover_type':'uniform',
              'max_iteration_without_improv':None,
              'Number_of_processes':'max',
              'Population_file_path': "pop.csv"}

Genetic = GA(objective,4,
             variable_type_mixed=vartype, 
             variable_boundaries=varbound, 
             function_timeout=5000, 
             algorithm_parameters=parameters)

# this line is to run the code for the first time
Genetic.run()

# this line is to resume an already existing run
Genetic.resume("old_pop.csv")

gaopt's People

Contributors

omarzaki96 avatar

Stargazers

xuhao0521 avatar Junhao Zheng avatar Gasser Galal Ali avatar A-Maged avatar

Watchers

 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.