Generated on Wed Nov 1 15:04:30 2006 for Gecode by doxygen 1.4.5

branch.hh

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2002
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-08-04 16:03:26 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $
00010  *     $Revision: 3512 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
00019  *
00020  */
00021 
00022 #ifndef __GECODE_INT_BRANCH_HH__
00023 #define __GECODE_INT_BRANCH_HH__
00024 
00025 #include "gecode/int.hh"
00026 
00032 namespace Gecode { namespace Int { namespace Branch {
00033 
00034   /*
00035    * Value selection classes
00036    *
00037    */
00038 
00046   class ValMin {
00047   public:
00049     int val(const Space* home, IntView x) const;
00051     ModEvent tell(Space* home, unsigned int a, IntView x, int n);
00052   };
00053 
00061   class ValMed {
00062   public:
00064     int val(const Space* home, IntView x) const;
00066     ModEvent tell(Space* home, unsigned int a, IntView x, int n);
00067   };
00068 
00076   class ValMax {
00077   public:
00079     int val(const Space* home, IntView x) const;
00081     ModEvent tell(Space* home, unsigned int a, IntView x, int n);
00082   };
00083 
00091   class ValSplitMin {
00092   public:
00094     int val(const Space* home, IntView x) const;
00096     ModEvent tell(Space* home, unsigned int a, IntView x, int n);
00097   };
00098 
00106   class ValSplitMax {
00107   public:
00109     int val(const Space* home, IntView x) const;
00111     ModEvent tell(Space* home, unsigned int a, IntView x, int n);
00112   };
00113 
00115   template <class SelView>
00116   static void
00117   create(Space* home, ViewArray<IntView>&, BvalSel);
00118 
00119 
00120   /*
00121    * Variable selection classes
00122    *
00123    */
00124 
00131   class ByNone {
00132   public:
00134     ViewSelStatus init(const Space* home, IntView x);
00136     ViewSelStatus select(const Space* home, IntView x);
00137   };
00138 
00145   class ByMinMin {
00146   protected:
00148     int min;
00149   public:
00151     ViewSelStatus init(const Space* home, IntView x);
00153     ViewSelStatus select(const Space* home, IntView x);
00154   };
00155 
00162   class ByMinMax {
00163   protected:
00165     int min;
00166   public:
00168     ViewSelStatus init(const Space* home, IntView x);
00170     ViewSelStatus select(const Space* home, IntView x);
00171   };
00172 
00179   class ByMaxMin {
00180   protected:
00182     int max;
00183   public:
00185     ViewSelStatus init(const Space* home, IntView x);
00187     ViewSelStatus select(const Space* home, IntView x);
00188   };
00189 
00196   class ByMaxMax {
00197   protected:
00199     int max;
00200   public:
00202     ViewSelStatus init(const Space* home, IntView x);
00204     ViewSelStatus select(const Space* home, IntView x);
00205   };
00206 
00213   class BySizeMin {
00214   protected:
00216     unsigned int size;
00217   public:
00219     ViewSelStatus init(const Space* home, IntView x);
00221     ViewSelStatus select(const Space* home, IntView x);
00222   };
00223 
00230   class BySizeMax {
00231   protected:
00233     unsigned int size;
00234   public:
00236     ViewSelStatus init(const Space* home, IntView x);
00238     ViewSelStatus select(const Space* home, IntView x);
00239   };
00240 
00247   class ByDegreeMin {
00248   protected:
00250     unsigned int degree;
00252     unsigned int size;
00253   public:
00255     ViewSelStatus init(const Space* home, IntView x);
00257     ViewSelStatus select(const Space* home, IntView x);
00258   };
00259 
00266   class ByDegreeMax {
00267   protected:
00269     unsigned int degree;
00271     unsigned int size;
00272   public:
00274     ViewSelStatus init(const Space* home, IntView x);
00276     ViewSelStatus select(const Space* home, IntView x);
00277   };
00278 
00285   class ByRegretMinMin {
00286   protected:
00288     unsigned int regret;
00289   public:
00291     ViewSelStatus init(const Space* home, IntView x);
00293     ViewSelStatus select(const Space* home, IntView x);
00294   };
00295 
00302   class ByRegretMinMax {
00303   protected:
00305     unsigned int regret;
00306   public:
00308     ViewSelStatus init(const Space* home, IntView x);
00310     ViewSelStatus select(const Space* home, IntView x);
00311   };
00312 
00319   class ByRegretMaxMin {
00320   protected:
00322     unsigned int regret;
00323   public:
00325     ViewSelStatus init(const Space* home, IntView x);
00327     ViewSelStatus select(const Space* home, IntView x);
00328   };
00329 
00336   class ByRegretMaxMax {
00337   protected:
00339     unsigned int regret;
00340   public:
00342     ViewSelStatus init(const Space* home, IntView x);
00344     ViewSelStatus select(const Space* home, IntView x);
00345   };
00346 
00347 
00352   class AssignDesc : public BranchingDesc {
00353   protected:
00354     const int _pos;
00355     const int _val;
00356   public:
00358     AssignDesc(const Branching* b, const int p, const int n);
00360     int pos(void) const;
00362     int val(void) const;
00364     virtual size_t size(void) const;
00365   };
00366 
00367   /*
00368    * Classes for assignment
00369    *
00370    */
00371 
00373   class Assign : public Branching {
00374   protected:
00376     ViewArray<IntView> x;
00378     mutable int pos;
00380     Assign(Space* home, bool share, Assign& b);
00381   public:
00383     Assign(Space* home, ViewArray<IntView>& x);
00385     virtual bool status(const Space* home) const;
00387     virtual ExecStatus commit(Space* home, const BranchingDesc* d,
00388                               unsigned int a);
00389   };
00390 
00391 
00393   class AssignMin : public Assign {
00394   protected:
00396     AssignMin(Space* home, bool share, AssignMin& b);
00397   public:
00399     AssignMin(Space* home, ViewArray<IntView>& x);
00401     virtual Actor* copy(Space* home, bool share);
00403     virtual const BranchingDesc* description(const Space* home) const;
00404   };
00405 
00407   class AssignMed : public Assign {
00408   protected:
00410     AssignMed(Space* home, bool share, AssignMed& b);
00411   public:
00413     AssignMed(Space* home, ViewArray<IntView>& x);
00415     virtual Actor* copy(Space* home, bool share);
00417     virtual const BranchingDesc* description(const Space* home) const;
00418   };
00419 
00421   class AssignMax : public Assign {
00422   protected:
00424     AssignMax(Space* home, bool share, AssignMax& b);
00425   public:
00427     AssignMax(Space* home, ViewArray<IntView>& x);
00429     virtual Actor* copy(Space* home, bool share);
00431     virtual const BranchingDesc* description(const Space* home) const;
00432   };
00433 
00434 }}}
00435 
00436 #include "gecode/int/branch/select-val.icc"
00437 #include "gecode/int/branch/select-view.icc"
00438 
00439 #include "gecode/int/branch/assign.icc"
00440 
00441 #endif
00442 
00443 // STATISTICS: int-branch
00444