Example #1
0
def check4CE(pwa_model, error_paths, sys_name, model_type, AA, sp, bmc_engine='sal'):
    max_path_len = max([len(path) for path in error_paths])
    print('max_path_len:', max_path_len)
    # depth = max_path_len - 1, because path_len = num_states along
    # path. This is 1 less than SAL depth and simulation length
    depth = max(int(np.ceil(AA.T/AA.delta_t)), max_path_len - 1)
    print('depth :',  depth)

    safety_prop = sp.final_cons
    sal_bmc = bmc.factory(
            bmc_engine,
            AA.num_dims.x, pwa_model, sp.init_cons, safety_prop,
            '{}_{}'.format(sys_name, model_type),
            model_type)

    status = sal_bmc.check(depth)
    if status == InvarStatus.Safe:
        print('Safe')
    elif status == InvarStatus.Unsafe:
        print('Unsafe')
    elif status == InvarStatus.Unknown:
        print('Unknown')
    else:
        raise err.Fatal('Internal')

    print('exiting')
    print(sal_bmc.get_last_trace())
    #sal_bmc.get_last_trace().last_trace.print_to_stream(sys.stderr)
    exit()
Example #2
0
def refine_dmt_model_based(AA, error_paths, pi_seq_list, sp, sys_sim, bmc_engine):
    """refine using discrete time models

    Parameters
    ----------
    A :
    error_paths :
    pi_seq_list :
    sp :
    sys_sim :

    Returns
    -------

    Notes
    ------
    does not handle pi_seq_list yet
    """
    # Unmantained old code. Update before using
    raise NotImplementedError
    # traversed_abs_state_set
    tas = {state for path in error_paths for state in path}

    pwa_models = build_pwa_dt_model(AA, tas, sp, sys_sim)

    sal_bmc = bmc.factory(bmc_engine)
    prop = sp.final_cons

    sal_bmc.init(AA.num_dims.x, pwa_models, sp.init_cons, prop, 'vdp_dmt', 'dmt')
    sal_bmc.check()