Re: [eclipse-clp-users] saving the resolution list of a call

From: Joachim Schimpf <joachim.schimpf_at_...44...>
Date: Mon, 17 May 2010 14:48:48 +1000
Christian Wirth wrote:
> At first, thanks to all your suggestions to this and the backtracking 
> question.
> I integrated all your ideas and it's already a lot faster ... but not 
> fast enough. It now takes a bit more then twice the time of a normal CALL.
> 
> Here is my current source code:
> 
> %requiered by problem
> expand(d_true(X,S),Y,Y) :- !,call(d_true(X,S)).
> expand(d_does(P,M,S),X,X) :- !,call(d_does(P,M,S)).
> expand((A\=B),X,X) :- !,call(A\=B).

remove all the call() wrappers, they are not needed.


> 
> expand((X1;Y1),ResListIn,ResListOut) :- 
> !,expand(X1,ResListIn,ResListOut);expand(Y1,ResListIn,ResListOut).    
> %OR clauses should not be added                          
> expand((X1,Y1),ResListIn,ResListOut) :- 
> !,expand(X1,ResListIn,ResListTmp),expand(Y1,ResListTmp,ResListOut).
> 
> expand(\+(X1),ResListIn,ResListOut) :- 
> !,not(expand(X1,ResListIn,ResListOut)). %negation should not be added

This won't work.  Any bindings from inside the not/1 are lost.


> 
> expand(X,ResListIn,[F/A|ResListOut]) :- 
> functor(X,F,A),clause(X,C),((C=true)->(ResListOut=ResListIn);(join_string([F,A,"rec"],"/",String1),(containsKey(String1)->(ResListOut=ResListIn,call(X));(expand(C,ResListIn,ResListOut))))).

If you present this in a readable form, I'll comment on it ;-)


> 
> containsKey(Key) :- clause(logicStorage(Key,_)).
> 
> logicStorage is a dynamic predicate and contains all recursive 
> predicates. The resolutionlist of those predicates should not be saved.
> And ideas how to increase the speed further ? If requiered, i would also 
> be willing to make changes to the eclipse source code to have this 
> resolution list available.
> 
> cheers Christian

-- Joachim
Received on Mon May 17 2010 - 04:47:02 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST