[gecode-users] Using AFC in Gecode 4

Christian Schulte cschulte at kth.se
Wed Jul 10 10:43:47 CEST 2013


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-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Kish Shen
Sent: Tuesday, July 09, 2013 7:09 PM
To: users at 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 at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://www.gecode.org/pipermail/users/attachments/20130710/0e533173/attachment.txt>


More information about the users mailing list