Skip to content

Commit

Permalink
VERSION 0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Blank committed Oct 21, 2019
1 parent 3d25b16 commit 373bd57
Show file tree
Hide file tree
Showing 102 changed files with 4,105 additions and 422 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ However, for instance executing NSGA2:
problem = get_problem("zdt2")
algorithm = NSGA2(pop_size=100, elimate_duplicates=True)
algorithm = NSGA2(pop_size=100, eliminate_duplicates=True)
res = minimize(problem,
algorithm,
Expand Down
11 changes: 5 additions & 6 deletions benchmark/benchmark_nelder_mead.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import os
import pickle

from pymoo.algorithms.so_genetic_algorithm import ga
from pymoo.algorithms.so_nelder_mead import nelder_mead
from pymoo.factory import get_problem, get_termination
from pymoo.operators.crossover.nelder_mead_crossover import NelderMeadCrossover
from pymoo.algorithms.so_nelder_mead import NelderMead

from pymoo.factory import get_problem

setup = [
"go-amgm",
Expand Down Expand Up @@ -222,7 +221,7 @@ def add_with_variables(D, problem, n_vars):
prefix = "runs"

# name of the experiment
name = "nelder-mead-0.3.1"
name = "nelder-mead-0.3.2"

# number of runs to execute
n_runs = 10
Expand All @@ -234,7 +233,7 @@ def add_with_variables(D, problem, n_vars):

problem = get_problem(_problem)

method = nelder_mead(n_max_restarts=100)
method = NelderMead(n_max_local_restarts=2)

for run in range(1, n_runs + 1):
fname = "%s_%s.run" % (_problem, run)
Expand Down
7 changes: 4 additions & 3 deletions benchmark/benchmark_nsga2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import os
import pickle

from pymoo.algorithms.nsga2 import nsga2
from pymoo.algorithms.nsga2 import NSGA2

from pymoo.factory import get_sampling, get_crossover, get_mutation, get_problem
from pymoo.operators.crossover.simulated_binary_crossover import SimulatedBinaryCrossover
from pymoo.operators.mutation.polynomial_mutation import PolynomialMutation
Expand Down Expand Up @@ -90,7 +91,7 @@
prefix = "runs"

# name of the experiment
name = "pynsga2-0.3.1"
name = "pynsga2-0.3.2"

# number of runs to execute
n_runs = 100
Expand All @@ -107,7 +108,7 @@
s = setup[_problem]
problem = s['problem']

method = nsga2(
method = NSGA2(
pop_size=s['pop_size'],
crossover=s['crossover'],
mutation=s['mutation'],
Expand Down
6 changes: 3 additions & 3 deletions benchmark/benchmark_nsga3.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import pickle

from pymoo.algorithms.nsga3 import nsga3
from pymoo.algorithms.nsga3 import NSGA3
from pymoo.factory import get_problem, get_reference_directions
from pymoo.operators.crossover.simulated_binary_crossover import SimulatedBinaryCrossover
from pymoo.operators.mutation.polynomial_mutation import PolynomialMutation
Expand Down Expand Up @@ -206,7 +206,7 @@ def get_setup(n_obj):
prefix = "runs"

# name of the experiment
name = "pynsga3-0.3.1"
name = "pynsga3-0.3.2"

# number of runs to execute
n_runs = 50
Expand All @@ -222,7 +222,7 @@ def get_setup(n_obj):
s = setup[_problem]
problem = s['problem']

method = nsga3(
method = NSGA3(
s['ref_dirs'],
pop_size=s['pop_size'],
crossover=s['crossover'],
Expand Down
17 changes: 8 additions & 9 deletions doc/source/_theme/custom_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css">
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">

{%- for cssfile in css_files %}
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css">
{%- endfor %}



<!--
---------------------------------------
JavaScript
Expand All @@ -59,18 +59,17 @@

<script type="text/javascript" src="{{ pathto('_static/js/custom.js', 1) }}"></script>
{%- for scriptfile in script_files %}
{% if pathto(scriptfile, 1) %}
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
{%endif %}
{%- endfor %}

{%- if favicon %}
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}">
{%- endif %}

<link rel="icon" type="image/png" href="{{ pathto('_static/img/favicon.ico', 1) }}">

<meta charset="{{ encoding }}">
{{ metatags }}



<title>pymoo</title>


Expand All @@ -91,7 +90,7 @@
<div class="container">
<div class="top-scipy-org-logo-header">
<a href="{{ pathto('index') }}">
<img style="border: 0;" alt="pymoo" src="{{ pathto('_static/img/pymoo.svg', 1) }}"></a>
<img style="border: 0;" alt="pymoo" src="{{ pathto('_static/img/pymoo.jpg', 1) }}"></a>
</div>
</div>
{% endblock %}
Expand Down Expand Up @@ -148,7 +147,7 @@
{%- block document %}
<div class="bodywrapper">
<div class="body" id="spc-section-body">
{% block body %}
{% block body %}
{% endblock %}
</div>
</div>
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions doc/source/algorithms/differential_evolution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@
"output_type": "stream",
"text": [
"Best solution found: \n",
"X = [-0.00055292 -0.00016638 -0.00024617 0.00021267 -0.0003819 -0.00024424\n",
" -0.0004285 0.00022352 -0.00025735 0.00014052]\n",
"F = [0.00124724]\n"
"X = [-1.72696533e-05 4.11624478e-06 7.02351801e-06 6.20937154e-05\n",
" 7.70382670e-05 -2.80596809e-05 -4.42434414e-06 -5.74272367e-06\n",
" -1.24745030e-06 -4.59264431e-05]\n",
"F = [0.00014488]\n"
]
}
],
Expand All @@ -92,8 +93,8 @@
"\n",
"res = minimize(problem,\n",
" algorithm,\n",
" termination=('n_gen', 250),\n",
" seed=1)\n",
" seed=1,\n",
" verbose=False)\n",
"\n",
"print(\"Best solution found: \\nX = %s\\nF = %s\" % (res.X, res.F))"
]
Expand Down
9 changes: 5 additions & 4 deletions doc/source/algorithms/genetic_algorithm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
"output_type": "stream",
"text": [
"Best solution found: \n",
"X = [0.99303414 0.99782661 0.99754116 0.99912976 0.99483 0.99544777\n",
" 0.98882008 0.97191879 0.9899395 2.9192581 2.80936782 2.33122498\n",
" 0.9894118 ]\n",
"F = [-13.92817742]\n"
"X = [0.99846487 0.99896452 0.99227818 0.98115003 0.97598486 0.93133579\n",
" 0.9989595 0.99283295 0.93527323 2.74333764 2.73101357 2.83238454\n",
" 0.99763872]\n",
"F = [-13.99514066]\n"
]
}
],
Expand All @@ -86,6 +86,7 @@
"res = minimize(problem,\n",
" algorithm,\n",
" termination=('n_gen', 50),\n",
" seed=1,\n",
" verbose=False)\n",
"\n",
"print(\"Best solution found: \\nX = %s\\nF = %s\" % (res.X, res.F))\n",
Expand Down
30 changes: 15 additions & 15 deletions doc/source/algorithms/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"\n",
" differential_evolution\n",
" genetic_algorithm\n",
" nelder_mead\n",
" nsga2\n",
" rnsga2\n",
" nsga3\n",
Expand All @@ -42,25 +43,24 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"|Name|Convenience|\n",
"|---|---|\n",
"|[Differential Evolution](differential_evolution.ipynb)|\"de\"|\n",
"|[Genetic Algorithm](genetic_algorithm.ipynb)|\"ga\"|\n",
"|[NSGA-II](nsga2.ipynb)|\"nsga2\"|\n",
"|[RNSGA-II](rnsga2.ipynb)|\"rnsga2\"|\n",
"|[NSGA-III](nsga3.ipynb)|\"nsga3\"|\n",
"|[UNSGA-III](unsga3.ipynb)|\"unsga3\"|\n",
"|[RNSGA-III](rnsga3.ipynb)|\"rnsga3\"|\n",
"|[MOEA/D](moead.ipynb)|\"moead\"|\n"
"|Name|Class|Convenience|\n",
"|---|---|---|\n",
"|[Differential Evolution](differential_evolution.ipynb)|\"DE\"|\"de\"\n",
"|[Genetic Algorithm](genetic_algorithm.ipynb)|\"GA\"|\"ga\"\n",
"|[Nelder Mead](nelder_mead.ipynb)|\"NelderMead\"|\"nelder-mead\"\n",
"|[NSGA-II](nsga2.ipynb)|\"NSGA2\"|\"nsga2\"\n",
"|[RNSGA-II](rnsga2.ipynb)|\"RNSGA2\"|\"rnsga2\"\n",
"|[NSGA-III](nsga3.ipynb)|\"NSGA3\"|\"nsga3\"\n",
"|[UNSGA-III](unsga3.ipynb)|\"UNSGA3\"|\"unsga3\"\n",
"|[RNSGA-III](rnsga3.ipynb)|\"RNSGA3\"|\"rnsga3\"\n",
"|[MOEA/D](moead.ipynb)|\"MOEAD\"|\"moead\"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Each of them is implemented in a class which can be used directly. However, it might\n",
"be more comfortable to either use the factory or convenience function.\n",
"For example for scatter plots the following initiates the same object:"
"Each of them is implemented in a class which can be used directly and the constructor takes parameter of the algorithm."
]
},
{
Expand All @@ -69,8 +69,8 @@
"metadata": {},
"outputs": [],
"source": [
"from pymoo.algorithms.nsga2 import nsga2\n",
"algorithm = nsga2()\n",
"from pymoo.algorithms.nsga2 import NSGA2\n",
"algorithm = NSGA2()\n",
"\n",
"from pymoo.factory import get_algorithm\n",
"algorithm = get_algorithm(\"nsga2\")"
Expand Down
2 changes: 1 addition & 1 deletion doc/source/algorithms/moead.ipynb

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions doc/source/algorithms/nelder_mead.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"cells": [
{
"cell_type": "raw",
"metadata": {
"raw_mimetype": "text/restructuredtext"
},
"source": [
".. _nb_nelder_mead:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Nelder Mead\n",
"\n",
"\n",
"This algorithm is implemented based on <cite data-cite=\"NelderMead65\"></cite>. In addition to other implementations, a boundary check is included. This ensures that the search considers the box constraints of the given optimization problem. If no boundaries are provided the algorithm falls back to a search without any constraints. "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"code": "algorithms/usage_so_nelder_mead.py"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0.49955771 0.49951863 0.50041486 0.49977682 0.50047266 0.50000158\n",
" 0.50030921 0.50048091 0.49992482 0.49986138]\n",
"[1.22442015e-06]\n"
]
}
],
"source": [
"from pymoo.algorithms.so_nelder_mead import NelderMead\n",
"from pymoo.factory import get_problem\n",
"from pymoo.optimize import minimize\n",
"\n",
"problem = get_problem(\"sphere\")\n",
"\n",
"algorithm = NelderMead(n_max_restarts=10)\n",
"\n",
"res = minimize(problem,\n",
" algorithm,\n",
" seed=1,\n",
" verbose=False)\n",
"\n",
"print(res.X)\n",
"print(res.F)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### API"
]
},
{
"cell_type": "raw",
"metadata": {
"raw_mimetype": "text/restructuredtext"
},
"source": [
".. autoclass:: pymoo.algorithms.so_nelder_mead.NelderMead\n",
" :noindex:"
]
}
],
"metadata": {
"celltoolbar": "Raw Cell Format",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
10 changes: 5 additions & 5 deletions doc/source/algorithms/nsga2.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions doc/source/algorithms/nsga3.ipynb

Large diffs are not rendered by default.

14 changes: 2 additions & 12 deletions doc/source/algorithms/rnsga2.ipynb

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions doc/source/algorithms/rnsga3.ipynb

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions doc/source/api/algorithms.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Algorithms
==============================================================================

.. autofunction:: pymoo.algorithms.so_genetic_algorithm.ga
.. autoclass:: pymoo.algorithms.so_genetic_algorithm.GA

.. autofunction:: pymoo.algorithms.so_de.de
.. autoclass:: pymoo.algorithms.so_de.DE

.. autofunction:: pymoo.algorithms.nsga2.nsga2
.. autoclass:: pymoo.algorithms.nsga2.NSGA2

.. autofunction:: pymoo.algorithms.rnsga2.rnsga2
.. autoclass:: pymoo.algorithms.rnsga2.RNSGA2

.. autofunction:: pymoo.algorithms.nsga3.nsga3
.. autoclass:: pymoo.algorithms.nsga3.NSGA3

.. autofunction:: pymoo.algorithms.unsga3.unsga3
.. autoclass:: pymoo.algorithms.unsga3.UNSGA3

.. autofunction:: pymoo.algorithms.rnsga3.rnsga3
.. autoclass:: pymoo.algorithms.rnsga3.RNSGA3

.. autofunction:: pymoo.algorithms.moead.moead
.. autoclass:: pymoo.algorithms.moead.MOEAD

4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@
links_local = [
("http://localhost:8001", "pymoo.org"),
("https://github.com/msu-coinlab/pymoo", "GitHub"),
("/api/simulation.html", "API")
("api/index.html", "API")
]

links_remote = [
("http://pymoo.org/", "pymoo.org"),
("https://github.com/msu-coinlab/pymoo", "GitHub"),
("/api/simulation.html", "API")
("api/index.html", "API")
]

html_theme_options = {
Expand Down
Loading

0 comments on commit 373bd57

Please sign in to comment.