\ifx\sevenrm\undefined
  \font\sevenrm=cmr7 scaled \magstep0
\fi

\newread\MyStyle
\openin\MyStyle=src2latex.s2t
\ifeof\MyStyle
  \closein\MyStyle
\else
  \input src2latex.s2t
  \closein\MyStyle
\fi

\ifx\gtfam\undefined
  \ifx\dm\undefined
    \ifx\tendm\undefined
      \def\mc{\null}
    \else
      \def\mc{\tendm}
    \fi
  \else
    \def\mc{\dm}
  \fi
  \ifx\dg\undefined
    \ifx\tendg\undefined
      \def\gt{\null}
    \else
      \def\gt{\tendg}
    \fi
  \else
    \def\gt{\dg}
  \fi
\fi
\ifx\sc\undefined
  \def\sc{\null}
\fi

\tt\mc 

\noindent
{\tt\%}{\tt\mc \kern0.500em}Simulationsumgebung{\tt\mc \kern0.500em}für{\tt\mc \kern0.500em}den{\tt\mc \kern0.500em}Wabenbau{\tt\mc \kern0.500em}sozialer{\tt\mc \kern0.500em}Insekten

\noindent
{}\hfill

\noindent
{}global{\tt\mc \kern0.500em}DX;

\noindent
{}global{\tt\mc \kern0.500em}DY;

\noindent
{}global{\tt\mc \kern0.500em}Wabengitter;

\noindent
{}global{\tt\mc \kern0.500em}Knotenzahl;

\noindent
{}global{\tt\mc \kern0.500em}zeit;

\noindent
{}global{\tt\mc \kern0.500em}Grenzen;

\noindent
{}global{\tt\mc \kern0.500em}MittelPunkte;

\noindent
{}global{\tt\mc \kern0.500em}MittelWabe;

\noindent
{}global{\tt\mc \kern0.500em}raumplot;

\noindent
{}global{\tt\mc \kern0.500em}bebautezellen;

\noindent
{}global{\tt\mc \kern0.500em}wespenanzahl;

\noindent
{}global{\tt\mc \kern0.500em}numberofruns;

\noindent
{}global{\tt\mc \kern0.500em}numberofgaruns;

\noindent
{}global{\tt\mc \kern0.500em}gadurchlauf;

\noindent
{}global{\tt\mc \kern0.500em}animation;

\noindent
{}\hfill

\noindent
{}DX{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}41;{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Breite{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}Gitters

\noindent
{}DY{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}41;{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Höhe{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}Gitters

\noindent
{}wespenanzahl{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}uint8(1);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Zahl{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}aktiven{\tt\mc \kern0.500em}Agenten

\noindent
{}MaxSteps{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}uint32(200);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Zahl{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Schritte{\tt\mc \kern0.500em}pro{\tt\mc \kern0.500em}Simulationslauf

\noindent
{}numberofruns{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}uint8(100);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Zahl{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Simulationsläufe{\tt\mc \kern0.500em}vor{\tt\mc \kern0.500em}Anwendung{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}GA

\noindent
{}numberofgaruns{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}uint8(100);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Zahl{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Durchläufe{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}GA

\noindent
{}animation{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}false;

\noindent
{}\hfill

\noindent
{}for{\tt\mc \kern0.500em}gadurchlauf=uint8(1):numberofgaruns

\noindent
{}close{\tt\mc \kern0.500em}all;{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}schließt{\tt\mc \kern0.500em}alle{\tt\mc \kern0.500em}vorherigen{\tt\mc \kern0.500em}Fenster

\noindent
{}\hfill

\noindent
{}for{\tt\mc \kern0.500em}run=uint8(1):numberofruns

\noindent
{}{\tt\mc \kern2.000em}

\noindent
{}Wabengitter{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}hextop(DX,DY);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Erzeugen{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}hexagonalen{\tt\mc \kern0.500em}Gitters

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}Struktur{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Matrix:

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}Zeile{\tt\mc \kern0.500em}1:{\tt\mc \kern0.500em}X{\tt -}Koordinate{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}Knotenpunkts

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}Zeile{\tt\mc \kern0.500em}2:{\tt\mc \kern0.500em}Y{\tt -}Koordinate{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}Knotenpunkts

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}Zeile{\tt\mc \kern0.500em}3:{\tt\mc \kern0.500em}Markierung,{\tt\mc \kern0.500em}ob{\tt\mc \kern0.500em}Knotenpunkt{\tt\mc \kern0.500em}Wabenmittelpunkt{\tt\mc \kern0.500em}ist{\tt\mc \kern0.500em}(1{\tt /}0)

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}Zeile{\tt\mc \kern0.500em}4:{\tt\mc \kern0.500em}Belegung{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}Feldes{\tt\mc \kern0.500em}(0{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}leer,{\tt\mc \kern0.500em}1{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}Baustein{\tt\mc \kern0.500em}Typ{\tt\mc \kern0.500em}1,{\tt\mc \kern0.500em}...)

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}Knotenzahl{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}size(Wabengitter,2);{\tt\mc \kern0.500em}

