Package eas.plugins.standard.eaPlugin.xmlRecording

Examples of eas.plugins.standard.eaPlugin.xmlRecording.XMLAufnLesen


            ArrayList<SingleParameter> allPars0 = null;
            for (String s : gespGr) {
                if (new File(path + "\\" + s + "-fitness.txt").exists()) {
                    params.logInfo("Datei existiert bereits: " + s + "-fitness.txt");
                } else {
                    XMLAufnLesen read = new XMLAufnLesen(new File(path + "\\" + s), params);
                    params.logInfo("Datei gelesen: " + s);
                   
                    if (allPars0 == null) {
                        allPars0 = read.getParams().getAllPars();
                    }
                   
                    ParCollection parColl = read.getParams();
                   
                    ArrayList<SingleParameter> allParsI = parColl.getAllPars();
                    for (SingleParameter par0 : allPars0) {
                        for (SingleParameter parI : allParsI) {
                            if (par0.getParameterName().equals(parI.getParameterName())) {
                                if (!par0.getParValue().equals(parI.getParValue())) {
                                    differingPars.add(par0.getParameterName());
                                }
                            }
                        }
                    }
                }
            }
        }
       
        params.logInfo("Folgende sich ändernde Parameter gefunden: " + differingPars);
       
        int window = 50;
        double[] formerValues = new double[window];
        int count;
       
        // Extrahiere Fitness in Einzeldateien.
        for (String s : gespGr) {
            if (new File(path + "\\" + s + "-fitness.txt").exists()) {
                params.logInfo("Datei existiert bereits: " + s + "-fitness.txt");
            } else {
                   
                XMLAufnLesen read = new XMLAufnLesen(new File(path + "\\" + s), params);
                params.logInfo("Datei gelesen: " + s);
                LinkedList<String> fitness = new LinkedList<String>();
   
                String preAmble = "";
                for (String par : differingPars) {
                    preAmble += par + "=" + read.getParams().getParValue(par) + ";";
                }

                count = 0;
                double lastMovingAvgVal = 0;
                int fitsumGes = 0;
               
                for (Population pop : read.getAllPopulations()) {
                   
                    String fit = "" + preAmble;
                    fit += pop.getCycle() + ";";
                    double fitSum = 0;
                    int min = Integer.MAX_VALUE;
View Full Code Here


    }
   
    @Override
    public synchronized void runDuringSimulation(EnvironmentEA env, Wink simZyk, ParCollection params) {
        super.runDuringSimulation(env, simZyk, params);
        XMLAufnLesen aufn = null;

        if (simZyk.getLastTick() % Math.round(params.getParValueDouble("saveInterval")) == 0) {
            if (filesFinished < storedRuns.length) {
                env.removeAllAgents();
   
                String compressedFileName = storedRuns[filesFinished].getPath();
                String decompressedFileName = params.getStdDirectory() + File.separator + StaticMethods.datNamOhneHintErw(storedRuns[filesFinished].getPath());
               
                params.log(StaticMethods.LOG_INFO, "This is Trajectory Master at time " + simZyk + ".");
               
                StaticMethods.entpackeDatei(compressedFileName, decompressedFileName, false); // Set to true to delete compressed file.
                params.log(StaticMethods.LOG_INFO, "Decompressed '" + compressedFileName + "' to '" + decompressedFileName + "'.");
   
                aufn = new XMLAufnLesen(new File(decompressedFileName), params);
                params.log(StaticMethods.LOG_INFO, "Loaded '" + decompressedFileName + "'.");
               
                StaticMethods.deleteDAT(decompressedFileName);
                params.log(StaticMethods.LOG_INFO, "Deleted temp files.");

                int bestPopNum = findBestPopulationMovingAverage(aufn, 5, storedRuns[filesFinished].getName(), params);

                // 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());
                    }
                }
                       
                filesFinished++;
            } else {
View Full Code Here

     *              extrahiert.
     */
    public static void main(final String[] args) {
        ParCollection paramsAkt = GlobalVariables.getPrematureParameters();
        paramsAkt.overwriteParameterList(args);
        XMLAufnLesen aufn = null;
       
        // Extrahiere alle Fitnesswerte.
        if (args.length > 1
            && args[1].toLowerCase().equals("allefitnesswerte")) {
            StaticMethods.log(StaticMethods.LOG_INFO,
                          "Extrahiere alle Fitnesswerte in " + args[0] + ".",
                          paramsAkt);
            StatisticMethods.extrahiereAlleFit(args[0], paramsAkt);
            StaticMethods.log(StaticMethods.LOG_INFO,
                          "Fitnesswerte extrahiert.",
                          paramsAkt);
            return;
        }

        // Normaler Programmstart.
        StaticMethods.log(StaticMethods.LOG_INFO,
                      "Aufnahme wird geladen (" + args[0] + ")...",
                      paramsAkt);
        try {
            if (StaticMethods.datEndung(args[0]).equals("gz")) {
                StaticMethods.entpackeDatei(args[0], StaticMethods
                        .datNamOhneHintErw(args[0]), false);
                aufn = new XMLAufnLesen(new File(StaticMethods
                        .datNamOhneHintErw(args[0])), paramsAkt);
            } else {
                aufn = new XMLAufnLesen(new File(args[0]), paramsAkt);
            }

            StaticMethods.log(StaticMethods.LOG_INFO, "Aufn.-Parameter: \n"
                    + aufn.getParams(), paramsAkt);
            aufn.getParams().complete();
        } catch (final Exception e) {
            StaticMethods.log(
                    StaticMethods.LOG_ERROR,
                    "Aufnahme konnte nicht geladen werden (Ursache:\n"
                        + e
                        + "\n)",
                    paramsAkt);
            e.printStackTrace();
        }
       
        TraceBetrachter steuer = new TraceBetrachter(
                aufn,
                aufn.getParams(),
                paramsAkt);
       
        // Speichere letzte Population.
        if (args.length > 1
            && args[1].toLowerCase().equals("nurletzter")) {
View Full Code Here

    }
   
    @Override
    public synchronized void runDuringSimulation(EnvironmentEA env, Wink simZyk, ParCollection params) {
        super.runDuringSimulation(env, simZyk, params);
        XMLAufnLesen aufn = null;

        if (simZyk.getLastTick() % Math.round(params.getParValueDouble("saveInterval")) == 0) {
            if (filesFinished < storedRuns.length) {
                env.removeAllAgents();
   
                String compressedFileName = storedRuns[filesFinished].getPath();
                String decompressedFileName = params.getStdDirectory() + File.separator + StaticMethods.datNamOhneHintErw(storedRuns[filesFinished].getPath());
               
                params.log(StaticMethods.LOG_INFO, "This is Trajectory TEMP Master at time " + simZyk + ".");
               
                StaticMethods.entpackeDatei(compressedFileName, decompressedFileName, false); // Set to true to delete compressed file.
                params.log(StaticMethods.LOG_INFO, "Decompressed '" + compressedFileName + "' to '" + decompressedFileName + "'.");
   
                aufn = new XMLAufnLesen(new File(decompressedFileName), params);
                params.log(StaticMethods.LOG_INFO, "Loaded '" + decompressedFileName + "'.");
               
                StaticMethods.deleteDAT(decompressedFileName);
                params.log(StaticMethods.LOG_INFO, "Deleted temp files.");

                int bestPopNum = findBestPopulationMovingAverage(aufn, 5);

                // 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());
                    }
                }
                       
                filesFinished++;
            } else {
View Full Code Here

                    true);
        }
       
        gespGr = pfad.list(new FileNamePostfixFilter(endung));
       
        XMLAufnLesen aufn;
        String sGes;
        String zusGes;

        for (int i = 0; i < gespGr.length; i++) {
            StaticMethods.log(StaticMethods.LOG_INFO,
                "Extrahiere Fitness ("
                    + verz
                    + File.separator
                    + gespGr[i]
                    + ").",
                params);
            try {
                String fitnessDatei = "FIT-" + gespGr[i] + ".txt";
                String zusatzDatei = "ZUS-" + gespGr[i] + ".txt";

                if (new File(
                        verz + File.separator + fitnessDatei).exists()
                        && new File(
                                verz + File.separator + zusatzDatei).exists()) {
                    // Falls die Ergebnisdateien schon existieren:
                    StaticMethods.log(
                            StaticMethods.LOG_INFO,
                            "Text-Dateien existieren bereits.",
                            params);
                } else {
                    aufn = new XMLAufnLesen(
                            new File(
                                    verz
                                    + File.separator
                                    + gespGr[i]),
                            params);
View Full Code Here

TOP

Related Classes of eas.plugins.standard.eaPlugin.xmlRecording.XMLAufnLesen

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.