Beispiel #1
0
        /// <summary>
        /// Question part of the model
        /// </summary>
        /// <param name="person">The person.</param>
        /// <param name="suffix">The suffix.</param>
        /// <exception cref="System.Exception">Unrolling not implemented if more than two skills needed for a question</exception>
        private void QuestionModelPart(int person, string suffix = "")
        {
            for (int question = 0; question < this.NumberOfQuestions; question++)
            {
                int[] skillsNeeded = this.SkillsNeeded[question];
                switch (skillsNeeded.Length)
                {
                case 1:
                    this.isCorrect[person][question].SetTo(
                        Factors.AddNoise(
                            this.unrolledSkills[person][skillsNeeded[0]],
                            this.ProbabilityOfNotMistake,
                            this.ProbabilityOfGuess));
                    break;

                case 2:
                    var hasSkills =
                        (this.unrolledSkills[person][skillsNeeded[0]] & this.unrolledSkills[person][skillsNeeded[1]])
                        .Named("hasSkills" + (question + 1) + suffix);

                    this.isCorrect[person][question].SetTo(
                        Factors.AddNoise(hasSkills, this.ProbabilityOfNotMistake, this.ProbabilityOfGuess));
                    break;

                default:
                    throw new Exception("Unrolling not implemented if more than two skills needed for a question");
                }
            }
        }