Sha256: 67485c8e005f846267619cfb3379e70dfd0ac5a416e2ade50211d0e368a830d5

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

/*
 *  Main authors:
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Copyright:
 *     Christian Schulte, 2004
 *
 *  Last modified:
 *     $Date: 2006-04-11 15:58:37 +0200 (Tue, 11 Apr 2006) $ by $Author: tack $
 *     $Revision: 3188 $
 *
 *  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.
 *
 */


#include "gecode/int/dom.hh"

namespace Gecode {

  using namespace Int;

  void
  dom(Space* home, IntVar x, int min, int max, IntConLevel) {
    if (home->failed()) return;
    IntView xv(x);
    GECODE_ME_FAIL(home,xv.gq(home,min));
    GECODE_ME_FAIL(home,xv.lq(home,max));
  }

  void
  dom(Space* home, IntVarArgs& x, int min, int max, IntConLevel) {
    if (home->failed()) return;
    for (int i=x.size(); i--; ) {
      IntView xv(x[i]);
      GECODE_ME_FAIL(home,xv.gq(home,min));
      GECODE_ME_FAIL(home,xv.lq(home,max));
    }
  }

  void
  dom(Space* home, IntVar x, const IntSet& is, IntConLevel) {
    if (home->failed()) return;
    IntView xv(x);
    IntSetRanges ris(is);
    GECODE_ME_FAIL(home,xv.inter(home,ris));
  }

  void
  dom(Space* home, IntVarArgs& x, const IntSet& is, IntConLevel) {
    if (home->failed()) return;
    for (int i = x.size(); i--; ) {
      IntSetRanges ris(is);
      IntView xv(x[i]);
      GECODE_ME_FAIL(home,xv.inter(home,ris));
    }
  }

  void
  dom(Space* home, IntVar x, int min, int max, BoolVar b, IntConLevel) {
    if (home->failed()) return;
    GECODE_ES_FAIL(home,Dom::ReRange<IntView>::post(home,x,min,max,b));
  }


  void
  dom(Space* home, IntVar x, const IntSet& is, BoolVar b, IntConLevel) {
    if (home->failed()) return;
    GECODE_ES_FAIL(home,Dom::ReIntSet<IntView>::post(home,x,is,b));
  }

}

// STATISTICS: int-post

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gecoder-with-gecode-0.7.1 ext/gecode-1.3.1/gecode/int/dom.cc