[gecode-users] Unless propagator

Christian Schulte cschulte at kth.se
Mon Jun 9 13:14:09 CEST 2008


The code does not make sense:

 - one() returns true, iff the variable is assigned to 1

 - zero() returns true, iff the variables is assigned to 0

 - none() returns true, uiff the variable is not assigned.

 

Christian

 

--

Christian Schulte, www.ict.kth.se/~cschulte/

 

From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Mauricio Toro
Sent: Monday, June 09, 2008 12:27 PM
To: users at gecode.org
Subject: [gecode-users] Unless propagator

 

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/b1fc8115/attachment.htm>


More information about the gecode-users mailing list