Re: counting the number of backtracs
From: Bart Demoen (bmd_at_cs.kuleuven.ac.be)
Date: 03/29/04
- Previous message: Bart Demoen: "Re: Sublists question"
- In reply to: zeus: "Re: counting the number of backtracs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Mar 2004 08:44:50 +0200
zeus wrote:
> bart demoen <bmd@cs.kuleuven.ac.be> wrote in message news:<1080422530.509215@seven.kulnet.kuleuven.ac.be>...
>
>>zeus wrote:
>>
>>>How can I use assert/retract to count the number of backtracks made in
>>>execution of a predicate?
>>>
>>>Thanks,
>>>Zeus
>>
>>Your question is very difficult to answer - it resembles the question:
>>"how can I use a hammer to put a nail in a piece of wood".
>>The question suggests that you are so close to actually doing it, that
>>you need no more help.
>>Unless you don't know what "the number of backtracks" means - and then
>>your question should have been different ...
>>
>>???
>>
>>Cheers
>>
>>Bart Demoen
>
>
>
> Actually to be precise, what I wanna count is the number of
> constraints checked by a predicate.
Maybe you should decide first what you want to make with the aid of
you hammer - a chair or a table ?
BTW, which constraint solver were you referring to in "number of constraints" ?
What is your definition of a "constraint checked by a predicate" ?
Since you asked specifically where the assert and retract go, here is
where:
init_counter :-
retract(counter(_)),
fail.
init_counter :-
assert(counter(0)).
increase_counter_by_one :-
retract(counter(C)),
NewC is C + 1,
assert(counter(NewC)).
Oh, and in case you don't know: reading the manual helps.
Cheers
Bart Demoen
- Previous message: Bart Demoen: "Re: Sublists question"
- In reply to: zeus: "Re: counting the number of backtracs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|