00001
00002
00003
00004 #include "BCP_math.hpp"
00005 #include "BCP_buffer.hpp"
00006 #include "BB_cut.hpp"
00007
00008
00009 void
00010 BB_indexed_cut::pack(BCP_buffer& buf) const
00011 {
00012 buf.pack(index_).pack(lb()).pack(ub());
00013 }
00014
00015
00016 BB_indexed_cut::BB_indexed_cut(BCP_buffer& buf) :
00017 BCP_cut_algo(-1e40, 1e40)
00018 {
00019 double lbound, ubound;
00020 buf.unpack(index_).unpack(lbound).unpack(ubound);
00021 change_bounds(lbound, ubound);
00022 }
00023
00024
00025 BB_indexed_cut::BB_indexed_cut(int index, double lbound, double ubound) :
00026 BCP_cut_algo(lbound, ubound), index_(index) {}
00027
00028
00029 BCP_MemPool BB_indexed_cut::memPool(sizeof(BB_indexed_cut));
00030
00031
00032 void
00033 BB_cut::pack(BCP_buffer& buf) const
00034 {
00035 buf.pack(OsiRowCut::lb())
00036 .pack(OsiRowCut::ub());
00037 const CoinPackedVector& v = OsiRowCut::row();
00038 const int numElem = v.getNumElements();
00039 buf.pack(v.getIndices(), numElem)
00040 .pack(v.getElements(), numElem);
00041 }
00042
00043
00044 BB_cut::BB_cut(BCP_buffer& buf) :
00045 BCP_cut_algo(-BCP_DBL_MAX, BCP_DBL_MAX), OsiRowCut()
00046 {
00047 double lb, ub;
00048 buf.unpack(lb)
00049 .unpack(ub);
00050 OsiRowCut::setLb(lb);
00051 OsiRowCut::setUb(ub);
00052
00053 int numElem;
00054 int* indices = NULL;
00055 double* elements = NULL;
00056 buf.unpack(indices, numElem, true)
00057 .unpack(elements, numElem, true);
00058 OsiRowCut::setRow(numElem, indices, elements);
00059
00060 if(numElem > 0) {
00061 delete[] indices;
00062 delete[] elements;
00063 }
00064 }
00065
00066
00067 BB_cut::BB_cut(const OsiRowCut& cut) :
00068 BCP_cut_algo(cut.lb(), cut.ub()), OsiRowCut(cut)
00069 {}
00070
00071
00072 BCP_MemPool BB_cut::memPool(sizeof(BB_cut));