[gecode-users] assert in propagator cast
Christian Schulte
cschulte at kth.se
Tue Oct 25 17:47:46 CEST 2011
Hi David,
Let me do some guessing here:
1) You are using a propagator that uses advisors.
2) The dispose method of your advisors does not unsubscribe the advisor from
the view.
3) The propagator's dispose method disposes the advisors' council without
deleting the advisors subscriptions
Bang! Is that correct?
If yes, there are two ways to fix it:
a) The dispose method of the advisors also unsubscribes, or
b) In the propagator's dispose method you iterate over all advisors and
unsubscribe (The iterator is called Advisors<A> where A is the type of the
advisor). You might want to search for Advisors in gecode/int/bool/or.hpp
for an example.
I hope that helps!
Best
Christian
PS: Sorry for the delay, I was travelling.
--
Christian Schulte, KTH, web.it.kth.se/~cschulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of David Rijsman
Sent: Monday, October 24, 2011 3:34 PM
To: users at gecode.org
Subject: [gecode-users] assert in propagator cast
I need some help with an assert being thrown by Gecode, hopefully by an
error I made in a propagator I have created. Is there an obvious candidate
for an error I made in my propagator when this assert is thrown?
The assert is thrown in core.hpp
forceinline Propagator&
Advisor::propagator(void) const {
assert(!disposed());
return *Propagator::cast(ActorLink::prev());
}
as a result of an invocation of Advisor::cast(*a)->propagator().afc() in:
template<class VIC>
forceinline double
VarImp<VIC>::afc(void) const {
if (degree() == 0)
return 0.0;
double d = degree();
// Count the afc of each propagator
{
ActorLink** a = const_cast<VarImp<VIC>*>(this)->actor(0);
ActorLink** e =
const_cast<VarImp<VIC>*>(this)->actorNonZero(pc_max+1);
while (a < e) {
d += Propagator::cast(*a)->afc(); a++;
}
}
// Count the afc of each advisor's propagator
{
ActorLink** a =
const_cast<VarImp<VIC>*>(this)->actorNonZero(pc_max+1);
ActorLink** e = const_cast<VarImp<VIC>*>(this)->base+entries;
while (a < e) {
d += Advisor::cast(*a)->propagator().afc(); a++;
}
}
return d;
}
thanks,
David Rijsman
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the users
mailing list