Ejemplo n.º 1
0
from automata import frontend, weighted_frontend, row_vector, tools

reqs = tools.convert("new-example-requirement")
plant = tools.convert(
    "new-example-a new-example-b new-example-c new-example-d new-example-e new-example-f"
)

operator = 0
rvecs = 0
L = 2

weighted_frontend.make_greedy_time_optimal_supervisor(
    plant, reqs, "{(a,c),(a,e),(c,e),(b,d),(b,f),(d,f)}",
    "new-example-sup-0.cfg", L)
tools.filter_results("new-example-sup-0.cfg",
                     "new-example-sup-0-unweighted.cfg")
weighted_frontend.LBE_make_greedy_time_optimal_supervisor(
    plant, reqs, "{(a,c),(a,e),(c,e),(b,d),(b,f),(d,f)}")

#operator = 1
#rvecs = row_vector.row_vector_compute(plant,reqs, "{(a,c),(a,e),(c,e),(b,d),(b,f),(d,f)}", "vectors.cfg", operator)
#weighted_frontend.make_greedy_time_optimal_supervisor_row_vectors(plant, reqs, "{(a,c),(a,e),(c,e),(b,d),(b,f),(d,f)}","new-example-sup-1.cfg", rvecs, operator)
#tools.filter_results("new-example-sup-1.cfg", "new-example-sup-1-unweighted.cfg" )
#operator = 2
#rvecs = row_vector.row_vector_compute(plant,reqs, "{(a,c),(a,e),(c,e),(b,d),(b,f),(d,f)}", "vectors.cfg", operator)
#weighted_frontend.make_greedy_time_optimal_supervisor_row_vectors(plant, reqs, "{(a,c),(a,e),(c,e),(b,d),(b,f),(d,f)}","new-example-sup-2.cfg", rvecs, operator)
#tools.filter_results("new-example-sup-2.cfg", "new-example-sup-2-unweighted.cfg" )

print "******Generation of F"
weighted_frontend.FK_row_vector(plant, reqs,
                                "{(a,c),(a,e),(c,e),(b,d),(b,f),(d,f)}")
from automata import frontend, weighted_frontend, row_vector, tools

#reqs  = tools.convert("new-example-requirement")
#plant = tools.convert("new-example-a new-example-b new-example-c new-example-d new-example-e new-example-f")
reqs = tools.convert(
    "Z1SPEC Z2SPEC Z3SPEC Z4SPEC WS1SPEC WS2SPEC WS3SPEC IPSSPEC COUNTJOBSSPEC-1jobs MOVEALLSPEC"
)
plant = tools.convert("AGV1 AGV2 AGV3 AGV4 AGV5")

#operator = 0
#rvecs = 0
L = 50

#weighted_frontend.make_greedy_time_optimal_supervisor(plant, reqs, "{(a,c),(a,e),(c,e),(b,d),(b,f),(d,f)}","new-example-sup-0.cfg",L)
#tools.filter_results("new-example-sup-0.cfg", "new-example-sup-0-unweighted.cfg" )
weighted_frontend.make_greedy_time_optimal_supervisor(
    plant, reqs,
    "{(11,20),(11,23),(13,20),(13,23),(18,33),(18,31),(24,33),(24,31),(21,41),(21,44),(26,41),(26,44),(40,51),(40,53),(43,51),(43,53),(32,50),(46,50),(32,46),(12,34),(28,42),(10,22),(11,22),(13,22),(11,24),(13,24),(10,20),(10,23),(12,20),(12,23),(20,31),(20,33),(26,31),(26,33),(18,32),(18,34),(24,32),(24,34),(18,41),(18,44),(28,41),(28,44),(21,40),(21,46),(26,40),(26,46),(40,50),(40,52),(43,50),(43,52),(42,51),(42,53),(44,51),(44,53)}",
    "AGV-example-sup.cfg", L)
tools.filter_results("AGV-example-sup.cfg",
                     "AGV-example-sup.cfg-unweighted.cfg")