\noindent
{}\hfill

\noindent
{}Position{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}DX{\tt\mc \kern0.500em}+{\tt\mc \kern0.500em}2;{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Initialisierung{\tt\mc \kern0.500em}{\tt -}{\tt\mc \kern0.500em}erster{\tt\mc \kern0.500em}Wabenmittelpunkt

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern4.000em}

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}Algorithmus{\tt\mc \kern0.500em}zur{\tt\mc \kern0.500em}Markierung{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Wabenmittelpunkte

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}{\tt -}{\tt\mc \kern0.500em}legt{\tt\mc \kern0.500em}eine{\tt\mc \kern0.500em}dritte{\tt\mc \kern0.500em}Zeile{\tt\mc \kern0.500em}in{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Matrix{\tt\mc \kern0.500em}Wabengitter{\tt\mc \kern0.500em}an{\tt\mc \kern0.500em}und{\tt\mc \kern0.500em}markiert{\tt\mc \kern0.500em}jeden

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}Knotenpunkt,{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}einem{\tt\mc \kern0.500em}Wabenmittelpunkt{\tt\mc \kern0.500em}entspricht,{\tt\mc \kern0.500em}mit{\tt\mc \kern0.500em}einer{\tt\mc \kern0.500em}1

\noindent
{}\hfill

\noindent
{}for{\tt\mc \kern0.500em}Position=DX+2:3:2{\tt *}DX{\tt -}1{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}zweite{\tt\mc \kern0.500em}Reihe{\tt\mc \kern0.500em}vom{\tt\mc \kern0.500em}zweiten{\tt\mc \kern0.500em}bis{\tt\mc \kern0.500em}zum{\tt\mc \kern0.500em}vorletzten{\tt\mc \kern0.500em}Element

\noindent
{}{\tt\mc \kern13.500em}{\tt\%}{\tt\mc \kern0.500em}mit{\tt\mc \kern0.500em}horizontalem{\tt\mc \kern0.500em}Abstand{\tt\mc \kern0.500em}3

\noindent
{}{\tt\mc \kern2.000em}Position2{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}Position;

\noindent
{}{\tt\mc \kern2.000em}while{\tt\mc \kern0.500em}Position2{\tt\mc \kern0.500em}{\tt <}{\tt\mc \kern0.500em}(Knotenzahl{\tt\mc \kern0.500em}{\tt -}{\tt\mc \kern0.500em}DX){\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}oberste{\tt\mc \kern0.500em}Zeile{\tt\mc \kern0.500em}ausschließen

