Main Page   Class Hierarchy   Compound List   File List   Contact   Download   Symbolic Constraints   Examples  

qelement.h

00001 #ifndef QELEMENT_H
00002 #define QELEMENT_H
00003 
00004 #include <boost/graph/adjacency_list.hpp>
00005 #include <boost/graph/adjacency_matrix.hpp>
00006 #include <boost/graph/graph_traits.hpp>
00007 #include <scil/core/monomial.h>
00008 #include <scil/core/boolfunction.h>
00009 
00010 namespace SCIL {
00011 
00012 using namespace boost;
00013 
00014 template <typename Graph>
00015 class qelement {
00016       
00017       protected:
00018          
00019          typedef graph_traits<Graph> GraphTraits;
00020          typedef typename GraphTraits::vertex_descriptor vertex_descriptor;
00021          typedef typename GraphTraits::edge_descriptor edge_descriptor;
00022 
00023 
00025 
00028          void checkGraphConcepts() {
00029             //Graph has to provide the vertex_descriptor type
00030             BOOST_CONCEPT_ASSERT((GraphConcept<Graph>));
00031          }
00032 
00033          qelement<Graph>* l; //a pointer to the left part of the quadratic decomposition
00034          qelement<Graph>* r; //a pointer to the right part of the quadratic decomposition
00035                        //for singletons l and r are  NULL and basic is true
00036          bool maximal; //true if the element is maximal in the decomposition
00037                        //i.e. it is not part of a decomposition
00038          bool basic;   //true if the qelement belongs to a basic variable
00039          qelement<Graph>* in_SG;
00040          vertex_descriptor sg_node; //the corresponding node in the separation graph
00041 
00042       public:
00043 
00044 
00045          //set the maximal flag to false
00046          //this means that this qelement is part of a decomposition
00047          void setNotMaximal() {
00048             maximal = false;
00049             return;
00050          }
00051 
00052          //return the left part of the decomposition
00053          qelement<Graph>* getLeft() const {
00054             return l;
00055          }
00056 
00057          //return the right part of the decomposition
00058          qelement<Graph>* getRight() const {
00059             return r;
00060          }
00061 
00062          //set the left part of the decomposition
00063          void setLeft(qelement<Graph>* li) {
00064             l = li;
00065             return;
00066          }
00067 
00068          //set the right part of the decomposition
00069          void setRight(qelement<Graph>* ri) {
00070             r = ri;
00071             return;
00072          }
00073 
00074          void set_in_separation_graph(qelement<Graph>* bfsg){
00075             in_SG = bfsg;
00076          }
00077 
00078          qelement<Graph>* in_separation_graph(){
00079             return in_SG;
00080          }
00081 
00082          //return true if qelement is maximal, else false
00083          bool isMaximal() const {
00084             return maximal;
00085          }
00086 
00087          //return true if qelement belongs to a basic variables, else false
00088          bool isBasic() {
00089             return basic;
00090          }
00091 
00092          //return the node in the separation graph
00093          vertex_descriptor  getSGNode() {
00094             return sg_node;
00095          }
00096 
00097          //set the node in the separation graph
00098          void setSGNode(vertex_descriptor  v) {
00099             sg_node = v;
00100             return;
00101          }
00102 
00103          qelement(){
00104             in_SG = NULL;
00105          }
00106 
00107          virtual row get_linVar() {};
00108          virtual monomial* getMonomial() const {};
00109          virtual boolfunction* getBoolfunction() const {};
00110 
00111 
00112          //the linear transformations
00113          virtual row trans() {};
00114          virtual row transLeft() {};
00115          virtual row transRight() {};
00116 
00117          //add the constraints coupling the element to its decomposition
00118          virtual void linearize(ILP_Problem& IP){};
00119 
00120          //output the variables making up the element (if NONLINEAR_INST_DEBUG)
00121          virtual void printName(){};
00122    };
00123 
00124 }
00125 #endif
Generated on Mon Mar 28 22:03:49 2011 for SCIL by  doxygen 1.6.3