Exemplo n.º 1
0
        public double Train()
        {
            lock (tempRoute)
            {
                if (tempRoute.Count > 0)
                {
                    route.AddRange(tempRoute);

                    int length = (route.Count - NEEDED_COUNT) / 2;
                    if (length > inputLength)
                    {
                        length = inputLength;
                    }

                    if ((length > 0) && ((mlp == null) || (mlp.inputLength != length)))
                    {
                        lasterror = 1000;
                        mlp       = new PredictorMLP(2, length);
                    }

                    if (route.Count > maxLength)
                    {
                        route.RemoveRange(0, route.Count - maxLength);
                    }
                    tempRoute.Clear();
                }
            }
            double[] input = MakeInput(route);
            if ((input != null) && (mlp != null))
            {
                if (lasterror > 0.08)
                {
                    lasterror = mlp.Train(input);
                }
                return(lasterror);
            }
            else
            {
                return(0);
            }

            return(0);
        }
Exemplo n.º 2
0
        public double Train()
        {
            
            lock (tempRoute)
            {
                if (tempRoute.Count > 0)
                {
                    route.AddRange(tempRoute);

                    int length = (route.Count - NEEDED_COUNT) / 2;
                    if (length > inputLength) length = inputLength;

                    if ((length > 0) && ((mlp == null) || (mlp.inputLength != length)))
                    {
                        lasterror = 1000;
                        mlp = new PredictorMLP(2, length);
                    }

                    if (route.Count > maxLength) route.RemoveRange(0, route.Count - maxLength);
                    tempRoute.Clear();
                }
            }
            double[] input = MakeInput(route);
            if ((input != null) && (mlp != null))
            {
                if (lasterror > 0.08)
                {
                    lasterror = mlp.Train(input);
                }
                return lasterror;
            }
            else return 0;
          
            return 0;
        }