'test_query': 0,
        'state_count': 0,
        'error_count': 0,
        'errors': set()
    },
    log_path=logdir.joinpath(f'{problem}_{now}_afl_wtraces.log'),
    write_on_change={'state_count', 'error_count'})

sul = RERSSOConnector(path)
afl_dir = f'/home/tom/projects/lstar/experiments/learningfuzzing/{problemset}/{problem}'
bin_path = f'/home/tom/projects/lstar/experiments/learningfuzzing/{problemset}/{problem}/{problem}'

eqc = StackedChecker(
    AFLEquivalenceCheckerV2(sul, afl_dir, bin_path, feedback='w_traces'),
    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,
                  render_options={'ignore_self_edges': ['error', 'invalid']},
                  on_hypothesis=savehypothesis(
                      f'hypotheses/afl_plain/{problem}', f'{problem}'))
Beispiel #2
0
        # 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,
        on_hypothesis=savehypothesis(f'hypotheses/{problemset}/{problem}', f'{problem}')
    )

    end_learning = datetime.now()

    # hyp.render_graph()

    nusmv = NuSMVUtils(constrpath, mappingpath)

    ltl_answers = nusmv.run_ltl_check(hyp)

    if 'Training' in problemset or problemset == 'SeqLtlRers2019':
        scores.append(check_result(ltl_answers, solutionspath))

    Path(f'results/{problemset}').mkdir(exist_ok=True, parents=True)
Beispiel #3
0
    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,
                  render_options={'ignore_self_edges': ['error', 'invalid']},
                  on_hypothesis=savehypothesis(f'hypotheses/ltl/{problem}',
                                               f'{problem}'))

nusmv = NuSMVUtils(constrpath, mappingpath)

result = nusmv.run_ltl_check(hyp)

print(result)

#
# mealy_lines = mealy2nusmv_withintermediate(hyp)
# ltl_lines = rersltl2smv_withintermediate(constrpath, mappingpath)
#
# smvdir = Path(f'./smv/{problemset}')
# smvdir.mkdir(parents=True, exist_ok=True)
#
# with open(smvdir.joinpath(f'{problem}.smv'), 'w') as file:
Beispiel #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')
Beispiel #5
0

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 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']})
        'errors': set()
    },
    log_path=logdir.joinpath(f'{problem}_{now}_reach.log'),
    write_on_change={'state_count', 'error_count'})

sul = RERSSOConnector(path)
afl_dir = f'{args.afl_dir}/{problemset}/{problem}'
bin_path = f'{args.afl_dir}/{problemset}/{problem}/{problem}'

eqc = StackedChecker(
    AFLEquivalenceCheckerV2(sul,
                            afl_dir,
                            bin_path,
                            eqchecktype=EQCheckType.BOTH),
    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,
                  render_options={'ignore_self_edges': ['error', 'invalid']},
                  on_hypothesis=savehypothesis(f'hypotheses/reach/{problem}',
                                               f'{problem}'))