示例#1
0
        internal int Afterthought(double [][] helix, ref double [] ans)
        {
            double[]   add      = new double[max];
            double[][] question = new double[NaturalSelection.vN][];
            int        passover = 0;
            int        addendum;
            byte       num = 0;

            for (byte b = 0; b < NaturalSelection.vAN; b++)
            {
                foreach (double[] d in helix)
                {
                    question[num] = this.BinaryRedux(d[b]);
                    fuzzify(ref question[num]);
                    addendum = unit + passover;
                    for (int c = passover; c < addendum; c++)
                    {
                        byte slider = 0;
                        add[c] = question[num][slider];
                        slider++;
                    }
                    passover += unit;
                    num++;
                }
            }

            input[0]  = add;
            output[0] = lastAns;


            bool end;
            int  count = 0;


            do
            {
                end = false;
                count++;
                precog.Train(input, output, TrainingType.BackPropogation, 1);

                for (byte c = 0; c < unit; c++)
                {
                    double check = Math.Abs(precog.OutputLayer[c].Output - lastAns[c]);
                    if (check > .01)
                    {
                        end = true;
                    }
                }
            } while (end && (count < 1000));
            for (byte c = 0; c < unit; c++)
            {
                ans[c] = precog.OutputLayer[c].Output;
            }
            antifuzzify(ref ans);


            Console.Write("Guess Value: ");
            Console.WriteLine(BinaryAddux(ans));
            return(count);
        }
示例#2
0
        internal double genesis(double [][] helix, double[] ans)
        {
            double[]   muse     = new double[unit];
            double[]   add      = new double[max];
            double[][] question = new double[NaturalSelection.vN][];
            int        passover = 0;
            int        addendum;
            byte       num = 0;

            for (byte b = 0; b < NaturalSelection.vAN; b++)
            {
                foreach (double[] d in helix)
                {
                    question[num] = this.BinaryRedux(d[b]);
                    fuzzify(ref question[num]);
                    addendum = unit + passover;
                    for (int c = passover; c < addendum; c++)
                    {
                        byte slider = 0;
                        add[c] = question[num][slider];
                        slider++;
                    }
                    passover += unit;
                    num++;
                }
            }

            bool end;
            int  count = 0;

            if (game >= 100)
            {
                game = this.Afterthought(helix, ref muse);
            }
            game += 100;


            input[0]  = add;
            output[0] = ans;
            do
            {
                end = false;
                count++;
                net.Train(input, output, TrainingType.BackPropogation, 1);

                for (byte c = 0; c < unit; c++)
                {
                    double check = Math.Abs(net.OutputLayer[c].Output - ans[c]);
                    if (check > .1)
                    {
                        end = true;
                    }
                }
            }while (end);
            for (byte c = 0; c < unit; c++)
            {
                ans[c] = net.OutputLayer[c].Output;
            }
            lastAns = ans;
            antifuzzify(ref ans);


            return(BinaryAddux(ans));
        }