\noindent
{}{\tt\mc \kern5.000em}Wabengitter(3,Position2){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}1;{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Setze{\tt\mc \kern0.500em}Markierung{\tt\mc \kern0.500em}für{\tt\mc \kern0.500em}Mittelpunkt

\noindent
{}{\tt\mc \kern5.000em}Position2{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}Position2{\tt\mc \kern0.500em}+{\tt\mc \kern0.500em}2{\tt\mc \kern0.500em}{\tt *}{\tt\mc \kern0.500em}DX;

\noindent
{}{\tt\mc \kern2.000em}end

\noindent
{}{\tt\mc \kern2.000em}Position2{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}Position{\tt\mc \kern0.500em}+{\tt\mc \kern0.500em}DX{\tt\mc \kern0.500em}+{\tt\mc \kern0.500em}2;

\noindent
{}{\tt\mc \kern2.000em}if{\tt\mc \kern0.500em}(mod(Position2,DX){\tt\mc \kern0.500em}{\tt >}{\tt\mc \kern0.500em}1){\tt\mc \kern0.500em}{\tt\&}{\tt\&}{\tt\mc \kern0.500em}(mod(Position2,DX){\tt\mc \kern0.500em}{\tt <}{\tt\mc \kern0.500em}DX){\tt\mc \kern0.500em}

\noindent
{}{\tt\mc \kern3.500em}while{\tt\mc \kern0.500em}Position2{\tt\mc \kern0.500em}{\tt <}{\tt\mc \kern0.500em}Knotenzahl{\tt\mc \kern0.500em}{\tt -}{\tt\mc \kern0.500em}DX

\noindent
{}{\tt\mc \kern6.500em}Wabengitter(3,Position2){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}1;

\noindent
{}{\tt\mc \kern6.500em}Position2{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}Position2{\tt\mc \kern0.500em}+{\tt\mc \kern0.500em}2{\tt *}DX;

\noindent
{}{\tt\mc \kern3.500em}end{\tt\mc \kern2.000em}

\noindent
{}{\tt\mc \kern2.000em}end{\tt\mc \kern1.000em}

\noindent
{}end

\noindent
{}{\tt\mc \kern6.000em}

\noindent
{}MittelPunkte{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}find(Wabengitter(3,:));{\tt\mc \kern0.500em}

\noindent
{}{\tt\mc \kern1.000em}{\tt\%}{\tt\mc \kern0.500em}erzeugt{\tt\mc \kern0.500em}einen{\tt\mc \kern0.500em}Vektor{\tt\mc \kern0.500em}mit{\tt\mc \kern0.500em}Indizes{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Wabenmittelpunkte

\noindent
{}Grenzen{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}max(Wabengitter,[],2);{\tt\mc \kern0.500em}

\noindent
{}{\tt\mc \kern1.000em}{\tt\%}{\tt\mc \kern0.500em}ereugt{\tt\mc \kern0.500em}einen{\tt\mc \kern0.500em}Vektor,{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}Endkoordinaten{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}Gitters{\tt\mc \kern0.500em}enthält

\noindent
{}MittelWabe{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}MittelPunkte(ceil(length(MittelPunkte){\tt\mc \kern0.500em}{\tt /}{\tt\mc \kern0.500em}2));

\noindent
{}{\tt\mc \kern1.000em}{\tt\%}{\tt\mc \kern0.500em}Index{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}annähernd{\tt\mc \kern0.500em}mittleren{\tt\mc \kern0.500em}Wabe{\tt\mc \kern0.500em}(Ausgangspunkt{\tt\mc \kern0.500em}für{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}Simulation)

\noindent
{}mittelnachbarn{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}nachbarn(MittelWabe);

\noindent
{}Wabengitter(4,MittelWabe){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}1;{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Baustein{\tt\mc \kern0.500em}vom{\tt\mc \kern0.500em}Typ{\tt\mc \kern0.500em}1{\tt\mc \kern0.500em}an{\tt\mc \kern0.500em}Mittelpunkt{\tt\mc \kern0.500em}gesetzt

\noindent
{}{\tt\mc \kern15.500em}{\tt\%}{\tt\mc \kern0.500em}Wird{\tt\mc \kern0.500em}als{\tt\mc \kern0.500em}Anfangspunkt{\tt\mc \kern0.500em}benötigt

\noindent
{}for{\tt\mc \kern0.500em}nachbarindex=1:6

\noindent
{}{\tt\mc \kern2.000em}Wabengitter(4,mittelnachbarn(nachbarindex)){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}1;

\noindent
{}end{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}sechs{\tt\mc \kern0.500em}direkten{\tt\mc \kern0.500em}Nachbarn{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}Mittelpunkts{\tt\mc \kern0.500em}werden{\tt\mc \kern0.500em}als{\tt\mc \kern0.500em}bebaut{\tt\mc \kern0.500em}markiert

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern1.000em}if{\tt\mc \kern0.500em}(gadurchlauf{\tt\mc \kern0.500em}=={\tt\mc \kern0.500em}numberofgaruns){\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}nur{\tt\mc \kern0.500em}beim{\tt\mc \kern0.500em}letzten{\tt\mc \kern0.500em}Durchlauf{\tt\mc \kern0.500em}grafisch{\tt\mc \kern0.500em}anzeigen

\noindent
{}{\tt\mc \kern1.500em}

\noindent
{}{\tt\mc \kern3.000em}close{\tt\mc \kern0.500em}all;{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}schließt{\tt\mc \kern0.500em}alle{\tt\mc \kern0.500em}Fenster{\tt\mc \kern0.500em}{\tt -}{\tt\mc \kern0.500em}Fix{\tt\mc \kern0.500em}um{\tt\mc \kern0.500em}Absturz{\tt\mc \kern0.500em}zu{\tt\mc \kern0.500em}verhindern

\noindent
{}{\tt\mc \kern3.000em}

\noindent
{}scrsz{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}get(0,'ScreenSize');

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}erzeuge{\tt\mc \kern0.500em}figure{\tt\mc \kern0.500em}für{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}graphische{\tt\mc \kern0.500em}Anzeige

\noindent
{}visual{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}figure('Name',['GA{\tt\mc \kern0.500em}'{\tt\mc \kern0.500em}num2str(gadurchlauf){\tt\mc \kern0.500em}'{\tt\mc \kern0.500em}RS{\tt\mc \kern0.500em}'{\tt\mc \kern0.500em}num2str(run)],{\tt\mc \kern0.500em}...

\noindent
{}{\tt\mc \kern8.000em}'Position',[1{\tt\mc \kern0.500em}scrsz(4){\tt\mc \kern0.500em}scrsz(3){\tt\mc \kern0.500em}scrsz(4)],{\tt\mc \kern0.500em}...

\noindent
{}{\tt\mc \kern8.000em}'NumberTitle','off');

\noindent
{}raumplot{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}gca;

\noindent
{}hold{\tt\mc \kern0.500em}on;{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}verhindern,{\tt\mc \kern0.500em}dass{\tt\mc \kern0.500em}gezeichnetes{\tt\mc \kern0.500em}wieder{\tt\mc \kern0.500em}gelöscht{\tt\mc \kern0.500em}wird

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}view(3);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Betrachtungswinkel{\tt\mc \kern0.500em}einstellen

