def check_split(conn, verbose): result, refobj = asst2.load_result('split') val = asst2.similarity(result, refobj, verbose) if val < 1.: if verbose: print("INFO: attempting to load resplit tables") try: result, refobj = asst2.load_result('resplit') num_partials = len(refobj) marks = (total - partial * num_partials) * val**2 for i, refelem in enumerate(refobj): try: table = result[i] except IndexError: print("ERROR: student does not have resplit[%d]" % i) continue val = asst2.similarity(table, refelem, verbose) marks += partial * val**2 conn.send(marks) return except KeyError: print("WARNING: could not load resplit table from student") conn.send(total * val**2)
def check_optimal(conn, verbose): result, refobj = asst2.load_result('optimal') val = asst2.similarity(result, refobj, verbose) if val >= cutoff: conn.send(math.sqrt(val)*total) else: conn.send(0)
def check_hit(conn, verbose): result, refobj = asst2.load_result('hit') val = asst2.similarity(result, refobj, verbose) conn.send(total * val**2)
def check_strategy(conn, verbose): result, refobj = asst2.load_result('strategy') val = asst2.similarity(result, refobj, verbose) conn.send(total * val**2)