Exemplo n.º 1
0
        public static Scene testScene_featuressimulation(double distmean, double diststd, int features)
        {
            var r = new Scene();
            var c = new PinholeCamera(CameraIntrinsics.GOPROHERO3_BROWNR3_AFGEROND_EXTRADIST);

            r.Add(c);
            Random rand = new WH2006();

            for (int i = 0; i < features; i++)
            {
                var sensorx = rand.NextDouble() * c.Intrinsics.PictureSize.Width;
                var sensory = rand.NextDouble() * c.Intrinsics.PictureSize.Height;
                var dist    = Util.NextGaussian(distmean, diststd);
                r.Add(CreateFeatureFromCamera(c, sensorx, sensory, dist, i));
            }
            return(r);
        }
 public static WH2006 wH2006 = new WH2006();                                                                // random number generator
 public static Func <int, int, float> ReturnFunction(float yMin, float yMax, bool rand, params int[] sizes) // returns a function
 {
     if (rand)
     {
         return((int rows, int columns) => (float)wH2006.NextDouble() * (yMax - yMin) + yMin); // random
     }
     else
     {
         return((int rows, int columns) => (yMax - yMin) / sizes[0] / sizes[1] * rows + columns * (yMax - yMin) / sizes[1] + yMin); // definiteve
     }
 }
        public virtual IAction SelectAction(uint stateID)
        {
            //get current policy and normalize
            var policy = this.GetPolicy(stateID);

            //choose an action randomly based on policy/distribution for state
            var prob = Rand.NextDouble();
            var sum  = 0d;

            for (var i = 0; i < this.Actions.Count; i++)
            {
                sum += policy[(uint)i];
                if (sum >= prob)
                {
                    return(this.ActionList[i]);
                }
            }

            //should never get here if policy is non-zero
            return(this.SelectGreedyAction(stateID));
        }