Beispiel #1
0
def get_result(benchmark: Benchmark, execution: Execution):
    """
    Returns the result of the given execution on the given benchmark.
    This method is called after executing the commands of the associated invocation.
    One can either find the result in the tooloutput (as done here) or
    read the result from a file that the tool has produced.
    The returned value should be either 'true', 'false', a decimal number, or a fraction.
    """
    invocation = execution.invocation
    log = execution.concatenate_logs()
    pos = log.find("+ Property {}".format(benchmark.get_property_name()))
    if pos < 0:
        return None
    pos = log.find("Probability: ", pos)
    if pos < 0:
        pos = log.find("Value: ")
        if pos < 0:
            pos = log.find("Result: ")
            if pos < 0:
                return None
            else:
                pos = pos + len("Result: ")
                eol_pos = log.find("\n", pos)
                return log[pos:eol_pos].lstrip()
        else:
            pos = pos + len("Value: ")
            eol_pos = log.find("\n", pos)
            return log[pos:eol_pos]
    else:
        pos = pos + len("Probability: ")
        eol_pos = log.find("\n", pos)
        return log[pos:eol_pos]
Beispiel #2
0
def get_result(benchmark: Benchmark, execution: Execution):
    """
    Returns the result of the given execution on the given benchmark.
    This method is called after executing the commands of the associated invocation.
    One can either find the result in the tooloutput (as done here) or
    read the result from a file that the tool has produced.
    The returned value should be either 'true', 'false', or a decimal number.
    """
    invocation = execution.invocation
    log = execution.concatenate_logs()

    if "PRISM-games" in log:
        # SMC
        pos = log.find("Result (maximum probability): ")
        if pos < 0:
            pos = log.find("Result (minimum probability): ")
            if pos < 0:
                return None
        pos = pos + len("Result (---imum probability): ")
        eol_pos = log.find("\n", pos)
        return log[pos:eol_pos]
    else:
        # PET
        pos = log.find("Output:\n")
        if pos < 0:
            return None
        pos = pos + len("Output:\n")
        eol_pos = log.find("\n", pos)
        if pos == eol_pos:
            return None
        return log[pos:eol_pos]
Beispiel #3
0
def get_result(benchmark: Benchmark, execution: Execution):
    """
    Returns the result of the given execution on the given benchmark.
    This method is called after executing the commands of the associated invocation.
    One can either find the result in the tooloutput (as done here) or
    read the result from a file that the tool has produced.
    The returned value should be either 'true', 'false', a decimal number, or a fraction.
    """
    invocation = execution.invocation
    log = execution.concatenate_logs()
    return grep_for_result(benchmark, log)
Beispiel #4
0
def get_result(benchmark: Benchmark, execution: Execution):
    """
	Returns the result of the given execution on the given benchmark.
	This method is called after executing the commands of the associated invocation.
	One can either find the result in the tooloutput (as done here) or
	read the result from a file that the tool has produced.
	The returned value should be either 'true', 'false', a decimal number, or a fraction.
	"""
    invocation = execution.invocation
    log = execution.concatenate_logs()
    RESULT_MARKER = "point estimate: "
    pos = log.find(RESULT_MARKER)
    if pos < 0:
        return None
    pos = pos + len(RESULT_MARKER)
    eol_pos = log.find(",", pos)
    return log[pos:eol_pos]
Beispiel #5
0
def get_result(benchmark: Benchmark, execution: Execution):
    """
    Returns the result of the given execution on the given benchmark.
    This method is called after executing the commands of the associated invocation.
    One can either find the result in the tooloutput (as done here) or
    read the result from a file that the tool has produced.
    The returned value should be either 'true', 'false', a decimal number, or a fraction.
    """
    invocation = execution.invocation
    log = execution.concatenate_logs()
    pos = log.find("command-check-result-is ")
    if pos < 0:
        return None
    pos += len("command-check-result-is ")
    eol_pos = log.find("\n", pos)
    space_pos = log.find(" ", pos)
    if (eol_pos < space_pos):
        return log[pos:eol_pos].rstrip()
    else:
        return log[pos:space_pos].rstrip()
Beispiel #6
0
def get_result(benchmark: Benchmark, execution: Execution):
    """
    Returns the result of the given execution on the given benchmark.
    This method is called after executing the commands of the associated invocation.
    One can either find the result in the tooloutput (as done here) or
    read the result from a file that the tool has produced.
    The returned value should be either 'true', 'false', a decimal number, or a fraction.
    """
    invocation = execution.invocation
    log = execution.concatenate_logs()
    if "Storm-dft" in log:
        pos = log.find("Result: [")
        if pos >= 0:
            pos = pos + len("Result: [")
            pos_e = log.find("]\n", pos)
            if pos_e >= 0:
                return log[pos:pos_e]

    pos1 = log.find("Model checking property \"{}\":".format(
        benchmark.get_property_name()))
    if pos1 < 0:
        return None
    for pre_result_str in [
            "Result (for initial states): ",
            "Result till abort (for initial states): "
    ]:
        pos2 = log.find(pre_result_str, pos1)
        if pos2 < 0: continue
        pos2 += len(pre_result_str)
        eol_pos = log.find("\n", pos2)
        result = log[pos2:eol_pos]
        pos_appr = result.find("(approx. ")
        if pos_appr >= 0:
            result = result[:pos_appr]
        return result
    return None