[eclipse-clp-users] amount of shallow backtracking.

From: mauricio montecinos <mauricio.montecinos_at_gmail.com>
Date: Thu, 7 May 2009 16:30:49 -0400
Dears.



I would like to know if there is a predefined predicate that allow me get
the amount of shallow backtracking.



Shallow backtracking: An attempt to instantiate a variable causes immediate
failure due to constraint propagation.



I'm trying to count the shallow backtracking. The core of my program is
based on codes of the form:



( fromto(AllVars, Vars, Rest, [])

        do

        choose_var(Vars, Var, Rest),

        choose_val(Var,Val),

        Var = Val,

       ).



If choose_val is:

choose_val(Var,Val):-

     indomain(Var).



If I replace indomain(Var) for my_indomain:

my_indomain(Var,Val):-

    get_domain_as_list(Var,Domain),

    member(Val,Domain).



If I replace member(Val,Domain) for my_member :

my_member(X,[X|_]).

my_member(X,[_|Xs]):- my_member(X,Xs).



I think that by incorporating of the predicate count_shallowbt I get the
amount of Shallow backtracking.



my_member(X,[X|_]).

my_member(X,[_|Xs]):- count_shallowbt, my_member(X,Xs).



Where:

count_shallowbt:-

   incval(shallowbt).



Every time that a "deep batcktrack" happens, the count of "shallow
backtracking" increases by one, for that reason, then I must be subtract the
amount of "deep backtrack" to the amount of "shallow backtracking".



I would like to know if my reasoning is correct?.



Thank in advance.



Sincerely.

Mauricio Montecinos.
Received on Thu May 07 2009 - 20:30:57 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET