def test_special_term_construction(): from tarski.syntax.arithmetic.special import max lang = fstrips.language(theories=[Theory.ARITHMETIC, Theory.SPECIAL]) ints = lang.Integer two, three = lang.constant(2, ints), lang.constant(3, ints) max_ = max(two, three) assert isinstance(max_, Term), "max_ should be the term max(Const(2), Const(3)), not the integer value 3"
def test_special_function_max(): from tarski.syntax.arithmetic.special import max lang = tarski.fstrips.language( theories=[Theory.ARITHMETIC, Theory.SPECIAL]) model = Model(lang) model.evaluator = evaluate reals = lang.Real a, b = lang.constant(3.14, reals), lang.constant(1.24, reals) assert model[max(a, b)].symbol == 3.14
def test_language_init_reservoir(): import tarski.syntax.arithmetic.special as tms res_reader = rddl.Reader('tests/data/rddl/Reservoir.rddl') assert res_reader.rddl_model is not None assert res_reader.rddl_model.domain.name == 'reservoir' # create sorts and initialize constants _ = res_reader.rddl_model.domain _ = res_reader.rddl_model.non_fluents res_reader.translate_rddl_model() assert res_reader.language is not None # try to construct expression without triggering any exceptions t1 = res_reader.language.get('t1') overflow = res_reader.language.get('overflow') rlevel = res_reader.language.get('rlevel') outflow = res_reader.language.get('outflow') max_reservoir_capacity = res_reader.language.get('MAX_RES_CAP') _ = overflow(t1) == tms.max(0.0, rlevel(t1) - outflow(t1) - max_reservoir_capacity(t1))