var Gene = {
    numberOfNeurons: 3,
    dimension: 3,
    // vectorLength: 1 + numberOfNeurons + numberOfNeurons * dimension + numberOfNeurons,
    createNew: function () {
        var gene = {};
        gene.theta = 0;
        gene.vector = [];
        gene.rbf = RBF.createNew();
        gene.clone = function () {
            var geneNew = Gene.createNew();
            for (var i = 0; i < this.vector.length; i++)
                geneNew.vector[i] = this.vector[i];
            geneNew.normalization();
            return geneNew;
        };
        gene.normalization = function (gene) {
            this.vector[0] = Math.min(Math.max(this.vector[0], 0), 1);
            this.rbf.theta = this.vector[0];
            for (var i = 0; i < Gene.numberOfNeurons; i++) {
                this.vector[i + 1] = Math.min(Math.max(this.vector[i + 1], 0), 80);
                this.rbf.W[i] = this.vector[i + 1];
            }
            for (var i = 1 + Gene.numberOfNeurons, j = 0; i < 1 + Gene.numberOfNeurons + Gene.numberOfNeurons * Gene.dimension; i++, j++) {
                this.vector[i] = Math.min(Math.max(this.vector[i], 0), 30);
                this.rbf.M[parseInt(j / Gene.dimension)][parseInt(j % Gene.dimension)] = this.vector[i];
            }
            for (var i = 1 + Gene.numberOfNeurons + Gene.numberOfNeurons * Gene.dimension, j = 0; i < 1 + Gene.numberOfNeurons + Gene.numberOfNeurons * Gene.dimension + Gene.numberOfNeurons; i++, j++) {
                this.vector[i] = Math.min(Math.max(this.vector[i], 0.000001), 10);
                this.rbf.sigma[j] = this.vector[i];
            }
        };
        gene.randomBuild = function () {
            this.vector[0] = Math.random();
            for (var i = 1; i < 1 + Gene.numberOfNeurons; i++) {
                this.vector[i] = Math.random();
            }
            for (var i = 1 + Gene.numberOfNeurons; i < 1 + Gene.numberOfNeurons + Gene.numberOfNeurons * Gene.dimension; i++) {
                this.vector[i] = Math.random() * 30;
            }
            for (var i = 1 + Gene.numberOfNeurons + Gene.numberOfNeurons * Gene.dimension; i < 1 + Gene.numberOfNeurons + Gene.numberOfNeurons * Gene.dimension + Gene.numberOfNeurons; i++) {
                this.vector[i] = Math.random() * 10;
            }
            this.normalization();
        };
        return gene;
    }
};

@@ -2314,32 +2314,1122 @@
 n();%0A        %7D;%0A
+        gene.getFitness = function (yD, x) %7B%0A            var value = 0;%0A            for (var i = 0; i %3C yD.length; i++) %7B%0A                var fX = this.rbf.getOutput(x%5Bi%5D);%0A                value += Math.pow(yD%5Bi%5D - fX, 2);%0A            %7D%0A            value = value / 2.0;%0A            return value;%0A        %7D;%0A        gene.getVectorTypeName = function () %7B%0A            var typeName = %5B%5D;%0A            typeName%5B0%5D = %22theta%22;%0A            for (var i = 1; i %3C= Gene.numberOfNeurons; i++) %7B%0A                typeName%5Bi%5D = %22w%22 + i;%0A            %7D%0A            for (var i = 1 + Gene.numberOfNeurons, j = 0; i %3C 1 + Gene.numberOfNeurons + Gene.numberOfNeurons * Gene.dimension; i++, j++) %7B%0A                typeName%5Bi%5D = %22m%22 + (j / Gene.dimension + 1) + %22,%22 + (j %25 Gene.dimension + 1);%0A            %7D%0A            for (var i = 1 + Gene.numberOfNeurons + Gene.numberOfNeurons * Gene.dimension, j = 0; i %3C 1 + Gene.numberOfNeurons + Gene.numberOfNeurons * Gene.dimension + Gene.numberOfNeurons; i++, j++) %7B%0A                typeName%5Bi%5D = %22sigma%22 + (j + 1);%0A            %7D%0A            return typeName;%0A        %7D;%0A
         return g

Update gene