.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/02_algorithms/plot_05_nsga2_reference.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_02_algorithms_plot_05_nsga2_reference.py: Many objectives, one person: reference-point NSGA-II ==================================================== Controller tuning has several computable objectives (integral error, overshoot, control effort, settling time) whose trade-off only a person can settle. In the interactive NSGA-II the population evolves for a few silent generations under Pareto dominance and crowding (Deb et al., 2002); then the evaluator picks the responses they like, and the picks act as reference points that bias the next silent phase (Deb and Sundar, 2006). .. GENERATED FROM PYTHON SOURCE LINES 14-16 PID tuning with a hidden preferred trade-off -------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 16-28 .. code-block:: Python import matplotlib.pyplot as plt import easyiec as ei from easyiec.problems import PIDTuning from easyiec.strategies import InteractiveNSGA2 problem = PIDTuning() print(problem.objectives_names()) strategy = InteractiveNSGA2(pop_size=8, inner_size=40, inner_generations=5) user = ei.SimulatedUser(problem, target="default", noise=0.05, seed=1) result = ei.run(problem, strategy, user, generations=10, seed=1) print(problem.describe(result.best.genome)) .. rst-class:: sphx-glr-script-out .. code-block:: none ['iae', 'overshoot', 'settling_time', 'input_tv', 'disturbance_iae'] PID controller Kc=2.07, Ti=8.07 s, Td=0.261 s, b=0.56, N=3.6. Setpoint step: IAE=7.44, overshoot=0.0 %, settling time=21.8 s; disturbance IAE=2.34; control-signal total variation=1.78. .. GENERATED FROM PYTHON SOURCE LINES 29-33 The final inner population in objective space --------------------------------------------- Integral error against control effort (total variation of the input). Grey: the silent population; blue: its non-dominated front; circles: the last picks. .. GENERATED FROM PYTHON SOURCE LINES 33-38 .. code-block:: Python last = result.log.records[-1] picked = [last.query.item(i) for i in last.feedback.chosen(last.query)] pool = strategy.inner + [p for p in picked if p not in strategy.inner] ei.viz.plot_pareto(problem, pool, objectives=["iae", "input_tv"], chosen=[p.id for p in picked]) .. image-sg:: /auto_examples/02_algorithms/images/sphx_glr_plot_05_nsga2_reference_001.png :alt: plot 05 nsga2 reference :srcset: /auto_examples/02_algorithms/images/sphx_glr_plot_05_nsga2_reference_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 39-41 The step responses the user chose from in the last gallery ---------------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 41-43 .. code-block:: Python ei.viz.plot_gallery(problem, last.query.items, chosen=last.feedback.chosen(last.query), ncols=8, size=1.4) plt.show() .. image-sg:: /auto_examples/02_algorithms/images/sphx_glr_plot_05_nsga2_reference_002.png :alt: #2003, #2014, #2022, #1999, #1934, #1972, #2011, #1985 :srcset: /auto_examples/02_algorithms/images/sphx_glr_plot_05_nsga2_reference_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 12.214 seconds) .. _sphx_glr_download_auto_examples_02_algorithms_plot_05_nsga2_reference.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/ComplexSystemsIntelligence/easyiec/main?urlpath=lab/tree/notebooks/auto_examples/02_algorithms/plot_05_nsga2_reference.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_05_nsga2_reference.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_05_nsga2_reference.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_05_nsga2_reference.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_