/Users/jamian/Desktop/gecode-2.0.1/contribs/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 __QECODE_IMPLICATIVE__
00024 #define __QECODE_IMPLICATIVE__
00025 #include "qecode.hh"
00026 #include <iostream>
00027 #include <cstdlib>
00028 #include "gecode/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 QECODE_VTABLE_EXPORT 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 
00067   QECODE_EXPORT Implicative(int ns,bool firstQ,int* nv); 
00068 
00072   QECODE_EXPORT Implicative(Implicative& im);
00073 
00077   QECODE_EXPORT virtual ~Implicative();
00078 
00082   QECODE_EXPORT int spaces();
00083 
00090   QECODE_EXPORT void QIntVar(int var,int min,int max);
00091 
00097   QECODE_EXPORT void QIntVar(int var,IntSet dom);
00098 
00105   QECODE_EXPORT void QBoolVar(int var,int min, int max);
00106 
00111   QECODE_EXPORT void QBoolVar(int var) {QBoolVar(var,0,1);}
00112 
00113 
00114 //  /** \brief Returns one of the restrictor space.
00115 //   * Returns one of the restrictor space. Deprecated : use space() and nextScope instead for constraint posting.
00116 //   *  @param sp the number of the restrictor to get (first restrictor is 0).
00117 //   */
00118 //  MySpace* getRuleSpace(int sp);
00119 //
00120 //
00121 //  /** \brief Returns the goal space.
00122 //   *  Returns the goal space. Deprecated : use space() and nextScope instead for constraint posting.
00123 //   */
00124 //  MySpace* getGoalSpace();
00125 
00126   
00130   QECODE_EXPORT MySpace* space();
00131 
00132 
00137   QECODE_EXPORT IntVar var(int n); 
00138 
00139 
00144   QECODE_EXPORT BoolVar bvar(int n); 
00145 
00146 
00147 
00152   QECODE_EXPORT int nextScope();
00153 
00154 
00158   QECODE_EXPORT void makeStructure();
00159 
00163   QECODE_EXPORT virtual void print();
00164       
00165       
00166   QECODE_EXPORT virtual bool quantification(int v);
00167   QECODE_EXPORT virtual int status(int var,unsigned long int& propsteps);
00168   QECODE_EXPORT virtual int finalStatus(unsigned long int& propsteps);
00169   QECODE_EXPORT virtual bool subsumed(int var);
00170   QECODE_EXPORT virtual Implicative* clone(); 
00171   QECODE_EXPORT virtual void assign_int(int var,int** vals,int nbVals);
00172   QECODE_EXPORT virtual void remove_int(int var,int** vals,int nbVals);
00173   QECODE_EXPORT virtual void assign_bool(int var,int** vals,int nbVals);
00174   QECODE_EXPORT virtual void remove_bool(int var,int** vals,int nbVals);
00175   QECODE_EXPORT virtual void assign_bool(int var,int b);
00176   QECODE_EXPORT virtual void remove_bool(int var,int b);
00177 //  virtual void infEqual(int var,int val);
00178 //  virtual void sup(int var,int val);
00179   QECODE_EXPORT virtual void backtrack();
00180   QECODE_EXPORT virtual void indicateBranchingHeuristic(BranchingHeuristic* bh);
00181 };
00182 
00183 
00184 #endif

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