Exemplo n.º 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));
        }
Exemplo n.º 2
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));
        }