Generated on Mon Aug 25 11:35:33 2008 for Gecode by doxygen 1.5.6

select-view.icc

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Patrick Pekczynski <pekczynski@ps.uni-sb.de>
00005  *
00006  *  Copyright:
00007  *     Patrick Pekczynski, 2006
00008  *
00009  *  Last modified:
00010  *     $Date: 2008-01-13 17:49:17 +0100 (Sun, 13 Jan 2008) $ by $Author: tack $
00011  *     $Revision: 5864 $
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 namespace Gecode { namespace CpltSet { namespace Branch {
00039 
00040   forceinline ViewSelStatus
00041   ByNone::init(const Space*, CpltSetView) {
00042     return VSS_COMMIT;
00043   }
00044 
00045   forceinline ViewSelStatus
00046   ByNone::select(const Space*, CpltSetView) {
00047     GECODE_NEVER;
00048     return VSS_NONE;
00049   }
00050 
00051   inline Support::Symbol
00052   ByNone::type(void) {
00053     return Support::Symbol("CpltSet::Branch::ByNone");
00054   }
00055 
00056   forceinline ViewSelStatus
00057   ByMinCard::init(const Space*, CpltSetView x) { 
00058     minCard = x.unknownSize();
00059     return (minCard == 1) ? VSS_COMMIT : VSS_SELECT;
00060   }
00061   forceinline ViewSelStatus
00062   ByMinCard::select(const Space*, CpltSetView x) {
00063     unsigned int us = x.unknownSize();
00064     if (us < minCard) {
00065       minCard = us;
00066       return (minCard == 1) ? VSS_COMMIT : VSS_SELECT;
00067     }
00068     return VSS_NONE;
00069   }
00070   inline Support::Symbol
00071   ByMinCard::type(void) {
00072     return Support::Symbol("CpltSet::Branch::ByMinCard");
00073   }
00074 
00075   forceinline ViewSelStatus
00076   ByMaxCard::init(const Space*, CpltSetView x) { 
00077     maxCard = x.unknownSize();
00078     return VSS_SELECT;
00079   }
00080   forceinline ViewSelStatus
00081   ByMaxCard::select(const Space*, CpltSetView x) {
00082     unsigned int us = x.unknownSize();
00083     if (us > maxCard) {
00084       maxCard = us; return VSS_SELECT;
00085     }
00086     return VSS_NONE;
00087   }
00088   inline Support::Symbol
00089   ByMaxCard::type(void) {
00090     return Support::Symbol("CpltSet::Branch::ByMaxCard");
00091   }
00092 
00093   forceinline ViewSelStatus
00094   ByMinUnknown::init(const Space*, CpltSetView x) {
00095     Set::UnknownRanges<CpltSetView> unknown(x);
00096     minUnknown = unknown.min();
00097     return VSS_SELECT;
00098   }
00099   forceinline ViewSelStatus
00100   ByMinUnknown::select(const Space*, CpltSetView x) {
00101     Set::UnknownRanges<CpltSetView> unknown(x);
00102     int um = unknown.min();
00103     if (um < minUnknown) {
00104       minUnknown = um; return VSS_SELECT;
00105     }
00106     return VSS_NONE;
00107   }
00108   inline Support::Symbol
00109   ByMinUnknown::type(void) {
00110     return Support::Symbol("CpltSet::Branch::ByMinUnknown");
00111   }
00112 
00113   forceinline ViewSelStatus
00114   ByMaxUnknown::init (const Space*, CpltSetView x) {
00115     Set::UnknownRanges<CpltSetView> unknown(x);
00116     do {
00117       maxUnknown = unknown.max();
00118       ++unknown;
00119     } while(unknown());
00120     return VSS_SELECT;
00121   }
00122   forceinline ViewSelStatus
00123   ByMaxUnknown::select(const Space*, CpltSetView x) {
00124     Set::UnknownRanges<CpltSetView> unknown(x);
00125     int um = 0;
00126     assert(unknown());
00127     do {
00128       um = unknown.max();
00129       ++unknown;
00130     } while(unknown());
00131     if (um > maxUnknown) {
00132       maxUnknown = um; return VSS_SELECT;
00133     }
00134     return VSS_NONE;
00135   }
00136   inline Support::Symbol
00137   ByMaxUnknown::type(void) {
00138     return Support::Symbol("CpltSet::Branch::ByMaxUnknown");
00139   }
00140 
00141 }}}
00142 
00143 // STATISTICS: cpltset-branch