/home/coin/SVN-release/Bcp-1.2.2/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 // 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 MCF1_var : public BCP_var_algo {
00022 public:
00023     int commodity;
00024     CoinPackedVector flow;
00025     double weight;
00026 
00027 public:
00028     MCF1_var(int com, const CoinPackedVector& f, double w) :
00029         BCP_var_algo(BCP_ContinuousVar, w, 0, 2),
00030         commodity(com), flow(f), weight(w) {}
00031     MCF1_var(BCP_buffer& buf);
00032     ~MCF1_var() {}
00033 
00034     void pack(BCP_buffer& buf) const;
00035 };
00036 
00037 /*---------------------------------------------------------------------------*/
00038 
00039 class MCF1_branching_var : public BCP_var_algo {
00040 public:
00041     int commodity;
00042     int arc_index;
00043     int lb_child0;
00044     int ub_child0;
00045     int lb_child1;
00046     int ub_child1;
00047 
00048 public:
00049     MCF1_branching_var(int comm, int ind, int lb0, int ub0, int lb1, int ub1) :
00050         BCP_var_algo(BCP_BinaryVar, 0, 0, 1),
00051         commodity(comm), arc_index(ind),
00052         lb_child0(lb0), ub_child0(ub0), lb_child1(lb1), ub_child1(ub1) {}
00053     MCF1_branching_var(BCP_buffer& buf);
00054     ~MCF1_branching_var() {}
00055 
00056     void pack(BCP_buffer& buf) const;
00057 };
00058 
00059 void MCF1_pack_var(const BCP_var_algo* var, BCP_buffer& buf);
00060 BCP_var_algo* MCF1_unpack_var(BCP_buffer& buf);
00061 
00062 #endif

Generated on Tue Jun 16 03:03:00 2009 for coin-Bcp by  doxygen 1.4.7