\noindent
{}axis(raumplot,'manual');

\noindent
{}set(raumplot,{\tt\mc \kern0.500em}'DataAspectRatio',{\tt\mc \kern0.500em}[1{\tt\mc \kern0.500em}1{\tt\mc \kern0.500em}1]{\tt\mc \kern0.500em});{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em},{\tt\mc \kern0.500em}...

\noindent
{}{\tt\mc \kern4.500em}{\tt\%}{\tt\mc \kern0.500em}'PlotBoxAspectRatio',{\tt\mc \kern0.500em}[1{\tt\mc \kern0.500em}1{\tt\mc \kern0.500em}1]{\tt\mc \kern0.500em});

\noindent
{}axis(raumplot,[{\tt -}2{\tt\mc \kern0.500em}(Grenzen(1)+2){\tt\mc \kern0.500em}{\tt -}2{\tt\mc \kern0.500em}(Grenzen(2)+2)]);

\noindent
{}camlight('right');

\noindent
{}camproj('perspective');

\noindent
{}lighting{\tt\mc \kern0.500em}gouraud;

\noindent
{}\hfill

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}leeres{\tt\mc \kern0.500em}Gitter{\tt\mc \kern0.500em}anzeigen

\noindent
{}plotgitter(Wabengitter,{\tt\mc \kern0.500em}raumplot);

\noindent
{}plotwabe(MittelWabe,{\tt\mc \kern0.500em}raumplot,{\tt\mc \kern0.500em}8);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}Anfangswabe{\tt\mc \kern0.500em}wird{\tt\mc \kern0.500em}markiert

\noindent
{}for{\tt\mc \kern0.500em}nachbarindex=1:6

\noindent
{}{\tt\mc \kern2.000em}plotwabe(mittelnachbarn(nachbarindex),{\tt\mc \kern0.500em}raumplot,{\tt\mc \kern0.500em}8);

