/home/coin/SVN-release/Bcp-1.3.2/Bcp/examples/MCF-2/include/MCF2_var.hpp

Go to the documentation of this file.
00001 #ifndef MCF2_var_hpp
00002 #define MCF2_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 // For the real variables the upper bound is 1, but we set it to 2 so there
00017 // will never be a variable out of basis at its upper bound. That would kill
00018 // column generation. The convexity constraint will take care of keeping these
00019 // variables under 1.
00020 
00021 class MCF2_var : public BCP_var_algo {
00022 public:
00023     int commodity;
00024     CoinPackedVector flow;
00025     double weight;
00026 
00027 public:
00028     MCF2_var(int com, const CoinPackedVector& f, double w) :
00029         BCP_var_algo(BCP_ContinuousVar, w, 0, 2),
00030         commodity(com),
00031         flow(f.getNumElements(), f.getIndices(), f.getElements(), false),
00032         weight(w) {}
00033     MCF2_var(BCP_buffer& buf);
00034     ~MCF2_var() {}
00035 
00036     void pack(BCP_buffer& buf) const;
00037 };
00038 
00039 /*---------------------------------------------------------------------------*/
00040 
00041 class MCF2_branching_var : public BCP_var_algo {
00042 public:
00043     int commodity;
00044     int arc_index;
00045     int lb_child0;
00046     int ub_child0;
00047     int lb_child1;
00048     int ub_child1;
00049 
00050 public:
00051     MCF2_branching_var(int comm, int ind, int lb0, int ub0, int lb1, int ub1) :
00052         BCP_var_algo(BCP_BinaryVar, 0, 0, 1),
00053         commodity(comm), arc_index(ind),
00054         lb_child0(lb0), ub_child0(ub0), lb_child1(lb1), ub_child1(ub1) {}
00055     MCF2_branching_var(BCP_buffer& buf);
00056     ~MCF2_branching_var() {}
00057 
00058     void pack(BCP_buffer& buf) const;
00059 };
00060 
00061 void MCF2_pack_var(const BCP_var_algo* var, BCP_buffer& buf);
00062 BCP_var_algo* MCF2_unpack_var(BCP_buffer& buf);
00063 
00064 #endif

Generated on Sun Oct 16 03:01:37 2011 for coin-Bcp by  doxygen 1.4.7