/home/coin/SVN-release/CoinAll-1.1.0/Bcp/examples/MCF-1/include/MCF1_var.hpp

Go to the documentation of this file.
00001 #ifndef MCF1_var_hpp
00002 #define MCF1_var_hpp
00003 
00004 #include "CoinPackedVector.hpp"
00005 #include "BCP_buffer.hpp"
00006 #include "BCP_var.hpp"
00007 
00008 /*---------------------------------------------------------------------------*/
00009 
00010 // Here are two kind of variables. The first is a "real" variable, i.e., it
00011 // describes a column of the master problem, that is a flow for a
00012 // commodity. The second is a "fake" variable. It simply holds information on
00013 // the branching decision so that in the subproblems we can make the
00014 // appropriate restrictions on the flow values.
00015 
00016 class MCF1_var : public BCP_var_algo {
00017 public:
00018     int commodity;
00019     CoinPackedVector flow;
00020     double weight;
00021 
00022 public:
00023     MCF1_var(int com, const CoinPackedVector& f, double w) :
00024         BCP_var_algo(BCP_ContinuousVar, w, 0, 1),
00025         commodity(com), flow(false), weight(w)
00026     {
00027         new (&flow) CoinPackedVector(f.getNumElements(),
00028                                      f.getIndices(), f.getElements(), false);
00029     }
00030     MCF1_var(BCP_buffer& buf);
00031     ~MCF1_var() {}
00032 
00033     void pack(BCP_buffer& buf) const;
00034 };
00035 
00036 /*---------------------------------------------------------------------------*/
00037 
00038 class MCF1_branching_var : public BCP_var_algo {
00039 public:
00040     int commodity;
00041     int arc_index;
00042     int lb_child0;
00043     int ub_child0;
00044     int lb_child1;
00045     int ub_child1;
00046 
00047 public:
00048     MCF1_branching_var(int comm, int ind, int lb0, int ub0, int lb1, int ub1) :
00049         BCP_var_algo(BCP_BinaryVar, 0, 0, 1),
00050         commodity(comm), arc_index(ind),
00051         lb_child0(lb0), ub_child0(ub0), lb_child1(lb1), ub_child1(ub1) {}
00052     MCF1_branching_var(BCP_buffer& buf);
00053     ~MCF1_branching_var() {}
00054 
00055     void pack(BCP_buffer& buf) const;
00056 };
00057 
00058 void MCF1_pack_var(const BCP_var_algo* var, BCP_buffer& buf);
00059 BCP_var_algo* MCF1_unpack_var(BCP_buffer& buf);
00060 
00061 #endif

Generated on Sun Nov 14 14:06:28 2010 for Coin-All by  doxygen 1.4.7