\noindent
{}end{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}sechs{\tt\mc \kern0.500em}unmittelbaren{\tt\mc \kern0.500em}Nachbarzellen{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Mittelwabe{\tt\mc \kern0.500em}werden{\tt\mc \kern0.500em}auch{\tt\mc \kern0.500em}gesetzt

\noindent
{}{\tt\mc \kern2.000em}{\tt\%}{\tt\mc \kern0.500em}verhindert{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}Notwendigkeit{\tt\mc \kern0.500em}einer{\tt\mc \kern0.500em}Einserregel

\noindent
{}{\tt\mc \kern1.000em}end

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}wespe(numberofruns,wespenanzahl){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}bauagent([1.0{\tt\mc \kern0.500em}1.0],{\tt\mc \kern0.500em}1);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}array{\tt\mc \kern0.500em}preallocation

\noindent
{}\hfill

\noindent
{}if{\tt\mc \kern0.500em}(gadurchlauf{\tt\mc \kern0.500em}=={\tt\mc \kern0.500em}1){\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}nur{\tt\mc \kern0.500em}im{\tt\mc \kern0.500em}ersten{\tt\mc \kern0.500em}Durchlauf{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}GA{\tt\mc \kern0.500em}

\noindent
{}{\tt\mc \kern2.000em}

\noindent
{}{\tt\mc \kern2.000em}for{\tt\mc \kern0.500em}nummer=uint8(1):wespenanzahl

\noindent
{}{\tt\mc \kern4.000em}wespe(run,nummer){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}bauagent(Wabengitter(1:2,{\tt\mc \kern0.500em}MittelWabe)',{\tt\mc \kern0.500em}nummer);{\tt\mc \kern0.500em}

\noindent
{}{\tt\mc \kern4.000em}{\tt\%}{\tt\mc \kern0.500em}erzeugt{\tt\mc \kern0.500em}ein{\tt\mc \kern0.500em}Objekt{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Klasse{\tt\mc \kern0.500em}Bauagent{\tt\mc \kern0.500em}auf{\tt\mc \kern0.500em}den{\tt\mc \kern0.500em}Koordinaten

\noindent
{}{\tt\mc \kern4.000em}{\tt\%}{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}mittleren{\tt\mc \kern0.500em}Wabe

\noindent
{}{\tt\mc \kern2.000em}end

\noindent
{}{\tt\mc \kern2.000em}{\tt\%}{\tt\mc \kern0.500em}erzeugt{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}durch{\tt\mc \kern0.500em}wespenanzahl{\tt\mc \kern0.500em}festgelegte{\tt\mc \kern0.500em}Menge{\tt\mc \kern0.500em}von{\tt\mc \kern0.500em}Objekten{\tt\mc \kern0.500em}der

\noindent
{}{\tt\mc \kern2.000em}{\tt\%}{\tt\mc \kern0.500em}Klasse{\tt\mc \kern0.500em}'agent'

\noindent
{}{\tt\mc \kern2.000em}global{\tt\mc \kern0.500em}wespe;

\noindent
{}else

\noindent
{}{\tt\mc \kern2.000em}for{\tt\mc \kern0.500em}nummer=uint8(1):wespenanzahl

\noindent
{}{\tt\mc \kern4.000em}wespe(run,nummer).BuildCounter{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}0;

\noindent
{}{\tt\mc \kern4.000em}wespe(run,nummer).Position{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}Wabengitter(1:2,{\tt\mc \kern0.500em}MittelWabe)';

\noindent
{}{\tt\mc \kern2.000em}end

\noindent
{}end

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern1.000em}

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}Simulationsstart

\noindent
{}bebautezellen{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}find(Wabengitter(4,:));{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Update{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Liste{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Indizes{\tt\mc \kern0.500em}aller{\tt\mc \kern0.500em}bebauten{\tt\mc \kern0.500em}Zellen

\noindent
{}\hfill

\noindent
{}grafik{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}gcf;

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}moviefile{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}avifile('simulation{\tt\_\kern.141em}04.avi');

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}moviefile.Quality{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}100;

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}moviefile.fps{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}5;

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern2.000em}for{\tt\mc \kern0.500em}zeit=uint32(1):MaxSteps{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}aktuelle{\tt\mc \kern0.500em}Simulationszeit{\tt\mc \kern0.500em}als{\tt\mc \kern0.500em}Integerwert{\tt\mc \kern0.500em}{\tt -}{\tt\mc \kern0.500em}wird{\tt\mc \kern0.500em}in{\tt\mc \kern0.500em}jedem{\tt\mc \kern0.500em}Zeitschritt{\tt\mc \kern0.500em}um{\tt\mc \kern0.500em}1{\tt\mc \kern0.500em}erhöht{\tt\mc \kern0.500em}

