/Users/jamian/Desktop/gecode-2.0.1/contribs/qecode/warner.hh

Go to the documentation of this file.
00001 /*****************************************************************[warner.hh]
00002 Copyright (c) 2007, Universite d'Orleans - Jeremie Vautard, Marco Benedetti,
00003 Arnaud Lallouet.
00004 
00005 Permission is hereby granted, free of charge, to any person obtaining a copy
00006 of this software and associated documentation files (the "Software"), to deal
00007 in the Software without restriction, including without limitation the rights
00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009 copies of the Software, and to permit persons to whom the Software is
00010 furnished to do so, subject to the following conditions:
00011 
00012 The above copyright notice and this permission notice shall be included in
00013 all copies or substantial portions of the Software.
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00021 THE SOFTWARE.
00022 *****************************************************************************/
00023 #ifndef __QECODE_WARNER__
00024 #define __QECODE_WARNER__
00025 
00026 #include "qecode.hh"
00027 #include <iostream>
00028 #include <cstdlib>
00029 #include "gecode/minimodel.hh"
00030 #include "qecore.hh"
00031 
00032 
00033 using namespace Gecode;
00034 using namespace Gecode::Int;
00035 
00036 class QECODE_VTABLE_EXPORT Warner {
00037 private : 
00038   BranchingHeuristic* bh;
00039   QSpace* sp;
00040 public : 
00041   QECODE_EXPORT Warner(QSpace* qs) {bh=NULL;sp=qs;}
00042   QECODE_EXPORT void update(QSpace* qs) {sp=qs;}
00043   QECODE_EXPORT void setBH(BranchingHeuristic* b);
00044   QECODE_EXPORT void warn(int w);
00045 };
00046 
00047 
00048 class QECODE_VTABLE_EXPORT IntWarningProp : public UnaryPropagator<IntView,PC_INT_DOM> {
00049 
00050 private : 
00051   int var;
00052   Warner* toWarn;
00053 
00054 public : 
00055   QECODE_EXPORT IntWarningProp (Space* home, int v, IntView vv, Warner* f, bool fd=false);
00056   QECODE_EXPORT IntWarningProp (Space* home,bool share, IntWarningProp& p);
00057   QECODE_EXPORT ~IntWarningProp (void);
00058   QECODE_EXPORT virtual PropCost cost(void) const;
00059   QECODE_EXPORT virtual ExecStatus propagate(Space * home);
00060   QECODE_EXPORT virtual Actor* copy(Space* home,bool share);
00061   QECODE_EXPORT static ExecStatus warning(Space* home, int v, IntView vv, Warner* f);
00062   QECODE_EXPORT static void IntWarning(Space* home, int v, IntVar iv, Warner* f);
00063 };
00064 
00065 class QECODE_VTABLE_EXPORT BoolWarningProp : public UnaryPropagator<BoolView,PC_INT_DOM> {
00066     
00067 private : 
00068     int var;
00069     Warner* toWarn;
00070     
00071 public : 
00072     QECODE_EXPORT BoolWarningProp (Space* home, int v, BoolView vv, Warner* f, bool fd=false);
00073     QECODE_EXPORT BoolWarningProp (Space* home,bool share, BoolWarningProp& p);
00074     QECODE_EXPORT ~BoolWarningProp (void);
00075     QECODE_EXPORT virtual PropCost cost(void) const;
00076     QECODE_EXPORT virtual ExecStatus propagate(Space * home);
00077     QECODE_EXPORT virtual Actor* copy(Space* home,bool share);
00078     QECODE_EXPORT static ExecStatus warning(Space* home, int v, BoolView vv, Warner* f);
00079     QECODE_EXPORT static void BoolWarning(Space* home, int v, BoolVar iv, Warner* f);
00080 };
00081 
00082 
00083 #endif

Generated on Thu Feb 7 14:33:45 2008 for qecode by  doxygen 1.5.2