Package fmg.fmg8.graphVis.darstellungsModi

Examples of fmg.fmg8.graphVis.darstellungsModi.DarstModEA


            int koordX = this.links;
            int koordY = this.oben;
           
            int kX;
            int kY;
            Transition bed;
            int folgeZustand;
            String bedingung;
            int xAusgleich;
            int zaehler = 0;
           
            // Knoten
            it = knotenListe.iterator();
            while (it.hasNext()) {
                knot = it.next();

                if (this.gesetzteKn.containsKey(knot.holeName())) {
                    kX = (int) this.gesetzteKn.get(knot.holeName()).x;
                    kY = (int) this.gesetzteKn.get(knot.holeName()).y;
                    this.setzeKnoten(knot,
                                     darstellung,
                                     kX,
                                     kY,
                                     (Knoten) ausgKn);

                    if (g.istStartZ(knot)) {
                        darstellung.hinzuPfeil(kX - 60,
                                               kY - 60,
                                               kX - 45,
                                               kY - 45,
                                               0.5,
                                               false);
                    }
                } else {
                    this.setzeKnoten(knot,
                                     darstellung,
                                     koordX,
                                     koordY,
                                     (Knoten) ausgKn);

                    this.gesetzteKn.put(knot.holeName(),
                                        new Vektor2D(koordX, koordY));

                    if (g.istStartZ(knot)) {
                        darstellung.hinzuPfeil(koordX - 60,
                                               koordY - 60,
                                               koordX - 45,
                                               koordY - 45,
                                               0.5,
                                               false);
                    }

                    zaehler++;
                   
                    if (zaehler < Math.ceil(Math.sqrt(knAnzahl))) {
                        koordX = koordX + gitterX;
                    } else {
                        koordX = this.links;
                        koordY = koordY + gitterY;
                        zaehler = 0;
                    }
                }
            }

            // Kanten
            it1 = knotenListe.iterator();
            while (it1.hasNext()) {
                knot1 = (Knoten) it1.next();
                koord1 = (Vektor2D) this.gesetzteKn.get(knot1.holeName());

                it2 = (new ArrayList<Integer>(
                                knot1.holeNachfolger().keySet())).iterator();
                while (it2.hasNext()) {
                    boolean gebogen = true;
                   
                    knot2 = g.holeKnoten((Integer) it2.next());
                    koord2 = (Vektor2D) this.gesetzteKn.get(knot2.holeName());
                    Condition cond
                        = knot1.getInfo().getTransZuZustand(
                                knot2.holeName()).get(0).getCond();
                    double staerke = SonstMeth.condStrength(cond,
                                                   Konstanten.STAERKE_ERST,
                                                   Konstanten.STAERKE_ZWEIT);
                   
                    if (koord1.distanz(koord2) < 140
                            && !koord1.equals(koord2)) {
                        gebogen = false;
                    }
                   
                    darstellung.hinzuPfeil(
                            (int) koord1.x,
                            (int) koord1.y,
                            (int) koord2.x,
                            (int) koord2.y,
                            staerke,
                            gebogen);
                }
            }

            // Kantenbeschriftungen
            it1 = knotenListe.iterator();
            while (it1.hasNext()) {
                int kantNum = 1;
                knot1 = (Knoten) it1.next();
                koord1 = this.gesetzteKn.get(knot1.holeName());

                it3 = ((ZInfo) knot1.getInfo()).getBeds().iterator();
                while (it3.hasNext()) {
                    Polygon p = new Polygon();
                    bed = it3.next();
                    folgeZustand = bed.getFolgezustand();
                    bedingung = bed.getCond().toString();
                    knot2 = g.holeKnoten(new Integer(folgeZustand));
                    koord2 = this.gesetzteKn.get(knot2.holeName());

                    p.addPoint((int) koord1.x, (int) koord1.y);
                    p.addPoint((int) koord2.x, (int) koord2.y);
View Full Code Here


     */
    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)) {
                    folgeZ = aktBed.getFolgezustand();
                    this.aktZustand[this.aktAut]
                        = this.vAut[this.aktAut].holeKnoten(
                                new Integer(folgeZ));
                }
            }
