/Users/jamian/qecode-1.1/qecode/implicative.hh

Go to the documentation of this file.
00001 /*****************************************************************[implicative.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 implicative
00024 #define implicative
00025 //plop
00026 #include <iostream>
00027 #include <cstdlib>
00028 #include "minimodel.hh"
00029 #include "warner.hh"
00030 #include "qecore.hh"
00031 #include "myspace.hh"
00032 
00033 using namespace Gecode;
00034 using namespace std;
00035 using namespace Gecode::Int;
00036 
00037 
00038 class Implicative : public QSpace {
00039     friend class valueHeuristic;
00040 
00041 protected : 
00042   bool* q;                
00043   int nbSpaces;           
00044   int currentDeclareSpace;
00045   int* nbVarBySpace;      
00046   int* whichSpaceOwns;    
00047   MySpace** rules;        
00048   MySpace* goal;          
00049   bool* varInitialised;   
00050   bool* ruleDefined;      
00051   int* ruleStatus;        
00052   bool goalDefined;       
00053   int goalStatus;         
00054   Warner* w;
00055   int prop_power;         
00056 
00057   int cascade(int firstSpace, unsigned long int& propsteps);
00058 
00059 public : 
00060 
00068   Implicative(int ns,bool firstQ,int* nv, int prop); 
00069 
00073   Implicative(Implicative& im);
00074 
00078   virtual ~Implicative();
00079 
00083   int spaces();
00084 
00091   void QIntVar(int var,int min,int max);
00092 
00098   void QIntVar(int var,IntSet dom);
00099 
00106   void QBoolVar(int var,int min, int max);
00107 
00112   void QBoolVar(int var) {QBoolVar(var,0,1);}
00113 
00114 
00119   MySpace* getRuleSpace(int sp);
00120 
00121 
00125   MySpace* getGoalSpace();
00126 
00127   
00131   MySpace* space();
00132 
00133 
00138   IntVar var(int n); 
00139 
00140 
00145   BoolVar bvar(int n); 
00146 
00147 
00148 
00153   int nextScope();
00154 
00155 
00159   void makeStructure();
00160 
00164   virtual void print();
00165       
00166       
00167   virtual bool quantification(int v);
00168   virtual int status(int var,unsigned long int& propsteps);
00169   virtual int finalStatus(unsigned long int& propsteps);
00170   virtual bool subsumed(int var);
00171   virtual Implicative* clone(); 
00172   virtual void assign(int var,int** vals,int nbVals);
00173   virtual void remove(int var,int** vals,int nbVals);
00174 //  virtual void infEqual(int var,int val);
00175 //  virtual void sup(int var,int val);
00176   virtual void backtrack();
00177   virtual void indicateBranchingHeuristic(BranchingHeuristic* bh);
00178 };
00179 
00180 
00181 #endif

Generated on Fri Sep 21 16:36:36 2007 for qecode by  doxygen 1.5.2