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

flow.cc

00001 #include <scil/scil.h>
00002 #include <LEDA/graph.h>
00003 #include <scil/constraints/flow.h>
00004 
00005 using namespace SCIL;
00006 using namespace LEDA;
00007 
00008 class FLOW::flow_balance : public cons_obj {
00009 private:
00010   graph& G;
00011   node v;
00012   scil_map<edge>& VM;
00013   row vv;
00014   
00015 public:
00016   flow_balance(graph& G_, node& v_, 
00017                scil_map<edge>& VM_, row vv_)
00018     : cons_obj(Equal, 0), G(G_), 
00019       v(v_), VM(VM_), vv(vv_) {
00020   };
00021 
00022   virtual void non_zero_entries(row& r) {
00023     edge e;
00024     forall_out_edges(e, v) {
00025       r+=VM(e);
00026     };
00027     forall_in_edges(e, v) {
00028       r-=VM(e);
00029     }
00030     r-=vv;
00031   };
00032 
00033   virtual ~flow_balance() {};
00034 };
00035 
00036 
00037 FLOW::FLOW(graph& G_, scil_map<node>& D_, scil_map<edge>& VM_) :
00038   /*{\Mcreate The constraint FLOWs adds the flow preservation constraints for all
00039     nodes, i.e.~
00040     $\sum_{e \in \delta^+(v)} x_e - \sum_{e \in \delta^-(v)} x_e = x_v $.\\
00041     For a demo see: production.}*/
00042   G(G_), D(D_), VM(VM_) {
00043 };
00044 
00045 void FLOW::init(subproblem& S) {
00046   node v;
00047   forall_nodes(v, G) {
00048     cout<<"Add\n";
00049     S.add_basic_constraint(new flow_balance(G, v, VM, D(v)));
00050     cout<<"Suceed\n";
00051   }
00052 };
00053 
00054 

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