[erlang-questions] Constraint satisfaction problems

Richard Carlsson richardc@REDACTED
Tue Nov 4 12:39:22 CET 2008


Jesper Eskilson wrote:
> On Fri, Oct 31, 2008 at 8:55 AM, Imre Palik <imre@REDACTED> wrote:
>> During playing with project Euler I solved a few constraint
>> satisfaction problems with erlang.  But whenever I code a solution,
>> I have a really awkward feeling, that it should be possible to do
>> better, but I don't know how.
>> 
>> I tend to code a backtracking search with constraint propagation
>> before every step.  I model the constraint graph with digraph, but
>> then the non-functional nature of the digraph package makes
>> backtracking really awkward.
>> 
>> Is there any better way to solve constraint satisfaction problems? 
>> What is the rationale behind those pesky side effects in digraph?
> 
> If you want to solve Project Euler problems using constraints, I'd 
> recommend using Prolog instead. GNU Prolog worked very nice for the 
> problems I tried.
> 
> Are there any good constraint libraries for Erlang?

Not that I know of, but there is a Masters' thesis from 1995 by Greger
Ottoson that might provide some inspiration for anyone wanting to write
such a library. (Greger added some destructive functions to the runtime
system, but it could probably be made sufficiently efficient using ets
tables or purely functional data structures instead.)

ftp://ftp.csd.uu.se/pub/papers/masters-theses/0085-ottosson.ps.gz

   /Richard



More information about the erlang-questions mailing list