\noindent
{}{\tt\mc \kern4.000em}for{\tt\mc \kern0.500em}wespennummer=uint8(1):wespenanzahl

\noindent
{}{\tt\mc \kern6.000em}wespe(run,wespennummer).movebuild();

\noindent
{}{\tt\mc \kern4.000em}end

\noindent
{}{\tt\mc \kern4.000em}{\tt\%}{\tt\mc \kern0.500em}plotwaben(Wabengitter);

\noindent
{}{\tt\mc \kern4.000em}{\tt\%}{\tt\mc \kern0.500em}drawnow;

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern4.000em}{\tt\%}{\tt\mc \kern0.500em}film{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}getframe(grafik);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}videoaufzeichnung

\noindent
{}{\tt\mc \kern4.000em}{\tt\%}{\tt\mc \kern0.500em}moviefile{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}addframe(moviefile,film);

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern4.000em}{\tt\%}{\tt\mc \kern0.500em}displayString{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}['Zeit:{\tt\mc \kern0.500em}'{\tt\mc \kern0.500em}num2str(Zeit){\tt\mc \kern0.500em}];

\noindent
{}{\tt\mc \kern4.000em}{\tt\%}{\tt\mc \kern0.500em}text(5,5,displayString);

\noindent
{}{\tt\mc \kern2.000em}end

\noindent
{}{\tt\mc \kern2.000em}

\noindent
{}[fitnesswert,{\tt\mc \kern0.500em}idealwert,{\tt\mc \kern0.500em}aussenlaenge,{\tt\mc \kern0.500em}wabenanzahl,{\tt\mc \kern0.500em}quotient]{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}fitness(Wabengitter);

\noindent
{}outp{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}sprintf('run{\tt\mc \kern0.500em}{\tt\%}u{\tt\mc \kern0.500em}{\tt\char92}n{\tt\mc \kern0.500em}fitness{\tt\mc \kern0.500em}{\tt\%}f{\tt\mc \kern0.500em}{\tt\char92}n{\tt\mc \kern0.500em}idealwert{\tt\mc \kern0.500em}{\tt\%}f{\tt\mc \kern0.500em}{\tt\char92}n{\tt\mc \kern0.500em}aussenlaenge{\tt\mc \kern0.500em}{\tt\%}d{\tt\mc \kern0.500em}{\tt\char92}n{\tt\mc \kern0.500em}wabenzahl{\tt\mc \kern0.500em}{\tt\%}d{\tt\mc \kern0.500em}{\tt\char92}n{\tt\mc \kern0.500em}quotient{\tt\mc \kern0.500em}{\tt\%}f',{\tt\mc \kern0.500em}...

\noindent
{}{\tt\mc \kern4.000em}run,{\tt\mc \kern0.500em}fitnesswert,{\tt\mc \kern0.500em}idealwert,{\tt\mc \kern0.500em}aussenlaenge,{\tt\mc \kern0.500em}wabenanzahl,{\tt\mc \kern0.500em}quotient)

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern2.000em}overallfitness(run){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}quotient;{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}legt{\tt\mc \kern0.500em}einen{\tt\mc \kern0.500em}Vektor{\tt\mc \kern0.500em}overallfitness{\tt\mc \kern0.500em}an

\noindent
{}{\tt\mc \kern8.500em}{\tt\%}{\tt\mc \kern0.500em}hier{\tt\mc \kern0.500em}wird{\tt\mc \kern0.500em}für{\tt\mc \kern0.500em}den{\tt\mc \kern0.500em}Phänotyp{\tt\mc \kern0.500em}(strukturelles{\tt\mc \kern0.500em}Simulationsergebnis)

