Skip to main content

Python version of the ParadisEO framework for metaheuristic optimization

Project description

pipeline status

For the documentation of PyParadiseo see this.

This README only gives a very short introduction.

Table of Contents

Installation

The easiest way to get pyparadiseo is to install it via pip. Currently the following Python versions are supported: 3.6, 3.7, 3.8, 3.9, 3.10

1) Recommended : install with pip

You can install pyParadiseo with pip

    pip install pyparadiseo

2) Build from source

To build pyParadiseo, you'll need to have a few prerequisites installed on your system and set the corresponding paths in setup.py and CMakeLists.txt

To compile the binary extension you need:

  • cmake >= 3.14
  • python3 >= 3.6
  • boost-python
  • boost-numpy

If you want to build pyparadiseo from source, the easiest should be to use this manylinux2014_x86_64 Docker image with installed prerequisites.

Getting Started

The documentation of PyParadiseo is available here

Example of running EO's simple GA (SGA) for the One-Max test problem

from pyparadiseo import config

# problem dependent
from pyparadiseo import population
from pyparadiseo import initializer
from pyparadiseo import evaluator
from pyparadiseo import operator

from pyparadiseo.eo import algo,select_one,continuator

DIM=20
POP_SIZE=25
MAX_GEN=100

if __name__ == "__main__":
    #set global solution type 'bin'
    config.set_solution_type('bin')

    #make pyparadiseo evaluator from python function
    eval = evaluator.fitness(lambda sol: sum(sol))

    #generate and evaluate population
    pop=population.from_init(POP_SIZE,initializer.random(DIM))
    evaluator.pop_eval_from_fitness(eval)(pop,pop)

    #assemble simple GA
    sga = algo.simpleGA(
        select_one.det_tournament(4),
        operator.OnePtBitCrossover(),.1,
        operator.DetBitFlip(),.7,
        eval,
        continuator.max_generations(MAX_GEN)
    )
    # #run algo on pop and print best individual
    sga(pop)
    print(pop.best())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pyparadiseo-0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pyparadiseo-0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pyparadiseo-0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.8 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pyparadiseo-0.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pyparadiseo-0.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.7 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page