From 5690c6d43143d9e266dc8df72b2bd3ebee4d6948 Mon Sep 17 00:00:00 2001 From: Winni <winnus@posteo.de> Date: Fri, 2 Jun 2023 16:16:33 +0200 Subject: [PATCH] First simple evolution algorithm, drawings updated. --- .gitignore | 4 + diagramms/.$Evolution_01.drawio.bkp | 465 +++++++++++ diagramms/Evolution_01.drawio | 465 +++++++++++ src/Evo.ipynb | 1130 +++++++++++++++++++++++++++ src/PyGMA.ipynb | 33 + 5 files changed, 2097 insertions(+) create mode 100644 .gitignore create mode 100755 diagramms/.$Evolution_01.drawio.bkp create mode 100755 diagramms/Evolution_01.drawio create mode 100755 src/Evo.ipynb create mode 100755 src/PyGMA.ipynb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9dff1a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# no ipython checkpoints +*.ipynb_checkpoints + + diff --git a/diagramms/.$Evolution_01.drawio.bkp b/diagramms/.$Evolution_01.drawio.bkp new file mode 100755 index 0000000..7181855 --- /dev/null +++ b/diagramms/.$Evolution_01.drawio.bkp @@ -0,0 +1,465 @@ +<mxfile host="Electron" modified="2023-06-02T14:00:28.948Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.2.8 Chrome/112.0.5615.165 Electron/24.2.0 Safari/537.36" etag="uGRXNjCx3vq0dflRDGp-" version="21.2.8" type="device"> + <diagram name="Page-1" id="ZgEUCu97vCsvLgyVy6hc"> + <mxGraphModel dx="2359" dy="1982" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0"> + <root> + <mxCell id="0" /> + <mxCell id="1" parent="0" /> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-17" value="Population" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-800" y="340" width="250" height="270" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-8" value="+ population_index: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="26" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-18" value="+ population_name: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="52" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-33" value="+ epoch_counter: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="78" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-100" value="+ individuals: array" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="104" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-29" value="+ operator: operator" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="130" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-90" value="+ mean_individual_fitness: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="156" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-19" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="182" width="250" height="8" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-64" value="+ instantiate_individuals()" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="190" width="250" height="28" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-20" value="+ recombine(operator(g_0, g_1))" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="218" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-8" value="+ apply_operator(operator)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="fyUvw5QtPV9Wiu8gB0H8-17"> + <mxGeometry y="244" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-21" value="Individual" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-60" y="164" width="160" height="138" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-22" value="+ gene: array " style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="26" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-25" value="+ fitness: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="52" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-99" value="+ population: population" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="78" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-23" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="104" width="160" height="8" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-24" value="+ method(type): type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="112" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-26" value="World_controller" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-445" width="330" height="112" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-27" value="+ populations: array(Populatoon" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-26" vertex="1"> + <mxGeometry y="26" width="330" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-51" value="+ epoch: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-26" vertex="1"> + <mxGeometry y="52" width="330" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-28" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="fyUvw5QtPV9Wiu8gB0H8-26" vertex="1"> + <mxGeometry y="78" width="330" height="8" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-29" value="+ epoch()&nbsp;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-26" vertex="1"> + <mxGeometry y="86" width="330" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-30" value="<b><font style="font-size: 30px;">Class diagramms</font></b>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="-520" y="-130" width="270" height="50" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-31" value="<font size="1"><b style="font-size: 30px;">Flowchart</b></font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1735" y="-240" width="160" height="50" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-34" value="main" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1735" y="-180" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-115" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="fyUvw5QtPV9Wiu8gB0H8-35" target="YBbd6qHGsjDS6U28tkjz-114" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="fyUvw5QtPV9Wiu8gB0H8-35" target="YBbd6qHGsjDS6U28tkjz-9" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1580.0000000000005" y="160.00000000000023" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-35" value="mpi?" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="1745" y="156" width="100" height="100" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-42" value="Y" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1875" y="174" width="30" height="30" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-45" value="N" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1695" y="173" width="30" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-1" value="since the programm will be run as sbatch<br>and the like it is nice if there is at least one<br>place to define all the params and a contfig file might be nice<br>Read config herer for decide if mpi shall be used or not.<br>Make this file a python dict that is imported in the end<br><br>This step includes to define all user functions like experiments and&nbsp; on_init...<br>It will load all these functions from the respective files and pass them to the controller instance or the worker instance" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1465" y="-135" width="640" height="130" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-32" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-9" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1600" y="640" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-172" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-9" target="YBbd6qHGsjDS6U28tkjz-168" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-9" value="CONTROLLER<br>INIT" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="500" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-30" value="Think:<br>&nbsp;operators distributed among different populations (each has one)<br>and then let the populations meet at some point to make new population.<br>Which operator to use then for this population? the one from each?<br>Or make thwo populations one with each operator?<br>Which populations to ditch then to not reach more then max? (just make not more then N*2 Pops )<br><br>Maybe for the name of a population make a random string which can reflect from which indexes the populations where made<br>so it is possible in the end to track how the most fittest individuan emerged.<br>It would be good since then one would have a "stammbaum" for each individual and as such can<br>Decide if population fusion/combination is bringing good :)<br>also for master thesis evolver this could be helpfull to understand the algorithm." style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="-810" y="138" width="680" height="190" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-33" target="YBbd6qHGsjDS6U28tkjz-34" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-33" value="while Controller.fitness or Controller.epochs&nbsp;" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.loop_limit;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="1550" y="640" width="100" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-37" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="YBbd6qHGsjDS6U28tkjz-36" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-39" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="YBbd6qHGsjDS6U28tkjz-36" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="YBbd6qHGsjDS6U28tkjz-40" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-49" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="YBbd6qHGsjDS6U28tkjz-45" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="6sdkXRkWTDobi1n3qOID-22" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-34" value="Controller.epoch()" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="838" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-36" value="population.mutate()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1281" y="838" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-38" value="call mutate on all the populations" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1240" y="797" width="200" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-40" value="population.recombine(<br>operator(g_0,g_1))" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1281" y="1148" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-44" value="will create N new individuals based on the the operators<br>&nbsp;and replace them with the last in the list.<br>N &lt;= popsize, if N==popsize no elitism :)" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1220" y="1095" width="320" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-176" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-45" target="YBbd6qHGsjDS6U28tkjz-173" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-45" value="population.instantiiate_<br>individuals(mpi=true)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1281" y="990" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-50" value="Here the fitness value will be evaluated by conducting the experiment<br>Based on bool mpi use the mpi passing model<br>or the process pool model to distribute the genes from<br>the populations to the experiments." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1126" y="918" width="390" height="70" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-52" value="Experiment" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-520" y="777" width="160" height="164" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-53" value="+ inputs: ?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="26" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-54" value="+ outputs:?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="52" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-57" value="+ Environment" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="78" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-35" value="+ Fitness_function?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="104" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-55" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="130" width="160" height="8" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-56" value="+ ?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="138" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-58" value="Environment" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-256" y="826" width="230" height="112" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-59" value="+ name: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-58" vertex="1"> + <mxGeometry y="26" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-62" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="YBbd6qHGsjDS6U28tkjz-58" vertex="1"> + <mxGeometry y="52" width="230" height="8" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-63" value="+ instantiate_individual(gene)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-58" vertex="1"> + <mxGeometry y="60" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-34" value="+ save_instantiation(filename, gene)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-58" vertex="1"> + <mxGeometry y="86" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-85" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-74" target="YBbd6qHGsjDS6U28tkjz-75" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-74" target="YBbd6qHGsjDS6U28tkjz-87" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-74" target="6sdkXRkWTDobi1n3qOID-21" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-74" value="Combine populations into new one?" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="1550" y="1394" width="100" height="100" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-75" target="6sdkXRkWTDobi1n3qOID-16" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-75" value="Controller.<br>population_fusion<br>(Indexes)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1213" y="1414" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-79" value="Y" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1511" y="1418" width="30" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-80" value="N" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1650" y="1414" width="30" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-81" value="There needs to be some configurable parameter maybe:<br>&nbsp;epochs<br>certain change in fitness<br>Gene diversity<br>&nbsp;on which to start this combination process.<br>Gene diversity tracking and if it stagnates then this could be called<br>Experiment or fitness function could also set a flag to call this<br>in the next round" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1416" y="1217" width="380" height="130" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-97" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-21" target="YBbd6qHGsjDS6U28tkjz-96" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1590" y="2020" as="sourcePoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-86" value="This will fusion the populations at the indexes inside the Controller<br>Population array. It will allow therefore to choose not only the fittest<br>But also random choices possible.<br>How to fusion populations?<br>Apply the genetic operators on them to create new individuals.<br>Make two pops, one with the operator from population one, one from the other one" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1022" y="1314" width="460" height="100" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-87" value="Controller.<br>population_removal<br>(Indexes)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1206" y="1700" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-89" value="Since new populations are there the need to shrink.<br>Indexes for more option.<br>But generally take the ones with the worst fitness.<br>But it might be okay to first test the newly generated because to make sure that you<br>do not remove some that are better then the newly generated?<br>So here a eval and experimental step of the new populations could be helpfull.<br>And generally it might be good for the diversity to keel the old populations?<br>Maybe make a switch for that so these are kept anyway?<br>Could be done in a index selection function" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1013" y="1547" width="470" height="140" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-102" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-96" target="YBbd6qHGsjDS6U28tkjz-101" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-96" value="Controller.<br>get_fittest(N)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="1860" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-98" value="Get the N fittest members from all populations.<br>Display some information about them" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1473" y="1800" width="270" height="40" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-105" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-101" target="YBbd6qHGsjDS6U28tkjz-104" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-101" value="Controller.<br>experiment.<br>world.<br>instantiate(gene)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="2025" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-103" value="Instantiate the most fittest ones so that one can work with them&nbsp;" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1436" y="1966" width="360" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-104" value="Save" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="2220" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-106" value="Save the results:<br>the most fittest genes<br>the instantiation of the most fittest genes.<br>The instantiation is saved via the method the<br>experiment/world is implementing.<br>If it is not implementing such save feature one can save the gene string and pass&nbsp;<br>it to the representative function in the world to get something usefull" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1375" y="2099" width="460" height="110" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-108" value="+ save_instantiation(gene):<br>Will save the instantiation of the individual<br>This will allow it for further use and<br>reflects the result of the genetic algorithm.<br><br>instantiate_individual(gene) will use the fitness funtion to test the individual?<br>Or will it make the object (a logic circuit) which is then passed back to the Experiment<br>Which will then evaluate it based on the fitness function?" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="-256" y="698" width="480" height="130" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-161" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-114" target="YBbd6qHGsjDS6U28tkjz-9" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1970.0000000000005" y="363" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-162" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-114" target="YBbd6qHGsjDS6U28tkjz-116" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="2377.5" y="440" as="sourcePoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-114" value="controller or<br>Worker?" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="2315" y="236" width="100" height="100" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-122" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-116" target="YBbd6qHGsjDS6U28tkjz-121" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-116" value="Init_Worker<br>Wait for work" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="2589" y="320" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-128" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-121" target="YBbd6qHGsjDS6U28tkjz-125" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-131" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-121" target="YBbd6qHGsjDS6U28tkjz-130" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-121" value="get_gene()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2590" y="462" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-125" value="EXPERIMENT<br>WORKFLOW" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2373" y="461" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-130" value="return fitness" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2589" y="600" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-133" value="Controller init&nbsp;" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontStyle=1;fontSize=30;fontColor=#006600;" parent="1" vertex="1"> + <mxGeometry x="1010" y="186" width="230" height="50" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-151" value="Experiment workflow" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontStyle=1;fontSize=30;fontColor=#006600;" parent="1" vertex="1"> + <mxGeometry x="2089.5" y="748" width="330" height="50" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-152" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-154" target="YBbd6qHGsjDS6U28tkjz-155" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-153" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-154" target="YBbd6qHGsjDS6U28tkjz-156" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-154" target="6sdkXRkWTDobi1n3qOID-9" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-154" value="experiment.<br>test_individual(gene)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2253" y="1060" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-155" value="world.instantiate_<br>individual(gene)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2053" y="1060" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-156" value="world.test_<br>individual(input, outputs)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2049" y="1190" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-157" value="These are all objects where each object is one experiment(with its world)<br>on one individual.<br>As such this can be passed to a worker wrapper and here<br>for each individual a own worker process is generated testing the individual and<br>returns the fitness value, or whatever value is represented." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="2069" y="797" width="450" height="90" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-159" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="fyUvw5QtPV9Wiu8gB0H8-34" target="YBbd6qHGsjDS6U28tkjz-158" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1795" y="-120" as="sourcePoint" /> + <mxPoint x="1795" y="156" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-160" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-158" target="fyUvw5QtPV9Wiu8gB0H8-35" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-158" value="read_config()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1735" y="26" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-164" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-165" target="YBbd6qHGsjDS6U28tkjz-169" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-165" value="init_populations()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1053" y="500" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-166" value="will create a population with given params<br>will create all gene strings and the like" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="985" y="435" width="250" height="40" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-167" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-168" target="YBbd6qHGsjDS6U28tkjz-165" edge="1"> + <mxGeometry relative="1" as="geometry"> + <Array as="points"> + <mxPoint x="1216" y="530" /> + <mxPoint x="1216" y="530" /> + </Array> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-168" value="Controlller = world_controller()" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1306" y="500" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-169" value="init_individ.()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="730" y="500" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-170" value="Will create the individuals inside the population.<br>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="650" y="445" width="280" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-171" value="World_controller will handle all the populations<br>the genetic operators applied and<br>has functons to mutate&nbsp;<br>as well as produce offsprings.<br>This is but just a bridge that calls all these funcitons&nbsp;<br>on the populations itself." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="960" y="291" width="300" height="100" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-180" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-173" target="YBbd6qHGsjDS6U28tkjz-177" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-181" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-173" target="YBbd6qHGsjDS6U28tkjz-179" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-173" value="use MPI?" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="860" y="1050" width="100" height="100" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-177" value="pass genes to MPI workers" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1000" y="1130" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-183" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-179" target="YBbd6qHGsjDS6U28tkjz-182" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-179" value="pass genes to process worker que/wrapper" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="620" y="1130" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-185" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-182" target="YBbd6qHGsjDS6U28tkjz-184" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-182" value="proces_pool_worker<br>wrapper function" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="620" y="1270" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-184" value="EXERIMENT<br>WORKFLOW" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="620" y="1410" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-1" target="YBbd6qHGsjDS6U28tkjz-154" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-1" value="Init_experiment()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2253" y="912" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-4" value="Init experiment will need to read all its own experiment configurations from its own config file.<br>This way the experiment can be treated independently from the Controller config." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="2090" y="983" width="520" height="40" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-9" value="call_gene_modification" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2253" y="1392" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-11" value="This could be a module/interface in which the fitness function can advise the controller to&nbsp;<br>Apply specific genetic operators, like the gene string extending operator<br>Recombine new populations<br>build entire new populations<br>sort out some populations.<br>Basically a function which can be called with differient params to achieve the above behaviour<br>Or maybe more a set of functions in the controller class that can be called if needed here from the experiment." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="2010" y="1260" width="610" height="110" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-16" target="YBbd6qHGsjDS6U28tkjz-173" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-16" value="instantiate<br>individuals of new pops" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="850" y="1414" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-19" value="This is necessary to ensure that the<br>population and the individuals got<br>fitness values" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="812" y="1340" width="210" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-21" target="YBbd6qHGsjDS6U28tkjz-33" edge="1"> + <mxGeometry relative="1" as="geometry"> + <Array as="points"> + <mxPoint x="1870" y="1650" /> + <mxPoint x="1870" y="670" /> + </Array> + </mxGeometry> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-21" value="print or log information about epoch" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="1620" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-22" target="YBbd6qHGsjDS6U28tkjz-74" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-22" value="check if the algorithm stagnates (no diversity)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="1148" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-30" value="World<br>experiment<br>controller<br>populations<br>individuals<br>operators" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="2880" y="1223" width="80" height="100" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-31" value="controller.pops_stagnation_check()<br>make all of these functions to have a better code overview" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1545" y="1080" width="330" height="40" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-32" value="On all populations set the epoch counder one up<br>so again you would pack this here into functions.<br>Like _populatios.mutat()<br>_populations_instantiate()<br>_populations_apply_operatos()" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1193" y="700" width="280" height="90" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-1" value="Operator_interface" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="-297" y="480" width="230" height="112" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-2" value="+ name: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2305VUciKoEtOX_F4iJQ-1"> + <mxGeometry y="26" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-3" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="2305VUciKoEtOX_F4iJQ-1"> + <mxGeometry y="52" width="230" height="8" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-4" value="+ apply_operator(gene_0, gene_1)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2305VUciKoEtOX_F4iJQ-1"> + <mxGeometry y="60" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-7" value="+ apply_operator(gene_0)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2305VUciKoEtOX_F4iJQ-1"> + <mxGeometry y="86" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-6" value="Thies will be an interface to the operators used to produce offsprings<br>There can be operators which will just use one gene string" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1"> + <mxGeometry x="-355" y="373" width="390" height="40" as="geometry" /> + </mxCell> + </root> + </mxGraphModel> + </diagram> +</mxfile> diff --git a/diagramms/Evolution_01.drawio b/diagramms/Evolution_01.drawio new file mode 100755 index 0000000..d6276f0 --- /dev/null +++ b/diagramms/Evolution_01.drawio @@ -0,0 +1,465 @@ +<mxfile host="Electron" modified="2023-06-02T14:05:06.038Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.2.8 Chrome/112.0.5615.165 Electron/24.2.0 Safari/537.36" etag="DCqei-6tQi-yrX2oefD1" version="21.2.8" type="device"> + <diagram name="Page-1" id="ZgEUCu97vCsvLgyVy6hc"> + <mxGraphModel dx="2359" dy="1982" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0"> + <root> + <mxCell id="0" /> + <mxCell id="1" parent="0" /> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-17" value="Population" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-800" y="340" width="250" height="270" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-8" value="+ population_index: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="26" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-18" value="+ population_name: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="52" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-33" value="+ epoch_counter: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="78" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-100" value="+ individuals: array" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="104" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-29" value="+ operator: operator" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="130" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-90" value="+ mean_individual_fitness: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="156" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-19" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="182" width="250" height="8" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-64" value="+ instantiate_individuals()" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="190" width="250" height="28" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-20" value="+ recombine(operator(g_0, g_1))" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-17" vertex="1"> + <mxGeometry y="218" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-8" value="+ apply_operator(operator)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="fyUvw5QtPV9Wiu8gB0H8-17"> + <mxGeometry y="244" width="250" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-21" value="Individual" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-60" y="164" width="160" height="138" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-22" value="+ gene: array " style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="26" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-25" value="+ fitness: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="52" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-99" value="+ population: population" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="78" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-23" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="104" width="160" height="8" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-24" value="+ method(type): type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-21" vertex="1"> + <mxGeometry y="112" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-26" value="World_controller" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-445" width="330" height="112" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-27" value="+ populations: array(Populatoon" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-26" vertex="1"> + <mxGeometry y="26" width="330" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-51" value="+ epoch: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-26" vertex="1"> + <mxGeometry y="52" width="330" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-28" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="fyUvw5QtPV9Wiu8gB0H8-26" vertex="1"> + <mxGeometry y="78" width="330" height="8" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-29" value="+ epoch()&nbsp;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="fyUvw5QtPV9Wiu8gB0H8-26" vertex="1"> + <mxGeometry y="86" width="330" height="26" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-30" value="<b><font style="font-size: 30px;">Class diagramms</font></b>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="-520" y="-130" width="270" height="50" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-31" value="<font size="1"><b style="font-size: 30px;">Flowchart</b></font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1735" y="-240" width="160" height="50" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-34" value="main" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1735" y="-180" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-115" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="fyUvw5QtPV9Wiu8gB0H8-35" target="YBbd6qHGsjDS6U28tkjz-114" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="fyUvw5QtPV9Wiu8gB0H8-35" target="YBbd6qHGsjDS6U28tkjz-9" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1580.0000000000005" y="160.00000000000023" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-35" value="mpi?" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="1745" y="156" width="100" height="100" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-42" value="Y" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1875" y="174" width="30" height="30" as="geometry" /> + </mxCell> + <mxCell id="fyUvw5QtPV9Wiu8gB0H8-45" value="N" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1695" y="173" width="30" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-1" value="since the programm will be run as sbatch<br>and the like it is nice if there is at least one<br>place to define all the params and a contfig file might be nice<br>Read config herer for decide if mpi shall be used or not.<br>Make this file a python dict that is imported in the end<br><br>This step includes to define all user functions like experiments and&nbsp; on_init...<br>It will load all these functions from the respective files and pass them to the controller instance or the worker instance" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1465" y="-135" width="640" height="130" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-32" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-9" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1600" y="640" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-172" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-9" target="YBbd6qHGsjDS6U28tkjz-168" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-9" value="CONTROLLER<br>INIT" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="500" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-30" value="Think:<br>&nbsp;operators distributed among different populations (each has one)<br>and then let the populations meet at some point to make new population.<br>Which operator to use then for this population? the one from each?<br>Or make thwo populations one with each operator?<br>Which populations to ditch then to not reach more then max? (just make not more then N*2 Pops )<br><br>Maybe for the name of a population make a random string which can reflect from which indexes the populations where made<br>so it is possible in the end to track how the most fittest individuan emerged.<br>It would be good since then one would have a "stammbaum" for each individual and as such can<br>Decide if population fusion/combination is bringing good :)<br>also for master thesis evolver this could be helpfull to understand the algorithm." style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="-810" y="138" width="680" height="190" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-33" target="YBbd6qHGsjDS6U28tkjz-34" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-33" value="while Controller.fitness or Controller.epochs&nbsp;" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.loop_limit;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="1550" y="640" width="100" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-37" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="YBbd6qHGsjDS6U28tkjz-36" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-39" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="YBbd6qHGsjDS6U28tkjz-36" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="YBbd6qHGsjDS6U28tkjz-40" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-49" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="YBbd6qHGsjDS6U28tkjz-45" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-34" target="6sdkXRkWTDobi1n3qOID-22" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-34" value="Controller.epoch()" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="838" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-36" value="population.mutate()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1281" y="838" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-38" value="call mutate on all the populations" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1240" y="797" width="200" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-40" value="population.recombine(<br>operator(g_0,g_1))" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1281" y="1148" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-44" value="will create N new individuals based on the the operators<br>&nbsp;and replace them with the last in the list.<br>N &lt;= popsize, if N==popsize no elitism :)" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1220" y="1095" width="320" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-176" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-45" target="YBbd6qHGsjDS6U28tkjz-173" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-45" value="population.instantiiate_<br>individuals(mpi=true)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1281" y="990" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-50" value="Here the fitness value will be evaluated by conducting the experiment<br>Based on bool mpi use the mpi passing model<br>or the process pool model to distribute the genes from<br>the populations to the experiments." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1126" y="918" width="390" height="70" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-52" value="Experiment" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-520" y="777" width="160" height="164" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-53" value="+ inputs: ?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="26" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-54" value="+ outputs:?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="52" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-57" value="+ Environment" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="78" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-35" value="+ Fitness_function?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="104" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-55" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="130" width="160" height="8" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-56" value="+ ?" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-52" vertex="1"> + <mxGeometry y="138" width="160" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-58" value="Environment" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="-256" y="826" width="230" height="112" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-59" value="+ name: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-58" vertex="1"> + <mxGeometry y="26" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-62" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="YBbd6qHGsjDS6U28tkjz-58" vertex="1"> + <mxGeometry y="52" width="230" height="8" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-63" value="+ instantiate_individual(gene)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-58" vertex="1"> + <mxGeometry y="60" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-34" value="+ save_instantiation(filename, gene)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="YBbd6qHGsjDS6U28tkjz-58" vertex="1"> + <mxGeometry y="86" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-85" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-74" target="YBbd6qHGsjDS6U28tkjz-75" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-88" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-74" target="YBbd6qHGsjDS6U28tkjz-87" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-74" target="6sdkXRkWTDobi1n3qOID-21" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-74" value="Combine populations into new one?" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="1550" y="1394" width="100" height="100" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-75" target="6sdkXRkWTDobi1n3qOID-16" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-75" value="Controller.<br>population_fusion<br>(Indexes)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1213" y="1414" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-79" value="Y" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1511" y="1418" width="30" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-80" value="N" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1650" y="1414" width="30" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-81" value="There needs to be some configurable parameter maybe:<br>&nbsp;epochs<br>certain change in fitness<br>Gene diversity<br>&nbsp;on which to start this combination process.<br>Gene diversity tracking and if it stagnates then this could be called<br>Experiment or fitness function could also set a flag to call this<br>in the next round" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1416" y="1217" width="380" height="130" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-97" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-21" target="YBbd6qHGsjDS6U28tkjz-96" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1590" y="2020" as="sourcePoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-86" value="This will fusion the populations at the indexes inside the Controller<br>Population array. It will allow therefore to choose not only the fittest<br>But also random choices possible.<br>How to fusion populations?<br>Apply the genetic operators on them to create new individuals.<br>Make two pops, one with the operator from population one, one from the other one" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1022" y="1314" width="460" height="100" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-87" value="Controller.<br>population_removal<br>(Indexes)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1206" y="1700" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-89" value="Since new populations are there the need to shrink.<br>Indexes for more option.<br>But generally take the ones with the worst fitness.<br>But it might be okay to first test the newly generated because to make sure that you<br>do not remove some that are better then the newly generated?<br>So here a eval and experimental step of the new populations could be helpfull.<br>And generally it might be good for the diversity to keel the old populations?<br>Maybe make a switch for that so these are kept anyway?<br>Could be done in a index selection function" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1013" y="1547" width="470" height="140" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-102" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-96" target="YBbd6qHGsjDS6U28tkjz-101" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-96" value="Controller.<br>get_fittest(N)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="1860" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-98" value="Get the N fittest members from all populations.<br>Display some information about them" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1473" y="1800" width="270" height="40" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-105" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-101" target="YBbd6qHGsjDS6U28tkjz-104" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-101" value="Controller.<br>experiment.<br>world.<br>instantiate(gene)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="2025" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-103" value="Instantiate the most fittest ones so that one can work with them&nbsp;" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1436" y="1966" width="360" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-104" value="Save" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="2220" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-106" value="Save the results:<br>the most fittest genes<br>the instantiation of the most fittest genes.<br>The instantiation is saved via the method the<br>experiment/world is implementing.<br>If it is not implementing such save feature one can save the gene string and pass&nbsp;<br>it to the representative function in the world to get something usefull" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1375" y="2099" width="460" height="110" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-108" value="+ save_instantiation(gene):<br>Will save the instantiation of the individual<br>This will allow it for further use and<br>reflects the result of the genetic algorithm.<br><br>instantiate_individual(gene) will use the fitness funtion to test the individual?<br>Or will it make the object (a logic circuit) which is then passed back to the Experiment<br>Which will then evaluate it based on the fitness function?" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="-256" y="698" width="480" height="130" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-161" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-114" target="YBbd6qHGsjDS6U28tkjz-9" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1970.0000000000005" y="363" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-162" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-114" target="YBbd6qHGsjDS6U28tkjz-116" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="2377.5" y="440" as="sourcePoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-114" value="controller or<br>Worker?" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="2315" y="236" width="100" height="100" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-122" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-116" target="YBbd6qHGsjDS6U28tkjz-121" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-116" value="Init_Worker<br>Wait for work" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="2589" y="320" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-128" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-121" target="YBbd6qHGsjDS6U28tkjz-125" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-131" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-121" target="YBbd6qHGsjDS6U28tkjz-130" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-121" value="get_gene()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2590" y="462" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-125" value="EXPERIMENT<br>WORKFLOW" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2373" y="461" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-130" value="return fitness" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2589" y="600" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-133" value="Controller init&nbsp;" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontStyle=1;fontSize=30;fontColor=#006600;" parent="1" vertex="1"> + <mxGeometry x="1010" y="186" width="230" height="50" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-151" value="Experiment workflow" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontStyle=1;fontSize=30;fontColor=#006600;" parent="1" vertex="1"> + <mxGeometry x="2089.5" y="748" width="330" height="50" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-152" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-154" target="YBbd6qHGsjDS6U28tkjz-155" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-153" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-154" target="YBbd6qHGsjDS6U28tkjz-156" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-154" target="6sdkXRkWTDobi1n3qOID-9" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-154" value="experiment.<br>test_individual(gene)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2253" y="1060" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-155" value="world.instantiate_<br>individual(gene)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2053" y="1060" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-156" value="world.test_<br>individual(input, outputs)" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2049" y="1190" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-157" value="These are all objects where each object is one experiment(with its world)<br>on one individual.<br>As such this can be passed to a worker wrapper and here<br>for each individual a own worker process is generated testing the individual and<br>returns the fitness value, or whatever value is represented." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="2069" y="797" width="450" height="90" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-159" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="fyUvw5QtPV9Wiu8gB0H8-34" target="YBbd6qHGsjDS6U28tkjz-158" edge="1"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="1795" y="-120" as="sourcePoint" /> + <mxPoint x="1795" y="156" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-160" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-158" target="fyUvw5QtPV9Wiu8gB0H8-35" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-158" value="read_config()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1735" y="26" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-164" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-165" target="YBbd6qHGsjDS6U28tkjz-169" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-165" value="init_populations()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1053" y="500" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-166" value="will create a population with given params<br>will create all gene strings and the like" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="985" y="435" width="250" height="40" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-167" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-168" target="YBbd6qHGsjDS6U28tkjz-165" edge="1"> + <mxGeometry relative="1" as="geometry"> + <Array as="points"> + <mxPoint x="1216" y="530" /> + <mxPoint x="1216" y="530" /> + </Array> + </mxGeometry> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-168" value="Controlller = world_controller()" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1306" y="500" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-169" value="init_individ.()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="730" y="500" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-170" value="Will create the individuals inside the population.<br>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="650" y="445" width="280" height="30" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-171" value="World_controller will handle all the populations<br>the genetic operators applied and<br>has functons to mutate&nbsp;<br>as well as produce offsprings.<br>This is but just a bridge that calls all these funcitons&nbsp;<br>on the populations itself." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="960" y="291" width="300" height="100" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-180" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-173" target="YBbd6qHGsjDS6U28tkjz-177" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-181" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="YBbd6qHGsjDS6U28tkjz-173" target="YBbd6qHGsjDS6U28tkjz-179" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-173" value="use MPI?" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.decision;whiteSpace=wrap;" parent="1" vertex="1"> + <mxGeometry x="860" y="1050" width="100" height="100" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-177" value="pass genes to MPI workers" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="1000" y="1130" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-183" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-179" target="YBbd6qHGsjDS6U28tkjz-182" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-179" value="pass genes to process worker que/wrapper" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="620" y="1130" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-185" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YBbd6qHGsjDS6U28tkjz-182" target="YBbd6qHGsjDS6U28tkjz-184" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-182" value="proces_pool_worker<br>wrapper function" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="620" y="1270" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="YBbd6qHGsjDS6U28tkjz-184" value="EXERIMENT<br>WORKFLOW" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="620" y="1410" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-1" target="YBbd6qHGsjDS6U28tkjz-154" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-1" value="Init_experiment()" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2253" y="912" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-4" value="Init experiment will need to read all its own experiment configurations from its own config file.<br>This way the experiment can be treated independently from the Controller config." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="2090" y="983" width="520" height="40" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-9" value="Contrpoller call_gene_modification" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="2253" y="1392" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-11" value="This could be a module/interface in which the fitness function can advise the controller to&nbsp;<br>Apply specific genetic operators, like the gene string extending operator<br>Recombine new populations<br>build entire new populations<br>sort out some populations.<br>Basically a function which can be called with differient params to achieve the above behaviour<br>Or maybe more a set of functions in the controller class that can be called if needed here from the experiment." style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="2010" y="1260" width="610" height="110" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-16" target="YBbd6qHGsjDS6U28tkjz-173" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-16" value="instantiate<br>individuals of new pops" style="whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1"> + <mxGeometry x="850" y="1414" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-19" value="This is necessary to ensure that the<br>population and the individuals got<br>fitness values" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="812" y="1340" width="210" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-21" target="YBbd6qHGsjDS6U28tkjz-33" edge="1"> + <mxGeometry relative="1" as="geometry"> + <Array as="points"> + <mxPoint x="1870" y="1650" /> + <mxPoint x="1870" y="670" /> + </Array> + </mxGeometry> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-21" value="print or log information about epoch" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="1620" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="6sdkXRkWTDobi1n3qOID-22" target="YBbd6qHGsjDS6U28tkjz-74" edge="1"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-22" value="check if the algorithm stagnates (no diversity)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="1540" y="1148" width="120" height="60" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-30" value="World<br>experiment<br>controller<br>populations<br>individuals<br>operators" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="2880" y="1223" width="80" height="100" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-31" value="controller.pops_stagnation_check()<br>make all of these functions to have a better code overview" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1545" y="1080" width="330" height="40" as="geometry" /> + </mxCell> + <mxCell id="6sdkXRkWTDobi1n3qOID-32" value="On all populations set the epoch counder one up<br>so again you would pack this here into functions.<br>Like _populatios.mutat()<br>_populations_instantiate()<br>_populations_apply_operatos()" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1"> + <mxGeometry x="1193" y="700" width="280" height="90" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-1" value="Operator_interface" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"> + <mxGeometry x="-297" y="480" width="230" height="112" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-2" value="+ name: string" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2305VUciKoEtOX_F4iJQ-1"> + <mxGeometry y="26" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-3" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" vertex="1" parent="2305VUciKoEtOX_F4iJQ-1"> + <mxGeometry y="52" width="230" height="8" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-4" value="+ apply_operator(gene_0, gene_1)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2305VUciKoEtOX_F4iJQ-1"> + <mxGeometry y="60" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-7" value="+ apply_operator(gene_0)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2305VUciKoEtOX_F4iJQ-1"> + <mxGeometry y="86" width="230" height="26" as="geometry" /> + </mxCell> + <mxCell id="2305VUciKoEtOX_F4iJQ-6" value="Thies will be an interface to the operators used to produce offsprings<br>There can be operators which will just use one gene string to modifie it.<br>In this case the controller needs to understand that and do an inplace modification" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1"> + <mxGeometry x="-390" y="415" width="460" height="60" as="geometry" /> + </mxCell> + </root> + </mxGraphModel> + </diagram> +</mxfile> diff --git a/src/Evo.ipynb b/src/Evo.ipynb new file mode 100755 index 0000000..fb1c00c --- /dev/null +++ b/src/Evo.ipynb @@ -0,0 +1,1130 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "863a0754-df1b-489d-83c6-6796c3ced23f", + "metadata": {}, + "outputs": [], + "source": [ + "%config Completer.use_jedi = False" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "bfdf8840-95c5-488c-b4d9-9b8e8ceec107", + "metadata": {}, + "outputs": [], + "source": [ + "class Individual:\n", + " def __init__(self, genome):\n", + " self.genome = np.array(genome)\n", + " self.fitness = 0\n", + "\n", + " def get_genome(self):\n", + " return self.genome\n", + "\n", + " def set_genome(self, genome):\n", + " self.genome = np.array(genome)\n", + "\n", + " def set_fitness(self, fitness):\n", + " self.fitness = fitness\n", + "\n", + " def get_fitness(self):\n", + " return self.fitness" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "840bef94-79d6-4474-889e-19eafbad5299", + "metadata": {}, + "outputs": [], + "source": [ + "from concurrent.futures import ProcessPoolExecutor\n", + "\n", + "import numpy as np\n", + "\n", + "# from Individual import Individual\n", + "\n", + "# IMPLEMENT ME:\n", + "# island models. Here many different sub populations emerge and at some\n", + "# points some individuals of them meet together and merge the populations\n", + "# that have hopefully defined many different aspects.\n", + "# THen again there are many sub populations evolving on their own until they get\n", + "# finally pooled together to bring in the best of every population.\n", + "\n", + "\n", + "# IMPLEMENT ME:\n", + "# an option to initialize the population via the user as he has domain knowledge\n", + "# and can give that knowledge diretctly to the algorithm by that.\n", + "# well he can just overrride self.population and are good to go!\n", + "class Evolution:\n", + " def __init__(self, population_size, gene_length, gene_value_low, gene_value_high):\n", + " self.population_size = population_size\n", + " self.gene_length = gene_length\n", + " self.gene_value_low = gene_value_low\n", + " self.gene_value_high = gene_value_high\n", + " self.population = []\n", + " self.mutation_rate = 0\n", + "\n", + " # Random number generator\n", + " self.rng = np.random.default_rng(12344)\n", + "\n", + " # init population\n", + " self.init_population()\n", + "\n", + " # FIXME:\n", + " # Needs to be reworked to more comlex init\n", + " def init_population(self):\n", + " \"\"\"\n", + " Initializes a new random population\n", + " gene_length: length of the individual genes\n", + " gene_value_low: smallest value in the gene string\n", + " gene_value_high: highest value in the gene string\n", + " \"\"\"\n", + " for i in range(self.population_size):\n", + " self.population.append(\n", + " Individual(\n", + " self.rng.integers(\n", + " low=self.gene_value_low,\n", + " high=self.gene_value_high,\n", + " size=self.gene_length,\n", + " )\n", + " )\n", + " )\n", + " return\n", + "\n", + " def get_fittest_n_individuals(self, n=2, sort_before_return=True):\n", + " \"\"\"\n", + " Returns the n fittest members of the population\n", + " \"\"\"\n", + " if sort_before_return:\n", + " self.sort_population()\n", + "\n", + " return self.population[:n]\n", + "\n", + " def integrate_new_individuals(self, individuals, sort_before_insert=True):\n", + " \"\"\"\n", + " Replaces the weakest individuals (which has the worst fitness)\n", + " of the population with the new individuals.\n", + " Be sure that individuals does not contain to many new guys.\n", + " \"\"\"\n", + " if sort_before_insert:\n", + " self.sort_population()\n", + "\n", + " # replacing the last individuals, assuming the population is sorted\n", + " for i in range(len(individuals)):\n", + " self.population[-(i + 1)] = individuals[i]\n", + "\n", + " return\n", + "\n", + " # FIXME: the bubblesort implementation was just fun to write again but\n", + " # there are faster algorithms.\n", + " def sort_population(self):\n", + " \"\"\"\n", + " Will sort the population based on their fitness.\n", + " Very fit members, having a high fitness comes first.\n", + " \"\"\"\n", + " elements = len(self.population) - 1\n", + " for i in range(elements):\n", + " for w in range(elements - i):\n", + " if (\n", + " self.population[elements - w].fitness\n", + " > self.population[elements - w - 1].fitness\n", + " ):\n", + " tmp = self.population[elements - w - 1]\n", + " self.population[elements - w - 1] = self.population[elements - w]\n", + " self.population[elements - w] = tmp\n", + "\n", + " return\n", + "\n", + " def crossover(self, crossover_binarys):\n", + " \"\"\"\n", + " Will do corssovers based on the given crossover binarys.\n", + " crossover_binarys: are a boolean array which defines which part of the child gene\n", + " will belong to parent 0 or 1.\n", + " There will be as much childs as the length of the array.\n", + " \"\"\"\n", + "\n", + " # sort the population based on their fitness\n", + " self.sort_population()\n", + "\n", + " # get the two most fittest individuals\n", + " parent_0_genome = self.population[0].get_genome()\n", + " parent_1_genome = self.population[1].get_genome()\n", + "\n", + " # combine children\n", + " new_children = []\n", + " for item in crossover_binarys:\n", + " # copy genome from parent 0\n", + " child_genome = parent_0_genome\n", + "\n", + " # get the indexes which should be copied from parent1\n", + " bins_p1 = np.where(crossover_binarys == 1)[0]\n", + "\n", + " # combine them into the child\n", + " child_genome[bins_p1] = parent_1_genome[bins_p1]\n", + "\n", + " # make new individual\n", + " indiv = Individual(child_genome)\n", + "\n", + " # save the new born\n", + " new_children.append(indiv)\n", + "\n", + " # integrate all new individuals into the population\n", + " self.integrate_new_individuals(new_children, sort_before_insert=False)\n", + "\n", + " return\n", + "\n", + " def mutate(self, mutation_rate, individuals_to_mutate):\n", + " \"\"\"\n", + " Will mutate all the individuals at the indexes given by\n", + " individuals_to_mutate.\n", + " mutation_rate: float value between 0 and 1.\n", + " Note: if the mutation rate is to high then you will not\n", + " converge, if it is to small then the algorithm is slow\n", + " \"\"\"\n", + " # for individuals in the list\n", + " for i in individuals_to_mutate:\n", + " # get the genome\n", + " genome = self.population[i].get_genome()\n", + "\n", + " # generate a random list of pairs that shall be mutated\n", + " bases_tobe_mutated = self.rng.random(len(genome))\n", + " bases_tobe_mutated = np.where(bases_tobe_mutated <= mutation_rate)[0]\n", + "\n", + " # generate new values for these base pairs\n", + " new_values = self.rng.integers(\n", + " low=self.gene_value_low,\n", + " high=self.gene_value_high,\n", + " size=len(bases_tobe_mutated),\n", + " )\n", + "\n", + " # mutate genome\n", + " genome[bases_tobe_mutated] = new_values\n", + "\n", + " # update genome\n", + " self.population[i].set_genome(genome)\n", + "\n", + " return\n", + "\n", + " def evaluating_function_wrapper(self, arguments):\n", + "\n", + " # extract arguments\n", + " index = arguments[0]\n", + " indiv = arguments[1]\n", + " f_fun = arguments[2]\n", + "\n", + " fitness = f_fun(indiv.get_genome())\n", + "\n", + " # print(fitness, \"\\n\")\n", + "\n", + " return (index, fitness)\n", + "\n", + " def evaluate_population(self, evaluating_function, max_workers=1):\n", + " \"\"\"\n", + " This will evalutate the whole populations fitness with the given\n", + " evaluating_function.\n", + " evaluating_function: shall return a fitness value >= 0.\n", + " \"\"\"\n", + " # make tuples for passing to the wrapper\n", + " # do no know how to ensure that the order is preserved\n", + " # when passing to PooledMap.\n", + " arguments = []\n", + " for tup in enumerate(self.population):\n", + " # (individual_index, individual, eval_func)\n", + " arguments.append((tup[0], tup[1], evaluating_function))\n", + "\n", + " # spawn processes\n", + " with ProcessPoolExecutor(max_workers=max_workers) as executor:\n", + " # estimate the chunksize\n", + " # size = round(len(arguments) / executor._max_workers)\n", + " # apply a function to each item in an iterable with a chunksize\n", + " # result = executor.map(self.evaluating_function_wrapper, arguments, chunksize=size)\n", + "\n", + " result = executor.map(self.evaluating_function_wrapper, arguments)\n", + "\n", + " # write back fitness values\n", + " for item in result:\n", + " self.population[item[0]].set_fitness(item[1])\n", + "\n", + " def __str__(self):\n", + " \"\"\"\n", + " STRFYI the fitness of the individuals\n", + " \"\"\"\n", + " s = \"\"\n", + " for item in enumerate(self.population):\n", + " s += f\"Individual {item[0]}: {item[1].get_fitness()} \\n\"\n", + " return s\n", + "\n", + " def print_individual_gene(self, individual_index):\n", + " \"\"\"\n", + " Pritnts out a soecific cromosome inside the population.\n", + " \"\"\"\n", + " print(self.population[individual_index].get_genome(), \"\\n\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d941f9a4-6204-4cdc-a6ee-82ee66f9baa1", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "56fc923a-8122-4743-9df6-367a00f6d769", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Individuals after init:\n", + "Individual 0: 0 \n", + "Individual 1: 0 \n", + "Individual 2: 0 \n", + "Individual 3: 0 \n", + "Individual 4: 0 \n", + "Individual 5: 0 \n", + "Individual 6: 0 \n", + "Individual 7: 0 \n", + "Individual 8: 0 \n", + "Individual 9: 0 \n", + "\n", + "Individual 1 before muatation:\n", + "[3 0 3 4 4 1 1 2 7 6] \n", + "\n", + "Individual 1 after muatation:\n", + "[3 0 3 4 4 1 1 2 7 6] \n", + "\n", + "Individuals after Evaluating:\n", + "Individual 0: 2 \n", + "Individual 1: 1 \n", + "Individual 2: 1 \n", + "Individual 3: 1 \n", + "Individual 4: 0 \n", + "Individual 5: 1 \n", + "Individual 6: 1 \n", + "Individual 7: 1 \n", + "Individual 8: 1 \n", + "Individual 9: 3 \n", + "\n", + "Individuals after crossover:\n", + "Individual 0: 3 \n", + "Individual 1: 2 \n", + "Individual 2: 1 \n", + "Individual 3: 1 \n", + "Individual 4: 1 \n", + "Individual 5: 1 \n", + "Individual 6: 1 \n", + "Individual 7: 1 \n", + "Individual 8: 0 \n", + "Individual 9: 0 \n", + "\n" + ] + } + ], + "source": [ + "# --------------------------------\n", + "# Example use case\n", + "# --------------------------------\n", + "\n", + "# --------------------------------\n", + "# fitness function\n", + "# --------------------------------\n", + "# this here will search for a string containing 1's\n", + "# the fitness function will always get the full genome of \n", + "# an individual and should return a fitness value\n", + "# based on this.\n", + "def eval_function(genome):\n", + " r = len(np.where(genome == 1)[0])\n", + " return r\n", + "\n", + "\n", + "# --------------------------------\n", + "# Evo definition\n", + "# --------------------------------\n", + "# Evolution params\n", + "pop_size = 10\n", + "gene_length = 10\n", + "gene_value_low = 0 # the lowest value in the chromosome\n", + "gene_value_high = 10 # the highest value in the chromosom\n", + "new_children = 2 # how many children to combine\n", + "# evo definition\n", + "evo = Evolution(pop_size, gene_length, gene_value_low, gene_value_high)\n", + "print(\"Individuals after init:\")\n", + "print(evo)\n", + "\n", + "\n", + "# --------------------------------\n", + "# mutation\n", + "# --------------------------------\n", + "print(\"Individual 1 before muatation:\")\n", + "evo.print_individual_gene(0)\n", + "mutation_rate = 0.01\n", + "# generate a list of the population members that shall be mutated\n", + "# [1,5] would mutate the members 1 and 5\n", + "individuals_to_mutate = np.arange(step=1, start=0, stop=pop_size)\n", + "evo.mutate(mutation_rate, individuals_to_mutate)\n", + "print(\"Individual 1 after muatation:\")\n", + "evo.print_individual_gene(0)\n", + "\n", + "\n", + "# --------------------------------\n", + "# evaluation\n", + "# --------------------------------\n", + "# evaluates the population\n", + "# this will automatically sort the population based on their fitness\n", + "evo.evaluate_population(eval_function)\n", + "print(\"Individuals after Evaluating:\")\n", + "print(evo)\n", + "\n", + "\n", + "# --------------------------------\n", + "# crossover\n", + "# --------------------------------\n", + "# crossover will receive a binary list which decides which\n", + "# genetic parts from parent0 and parent2 will be used\n", + "crossover_bin = []\n", + "for i in range(new_children):\n", + " # create random crossover bins which should be adapted to the need!!!\n", + " crossover_bin.append(np.random.randint(0, 2, gene_length))\n", + "evo.crossover(crossover_bin)\n", + "print(\"Individuals after crossover:\")\n", + "print(evo)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "352eaaae-20d5-445a-b2dd-d3bc902debfe", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "epoch: 0\n", + "Individual 0: 19 \n", + "Individual 1: 18 \n", + "Individual 2: 17 \n", + "Individual 3: 17 \n", + "Individual 4: 16 \n", + "Individual 5: 15 \n", + "Individual 6: 15 \n", + "Individual 7: 15 \n", + "Individual 8: 14 \n", + "Individual 9: 14 \n", + "Individual 10: 13 \n", + "Individual 11: 13 \n", + "Individual 12: 13 \n", + "Individual 13: 13 \n", + "Individual 14: 12 \n", + "Individual 15: 12 \n", + "Individual 16: 12 \n", + "Individual 17: 12 \n", + "Individual 18: 12 \n", + "Individual 19: 12 \n", + "Individual 20: 12 \n", + "Individual 21: 12 \n", + "Individual 22: 12 \n", + "Individual 23: 12 \n", + "Individual 24: 12 \n", + "Individual 25: 12 \n", + "Individual 26: 11 \n", + "Individual 27: 11 \n", + "Individual 28: 11 \n", + "Individual 29: 11 \n", + "Individual 30: 11 \n", + "Individual 31: 11 \n", + "Individual 32: 11 \n", + "Individual 33: 11 \n", + "Individual 34: 10 \n", + "Individual 35: 10 \n", + "Individual 36: 10 \n", + "Individual 37: 10 \n", + "Individual 38: 10 \n", + "Individual 39: 10 \n", + "Individual 40: 10 \n", + "Individual 41: 10 \n", + "Individual 42: 10 \n", + "Individual 43: 10 \n", + "Individual 44: 10 \n", + "Individual 45: 10 \n", + "Individual 46: 10 \n", + "Individual 47: 9 \n", + "Individual 48: 9 \n", + "Individual 49: 9 \n", + "Individual 50: 9 \n", + "Individual 51: 9 \n", + "Individual 52: 9 \n", + "Individual 53: 8 \n", + "Individual 54: 8 \n", + "Individual 55: 8 \n", + "Individual 56: 8 \n", + "Individual 57: 8 \n", + "Individual 58: 8 \n", + "Individual 59: 8 \n", + "Individual 60: 8 \n", + "Individual 61: 7 \n", + "Individual 62: 7 \n", + "Individual 63: 7 \n", + "Individual 64: 7 \n", + "Individual 65: 6 \n", + "Individual 66: 6 \n", + "Individual 67: 6 \n", + "Individual 68: 5 \n", + "Individual 69: 1 \n", + "\n", + "epoch: 500\n", + "Individual 0: 148 \n", + "Individual 1: 148 \n", + "Individual 2: 148 \n", + "Individual 3: 148 \n", + "Individual 4: 148 \n", + "Individual 5: 148 \n", + "Individual 6: 147 \n", + "Individual 7: 147 \n", + "Individual 8: 147 \n", + "Individual 9: 146 \n", + "Individual 10: 146 \n", + "Individual 11: 146 \n", + "Individual 12: 146 \n", + "Individual 13: 146 \n", + "Individual 14: 146 \n", + "Individual 15: 145 \n", + "Individual 16: 145 \n", + "Individual 17: 145 \n", + "Individual 18: 145 \n", + "Individual 19: 144 \n", + "Individual 20: 144 \n", + "Individual 21: 144 \n", + "Individual 22: 144 \n", + "Individual 23: 143 \n", + "Individual 24: 143 \n", + "Individual 25: 143 \n", + "Individual 26: 142 \n", + "Individual 27: 142 \n", + "Individual 28: 142 \n", + "Individual 29: 142 \n", + "Individual 30: 142 \n", + "Individual 31: 142 \n", + "Individual 32: 142 \n", + "Individual 33: 141 \n", + "Individual 34: 141 \n", + "Individual 35: 141 \n", + "Individual 36: 141 \n", + "Individual 37: 141 \n", + "Individual 38: 141 \n", + "Individual 39: 140 \n", + "Individual 40: 140 \n", + "Individual 41: 140 \n", + "Individual 42: 140 \n", + "Individual 43: 140 \n", + "Individual 44: 140 \n", + "Individual 45: 140 \n", + "Individual 46: 140 \n", + "Individual 47: 139 \n", + "Individual 48: 139 \n", + "Individual 49: 139 \n", + "Individual 50: 139 \n", + "Individual 51: 138 \n", + "Individual 52: 138 \n", + "Individual 53: 138 \n", + "Individual 54: 138 \n", + "Individual 55: 138 \n", + "Individual 56: 138 \n", + "Individual 57: 137 \n", + "Individual 58: 137 \n", + "Individual 59: 137 \n", + "Individual 60: 137 \n", + "Individual 61: 137 \n", + "Individual 62: 136 \n", + "Individual 63: 136 \n", + "Individual 64: 136 \n", + "Individual 65: 136 \n", + "Individual 66: 135 \n", + "Individual 67: 135 \n", + "Individual 68: 135 \n", + "Individual 69: 134 \n", + "\n", + "epoch: 1000\n", + "Individual 0: 207 \n", + "Individual 1: 207 \n", + "Individual 2: 207 \n", + "Individual 3: 207 \n", + "Individual 4: 207 \n", + "Individual 5: 207 \n", + "Individual 6: 207 \n", + "Individual 7: 207 \n", + "Individual 8: 207 \n", + "Individual 9: 206 \n", + "Individual 10: 206 \n", + "Individual 11: 206 \n", + "Individual 12: 205 \n", + "Individual 13: 205 \n", + "Individual 14: 205 \n", + "Individual 15: 204 \n", + "Individual 16: 204 \n", + "Individual 17: 204 \n", + "Individual 18: 203 \n", + "Individual 19: 203 \n", + "Individual 20: 203 \n", + "Individual 21: 203 \n", + "Individual 22: 203 \n", + "Individual 23: 203 \n", + "Individual 24: 203 \n", + "Individual 25: 203 \n", + "Individual 26: 203 \n", + "Individual 27: 201 \n", + "Individual 28: 201 \n", + "Individual 29: 201 \n", + "Individual 30: 201 \n", + "Individual 31: 200 \n", + "Individual 32: 199 \n", + "Individual 33: 198 \n", + "Individual 34: 198 \n", + "Individual 35: 198 \n", + "Individual 36: 198 \n", + "Individual 37: 197 \n", + "Individual 38: 197 \n", + "Individual 39: 197 \n", + "Individual 40: 197 \n", + "Individual 41: 197 \n", + "Individual 42: 196 \n", + "Individual 43: 196 \n", + "Individual 44: 196 \n", + "Individual 45: 196 \n", + "Individual 46: 196 \n", + "Individual 47: 196 \n", + "Individual 48: 195 \n", + "Individual 49: 195 \n", + "Individual 50: 195 \n", + "Individual 51: 195 \n", + "Individual 52: 194 \n", + "Individual 53: 194 \n", + "Individual 54: 194 \n", + "Individual 55: 193 \n", + "Individual 56: 193 \n", + "Individual 57: 193 \n", + "Individual 58: 192 \n", + "Individual 59: 192 \n", + "Individual 60: 192 \n", + "Individual 61: 191 \n", + "Individual 62: 191 \n", + "Individual 63: 191 \n", + "Individual 64: 191 \n", + "Individual 65: 190 \n", + "Individual 66: 190 \n", + "Individual 67: 190 \n", + "Individual 68: 190 \n", + "Individual 69: 190 \n", + "\n", + "epoch: 1500\n", + "Individual 0: 249 \n", + "Individual 1: 248 \n", + "Individual 2: 248 \n", + "Individual 3: 248 \n", + "Individual 4: 248 \n", + "Individual 5: 248 \n", + "Individual 6: 248 \n", + "Individual 7: 247 \n", + "Individual 8: 246 \n", + "Individual 9: 246 \n", + "Individual 10: 246 \n", + "Individual 11: 246 \n", + "Individual 12: 246 \n", + "Individual 13: 246 \n", + "Individual 14: 246 \n", + "Individual 15: 245 \n", + "Individual 16: 245 \n", + "Individual 17: 245 \n", + "Individual 18: 245 \n", + "Individual 19: 244 \n", + "Individual 20: 244 \n", + "Individual 21: 244 \n", + "Individual 22: 244 \n", + "Individual 23: 243 \n", + "Individual 24: 243 \n", + "Individual 25: 243 \n", + "Individual 26: 243 \n", + "Individual 27: 243 \n", + "Individual 28: 242 \n", + "Individual 29: 241 \n", + "Individual 30: 241 \n", + "Individual 31: 241 \n", + "Individual 32: 240 \n", + "Individual 33: 240 \n", + "Individual 34: 240 \n", + "Individual 35: 240 \n", + "Individual 36: 239 \n", + "Individual 37: 239 \n", + "Individual 38: 239 \n", + "Individual 39: 239 \n", + "Individual 40: 238 \n", + "Individual 41: 238 \n", + "Individual 42: 238 \n", + "Individual 43: 238 \n", + "Individual 44: 237 \n", + "Individual 45: 237 \n", + "Individual 46: 236 \n", + "Individual 47: 236 \n", + "Individual 48: 235 \n", + "Individual 49: 235 \n", + "Individual 50: 235 \n", + "Individual 51: 235 \n", + "Individual 52: 234 \n", + "Individual 53: 234 \n", + "Individual 54: 234 \n", + "Individual 55: 234 \n", + "Individual 56: 233 \n", + "Individual 57: 233 \n", + "Individual 58: 233 \n", + "Individual 59: 232 \n", + "Individual 60: 232 \n", + "Individual 61: 232 \n", + "Individual 62: 232 \n", + "Individual 63: 232 \n", + "Individual 64: 232 \n", + "Individual 65: 231 \n", + "Individual 66: 231 \n", + "Individual 67: 231 \n", + "Individual 68: 230 \n", + "Individual 69: 228 \n", + "\n", + "epoch: 2000\n", + "Individual 0: 283 \n", + "Individual 1: 283 \n", + "Individual 2: 283 \n", + "Individual 3: 283 \n", + "Individual 4: 283 \n", + "Individual 5: 283 \n", + "Individual 6: 283 \n", + "Individual 7: 282 \n", + "Individual 8: 281 \n", + "Individual 9: 281 \n", + "Individual 10: 281 \n", + "Individual 11: 281 \n", + "Individual 12: 280 \n", + "Individual 13: 279 \n", + "Individual 14: 279 \n", + "Individual 15: 279 \n", + "Individual 16: 279 \n", + "Individual 17: 279 \n", + "Individual 18: 279 \n", + "Individual 19: 279 \n", + "Individual 20: 278 \n", + "Individual 21: 277 \n", + "Individual 22: 277 \n", + "Individual 23: 277 \n", + "Individual 24: 276 \n", + "Individual 25: 275 \n", + "Individual 26: 275 \n", + "Individual 27: 275 \n", + "Individual 28: 274 \n", + "Individual 29: 274 \n", + "Individual 30: 274 \n", + "Individual 31: 274 \n", + "Individual 32: 273 \n", + "Individual 33: 273 \n", + "Individual 34: 273 \n", + "Individual 35: 273 \n", + "Individual 36: 272 \n", + "Individual 37: 272 \n", + "Individual 38: 271 \n", + "Individual 39: 271 \n", + "Individual 40: 271 \n", + "Individual 41: 271 \n", + "Individual 42: 270 \n", + "Individual 43: 270 \n", + "Individual 44: 270 \n", + "Individual 45: 270 \n", + "Individual 46: 269 \n", + "Individual 47: 269 \n", + "Individual 48: 269 \n", + "Individual 49: 269 \n", + "Individual 50: 268 \n", + "Individual 51: 268 \n", + "Individual 52: 268 \n", + "Individual 53: 268 \n", + "Individual 54: 268 \n", + "Individual 55: 268 \n", + "Individual 56: 267 \n", + "Individual 57: 267 \n", + "Individual 58: 267 \n", + "Individual 59: 267 \n", + "Individual 60: 266 \n", + "Individual 61: 266 \n", + "Individual 62: 265 \n", + "Individual 63: 265 \n", + "Individual 64: 265 \n", + "Individual 65: 264 \n", + "Individual 66: 264 \n", + "Individual 67: 263 \n", + "Individual 68: 263 \n", + "Individual 69: 262 \n", + "\n" + ] + } + ], + "source": [ + "# --------------------------------\n", + "# for more epochs\n", + "# --------------------------------\n", + "def eval_function(genome):\n", + " r = len(np.where(genome == 1)[0])\n", + " return r\n", + "\n", + "\n", + "# Evolution params\n", + "pop_size = 70\n", + "gene_length = 1000\n", + "gene_value_low = 0\n", + "gene_value_high = 100\n", + "# if to big no convergence, if to small slower\n", + "# usually choosen 0.5 - 1% thats 0.005 - 0.01\n", + "mutation_rate = 0.007\n", + "epochs = 2001\n", + "# will make 10% new children each round\n", + "children_percent = 0.01\n", + "new_children_per_epoch = int(pop_size * children_percent)\n", + "\n", + "# Evo definition\n", + "evo = Evolution(pop_size, gene_length, gene_value_low, gene_value_high)\n", + "\n", + "# IMPLEMENT ME:\n", + "# a stopping criterion that stops when the fitness does not\n", + "# rise anymore. Meaning if there is no rise in fitness after\n", + "# n epochs, stop the process\n", + "for epoch in range(epochs):\n", + " # Evo crossover\n", + " crossover_bin = []\n", + " for i in range(new_children_per_epoch):\n", + " crossover_bin.append(np.random.randint(0, 2, gene_length))\n", + "\n", + " # add 50% crossover\n", + " gen_cross = np.ones(gene_length, dtype=int)\n", + " bins_p0 = np.arange(step=1, start=0, stop=int(gene_length / 2))\n", + " gen_cross[bins_p0] = np.zeros(int(gene_length / 2), dtype=int)\n", + " crossover_bin.append(gen_cross)\n", + "\n", + " evo.crossover(crossover_bin)\n", + " # print(\"Individuals after crossover:\")\n", + " # print(evo)\n", + "\n", + " # Evo mutation\n", + " individuals_to_mutate = np.arange(\n", + " step=1, start=0, stop=pop_size - new_children_per_epoch\n", + " )\n", + " evo.mutate(mutation_rate, individuals_to_mutate)\n", + " # print(\"Individual 1 after muatation:\")\n", + " # evo.print_individual_gene(0)\n", + "\n", + " # Evo evaluation\n", + " evo.evaluate_population(eval_function, max_workers=1)\n", + " # print(\"Individuals after Evaluating:\")\n", + " # print(evo)\n", + "\n", + " # print fitness\n", + " if epoch % 500 == 0:\n", + " print(f\"epoch: {epoch}\")\n", + " evo.sort_population()\n", + " print(evo)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4a3edf04-e75c-498d-a758-307d505e7b3f", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1cddaafb-069a-42a9-8c67-a187541f085f", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eedb559c-78ed-4ed9-b519-531eb189960e", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f134f4b1-902a-4488-90ad-a7ac51180ed6", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "dec0eb1a-96a8-4220-be1e-fc783c662a8a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([1, 2])" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ind = Individual([1, 2])\n", + "a = np.array([ind], dtype=Individual)\n", + "a[0].get_genome()" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "cc665751-c86f-4d95-ab11-aa6311e0be56", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n" + ] + }, + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 13, 12, 11, 10]" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a = [1, 2, 3, 4, 5, 6, 7, 8]\n", + "b = [10, 11, 12, 13]\n", + "for i in range(len(b)):\n", + " a[-(i + 1)] = b[i]\n", + " print(i)\n", + "\n", + "a" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "f3ff5738-46c0-44ab-acaa-82e7fcedb2a8", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1]\n" + ] + }, + { + "data": { + "text/plain": [ + "array([10, 2, 0, 9])" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a = np.array([10, 0, 0, 9])\n", + "b = np.array([1, 2, 1, 1])\n", + "bins = np.array([0, 1, 0, 0])\n", + "\n", + "c = a\n", + "bins_p1 = np.where(bins == 1)[0]\n", + "print(bins_p1)\n", + "c[bins_p1] = b[bins_p1]\n", + "\n", + "c" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "b59e979f-2e51-43ec-a5f8-4cf370df5910", + "metadata": {}, + "outputs": [], + "source": [ + "population = []\n", + "r = 10\n", + "for i in range(r):\n", + " indiv = Individual([1, 1, 1])\n", + " indiv.fitness = i\n", + " population.append(indiv)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "77b4ced2-17fe-4b10-b84b-549f3a936788", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n" + ] + } + ], + "source": [ + "for item in population:\n", + " print(item.fitness)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "979f1d4a-9c40-448a-a507-64ac97bf8efa", + "metadata": {}, + "outputs": [], + "source": [ + "elements = len(population) - 1\n", + "for i in range(elements):\n", + " for w in range(elements - i):\n", + " if population[elements - w].fitness > population[elements - w - 1].fitness:\n", + " tmp = population[elements - w - 1]\n", + " population[elements - w - 1] = population[elements - w]\n", + " population[elements - w] = tmp" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "6b502192-7731-4bce-b40d-99b0eb05b8db", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "9\n", + "8\n", + "7\n", + "6\n", + "5\n", + "4\n", + "3\n", + "2\n", + "1\n", + "0\n" + ] + } + ], + "source": [ + "for item in population:\n", + " print(item.fitness)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "a4903f3d-e030-43c8-89e7-d8a21e46cd61", + "metadata": {}, + "outputs": [], + "source": [ + "indi = Individual([1, 2])" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "b13914f1-9afe-4641-949e-631b1026d40d", + "metadata": {}, + "outputs": [], + "source": [ + "a = np.array([indi, indi])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0eab0ae2-7e57-452c-8dba-bcd2b59fd627", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "402055e5-4836-473c-89ea-6c27f6c1b5ee", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "14aeb7e2-66a8-41d5-ad79-09b69f95d830", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "14e2c215-836b-4309-8f2a-f717fe87608c", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "venv_evolution", + "language": "python", + "name": "venv_evolution" + }, + "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.11.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/src/PyGMA.ipynb b/src/PyGMA.ipynb new file mode 100755 index 0000000..78d7a30 --- /dev/null +++ b/src/PyGMA.ipynb @@ -0,0 +1,33 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "1c9a80e2-37b8-46f5-94ba-d547329f2234", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "venv_evolution", + "language": "python", + "name": "venv_evolution" + }, + "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.11.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} -- GitLab