Beispiel #1
0
        public ISatisfactionRate GetESR(Goal goal, IEnumerable <Obstacle> onlyObstacles)
        {
            if (obstructionSuperset == null || prebuilt_element != goal)
            {
                obstructionSuperset = new ObstructionSuperset(goal);
            }

            var random = new Random(_seed);
            var s_sr   = new double[_n_samples];

            for (int i = 0; i < _n_samples; i++)
            {
                var vector = new RandomizedSamplingVector(_model, random, onlyObstacles?.Select(x => x.Identifier)?.ToHashSet());
                s_sr[i] = 1.0 - obstructionSuperset.GetProbability(vector);
            }

            return(new SimulatedSatisfactionRate(s_sr));
        }
        public ISatisfactionRate GetESR(Goal goal, IEnumerable <Obstacle> onlyObstacles)
        {
            ObstructionSuperset os;

            if (!obstructionSupersets.ContainsKey(goal.Identifier))
            {
                os = new ObstructionSuperset(goal);
            }
            else
            {
                os = obstructionSupersets[goal.Identifier];
            }

            var vector = new SamplingVector(_model, onlyObstacles?.Select(x => x.Identifier)?.ToHashSet());
            var value  = 1.0 - os.GetProbability(vector);

            return(new DoubleSatisfactionRate(value));
        }
Beispiel #3
0
        public virtual ISatisfactionRate GetESR(Obstacle obstacle)
        {
            if (obstructionSuperset == null || prebuilt_element != obstacle)
            {
                obstructionSuperset = new ObstructionSuperset(obstacle);
            }

            var random = new Random(_seed);
            var s_sr   = new double[_n_samples];

            for (int i = 0; i < _n_samples; i++)
            {
                var vector = new RandomizedSamplingVector(_model, random);
                s_sr[i] = obstructionSuperset.GetProbability(vector);
            }

            return(new SimulatedSatisfactionRate(s_sr));
        }
        public virtual ISatisfactionRate GetESR(Goal goal)
        {
            ObstructionSuperset os;

            if (!obstructionSupersets.ContainsKey(goal.Identifier))
            {
                //Console.WriteLine("Computing new OS for " + goal.Identifier);
                os = new ObstructionSuperset(goal);
                //Console.WriteLine("---");
                //Console.WriteLine(os.ToDot());
                //Console.WriteLine("---");
            }
            else
            {
                os = obstructionSupersets[goal.Identifier];
            }
            var vector = new SamplingVector(_model);

            double v = os.GetProbability(vector);

            //Console.WriteLine("Obstruction set probability: "  + v);
            return(new DoubleSatisfactionRate(1.0 - v));
        }
Beispiel #5
0
 public virtual void PreBuildObstructionSet(Goal goal)
 {
     prebuilt_element    = goal;
     obstructionSuperset = new ObstructionSuperset(goal);
 }