Why not first solve the problem assuming that the you
have pairs {(p_1 c_1) (p_2 c_2) (p_3 c_3) (p_4 c_4) ...}
where p_i is the parent of c_i and {o_1 o_2 ...} is a set of
others. people you are required to seat.  Then, dropping
in these others should be trivial.  See if that helps?

... Dan


On Sat, May 31, 2014 at 7:48 PM, Jack Moffitt <[email protected]> wrote:

> I'm working on some code that does seating arrangements subject to
> various contraints in core.logic. Unfortunately, no matter how I seem
> to express the problem, it takes quite a long time and results in a
> stack overflow error.
>
> There are 5 tables, with 5 seats per table and a list of 25 guests.
> There are facts for the ages of the guests and their family
> relationships. I started an unconstrained (random) arrangement, and
> that worked fine. Now I've added the constraint that children <= 13
> years old must be seated with at least one parent. Seating any number
> of tables < 5 works quickly, but trying to seat all 5 tables never
> works in either version of the code.
>
> The code is here: https://gist.github.com/metajack/16546860f9ecd22de343
>
> The first version (seatmap2.clj) tries to seat a table at at time and
> takes the leftover guests to the next tables.
>
> The second version (seatmap2b) tries to seat a guest at a time,
> perhaps also seating a parent if the guest is <= 13 years old.
>
> Can anyone offer me any guidance on why the full arrangement can't be
> completed or suggestions on how to refactor the problem so that it
> won't have this issue?
>
> Thanks,
> jack.
>
> --
> You received this message because you are subscribed to the Google Groups
> "minikanren" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/minikanren.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"minikanren" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/minikanren.
For more options, visit https://groups.google.com/d/optout.

Reply via email to