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