BCP_matrix_pack.cpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 
4 #include <numeric>
5 
6 #include "BCP_matrix.hpp"
7 #include "BCP_buffer.hpp"
8 
9 void
11  const int major = getMajorDim();
12  const int minor = getMinorDim();
13  buf.pack(colOrdered_)
14  .pack(extraGap_)
15  .pack(extraMajor_)
16  .pack(major)
17  .pack(minor)
18  .pack(size_)
19  .pack(maxMajorDim_)
20  .pack(maxSize_);
21 
22  const int * length = getVectorLengths();
23  const int * start = getVectorStarts();
24  const int * ind = getIndices();
25  const double * elem = getElements();
26  if (major > 0) {
27  buf.pack(length, major);
28  buf.pack(start, major+1);
29  for (int i = 0; i < major; ++i)
30  buf.pack(ind + start[i], length[i]);
31  for (int i = 0; i < major; ++i)
32  buf.pack(elem + start[i], length[i]);
33  }
34 
37 }
38 
39 void
41  CoinPackedMatrix::gutsOfDestructor();
42 
43  buf.unpack(colOrdered_)
44  .unpack(extraGap_)
45  .unpack(extraMajor_)
46  .unpack(majorDim_)
47  .unpack(minorDim_)
48  .unpack(size_)
49  .unpack(maxMajorDim_)
50  .unpack(maxSize_);
51 
52  length_ = new int[maxMajorDim_];
53  start_ = new int[maxMajorDim_+1];
54  index_ = new int[maxSize_];
55  element_ = new double[maxSize_];
56  if (majorDim_) {
57  buf.unpack(length_, majorDim_, false);
58  int md1 = majorDim_+1;
59  buf.unpack(start_, md1, false);
60 
61  for (int i = 0; i < majorDim_; ++i) {
62  int * itmp = index_ + start_[i];
63  buf.unpack(itmp, length_[i], false);
64  }
65  for (int i = 0; i < majorDim_; ++i) {
66  double * dtmp = element_ + start_[i];
67  buf.unpack(dtmp, length_[i], false);
68  }
69  }
70 
73 }
BCP_vec< double > _ColUpperBound
The upper bounds on the variables.
Definition: BCP_matrix.hpp:276
BCP_vec< double > _RowUpperBound
The upper bounds on the cuts.
Definition: BCP_matrix.hpp:280
BCP_buffer & pack(const T &value)
Pack a single object of type T.
Definition: BCP_buffer.hpp:177
BCP_buffer & unpack(T &value)
Unpack a single object of type T.
Definition: BCP_buffer.hpp:186
void unpack(BCP_buffer &buf)
Unpack the LP relaxation from the buffer.
BCP_vec< double > _ColLowerBound
The lower bounds on the variables.
Definition: BCP_matrix.hpp:274
void pack(BCP_buffer &buf) const
Pack the LP relaxation into the buffer.
BCP_vec< double > _Objective
The objective coefficients of the variables.
Definition: BCP_matrix.hpp:272
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
BCP_vec< double > _RowLowerBound
The lower bounds on the cuts.
Definition: BCP_matrix.hpp:278