Examples of RobSnapshot


Examples of eas.simulation.spatial.sim2D.marbSimulation.statistik.RobSnapshot

                // Starte n Generationen vor der besten Population.
                bestPopNum = Math.max(0, bestPopNum - 1);
               
                for (int i = 0; i < aufn.getPop(0).getRobSchnapp().length; i++) {
                    RobSnapshot robSchnapp = aufn.getPop(bestPopNum).getRobSchnapp()[i];
                    RobEA rob = new RobEA(i, env, params, env.getRand());
                    rob.erzeugeAusSequenz(0, robSchnapp.getVStdCodes()[0], null, false);
                    env.hinzuRobotRand(rob);
                   
                    // Speichere einen beliebigen (hoffentlich representativen) Roboterautomaten.
                    if (i == 0) {
                        StaticMethods.saveAutPNG(
                                robSchnapp.getVStdCodes()[0],
                                storedRuns[filesFinished].getName() + "_simTrajTime_" + simZyk.getLastTick() + "_simOriginalTime_" + aufn.getPop(bestPopNum).getId() + ".png",
                                params);
                        rob.speichereAuts(storedRuns[filesFinished].getName() + "_simTrajTime_" + simZyk.getLastTick() + "_simOriginalTime_" + aufn.getPop(bestPopNum).getId());
                    }
                }
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.statistik.RobSnapshot

                             final int endSnap,
                             final boolean fitness) {
        this.guiSim.loescheFeld();
        long lang = 20;
        Vector2D norm;
        RobSnapshot rob;
        int anfang = startSnap;
        int ende = endSnap;
        PopSnapshot pop;
        Vector2D[] letzte = new Vector2D[grIndizes.length];
        byte farbe;
       
        for (int i = anfang; i <= ende; i++) {
            pop = this.aufnahme.getPop(i);
            for (int j = 0; j < grIndizes.length; j++) {
                rob = pop.getRobSchnapp()[grIndizes[j]];
               
                farbe
                    = eas.simulation.ConstantsSimulation.FARBEN_BENUTZER[
                      grIndizes[j]
                      % eas.simulation.ConstantsSimulation.FARBEN_BENUTZER.length];
               
                if (letzte[j] != null) {
                    this.guiSim.getUmgeb().setzeLinie(
                                              (int) letzte[j].x,
                                              (int) letzte[j].y,
                                              (int) rob.getPosition().x,
                                              (int) rob.getPosition().y,
                                              farbe,
                                              true,
                                              false,
                                              false,
                                              false);

                    norm = new Vector2D(letzte[j].x, letzte[j].y);
                    norm.sub(new Vector2D(
                            rob.getPosition().x,
                            rob.getPosition().y));
                    norm.ortho();
                    norm.norm();
                   
                    lang = rob.getFitSum();
                   
                    if (lang <= 0) {
                        lang = 5;
                        farbe = eas.simulation.ConstantsSimulation.FARBE_SEL;
                    } else {
                        lang += 5;
                    }
                   
                    if (!fitness) {
                        lang = 0;
                    }
                   
                    this.guiSim.getUmgeb().setzeLinie(
                            (int) rob.getPosition().x - norm.x * lang / 2,
                            (int) rob.getPosition().y - norm.y * lang / 2,
                            (int) rob.getPosition().x + norm.x * lang / 2,
                            (int) rob.getPosition().y + norm.y * lang / 2,
                            farbe,
                            true,
                            false,
                            false,
                            false);

                } else {
                    // Setze Kreuz + ersten Punkt.
                    int x1 = (int) rob.getPosition().x - 10;
                    int y1 = (int) rob.getPosition().y - 10;
                    int x2 = (int) rob.getPosition().x + 10;
                    int y2 = (int) rob.getPosition().y + 10;
                    this.guiSim.getUmgeb().setzeLinie(
                            x1, y1, x2, y2, farbe,
                            true, false, false, false);
                    this.guiSim.getUmgeb().setzeLinie(
                            x2, y1, x1, y2, farbe,
                            true, false, false, false);
                    this.guiSim.getUmgeb().setzeLinie(
                            x1 + 1, y1, x2 + 1, y2, farbe,
                            true, false, false, false);
                    this.guiSim.getUmgeb().setzeLinie(
                            x2 + 1, y1, x1 + 1, y2, farbe,
                            true, false, false, false);
                    this.guiSim.getUmgeb().setzeLinie(
                            x1 - 1, y1, x2 - 1, y2, farbe,
                            true, false, false, false);
                    this.guiSim.getUmgeb().setzeLinie(
                            x2 - 1, y1, x1 - 1, y2, farbe,
                            true, false, false, false);
                }

                letzte[j] = rob.getPosition();
            }
        }
       
        this.guiSim.getUmgeb().beendeZeichenSession();
    }
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.statistik.RobSnapshot

                // Starte n Generationen vor der besten Population.
                bestPopNum = Math.max(0, bestPopNum - 1);
               
                for (int i = 0; i < aufn.getPop(0).getRobSchnapp().length; i++) {
                    RobSnapshot robSchnapp = aufn.getPop(bestPopNum).getRobSchnapp()[i];
                    RobEA rob = new RobEA(i, env, params, env.getRand());
                    rob.erzeugeAusSequenz(0, robSchnapp.getVStdCodes()[0], null, false);
                    env.hinzuRobotRand(rob);
                   
                    // Speichere einen beliebigen (hoffentlich representativen) Roboterautomaten.
                    if (i == 0) {
                        rob.speichereAuts(storedRuns[filesFinished].getName() + "_simTrajTime_" + simZyk.getLastTick() + "_simOriginalTime_" + aufn.getPop(bestPopNum).getId());
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.statistik.RobSnapshot

   
    private List<RobSnapshot> roblistToRobsnlist(final List<RobEA> liste) {
        ArrayList<RobSnapshot> liste2
            = new ArrayList<RobSnapshot>(liste.size());
        for (RobEA r : liste) {
            liste2.add(new RobSnapshot(r));
        }
       
        return liste2;
    }
View Full Code Here

Examples of eas.simulation.spatial.sim2D.marbSimulation.statistik.RobSnapshot

    private RobSnapshot xmlRobToRob(final RoboterTyp xmlrob) {
        if (xmlrob == null) {
            return null;
        }

        RobSnapshot robSnap;
        int idNum = xmlrob.getID();
        int[] bewertungen = new int[1];
        bewertungen[0] = xmlrob.getFit();
        String[] vSequenzen = new String[1];
        String[] vStdSequenzen = new String[1];
        String[] tSequenzen = new String[1];
        String[] tStdSequenzen = new String[1];
        String[] sensString = xmlrob.getSens().split(";");
        int[] sens = new int[sensString.length];
        Vector2D pos = new Vector2D(
                xmlrob.getPos().getX(),
                xmlrob.getPos().getY());
        double wink = xmlrob.getPos().getWinkel();
        double breit = xmlrob.getDehn().getX();
        double lang = xmlrob.getDehn().getY();
        int zust = xmlrob.getZust();
       
        vSequenzen[0] = xmlrob.getVG(); // Direkte Adressierung.
        if (vSequenzen[0].length() > 0 && vSequenzen[0].charAt(0) == '!') {
            // Indirekte Adressierung.
            int adresse = Integer.parseInt(vSequenzen[0].substring(1));
            vSequenzen[0] = this.xmlAufn.getAufnahme().getPopulationArray(
                    adresse).getRoboterArray(xmlrob.getID()).getVG();
        }
           
        vStdSequenzen[0] = xmlrob.getVP(); // Direkte Adressierung.
        if (vStdSequenzen[0].length() > 0
                && vStdSequenzen[0].charAt(0) == '!') {
            // Indirekte Adressierung.
            int adresse = Integer.parseInt(vStdSequenzen[0].substring(1));
            vStdSequenzen[0] = this.xmlAufn.getAufnahme().getPopulationArray(
                    adresse).getRoboterArray(xmlrob.getID()).getVP();
        }
           
        tSequenzen[0] = xmlrob.getTG(); // Direkte Adressierung.
        if (tSequenzen[0].length() > 0 && tSequenzen[0].charAt(0) == '!') {
            // Indirekte Adressierung.
            int adresse = Integer.parseInt(tSequenzen[0].substring(1));
            tSequenzen[0] = this.xmlAufn.getAufnahme().getPopulationArray(
                    adresse).getRoboterArray(xmlrob.getID()).getTG();
        }
           
        tStdSequenzen[0] = xmlrob.getTP(); // Direkte Adressierung.
        if (tStdSequenzen[0].length() > 0
                && tStdSequenzen[0].charAt(0) == '!') {
            // Indirekte Adressierung.
            int adresse = Integer.parseInt(tStdSequenzen[0].substring(1));
            tStdSequenzen[0] = this.xmlAufn.getAufnahme().getPopulationArray(
                    adresse).getRoboterArray(xmlrob.getID()).getTP();
        }
           
        for (int i = 0; i < sensString.length; i++) {
            sens[i] = Integer.parseInt(sensString[i]);
        }
       
        // Zu beachten: zustand = -1 ==> zustand ist Startzustand.
        robSnap = new RobSnapshot(
                idNum,
                bewertungen,
                vSequenzen,
                vStdSequenzen,
                new ConstLeaf[bewertungen.length], // Conditions.
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.