[gecode-users] Using AFC in Gecode 4

Kish Shen kisshen at cisco.com
Tue Jul 9 19:08:57 CEST 2013

Hi Christian,

Thanks for your help!

On 09/07/2013 14:59, Christian Schulte wrote:

> The afc() member function now requires a space argument, see:
> http://www.gecode.org/doc-latest/reference/classGecode_1_1IntVar-members.htm
> l

Thanks. I have added this, and it now compiles.

This probably reflects my unfamiliarity with C++, but I did look at the 
reference documentation for IntVar, and found that afc() was not there, 
as it is in VarImpVar<int:IntVarImp>, and I didn't know I should look 
somewhere other than the IntVar section.

> Before using afc, you have to call
> 	space.afc_decay(d)
> for some decay value to enable support for afc (if not doing that, things
> will go kaboom). This method also changes the afc-decay for all variables.

I assume this only has to be done with the first space I create, and not 
any subsequent clones of the space?

I tried adding the afc_decay(1U) call just after the first time a space 
is created. The space I use is of class GecodeSpace, and I get an error

void Gecode::Space::afc_decay(double) is private within this context

the code I have is essentially:

GecodeSpace* solver;
solver = new GecodeSpace();

Do I need to do something in the definition of GecodeSpace to make 
afc_decay() public? (I guess this is again my unfamiliarity with C++)

Finally, as I mentioned in my previous message, I got the impression 
from reading the MPG (section 8.5.2, Selection using accumulated failure 
count), that you need to create a IntAFC object on an integer variable 
array in order to use AFC. Did I miss something in this section, or 
should the above usage of AFC be mentioned in the section?

Thanks and cheers,


More information about the users mailing list