Parameter constraints

This commit is contained in:
Artur Meski
2017-12-31 21:33:15 +00:00
parent 98f6b805ab
commit dca5f84b63
8 changed files with 136 additions and 18 deletions

View File

@@ -25,14 +25,24 @@ def gene_expression(cmd_args):
Simple gene expression example
"""
r = ReactionSystemWithConcentrationsParam()
r.add_bg_set_entity(("x", 1))
r.add_bg_set_entity(("xp", 1))
r.add_bg_set_entity(("X", 1))
r.add_bg_set_entity(("y", 1))
r.add_bg_set_entity(("yp", 1))
r.add_bg_set_entity(("Y", 1))
r.add_bg_set_entity(("h", 1))
r.add_bg_set_entity(("Q", 1))
all_entities = set(r.background_set)
r.add_reaction([("x",1)],[("h",1)],[("x",1)])
r.add_reaction([("x",1)],[("h",1)],[("xp",1)])
r.add_reaction([("x",1),("xp",1)],[("h",1)],[("X",1)])
r.add_reaction([("X",1),("Y",1)],[("h",1)],[("Q",1)])
## y
# r.add_reaction([("y",1)],[("h",1)],[("y",1)])
# r.add_reaction([("y",1)],[("Q",1)],[("yp",1)])
@@ -50,10 +60,11 @@ def gene_expression(cmd_args):
c.add_state("1")
# the experiments starts with adding x and y:
c.add_transition("0", [("y", 1)], "1")
c.add_transition("0", [("y", 1),("x",1)], "1")
# for all the remaining steps we have empty context sequences
c.add_transition("1", [], "1")
c.add_transition("1", [("h", 1)], "1")
rc = ReactionSystemWithAutomaton(r, c)
rc.show()
@@ -65,32 +76,42 @@ def gene_expression(cmd_args):
# exact_state(["x", "xp"], all_entities),
# ltl_X(bag_Not("h"), exact_state("X", all_entities))))
reach_yp = ltl_F(True, "yp")
reach_Y = ltl_F(True, "Y")
reach_y = ltl_F(True, "y")
# reachability
reach_y = ltl_F(bag_entity("h") == 0, "y")
reach_yp = ltl_F(bag_entity("h") == 0, "yp")
reach_Y = ltl_F(bag_entity("h") == 0, "Y")
#
phi_r = ltl_And(reach_y, reach_yp, reach_Y)
f_y1 = ltl_G(bag_entity("h") == 0, ltl_Implies(
# rules
phi_c1 = ltl_G(bag_entity("h") == 0, ltl_Implies(
bag_entity("y") > 0,
ltl_X(True, bag_And(bag_entity("y") > 0, bag_entity("yp") > 0))))
f_y2 = ltl_G(bag_entity("h") == 0, ltl_Implies(
phi_c2 = ltl_G(bag_entity("h") == 0, ltl_Implies(
bag_And(bag_entity("y") > 0, bag_entity("yp") > 0),
ltl_F(True, bag_entity("Y") > 0)))
# delayed_Y = ltl_X(True, ltl_And(bag_entity("Y") == 0, ltl_X(True, bag_entity("Y") == 0)))
delayed_Y = ltl_X(True, bag_entity("Y") == 0)
obs_1 = ltl_And(f_y1, reach_y, delayed_Y)
obs_2 = ltl_And(f_y2, reach_y, reach_Y, delayed_Y)
# delayed_Y = ltl_X(True, ltl_And(bag_entity("Y") == 0, ltl_X(True, bag_entity("Y") == 0)))
# delayed_Y = ltl_X(True, bag_entity("Y") == 0)
delayed_Q = ltl_And(bag_entity("Q") == 0, ltl_X(True, ltl_And(bag_entity("Q") == 0, ltl_X(True, ltl_And(bag_entity("Q") == 0, ltl_F(True, bag_entity("Q") > 0))))))
obs_1 = ltl_And(phi_r, phi_c1, phi_c2, delayed_Q)
# obs_2 = ltl_And(f_y2, reach_y, reach_Y, delayed_Y, delayed_Q)
# f_x2 = ltl_G(True, ltl_Implies(
# exact_state(["x", "xp"], all_entities),
# ltl_X(bag_Not("h"), exact_state("X", all_entities))))
#
param_constr = param_And(param_entity(lda3, "Y") > 0, param_entity(lda2, "Q") == 0, param_entity(lda1, "yp") == 0, param_entity(lda1, "Y") == 0)
smt_rsc = SmtCheckerRSCParam(rc, optimise=cmd_args.optimise)
#
smt_rsc.check_rsltl(formulae_list=[obs_1, obs_2], max_level=4, cont_if_sat=True)
smt_rsc.check_rsltl(formulae_list=[obs_1], param_constr=param_constr) #, max_level=4, cont_if_sat=True)
# smt_rsc.check_rsltl(formula=f_x1, print_witness=True)