Generated on Tue Apr 18 10:21:37 2017 for Gecode by doxygen 1.6.3

val-sel-commit.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: 2017-02-16 12:11:51 +0100 (Thu, 16 Feb 2017) $ by $Author: schulte $
00011  *     $Revision: 15434 $
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   ValSelCommitBase<SetView,int>*
00043   valselcommit(Space& home, const SetValBranch& svb) {
00044     switch (svb.select()) {
00045     case SetValBranch::SEL_MIN_INC:
00046       return new (home) ValSelCommit<ValSelMin,ValCommitInc>(home,svb);
00047     case SetValBranch::SEL_MIN_EXC:
00048       return new (home) ValSelCommit<ValSelMin,ValCommitExc>(home,svb);
00049     case SetValBranch::SEL_MED_INC:
00050       return new (home) ValSelCommit<ValSelMed,ValCommitInc>(home,svb);
00051     case SetValBranch::SEL_MED_EXC:
00052       return new (home) ValSelCommit<ValSelMed,ValCommitExc>(home,svb);
00053     case SetValBranch::SEL_MAX_INC:
00054       return new (home) ValSelCommit<ValSelMax,ValCommitInc>(home,svb);
00055     case SetValBranch::SEL_MAX_EXC:
00056       return new (home) ValSelCommit<ValSelMax,ValCommitExc>(home,svb);
00057     case SetValBranch::SEL_RND_INC:
00058       return new (home) ValSelCommit<ValSelRnd,ValCommitInc>(home,svb);
00059     case SetValBranch::SEL_RND_EXC:
00060       return new (home) ValSelCommit<ValSelRnd,ValCommitExc>(home,svb);
00061     case SetValBranch::SEL_VAL_COMMIT:
00062       if (!svb.commit()) {
00063         return new (home)
00064           ValSelCommit<ValSelFunction<SetView>,ValCommitInc>(home,svb);
00065       } else {
00066         return new (home)
00067           ValSelCommit<ValSelFunction<SetView>,ValCommitFunction<SetView> >(home,svb);
00068       }
00069     default:
00070       throw UnknownBranching("Set::branch");
00071     }
00072   }
00073 
00074   ValSelCommitBase<SetView,int>*
00075   valselcommit(Space& home, const SetAssign& sa) {
00076     switch (sa.select()) {
00077     case SetAssign::SEL_MIN_INC:
00078       return new (home) ValSelCommit<ValSelMin,ValCommitInc>(home,sa);
00079     case SetAssign::SEL_MIN_EXC:
00080       return new (home) ValSelCommit<ValSelMin,ValCommitExc>(home,sa);
00081     case SetAssign::SEL_MED_INC:
00082       return new (home) ValSelCommit<ValSelMed,ValCommitInc>(home,sa);
00083     case SetAssign::SEL_MED_EXC:
00084       return new (home) ValSelCommit<ValSelMed,ValCommitExc>(home,sa);
00085     case SetAssign::SEL_MAX_INC:
00086       return new (home) ValSelCommit<ValSelMax,ValCommitInc>(home,sa);
00087     case SetAssign::SEL_MAX_EXC:
00088       return new (home) ValSelCommit<ValSelMax,ValCommitExc>(home,sa);
00089     case SetAssign::SEL_RND_INC:
00090       return new (home) ValSelCommit<ValSelRnd,ValCommitInc>(home,sa);
00091     case SetAssign::SEL_RND_EXC:
00092       return new (home) ValSelCommit<ValSelRnd,ValCommitExc>(home,sa);
00093     case SetAssign::SEL_VAL_COMMIT:
00094       if (!sa.commit()) {
00095         return new (home)
00096           ValSelCommit<ValSelFunction<SetView>,ValCommitInc>(home,sa);
00097       } else {
00098         return new (home)
00099           ValSelCommit<ValSelFunction<SetView>,ValCommitFunction<SetView> >(home,sa);
00100       }
00101     default:
00102       throw UnknownBranching("Set::assign");
00103     }
00104   }
00105 
00106 }}}
00107 
00108 // STATISTICS: set-branch
00109