/Users/jamian/Desktop/qecode/Implicative.hh

Go to the documentation of this file.
00001 /****   , [ Implicative.hh ], 
00002 Copyright (c) 2008 Universite d'Orleans - Jeremie Vautard 
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a copy
00005 of this software and associated documentation files (the "Software"), to deal
00006 in the Software without restriction, including without limitation the rights
00007 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008 copies of the Software, and to permit persons to whom the Software is
00009 furnished to do so, subject to the following conditions:
00010 
00011 The above copyright notice and this permission notice shall be included in
00012 all copies or substantial portions of the Software.
00013 
00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00020 THE SOFTWARE.
00021  *************************************************************************/
00022 #ifndef __QECODE_IMPLICATIVEOPT__
00023 #define __QECODE_IMPLICATIVEOPT__
00024 
00025 #include "myspace.hh"
00026 #include "vartype.hh"
00027 #include "OptVar.hh"
00028 #include <vector>
00029 
00030 
00031 using namespace std;
00032 class QECODE_VTABLE_EXPORT Implicative {
00033     friend class valueHeuristic;
00034     friend class QSolverOpt;
00035 private:
00036     struct Opts {
00037         vector<OptVar*> vars; // Several Optvars in universal scopes, one in existential ones
00038         int opt_type;        // Used in existential scopes : 0 for ANY, 1 for MIN, 2 for MAX.
00039     };
00040     
00041     int n;
00042     int nbSpaces;
00043     void** v;
00044     VarType* type_of_v;
00045     
00046     bool* Quantifiers;
00047     MySpace** rules;
00048     MySpace* goal;
00049     Opts* optim;
00050     int* nbVarBySpace;
00051     int* whichSpaceOwns;
00052     bool* varInitialised;
00053     
00054     int currentDeclareSpace;
00055     
00056 public:
00057     QECODE_EXPORT int nv() {return n;}
00058     
00066     QECODE_EXPORT Implicative(int ns, bool* quant,int* nv);
00067     QECODE_EXPORT ~Implicative();
00068     
00075     QECODE_EXPORT void QIntVar(int var,int min,int max);
00076     
00083     QECODE_EXPORT void QIntVar(int var,IntSet dom);
00084     
00090     QECODE_EXPORT void QBoolVar(int var);
00091     
00096     QECODE_EXPORT MySpace* space();
00097     
00103     QECODE_EXPORT IntVar var(int n);
00104 
00110     QECODE_EXPORT BoolVar bvar(int n);
00111 
00117     QECODE_EXPORT int nextScope();
00118 
00125     QECODE_EXPORT void makeStructure();
00126 
00134     QECODE_EXPORT OptVar* getAggregate(int scope, OptVar* opt, Aggregator* agg);
00135 
00141     QECODE_EXPORT OptVar* getExistential(int var);
00142     
00151     QECODE_EXPORT void optimize(int scope, int optType, OptVar* var);
00152 //    QECODE_EXPORT void print();
00153     
00154     QECODE_EXPORT bool qt_of_var(int v); 
00155     QECODE_EXPORT bool quantification(int scope) {return Quantifiers[scope];} 
00156     QECODE_EXPORT int spaces(); 
00157     QECODE_EXPORT int nbVarInScope(int scope) {return nbVarBySpace[scope];}
00158     QECODE_EXPORT MySpace* getSpace(int scope);
00159     QECODE_EXPORT MySpace* getGoal();
00160     QECODE_EXPORT int getOptType(int scope); 
00161     QECODE_EXPORT OptVar* getOptVar(int scope);
00162 };
00163     
00164 #endif

Generated on Tue Jun 10 18:31:30 2008 for qecode by  doxygen 1.5.2