Generated on Sun Feb 17 15:24:07 2019 for Gecode by doxygen 1.6.3

var.hpp

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, 2012
00008  *
00009  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  *  Permission is hereby granted, free of charge, to any person obtaining
00014  *  a copy of this software and associated documentation files (the
00015  *  "Software"), to deal in the Software without restriction, including
00016  *  without limitation the rights to use, copy, modify, merge, publish,
00017  *  distribute, sublicense, and/or sell copies of the Software, and to
00018  *  permit persons to whom the Software is furnished to do so, subject to
00019  *  the following conditions:
00020  *
00021  *  The above copyright notice and this permission notice shall be
00022  *  included in all copies or substantial portions of the Software.
00023  *
00024  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00031  *
00032  */
00033 
00034 namespace Gecode {
00035 
00036   forceinline
00037   SetVarBranch::SetVarBranch(void)
00038     : s(SEL_NONE) {}
00039 
00040   forceinline
00041   SetVarBranch::SetVarBranch(Select s0, BranchTbl t)
00042     : VarBranch<SetVar>(t), s(s0) {}
00043 
00044   forceinline
00045   SetVarBranch::SetVarBranch(Rnd r)
00046     : VarBranch<SetVar>(r), s(SEL_RND) {}
00047 
00048   forceinline
00049   SetVarBranch::SetVarBranch(Select s0, double d, BranchTbl t)
00050     : VarBranch<SetVar>(d,t), s(s0) {}
00051 
00052   forceinline
00053   SetVarBranch::SetVarBranch(Select s0, SetAFC a, BranchTbl t)
00054     : VarBranch<SetVar>(a,t), s(s0) {}
00055 
00056   forceinline
00057   SetVarBranch::SetVarBranch(Select s0, SetAction a, BranchTbl t)
00058     : VarBranch<SetVar>(a,t), s(s0) {}
00059 
00060   forceinline
00061   SetVarBranch::SetVarBranch(Select s0, SetCHB c, BranchTbl t)
00062     : VarBranch<SetVar>(c,t), s(s0) {}
00063 
00064   forceinline
00065   SetVarBranch::SetVarBranch(Select s0, SetBranchMerit mf, BranchTbl t)
00066     : VarBranch<SetVar>(mf,t), s(s0) {}
00067 
00068   forceinline SetVarBranch::Select
00069   SetVarBranch::select(void) const {
00070     return s;
00071   }
00072 
00073   forceinline void
00074   SetVarBranch::expand(Home home, const SetVarArgs& x) {
00075     switch (select()) {
00076     case SEL_AFC_MIN: case SEL_AFC_MAX:
00077     case SEL_AFC_SIZE_MIN: case SEL_AFC_SIZE_MAX:
00078       if (!_afc)
00079         _afc = SetAFC(home,x,decay());
00080       break;
00081     case SEL_ACTION_MIN: case SEL_ACTION_MAX:
00082     case SEL_ACTION_SIZE_MIN: case SEL_ACTION_SIZE_MAX:
00083       if (!_act)
00084         _act = SetAction(home,x,decay());
00085       break;
00086     case SEL_CHB_MIN: case SEL_CHB_MAX:
00087     case SEL_CHB_SIZE_MIN: case SEL_CHB_SIZE_MAX:
00088       if (!_chb)
00089         _chb = SetCHB(home,x);
00090       break;
00091     default: ;
00092     }
00093   }
00094 
00095   inline SetVarBranch
00096   SET_VAR_NONE(void) {
00097     return SetVarBranch(SetVarBranch::SEL_NONE,nullptr);
00098   }
00099 
00100   inline SetVarBranch
00101   SET_VAR_RND(Rnd r) {
00102     return SetVarBranch(r);
00103   }
00104 
00105   inline SetVarBranch
00106   SET_VAR_MERIT_MIN(SetBranchMerit bm, BranchTbl tbl) {
00107     return SetVarBranch(SetVarBranch::SEL_MERIT_MIN,bm,tbl);
00108   }
00109 
00110   inline SetVarBranch
00111   SET_VAR_MERIT_MAX(SetBranchMerit bm, BranchTbl tbl) {
00112     return SetVarBranch(SetVarBranch::SEL_MERIT_MAX,bm,tbl);
00113   }
00114 
00115   inline SetVarBranch
00116   SET_VAR_DEGREE_MIN(BranchTbl tbl) {
00117     return SetVarBranch(SetVarBranch::SEL_DEGREE_MIN,tbl);
00118   }
00119 
00120   inline SetVarBranch
00121   SET_VAR_DEGREE_MAX(BranchTbl tbl) {
00122     return SetVarBranch(SetVarBranch::SEL_DEGREE_MAX,tbl);
00123   }
00124 
00125   inline SetVarBranch
00126   SET_VAR_AFC_MIN(double d, BranchTbl tbl) {
00127     return SetVarBranch(SetVarBranch::SEL_AFC_MIN,d,tbl);
00128   }
00129 
00130   inline SetVarBranch
00131   SET_VAR_AFC_MIN(SetAFC a, BranchTbl tbl) {
00132     return SetVarBranch(SetVarBranch::SEL_AFC_MIN,a,tbl);
00133   }
00134 
00135   inline SetVarBranch
00136   SET_VAR_AFC_MAX(double d, BranchTbl tbl) {
00137     return SetVarBranch(SetVarBranch::SEL_AFC_MAX,d,tbl);
00138   }
00139 
00140   inline SetVarBranch
00141   SET_VAR_AFC_MAX(SetAFC a, BranchTbl tbl) {
00142     return SetVarBranch(SetVarBranch::SEL_AFC_MAX,a,tbl);
00143   }
00144 
00145   inline SetVarBranch
00146   SET_VAR_ACTION_MIN(double d, BranchTbl tbl) {
00147     return SetVarBranch(SetVarBranch::SEL_ACTION_MIN,d,tbl);
00148   }
00149 
00150   inline SetVarBranch
00151   SET_VAR_ACTION_MIN(SetAction a, BranchTbl tbl) {
00152     return SetVarBranch(SetVarBranch::SEL_ACTION_MIN,a,tbl);
00153   }
00154 
00155   inline SetVarBranch
00156   SET_VAR_ACTION_MAX(double d, BranchTbl tbl) {
00157     return SetVarBranch(SetVarBranch::SEL_ACTION_MAX,d,tbl);
00158   }
00159 
00160   inline SetVarBranch
00161   SET_VAR_ACTION_MAX(SetAction a, BranchTbl tbl) {
00162     return SetVarBranch(SetVarBranch::SEL_ACTION_MAX,a,tbl);
00163   }
00164 
00165   inline SetVarBranch
00166   SET_VAR_CHB_MIN(BranchTbl tbl) {
00167     return SetVarBranch(SetVarBranch::SEL_CHB_MIN,tbl);
00168   }
00169 
00170   inline SetVarBranch
00171   SET_VAR_CHB_MIN(SetCHB c, BranchTbl tbl) {
00172     return SetVarBranch(SetVarBranch::SEL_CHB_MIN,c,tbl);
00173   }
00174 
00175   inline SetVarBranch
00176   SET_VAR_CHB_MAX(BranchTbl tbl) {
00177     return SetVarBranch(SetVarBranch::SEL_CHB_MAX,tbl);
00178   }
00179 
00180   inline SetVarBranch
00181   SET_VAR_CHB_MAX(SetCHB c, BranchTbl tbl) {
00182     return SetVarBranch(SetVarBranch::SEL_CHB_MAX,c,tbl);
00183   }
00184 
00185   inline SetVarBranch
00186   SET_VAR_MIN_MIN(BranchTbl tbl) {
00187     return SetVarBranch(SetVarBranch::SEL_MIN_MIN,tbl);
00188   }
00189 
00190   inline SetVarBranch
00191   SET_VAR_MIN_MAX(BranchTbl tbl) {
00192     return SetVarBranch(SetVarBranch::SEL_MIN_MAX,tbl);
00193   }
00194 
00195   inline SetVarBranch
00196   SET_VAR_MAX_MIN(BranchTbl tbl) {
00197     return SetVarBranch(SetVarBranch::SEL_MAX_MIN,tbl);
00198   }
00199 
00200   inline SetVarBranch
00201   SET_VAR_MAX_MAX(BranchTbl tbl) {
00202     return SetVarBranch(SetVarBranch::SEL_MAX_MAX,tbl);
00203   }
00204 
00205   inline SetVarBranch
00206   SET_VAR_SIZE_MIN(BranchTbl tbl) {
00207     return SetVarBranch(SetVarBranch::SEL_SIZE_MIN,tbl);
00208   }
00209 
00210   inline SetVarBranch
00211   SET_VAR_SIZE_MAX(BranchTbl tbl) {
00212     return SetVarBranch(SetVarBranch::SEL_SIZE_MAX,tbl);
00213   }
00214 
00215   inline SetVarBranch
00216   SET_VAR_DEGREE_SIZE_MIN(BranchTbl tbl) {
00217     return SetVarBranch(SetVarBranch::SEL_DEGREE_SIZE_MIN,tbl);
00218   }
00219 
00220   inline SetVarBranch
00221   SET_VAR_DEGREE_SIZE_MAX(BranchTbl tbl) {
00222     return SetVarBranch(SetVarBranch::SEL_DEGREE_SIZE_MAX,tbl);
00223   }
00224 
00225   inline SetVarBranch
00226   SET_VAR_AFC_SIZE_MIN(double d, BranchTbl tbl) {
00227     return SetVarBranch(SetVarBranch::SEL_AFC_SIZE_MIN,d,tbl);
00228   }
00229 
00230   inline SetVarBranch
00231   SET_VAR_AFC_SIZE_MIN(SetAFC a, BranchTbl tbl) {
00232     return SetVarBranch(SetVarBranch::SEL_AFC_SIZE_MIN,a,tbl);
00233   }
00234 
00235   inline SetVarBranch
00236   SET_VAR_AFC_SIZE_MAX(double d, BranchTbl tbl) {
00237     return SetVarBranch(SetVarBranch::SEL_AFC_SIZE_MAX,d,tbl);
00238   }
00239 
00240   inline SetVarBranch
00241   SET_VAR_AFC_SIZE_MAX(SetAFC a, BranchTbl tbl) {
00242     return SetVarBranch(SetVarBranch::SEL_AFC_SIZE_MAX,a,tbl);
00243   }
00244 
00245   inline SetVarBranch
00246   SET_VAR_ACTION_SIZE_MIN(double d, BranchTbl tbl) {
00247     return SetVarBranch(SetVarBranch::SEL_ACTION_SIZE_MIN,d,tbl);
00248   }
00249 
00250   inline SetVarBranch
00251   SET_VAR_ACTION_SIZE_MIN(SetAction a, BranchTbl tbl) {
00252     return SetVarBranch(SetVarBranch::SEL_ACTION_SIZE_MIN,a,tbl);
00253   }
00254 
00255   inline SetVarBranch
00256   SET_VAR_ACTION_SIZE_MAX(double d, BranchTbl tbl) {
00257     return SetVarBranch(SetVarBranch::SEL_ACTION_SIZE_MAX,d,tbl);
00258   }
00259 
00260   inline SetVarBranch
00261   SET_VAR_ACTION_SIZE_MAX(SetAction a, BranchTbl tbl) {
00262     return SetVarBranch(SetVarBranch::SEL_ACTION_SIZE_MAX,a,tbl);
00263   }
00264 
00265   inline SetVarBranch
00266   SET_VAR_CHB_SIZE_MIN(BranchTbl tbl) {
00267     return SetVarBranch(SetVarBranch::SEL_CHB_SIZE_MIN,tbl);
00268   }
00269 
00270   inline SetVarBranch
00271   SET_VAR_CHB_SIZE_MIN(SetCHB c, BranchTbl tbl) {
00272     return SetVarBranch(SetVarBranch::SEL_CHB_SIZE_MIN,c,tbl);
00273   }
00274 
00275   inline SetVarBranch
00276   SET_VAR_CHB_SIZE_MAX(BranchTbl tbl) {
00277     return SetVarBranch(SetVarBranch::SEL_CHB_SIZE_MAX,tbl);
00278   }
00279 
00280   inline SetVarBranch
00281   SET_VAR_CHB_SIZE_MAX(SetCHB c, BranchTbl tbl) {
00282     return SetVarBranch(SetVarBranch::SEL_CHB_SIZE_MAX,c,tbl);
00283   }
00284 
00285 }
00286 
00287 // STATISTICS: set-branch