Generated on Mon Aug 25 11:35:33 2008 for Gecode by doxygen 1.5.6

branch.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2002
00008  *
00009  *  Last modified:
00010  *     $Date: 2008-07-11 10:10:11 +0200 (Fri, 11 Jul 2008) $ by $Author: tack $
00011  *     $Revision: 7310 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  *  Permission is hereby granted, free of charge, to any person obtaining
00018  *  a copy of this software and associated documentation files (the
00019  *  "Software"), to deal in the Software without restriction, including
00020  *  without limitation the rights to use, copy, modify, merge, publish,
00021  *  distribute, sublicense, and/or sell copies of the Software, and to
00022  *  permit persons to whom the Software is furnished to do so, subject to
00023  *  the following conditions:
00024  *
00025  *  The above copyright notice and this permission notice shall be
00026  *  included in all copies or substantial portions of the Software.
00027  *
00028  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  *
00036  */
00037 
00038 #ifndef __GECODE_INT_BRANCH_HH__
00039 #define __GECODE_INT_BRANCH_HH__
00040 
00041 #include "gecode/int.hh"
00042 
00048 namespace Gecode { namespace Int { namespace Branch {
00049 
00050   /*
00051    * Value selection classes
00052    *
00053    */
00054 
00062   template<class View>
00063   class ValMin {
00064   public:
00066     int val(const Space* home, View x) const;
00068     ModEvent tell(Space* home, unsigned int a, View x, int n);
00070     static Support::Symbol type(void);
00072     void branchingSpec(const Space* home,
00073                        Reflection::VarMap& m, Reflection::BranchingSpec& bs,
00074                        int alt, View x, int n) const;
00075   };
00076 
00084   template<class View>
00085   class ValMed {
00086   public:
00088     int val(const Space* home, View x) const;
00090     ModEvent tell(Space* home, unsigned int a, View x, int n);
00092     static Support::Symbol type(void);
00094     void branchingSpec(const Space* home,
00095                        Reflection::VarMap& m, Reflection::BranchingSpec& bs,
00096                        int alt, View x, int n) const;
00097   };
00098 
00106   template<class View>
00107   class ValMax {
00108   public:
00110     int val(const Space* home, View x) const;
00112     ModEvent tell(Space* home, unsigned int a, View x, int n);
00114     static Support::Symbol type(void);
00116     void branchingSpec(const Space* home,
00117                        Reflection::VarMap& m, Reflection::BranchingSpec& bs,
00118                        int alt, View x, int n) const;
00119   };
00120 
00128   template<class View>
00129   class ValSplitMin {
00130   public:
00132     int val(const Space* home, View x) const;
00134     ModEvent tell(Space* home, unsigned int a, View x, int n);
00136     static Support::Symbol type(void);
00138     void branchingSpec(const Space* home,
00139                        Reflection::VarMap& m, Reflection::BranchingSpec& bs,
00140                        int alt, View x, int n) const;
00141   };
00142 
00150   template<class View>
00151   class ValSplitMax {
00152   public:
00154     int val(const Space* home, View x) const;
00156     ModEvent tell(Space* home, unsigned int a, View x, int n);
00158     static Support::Symbol type(void);
00160     void branchingSpec(const Space* home,
00161                        Reflection::VarMap& m, Reflection::BranchingSpec& bs,
00162                        int alt, View x, int n) const;
00163   };
00164 
00166   template<class View, class SelView>
00167   static void
00168   create(Space* home, ViewArray<View>&, IntValBranch);
00169 
00171   class NoValue {
00172   public:
00174     static Support::Symbol type(void);
00175   };
00176 
00184   template<class View>
00185   class ValZeroOne {
00186   public:
00188     NoValue val(const Space* home, View x) const;
00190     ModEvent tell(Space* home, unsigned int a, View x, NoValue n);
00192     static Support::Symbol type(void);
00194     void branchingSpec(const Space* home,
00195                        Reflection::VarMap& m, Reflection::BranchingSpec& bs,
00196                        int alt, View x, NoValue n) const;
00197   };
00198 
00206   template<class View>
00207   class ValOneZero {
00208   public:
00210     NoValue val(const Space* home, View x) const;
00212     ModEvent tell(Space* home, unsigned int a, View x, NoValue n);
00214     static Support::Symbol type(void);
00216     void branchingSpec(const Space* home,
00217                        Reflection::VarMap& m, Reflection::BranchingSpec& bs,
00218                        int alt, View x, NoValue n) const;
00219   };
00220 
00221 
00222   /*
00223    * Variable selection classes
00224    *
00225    */
00226 
00233   template<class View>
00234   class ByNone {
00235   public:
00237     ViewSelStatus init(const Space* home, View x);
00239     ViewSelStatus select(const Space* home, View x);
00241     static Support::Symbol type(void);
00242   };
00243 
00250   template<class View>
00251   class ByMinMin {
00252   protected:
00254     int min;
00255   public:
00257     ViewSelStatus init(const Space* home, View x);
00259     ViewSelStatus select(const Space* home, View x);
00261     static Support::Symbol type(void);
00262   };
00263 
00270   template<class View>
00271   class ByMinMax {
00272   protected:
00274     int min;
00275   public:
00277     ViewSelStatus init(const Space* home, View x);
00279     ViewSelStatus select(const Space* home, View x);
00281     static Support::Symbol type(void);
00282   };
00283 
00290   template<class View>
00291   class ByMaxMin {
00292   protected:
00294     int max;
00295   public:
00297     ViewSelStatus init(const Space* home, View x);
00299     ViewSelStatus select(const Space* home, View x);
00301     static Support::Symbol type(void);
00302   };
00303 
00310   template<class View>
00311   class ByMaxMax {
00312   protected:
00314     int max;
00315   public:
00317     ViewSelStatus init(const Space* home, View x);
00319     ViewSelStatus select(const Space* home, View x);
00321     static Support::Symbol type(void);
00322   };
00323 
00330   template<class View>
00331   class BySizeMin {
00332   protected:
00334     unsigned int size;
00335   public:
00337     ViewSelStatus init(const Space* home, View x);
00339     ViewSelStatus select(const Space* home, View x);
00341     static Support::Symbol type(void);
00342   };
00343 
00350   template<class View>
00351   class BySizeMax {
00352   protected:
00354     unsigned int size;
00355   public:
00357     ViewSelStatus init(const Space* home, View x);
00359     ViewSelStatus select(const Space* home, View x);
00361     static Support::Symbol type(void);
00362   };
00363 
00370   template<class View>
00371   class ByDegreeMin {
00372   protected:
00374     unsigned int degree;
00376     unsigned int size;
00377   public:
00379     ViewSelStatus init(const Space* home, View x);
00381     ViewSelStatus select(const Space* home, View x);
00383     static Support::Symbol type(void);
00384   };
00385 
00392   template<class View>
00393   class ByDegreeMax {
00394   protected:
00396     unsigned int degree;
00398     unsigned int size;
00399   public:
00401     ViewSelStatus init(const Space* home, View x);
00403     ViewSelStatus select(const Space* home, View x);
00405     static Support::Symbol type(void);
00406   };
00407 
00414   template<class View>
00415   class ByDegreeMinNoTies {
00416   protected:
00418     unsigned int degree;
00419   public:
00421     ViewSelStatus init(const Space* home, View x);
00423     ViewSelStatus select(const Space* home, View x);
00425     static Support::Symbol type(void);
00426   };
00427 
00434   template<class View>
00435   class ByDegreeMaxNoTies {
00436   protected:
00438     unsigned int degree;
00439   public:
00441     ViewSelStatus init(const Space* home, View x);
00443     ViewSelStatus select(const Space* home, View x);
00445     static Support::Symbol type(void);
00446   };
00447 
00455   template<class View>
00456   class BySizeDegreeMin {
00457   protected:
00459     double sizedegree;
00460   public:
00462     ViewSelStatus init(const Space* home, View x);
00464     ViewSelStatus select(const Space* home, View x);
00466     static Support::Symbol type(void);
00467   };
00468 
00475   template<class View>
00476   class BySizeDegreeMax {
00477   protected:
00479     double sizedegree;
00480   public:
00482     ViewSelStatus init(const Space* home, View x);
00484     ViewSelStatus select(const Space* home, View x);
00486     static Support::Symbol type(void);
00487   };
00488 
00495   template<class View>
00496   class ByRegretMinMin {
00497   protected:
00499     unsigned int regret;
00500   public:
00502     ViewSelStatus init(const Space* home, View x);
00504     ViewSelStatus select(const Space* home, View x);
00506     static Support::Symbol type(void);
00507   };
00508 
00515   template<class View>
00516   class ByRegretMinMax {
00517   protected:
00519     unsigned int regret;
00520   public:
00522     ViewSelStatus init(const Space* home, View x);
00524     ViewSelStatus select(const Space* home, View x);
00526     static Support::Symbol type(void);
00527   };
00528 
00535   template<class View>
00536   class ByRegretMaxMin {
00537   protected:
00539     unsigned int regret;
00540   public:
00542     ViewSelStatus init(const Space* home, View x);
00544     ViewSelStatus select(const Space* home, View x);
00546     static Support::Symbol type(void);
00547   };
00548 
00555   template<class View>
00556   class ByRegretMaxMax {
00557   protected:
00559     unsigned int regret;
00560   public:
00562     ViewSelStatus init(const Space* home, View x);
00564     ViewSelStatus select(const Space* home, View x);
00566     static Support::Symbol type(void);
00567   };
00568 
00569   template <template <class,class,class,class> class B>
00570   void
00571   createBranch(Space* home, const IntVarArgs& x,
00572                IntVarBranch vars, IntValBranch vals);
00573 
00574   template <template <class,class,class,class> class B>
00575   void
00576   createBranch(Space* home, const BoolVarArgs& x, 
00577                IntVarBranch vars, IntValBranch vals);
00578 
00579 }}}
00580 
00581 #include "gecode/int/branch/select-val.icc"
00582 #include "gecode/int/branch/select-view.icc"
00583 #include "gecode/int/branch/create-branch.icc"
00584 
00585 #endif
00586 
00587 // STATISTICS: int-branch