Hi everybody,
Thanks for the explanation. I need just a half reification of the
extensional constraint. For that, i implement a class named "reg"
allowing to specify a control variable "b" as follow:
template <class View>
class reg : public Propagator{
protected:
ViewArray<View> x;
DFA dfa;
Int::BoolView b;
/// Constructor for posting
reg(Space& home, ViewArray<View>& x0, Int::BoolView b0);
/// Constructor for cloning \a p
reg(Space& home, bool share, reg& p);
public:
/// Copy propagator during cloning
virtual Actor* copy(Space& home, bool share);
/// Perform propagation
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
virtual size_t dispose(Space& home);
/// Post propagator for view array \a x
static ExecStatus post(Space& home, const IntVarArgs& x0, const
DFA& dfa, Int::BoolView b0);
};
the constructor:
template <class View>
forceinline
reg<View>::reg(Space& home, ViewArray<View>& x0, Int::BoolView b0)
: Propagator(home), x(x0), b(b0) {
x.subscribe(home,*this,PC_INT_VAL);
b.subscribe(home,*this,PC_BOOL_VAL);
}
The post function:
template <class View>
ExecStatus
reg<View>::post_amina(Space& home, const IntVarArgs& x0, const DFA&
dfa, Int::BoolView b){
ViewArray<IntView> xv(home,x0);
*(void) new (home) reg<View>(home,xv,b);*
return ES_OK;
}
After compilation, I obtained the following error:
regular.hpp:115:5: error: cannot allocate an object of abstract type
'myprop::reg<Gecode::Int::IntView>'
regular.hpp:41:9: note: because the following virtual functions are
pure within 'myprop::reg<Gecode::Int::IntView>':
/usr/local/include/gecode/kernel/core.hpp:811:22: note: virtual
Gecode::PropCost Gecode::Propagator::cost(const Gecode::Space&, const
ModEventDelta&) const
1. This error is due to the line : *(void) new (home)
reg<View>(home,xv,b); *if anyone have any idea about this, it will
be very helpful for me.
2. In the propagate function I call
Gecode::Int::Extensional::post_lgp(home,x,dfa); x is of type
IntVarArgs and not ViewArray, I want to know if it is the right way
to to this?
Thanks.
---
Amina
On 06/15/2014 04:05 AM, Guido Tack wrote:
Hi,
you're right that you'd have to implement your own propagator for
that. Before you do that you should check if you actually need full
reification (i.e. b <-> c) or if an implication would be enough (b ->
c). In the latter case, you don't need to implement the negation of c
(where c is your extensional constraint).
If you implement the full version, negating a DFA is (in principle)
easy, just make all accepting states rejecting and all rejecting
states accepting. In the Gecode representation the rejecting states
aren't represented directly so you'll have to work around that a bit.
Cheers,
Guido
--
Guido Tack
http://www.csse.monash.edu/~guidot/
<http://www.csse.monash.edu/%7Eguidot/>
On 14 Jun 2014, at 8:35 pm, Amina Kemmar <kemmar.am...@gmail.com
<mailto:kemmar.am...@gmail.com>> wrote:
Hi all,
I want to use a reification version of the extensional constraint,
but I think that it is not implemented in Gecode.
The chapter 24 explains how to implement a reification version of a
constraint, I understand that we need the negation of the automata
DFA. So, I want to know if there is an easy way to do this with
extensional constraint? If you have any details about this, it will
be very helpful for me.
Thanks.
Best regards,
---
Amina
_______________________________________________
Gecode users mailing list
users@gecode.org <mailto:users@gecode.org>
https://www.gecode.org/mailman/listinfo/gecode-users
_______________________________________________
Gecode users mailing list
users@gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users