[erlang-questions] Constraint satisfaction problems

Robert Virding rvirding@REDACTED
Sat Nov 1 03:02:50 CET 2008


2008/10/31 Imre Palik <imre@REDACTED>

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


I don't think is there is a deeper rationale behind the side effects in
digraph other than that they are a result of it using ets internally.

One solution would be to rewrite it, or at least a part of it, using dict or
gb_trees but that might be overkill for what you want to do. Depends, I
suppose, on how much functionality you need.

What type of constraints are they? If your backtracking search algorithm is
more suitable for prolog you could try erlog which is a prolog interpreter
written in erlang.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081101/b8bd6853/attachment.htm>


More information about the erlang-questions mailing list