00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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