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

Christian Schulte cschulte at kth.se
Wed Jul 9 15:37:37 CEST 2014


Hi Kish,

The activity thing is easy enough, just cast Space to whatever you want. See
Section 8.7 in MPG how to do it!

Yes, AFC cannot be initialized for the very reason you mention!

Cheers
Christian

--
Christian Schulte, Professor of Computer Science, KTH,
www.gecode.org/~schulte/


-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Kish Shen
Sent: Tuesday, July 08, 2014 8:40 PM
To: users at gecode.org
Subject: [gecode-users] Passing user defined values to initialise
IntActivity

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

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




More information about the users mailing list