Well, I don't really understand your model.  What's an incrementation?

The only way I can imagine how you want your model to work is to just split the element constraint in two. I.e., have two arrays a0 and a1 of integers (or IntVars), such that <a0[i], a1[i]> is the edge i, and then use element(a0,b,d0); element(a1,b,d1) to constrain the two IntVars d0 and d1 to be equal to the edge.

Cheers,
        Guido

frank lemoine wrote:

hello christian and Guido,

thank's Guido for the approaches you give it to me, i see cp(map) it's very interesting but it's also very far from my level in gecode. the idea of using a boolean variable is very useful and i use it but i still have some troubling :

my constraint it's about checking for an edge represented by two variable if it's present in a set possible edge and it should work on the element constraint like this element (*this, a ,b ,c) so that:

a is the set of possible edge (set of edges each one is represented by two int variables)
b incrementation
d candidat edge (represented by two int varaibless)

but in c From what I know we can just put one single variable so i can't describe an edge

i hope  this expression will be more explicit.

Hamza
From: t...@ps.uni-sb.de
Date: Thu, 5 Nov 2009 11:52:22 +0100
CC: us...@gecode.org
To: benoun...@live.fr
Subject: Re: [gecode-users] element constraint

Hi,

frank lemoine wrote:
thank you christian for tips about the element constraint i run it, it's a very usefull but still i had some difficulties i don't know if gecode provide a solution for representing two intvar by a single intvar.

let this constaint element (home, a,b,c)

i have two integer variables represented by Intvar, i want to use a variable Intvar in c that can represent the link between this two varaibles (an edge for example)
the goal is to check if this pair is in a the set of all pairs in a

I'm not sure you can use IntVars the way you describe the problem. Do you want to have one variable for each node that describes the set of edges incident to the node? Then you'll have to use set variables instead of integer variables. Of course, if every node has exactly one incident edge, IntVars are fine. A different approach is to use n*n Boolean variables if you have n nodes, one for each edge, representing that the graph contains the edge or not. It really depends on what other constraints you want to put on the graph. Maybe the literature on graph variables (simply google for CP Graph) or tree constraints will help you get an idea.

Cheers,
Guido


Nouveau Windows 7 : Trouvez le PC qui vous convient. En savoir plus. _______________________________________________
Gecode users mailing list
us...@gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users

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

Reply via email to