[gecode-users] Unless propagator

Mauricio Toro mauriciotorob at gmail.com
Mon Jun 9 12:27:28 CEST 2008


Hello all,
First, thanks for all the help given to me in the past.
The "ask" and the "parallel conditional" propagators
are working very well now.

I need some help with another propagator which
should behave like this:

Unless <Boolean_var> do <something>

The idea is to execute <something> when
the Boolean_var is either false o it is not assigned.

The problem I am having is that it is calling
<something> multiple times.

These are the post and the propagate methods:

  UnlessProp::UnlessProp
  (Space* home,BoolView x,  AskBody * askbody)
    : UnaryPropagator<BoolView,PC_GEN_ASSIGNED>(home,x) {this->askbody =
askbody;}

  ExecStatus
  UnlessProp::post(Space* home, BoolView x,  AskBody * askbody) {
    if (x.one())
      {std::cout << "one" << std::endl << std::endl;}
    else if (x.zero())
      {std::cout << "something"; std::cout << "zero" << std::endl <<
std::endl;}
    else if (x.assigned())
      assert(x.none());
    else  // not assigned, not zero and not one
      std::cout << "something";

    (void) new (home) UnlessProp(home,x,askbody);    // ?
    return ES_OK;
  }

  ExecStatus
  UnlessProp::propagate(Space* home, ModEventDelta med) {

    return ES_SUBSUMED(this,sizeof(*this));
  }

Thanks,

Mauricio

-- 
Mauricio Toro Bermudez
Estudiante de Ingeniería de Sistemas
Pontificia Universidad Javeriana, Colombia

Stagiare à l'Ircam
1, place Igor-Stravinsky 75004 Paris,
France de 2008 à 2009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080609/db7a4474/attachment.htm>


More information about the gecode-users mailing list