예제 #1
0
    ct.add(ctex)
    ct.save(f'counterexamples_{problem}_nomutation.p')


eqc.onCounterexample(onct)

# Set up the teacher, with the system under learning and the equivalence checker
teacher = Teacher(sul, eqc)

# Set up the learner who only talks to the teacher
learner = TTTMealyLearner(teacher)
# learner.enable_checkpoints('checkpoints3')
# learner.load_checkpoint('/home/tom/projects/lstar/experiments/counterexampletracker/checkpoints3/cZsmSu/2020-05-06_20:00:33:790987')
# Get the learners hypothesis
hyp = learner.run(
    show_intermediate=False,
    render_options={'ignore_self_edges': ['error', 'invalid']},
    on_hypothesis=lambda x: check_result(
        x,
        f'../../rers/TrainingSeqReachRers2019/{problem}/reachability-solution-{problem}.csv'
    ))

print(
    "SUCCES",
    check_result(
        hyp,
        f'../../rers/TrainingSeqReachRers2019/{problem}/reachability-solution-{problem}.csv'
    ))

hyp.render_graph(render_options={'ignore_self_edges': ['error', 'invalid']})
예제 #2
0
    eqc = StackedChecker(
        SmartWmethodEquivalenceCheckerV2(sul,
                                         horizon=horizon,
                                         stop_on={'invalid_input'},
                                         stop_on_startswith={'error'}),
        NuSMVEquivalenceChecker(sul, constrpath, mappingpath, n_unrolls=10),
        # SmartWmethodEquivalenceCheckerV2(sul,
        #                                  horizon=horizon,
        #                                  stop_on={'invalid_input'},
        #                                  stop_on_startswith={'error'})
    )

    # Set up the teacher, with the system under learning and the equivalence checker
    teacher = Teacher(sul, eqc)

    # Set up the learner who only talks to the teacher
    learner = TTTMealyLearner(teacher)

    # Get the learners hypothesis
    hyp = learner.run(show_intermediate=False, )

    #hyp.render_graph()

    nusmv = NuSMVUtils(constrpath, mappingpath)

    ltl_answers = nusmv.run_ltl_check(hyp)

    if 'Training' in problemset:
        check_result(ltl_answers, solutionspath)
예제 #3
0
# Set up the teacher, with the system under learning and the equivalence checker
teacher = Teacher(sul, eqc)

# Set up the learner who only talks to the teacher
learner = TTTMealyLearner(teacher)


def stack(*args):
    def chained(hypothesis):
        for function in args:
            function(hypothesis)

    return chained


# Get the learners hypothesis
hyp = learner.run(
    show_intermediate=False,
    render_options={'ignore_self_edges': ['error', 'invalid']},
    on_hypothesis=stack(
        savehypothesis(f'{prefix}/hypotheses/{problemset}/{problem}',
                       f'{problem}'),
        lambda h: check_result(
            h,
            f'../../rers/{problemset}/{problem}/constraints-solution-{problem}.txt'
        )))

statstracker.write_log()

hyp.render_graph(render_options={'ignore_self_edges': ['error', 'invalid']})
예제 #4
0
#                                   fuzzer_path=fuzzer_path,
#                                   eqchecktype=EQCheckType.BOTH,
#                                   enable_dtraces=False,
#                                   minimize=False)
# eqc = SmartWmethodEquivalenceCheckerV4(sul,
#                                        horizon=13,
#                                        stop_on={'invalid_input'},
#                                        stop_on_startswith={'error'},
#                                        order_type='shortest first')
eqc = SmartWmethodEquivalenceCheckerV2(sul,
                                       horizon=13,
                                       stop_on={'invalid_input'},
                                       stop_on_startswith={'error'})
#order_type='shortest first')

# Set up the teacher, with the system under learning and the equivalence checker
teacher = Teacher(sul, eqc)

# Set up the learner who only talks to the teacher
learner = TTTMealyLearner(teacher)

# Get the learners hypothesis
hyp = learner.run(show_intermediate=False,
                  render_options={'ignore_self_edges': ['error', 'invalid']},
                  on_hypothesis=savehypothesis(f'hypotheses/{problem}_wmethod',
                                               f'{problem}'))

hyp.render_graph(render_options={'ignore_self_edges': ['error', 'invalid']})
check_result(
    hyp,
    f'../../rers/{problemset}/{problem}/reachability-solution-{problem}.csv')
sul = RersTrieCache(RERSConnectorV4(f'{path}/{problem}_Reach'),
                    storagepath=cache)

# We use a specialized W-method equivalence checker which features
# early stopping on invalid inputs, which speeds things up a lot
# eqc = RersWmethodEquivalenceChecker(sul, False, m=5)
eqc = SmartWmethodEquivalenceChecker(sul,
                                     horizon=5,
                                     stop_on={'invalid_input'},
                                     stop_on_startswith={'error'})

# Set up the teacher, with the system under learning and the equivalence checker
teacher = Teacher(sul, eqc)

# Set up the learner who only talks to the teacher
# We let it save checkpoints of every intermediate hypothesis
learner = MealyLearner(teacher)\
    .enable_checkpoints("checkpoints", problem)\
    #.load_checkpoint('/home/tom/projects/lstar/examples/learn_rers/checkpoints/m34/2020-05-16_15:42:30:713416')

# Get the learners hypothesis
hyp = learner.run(show_intermediate=True,
                  render_options={'ignore_self_edges': ['error', 'invalid']},
                  on_hypothesis=lambda x: check_result(
                      x, f'{path}/solution_{problem}_reachability.csv'))

print("SUCCES", check_result(hyp,
                             f'{path}/solution_{problem}_reachability.csv'))

hyp.render_graph(tempfile.mktemp('.gv'))