Package eas.simulation.spatial.sim2D.marbSimulation.endlAutomat

Examples of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.EndlicherAutomat


        genotype.addAll(initialGenotype);
        int mutNum = 0;
       
        // Erzeuge initialen Automaten.
        Script initialScript = automaton.translate(EndlicherAutomat.bereinigeStatic(StaticMethods.ListToString(this.initialGenotype)));
        EndlicherAutomat initialEA = new EndlicherAutomat();
        automaton.getScriptInterpreter().generateAutomaton(initialEA, initialScript);
        String initialString = initialEA.erzeugeStringSeq();
       
        // Instantiiere Testautomaten.
        Script testScript;
        EndlicherAutomat testEA = new EndlicherAutomat();
        String testString;
       
        for (int k = 0; k < maxNumOfMutations; k++) {
            List<Integer> initialSeq, mutatedSeq;
            initialSeq = this.genotype;
            mutatedSeq = initialSeq;
           
            // Mutiere Sequenz so lange, bis sie verändert ist.
            while (initialSeq.equals(mutatedSeq)) {
                if (mutNum % 10000 == 9999) {
                    this.pars.logWarning(this.getClass().getSimpleName() + ": Keine Änderung nach " + mutNum + " Mutationen.");
                }
                this.genotype = this.mutation.mutiere(this.genotype);
                mutatedSeq = this.genotype;
                mutNum++;
            }
           
            // Erzeuge Testautomaten.
            testScript = automaton.translate(EndlicherAutomat.bereinigeStatic(StaticMethods.ListToString(this.genotype)));
            automaton.getScriptInterpreter().generateAutomaton(testEA, testScript);
            testString = testEA.erzeugeStringSeq();
            if (!testString.equals(initialString)) {
                if (k + 1 > this.maxValue) {
                    maxValue = k + 1;
                }
               
View Full Code Here


                this.conds[i]
                    = StaticMethods.ausFormatBed(this.conds[i - 1].formatted());
            }
            this.fits[i] = 0;

            this.vAut[i] = new EndlicherAutomat(this.earlErk, this.scriptInt);
            if (this.observer != null) {
                this.vAut[i].addObserver(this.observer);
            }
            this.verhCodes[i] = this.getVAut()[i].generateSequence();
        }
View Full Code Here

                this.vAut[i].generateFromSequence(
                        seq[i],
                        trans2[i],
                        pruefen, this.getPars());

                bereinigt = (new EndlicherAutomat()).bereinige(seq[i]);
                this.verhCodes[i] = StaticMethods.listSeqAusString(bereinigt);

                if (cond != null && i < cond.length && cond[i] != null) {
                    this.conds[i] = cond[i];
                }
View Full Code Here

                        ScriptInterpreter.MODUS_VERHALTEN),
                this.getPars());
       
        this.translatoren[transNum].generateFromSequence(seq, trans, pruefen, this.getPars());
       
        bereinigt = (new EndlicherAutomat()).bereinige(seq);
        this.transCodes[transNum] = StaticMethods.listSeqAusString(bereinigt);
       
//        if (trans != null) {
//            trans.setModus(altMod);
//        }
View Full Code Here

    public MARBBrain(
            final AgentType brainsBody,
            final String sequence,
            final ParCollection params) {
        super(brainsBody);
        marb = new EndlicherAutomat();
        marb.erzeugeAusStdSequenz(sequence);
        this.pars = params;
        this.master = new ArrowMaster(this.pars);
    }
