[gecode-users] branching...

Kilian Sprotte ml13 at onlinehome.de
Thu Dec 21 13:42:32 CET 2006


Hi,

thinking about how to make gecol at least a little more flexible,
I have some general little questions. :)

As gecol does not allow for subclassing Space
(the SWIG CFFI wrapper creation is not really ready
yet for c++), I am using the following hard-wired problem
space:

class GecolSpace : public Space {
protected:
   IntVarArray  ints;
   BoolVarArray bools;
   SetVarArray  sets;
public:
[...]

I have seen that it is possible to call branch twice -
for example for the ints and then for the bools, in order
to have both of them distributed.

My first question:
If I wanted to consider ints and bools together for branching,
for example giving them a naive predefined, but not regular
ordering like:

i1 i2 b1 i3 i4 i5 i6 b2 b3 i7 b4 b5 b6

Can I put them into an IntVarArgs array and treat them together?

My second question:
If I wanted to add my own ViewSel class....

Do I actually need to change branch in branch.cc
http://www.gecode.org/gecode-doc-latest/int_2branch_8cc- 
source.html#l00029 ?

and add my own 'case'....

Probably I can just instantiate the ViewValBranching directly?

Sorry for asking this c++ questions, I would be very grateful about a  
few
words, what the necessary steps are....

Maybe it is more interesting for you what kind of custom
distribution strategy I have in mind.

Lets say my problem has only int vars. I would like to decide the order
of distribution according to the value (if it is already assigned) of  
another
var that each var points to.
In other words, I conceptually sort my vars according to a key and
then pick the first. There is a (fixed) mapping of each var to another
one that serves for the key. If it is not yet assigned, we could say the
key value was +inf.

This is actually very musically, as e.g. vars representing pitches  
can be chosen according to their time in the score, which is  
represented by the start time var of the chord they belong to. :)

I am keeping some good memories of the flexibility of {FD.distribute  
+Dist +Xv} in Oz....
For experimenting, I am hoping to provide at some point something  
similar in Lisp,
by using callbacks....

All of this is not so easy for a musician,
but I need to do it :-P

Merry Xmas,

   Kilian







More information about the gecode-users mailing list