Examples of Knoten


Examples of fmg.fmg8.graphVis.graph.Knoten

     * @param ea  Der zu mutierende Automat.
     * @return  Ob ein Zustand mutiert wurde.
     */
    public final boolean mutationZustand(final EndlicherAutomat ea) {
        ArrayList<Integer> knListe = ea.getKnList();
        Knoten zufallsKnoten1;
        int veraenderung;
        int neuParam;
        int altParam;
        int neuBefehl;
        int zufallsIndex;
       
        if (knListe.size() == 0) {
            return false;
        } else {
            zufallsIndex = this.rand.nextInt(knListe.size());
            zufallsKnoten1 = (Knoten) ea.holeKnoten(knListe.get(zufallsIndex));
            veraenderung = this.rand.nextInt(2 * this.k) - this.k;
            altParam = ((ZInfo)
                    zufallsKnoten1.getInfo()).getParam();
            if (veraenderung + altParam > 0) {
                neuParam = altParam + veraenderung;
                neuBefehl = ((ZInfo)
                        zufallsKnoten1.getInfo()).getAktion();
            } else if (veraenderung + altParam < 0) {
                neuParam = (veraenderung + altParam) * -1;
                neuBefehl = SonstMeth.glVertZwischen(
                        SonstMeth.minBef(this.modus),
                        SonstMeth.maxBef(this.modus),
                        this.rand);
               
            } else { // veraenderung + altparam == 0
                neuParam = 1;
                neuBefehl = ((ZInfo)
                        zufallsKnoten1.getInfo()).getAktion();
            }
               
           
            ((ZInfo) zufallsKnoten1.getInfo()).setAkt(neuBefehl);
            ((ZInfo) zufallsKnoten1.getInfo()).setPar(neuParam);
           
            return true;
        }
    }
View Full Code Here

