示例#1
0
文件: cndfs.c 项目: Meijuh/ltsmin
void
cndfs_local_setup   (run_t *run, wctx_t *ctx)
{
    cndfs_alg_local_t  *cloc = (cndfs_alg_local_t *) ctx->local;
    cloc->timer = RTcreateTimer ();
    ndfs_local_setup (run, ctx);
    size_t len = state_info_serialize_int_size (ctx->state);
    cloc->in_stack = dfs_stack_create (len);
    cloc->out_stack = dfs_stack_create (len);

    if ((get_strategy(run->alg) & Strat_TA) == 0) {
        cloc->pink = fset_create (sizeof(ref_t), sizeof(size_t), FSET_MIN_SIZE, 24);
    }

    if (get_strategy(run->alg) & Strat_CNDFS) return;

    if (run->shared->rec == NULL) {
        Abort ("Missing recursive strategy for %s!",
               key_search(strategies, get_strategy(run->alg)));
        return;
    }

    HREassert (ctx->global != NULL, "Run global before local init");

    // We also need to finalize the worker initialization:
    ctx->global->rec = run_init (run->shared->rec, ctx->model);

    // Recursive strategy maybe unaware of its caller, so here we update its
    // recursive bits (top-level strategy always has rec_bits == 0, which
    // is ensured by ndfs_local_setup):
    ctx->global->rec->local->rec_bits = run->shared->color_bit_shift;
    cloc->rec = ctx->global->rec->local;
}
示例#2
0
void
tarjan_local_init (run_t *run, wctx_t *ctx)
{
    ctx->local         = RTmallocZero (sizeof (alg_local_t));
    ctx->local->target = state_info_create ();

    // extend state_info with tarjan_state information
    state_info_add_simple (ctx->local->target, sizeof (uint32_t),
                          &ctx->local->target_tarjan.index);
    state_info_add_simple (ctx->local->target, sizeof (uint32_t),
                          &ctx->local->target_tarjan.lowlink);

    state_info_add_simple (ctx->state, sizeof (uint32_t),
                          &ctx->local->state_tarjan.index);
    state_info_add_simple (ctx->state, sizeof (uint32_t),
                          &ctx->local->state_tarjan.lowlink);

    size_t len = state_info_serialize_int_size (ctx->state);
    ctx->local->search_stack = dfs_stack_create (len);
    ctx->local->tarjan_stack = dfs_stack_create (len);

    ctx->local->cnt.scc_count       = 0;
    ctx->local->cnt.tarjan_counter  = 0;

    ctx->local->visited_states =
            fset_create (sizeof (ref_t), sizeof (raw_data_t), 10, dbs_size);

#ifdef SEARCH_COMPLETE_GRAPH
    // provide the input file name to dlopen_setup
    dlopen_setup (files[0]);
#endif

    (void) run; 
}
示例#3
0
文件: ndfs.c 项目: graydon/ltsmin
void
ndfs_local_setup   (run_t *run, wctx_t *ctx)
{
    alg_local_t        *loc = ctx->local;
    size_t              local_bits = 2;
    int res = bitvector_create (&loc->color_map, local_bits<<dbs_size);
    HREassert (res != -1, "Failure to allocate a color_map bitvector.");
    if (all_red)
        res = bitvector_create (&loc->stackbits, MAX_STACK);
    HREassert (res != -1, "Failure to allocate a all_red bitvector.");
    loc->rec_bits = 0;
    loc->strat = get_strategy (run->alg);
    loc->seed = state_info_create ();
    size_t              len = state_info_serialize_int_size (ctx->state);

    //state_info_add_simple (ctx->state, sizeof(int), &loc->bits);
    //state_info_add_simple (ctx->local->seed, sizeof(int), &loc->seed_bits);

    loc->stack = dfs_stack_create (len);
}