コード例 #1
0
ファイル: communication.py プロジェクト: jwcarr/flatlanders
def CommAccuracy(chain, generation):
    dynamic_set = basics.load(3, chain, generation, "d")
    static_set = basics.load(3, chain, generation, "s")
    accuracy = 0
    for item in dynamic_set + static_set:
        target_triangle = item[1] + ";" + item[2] + ";" + item[3]
        selected_triangle = item[5] + ";" + item[6] + ";" + item[7]
        if target_triangle == selected_triangle:
            accuracy += 1
    return accuracy
コード例 #2
0
ファイル: rater_generator.py プロジェクト: jwcarr/flatlanders
def generation_pairs(chain, generation):
    dynamic_set = basics.load(3, chain, generation, "d")
    static_set = basics.load(3, chain, generation, "s")
    triangle_pairs = []
    for item in dynamic_set + static_set:
        target_triangle = item[1] + ";" + item[2] + ";" + item[3]
        selected_triangle = item[5] + ";" + item[6] + ";" + item[7]
        if target_triangle != selected_triangle:
            triangle_pairs.append([target_triangle, selected_triangle])
    return triangle_pairs
コード例 #3
0
ファイル: communication.py プロジェクト: jwcarr/flatlanders
def CommError(chain, generation, distances=None):
    if distances == None:
        distances = reliable_distances
    dynamic_set = basics.load(3, chain, generation, "d")
    static_set = basics.load(3, chain, generation, "s")
    triangle_pairs = []
    for item in dynamic_set + static_set:
        target_triangle = item[1] + ";" + item[2] + ";" + item[3]
        selected_triangle = item[5] + ";" + item[6] + ";" + item[7]
        if target_triangle != selected_triangle:
            triangle_pairs.append(target_triangle + "~" + selected_triangle)
    error = 0.0
    for pair in triangle_pairs:
        error += distances[pair]
    return error