Examples of fmg.fmg8.graphVis.graph.Knoten

     * @param aut       The automaton.
     */
    private void insertEdge(final int knotNam1,
                            final int knotNam2,
                            final EndlicherAutomat aut) {
        Knoten knot1 = aut.holeKnoten(knotNam1);
        Knoten knot2 = aut.holeKnoten(knotNam2);
        Condition c;
       
        if (knot1 == null) {
            this.insertNode(knotNam1, aut);
        }
View Full Code Here

Examples of fmg.fmg8.graphVis.graph.Knoten

    private void changeNode(final int mode,
                            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++;
        }
View Full Code Here

Examples of fmg.fmg8.graphVis.graph.Knoten

            final int qKnotNam,
            final int zKnotNam,
            final EndlicherAutomat aut) {
       
        int quellKnotNam = qKnotNam, zielKnotNam = zKnotNam;
        Knoten knot1;
        Knoten knot2;
        List<Transition> vorhTrans;
        List<Condition> vorhConds;
        Condition c;
        Condition[] cZwisch;
        ArrayList<Integer> knListe;
View Full Code Here

Examples of fmg.fmg8.graphVis.graph.Knoten

        ArrayList<Integer> knot;
        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[] eas = new EndlicherAutomat[endAuts.length];
        LinkedList<Transition> trans;
        Transition tran;
        String[] args = {"log 4"};
       
        if (endAuts == null
                || conds == null
                || endAuts.length != conds.length
                || endAuts.length == 0) {
            SonstMeth.log(SonstMeth.LOG_ERROR,
                          "Gesamtautomat konnte nicht erzeugt werden.",
                          new Parametersatz(args));
        }
       
        for (int i = 0; i < eas.length; i++) {
            eas[i] = new EndlicherAutomat();
            eas[i].erzeugeAusSequenz(
                    endAuts[i].erzeugeStringSeq(),
                    fmg.fmg8.endlAutomat.translator.Konstanten.STD_TRANSL_BE,
                    false);
           
            if (eas[i].istLeer()) {
                eas[i].einfuegenKnoten(Integer.MAX_VALUE,
                        SonstMeth.posSuch(
                                fmg.fmg8.umgebung2D.Konstanten.BEF,
                                "stp"),
                        1,
                        1);
               
                eas[i].setStart(eas[i].holeKnoten(Integer.MAX_VALUE));
            }
        }
       
        // Neue Knoten zuordnen.
        for (int i = 0; i < eas.length; i++) {
            knotZuord[i] = new HashMap<Integer, Integer>();
           
            knot = new ArrayList<Integer>(eas[i].holAdj().keySet());
            it = knot.iterator();

            while (it.hasNext()) {
                aktKnNum = it.next();
                aktKn = eas[i].holeKnoten(aktKnNum);
                info = aktKn.getInfo();
                neu.einfuegenKnoten(lfdNr,
                                    info.getAktion(),
                                    info.getParam(),
                                    info.getAlter());
               
                knotZuord[i].put(aktKnNum, lfdNr);
                lfdNr++;
            }
        }
       
        // Neue Kanten INTER Automaten zuordnen.
        for (int i = 0; i < eas.length; i++) {
            zielKn = eas[i].holeStartzustand();
           
            if (zielKn != null) {
                zielKnNum = (Integer) knotZuord[i].get(zielKn.holeName());
                neuBed = SonstMeth.ausFormatBed(conds[i].formatted());
                for (int j = 0; j < i; j++) {
                    zwischBed = SonstMeth.ausFormatBed(conds[j].formatted());
                    zwischBed.negiere();
                    neuBed = new InnerNode(neuBed,
                                           zwischBed,
                                           fmg.fmg8.endlAutomat.Konstanten.UND);
                }
               
                for (int j = 0; j < eas.length; j++) {
                    if (j != i) {
                        knot = new ArrayList<Integer>(
                                eas[j].holAdj().keySet());
                        it = knot.iterator();
                       
                        while (it.hasNext()) {
                            aktKnNum = (Integer) knotZuord[j].get(it.next());
                            neu.einfuegKante(aktKnNum, zielKnNum, neuBed, 1);
                        }
                    }
                }
            }
        }

        // Neue Kanten INTRA Automaten zuordnen.
        for (int i = 0; i < eas.length; i++) {
            knot1 = new ArrayList<Integer>(eas[i].holAdj().keySet());
            it1 = knot1.iterator();
           
            while (it1.hasNext()) {
                numOrig1 = it1.next();
                aktKnNum = (Integer) knotZuord[i].get(numOrig1);
                aktKn = eas[i].holeKnoten(numOrig1);
               
                if (aktKn.getInfo() != null
                        && aktKn.getInfo().getBedingungen() != null) {
                    trans = aktKn.getInfo().getBedingungen();
                    it3 = trans.iterator();
                   
                    while (it3.hasNext()) {
                        tran = it3.next();
                        numOrig2 = tran.getFolgezustand();
                        zielKnNum = (Integer) knotZuord[i].get(numOrig2);
                        aktBed = tran.getCond();
                       
                        if (aktBed != null) {
                            neu.einfuegKante(aktKnNum, zielKnNum, aktBed, 1);
                        }
                    }
                }
            }
        }

        // true - Kanten zu den einzelnen Startknoten einf�gen.
        for (int i = 0; i < eas.length; i++) {
            zielKn = eas[i].holeStartzustand();
           
            if (zielKn != null) {
                zielKnNum = (Integer) knotZuord[i].get(zielKn.holeName());
               
                knot = new ArrayList<Integer>(eas[i].holAdj().keySet());
                it = knot.iterator();
               
                while (it.hasNext()) {
View Full Code Here

Examples of fmg.fmg8.graphVis.graph.Knoten

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

        if (arg == null) {
View Full Code Here

Examples of fmg.fmg8.graphVis.graph.Knoten

        DargestellterGraph darstellung = new DargestellterGraph();
        Iterator<Knoten> it;
        Iterator<Knoten> it1;
        Iterator<Integer> it2;
        Iterator<Transition> it3;
        Knoten knot;
        Knoten knot1;
        Knoten knot2;
        Vektor2D koord1;
        Vektor2D koord2;

        if (!g.istLeer()) {
            final ArrayList<Knoten> knotenListe
                = new ArrayList<Knoten>(g.holAdj().values());
            int knAnzahl = knotenListe.size();
           
            if (knAnzahl < 2) {
                knAnzahl = 2;
            }
           
            int gitterX = Math.abs(this.rechts - this.links)
                          / (int) ((Math.ceil(Math.sqrt(knAnzahl))) - 1);
            int gitterY = Math.abs(this.unten - this.oben)
                          / (int) ((Math.ceil(Math.sqrt(knAnzahl))) - 1);

            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 kantAlter;
                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();
                    kantAlter = bed.getAlter();
                    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);

                    if (koord1.equals(koord2)) {
View Full Code Here

Examples of fmg.fmg8.graphVis.graph.Knoten

        ArrayList<Integer> zustaende;
        boolean vorhandenAll;
        Iterator<Integer> it, it1, it2;
        Integer aktName;
        Knoten[] knotenListe = new Knoten[rob.length];
        Knoten zwischKnoten;
        Integer kn1, kn2;
        Knoten zKnoten;
        Condition zCond;
        int aktion;
        int param;      
        int alt;
        boolean istStart;
        Roboter aktRob;
        Condition[] condListe = new Condition[rob.length];
        int j = -1;
       
        /*
         * Ersetzt alle Vorkommnisse von <code>null</code> im Array rob durch
         * g�ltige im Array weiter vorne stehende Roboter. Dabei wird die
         * Liste der Roboter VOR dem ersten Vorkommnis von <code>null</code>
         * immer wieder �ber das Array gelegt und die null-Werte werden
         * �berschrieben:
         *
         * [1 3 null null null null] => [1 3 1 3 1 3].
         *
         * Wenn nach dem ersten Vorkommnis von <code>null</code> ein g�ltiger
         * Roboter vorkommt (dies ist kein erw�nschter Fall), dann wird er
         * im Array belassen.
         */
        for (int i = 0; i < rob.length; i++) {
            if (rob[i] == null) {
                if (j < 0) {
                    j = i;
                }
                rob[i] = rob[i % j];
            }
        }
       
        for (int i = 0; i < rob.length; i++) {
            if (rob[i].getFitness()[0] > 0) {
                vert.add(new Long(rob[i].getFitness()[0]));
            } else {
                vert.add(new Long(0));
            }
        }

        aktRob = (Roboter) MathMeth.randVerteilung(rob, vert, this.rand);
        zustaende = aktRob.vAuts()[0].getKnList();
        fitness = aktRob.getFitness()[0];
       
        vorhandenAll = true;
       
        it = zustaende.iterator();
        while (it.hasNext()) {
            aktName = (Integer) it.next();
            for (int i = 0; i < rob.length; i++) {
                zwischKnoten = rob[i].vAuts()[0].holeKnoten(aktName);
                if (zwischKnoten != null) {
                    knotenListe[i] = zwischKnoten;
                } else {
                    vorhandenAll = false;
                    break;
                }
            }
           
            if (vorhandenAll) {
                zKnoten = (Knoten) MathMeth.randVerteilung(knotenListe,
                                                           vert,
                                                           this.rand);
            } else {
                zKnoten = aktRob.vAuts()[0].holeKnoten(aktName);
            }
           
            aktion = ((ZInfo) zKnoten.getInfo()).getAktion();
            param = ((ZInfo) zKnoten.getInfo()).getParam();
            alt = ((ZInfo) zKnoten.getInfo()).getAlter();
            istStart = ((ZInfo) zKnoten.getInfo()).istStartZ();
           
            kind.einfuegenKnoten(aktName, aktion, param, alt);
            if (istStart) {
                kind.setStart(kind.holeKnoten(aktName));
            }
View Full Code Here

Examples of fmg.fmg8.graphVis.graph.Knoten

     * @param aut       The automaton.
     */
    private void insertEdge(final int knotNam1,
                            final int knotNam2,
                            final EndlicherAutomat aut) {
        Knoten knot1 = aut.holeKnoten(knotNam1);
        Knoten knot2 = aut.holeKnoten(knotNam2);
        Condition c;
       
        if (knot1 == null) {
            this.insertNode(knotNam1, aut);
        }
View Full Code Here

Examples of fmg.fmg8.graphVis.graph.Knoten

    private void changeNode(final int mode,
                            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++;
        }
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.