Sha256: b429490df8a059dcdb76f63eada8317552843845184a2c0e9c9366e915781e2f

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

/*
 *  Main authors:
 *     Guido Tack <tack@gecode.org>
 *
 *  Copyright:
 *     Guido Tack, 2004
 *
 *  Last modified:
 *     $Date: 2006-06-19 11:03:38 +0200 (Mon, 19 Jun 2006) $ by $Author: tack $
 *     $Revision: 3304 $
 *
 *  This file is part of Gecode, the generic constraint
 *  development environment:
 *     http://www.gecode.org
 *
 *  See the file "LICENSE" for information on usage and
 *  redistribution of this file, and for a
 *     DISCLAIMER OF ALL WARRANTIES.
 *
 */

namespace Gecode { namespace Set { namespace Distinct {

  /*
   * n-ary distinct with fixed cardinalities propagator
   *
   */

  forceinline
  Distinct::Distinct(Space* home, ViewArray<SetView>& x, unsigned int _c)
    : NaryPropagator<SetView, PC_SET_ANY>(home,x,true), bin(10), c(_c) {}

  forceinline
  Distinct::Distinct(Space* home, bool share, Distinct& p)
    : NaryPropagator<SetView, PC_SET_ANY>(home,share,p), bin(0), c(p.c) {
    bin.update(share, p.bin);
  }

  forceinline ExecStatus
  Distinct::post(Space* home, ViewArray<SetView> x, unsigned int c) {
    for (int i=x.size(); i--;) {
      GECODE_ES_CHECK(x[i].cardMin(home, c));
      GECODE_ES_CHECK(x[i].cardMax(home, c));
    }

    (void) new (home) Distinct(home,x,c);
    return ES_OK;
  }

  forceinline size_t
  Distinct::dispose(Space* home) {
    bin.~Binomial();
    return sizeof(*this);
  }

}}}

// STATISTICS: set-prop

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gecoder-with-gecode-0.7.1 ext/gecode-1.3.1/gecode/set/distinct/distinct.icc