public void setDNA(dna nD)
 {
     this.weights_1 = copy_matrix(nD.getWeights1());
     this.weights_2 = copy_matrix(nD.getWeights2());
     this.weights_3 = copy_matrix(nD.getWeights3());
     this.bias1     = copy_matrix(nD.getb1());
     this.bias2     = copy_matrix(nD.getb2());
     this.bias3     = copy_matrix(nD.getb3());
 }
    public dna crossover_DNA(dna parent_b)
    {
        Matrix <float> w1 = copy_matrix(parent_b.getWeights1());
        Matrix <float> w2 = copy_matrix(parent_b.getWeights2());
        Matrix <float> w3 = copy_matrix(parent_b.getWeights3());
        Matrix <float> b1 = copy_matrix(parent_b.getb1());
        Matrix <float> b2 = copy_matrix(parent_b.getb2());
        Matrix <float> b3 = copy_matrix(parent_b.getb3());

        Matrix <float> new_w1 = copy_matrix(weights_1);

        for (int i = 0; i < (this.weights_1.RowCount * this.weights_1.ColumnCount) / 2; i++)
        {
            int randI = Random.Range(0, this.weights_1.RowCount);
            int randJ = Random.Range(0, this.weights_1.ColumnCount);
            new_w1[randI, randJ] = w1[randI, randJ];
        }

        Matrix <float> new_w2 = copy_matrix(weights_2);

        for (int i = 0; i < (this.weights_2.RowCount * this.weights_2.ColumnCount) / 2; i++)
        {
            int randI = Random.Range(0, this.weights_2.RowCount);
            int randJ = Random.Range(0, this.weights_2.ColumnCount);
            new_w2[randI, randJ] = w2[randI, randJ];
        }

        Matrix <float> new_w3 = copy_matrix(weights_3);

        for (int i = 0; i < (this.weights_3.RowCount * this.weights_3.ColumnCount) / 2; i++)
        {
            int randI = Random.Range(0, this.weights_3.RowCount);
            int randJ = Random.Range(0, this.weights_3.ColumnCount);
            new_w3[randI, randJ] = w3[randI, randJ];
        }

        Matrix <float> new_b1 = copy_matrix(bias1);

        for (int i = 0; i < (this.bias1.RowCount * this.bias1.ColumnCount) / 2; i++)
        {
            int randI = Random.Range(0, this.bias1.RowCount);
            new_b1[randI, 0] = b1[randI, 0];
        }

        Matrix <float> new_b2 = copy_matrix(bias2);

        for (int i = 0; i < (this.bias2.RowCount * this.bias2.ColumnCount) / 2; i++)
        {
            int randI = Random.Range(0, this.bias2.RowCount);
            new_b2[randI, 0] = b2[randI, 0];
        }

        Matrix <float> new_b3 = copy_matrix(bias3);

        for (int i = 0; i < (this.bias3.RowCount * this.bias3.ColumnCount) / 2; i++)
        {
            int randI = Random.Range(0, this.bias3.RowCount);
            new_b3[randI, 0] = b3[randI, 0];
        }

        dna new_dna = new dna();

        new_dna.setDNA(new_w1, new_w2, new_w3, new_b1, new_b2, new_b3);
        return(new_dna);
    }