Commit 32bbf4b7 authored by Adéla Štěpková's avatar Adéla Štěpková
Browse files

running experiments

parent e6bc80a8
Loading
Loading
Loading
Loading
+9529 −0

File added.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/recHanoi03_true-unreach-call_true-termination.c_2175.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/nested9_true-unreach-call.i_1475.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/nested9_true-unreach-call.i_1738.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/recHanoi03_true-unreach-call_true-termination.c_367.0.mata
# /home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/recHanoi03_true-unreach-call_true-termination.c_367.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/Primes_true-unreach-call.c_678.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/nested9_true-unreach-call.i_1777.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/nested9_true-unreach-call.i_1357.0.mata
@@ -24,7 +24,7 @@
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/nested9_true-unreach-call.i_1798.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/nested9_true-unreach-call.i_762.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/nested9_true-unreach-call.i_1722.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/Primes_true-unreach-call.c_1657.0.mata
# /home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/Primes_true-unreach-call.c_1657.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/nested9_true-unreach-call.i_1749.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/MADWiFi-encode_ie_ok_true-unreach-call.i_7.0.mata
/home/notme/nfa-bench/benchmarks/presburger/complement/UltimateAutomizer/nested9_true-unreach-call.i_1107.0.mata
+9090 −0

File added.

Preview size limit exceeded, changes collapsed.

+9366 −0

File added.

Preview size limit exceeded, changes collapsed.

+43 −15
Original line number Diff line number Diff line
import sys
import os
import mmap
aligater_path = os.path.dirname(os.path.dirname(__file__))
sys.path.append(aligater_path)

@@ -85,6 +86,8 @@ def count_sccs(nfa: ExtendedNFA, data, timeout):
        data["avg_scc_size"] = sum(scc_sizes) / len(scc_sizes)
        data["one_state_sccs"] = one_state_sccs

    # partitioning does not make sense if there is only 1 scc
    if len(sccs) > 1:
        det_partition = partition_into_comp_infos(PortsNFA(nfa), sccs, method=PortPartitionEnum.DETERMINISTIC)
        data["det_components_count"] = len(det_partition)

@@ -106,9 +109,23 @@ def count_sccs(nfa: ExtendedNFA, data, timeout):

def get_statistics(source: str, xml_path: str, timeout: int):

    with open(xml_path, "w") as file:
        file.write("<data>\n")
    # prepare xml file
    if os.path.isfile(xml_path):
        # do not overwrite the file if it already exists
        with open(xml_path, "r") as xml_file:
            for line in xml_file:
                pass
            
            if "</data>" in line:
                print(f"The xml file {xml_path} already exists and is finalized, aborting.")
                return

    else:
        xml_file = open(xml_path, "w")
        xml_file.write("<data>\n")
        xml_file.close()

    # prepare file paths
    if os.path.isdir(source):
        file_paths = [filename.path for filename in os.scandir(source)]
    elif os.path.isfile(source):
@@ -119,6 +136,17 @@ def get_statistics(source: str, xml_path: str, timeout: int):
        print("invalid source, not file or directory")
        return
    
    # get files to skip
    files_to_skip = []
    with open(xml_path, "r") as xml_file:
        with mmap.mmap(xml_file.fileno(), 0, access=mmap.ACCESS_READ) as s:
            for file_path in file_paths:
                _, name = os.path.split(file_path)
                if s.find(name.encode('utf-8')) != -1:
                    files_to_skip.append(file_path)

    file_paths = [path for path in file_paths if path not in files_to_skip]

    for nfa, name in parser.load_from_iterable(file_paths):
        print(datetime.datetime.now().strftime('%H:%M:%S'), name)

Loading