Package fmg.fmg8.umgebung2D

Examples of fmg.fmg8.umgebung2D.SimulationsZeit


     *
     * @param args  Parameter.
     */
    @Deprecated
    public static void main(String[] args) {
        Parametersatz params = new Parametersatz(args);
        params.ergaenze();
        String seqCode
        = "001 110 100 101 000 012 099 001 000 007 000 000 002 001 000 " +
        "012 099 002 000 004 000 000 005 001 000 000 000 014 105 100 " +
        "001 000 012 099 001 000 004 000 000 010 001 000 012 099 001 " +
        "000 007 000 000 004 001 000 000 000 013 108 100 001 000 012 " +
View Full Code Here


            } else {
                automatSp = false;
            }
                this.schnappAuts++;
                this.schnappZyklen = 0;
                this.aufnahme.addPopSn(new PopSnapshot(
                                       this.umgebung.getAkteure(),
                                       this.umgebung.getGegVerschieb(),
                                       this.simZyklen,
                                       automatSp));
        }
View Full Code Here

            final Translator[] trans) {

        this.aktVisTrans = new LinkedList<VisTrans>();
       
        if (this.rob == null) {
            this.rob = new Roboter(
                    0,
                    0,
                    0,
                    fmg.fmg8.umgebung2D.Konstanten.ROB_AUSDEHNUNG_X,
                    fmg.fmg8.umgebung2D.Konstanten.ROB_AUSDEHNUNG_Y,
View Full Code Here

     * Startet die Simulation.
     *
     * @param evol  Ob evolviert werden soll.
     */
    private void simStarten(final boolean evol) {
        SimulationsZeit simZ;
        Vis aktVis = this.aktGrph;
        String lauf;
        Vis[] visGr = new Vis[this.graphen.size()];
        int i = 0;
        Iterator<Vis> it = this.graphen.iterator();
        while (it.hasNext()) {
            visGr[i] = (Vis) it.next();
            i++;
        }
       
        this.setzeSimLf(true);
        this.pars.setEvolution(evol);
        this.pars.setBezier(
                fmg.fmg8.graphVis.zeichenModi.Konstanten.BEZIER_ZAHL_SCHNELL);
       
        this.pars.setPNGAutSp(false);
        this.speichereAlleGraphen(Messages.getString("Vis.All"));
        this.pars.setPNGAutSp(true);
        this.selGraph(aktVis);

        if (evol) {
            lauf = "Evolution";
        } else {
            lauf = "Simulation";
        }
       
        this.simGUI = new GuiSimulation(lauf
                                            + " ["
                                            + this.graphen.size()
                                            + " Robots]",
                                        this.sensFenster,
                                        this,
                                        this.pars);

        simZ = new SimulationsZeit(
                this.pars,
                this.simGUI,
                visGr,
                DynFactory.getKonstDyn(
                        this.pars.getDynArt(),
View Full Code Here

        }
       
    /*
     * Erzeugt eine Simulationsumgebung, in der die Aufnahme angezeigt wird:
     */
        SimulationsZeit simZ;
        int size = robs.length;
       
        String[][] vAutStd  = new String[size][];
        String[][] tAutStd  = new String[size][];
        String[][] vAut  = new String[size][];
        String[][] tAut  = new String[size][];
        int[] identitaeten  = new int[size];
        Vektor2D[] positionen = new Vektor2D[size];
        double[] winkel     = new double[size];
        Vektor2D[] versch;
        Vektor2D[] neuVersch;
        int[][] fitness = new int[size][];
        Condition[][] conds = new Condition[size][];
       
        Vis[] visGr = new Vis[this.graphen.size()];
       
        int i = 0;
        Iterator<Vis> it = this.graphen.iterator();
        while (it.hasNext()) {
            visGr[i] = it.next();
           
            for (int j = 0; j < robs.length; j++) {
                if (visGr[i].getRob().getId() == robs[j].getId()) {
                    vAutStd[i] = robs[j].getVStdCodes();
                    vAut[i] = robs[j].getVCodes();
                    tAutStd[i] = robs[j].getTStdCodes();
                    tAut[i] = robs[j].getTCodes();
                    fitness[i] = robs[j].getFitness();
                    identitaeten[i] = robs[j].getId();
                    positionen[i] = robs[j].getPosition();
                    winkel[i] = robs[j].getWinkel();
                    conds[i] = new Condition[robs[j].getConds().length];
                    for (int k = 0; k < robs[j].getConds().length; k++) {
                        conds[i][k] = robs[j].getConds()[k];
                    }
                    break;
                }
            }
            i++;
        }
           
        // Erzeugt eine neue Simulation, falls noch keine erzeugt wurde.
        if (this.guiSim == null) {
            this.parsAufn.setAufnSp(false);
            this.parsAufn.setEndlos(true);
            this.parsAufn.setEvolution(false);
            this.parsAufn.setVerzoegerung(Long.MAX_VALUE);
           
            this.guiSim = new GuiSimulation("Snapshot"
                                                + " ["
                                                + this.graphen.size()
                                                + " robots]",
                                            null,
                                            this,
                                            this.parsAufn);
   
            simZ = new SimulationsZeit(this.parsAufn,
                                       this.guiSim,
                                       visGr,
                                       vAutStd,
                                       conds,
                                       identitaeten);
View Full Code Here

        }
       
    /*
     * Erzeugt eine Simulationsumgebung, in der die Aufnahme angezeigt wird:
     */
        SimulationsZeit simZ;
        int size = robs.length;
       
        String[][] vAutStd  = new String[size][];
        String[][] tAutStd  = new String[size][];
        String[][] vAut  = new String[size][];
        String[][] tAut  = new String[size][];
        int[] identitaeten  = new int[size];
        Vektor2D[] positionen = new Vektor2D[size];
        double[] winkel     = new double[size];
        Vektor2D[] versch;
        Vektor2D[] neuVersch;
        int[][] fitness = new int[size][];
        Condition[][] conds = new Condition[size][];
       
        Vis[] visGr = new Vis[this.graphen.size()];
       
        int i = 0;
        Iterator<Vis> it = this.graphen.iterator();
        while (it.hasNext()) {
            visGr[i] = it.next();
           
            for (int j = 0; j < robs.length; j++) {
                if (visGr[i].getRob().getId() == robs[j].getId()) {
                    vAutStd[i] = robs[j].getVStdCodes();
                    vAut[i] = robs[j].getVCodes();
                    tAutStd[i] = robs[j].getTStdCodes();
                    tAut[i] = robs[j].getTCodes();
                    fitness[i] = robs[j].getFitness();
                    identitaeten[i] = robs[j].getId();
                    positionen[i] = robs[j].getPosition();
                    winkel[i] = robs[j].getWinkel();
                    conds[i] = new Condition[robs[j].getConds().length];
                    for (int k = 0; k < robs[j].getConds().length; k++) {
                        conds[i][k] = robs[j].getConds()[k];
                    }
                    break;
                }
            }
            i++;
        }
               
        if (this.guiSim == null) {
            this.parsAufn.setAufnSp(false);
            this.parsAufn.setEndlos(true);
            this.parsAufn.setEvolution(false);
            this.parsAufn.setVerzoegerung(Long.MAX_VALUE);
           
            this.guiSim = new GuiSimulation("Snapshot"
                                                + " ["
                                                + this.graphen.size()
                                                + " Roboter]",
                                            null,
                                            this,
                                            this.parsAufn);
   
            simZ = new SimulationsZeit(this.parsAufn,
                                       this.guiSim,
                                       visGr,
                                       vAutStd,
                                       conds,
                                       identitaeten);
View Full Code Here

     * Startet die Simulation.
     *
     * @param evol  Ob evolviert werden soll.
     */
    private void simStarten(final boolean evol) {
        SimulationsZeit simZ;
        Vis aktVis = this.aktGrph;
        String lauf;
        Vis[] visGr = new Vis[this.graphen.size()];
        int i = 0;
        Iterator<Vis> it = this.graphen.iterator();
        while (it.hasNext()) {
            visGr[i] = (Vis) it.next();
            i++;
        }
       
        this.setzeSimLf(true);
        this.pars.setEvolution(evol);
        this.pars.setBezier(
                fmg.fmg8.graphVis.zeichenModi.Konstanten.BEZIER_ZAHL_SCHNELL);
       
        this.pars.setPNGAutSp(false);
        this.speichereAlleGraphen(Messages.getString("Vis.All"));
        this.pars.setPNGAutSp(true);
        this.selGraph(aktVis);

        if (evol) {
            lauf = "Evolution";
        } else {
            lauf = "Simulation";
        }
       
        this.simGUI = new GuiSimulation(lauf
                                            + " ["
                                            + this.graphen.size()
                                            + " Robots]",
                                        this.sensFenster,
                                        this,
                                        this.pars);

        simZ = new SimulationsZeit(this.pars, this.simGUI, visGr);
        this.simGUI.setVisible(true);
        this.simGUI.registriereTakt(simZ);
        this.setVisible(false);
        this.simGUI.simStarten();
    }
View Full Code Here

        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,
View Full Code Here

     *                werden soll.
     * @param x       X-Koordinate.
     * @param y       Y-Koordinate.
     */
    public void neueKoord(final Knoten knoten, final int x, final int y) {
        Vektor2D koord;

        if (this.gesetzteKn.containsKey(knoten.holeName())) {
            koord = this.gesetzteKn.get(knoten.holeName());
            koord.x = x;
            koord.y = y;
        } else {
            this.gesetzteKn.put(knoten.holeName(), new Vektor2D(x, y));
        }
    }
View Full Code Here

                    this.drehen.set(i, !this.drehen.get(i));
                    this.winkel.set(i, this.random.nextDouble() * 0.5);
                }
            }
            if (this.versch.get(i)) {
                Vektor2D vSchiebg = umg.getDynVersch()[this.waende.get(i)];
                vSchiebg.add(new Vektor2D(
                        this.xRicht.get(i),
                        this.yRicht.get(i)));
               
                if (null != umg.verschWand(
                        this.waende.get(i),
                        vSchiebg)) {
                    this.versch.set(i, !this.versch.get(i));
                    this.xRicht.set(i, this.random.nextDouble() * 0.5);
                    this.yRicht.set(i, this.random.nextDouble() * 0.5);
                }
            } else {
                Vektor2D vSchiebg = umg.getDynVersch()[this.waende.get(i)];
                vSchiebg.add(new Vektor2D(
                        -this.xRicht.get(i),
                        -this.yRicht.get(i)));
               
                if (null != umg.verschWand(
                        this.waende.get(i),
View Full Code Here

TOP

Related Classes of fmg.fmg8.umgebung2D.SimulationsZeit

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.