[gecode-users] Graph adjacency constraint

Christian Schulte cschulte at kth.se
Fri Nov 9 14:37:23 CET 2007


Hi,

To use element you can map the X and Y coordinate into a single variable
(use multiplication and addition) and then use element on that variable:
basically flatten the matrix into an array.

As it comes to adjacency: have for each node i in the graph an array x of
0/1 variables, where x[j] tells you whether i is connected to j.

If you are looking for a single path in the graph (so every node has a
single node it is connected to), you can use a single variable for the node.

Christian 

--
Christian Schulte, http://www.imit.kth.se/~schulte/ 

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Malcolm Ryan
Sent: Thursday, November 08, 2007 11:15 PM
To: gecode list
Subject: Re: [gecode-users] Graph adjacency constraint


On 09/11/2007, at 8:36 AM, Christian Schulte wrote:

> Please consider the element constraint.

I don't see how the element constraint is applicable in this case.

> Unless you want to transform your graph representation to an  
> adjacency rep
> which is obviously more suited to constraint programming.

I'm not sure I understand what you mean. What kind of representation  
are you thinking of?

> Other options are extensional table
> constraints, which will be available in Gecode 2.0.0.
>
> BTW, Gecode 2.0.0 will be released next Monday. Gecode/J 2.0.0 will  
> follow
> suit a little later.

Excellent. Well I guess I can wait.

Malcolm

--
            "Cleanliness is not next to godliness nowadays,
                 for cleanliness is made an essential
               and godliness is regarded as an offence.
                                     - G.K.Chesterton, On Lying in Bed




_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users





More information about the gecode-users mailing list