Hi Kish, Please find attached a patch that makes afc_decay() and friends public (I also did in the trunk and the next release is not that far away).
The reason why the reference docs are so useful is that they always list all member functions including those which got inherited. So when I have to know I'll also look at the docs and not at the code... Yes, you have to call afc_decay only on the root space once. IntAFC is a fake ( ;-) =, afc works even without it. IntAFC is there such that it looks exactly like Activity. Cheers Christian -- Christian Schulte, Professor of Computer Science, KTH, www.ict.kth.se/~cschulte/ -----Original Message----- From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf Of Kish Shen Sent: Tuesday, July 09, 2013 7:09 PM To: users@gecode.org Subject: Re: [gecode-users] Using AFC in Gecode 4 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-membe > rs.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(); solver->afc_decay(1U); 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, Kish _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users
Index: gecode/kernel/core.hpp =================================================================== --- gecode/kernel/core.hpp (revision 13835) +++ gecode/kernel/core.hpp (working copy) @@ -1418,14 +1418,6 @@ GECODE_KERNEL_EXPORT void _commit(const Choice& c, unsigned int a); - /// Set AFC decay factor to \a d - GECODE_KERNEL_EXPORT - void afc_decay(double d); - /// Return AFC decay factor - double afc_decay(void) const; - /// Reset AFC to \a a - GECODE_KERNEL_EXPORT - void afc_set(double a); public: /** * \brief Default constructor @@ -2089,6 +2081,18 @@ /// Return propagator const Brancher& brancher(void) const; }; + + /// \name Low-level support for AFC + //@{ + /// Set AFC decay factor to \a d + GECODE_KERNEL_EXPORT + void afc_decay(double d); + /// Return AFC decay factor + double afc_decay(void) const; + /// Reset AFC to \a a + GECODE_KERNEL_EXPORT + void afc_set(double a); + //@} };
_______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users