Examples of ZInfo


Examples of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.ZInfo

    public void step(final Wink simZyk) {
        LinkedList<Transition> bedingungen;
        Transition aktBed;
        int aktion;
        int parameter;
        ZInfo zusatz;
        int folgeZ = 0;
        Iterator<Transition> it;
        int i = 0;
       
        while (i < this.conds.length) {
            if (this.conds[i].evaluiere(this)) {
                if (this.initial || i != this.aktAut) {
                    this.aktAut = i;
                    this.vAut[this.aktAut].setzeChanged();
                    this.vAut[this.aktAut].notifyObservers(
                            new Integer(this.aktAut));
                    this.initial = false;
                }
                break;
            }
            i++;
        }
       
        this.expAktZyklen++;
        this.fitAktZyklen[this.aktAut]++;
        this.fitRedAktZyklen[this.aktAut]++;
        this.aktivZyklen[this.aktAut]++;
        this.mutAktZyklen++;
       
        if (this.fitRedAktZyklen[this.aktAut] > this.fitRedZyklen) {
            this.setFitness(this.aktAut,
                            (int) (this.getFitness()[this.aktAut]
                                    / this.fitRedWert));
            this.fitRedAktZyklen[this.aktAut] = 0;
        }
       
        if (simZyk.getLastTick() % this.fitZyklen == 0) {
            this.befehle.clear();
            this.befehle.add(new Integer(this.lastBf));

            this.setFitness(this.aktAut,
                            this.getFitness()[this.aktAut]
                            + this.fitVs[this.aktAut].fitness(
                                    (RobEA) this));
        }

        if (this.umg.existsPlugin(new EvolutionPluginCompletelyEvolvable().id())) {
            if (this.mutAktZyklen > this.mutZyklen) {
                this.mutV = true;
                this.mutiere();
                this.mutAktZyklen = 0;
                this.mutV = false;
                GlobaleMARBVariablen.setVMutationInLetztemZyklus(true);
            } else {
                this.mutV = false;
                GlobaleMARBVariablen.setVMutationInLetztemZyklus(false);
            }
           
            // Mutieren der Bedingungen deaktiviert.
            // if (this.condMutAktZyklen >
            // this.pars.getParWertLong().getCondMutZyk()) {
            // this.mutiereBeds();
            // this.condMutAktZyklen = 0;
            // }
        }
       
        if (this.aktZustand[this.aktAut] == null) {
            this.aktZustand[this.aktAut]
                            = this.vAut[this.aktAut].holeStartzustand();
        }

        if (this.isSelektiert()) {
            if (this.aktZustand[this.aktAut] != null) {
                this.vAut[this.aktAut].setzeChanged();
                this.vAut[this.aktAut].notifyObservers(
                        this.aktZustand[this.aktAut]);
            }
        }

        if (this.aktZustand[this.aktAut] != null) {
            zusatz = this.aktZustand[this.aktAut].getInfo();
            aktion = zusatz.getAktion();
            parameter = zusatz.getParam();

            this.gesamtAktion(aktion, parameter);
           
            this.lastBf = aktion;
           
            bedingungen = zusatz.getBeds();
            it = bedingungen.iterator();
            this.aktZustand[this.aktAut] = null;
            while (it.hasNext() && folgeZ == 0) {
                aktBed = it.next();
                if (aktBed.evaluiere(this)) {
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.ZInfo

                            final int knotNam,
                            final int setValue,
                            final EndlicherAutomat aut) {
       
        Knoten knot = aut.holeKnoten(knotNam);
        ZInfo zusatz;
        int set;
        int setInst;
       
        if (knot == null) {
            this.insertNode(knotNam, aut);
            knot = aut.holeKnoten(knotNam);
        }
       
        zusatz = knot.getInfo();
        set = setValue % 256;
        if (set == 0) {
            set++;
        }

        if (mode == 1) { // Change instruction.
            setInst = StaticMethods.modZwischen(
                    setValue,
                    StaticMethods.minBef(this.modus),
                    StaticMethods.maxBef(this.modus, this.pars),
                    StaticMethods.verboteneBefehle(this.modus, this.pars));
           
            zusatz.setAkt(setInst);
        }
        if (mode == 2) { // Change parameter.
            zusatz.setPar(set);
        }
        if (mode == 3) { // Change additional parameter.
            zusatz.setAlter(set);
        }

        this.instrCounter++;
    }
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.ZInfo

        ArrayList<Integer> knot1;
        Iterator<Integer> it, it1;
        Iterator<Transition> it3;
        Integer aktKnNum;
        Knoten aktKn;
        ZInfo info;
        Knoten zielKn;
        Integer zielKnNum;
        Condition aktBed;
        Condition neuBed = null;
        Condition zwischBed;
        int numOrig1, numOrig2;
        int idlBefehl;
        EndlicherAutomat[] endAs = new EndlicherAutomat[endAuts.length];
        LinkedList<Transition> trans;
        Transition tran;
        String[] args = {"log 4"};
       
        if (conds == null
                || endAuts.length != conds.length
                || endAuts.length == 0) {
            ParCollection parColl = GlobalVariables.getPrematureParameters();
            parColl.overwriteParameterList(args);
            StaticMethods.log(StaticMethods.LOG_ERROR,
                          "Gesamtautomat konnte nicht erzeugt werden.",
                          parColl);
        }
       
        for (int i = 0; i < endAs.length; i++) {
            endAs[i] = new EndlicherAutomat();
           
            if (params.getParValueBoolean("UseTranslatorWITHCompletingTransitions")) {
                endAs[i].generateFromSequence(
                        endAuts[i].erzeugeStringSeq(),
                        eas.simulation.spatial.sim2D.marbSimulation.translator.ConstantsTranslator.getStdTranslatorBE(params),
                        false, params);
            } else {
                endAs[i].generateFromSequence(
                        endAuts[i].erzeugeStringSeq(),
                        ConstantsTranslatorWOC.getStdTranslatorBE(params),
                        false, params);
            }
           
            if (endAs[i].istLeer()) {
                endAs[i].einfuegenKnoten(Integer.MAX_VALUE,
                        StaticMethods.posSuch(
                                eas.simulation.ConstantsSimulation.getBefehlNamenArray(params),
                                "stp"),
                        1,
                        1);
               
                endAs[i].setStart(endAs[i].holeKnoten(Integer.MAX_VALUE));
            }
        }
       
        // Neue Knoten zuordnen.
        for (int i = 0; i < endAs.length; i++) {
            knotZuord[i] = new HashMap<Integer, Integer>();
           
            knot = new ArrayList<Integer>(endAs[i].holAdj().keySet());
            it = knot.iterator();

            while (it.hasNext()) {
                aktKnNum = it.next();
                aktKn = endAs[i].holeKnoten(aktKnNum);
                info = aktKn.getInfo();
                neu.einfuegenKnoten(lfdNr,
                                    info.getAktion(),
                                    info.getParam(),
                                    info.getAlter());
               
                knotZuord[i].put(aktKnNum, lfdNr);
                lfdNr++;
            }
        }
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.ZInfo

     *          aktuellen Zustand keine Scriptinstruktion decodiert wurde.
     */
    private String naechsterZustand() {
        String inst = "";
        Knoten aktZust = this.holeKnoten(this.aktZustand);
        ZInfo info;
        LinkedList<Transition> bedingungen;
        int aktion;
        int par, parStand;
        int zusatz, zusatzStand;
        int regNumZiel;
        int regNumQuelle;
        int scrAktion;
        int k;
        int zwisch;
       
        if (this.boc || this.eoc) {
            return null;
        }
       
        if (aktZust == null) {
            aktZust = this.holeStartzustand();
           
            if (aktZust == null) {
                return null;
            }
           
            this.aktZustand = aktZust.holeName();
        }
       
        info = aktZust.getInfo();
        aktion = info.getAktion();
       
        if (!this.pars.getParValueBoolean("UseTranslatorWITHCompletingTransitions") && aktion == 106) {
            StaticMethods.logError("\nTranslator-Befehl 106 aufgetreten in "
                    + Arrays.deepToString(Thread.currentThread().getStackTrace()), this.pars);
            throw new RuntimeException("\nTranslator-Befehl 106 aufgetreten.");
        }
       
        // Aktion ermitteln und zusammenstellen.
        // This should work for both WC and WOC.
        if (aktion == ConstantsTranslator.AUT_ADD_EDGE
                || aktion == ConstantsTranslator.AUT_ADD_NODE
                || aktion == ConstantsTranslator.AUT_CHANGE_ACT
                || aktion == ConstantsTranslator.AUT_CHANGE_AGE
                || aktion == ConstantsTranslator.AUT_CHANGE_PAR
                || aktion == ConstantsTranslator.AUT_EXTEND_COND_H
                || aktion == ConstantsTranslator.AUT_EXTEND_COND_C
                || aktion == ConstantsTranslator.AUT_EXTEND_COND_O
                || aktion == ConstantsTranslator.AUT_ERGAENZ_COND) {
            // Topologische Aktionen:
           
            parStand = info.getParam();
            parStand = StaticMethods.modZwischen(
                    parStand,
                    StaticMethods.minVar(StaticMethods.MODUS_TRANSLATOR),
                    StaticMethods.maxVar(StaticMethods.MODUS_TRANSLATOR));
           
            if (aktion == ConstantsTranslator.AUT_EXTEND_COND_H) {
                k = 255;
            } else if (aktion == ConstantsTranslator.AUT_EXTEND_COND_O) {
                // Für Konstanten siehe Konstanten.autTOscript()
                zwisch = StaticMethods.modZwischen(this.getH(parStand), 4, 16);
                if (zwisch == 12) {
                    zwisch++;
                }
               
                // This should work for both WC and WOC.
                k = ConstantsTranslator.autTOscript(zwisch) - zwisch;
//                k = Konstanten.autTOscript(
//                        this.getH(parStand))
//                        - this.getH(parStand);
            } else {
                k = 0;
            }

            if (this.pars.getParValueBoolean("UseTranslatorWITHCompletingTransitions")) {
                scrAktion = ConstantsTranslator.scrBefNum(aktion);
            } else {
                scrAktion = ConstantsTranslatorWOC.scrBefNum(aktion);
            }
           
//            System.out.println(
//                    aktion
//                        + ": "
//                        + ConstantsTranslatorWOC.scrBefNum(aktion)
//                        + " ("
//                        + ConstantsTranslator.scrBefNum(aktion)
//                        + ")");
           
            inst += scrAktion;
            inst += "," + (this.getH(parStand) + k);
           
            // Zusatzparameter vorhanden?
            // This should work in both WC and WOC mode.
            if (ConstantsScript.BEF_PAR[scrAktion] == 2) {
                zusatzStand = info.getAlter();
                zusatzStand = StaticMethods.modZwischen(
                        zusatzStand,
                        StaticMethods.minVar(StaticMethods.MODUS_TRANSLATOR),
                        StaticMethods.maxVar(StaticMethods.MODUS_TRANSLATOR));
               
                inst += "," + this.getH(zusatzStand);

                // Speichere automatisch den Zusatzparameter in Reg2 (= H102).
                // This should work for both WC and WOC.
                if (aktion != ConstantsTranslator.AUT_EXTEND_COND_C
                        && aktion != ConstantsTranslator.AUT_EXTEND_COND_H
                        && aktion != ConstantsTranslator.AUT_EXTEND_COND_O) {
                    this.setH(
                            ConstantsTranslator.SENS_REG_MIN + 1,
                            this.getH(zusatzStand));
                }
            }
           
            // Speichere automatisch den Parameter in Reg1 (= H101).
            // This should work for both WC and WOC.
            if (aktion != ConstantsTranslator.AUT_EXTEND_COND_C
                    && aktion != ConstantsTranslator.AUT_EXTEND_COND_H
                    && aktion != ConstantsTranslator.AUT_EXTEND_COND_O) {
                this.setH(ConstantsTranslator.SENS_REG_MIN, this.getH(parStand));
            }
        } else if (aktion == ConstantsTranslator.AUT_REG_CONST) {
            // Register-Aktion (Konstante setzen):
           
            par = info.getParam();
            zusatz = info.getAlter();
            regNumZiel = StaticMethods.modZwischen(
                    par,
                    StaticMethods.minVar(StaticMethods.MODUS_TRANSLATOR),
                    StaticMethods.maxVar(StaticMethods.MODUS_TRANSLATOR));
            this.setH(regNumZiel, zusatz);
        } else if (aktion == ConstantsTranslator.AUT_REG_VAR) {
            // Register-Aktion (anderes Register kopieren):

            par = info.getParam();
            zusatz = info.getAlter();
            regNumQuelle = StaticMethods.modZwischen(
                    par,
                    StaticMethods.minVar(StaticMethods.MODUS_TRANSLATOR),
                    StaticMethods.maxVar(StaticMethods.MODUS_TRANSLATOR));
            regNumZiel = StaticMethods.modZwischen(
                    zusatz,
                    StaticMethods.minVar(StaticMethods.MODUS_TRANSLATOR),
                    StaticMethods.maxVar(StaticMethods.MODUS_TRANSLATOR));
           
            this.setH(regNumZiel, this.getH(regNumQuelle));
        }
       
        /*
         * IDLE-Aktion (NXT): Bedeutet, dass nur der Code-Zeiger verschoben
         * wird; wird nicht explizit behandelt.
         */

        StaticMethods.log(
                StaticMethods.LOG_STAGE1,
                "Translator: Zustand "
                    + this.aktZustand
                    + ", Token "
                    + this.getAktToken()
                    + " / "
                    + this.getLookAheadToken()
                    + ": "
                    + new Script(inst, this.pars),
                this.pars);
       
        // Folgezustand festlegen, Code-Zeiger verschieben.
        bedingungen = info.getBeds();
        this.aktZustand = -1;
        for (Transition aktBed : bedingungen) {
            if (aktBed.evaluiere(this)) {
                this.aktZustand = aktBed.getFolgezustand();
                break;
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.ZInfo

    protected void naechsterZustand() {
        int aktion;
        int parameter;
        LinkedList<Transition> bedingungen;
        Transition aktBed;
        ZInfo zusatz;
        int folgeZ = 0;
        Iterator<Transition> it;
        int i = 0;
       
        while (i < this.conds.length) {
            if (this.conds[i].evaluiere(this)) {
                if (this.initial || i != this.aktAut) {
                    this.aktAut = i;
                    this.vAut[this.aktAut].setzeChanged();
                    this.vAut[this.aktAut].notifyObservers(
                            new Integer(this.aktAut));
                    this.initial = false;
                }
                break;
            }
            i++;
        }
       
        this.expAktZyklen++;
        this.fitAktZyklen[this.aktAut]++;
        this.fitRedAktZyklen[this.aktAut]++;
        this.aktivZyklen[this.aktAut]++;
        this.mutAktZyklen++;
       
        if (this.fitRedAktZyklen[this.aktAut] > this.fitRedZyklen) {
            this.setFitness(this.aktAut,
                            (int) (this.getFitness()[this.aktAut]
                                    / this.fitRedWert));
            this.fitRedAktZyklen[this.aktAut] = 0;
        }
       
        if (this.fitAktZyklen[this.aktAut] > this.fitZyklen) {
            this.befehle.clear();
            this.befehle.add(new Integer(this.lastBf));


            this.fitAktZyklen[this.aktAut] = 0;
        }

//        if (this.pars.getEvol().booleanValue()) {
        if (this.umg.getSimulation().isEvolution()) {
            if (this.mutAktZyklen > this.mutZyklen) {
                this.mutV = true;
                this.mutiere();
                this.mutAktZyklen = 0;
                this.mutV = false;
                GlobaleMARBVariablen.setVMutationInLetztemZyklus(true);
            } else {
                this.mutV = false;
                GlobaleMARBVariablen.setVMutationInLetztemZyklus(false);
            }
           
        }
       
        if (this.aktZustand[this.aktAut] == null) {
            this.aktZustand[this.aktAut]
                            = this.vAut[this.aktAut].holeStartzustand();
        }

        if (this.isSelektiert()) {
            if (this.aktZustand[this.aktAut] != null) {
                this.vAut[this.aktAut].setzeChanged();
                this.vAut[this.aktAut].notifyObservers(
                        this.aktZustand[this.aktAut]);
            }
        }

        if (this.aktZustand[this.aktAut] != null) {
            zusatz = this.aktZustand[this.aktAut].getInfo();
            aktion = zusatz.getAktion();
            parameter = zusatz.getParam();

            this.gesamtAktion(aktion, parameter);
           
            this.lastBf = aktion;
           
            bedingungen = zusatz.getBeds();
            it = bedingungen.iterator();
            this.aktZustand[this.aktAut] = null;
            while (it.hasNext() && folgeZ == 0) {
                aktBed = it.next();
                if (aktBed.evaluiere(this)) {
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.ZInfo

     */
    public void selKn(final Knoten knot) {
        String bed;
        int folgeZustand;
        int kantAlter;
        ZInfo zusatz;
        Iterator<Transition> it;
        Transition bedingung;
        String istStart = "";

        this.loescheSelKnot();
        this.aktKnot = knot;

        if (this.aktKnot != null) {
            zusatz = this.aktKnot.getInfo();

            it = zusatz.getBeds().iterator();
            while (it.hasNext()) {
                bedingung = it.next();
                bed = bedingung.getCond().toString();
                folgeZustand = bedingung.getFolgezustand();
                kantAlter = bedingung.getAlter();
                this.ktList.add(bed
                                  + "-"
                                  + folgeZustand
                                  + " ("
                                  + kantAlter
                                  + ")");
            }

            this.aktion.setText("" + zusatz.getAktion());
            this.param.setText("" + zusatz.getParam());
            this.alter.setText("" + zusatz.getAlter());
            if (zusatz.istStartZ()) {
                istStart = Messages.getString("SteuerFenster.IstStart");
            }
            this.zustName.setText("" + knot.holeName() + istStart);
        }
    }
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.ZInfo

     * @param event  Das Event.
     */
    @Override
    public void itemStateChanged(final ItemEvent event) {
        int pos;
        ZInfo zusatz;
        Transition bed;

        if (event.getSource() == this.ktList) {
            pos = ((Integer) event.getItem()).intValue();
            this.kantenEinstell.setEnabled(true);

            if (this.ktList.getSelectedItem() != null) {
                if (this.ktList.getSelectedItem().equals(
                        Messages.getString("SteuerFenster.KanteNeu"))) {
                    this.beding.setText(
                        Messages.getString("SteuerFenster.Bedingung"));
                    this.folgeZust.setText(
                        Messages.getString("SteuerFenster.FolgeZ"));
                    this.ktAlter.setText(
                        Messages.getString("SteuerFenster.KantAlter"));
                } else {
                    zusatz = this.aktKnot.getInfo();
                    bed = zusatz.getBeds().get(pos);
                    this.beding.setText(bed.getCond().toString());
                    this.folgeZust.setText("" + bed.getFolgezustand());
                    this.ktAlter.setText("" + bed.getAlter());
                }
            }
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.ZInfo

    public void actionPerformed(final ActionEvent event) {
        Object obj = event.getSource();
        String cmd = event.getActionCommand();
        String neueBed;
        int pos;
        ZInfo neuerZusatz;
        String neuFlZst;
        String neuKtAl;
        String[] elemente;
        boolean grammOk = true;
        Iterator<Vis> itG;
        String[] altSeq = this.aktGrph.getRob().erzeugeStrSeqs();
        Condition[] altCond = this.aktGrph.getRob().getConds();
        String befehl;

        befehl = ""
            + StaticMethods.posSuch(ConstantsSimulation.getBefehlNamenArray(this.pars),
                                this.aktion.getText());

        this.setCursor(new Cursor(Cursor.WAIT_CURSOR));

        itG = this.graphen.iterator();
        while (itG.hasNext()) {
            itG.next().setCursor(new Cursor(Cursor.WAIT_CURSOR));
        }

        try {
            if (obj instanceof Button) {
                if (cmd.equals(Messages.getString(
                        "SteuerFenster.Autoanordnung"))) {
                    this.aktGrph.zuruecksetzen();
                } else if (cmd.equals(Messages.getString(
                        "SteuerFenster.Beenden"))) {
                    WindowClosingAdapter ende
                        = new WindowClosingAdapter(true, this);
                    ende.schliesseExt(this);
                } else if (cmd.equals(Messages.getString(
                        "SteuerFenster.Uebernehmen"))
                           && this.aktKnot != null) {
                    GeneralDialog dia;
                    ArrayList<String> buttons = new ArrayList<String>();
                    buttons.add(Messages.getString("SteuerFenster.OK"));

                    if (!this.byteErk.erkenne(befehl)) {
                        dia = new GeneralDialog(this,
                                        null,
                                        Messages.getString(
                                           "SteuerFenster.Earley"),
                                        buttons,
                                        "<"
                                        + befehl
                                        + ">\n\n\n"
                                        + this.byteErk.toString());
                        dia.setVisible(true);
                        grammOk = grammOk & false;
                    }
                    if (!this.byteErk.erkenne(this.param.getText())) {
                        dia = new GeneralDialog(this,
                                        null,
                                        Messages.getString(
                                           "SteuerFenster.Earley"),
                                        buttons,
                                        "<"
                                        + this.param.getText()
                                        + ">\n\n\n"
                                        + this.byteErk.toString());
                        dia.setVisible(true);
                        grammOk = grammOk & false;
                    }
                    if (!this.byteErk.erkenne(this.alter.getText())) {
                        dia = new GeneralDialog(this,
                                        null,
                                        Messages.getString(
                                           "SteuerFenster.Earley"),
                                        buttons,
                                        "<"
                                        + this.alter.getText()
                                        + ">\n\n\n"
                                        + this.byteErk.toString());
                        dia.setVisible(true);
                        grammOk = grammOk & false;
                    }
                    if (this.ktList.getSelectedItems().length > 0) {
                        this.beding.setText(
                                EndlicherAutomat.formatBed(
                                        this.beding.getText()));
                       
                        if (!this.bedgErk.erkenne(this.beding.getText())) {
                            dia = new GeneralDialog(this,
                                            null,
                                            Messages.getString(
                                               "SteuerFenster.Earley"),
                                            buttons,
                                            "<"
                                            + this.beding.getText()
                                            + ">\n\n\n"
                                            + this.bedgErk.toString());
                            dia.setVisible(true);
                            grammOk = grammOk & false;
                        }
                        if (!this.byteErk.erkenne(this.folgeZust.getText())) {
                            dia = new GeneralDialog(this,
                                            null,
                                            Messages.getString(
                                               "SteuerFenster.Earley"),
                                            buttons,
                                            "<"
                                            + this.folgeZust.getText()
                                            + ">\n\n\n"
                                            + this.byteErk.toString());
                            dia.setVisible(true);
                            grammOk = grammOk & false;
                        }
                        if (!this.byteErk.erkenne(this.ktAlter.getText())) {
                            dia = new GeneralDialog(this,
                                            null,
                                            Messages.getString(
                                               "SteuerFenster.Earley"),
                                            buttons,
                                            "<"
                                            + this.ktAlter.getText()
                                            + ">\n\n\n"
                                            + this.byteErk.toString());
                            dia.setVisible(true);
                            grammOk = grammOk & false;
                        }
                    } else {
                        grammOk = grammOk & true;
                    }

                    if (grammOk) {
                        boolean istStart
                            = this.aktGrph.getRob().istStartZ(this.aktKnot);
                        if (this.ktList.getSelectedItem() != null
                            && !this.beding.getText().equals(
                                Messages.getString("SteuerFenster.Bedingung"))
                            && !this.folgeZust.getText().equals(
                                Messages.getString("SteuerFenster.FolgeZ"))
                            && !this.ktAlter.getText().equals(
                                Messages.getString("SteuerFenster.KantAlter"))
                            && !this.beding.getText().equals("")
                            && !this.folgeZust.getText().equals("")
                            && !this.ktAlter.getText().equals("")) {
                            pos = this.ktList.getSelectedIndex();
                            neueBed = StaticMethods.ausFormatBed(
                                          this.beding.getText())
                                      + "-"
                                      + this.folgeZust.getText()
                                      + " ("
                                      + this.ktAlter.getText()
                                      + ")";
                            this.ktList.replaceItem(neueBed, pos);
                        }
                        this.aktKnot.loescheAlleNachfolger();
                        if (this.alter.getText().equals("")) {
                            this.alter.setText("1");
                        }
                        neuerZusatz = new ZInfo(
                                Integer.parseInt(befehl),
                                Integer.parseInt(this.param.getText()),
                                null,
                                istStart,
                                Integer.parseInt(this.alter.getText()));
View Full Code Here

Examples of fmg.fmg8.endlAutomat.ZInfo

    public void naechsterZustand() {
        int aktion;
        int parameter;
        LinkedList<Transition> bedingungen;
        Transition aktBed;
        ZInfo zusatz;
        int folgeZ = 0;
        Iterator<Transition> it;
        int i = 0;
       
        while (i < this.conds.length) {
            if (this.conds[i].evaluiere(this)) {
                if (this.initial || i != this.aktAut) {
                    this.aktAut = i;
                    this.vAut[this.aktAut].setzeChanged();
                    this.vAut[this.aktAut].notifyObservers(
                            new Integer(this.aktAut));
                    this.initial = false;
                }
                break;
            }
            i++;
        }
       
        this.expAktZyklen++;
        this.fitAktZyklen[this.aktAut]++;
        this.fitRedAktZyklen[this.aktAut]++;
        this.aktivZyklen[this.aktAut]++;
        this.mutAktZyklen++;
        this.aktMemZyk++;
        this.condMutAktZyklen++;
       
        if (this.fitRedAktZyklen[this.aktAut] > this.fitRedZyklen) {
            this.setFitness(this.aktAut,
                            (int) ((double) this.getFitness()[this.aktAut]
                                    / this.fitRedWert));
            this.fitRedAktZyklen[this.aktAut] = 0;
        }
       
        if (this.fitAktZyklen[this.aktAut] > this.fitZyklen) {
            this.befehle.clear();
            this.befehle.add(new Integer(this.lastBf));

            this.setFitness(this.aktAut,
                            this.getFitness()[this.aktAut]
                            + this.fitVs[this.aktAut].fitness(
                                    (Roboter) this));

            this.fitAktZyklen[this.aktAut] = 0;
        }

        if (this.pars.getEvol().booleanValue()) {
            if (this.aktMemZyk > this.pars.getMemInt().longValue()) {
                this.resetToBest();
            }
           
            if (this.mutAktZyklen > this.mutZyklen) {
                this.mutV = true;
                this.mutiere();
                this.mutAktZyklen = 0;
                this.mutV = false;
            } else {
                this.mutV = false;
            }
           
            if (this.condMutAktZyklen > this.pars.getCondMutZyk()) {
                this.mutiereBeds();
                this.condMutAktZyklen = 0;
            }
        }
       
        if (this.aktZustand[this.aktAut] == null) {
            this.aktZustand[this.aktAut]
                            = this.vAut[this.aktAut].holeStartzustand();
        }

        if (this.isSelektiert()) {
            if (this.aktZustand[this.aktAut] != null) {
                this.vAut[this.aktAut].setzeChanged();
                this.vAut[this.aktAut].notifyObservers(
                        this.aktZustand[this.aktAut]);
            }
        }

        if (this.aktZustand[this.aktAut] != null) {
            zusatz = (ZInfo) this.aktZustand[this.aktAut].getInfo();
            aktion = zusatz.getAktion();
            parameter = zusatz.getParam();

            this.gesamtAktion(aktion, parameter);
           
            this.lastBf = aktion;
           
            bedingungen = zusatz.getBeds();
            it = bedingungen.iterator();
            this.aktZustand[this.aktAut] = null;
            while (it.hasNext() && folgeZ == 0) {
                aktBed = (Transition) it.next();
                if (aktBed.evaluiere(this)) {
View Full Code Here

Examples of fmg.fmg8.endlAutomat.ZInfo

                            final int knotNam,
                            final int setValue,
                            final EndlicherAutomat aut) {
       
        Knoten knot = aut.holeKnoten(knotNam);
        ZInfo zusatz;
        int set;
        int setInst;
       
        if (knot == null) {
            this.insertNode(knotNam, aut);
            knot = aut.holeKnoten(knotNam);
        }
       
        zusatz = knot.getInfo();
        set = setValue % 256;
        if (set == 0) {
            set++;
        }

        if (mode == 1) { // Change instruction.
            setInst = SonstMeth.modZwischen(
                    setValue,
                    SonstMeth.minBef(this.modus),
                    SonstMeth.maxBef(this.modus));
            zusatz.setAkt(setInst);
        }
        if (mode == 2) { // Change parameter.
            zusatz.setPar(set);
        }
        if (mode == 3) { // Change additional parameter.
            zusatz.setAlter(set);
        }

        this.instrCounter++;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.