Exemplo n.º 1
0
        /// <summary>
        /// This method can be executed several times, it returns the same if the probability has not been updated between the calls
        /// </summary>
        public void RecalculateProbForEachAnswer()
        {
            if (ProbChange != -1)
            {
                //UncertainFact provided only with ProbChange (not fixed list of probabilities)

                probabilitiesForEachPossibleAnswer[0] = SharedHelper.IncreaseProb(ProbVariable.RefValue.ProbOf(e => e == true), -ProbChange);

                probabilitiesForEachPossibleAnswer[1] = ProbVariable.RefValue.ProbOf(e => e == true).Value; //get the current value

                probabilitiesForEachPossibleAnswer[2] = SharedHelper.IncreaseProb(ProbVariable.RefValue.ProbOf(e => e == true), ProbChange);

                //UnityEngine.Debug.LogWarning("Recalculate answers probabilities for " + this.Name + ": " + probabilitiesForEachPossibleAnswer[0] + " " + probabilitiesForEachPossibleAnswer[1] + " " + probabilitiesForEachPossibleAnswer[2]);
            }
            else
            {
                SharedHelper.LogWarning("Prob change requested for " + Name + ", but this question is with fixed probabilities");
            }

            #region debug
            if (probabilitiesForEachPossibleAnswer.Sum() == 0)
            {
                SharedHelper.LogError("Probabilities are all 0!!! for " + Name);
            }
            #endregion
        }