View Full Code Here

     */
    @Override
    public Condition mutiere(final Condition cond) {
        StaticMethods.log(StaticMethods.LOG_ERROR, "Bedingungsmutation verwendet.",
                this.pars);
        EndlicherAutomat aut = new EndlicherAutomat();
        Long[] intObj = new Long[5];
        ArrayList<Long> vert = new ArrayList<Long>(5);
       
        aut.einfuegenKnoten(1, 1, 1, 1);
        aut.einfuegKante(1, 1, cond, 1);

       
        for (int i = 0; i < intObj.length; i++) {
            intObj[i] = new Long(i);
        }
       
        vert.add(new Long(10)); // 0 : mutationBedA
        vert.add(new Long(9)); //  1 : mutationBedBeinfacher
        vert.add(new Long(3)); //  2 : mutationBedZahl
        vert.add(new Long(6)); //  3 : mutationBedkomplexer
        vert.add(new Long(1)); //  4 : mutationBedSensVar
       
        Long rnd = (Long) MiscMath.randVerteilung(
                intObj,
                vert,
                this.getRand());
       
        switch(rnd.intValue()) {
        case 0:
            this.mutationBedA(aut);
            break;
        case 1:
            this.mutationBedBeinfacher(aut);
            break;
        case 2:
            this.mutationBedZahl(aut);
            break;
        case 3:
            this.mutationBedkomplexer(aut);
            break;
        case 4:
            this.mutationBedSensVar(aut);
            break;
        default:
            break;
        }

        return aut.holeKnoten(1).getInfo().getBedingungen().get(0).getCond();
    }
View Full Code Here

     *
     * @param robID  Der Roboter, dessen Automaten neu übersetzt werden sollen.
     * @param level  Der Level i, ab dem übersetzt werden soll.
     */
    private void translationFuerRoboterAbLevel(final int robID, final int level, ParCollection params) {
        EndlicherAutomat ea;
        Translator trans;
       
        if (this.automaten.get(robID) == null) {
            this.automaten.put(robID, new ArrayList<EndlicherAutomat>(this.mutationsarten.size()));
        }

        // Oberste Hierarchiestufe initialisieren.
        if (this.getAutomat(robID, this.levelAnzahl - 1) == null) {
            if (params.getParValueBoolean("UseTranslatorWITHCompletingTransitions")) {
                if (this.levelAnzahl <= 2) {
                    this.setAutomat(robID, ConstantsTranslator.getStdTranslatorBE(params), this.levelAnzahl - 1);
                } else {
                    this.setAutomat(robID, ConstantsTranslator.getStdTranslatorTR(params), this.levelAnzahl - 1);
                }
            } else {
                if (this.levelAnzahl <= 2) {
                    this.setAutomat(robID, ConstantsTranslatorWOC.getStdTranslatorBE(params), this.levelAnzahl - 1);
                } else {
                    this.setAutomat(robID, ConstantsTranslatorWOC.getStdTranslatorTR(params), this.levelAnzahl - 1);
                }
            }
        }
       
        if (level > 1) {
            trans = new Translator("", this.scriptInterpreterTranslator, this.pars);
        } else {
            trans = new Translator("", this.scriptInterpreterVerhalten, this.pars);
        }

        // Konstanter Translator-Level.
        if (level >= this.levelAnzahl - 1) {
            throw new RuntimeException("Translator vom Level " + level + " ist konstant und kann nicht mutiert bzw. neu übersetzt werden.");
        } else if (level > 0) { // (Mutierbarer oder unmutierbarer) Translator-Level.
            this.setAutomat(robID, trans, level);
            trans.generateFromSequence(StaticMethods.stringAusListSeq(this.getGenom(robID, level)), (Translator) this.getAutomat(robID, level + 1), false, params);
            this.setAutomat(robID, trans, level);
           
            params.logStage1(this.id().toUpperCase() + " -- Roboter " + robID
                    + " / Level " + level + " (StdSeq übersetzt: \""
                    + this.getAutomat(robID, level).erzeugeStringSeq() + "\")");
           
            this.translationFuerRoboterAbLevel(robID, level - 1, params);
        } else { // Verhaltenslevel.
            ea = new EndlicherAutomat();
            this.setAutomat(robID, ea, level);
            ea.generateFromSequence(
                    StaticMethods.stringAusListSeq(this.getGenom(robID, level)),
                    (Translator) this.getAutomat(robID, level + 1), false, params);
            this.setAutomat(robID, ea, level);
           
            params.logStage1(this.id().toUpperCase() + " -- Roboter " + robID
View Full Code Here

TOP

Related Classes of eas.simulation.spatial.sim2D.marbSimulation.endlAutomat.EndlicherAutomat

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.