Appendix B
From the MATLAB toolbox to easyiec
EASY-IEC users wrote a user function that draws one individual into a column of subplots, created a population with popu_init and started the interactive loop with ies_main; parents were marked by one click, offspring to keep by two, and the Exit button ended the session [2]. easyiec.compat keeps this workflow, so that old examples port line by line; the gallery script plot_05_matlab_workflow.py shows a complete example.
The workflow
|
EASY-IEC (MATLAB) |
easyiec |
|
popu = popu_init(LB, UB, nind, initchrom) |
popu = easyiec.compat.popu_init(LB, UB, nind, init_chrom) |
|
function userfun(chrom, axhandles) |
def userfun(chrom, axes): ... with a list of Matplotlib axes |
|
popu = ies_main(popu, subfigrows, ’userfun’) |
popu = easyiec.compat.ies_main(popu, subfigrows, userfun) |
|
click once / twice on a subplot |
the same in MatplotlibGallery (parent / kept) |
|
Exit button |
Stop button, or a budget (generations=...) |
|
the popu structure (chrom, devi, LB, UB, nvar, nind) |
the same keys of a dictionary |
|
dragging the knots of a profile |
edit_handles/apply_edit of editable problems; draggable in MatplotlibGallery, gene editor in JupyterGallery |
|
IPSO toolbox |
InteractivePSO |
Beyond the workflow
The same loop runs unattended with any evaluator, for example a metric or a simulated user, ies_main(popu, 1, userfun, evaluator=..., generations=20). New code is better written with Session and EasyIEC, which add logging, budgets, all protocols, AI judges, hybrid evaluation and every visualization and validation tool of the package:
import easyiec as ei from easyiec.compat import UserFunctionProblem from easyiec.strategies import EasyIEC problem = UserFunctionProblem(LB, UB, userfun) # the old user function as a problem session = ei.Session(problem, EasyIEC(pop_size=9), ei.ui.MatplotlibGallery(problem)) result = session.run(20) ei.viz.session_report(result, "report.html")