Sha256: 9c94c8598dca742f8d683316b9ef30efe0bda0f22004ad721f40673d54b2aae0

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

/*
 *  Main authors:
 *     Guido Tack <tack@gecode.org>
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Contributing authors:
 *     Gabor Szokoli <szokoli@gecode.org>
 *
 *  Copyright:
 *     Guido Tack, 2004
 *     Christian Schulte, 2004
 *     Gabor Szokoli, 2004
 *
 *  Last modified:
 *     $Date: 2006-07-18 15:39:20 +0200 (Tue, 18 Jul 2006) $ by $Author: schulte $
 *     $Revision: 3390 $
 *
 *  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 Branch {

  forceinline int
  ValMin::val(const Space*, SetView x) const {
    UnknownRanges<SetView> unknown(x);
    return unknown.min();
  }
  forceinline ModEvent
  ValMin::tell(Space* home, unsigned int a, SetView x, int v) {
    return (a == 0) ? x.include(home,v) : x.exclude(home,v);
  }

  forceinline int
  ValMax::val(const Space*, SetView x) const {
    int maxElem = 0;
    UnknownRanges<SetView> unknown(x);
    while (unknown()) {
      maxElem = unknown.max();
      ++unknown;
    }
    return maxElem;
  }
  forceinline ModEvent
  ValMax::tell(Space* home, unsigned int a, SetView x, int v) {
    return (a == 0) ? x.include(home,v) : x.exclude(home,v);
  }

  template <class SelView>
  static void
  create(Space* home, ViewArray<SetView>& x, SetBvalSel vals) {
    switch (vals) {
    case SETBVAL_MIN:
      (void) new (home) ViewValBranching<SetView,int,SelView,ValMin>(home,x);
      break;
    case SETBVAL_MAX:
      (void) new (home) ViewValBranching<SetView,int,SelView,ValMax>(home,x);
      break;
    default:
      throw UnknownBranching("Set::branch");
    }
  }

}}}

// STATISTICS: set-branch

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/branch/select-val.icc