예제 #1
0
파일: tool.py 프로젝트: MKlauck/qcomp2020
def is_benchmark_supported(benchmark: Benchmark):
    """returns True if the provided benchmark is supported by the tool and if the given benchmark should appear on the generated benchmark list"""

    # list of input models ePMC does not support
    if benchmark.is_pta():
        # PTAs are not supported by ePMC
        return False
    if benchmark.is_ma():
        # MAs are not supported by ePMC
        return False


#    if benchmark.get_short_property_type() == "S":
#        # Steady state properties are not supported by ePMC
#        return False
    if benchmark.is_prism_inf():
        # CTMCs with infinite state-spaces are not supported by ePMC
        return False

    # list of properties ePMC supports : unbounded and time-bounded probabilistic reachability; steady-state probability
    if (not benchmark.is_unbounded_probabilistic_reachability()) and (
            not benchmark.is_time_bounded_probabilistic_reachability()) and (
                not benchmark.is_steady_state_probability()) and (
                    not benchmark.is_steady_state_reward()) and (
                        not benchmark.is_unbounded_expected_reward()):
        return False

    return True
예제 #2
0
파일: tool.py 프로젝트: MKlauck/qcomp2020
def is_benchmark_supported(benchmark: Benchmark, trackId):
    """returns True if the provided benchmark is supported by the tool and if the given benchmark should appear on the generated benchmark list"""

    if benchmark.is_pta() and benchmark.is_prism():
        # Some PTAs from Prism are not supported because either
        # modest can't apply digital clocks semantic due to open constraints, or
        # modest puts the time as branch-rewards on the models, which are not supported for time-bounded properties
        if benchmark.get_model_short_name() in [
                "firewire-pta", "zeroconf-pta"
        ]:
            return "time-bounded" not in benchmark.get_property_type()
        else:
            return False
    if benchmark.is_prism_inf() and benchmark.is_ctmc():
        # Storm does not support the CTMCs with infinite state-spaces
        return False

    # Time bounded queries on continuous time models can not be solved exactly
    if trackId in ["correct", "floating-point-correct"]:
        if "time-bounded" in benchmark.get_property_type() and (
                benchmark.is_ma() or benchmark.is_ctmc()):
            return False
    return True
예제 #3
0
파일: tool.py 프로젝트: MKlauck/qcomp2020
def is_benchmark_supported(benchmark: Benchmark):
    """
	Returns True if the provided benchmark is supported by the tool and
	if the given benchmark should appear on the generated benchmark list
	"""
    # DFTRES only supports Markovian models with purely spurious nondeterminism
    if not (benchmark.is_dtmc() or benchmark.is_ctmc() or benchmark.is_ma()):
        return False
    # User-defined functions (the "call" JANI operator) are not supported
    if "functions" in benchmark.get_jani_features():
        return False
    # Only time-accumulating or time-instant reward queries
    supported_queries = [
        "prob-reach", "prob-reach-time-bounded", "steady-state-prob"
    ]
    if not benchmark.get_property_type() in supported_queries:
        return False
    # No support for real variables yet
    real_vars = [ v for v in benchmark.load_jani_file()["variables"] \
         if v["type"] == "real"]
    if 0 < len(real_vars):
        return False
    # Some MAs have not-obviously-spurious nondeterminism and can't be simulated
    unsupported_models = [
        "bitcoin-attack",
    ]
    # The arithmetic operations of some models aren't supported
    unsupported_models += [
        "majority", "philosophers", "speed-ind", "dpm", "readers-writers"
    ]
    if benchmark.get_model_short_name() in unsupported_models:
        return False
    # All other models are supported
    if ONLY_QCOMP_2020_BENCHMARKS:
        return benchmark.get_identifier() in QComp2020_benchmarks
    else:
        return True
