def worker(x,
           model,
           set_static_percentage=False,
           no_output=False,
           num_students=10,
           num_assignments=1):
    # Omit output if true
    if not no_output:
        print("{0} of {1} | ({2}%)".format(x, num_students,
                                           (x / num_students) * 100.0))

    # Initialize a student
    student = model(id=x)

    #  Set static values if true
    if set_static_percentage:
        student.static = True
        student.static_percentage = x

    #  Init expectation matrix
    student.matrix, student.history_matrix = sm.get_expectation_matrix()
    student.assign_hobbit(hh_sceptical)

    # Request taskset for student
    for y in range(num_assignments):
        student.request_taskset()
        answer = student.answer_taskset()
        student.deliver_taskset(answer)

    # Return student
    return student
def worker(
        x,
        model,
        set_static_percentage=False,
        no_output=False,
        num_students=10,
        num_assignments=10,
        epsilon=.0
):
    # Omit output if true
    if not no_output:
        print("{0} of {1} | ({2}%)".format(x, num_students, (x/num_students)*100.0))

    # Initialize a student
    student = model(id=x, static_epsilon=True )
    student.epsilon = epsilon

    #  Set static values if true
    if set_static_percentage:
        student.static = True
        student.static_percentage = x

    #  Init expectation matrix
    student.matrix, student.history_matrix = sm.get_expectation_matrix()
    student.assign_hobbit(hh_sceptical)

    # Request taskset for student
    for y in range(num_assignments):
        student.request_taskset()
        answer = student.answer_taskset()
        student.deliver_taskset(answer)

    # Return student
    return student
def worker(
        x,
        model,
        num_students=10,
        num_assignments=10
):
    #print("{0} of {1} | ({2}%)".format(x, num_students, (x/num_students)*100.0))

    # Initialize a student
    student = model(id=x)
    student.static = True
    student.static_percentage = x

    #  Init expectation matrix
    student.matrix, student.history_matrix = sm.get_expectation_matrix()
    student.assign_hobbit(hh_sceptical)

    # Request taskset for student
    for y in range(num_assignments):
        student.request_taskset()
        answer = student.answer_taskset()
        student.deliver_taskset(answer)

    # Return student
    return student
Exemplo n.º 4
0
def worker(x, model, set_static_percentage=False, tasks=100):

    # Initialize a student
    student = model(id=x)

    #  Set static values if true
    if set_static_percentage:
        student.static = True
        student.static_percentage = x

    #  Init expectation matrix
    student.matrix, student.history_matrix = sm.get_expectation_matrix()
    student.assign_hobbit(hh_sceptical)

    # Request taskset for student
    for x in range(tasks):
        student.request_taskset(num=1)
        answer = student.answer_taskset()
        if answer[0][2]:
            student.winloss["win"] += 1
        else:
            student.winloss["loss"] += 1

        student.deliver_taskset(answer)
        #print(answer, student.hobbit.get_skill())

    # Return student
    return student
Exemplo n.º 5
0
from Algorithms.Hobbit.hobbit_sceptical import hobbit_sceptical as hh_sceptical
from Algorithms.Hobbit.hobbit_ssbt import hobbit_ssbt as hh_ssbt
import simulation_manager as sm
from StudentModel.Student import Student
import matplotlib.pyplot as plt

student = Student(id=1)
student.matrix, student.history_matrix = sm.get_expectation_matrix()
#student.assign_hobbit(hh_ssbt)

student.assign_hobbit(hh_sceptical)

for y in range(100):
    student.request_taskset(num=1)

    answer = []
    for task in student.get_taskset():
        print("----------")
        print("Task is: {0}".format(task))
        inp = input("Did you pass?: ")
        #inp = "y"
        if inp is "y":
            cell = student.hobbit.cell_of(task)
            student.reward(cell)
            answer.append((task[0], task[1], True))
        else:
            cell = student.hobbit.cell_of(task)
            student.punish(cell)
            answer.append((task[0], task[1], False))

    student.deliver_taskset(answer)
from Algorithms.Hobbit.hobbit_sceptical import hobbit_sceptical as hh_sceptical
from Algorithms.Hobbit.hobbit_ssbt import hobbit_ssbt as hh_ssbt
import simulation_manager as sm
from StudentModel.Student import Student
import matplotlib.pyplot as plt




student = Student(id=1)
student.matrix, student.history_matrix = sm.get_expectation_matrix()
#student.assign_hobbit(hh_ssbt)

student.assign_hobbit(hh_sceptical)




for y in range(100):
    student.request_taskset(num=1)

    answer = []
    for task in student.get_taskset():
        print("----------")
        print("Task is: {0}".format(task))
        inp = input("Did you pass?: ")
        #inp = "y"
        if inp is "y":
            cell = student.hobbit.cell_of(task)
            student.reward(cell)
            answer.append((task[0], task[1], True))