コード例 #1
0
    // Declare member variables here. Examples:
    // private int a = 2;
    // private string b = "text";

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        double[] data = new double[] { 3, 3, 3 };

        Counter          counter       = new Counter();
        Genome           master        = new Genome();
        GenesisPhenotype gp            = new GenesisPhenotype(counter, master, 3, 3);
        List <Neuron>    inputNeurons  = gp.InputNeurons;
        List <Neuron>    outputNeurons = gp.OutputNeurons;
        List <Synapse>   synapses      = gp.Synapses;

        Phenotype new_pheno = new Phenotype(master, synapses, inputNeurons, outputNeurons, new List <Neuron>(), counter);
        Phenotype clone     = new_pheno.Clone();

        for (int i = 0; i < 1; i++)
        {
            new_pheno.Mutate();
            clone.Mutate();
        }
        double[] output  = new_pheno.Forward(data);
        double[] output2 = clone.Forward(data);

        PrintOutput(output);
        PrintOutput(output2);


        Phenotype mate = new_pheno.Mate(clone);

        double[] output3 = mate.Forward(data);
        PrintOutput(output3);
    }
コード例 #2
0
ファイル: pop_manager.cs プロジェクト: Uggeli/GodotNeat
        public PopulationManager(int popSize, int nInputs, int nOutputs)
        {
            this.popSize = popSize;
            GenesisPhenotype proto = new GenesisPhenotype(this.counter, this.MasterGenome, nInputs, nOutputs);
            Phenotype        Adam  = new Phenotype(MasterGenome, proto.Synapses, proto.InputNeurons, proto.OutputNeurons, new List <Neuron>(), counter);

            for (int i = 0; i < popSize; i++)
            {
                Phenotype newClone = Adam.Clone();
                // newClone.Mutate();
                Population.Add(newClone);
            }
        }