Re: Is Prolog a good language for generating semi-random, constrained solutions?

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 03/25/2014 03:43 PM, Alan Baljeu wrote:
>
>  > P.s.    When I was in Vienna, Markus and I chatted briefly about the
>  >    idea to have a Prolog thread `fork', i.e., a call that creates
>  >    a new thread as a copy of the running one.  This would require
>  >    some restrictions, i.e., we cannot fork if Prolog is called
>  >    from C in an arbitrary way.  Is that worth investigating at
>  >    some point?
>
> Can you have it sync-up?  It shouldn't matter to C if Prolog forks off a
> thread and then closes it before returning to caller.
> Or, you could return to caller but only the first thread ; all others
> terminate.  I think this construct is useful:
>
> first_to_complete(List of Callables) is semidet.

There is already available as first_solution/3 [1].  It is indeed not
really clear how these two would relate.  first_solution/3 would of
course copy the goal to multiple new threads, which are otherwise
empty.  A fork would clone all thread-specific data.  It is more useful
to split a computation and follow two different strategies to complete
it.  Hmmm.  Bit unclear ...

	Cheers --- Jan

[1]
http://www.swi-prolog.org/pldoc/doc_for?object=thread:first_solution/3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.