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

Alan Baljeu <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
>We only have a brought id of your latest ninja code :-) I think that

>Prolog adds two things to tackle the case where naive generate-and-test
>proves to be too slow: constraints and easy integration of DSLs.
>Constraints provide a neat way to merge testing inside the generator,
>such that it is executed as early as possible. In a sense, I guess we
>can see that as a form of `aspect programming'. Instead of
>
>    generate, test
>
>you  get
>
>    set_constraints, generate, test
>
>where test can also become empty. In addition constraints allow to
>reason about the domains of variables and avoid brute force generate and
>test. DSLs allow you to express your problem natively and generate the
>dirty stuff in the generate routine automatically, or do simple things
>such as goal reordering to reduce backtracking.



I completely endorse this approach.

>  Cheers --- Jan

> 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.

Alan Baljeu
-------------- next part --------------
HTML attachment scrubbed and removed
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.