예제 #4
0
def get_invocations(benchmark : Benchmark):
	"""
	Returns a list of invocations that invoke the tool for the given benchmark.
	It can be assumed that the current directory is the directory from which execute_invocations.py is executed.
	For QCOMP 2020, this should return a list of invocations for all tracks in which the tool can take part. For each track an invocation with default settings has to be provided and in addition, an optimized setting (e.g., the fastest engine and/or solution technique for this benchmark) can be specified. Only information about the model type, the property type and the state space size are allowed to be used to tweak the parameters.
   
	If this benchmark is not supported, an empty list has to be returned.
	"""

	if not is_benchmark_supported(benchmark):
		return []
	short = benchmark.get_model_short_name()
	prop = benchmark.get_property_name()
	prop_type = benchmark.get_short_property_type()
	params = benchmark.get_parameter_values_string()
	instance = short + "." + params
	size = benchmark.get_num_states_tweak()

	invocations = []

	benchmark_settings = ""
	if benchmark.get_open_parameter_def_string() != "":
		benchmark_settings += "-E " + benchmark.get_open_parameter_def_string() + " "
	benchmark_settings += "--props " + benchmark.get_property_name()

	default_base = "mcsta/modest mcsta " + benchmark.get_janifilename() + " " + benchmark_settings + " -O out.txt Minimal --unsafe --es"
	specific_base = default_base + tweak_memory(benchmark) # specific settings
	default_base += " -S Memory"

	#
	# Track "floating-point-correct"
	#
	skip = False
	precision = "0"
	default_cmd  = default_base  + " --no-partial-results"
	specific_cmd = specific_base + " --no-partial-results"
	if prop_type == "S" or (benchmark.is_ma() or benchmark.is_ctmc()) and benchmark.is_time_bounded_probabilistic_reachability():
		# long-run average or time-bounded on MA/CTMC: no fp-exact algorithm available
		skip = True
	elif prop_type == "P":
		# probabilistic reachability: try value iteration until fp-fixpoint
		default_cmd +=  " --p0 --p1 --epsilon 0 --absolute-epsilon"
		specific_cmd += " --p0 --p1 --epsilon 0 --absolute-epsilon"
	elif prop_type == "E":
		# expected reward: try value iteration until fp-fixpoint
		default_cmd +=  " --epsilon 0 --absolute-epsilon"
		specific_cmd += " --epsilon 0 --absolute-epsilon"
	elif prop_type == "Pb":
		# state elimination is fp-exact
		default_cmd +=  " --reward-bounded-alg StateElimination"
		if "-S Memory" in specific_cmd:
			specific_cmd += " --reward-bounded-alg StateElimination"
		else:
			specific_cmd += " --epsilon 0 --absolute-epsilon"
	if not skip:
		add_invocations(invocations, "floating-point-correct", default_cmd, tweak(benchmark, specific_cmd))

	#
	# Track "epsilon-correct"
	#
	skip = False
	precision = "1e-6"
	default_cmd  = default_base  + " --no-partial-results"
	specific_cmd = specific_base + " --no-partial-results"
	if prop_type == "S":
		# long-run average: default is the sound algorithm based on value iteration
		default_cmd +=  " --width $PRECISION --relative-width"
		specific_cmd += " --width $PRECISION --relative-width"
	elif (benchmark.is_ma() or benchmark.is_ctmc()) and benchmark.is_time_bounded_probabilistic_reachability():
		# time-bounded probability for CTMC and MA: default is sound Unif+
		default_cmd +=  " --width $PRECISION --relative-width"
		specific_cmd += " --width $PRECISION --relative-width"
	elif benchmark.is_pta() and prop_type == "Pb":
		# time-bounded reachability for PTA: state elimination recommended
		default_cmd +=  " --reward-bounded-alg StateElimination"
		if "-S Memory" in specific_cmd:
			specific_cmd += " --reward-bounded-alg StateElimination"
		else:
			specific_cmd += " --alg IntervalIteration --width $PRECISION --relative-width"
	elif prop_type == "Pb":
		# reward-bounded probability: default is unsound VI, so need to change to II (SVI and OVI not yet implemented for this case)
		default_cmd  += " --alg IntervalIteration --width $PRECISION --relative-width"
		specific_cmd += " --alg IntervalIteration --width $PRECISION --relative-width"
	else:
		# unbounded probability or expected reward: default is unsound VI, so need to change to OVI
		default_cmd  += " --alg OptimisticValueIteration --epsilon $PRECISION --width $PRECISION --relative-width"
		specific_cmd += " --alg OptimisticValueIteration --epsilon $PRECISION --width $PRECISION --relative-width"
		if prop_type == "P" and benchmark.is_dtmc() or benchmark.is_ctmc():
			# for unbounded probabilities on DTMC and CTMC: use 0/1 preprocessing
			default_cmd += " --p0 --p1"
			specific_cmd += " --p0 --p1"
	if not skip:
		add_invocations(invocations, "epsilon-correct", default_cmd.replace("$PRECISION", precision), tweak(benchmark, specific_cmd).replace("$PRECISION", precision))

	#
	# Track "probably-epsilon-correct"
	#
	skip = False
	precision = "5e-2"
	if not skip:
		add_invocations(invocations, "probably-epsilon-correct", default_cmd.replace("$PRECISION", precision), tweak(benchmark, specific_cmd).replace("$PRECISION", precision))

	#
	# Track "often-epsilon-correct"
	#
	skip = False
	precision = "1e-3"
	default_cmd  = default_base  + " --no-partial-results"
	specific_cmd = specific_base + " --no-partial-results"
	if prop_type == "S":
		# long-run average: default is the sound algorithm based on value iteration
		default_cmd +=  " --width $PRECISION --relative-width"
		specific_cmd += " --width $PRECISION --relative-width"
	elif (benchmark.is_ma() or benchmark.is_ctmc()) and benchmark.is_time_bounded_probabilistic_reachability():
		# time-bounded probability for CTMC and MA: default is sound Unif+
		default_cmd +=  " --width $PRECISION --relative-width"
		specific_cmd += " --width $PRECISION --relative-width"
	elif benchmark.is_pta() and prop_type == "Pb":
		# time-bounded reachability for PTA: state elimination recommended
		default_cmd +=  " --reward-bounded-alg StateElimination"
		if "-S Memory" in specific_cmd:
			specific_cmd += " --reward-bounded-alg StateElimination"
		else:
			specific_cmd += " --alg IntervalIteration --width $PRECISION --relative-width"
	elif prop_type == "Pb":
		# reward-bounded probability: default is unsound VI, which is okay here
		pass
	else:
		# unbounded probability or expected reward: default is unsound VI, which is okay here
		if prop_type == "P" and benchmark.is_dtmc() or benchmark.is_ctmc():
			# for unbounded probabilities on DTMC and CTMC: use 0/1 preprocessing
			default_cmd += " --p0 --p1"
			specific_cmd += " --p0 --p1"
	if not skip:
		add_invocations(invocations, "often-epsilon-correct", default_cmd.replace("$PRECISION", precision), tweak(benchmark, specific_cmd).replace("$PRECISION", precision))

	#
	# Track "often-epsilon-correct-10-min"
	#
	skip = False
	precision = "0" # so we just run for the full 10 minutes (or until we get an exact result)
	default_cmd  = default_base
	specific_cmd = specific_base
	if prop_type == "S":
		skip = True
	elif (benchmark.is_ma() or benchmark.is_ctmc()) and benchmark.is_time_bounded_probabilistic_reachability():
		default_cmd += " --width 0"
		specific_cmd += " --width 0"
	elif prop_type == "Pb":
		# reward-bounded reachability for DTMC, MDP, and PTA
		default_cmd +=  " --reward-bounded-alg StateElimination"
		if "-S Memory" in specific_cmd:
			specific_cmd += " --reward-bounded-alg StateElimination"
		else:
			specific_cmd += " --epsilon 0"
	else:
		default_cmd += " --epsilon 0"
		specific_cmd += " --epsilon 0"
	if prop_type == "P" and benchmark.is_dtmc() or benchmark.is_ctmc():
		# for unbounded probabilities on DTMC and CTMC: use 0/1 preprocessing
		default_cmd += " --p0 --p1"
		specific_cmd += " --p0 --p1"
	if not skip:
		add_invocations(invocations, "often-epsilon-correct-10-min", default_cmd, tweak(benchmark, specific_cmd))
	
	#
	# Done
	#
	return invocations