[gecode-users] Passing user defined values to initialise IntActivity

Kish Shen kisshen at cisco.com
Tue Jul 8 20:39:34 CEST 2014


Hi,

I am trying to implement the initialisation of the starting values for 
the activity of the variables in a search. From reading the MPG, I am 
doing this when the IntActivity is declared:

IntActivity act(*solver, vars, decay, merit)

where merit is a IntBranchMerit function.

I have implemented setting the initial value for the activity of a 
variable to its degree. However, I also want to allow the user to 
specify the initial values for the variables, in cases where they may 
have some idea of which variables are "better", and I am not sure how 
this can be done, i.e. how I can pass user defined values to a 
IntBranchMerit function:

(..IntBranchMerit)(const Space &home, IntVar x, int i)

what I would like to pass to this function is an array that defines the 
initial values (array[i] would give the value intended for x (i.e. 
vars[i])).

A possible issue I had with declaring the IntBranchMerit function is 
that I had to use Space, rather than GecodeSpace, which is the class I 
defined:

class GecodeSpace : public Gecode::MinimizeSpace {....}

i.e., I had to declare merit as:

double merit(const Space& solver, IntVar x, int i)

This probably reflects my (lack of) C++ knowledge...

if I do have to use Space, then I cannot even pass a user specified 
field via GecodeSpace to merit function -- and I am not sure if this is 
the right thing to do anyway, as the data I want to pass is for a 
specific search, rather than something global to the space itself.


On a somewhat related note: it seems to make sense to me to allow the 
user to set the initial values for the AFC of each variable, because the 
degree may not always be the best initial value. Am I correct that this 
is difficult to do, as the AFC value for each variable is computed from 
summing the AFC values for the constraints involving that variable?

Thanks in advance for any information/help!

Kish



More information about the users mailing list