weighted_frontend.LBE_make_greedy_time_optimal_supervisor(
    plant, reqs,
    "{(11,20),(11,23),(13,20),(13,23),(18,33),(18,31),(24,33),(24,31),(21,41),(21,44),(26,41),(26,44),(40,51),(40,53),(43,51),(43,53),(32,50),(46,50),(32,46),(12,34),(28,42),(10,22),(11,22),(13,22),(11,24),(13,24),(10,20),(10,23),(12,20),(12,23),(20,31),(20,33),(26,31),(26,33),(18,32),(18,34),(24,32),(24,34),(18,41),(18,44),(28,41),(28,44),(21,40),(21,46),(26,40),(26,46),(40,50),(40,52),(43,50),(43,52),(42,51),(42,53),(44,51),(44,53)}"
)
from automata import frontend, weighted_frontend, row_vector,tools

#plant = convert("algorithm2-M algorithm2-M")
#reqs  = convert("algorithm2-SPEC1 algorithm2-SPEC1")
#row_vector_compute(plant, reqs, "{(a,c),(b,c),(a,d),(c,d)}", 1)

plant = tools.convert("wmw-M1 wmw-M2")
reqs  = tools.convert("WMW-SPEC3 WMW-SPEC4 WMW-SPEC51 WMW-SPEC52")
operator = 1
# for algorithm 2, the operator is one; for algorithm 3, the operator is two
rvecs = row_vector.row_vector_compute(plant,reqs, "{(b11,a21),(b22,a12)}", "vectors.cfg", operator)

weighted_frontend.make_greedy_time_optimal_supervisor(plant, reqs, "{(b11,a21),(b22,a12)}","WMW-example-sup.cfg", rvecs)
tools.filter_results("WMW-example-sup.cfg", "WMW-unweight.cfg")
frontend.make_abstraction("WMW-unweight.cfg", "a11, a12, a21, a22, b11, b12, b21, b22", "WMW-example-simsup.cfg")
frontend.make_dot("WMW-example-simsup.cfg", "WMW-example-simsup.dot")
Ejemplo n.º 4
0
from automata import frontend, weighted_frontend, row_vector, tools

reqs = tools.convert(
    "H11 H12 H13 H14 H21 H22 H23 H24 H31 H32 H33 H34 job-number-2")
plant = tools.convert(
    "TC_in TC_out TR1 TR2 TR3 TB1 TB2 TProc_11 TProc_12 TProc_21 TProc_22 TProc_31 TProc_32 TProc_33"
)

#operator = 0
#rvecs = 0
L = 50

weighted_frontend.make_greedy_time_optimal_supervisor(
    plant, reqs, "type1", "Cluster-Tool-example-sup.cfg", L)
tools.filter_results("Cluster-Tool-example-sup.cfg",
                     "Cluster-Tool-example-sup.cfg-unweighted.cfg")

#weighted_frontend.LBE_make_greedy_time_optimal_supervisor(plant, reqs, "type1")

weighted_frontend.make_time_optimal_supervisor(plant, reqs, "type1",
                                               "Cluster-Tool-example-sup.cfg")
Ejemplo n.º 5
0
####### Initialize #######
comp_string = "EPUCK1"
for i in range(1, num_comp):
    comp_string = comp_string + " EPUCK" + str(i+1)
with open("EPUCK-mut_ex_" + str(num_comp) + "_plants.txt", "r") as mut_ex_list_file:
    mut_ex_list = mut_ex_list_file.read()
# comp_string = "plant1 plant2"
# mut_ex_list = "{}"

####### Program #######

# Generate component data
coll = collection.Collection()
common.print_line("Loading automata...")
comp_names = tools.convert(comp_string)
comp_list = weighted_frontend.load_weighted_automata(coll, comp_names, False, True)

common.print_line("Computing event data...")
evt_pairs = taskresource.process_event_pairs(coll, None, mut_ex_list)
eventdata, heap_len = taskresource.compute_custom_eventdata(comp_list, evt_pairs)

def find_distances_to_marker(comp_list):
    distances_structure = {}
    for comp in comp_list:
        distances_to_marker = {}
        
        # Find marker state
        # Maybe edit this part to work for automata with multiple marker states?
        end_state = None
        while end_state == None: