Пример #1
0
        public UncertainFact(string p_Name, bool p_IsFactAboutTheBot, string p_Question, VarRef <FiniteDist <bool> > p_ProbVariable, string[] p_AllPossibleAnswers, double[] p_ProbabilitiesForEachPossibleAnswer, UIAnswer p_UI)
        {
            Name = p_Name;
            IsFactAboutTheBot = p_IsFactAboutTheBot;
            Question          = p_Question;
            ProbVariable      = p_ProbVariable;
            //NumberOfPossibleAnswers = p_NumberOfPossibleAnswers;
            AllPossibleAnswers = p_AllPossibleAnswers;
            probabilitiesForEachPossibleAnswer = p_ProbabilitiesForEachPossibleAnswer;
            UI = p_UI;

            if (AllPossibleAnswers.Length != NumberOfPossibleAnswers)
            {
                throw new Exception("Mismatch number of answers for: " + Name);
            }
            if (ProbabilitiesForEachPossibleAnswer.Length != NumberOfPossibleAnswers)
            {
                throw new Exception("Mismatch number of answers for: " + Name);
            }
        }
Пример #2
0
        public UncertainFact(string p_Name, bool p_IsFactAboutTheBot, string p_Question, VarRef <FiniteDist <bool> > p_ProbVariable, string[] p_AllPossibleAnswers, UIAnswer p_UI, double p_ProbChange)
        {
            Name = p_Name;
            IsFactAboutTheBot = p_IsFactAboutTheBot;
            Question          = p_Question;
            ProbVariable      = p_ProbVariable;
            //NumberOfPossibleAnswers = p_NumberOfPossibleAnswers;
            AllPossibleAnswers = p_AllPossibleAnswers;
            probabilitiesForEachPossibleAnswer = new double[NumberOfPossibleAnswers];
            UI         = p_UI;
            ProbChange = p_ProbChange;

            if (AllPossibleAnswers.Length != NumberOfPossibleAnswers)
            {
                throw new Exception("Mismatch number of answers for: " + Name);
            }
            if (ProbabilitiesForEachPossibleAnswer.Length != NumberOfPossibleAnswers)
            {
                throw new Exception("Mismatch number of answers for: " + Name);
            }

            //p_ProbChange has been provided without a list of probabilities, so they must be calculated the first time
            RecalculateProbForEachAnswer();
        }