\noindent
{}{\tt\mc \kern8.500em}{\tt\%}{\tt\mc \kern0.500em}jedes{\tt\mc \kern0.500em}Regelsatzes{\tt\mc \kern0.500em}seine{\tt\mc \kern0.500em}Overall{\tt -}Fitness{\tt\mc \kern0.500em}abgespeichert

\noindent
{}{\tt\mc \kern8.500em}{\tt\%}{\tt\mc \kern0.500em}Dient{\tt\mc \kern0.500em}als{\tt\mc \kern0.500em}Basis{\tt\mc \kern0.500em}für{\tt\mc \kern0.500em}den{\tt\mc \kern0.500em}GA

\noindent
{}end

\noindent
{}\hfill

\noindent
{}strengthga(overallfitness);{\tt\mc \kern0.500em}{\tt\%}{\tt\mc \kern0.500em}Aufruf{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}GA{\tt\mc \kern0.500em}zur{\tt\mc \kern0.500em}Erzeugung{\tt\mc \kern0.500em}neuer{\tt\mc \kern0.500em}Regelsätze

\noindent
{}{\tt\mc \kern14.000em}{\tt\%}{\tt\mc \kern0.500em}mit{\tt\mc \kern0.500em}anderen{\tt\mc \kern0.500em}Fitnesswerten

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern14.000em}numberofruns{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}size(wespe,1);

\noindent
{}{\tt\mc \kern14.000em}{\tt\%}{\tt\mc \kern0.500em}Update{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Anzahl{\tt\mc \kern0.500em}der{\tt\mc \kern0.500em}Durchläufe

\noindent
{}{\tt\mc \kern14.000em}{\tt\%}{\tt\mc \kern0.500em}{\tt -}{\tt\mc \kern0.500em}wenn{\tt\mc \kern0.500em}neue{\tt\mc \kern0.500em}Individuen{\tt\mc \kern0.500em}(Regelsätze)

\noindent
{}{\tt\mc \kern14.000em}{\tt\%}{\tt\mc \kern0.500em}dazukommen,{\tt\mc \kern0.500em}müssen{\tt\mc \kern0.500em}die{\tt\mc \kern0.500em}auch{\tt\mc \kern0.500em}berücksichtigt

\noindent
{}{\tt\mc \kern14.000em}{\tt\%}{\tt\mc \kern0.500em}werden

\noindent
{}{\tt\mc \kern14.000em}

\noindent
{}{\tt\mc \kern14.000em}[bestwert,{\tt\mc \kern0.500em}bestindex]{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}max(overallfitness);

\noindent
{}{\tt\mc \kern15.000em}{\tt\%}{\tt\mc \kern0.500em}ermittelt{\tt\mc \kern0.500em}den{\tt\mc \kern0.500em}Regelsatz{\tt\mc \kern0.500em}mit{\tt\mc \kern0.500em}bester{\tt\mc \kern0.500em}Fitness

\noindent
{}{\tt\mc \kern14.000em}maxvektor(gadurchlauf,1){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}bestwert;

\noindent
{}{\tt\mc \kern14.000em}maxvektor(gadurchlauf,2){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}bestindex;

\noindent
{}{\tt\mc \kern14.000em}maxvektor(gadurchlauf,3){\tt\mc \kern0.500em}={\tt\mc \kern0.500em}mean(overallfitness);

\noindent
{}end

\noindent
{}\hfill

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}close(grafik);

\noindent
{}{\tt\%}{\tt\mc \kern0.500em}moviefile{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}close(moviefile);

\noindent
{}\hfill

\noindent
{}outp{\tt\mc \kern0.500em}={\tt\mc \kern0.500em}sprintf('maximaler{\tt\mc \kern0.500em}Fitnesswert{\tt\mc \kern0.500em}{\tt /}{\tt\mc \kern0.500em}Index{\tt\mc \kern0.500em}des{\tt\mc \kern0.500em}Regelsatzes{\tt\mc \kern0.500em}{\tt /}{\tt\mc \kern0.500em}Durchschnittsfitness')

\noindent
{}maxvektor

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern2.000em}

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}\hfill

\noindent
{}{\tt\mc \kern4.000em}

\rm\mc
