Generated on Thu Apr 11 13:58:58 2019 for Gecode by doxygen 1.6.3

view-sel.cpp

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 #include <gecode/set/branch.hh>
00035 
00036 namespace Gecode { namespace Set { namespace Branch {
00037 
00038   ViewSel<SetView>*
00039   viewsel(Space& home, const SetVarBranch& svb) {
00040     switch (svb.select()) {
00041     case SetVarBranch::SEL_NONE:
00042       return new (home) ViewSelNone<SetView>(home,svb);
00043     case SetVarBranch::SEL_RND:
00044       return new (home) ViewSelRnd<SetView>(home,svb);
00045     default: break;
00046     }
00047     if (svb.tbl() != NULL) {
00048       switch (svb.select()) {
00049       case SetVarBranch::SEL_MERIT_MIN:
00050         return new (home) ViewSelMinTbl<MeritFunction<SetView>>(home,svb);
00051       case SetVarBranch::SEL_MERIT_MAX:
00052         return new (home) ViewSelMaxTbl<MeritFunction<SetView>>(home,svb);
00053       case SetVarBranch::SEL_MIN_MIN:
00054         return new (home) ViewSelMinTbl<MeritMin>(home,svb);
00055       case SetVarBranch::SEL_MIN_MAX:
00056         return new (home) ViewSelMaxTbl<MeritMin>(home,svb);
00057       case SetVarBranch::SEL_MAX_MIN:
00058         return new (home) ViewSelMinTbl<MeritMax>(home,svb);
00059       case SetVarBranch::SEL_MAX_MAX:
00060         return new (home) ViewSelMaxTbl<MeritMax>(home,svb);
00061       case SetVarBranch::SEL_SIZE_MIN:
00062         return new (home) ViewSelMinTbl<MeritSize>(home,svb);
00063       case SetVarBranch::SEL_SIZE_MAX:
00064         return new (home) ViewSelMaxTbl<MeritSize>(home,svb);
00065       case SetVarBranch::SEL_DEGREE_MIN:
00066         return new (home) ViewSelMinTbl<MeritDegree<SetView>>(home,svb);
00067       case SetVarBranch::SEL_DEGREE_MAX:
00068         return new (home) ViewSelMaxTbl<MeritDegree<SetView>>(home,svb);
00069       case SetVarBranch::SEL_AFC_MIN:
00070         return new (home) ViewSelMinTbl<MeritAFC<SetView>>(home,svb);
00071       case SetVarBranch::SEL_AFC_MAX:
00072         return new (home) ViewSelMaxTbl<MeritAFC<SetView>>(home,svb);
00073       case SetVarBranch::SEL_ACTION_MIN:
00074         return new (home) ViewSelMinTbl<MeritAction<SetView>>(home,svb);
00075       case SetVarBranch::SEL_ACTION_MAX:
00076         return new (home) ViewSelMaxTbl<MeritAction<SetView>>(home,svb);
00077       case SetVarBranch::SEL_CHB_MIN:
00078         return new (home) ViewSelMinTbl<MeritCHB<SetView>>(home,svb);
00079       case SetVarBranch::SEL_CHB_MAX:
00080         return new (home) ViewSelMaxTbl<MeritCHB<SetView>>(home,svb);
00081       case SetVarBranch::SEL_DEGREE_SIZE_MIN:
00082         return new (home) ViewSelMinTbl<MeritDegreeSize>(home,svb);
00083       case SetVarBranch::SEL_DEGREE_SIZE_MAX:
00084         return new (home) ViewSelMaxTbl<MeritDegreeSize>(home,svb);
00085       case SetVarBranch::SEL_AFC_SIZE_MIN:
00086         return new (home) ViewSelMinTbl<MeritAFCSize>(home,svb);
00087       case SetVarBranch::SEL_AFC_SIZE_MAX:
00088         return new (home) ViewSelMaxTbl<MeritAFCSize>(home,svb);
00089       case SetVarBranch::SEL_ACTION_SIZE_MIN:
00090         return new (home) ViewSelMinTbl<MeritActionSize>(home,svb);
00091       case SetVarBranch::SEL_ACTION_SIZE_MAX:
00092         return new (home) ViewSelMaxTbl<MeritActionSize>(home,svb);
00093       case SetVarBranch::SEL_CHB_SIZE_MIN:
00094         return new (home) ViewSelMinTbl<MeritCHBSize>(home,svb);
00095       case SetVarBranch::SEL_CHB_SIZE_MAX:
00096         return new (home) ViewSelMaxTbl<MeritCHBSize>(home,svb);
00097       default:
00098         throw UnknownBranching("Set::branch");
00099       }
00100     } else {
00101       switch (svb.select()) {
00102       case SetVarBranch::SEL_MERIT_MIN:
00103         return new (home) ViewSelMin<MeritFunction<SetView>>(home,svb);
00104       case SetVarBranch::SEL_MERIT_MAX:
00105         return new (home) ViewSelMax<MeritFunction<SetView>>(home,svb);
00106       case SetVarBranch::SEL_MIN_MIN:
00107         return new (home) ViewSelMin<MeritMin>(home,svb);
00108       case SetVarBranch::SEL_MIN_MAX:
00109         return new (home) ViewSelMax<MeritMin>(home,svb);
00110       case SetVarBranch::SEL_MAX_MIN:
00111         return new (home) ViewSelMin<MeritMax>(home,svb);
00112       case SetVarBranch::SEL_MAX_MAX:
00113         return new (home) ViewSelMax<MeritMax>(home,svb);
00114       case SetVarBranch::SEL_SIZE_MIN:
00115         return new (home) ViewSelMin<MeritSize>(home,svb);
00116       case SetVarBranch::SEL_SIZE_MAX:
00117         return new (home) ViewSelMax<MeritSize>(home,svb);
00118       case SetVarBranch::SEL_DEGREE_MIN:
00119         return new (home) ViewSelMin<MeritDegree<SetView>>(home,svb);
00120       case SetVarBranch::SEL_DEGREE_MAX:
00121         return new (home) ViewSelMax<MeritDegree<SetView>>(home,svb);
00122       case SetVarBranch::SEL_AFC_MIN:
00123         return new (home) ViewSelMin<MeritAFC<SetView>>(home,svb);
00124       case SetVarBranch::SEL_AFC_MAX:
00125         return new (home) ViewSelMax<MeritAFC<SetView>>(home,svb);
00126       case SetVarBranch::SEL_ACTION_MIN:
00127         return new (home) ViewSelMin<MeritAction<SetView>>(home,svb);
00128       case SetVarBranch::SEL_ACTION_MAX:
00129         return new (home) ViewSelMax<MeritAction<SetView>>(home,svb);
00130       case SetVarBranch::SEL_CHB_MIN:
00131         return new (home) ViewSelMin<MeritCHB<SetView>>(home,svb);
00132       case SetVarBranch::SEL_CHB_MAX:
00133         return new (home) ViewSelMax<MeritCHB<SetView>>(home,svb);
00134       case SetVarBranch::SEL_DEGREE_SIZE_MIN:
00135         return new (home) ViewSelMin<MeritDegreeSize>(home,svb);
00136       case SetVarBranch::SEL_DEGREE_SIZE_MAX:
00137         return new (home) ViewSelMax<MeritDegreeSize>(home,svb);
00138       case SetVarBranch::SEL_AFC_SIZE_MIN:
00139         return new (home) ViewSelMin<MeritAFCSize>(home,svb);
00140       case SetVarBranch::SEL_AFC_SIZE_MAX:
00141         return new (home) ViewSelMax<MeritAFCSize>(home,svb);
00142       case SetVarBranch::SEL_ACTION_SIZE_MIN:
00143         return new (home) ViewSelMin<MeritActionSize>(home,svb);
00144       case SetVarBranch::SEL_ACTION_SIZE_MAX:
00145         return new (home) ViewSelMax<MeritActionSize>(home,svb);
00146       case SetVarBranch::SEL_CHB_SIZE_MIN:
00147         return new (home) ViewSelMin<MeritCHBSize>(home,svb);
00148       case SetVarBranch::SEL_CHB_SIZE_MAX:
00149         return new (home) ViewSelMax<MeritCHBSize>(home,svb);
00150       default:
00151         throw UnknownBranching("Set::branch");
00152       }
00153     }
00154     GECODE_NEVER;
00155     return NULL;
00156   }
00157 
00158 }}}
00159 
00160 
00161 // STATISTICS: set-branch
00162