コード例 #1
0
ファイル: ndfs.c プロジェクト: graydon/ltsmin
void
ndfs_blue_handle (void *arg, state_info_t *successor, transition_info_t *ti,
                  int seen)
{
    wctx_t             *ctx = (wctx_t *) arg;
    alg_local_t        *loc = ctx->local;
    nndfs_color_t color = nn_get_color (&loc->color_map, successor->ref);
    if (proviso == Proviso_Stack)
        ti->por_proviso = !nn_color_eq(color, NNCYAN);
    /**
     * The following lines bear little resemblance to the algorithms in the
     * respective papers (NNDFS / LNDFS), but we must store all non-red states
     * on the stack here, in order to calculate all-red correctly later.
     */
    if ( ecd && nn_color_eq(color, NNCYAN) &&
            (GBbuchiIsAccepting(ctx->model, state_info_state(ctx->state)) ||
             GBbuchiIsAccepting(ctx->model, state_info_state(successor))) ) {
        /* Found cycle in blue search */
        ndfs_report_cycle (ctx->run, ctx->model, loc->stack, successor);
    } else if ((loc->strat == Strat_LNDFS && !state_store_has_color(ctx->state->ref, GRED, loc->rec_bits)) ||
               (loc->strat != Strat_LNDFS && !nn_color_eq(color, NNPINK))) {
        raw_data_t stack_loc = dfs_stack_push (loc->stack, NULL);
        state_info_serialize (successor, stack_loc);
    }
    (void) ti; (void) seen;
}
コード例 #2
0
ファイル: cndfs.c プロジェクト: Meijuh/ltsmin
static void
endfs_handle_red (void *arg, state_info_t *successor, transition_info_t *ti, int seen)
{
    wctx_t             *ctx = (wctx_t *) arg;
    alg_local_t        *loc = ctx->local;
    cndfs_alg_local_t  *cloc = (cndfs_alg_local_t *) ctx->local;
    int                 onstack;

    /* Find cycle back to the seed */
    HREassert (cloc->accepting_depth > 0);
    size_t             *level;
    onstack = ctx->state->ref == loc->seed->ref;
    if (!onstack) {
        onstack = fset_find (cloc->pink, NULL, &successor->ref, (void**)&level, false);
        HREassert (onstack != FSET_FULL);
    }

    if ( onstack && *level < cloc->accepting_depth )
        ndfs_report_cycle (ctx, ctx->model, loc->stack, successor);
    /* Mark states dangerous if necessary */
    if ( Strat_ENDFS == loc->strat &&
         pins_state_is_accepting(ctx->model, state_info_state(successor)) &&
         state_store_get_colors (successor->ref) != CRED )
        state_store_try_color(successor->ref, GDANGEROUS, loc->rec_bits);

    if ( !onstack && state_store_get_colors (successor->ref) != CRED ) {
        raw_data_t stack_loc = dfs_stack_push (loc->stack, NULL);
        state_info_serialize (successor, stack_loc);
    }

    // check proviso
    if (PINS_POR && proviso == Proviso_CNDFS && cloc->successors == NONEC) {
        if (ti->por_proviso != 0) { // state already fully expanded
            cloc->successors = SRCINV;
        } else if (onstack) { // cycle check
            if (onstack) cloc->successors = CYCLE;
        }
        // avoid full exploration (proviso is enforced later in backtrack)
        ti->por_proviso = 1; // avoid full exploration
    }
    (void) seen;
}
コード例 #3
0
ファイル: ndfs.c プロジェクト: graydon/ltsmin
static void
ndfs_red_handle (void *arg, state_info_t *successor, transition_info_t *ti,
                  int seen)
{
    wctx_t             *ctx = (wctx_t *) arg;
    alg_local_t        *loc = ctx->local;
    nndfs_color_t color = nn_get_color(&loc->color_map, successor->ref);
    ti->por_proviso = 1; // only visit blue states to stay in reduced search space

    if (proviso != Proviso_None && !nn_color_eq(color, NNBLUE))
        return; // only revisit blue states to determinize POR
    if ( nn_color_eq(color, NNCYAN) ) {
        /* Found cycle back to the stack */
        ndfs_report_cycle (ctx->run, ctx->model, loc->stack, successor);
    } else if ( nn_color_eq(color, NNBLUE) && (loc->strat != Strat_LNDFS ||
            !state_store_has_color(ctx->state->ref, GRED, loc->rec_bits)) ) {
        raw_data_t stack_loc = dfs_stack_push (loc->stack, NULL);
        state_info_serialize (successor, stack_loc);
    }
    (void) ti; (void) seen;
}
コード例 #4
0
ファイル: cndfs.c プロジェクト: Meijuh/ltsmin
static void
endfs_handle_blue (void *arg, state_info_t *successor, transition_info_t *ti, int seen)
{
    wctx_t             *ctx = (wctx_t *) arg;
    alg_local_t        *loc = ctx->local;
    cndfs_alg_local_t  *cloc = (cndfs_alg_local_t *) ctx->local;

    size_t             *level;
    int onstack = fset_find (cloc->pink, NULL, &successor->ref, (void**)&level, false);
    HREassert (onstack != FSET_FULL);

    /**
     * The following lines bear little resemblance to the algorithms in the
     * respective papers (Evangelista et al./ Laarman et al.), but we must
     * store all non-red states on the stack in order to calculate
     * all-red correctly later. Red states are also stored as optimization.
     */
    if ( ecd && onstack && *level < cloc->accepting_depth) {
        /* Found cycle in blue search */
        ndfs_report_cycle (ctx, ctx->model, loc->stack, successor);
    } else if ( all_red || (!onstack &&
                         state_store_get_colors (successor->ref) != CBLUE) ) {
        raw_data_t stack_loc = dfs_stack_push (loc->stack, NULL);
        state_info_serialize (successor, stack_loc);
    }

    // check proviso
    if (PINS_POR && proviso == Proviso_CNDFS && cloc->successors == NONEC) {
        if (ti->por_proviso != 0) { // state already fully expanded
            cloc->successors = SRCINV;
        } else if (onstack) { // check cycle
            cloc->successors = CYCLE;
        }
        // avoid full exploration (proviso is enforced later in backtrack)
        ti->por_proviso = 1;
    }
    (void) seen;
}