def main():
    concepts = ["IA","IB","II"]
    num_answers = -1
    avg_concepts_involved = 2
    
    exm = exam.ProblemSet(concepts)
    answers = []
    
    # Now we want to get the model to update in real time.  Let's do this
    # interactively!
    p = problem.RandomProblem(concepts, num_answers, avg_concepts_involved)
    exm.addProblem(p)
    
    # The initial competence dictionary for all students is initialized to 0.5
    # for all concepts
    start_dic = {}
    for concept in concepts:
        start_dic[concept] = 0.5
    
    logistic_guess = start_dic
    binary_guess = start_dic
    linear_guess = start_dic
    
    print "Estimated Logistic Competence Level:\n" + str(logistic_guess)
    print "Estimated Binary Competence Level:\n" + str(binary_guess)
    print "Estimated Linear Competence Level:\n" + str(linear_guess)
    print p
    
    
    # interactive sessions are fun!
    # this explores how updating could work
    while raw_input("Answer Question? (y/n)  ")[0] == 'y':
        answer = (raw_input("Correctly? (y/n)  ")[0] == 'y')
        answers.append(answer)
        
        # update logistic model
        temp_stud = students.LogisticStudent(concepts)
        temp_stud.competences = logistic_guess
        logistic_guess = sim_annealing.most_likely_explanation( \
                                temp_stud, exm, answers, prob_map.MultMap())
        
        # update binary model
        temp_stud = students.BinaryStudent(concepts)
        temp_stud.competences = binary_guess
        binary_guess = sim_annealing.most_likely_explanation( \
                                temp_stud, exm, answers, prob_map.MultMap())

        # update linear model
        temp_stud = students.LinearStudent(concepts)
        temp_stud.competences = linear_guess
        linear_guess = sim_annealing.most_likely_explanation( \
                                temp_stud, exm, answers, prob_map.MultMap())
        
        print "Estimated Logistic Competence Level:\n" + str(logistic_guess)
        print "Estimated Binary Competence Level:\n" + str(binary_guess)
        print "Estimated Linear Competence Level:\n" + str(linear_guess)
        
        p = problem.RandomProblem(concepts, num_answers, avg_concepts_involved)
        exm.addProblem(p)
        print p
 log = students.LogisticStudent(cons)
 bin = students.BinaryStudent(cons)
 lin = students.LinearStudent(cons)
 all_students = {log: " log,", lin: " lin,", bin: " bin,"}
 for stu in all_students:
     for strat in strategies:
         for num_p in num_problems:
             for i in range(num_iterations):
                 stu.random_competences()
                 answers = []
                 exm = exam.RandomProblemSet(cons, num_p, num_answers, avg_concepts_involved)
                 for item in exm.problems:
                     result = random.random() < strat.process(stu.get_prob_correct(item))
                     answers.append(result)
                 true_comp = stu.get_competences()
                 guess = sim_annealing.most_likely_explanation(stu, exm, answers, strat)
                 f.write("\n")
                 f.write("\n")
                 f.write("\n")
                 f.write(all_students[stu] + strategies[strat] + str(len(cons)) + ", " + str(num_p) + "\n")
                 f.write(str(exm))
                 f.write("\n")
                 f.write(str(answers))
                 f.write("\n")
                 f.write(str(true_comp))
                 f.write("\n")
                 stu.competences = true_comp
                 f.write(str(students.get_probability_of_outcome(exm, answers, stu, strat)))
                 f.write("\n")
                 f.write(str(guess))
                 f.write("\n")