Hi Christian,

the use case I am looking at is if at some point in the branching you decide to 
order two (temporal) variables you would want to find these two variables in 
your graph to add the edges. I do not think a node to view mapping will help 
with this.  

I think I know how to do this in my world as I have already a layer on top of 
the IntVar of Gecode. It would off course be nicer if my propagator does not 
have to know about my world. Like you suggest I was thinking of using the 
varimp addresses and indeed rehash etc. What we really need is some constant 
hash function on the varimp (an int or such) and can be used for this purpose. 
There must not be too many propagators that need this kind of information or 
aggregate multiple constraints in one datastructure. Let me think some more how 
it can be done...





David J. Rijsman
Algorithm Lead
Quintiq
 
T +31 (0)73 691 07 39
F +31 (0)73 691 07 54
M +31 (0)62 127 68 29
E [email protected]
I www.quintiq.com


>>> 
From:   "Christian Schulte" <[email protected]>
To:     "'David Rijsman'" <[email protected]>, <[email protected]>
Date:   13-2-2013 17:13
Subject:        RE: [gecode-users] Identifying a view

I think I would turn it upside down: I would use integers as nodes in the
graph and maintain a mapping of these integers to their corresponding views.
Is that possible?

Otherwise, things get hairy: you could hash on the variable implementation
address to which the view is pointing to (if x is a view, then x.varimp()
gives you that). But each time you clone, you would have to rehash as the
varimp() changes.

Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/ 



-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of David Rijsman
Sent: Wednesday, February 13, 2013 11:36 AM
To: [email protected] 
Subject: [gecode-users] Identifying a view

Another question on how we can do this best. Imagine I have a precedence
constraint:

void Gecode::precedence(Home home, IntVar x, IntVar y, int lb, int ub,
IntConLevel=ICL_DEF )

Post temporal propagator that maintains lb <= x - y <= ub 

This will invoke 

Precedence::post( Home home, View x, View y, int lb, int ub )

and this will update the shared handle to some shared distance graph. In the
distance graph we maintain a graph which has vertices for each view. 

What is the best way of mapping a view to a vertex in this graph, that is
how can identify a view to see if it already has been mapped into a vertex
in for example a graph? 

Posting a new precedence constraint has to extend the graph with vertices
for the views if they do not exist yet and add or update the edges between
these vertices. 

any ideas?



David J. Rijsman
Algorithm Lead
Quintiq
 
T +31 (0)73 691 07 39
F +31 (0)73 691 07 54
M +31 (0)62 127 68 29
E [email protected] 
I www.quintiq.com 



_______________________________________________
Gecode users mailing list
[email protected] 
https://www.gecode.org/mailman/listinfo/gecode-users 




_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to