Re: [eclipse-clp-users] Java-eclipse question

From: Joachim Schimpf <joachim.schimpf_at_infotech.monash.edu.au>
Date: Mon, 26 Apr 2010 21:41:41 +1000
Caroline Nabil wrote:
> Ok,thanks a lot for your help .I tried it with member predicate example 
> and it is working but i have another problem with  that i have a lot of 
> solutions and the program takes a lot of time running so i want to know 
> if there is a way to stop it after a few seconds or a few set of 
> solutions..and i tried timeout/3 but the problem with it ,it doesnt give 
> me the output in the list as it should be, to explain more what i mean 
> here is my predicate :
> 
> %Objects is a list of structs which i send to solve  and i am expecting 
> to get the result in List
> 
> solveAll(Objects,List):-
> 	timeout(findall(Objects,solve(Objects),List),5,writeln(done)).

Here is a working example:

:- lib(timeout).

p(L) :- findall(X, timeout(between(1,1000000000,1,X), 1, fail), L).


-- Joachim
Received on Mon Apr 26 2010 - 11:41:51 CEST

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