Example #1
0
 public NeuralRobot(BasicNetwork network, bool track, Position source, Position destination)
 {
     _hStats = new NormalizedField(NormalizationAction.Normalize, "Heading", 359, 0, .9, -.9);
     _CanGoStats = new NormalizedField(NormalizationAction.Normalize, "CanGo", 1, 0, 0.9, -0.9);
     _track = track;
     _network = network;
     sim = new RobotSimulator(source, destination);
 }
        /// <summary>
        /// Construct the training generator. 
        /// </summary>
        /// <param name="thePath">The path to use.</param>
        public GenerateTraining(string thePath)
        {
            _path = thePath;
            _trainingFile = FileUtil.CombinePath(new FileInfo(_path), Config.FilenameTrain);

            _fieldDifference = new NormalizedField(NormalizationAction.Normalize, "diff", Config.DiffRange,
                                                  -Config.DiffRange, 1, -1);
            _fieldOutcome = new NormalizedField(NormalizationAction.Normalize, "out", Config.PipRange, -Config.PipRange,
                                               1, -1);
        }
        public NeuralPilot(BasicNetwork network, bool track)
        {
            _fuelStats = new NormalizedField(NormalizationAction.Normalize, "fuel", 200, 0, -0.9, 0.9);
            _altitudeStats = new NormalizedField(NormalizationAction.Normalize, "altitude", 10000, 0, -0.9, 0.9);
            _velocityStats = new NormalizedField(NormalizationAction.Normalize, "velocity",
                                                LanderSimulator.TerminalVelocity, -LanderSimulator.TerminalVelocity,
                                                -0.9, 0.9);

            _track = track;
            _network = network;
        }
        public void Execute(IExampleInterface app)
        {
            // Normalize values with an actual range of (0 to 100) to (-1 to 1)
            var norm = new NormalizedField(NormalizationAction.Normalize,
                                           null, 100, 0, 1, -1);

            double x = 5;
            double y = norm.Normalize(x);

            Console.WriteLine(x + @" normalized is " + y);

            double z = norm.DeNormalize(y);

            Console.WriteLine(y + @" denormalized is " + z);
        }
Example #5
0
 public double[] Process(double[] inputArray)
 {
     double num;
     double[] numArray;
     int num2;
     int num3;
     this._x24d1ebc88ca906aa = new NormalizedField();
     goto Label_0097;
     Label_0010:
     if (num2 >= inputArray.Length)
     {
         goto Label_0085;
     }
     Label_0023:
     numArray[num2] = this._x24d1ebc88ca906aa.Normalize(inputArray[num2]);
     num2++;
     if ((((uint) num2) - ((uint) num3)) <= uint.MaxValue)
     {
         goto Label_0010;
     }
     Label_0085:
     if (((uint) num3) <= uint.MaxValue)
     {
         return numArray;
     }
     Label_0097:
     this._x24d1ebc88ca906aa.NormalizedHigh = this._x891507b50bbab0f9;
     if ((((uint) num) - ((uint) num)) > uint.MaxValue)
     {
         goto Label_0023;
     }
     this._x24d1ebc88ca906aa.NormalizedLow = this._x136bfff0efb12047;
     double[] numArray2 = inputArray;
     num3 = 0;
     while (true)
     {
         if (num3 >= numArray2.Length)
         {
             numArray = new double[inputArray.Length];
             num2 = 0;
             goto Label_0010;
         }
         num = numArray2[num3];
         this._x24d1ebc88ca906aa.Analyze(num);
         num3++;
     }
 }
        /// <summary>
        /// Construct the indicator. 
        /// </summary>
        /// <param name="theMethod">The machine learning method to use.</param>
        /// <param name="thePath">The path to use.</param>
        public MyInd(IMLRegression theMethod, string thePath)
            : base(theMethod != null)
        {
            _method = theMethod;
            _path = thePath;

            RequestData("CLOSE[1]");
            RequestData("SMA(10)[" + Config.InputWindow + "]");
            RequestData("SMA(25)[" + Config.InputWindow + "]");

            _fieldDifference = new NormalizedField(NormalizationAction.Normalize, "diff", Config.DiffRange,
                                                  -Config.DiffRange, 1, -1);
            _fieldOutcome = new NormalizedField(NormalizationAction.Normalize, "out", Config.PipRange, -Config.PipRange,
                                               1, -1);
        }