Generated on Fri Mar 20 15:55:59 2015 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  *  Last modified:
00010  *     $Date: 2013-02-19 13:26:08 +0100 (Tue, 19 Feb 2013) $ by $Author: schulte $
00011  *     $Revision: 13313 $
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 #include <gecode/set/branch.hh>
00039 
00040 namespace Gecode { namespace Set { namespace Branch {
00041 
00042   ViewSel<SetView>*
00043   viewsel(Space& home, const SetVarBranch& svb) {
00044     switch (svb.select()) {
00045     case SetVarBranch::SEL_NONE:
00046       return new (home) ViewSelNone<SetView>(home,svb);
00047     case SetVarBranch::SEL_RND:
00048       return new (home) ViewSelRnd<SetView>(home,svb);
00049     default: break;
00050     }
00051     if (svb.tbl() != NULL) {
00052       switch (svb.select()) {
00053       case SetVarBranch::SEL_MERIT_MIN:
00054         return new (home) ViewSelMinTbl<MeritFunction<SetView> >(home,svb);
00055       case SetVarBranch::SEL_MERIT_MAX:
00056         return new (home) ViewSelMaxTbl<MeritFunction<SetView> >(home,svb);
00057       case SetVarBranch::SEL_MIN_MIN:
00058         return new (home) ViewSelMinTbl<MeritMin>(home,svb);
00059       case SetVarBranch::SEL_MIN_MAX:
00060         return new (home) ViewSelMaxTbl<MeritMin>(home,svb);
00061       case SetVarBranch::SEL_MAX_MIN:
00062         return new (home) ViewSelMinTbl<MeritMax>(home,svb);
00063       case SetVarBranch::SEL_MAX_MAX:
00064         return new (home) ViewSelMaxTbl<MeritMax>(home,svb);
00065       case SetVarBranch::SEL_SIZE_MIN:
00066         return new (home) ViewSelMinTbl<MeritSize>(home,svb);
00067       case SetVarBranch::SEL_SIZE_MAX:
00068         return new (home) ViewSelMaxTbl<MeritSize>(home,svb);
00069       case SetVarBranch::SEL_DEGREE_MIN:
00070         return new (home) ViewSelMinTbl<MeritDegree<SetView> >(home,svb);
00071       case SetVarBranch::SEL_DEGREE_MAX:
00072         return new (home) ViewSelMaxTbl<MeritDegree<SetView> >(home,svb);
00073       case SetVarBranch::SEL_AFC_MIN:
00074         return new (home) ViewSelMinTbl<MeritAFC<SetView> >(home,svb);
00075       case SetVarBranch::SEL_AFC_MAX:
00076         return new (home) ViewSelMaxTbl<MeritAFC<SetView> >(home,svb);
00077       case SetVarBranch::SEL_ACTIVITY_MIN:
00078         return new (home) ViewSelMinTbl<MeritActivity<SetView> >(home,svb);
00079       case SetVarBranch::SEL_ACTIVITY_MAX:
00080         return new (home) ViewSelMaxTbl<MeritActivity<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_ACTIVITY_SIZE_MIN:
00090         return new (home) ViewSelMinTbl<MeritActivitySize>(home,svb);
00091       case SetVarBranch::SEL_ACTIVITY_SIZE_MAX:
00092         return new (home) ViewSelMaxTbl<MeritActivitySize>(home,svb);
00093       default:
00094         throw UnknownBranching("Set::branch");
00095       }
00096     } else {
00097       switch (svb.select()) {
00098       case SetVarBranch::SEL_MERIT_MIN:
00099         return new (home) ViewSelMin<MeritFunction<SetView> >(home,svb);
00100       case SetVarBranch::SEL_MERIT_MAX:
00101         return new (home) ViewSelMax<MeritFunction<SetView> >(home,svb);
00102       case SetVarBranch::SEL_MIN_MIN:
00103         return new (home) ViewSelMin<MeritMin>(home,svb);
00104       case SetVarBranch::SEL_MIN_MAX:
00105         return new (home) ViewSelMax<MeritMin>(home,svb);
00106       case SetVarBranch::SEL_MAX_MIN:
00107         return new (home) ViewSelMin<MeritMax>(home,svb);
00108       case SetVarBranch::SEL_MAX_MAX:
00109         return new (home) ViewSelMax<MeritMax>(home,svb);
00110       case SetVarBranch::SEL_SIZE_MIN:
00111         return new (home) ViewSelMin<MeritSize>(home,svb);
00112       case SetVarBranch::SEL_SIZE_MAX:
00113         return new (home) ViewSelMax<MeritSize>(home,svb);
00114       case SetVarBranch::SEL_DEGREE_MIN:
00115         return new (home) ViewSelMin<MeritDegree<SetView> >(home,svb);
00116       case SetVarBranch::SEL_DEGREE_MAX:
00117         return new (home) ViewSelMax<MeritDegree<SetView> >(home,svb);
00118       case SetVarBranch::SEL_AFC_MIN:
00119         return new (home) ViewSelMin<MeritAFC<SetView> >(home,svb);
00120       case SetVarBranch::SEL_AFC_MAX:
00121         return new (home) ViewSelMax<MeritAFC<SetView> >(home,svb);
00122       case SetVarBranch::SEL_ACTIVITY_MIN:
00123         return new (home) ViewSelMin<MeritActivity<SetView> >(home,svb);
00124       case SetVarBranch::SEL_ACTIVITY_MAX:
00125         return new (home) ViewSelMax<MeritActivity<SetView> >(home,svb);
00126       case SetVarBranch::SEL_DEGREE_SIZE_MIN:
00127         return new (home) ViewSelMin<MeritDegreeSize>(home,svb);
00128       case SetVarBranch::SEL_DEGREE_SIZE_MAX:
00129         return new (home) ViewSelMax<MeritDegreeSize>(home,svb);
00130       case SetVarBranch::SEL_AFC_SIZE_MIN:
00131         return new (home) ViewSelMin<MeritAFCSize>(home,svb);
00132       case SetVarBranch::SEL_AFC_SIZE_MAX:
00133         return new (home) ViewSelMax<MeritAFCSize>(home,svb);
00134       case SetVarBranch::SEL_ACTIVITY_SIZE_MIN:
00135         return new (home) ViewSelMin<MeritActivitySize>(home,svb);
00136       case SetVarBranch::SEL_ACTIVITY_SIZE_MAX:
00137         return new (home) ViewSelMax<MeritActivitySize>(home,svb);
00138       default:
00139         throw UnknownBranching("Set::branch");
00140       }
00141     }
00142     GECODE_NEVER;
00143     return NULL;
00144   }
00145 
00146 }}}
00147 
00148 
00149 // STATISTICS: set-branch
00150