View Full Code Here

    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

                while (it2.hasNext()) {
                    boolean gebogen = true;
                   
                    knot2 = g.holeKnoten((Integer) it2.next());
                    koord2 = (Vektor2D) this.gesetzteKn.get(knot2.holeName());
                    Condition cond
                        = knot1.getInfo().getTransZuZustand(
                                knot2.holeName()).get(0).getCond();
                    double staerke = SonstMeth.condStrength(cond,
                                                   Konstanten.STAERKE_ERST,
                                                   Konstanten.STAERKE_ZWEIT);
View Full Code Here

     *            Der Zusatzparameter.
     */
    public void update(final Observable o, final Object arg) {
        Knoten k;
        AutomatenNummer aN;
        ConditionNummer cN;
        int autNum;

        if (arg == null) {
            return;
        }

        if (arg.getClass().equals(Integer.class)) {
            // Neuer Automat wurde ausgew�hlt.
            autNum = ((Integer) arg).intValue();
            this.benutztAut = autNum;
            this.selectAktAut(false, autNum);
        } else if (arg.getClass().equals(Knoten.class)) {
            // Neuer Knoten wurde ausgew�hlt.
            k = (Knoten) arg;
            this.selKnoten(k, this.benutztAut);
        } else if (arg.getClass().equals(AutomatenNummer.class)) {
            // Sequenz wurde ver�ndert.
            aN = (AutomatenNummer) arg;
            this.erzeugeAusSequenz(aN.getAutNum(),
                                   aN.getSequenz(),
                                   null,
                                   false);
        } else if (arg.getClass().equals(ConditionNummer.class)) {
            // Bedingungen wurden ver�ndert.
            cN = (ConditionNummer) arg;
            this.setzeCond(cN.getAutNum(), cN.getSequenz());
           
            for (VisTrans v : this.aktVisTrans) {
                v.neuZeichnen();
            }
        }
View Full Code Here

        for (int i = 0; i < this.conds.length; i++) {
            this.conds[i] = this.mut.mutiere(this.conds[i]);
            if (this.isSelektiert()) {
                this.vAut[i].setzeChanged();
                this.vAut[i].notifyObservers(
                        new ConditionNummer(this.conds[i].toString(),
                                            i));
            }
        }
    }
View Full Code Here

            this.conds[autNum] = cond;
           
            if (this.isSelektiert()) {
                this.vAut[autNum].setzeChanged();
                this.vAut[autNum].notifyObservers(
                        new ConditionNummer(this.conds[autNum].toString(),
                                            autNum));
            }
        }
       
        if (this.isSelektiert()) {
View Full Code Here

                        this.pars.getMutSeqLenKonstTrans(),
                        this.rand);

                visRob = new VisMantel(grNam,
                        this.umgebung,
                        new MutationSEQ(mutSeqVerh, true, false),
                        new MutationSEQ(mutSeqTrans, false, true),
                        this.rand,
                        this.kleinsteFreieID(),
                        this.pars,
                        sel,
                        obs);
View Full Code Here

                        }
                    }
                }
               
                MutSeqVerf mutSeqVerh = new MutationKlWkeit(
                        new EinzelMutAdd(
                                this.rand,
                                this.pars.getMutVerhStdAbw()),
                        this.pars.getMutVerhWkeit(),
                        this.pars.getMutMinFaktorVerh(),
                        this.pars.getMutMaxFaktorVerh(),
                        this.pars.getMutSeqLenKonstVerh(),
                        this.rand);
                MutSeqVerf mutSeqTrans = new MutationKlWkeit(
                        new EinzelMutAdd(
                                this.rand,
                                this.pars.getMutTransStdAbw()),
                        this.pars.getMutTransWkeit(),
                        this.pars.getMutMinFaktorTrans(),
                        this.pars.getMutMaxFaktorTrans(),
View Full Code Here

                            break;
                        }
                    }
                }
               
                MutSeqVerf mutSeqVerh = new MutationKlWkeit(
                        new EinzelMutAdd(
                                this.rand,
                                this.pars.getMutVerhStdAbw()),
                        this.pars.getMutVerhWkeit(),
                        this.pars.getMutMinFaktorVerh(),
                        this.pars.getMutMaxFaktorVerh(),
                        this.pars.getMutSeqLenKonstVerh(),
                        this.rand);
                MutSeqVerf mutSeqTrans = new MutationKlWkeit(
                        new EinzelMutAdd(
                                this.rand,
                                this.pars.getMutTransStdAbw()),
                        this.pars.getMutTransWkeit(),
                        this.pars.getMutMinFaktorTrans(),
View Full Code Here

TOP

Related Classes of fmg.fmg8.graphVis.darstellungsModi.DarstModEA

Copyright © 2018 www.massapicom. 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.