coin-Bcp
MCF2_var.hpp
Go to the documentation of this file.
1 #ifndef MCF2_var_hpp
2 #define MCF2_var_hpp
3 
4 #include "CoinPackedVector.hpp"
5 #include "BCP_buffer.hpp"
6 #include "BCP_var.hpp"
7 
8 /*---------------------------------------------------------------------------*/
9 
10 // Here are two kind of variables. The first is a "real" variable, i.e., it
11 // describes a column of the master problem, that is a flow for a
12 // commodity. The second is a "fake" variable. It simply holds information on
13 // the branching decision so that in the subproblems we can make the
14 // appropriate restrictions on the flow values.
15 
16 // For the real variables the upper bound is 1, but we set it to 2 so there
17 // will never be a variable out of basis at its upper bound. That would kill
18 // column generation. The convexity constraint will take care of keeping these
19 // variables under 1.
20 
21 class MCF2_var : public BCP_var_algo {
22 public:
23  int commodity;
25  double weight;
26 
27 public:
28  MCF2_var(int com, const CoinPackedVector& f, double w) :
30  commodity(com),
31  flow(f.getNumElements(), f.getIndices(), f.getElements(), false),
32  weight(w) {}
33  MCF2_var(BCP_buffer& buf);
34  ~MCF2_var() {}
35 
36  void pack(BCP_buffer& buf) const;
37 };
38 
39 /*---------------------------------------------------------------------------*/
40 
42 public:
43  int commodity;
44  int arc_index;
45  int lb_child0;
46  int ub_child0;
47  int lb_child1;
48  int ub_child1;
49 
50 public:
51  MCF2_branching_var(int comm, int ind, int lb0, int ub0, int lb1, int ub1) :
52  BCP_var_algo(BCP_BinaryVar, 0, 0, 1),
53  commodity(comm), arc_index(ind),
54  lb_child0(lb0), ub_child0(ub0), lb_child1(lb1), ub_child1(ub1) {}
57 
58  void pack(BCP_buffer& buf) const;
59 };
60 
61 void MCF2_pack_var(const BCP_var_algo* var, BCP_buffer& buf);
63 
64 #endif
Binary (0-1) variable.
Definition: BCP_enum.hpp:163
MCF2_var(int com, const CoinPackedVector &f, double w)
Definition: MCF2_var.hpp:28
double weight
Definition: MCF2_var.hpp:25
void pack(BCP_buffer &buf) const
BCP_var_algo * MCF2_unpack_var(BCP_buffer &buf)
~MCF2_var()
Definition: MCF2_var.hpp:34
MCF2_branching_var(int comm, int ind, int lb0, int ub0, int lb1, int ub1)
Definition: MCF2_var.hpp:51
Continuous variable.
Definition: BCP_enum.hpp:167
void pack(BCP_buffer &buf) const
This is the class from which the user should derive her own algorithmic variables.
Definition: BCP_var.hpp:277
Sparse Vector.
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
CoinPackedVector flow
Definition: MCF2_var.hpp:24
void MCF2_pack_var(const BCP_var_algo *var, BCP_buffer &buf)
int commodity
Definition: MCF2_var.hpp:23