/home/coin/SVN-release/OS-2.4.0/ApplicationTemplates/branchCutPrice/Member/OS_cut.cpp

Go to the documentation of this file.
00001 /* $Id: OS_cut.cpp 2698 2009-06-09 04:14:07Z kmartin $ */
00002 // Copyright (C) 2003, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 
00005 #include "BCP_math.hpp"
00006 #include "BCP_buffer.hpp"
00007 #include "OS_cut.hpp"
00008    
00009 /****************************************************************************/
00010 void
00011 OS_cut::pack(BCP_buffer& buf) const
00012 {
00013   buf.pack(OsiRowCut::lb());
00014   buf.pack(OsiRowCut::ub());
00015   const CoinPackedVector& v = OsiRowCut::row();
00016   const int numElem = v.getNumElements();
00017   buf.pack(v.getIndices(), numElem);
00018   buf.pack(v.getElements(), numElem);
00019 }
00020 
00021 /****************************************************************************/
00022 OS_cut::OS_cut(BCP_buffer& buf) :
00023    BCP_cut_algo(-BCP_DBL_MAX, BCP_DBL_MAX), OsiRowCut()
00024 {
00025         double lb, ub;
00026         buf.unpack( lb);
00027         buf.unpack( ub);
00028         OsiRowCut::setLb( lb);
00029         OsiRowCut::setUb( ub);
00030 
00031         int numElem;
00032         int* indices;
00033         double* elements;
00034         buf.unpack(indices, numElem, true);
00035         buf.unpack(elements, numElem, true);
00036         OsiRowCut::setRow(numElem, indices, elements);
00037 
00038         if(numElem > 0) {
00039                 delete[] indices;
00040                 delete[] elements;
00041         }
00042 }
00043 
00044 /****************************************************************************/
00045 OS_cut::OS_cut(const OsiRowCut& cut) :
00046    BCP_cut_algo(cut.lb(), cut.ub()), OsiRowCut(cut)
00047 {}
00048 
00049 /****************************************************************************/
00050 BCP_MemPool OS_cut::memPool(sizeof(OS_cut));

Generated on Thu Sep 22 03:05:50 2011 by  doxygen 1.4.7