RE: Counting backtracks

From: Karen Petrie <scomkep_at_zeus.hud.ac.uk>
Date: Fri 02 May 2003 03:49:57 PM GMT
Message-Id: <200305021549.h42FnvF05125@dvorak.hud.ac.uk>
Forouk,

Where are you actually calling init_backtracks, it should be the line 
before search. Your control code fragment should look something like:

init_backtracks,
minimize((
	    mylabeling(SearchVars),
            get_backtracks(B),
            printf("Backtracks to this point = %d \n \n", [B])
	), OptimalNumber).
	
Karen	

>X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0
>content-class: urn:content-classes:message
>MIME-Version: 1.0
>Subject: RE: [eclipse-users] Counting backtracks
>Date: Fri, 2 May 2003 16:18:30 +0100
>Thread-Topic: [eclipse-users] Counting backtracks
>Thread-Index: AcMQurxhDZaA0NI8RsedgLBzgdS9XQAA0/Hw
>From: "Aminu, Farouk" <f.aminu@lancaster.ac.uk>
>To: Karen Petrie <scomkep@zeus.hud.ac.uk>
>Cc: eclipse-users <eclipse-users@icparc.ic.ac.uk>
>X-OriginalArrivalTime: 02 May 2003 15:18:30.0936 (UTC) 
FILETIME=[16D47980:01C310BE]
>Content-Transfer-Encoding: 8bit
>X-MIME-Autoconverted: from quoted-printable to 8bit by zeus.hud.ac.uk id 
QAA05333
>
>Dear Karen,
>
>I have also tried all the initialisations before calling minimize/2 this 
way:
>
>init_backtracks :-
>        setval(backtracks,0).
>
>	get_backtracks(B) :-
>        	getval(backtracks,B).
>        
>	count_backtracks :-
>        	setval(deep_fail,false).
>
>	count_backtracks :-
>        	getval(deep_fail,false),        % may fail
>        	setval(deep_fail,true),
>        	incval(backtracks),
>        	fail.
>minimize((
>	    mylabeling(SearchVars),
>            get_backtracks(B),
>            printf("Backtracks to this point = %d \n \n", [B])
>	), OptimalNumber).
>
>Yet I received the same message.
>
>Regards,
>
>Farouk
>
>
>-----Original Message-----
>From: Karen Petrie [mailto:scomkep@zeus.hud.ac.uk]
>Sent: 02 May 2003 15:46
>To: eclipse-users@icparc.ic.ac.uk; f.aminu@lancaster.ac.uk
>Subject: RE: [eclipse-users] Counting backtracks
>
>
>Farouk,
>
>Are you remembering to count the backtracks in your labelling code? As it 
>looks as if the B is uninstantiated. If so, can you send me a bigger 
>fragment of code to study.
>
>Karen
>
>>X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0
>>content-class: urn:content-classes:message
>>MIME-Version: 1.0
>>Subject: RE: [eclipse-users] Counting backtracks
>>Date: Fri, 2 May 2003 15:32:31 +0100
>>Thread-Topic: [eclipse-users] Counting backtracks
>>Thread-Index: AcMQof3V3KhXX1AUS/GvTHGCiL33JQAFbMiA
>>From: "Aminu, Farouk" <f.aminu@lancaster.ac.uk>
>>To: Joachim Schimpf <j.schimpf@icparc.ic.ac.uk>, eclipse-users 
><eclipse-users@icparc.ic.ac.uk>
>>X-OriginalArrivalTime: 02 May 2003 14:32:31.0921 (UTC) 
>FILETIME=[AA543210:01C310B7]
>>Content-Transfer-Encoding: 8bit
>>X-MIME-Autoconverted: from quoted-printable to 8bit by zeus.hud.ac.uk id 
>PAA05198
>>
>>Hello,
>>
>>I used: 
>>
>> minimize((
>>	    mylabeling(SearchVars),
>>            get_backtracks(B),
>>            printf("Backtracks to this point = %d \n \n", [B])
>>	), OptimalNumber)
>>
>>but I am getting the following message:
>>
>>'type error in printf("%d \n \n", [B])'
>>
>>am I doing something wrong?
>>
>>Farouk
>>
>>Umaru Farouk Aminu
>>Department of Management Science,
>>Lancaster University,
>>Lancaster,
>>LA1 4YX,
>>UK.
>>Tel: +44 1524 383619 (Home)
>>      +44 1524 593865 (School)
>>      +44 1524 844885 (Fax)
>>
>>
>>
>>
>>-----Original Message-----
>>From: Joachim Schimpf [mailto:j.schimpf@icparc.ic.ac.uk]
>>Sent: 02 May 2003 12:40
>>To: eclipse-users@icparc.ic.ac.uk
>>Subject: Re: [eclipse-users] Counting backtracks
>>
>>
>>Karen Petrie (scomkep@zeus.hud.ac.uk) wrote
>>>...
>>> Then you need to redefine the event handler:
>>> 
>>> write_info(_Error, Predicate):-
>>>         arg(1, Predicate, Minimum),
>>>         printf("Found a solution with cost %d \n", [Minimum]),
>>>         get_backtracks(B),
>>>         printf("Backtracks to this point = %d \n \n", [B]).
>>> 
>>> %set event handler
>>> :- set_event_handler(280, write_info/2).
>>> 
>>> Then all you do is call minimize on your labelling:
>>> 
>>> minimize(mylabeling(SearchVars), OptimalNumber)
>>
>>
>>There is actually no need to use this obscure event handler.
>>You can simply write:
>>
>>    minimize((
>>	    mylabeling(SearchVars),
>>            get_backtracks(B),
>>            printf("Backtracks to this point = %d \n \n", [B])
>>	), OptimalNumber)
>>
>>Whenever mylabeling/1 succeeds, you have a better solution.
>>
>>
>>-- 
>> Joachim Schimpf              /             phone: +44 20 7594 8187
>> IC-Parc                     /      mailto:J.Schimpf@imperial.ac.uk
>> Imperial College London    /    http://www.icparc.ic.ac.uk/eclipse
>>
>>
>
>
Received on Fri May 02 17:00:47 2003

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:24 PM GMT GMT