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

subproblem.h

00001 #ifndef SCIL_SUBPROBLEM_H
00002 #define SCIL_SUBPROBLEM_H
00003 
00004 #include<LEDA/list.h>
00005 #include<LEDA/string.h>
00006 #include<abacus/sub.h>
00007 #include<scil/global.h>
00008 //#include<abacus/sub.h>
00009 #include<scil/row.h>
00010 #include<scil/sym_constraint.h>
00011 
00012 namespace SCIL {
00013 
00014 class solution;
00015 class var;
00016 class sym_constraint;
00017 class cons;
00018 class cons_obj;
00019 
00020 #define forall_variables(x,S)\
00021 for(int loop_var = (S).first_variable_item();\
00022 x=(S).get_var(loop_var), x != nil; \
00023 loop_var=(S).next_variable_item(loop_var) )
00024 
00025 #define forall_basic_constraints(x,S)\
00026 for(int loop_var = (S).first_constraint_item();\
00027 x=(S).get_cons(loop_var), x != nil; \
00028 loop_var=(S).next_constraint_item(loop_var) )
00029 
00030 #define forall_sym_constraints(x,S)\
00031 for(LEDA::list_item loop_var = (S).first_sym_constraint_item();\
00032 x=(S).get_sym_cons(loop_var), x != nil; \
00033 loop_var=(S).next_sym_constraint_item(loop_var) )
00034   
00037 
00038 class subproblem : private ABA_SUB
00039 {
00040   friend class ABA_Variable;
00041   friend class ABA_Constraint;
00042   friend class ILP_Problem;
00043 
00044  public: //TODO remake private
00045   int t;
00046   ILP_Problem & GM;
00047   bool initpricing;
00048   ABA_BUFFER < ABA_VARIABLE * >*newvarbuffer;
00049   LEDA::list < sym_constraint * >sym_constraints;
00050   int updateLP;
00051   bool check_LP ();
00052 
00053  public:
00054   
00058 
00064   var add_variable (double obj, double lBound, double uBound, Vartype,
00065                     Activation a = Static);
00066 
00069   void add_variable (var, Activation a = Static);
00070 
00075   virtual
00076   cons add_basic_constraint (cons_sense, double, Activation a = Dynamic);
00077 
00080   virtual
00081   cons add_basic_constraint (cons_obj * c, Activation a = Dynamic);
00082 
00084   void add_sym_constraint (sym_constraint * c);
00085 
00088   void remove_variable (var V);
00089 
00092   void set_coefficient (var v, cons i, double d);
00093 
00095 
00099 
00101   var get_var (int i);
00102 
00104   int nVar () const;
00105 
00107   double get_coeff (var v, cons i);
00108 
00110   int first_variable_item() const { 
00111     return 0; }
00112 
00114   int next_variable_item(int i) const {
00115     return i+1;
00116   };
00117 
00118   int first_constraint_item() const { 
00119     return 0; }
00120 
00122   int next_constraint_item(int i) const {
00123     return i+1;
00124   };
00125 
00126   LEDA::list_item first_sym_constraint_item() const;
00127 
00128   LEDA::list_item next_sym_constraint_item(LEDA::list_item i) const;
00129 
00130   sym_constraint* get_sym_cons(LEDA::list_item i);
00131 
00133   cons get_cons (int i);
00134 
00135   int found_constraint() {
00136     return t>0;
00137   };
00138 
00140   int ncons ();
00141 
00143   virtual
00144   double value (var v);
00145 
00147   double value(row& r);
00148 
00150   double lower_bound (var v);
00151 
00153   double upper_bound (var v);
00154 
00160   double value (cons i, as_what as = as_is);
00161 
00163   double red_cost(var v);
00164 
00165   void save_solution(solution& s);
00166 
00168 
00172 
00174   const
00175   LEDA::string& configuration(const LEDA::string& s) const;
00176 
00178   LEDA::string& configuration(const LEDA::string&);
00179 
00181 
00183   subproblem(ABA_MASTER * master);
00184 
00185   subproblem(ABA_MASTER * master, ABA_SUB * father, ABA_BRANCHRULE * branchRule);
00186 
00187   virtual ~ subproblem ();
00188 
00189   virtual bool feasible ();
00190 
00191   virtual bool feasible (subproblem &, solution&);
00192 
00193   void update_indices (); 
00194 
00195   virtual int separate ();
00196   
00197   virtual int separate (subproblem &); 
00198 
00199   void activate (subproblem & S);
00200 
00201   void activate ();
00202 
00203   void deactivate (subproblem & S);
00204 
00205   void deactivate ();
00206 
00207   double myvalue (int i);
00208 
00209   virtual int pricing ();
00210 
00211   virtual int pricing (subproblem &);
00212 
00213   virtual int mf_pricing (subproblem &); 
00214 
00215   double *MxVal ();
00216 
00217   virtual ABA_SUB * generateSon (ABA_BRANCHRULE * rule);
00218 
00220 };
00221 
00222 }
00223 #endif

Generated on Tue Nov 16 15:18:22 2004 for SCIL by doxygen1.2.16