|
1 | | -# openmdao-nsga |
2 | | -NSGA-II and NSGA-III implementations for OpenMDAO |
| 1 | +# OpenMDAO-NSGA |
| 2 | + |
| 3 | +[](https://doi.org/f762) |
| 4 | + |
| 5 | +NSGA-II and NSGA-III implementations for OpenMDAO. |
| 6 | + |
| 7 | +Some notable features include: |
| 8 | + |
| 9 | +* Support for continuous, integer, discrete and categorical variables. |
| 10 | +* Support for Pareto-optimization of multi-objective problems. |
| 11 | +* Constraint handling without parameters (using the method described in the original NSGA-II paper). |
| 12 | +* Flexible termination criteria. |
| 13 | + |
| 14 | +Do note that the performance for discrete problems will probably be bad, but if you are looking for a fairly robust *shotgun approach* for a variety of different problems, OpenMDAO-NSGA might serve you well enough. |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +This assumes you are using Conda. Run this in your environment to install: |
| 19 | + |
| 20 | + conda install ovidner::openmdao-nsga |
| 21 | + |
| 22 | +## Usage example |
| 23 | + |
| 24 | +```python |
| 25 | +import openmdao.api as om |
| 26 | +import omnsga |
| 27 | + |
| 28 | +prob = om.Problem() |
| 29 | + |
| 30 | +... |
| 31 | + |
| 32 | +# Real or integer design var |
| 33 | +prob.model.add_design_var("x_1", lower=0, upper=1) |
| 34 | +# Discrete design var |
| 35 | +omnsga.add_design_var(prob.model, "x_2", values={0, 1, 4}, type=omnsga.VariableType.ORDINAL) |
| 36 | +# Categorical design var |
| 37 | +omnsga.add_design_var(prob.model, "x_3", values={True, False, None}, type=omnsga.VariableType.NOMINAL) |
| 38 | + |
| 39 | +prob.model.add_constraint("g", lower=0, upper=1) |
| 40 | +# Maximize f_1 |
| 41 | +prob.model.add_objective("f_1", scaler=-1) |
| 42 | +# Minimize f_2 |
| 43 | +prob.model.add_objective("f_2") |
| 44 | + |
| 45 | +prob.driver = omnsga.Nsga2Driver( |
| 46 | + termination_criterion=omnsga.MaxEvaluationsCriterion(500), |
| 47 | +) |
| 48 | + |
| 49 | +prob.run_driver() |
| 50 | +``` |
0 commit comments