Beispiel #1
0
void
ndfs_explore_state_blue (wctx_t *ctx)
{
    work_counter_t     *cnt = ctx->counters;
    dfs_stack_enter (ctx->local->stack);
    increase_level (cnt);
    cnt->trans += permute_trans (ctx->permute, ctx->state, ndfs_blue_handle, ctx);
    cnt->explored++;
    run_maybe_report (ctx->run, cnt, "[Blue] ");
}
Beispiel #2
0
void
ndfs_explore_state_red (wctx_t *ctx)
{
    alg_local_t        *loc = ctx->local;
    work_counter_t     *cnt = &loc->red_work;
    dfs_stack_enter (loc->stack);
    increase_level (cnt);
    cnt->trans += permute_trans (ctx->permute, ctx->state, ndfs_red_handle, ctx);
    run_maybe_report (ctx->run, cnt, "[Red ] ");
}
Beispiel #3
0
void
reach_explore_all (wctx_t *ctx, state_info_t *state)
{
    alg_local_t        *loc = ctx->local;
    
    permute_set_por (ctx->permute, 0);

    dfs_stack_enter (loc->stack);
    increase_level (ctx->counters);
    permute_trans (ctx->permute, state, endfs_handle_all, ctx);

    permute_set_por (ctx->permute, 1);
}
Beispiel #4
0
static inline void
endfs_explore_state_blue (wctx_t *ctx)
{
    alg_local_t        *loc = ctx->local;
    work_counter_t     *cnt = ctx->counters;
    cndfs_alg_local_t  *cloc = (cndfs_alg_local_t *) ctx->local;

    cloc->successors = NONEC;

    dfs_stack_enter (loc->stack);
    increase_level (ctx->counters);
    cnt->trans += permute_trans (ctx->permute, ctx->state, endfs_handle_blue, ctx);
    check_counter_example (ctx, loc->stack, true);
    cnt->explored++;
    run_maybe_report1 (ctx->run, cnt, "[Blue] ");

    set_proviso_stack (ctx, loc, cloc);
}
Beispiel #5
0
/**
 * make a stackframe on search_stack and handle the successors of ctx->state
 */
static inline void
explore_state (wctx_t *ctx)
{
    alg_local_t        *loc = ctx->local;

    dfs_stack_enter (loc->search_stack);
    increase_level (ctx->counters);

#ifdef SEARCH_COMPLETE_GRAPH
    // bypass the pins interface by directly handling the successors
    int                 ref_arr[2];
    ref_arr[0] = (int) ctx->state->ref;
    dlopen_next_state (NULL, 0, ref_arr, permute_complete, ctx);
#else
    permute_trans (ctx->permute, ctx->state, tarjan_handle, ctx);
#endif

    ctx->counters->explored++;
    run_maybe_report1 (ctx->run, (work_counter_t *) ctx->counters, "");
}
Beispiel #6
0
int main() {
	dfs_stack_t stack = dfs_stack_create (ARRAY_SIZE);
	size_t x;

	printf("Filling stack\n");
	for (x = 0; x<NUM; x++) {
		int ar[ARRAY_SIZE];
		ar[0] = x; ar[ARRAY_SIZE-1] = -x;
		dfs_stack_push(stack, ar);
		if (x%(NUM/FRAMES)==0) {
			printf("entered frame after: %zu - %zu\n", x, -x);
			dfs_stack_enter(stack);
		}
	}
        char tmp[256];
        ssize_t tmpsz = sizeof tmp;
        printf("%s\n", dfs_stack_to_string(stack, tmp, &tmpsz));


	for (x = 0; x<=FRAMES; x++) {
		int* ar =  dfs_stack_peek_top(stack, x);
		printf("peek_top(%zu): %d - %d\n", x, ar[0], ar[ARRAY_SIZE-1]);
	}


	printf("Emptying stack stack\n");
	for (x = 0; x<NUM; x++) {
		int* ar;
		if ((ar = dfs_stack_top(stack))==NULL) {
			dfs_stack_leave(stack);
			ar = dfs_stack_top(stack);
			printf("leave frame before: %d - %d\n", ar[0], ar[ARRAY_SIZE-1]);
		}
		ar = dfs_stack_pop(stack);
	}

	printf("DONE\n");
	//pop(stack);
	dfs_stack_destroy(stack);
	return 0;
}
Beispiel #7
0
void
ta_dfs (wctx_t *ctx)
{
    alg_shared_t       *shared = ctx->run->shared;
    alg_global_t       *sm = ctx->global;
    while (lb_balance(shared->lb, ctx->id, dfs_stack_size(sm->stack), split_dfs)) {
        raw_data_t          state_data = dfs_stack_top (sm->stack);
        if (NULL != state_data) {
            if (grab_waiting(ctx, state_data)) {
                dfs_stack_enter (sm->stack);
                increase_level (ctx->counters);
                ta_explore_state (ctx);
            } else {
                dfs_stack_pop (sm->stack);
            }
        } else {
            if (0 == dfs_stack_size (sm->stack))
                continue;
            dfs_stack_leave (sm->stack);
            ctx->counters->level_cur--;
            dfs_stack_pop (sm->stack);
        }
    }
}