Skip to content

Commit

Permalink
Merge from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Blank committed Aug 13, 2019
1 parent dee4514 commit 11b45f8
Show file tree
Hide file tree
Showing 537 changed files with 145,169 additions and 6,532 deletions.
27 changes: 10 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,29 @@
.DS_Store
**/.DS_Store
**/.vscode

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

*.c
*.cpp
*.run
*.so

pymoo/experimental


README.html

pymoo/cython/*html

experiments/runs
# files which are in tests
tests/!archive/*
tests/!archive_tests/*
tests/!experimental/*

benchmark/runs/*

tests/resources/*

# any video or other output file
*.mp4
*.out
*.dat

pymoo/.DS_Store

# pycharm folder
.idea/

# C extensions
*.so

# Distribution / packaging
.Python
Expand Down
8 changes: 4 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
recursive-include . *.py *.pyx *.pxd
recursive-exclude . *.so
recursive-exclude pymoo/experimental *.py
include LICENSE
recursive-include pymoo *.py *.cpp
recursive-exclude pymoo *.so *.pyx *.pxd

include LICENSE Makefile
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
clean:
rm -rf build dist pymoo.egg-info

clean-ext:
rm -f pymoo/cython/*.c
rm -f pymoo/cython/*.so
rm -f pymoo/cython/*.cpp
rm -f pymoo/cython/*.html

compile:
python setup.py build_ext --inplace

compile-with-cython:
python setup.py build_ext --inplace --cythonize

dist:
python setup.py sdist

install:
python setup.py install

42 changes: 20 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The official release is always available at PyPi:

.. code:: bash
pip install Cython>=0.29 numpy>=1.15 pymoo
pip install -U pymoo
For the current developer version:
Expand All @@ -52,6 +52,7 @@ For the current developer version:
cd pymoo
pip install .
Since for speedup some of the modules are also available compiled you can double check
if the compilation worked. When executing the command be sure not already being in the local pymoo
directory because otherwise not the in site-packages installed version will be used.
Expand All @@ -61,7 +62,6 @@ directory because otherwise not the in site-packages installed version will be u
python -c "from pymoo.cython.function_loader import is_compiled;print('Compiled Extensions: ', is_compiled())"
Usage
==================================

Expand All @@ -70,38 +70,36 @@ However, for instance executing NSGA2:

.. code:: python
from pymoo.optimize import minimize
from pymoo.algorithms.nsga2 import nsga2
from pymoo.util import plotting
from pymop.factory import get_problem
# load a test or define your own problem
problem = get_problem("zdt1")
from pymoo.algorithms.nsga2 import NSGA2
from pymoo.factory import get_problem
from pymoo.optimize import minimize
from pymoo.visualization.scatter import Scatter
# get the optimal solution of the problem for the purpose of comparison
pf = problem.pareto_front()
problem = get_problem("zdt3")
pf = problem.pareto_front(n_points=200, flatten=False, use_cache=False)
# create the algorithm object
method = nsga2(pop_size=100, elimate_duplicates=True)
algorithm = NSGA2(pop_size=100, elimate_duplicates=True)
# execute the optimization
res = minimize(problem,
method,
termination=('n_gen', 200),
pf=pf,
disp=True)
res = minimize(problem,
algorithm,
('n_gen', 200),
seed=1,
verbose=False)
# plot the results as a scatter plot
plotting.plot(pf, res.F, labels=["Pareto-Front", "F"])
plot = Scatter()
plot.add(pf, plot_type="line", color="black", alpha=0.7)
plot.add(res.F, color="red")
plot.show()
Contact
====================================================================

Feel free to contact me if you have any question:

| Julian Blank (blankjul [at] egr.msu.edu)
| Michigan State University
| Computational Optimization and Innovation Laboratory (COIN)
| East Lansing, MI 48824, USA
45 changes: 45 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

# TODO


- Write test suite for all algorithms (many problems just run once - no crash should occur)
- Add global tests of all optimization methods
- Elementwise function evaluation gradient is not working yet
- Report None of infeasible or feasible




####################################################################

# DONE
- NSGA3 - add non-dom check finally (factor out the algorithm method and reuse)
- !!! NDS and crowding cast to np.float
- !!! Rewrite integer operation with a wrapper - check if casting is working for different types
- copy of algorithm object when minimize is called
- Add sidebar to homepage
- Decision Making (Pseudo Weight, ...)
- Termination Criteria in x space and fspace - xtol and ftol
- PCP values do have different ranges
- Add ZDT5 and show it for NSGA2
- 0.9 prob for crossover in general
- add normalization to radar - externalize from pcp
- Performance check nsga3
- Deliver just .c files for pip to make the build independent from Cython
- Compilation issue with MacOSX Macoave
- NSGA3 worst swap of arguments


####################################################################

# Future

- Add mixed variable possibility
- PCX as crossover
- Remove image file from git history
- (mu,lambda) and (mu+lambda) difference
- Add NoCrossover and NoMutation
- Statistics of Survival and more attributes for individuals
- ask and tell interface Documentation
- maybe include CMA-ES: https://github.com/CMA-ES/pycma
- Implement an async version of algorithms
42 changes: 42 additions & 0 deletions benchmark/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-------------------------------------------------------------------------------------------------
Benchmark
-------------------------------------------------------------------------------------------------

This folder contains an example benchmark setup for algorithms. It is constructed to be executed
on a single-machine with many cores. Since most of the algorithm execute pretty fast we did
not setup a distributed system for our benchmarking yet.


1. Run the corresponding benchmark file which will create the configuration into the
pymoo/benchmark/runs folder. You will find for a run a persisted configuration and a batch file
run.bat that contains a line to run each configuration.

2. The framework must be available where you execute the benchmark. Either you use the globally
installed pymoo through pip or if you are developing a new algorithm you need to import the
local project. To do so, open pymoo/benchmark/execute.py and make sure that the folder to
pymoo is imported correctly. E.g.

sys.path.insert(0, "/home/blankjul/workspace/pymoo/")



Serialized
========================

In order to run all algorithms serialized you can now simply execute:

cd pymoo/benchmark
sh runs/<algorithm>/run.bat

This will run all algorithms in a row. Be careful to be in the benchmark folder.


Multi Processes
========================

For parallelization you can use the runner.py by provided the path to the run.bat and the number
processes to be used.

python runner.py runs/<algorithm>/run.bat 32

To run it on 32 processes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import pickle

from experiments.experiment_nsga3 import setup
from benchmark.benchmark_nsga3 import setup
from pymoo.algorithms.moead import moead

if __name__ == '__main__':
Expand All @@ -18,7 +18,7 @@
# number of runs to execute
n_runs = 50

# problems to be investigated
# single to be investigated
problems = setup.keys()

# path were the files for this experiment are saved
Expand All @@ -33,7 +33,7 @@
s['ref_dirs'],
n_neighbors=20,
decomposition='auto',
prob_neighbor_mating=0.7,
prob_neighbor_mating=0.9,
eliminate_duplicates=True
)

Expand Down
Loading

0 comments on commit 11b45f8

Please sign in to comment.