coin-Bcp
MCF1_var.hpp
Go to the documentation of this file.
1 #ifndef MCF1_var_hpp
2 #define MCF1_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 MCF1_var : public BCP_var_algo {
22 public:
23  int commodity;
25  double weight;
26 
27 public:
28  MCF1_var(int com, const CoinPackedVector& f, double w) :
30  commodity(com), flow(f), weight(w) {}
31  MCF1_var(BCP_buffer& buf);
32  ~MCF1_var() {}
33 
34  void pack(BCP_buffer& buf) const;
35 };
36 
37 /*---------------------------------------------------------------------------*/
38 
40 public:
41  int commodity;
42  int arc_index;
43  int lb_child0;
44  int ub_child0;
45  int lb_child1;
46  int ub_child1;
47 
48 public:
49  MCF1_branching_var(int comm, int ind, int lb0, int ub0, int lb1, int ub1) :
50  BCP_var_algo(BCP_BinaryVar, 0, 0, 1),
51  commodity(comm), arc_index(ind),
52  lb_child0(lb0), ub_child0(ub0), lb_child1(lb1), ub_child1(ub1) {}
55 
56  void pack(BCP_buffer& buf) const;
57 };
58 
59 void MCF1_pack_var(const BCP_var_algo* var, BCP_buffer& buf);
61 
62 #endif
Binary (0-1) variable.
Definition: BCP_enum.hpp:163
MCF1_var(int com, const CoinPackedVector &f, double w)
Definition: MCF1_var.hpp:28
BCP_var_algo * MCF1_unpack_var(BCP_buffer &buf)
void pack(BCP_buffer &buf) const
int commodity
Definition: MCF1_var.hpp:23
CoinPackedVector flow
Definition: MCF1_var.hpp:24
void MCF1_pack_var(const BCP_var_algo *var, BCP_buffer &buf)
MCF1_branching_var(int comm, int ind, int lb0, int ub0, int lb1, int ub1)
Definition: MCF1_var.hpp:49
void pack(BCP_buffer &buf) const
Continuous variable.
Definition: BCP_enum.hpp:167
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
~MCF1_var()
Definition: MCF1_var.hpp:32
double weight
Definition: MCF1_var.hpp:25