- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/OS-2.3.5/ApplicationTemplates/branchCutPrice/Member/OS_var.cpp

Go to the documentation of this file.

    00001 /* $Id: OS_var.cpp 2698 2009-06-09 04:14:07Z kmartin $ */
    00002 #include "OS_var.hpp"
    00003
    00004
    00005
    00006
    00007 /*---------------------------------------------------------------------------*/
    00008
    00009
    00010 OS_var::OS_var(int idx, const CoinPackedVector& f, double w) :
    00011         BCP_var_algo(BCP_IntegerVar, w, 0, 1),
    00012         varIndex( idx), coinPackedVec(false), weight(w)
    00013 {
    00014         std::cout << "INSIDE VAR CONSTRUCTOR OS_var(int idx, const CoinPackedVector& f, double w)  " << std::endl;
    00015         new (&coinPackedVec) CoinPackedVector(f.getNumElements(),
    00016                         f.getIndices(), f.getElements(), false);
    00017
    00018 }
    00019 /*---------------------------------------------------------------------------*/
    00020
    00021 OS_var::OS_var( BCP_buffer& buf) :
    00022     // we don't know the onj coeff (weight) yet, so temporarily set it to 0
    00023     BCP_var_algo( BCP_IntegerVar, 0, 0, 1)
    00024 {
    00025
    00026         std::cout << "INSIDE VAR CONSTRUCTOR  OS_var(BCP_buffer& buf) " << std::endl;
    00027
    00028     buf.unpack( varIndex);
    00029     int nonz;
    00030     int* indexes;
    00031     double* values;
    00032     buf.unpack(indexes, nonz);
    00033     buf.unpack(values,  nonz);
    00034     coinPackedVec.assignVector(nonz, indexes, values, false );  //false -- don't test for duplicates
    00035     buf.unpack( weight);
    00036     set_obj( weight);
    00037 }
    00038
    00039 /*===========================================================================*/
    00040
    00041
    00042
    00043 void OS_var::pack(BCP_buffer& buf) const
    00044 {
    00045         std::cout << "PACKING  OS_var::pack(BCP_buffer& buf) " << std::endl;
    00046     buf.pack( varIndex);
    00047         int nonz = coinPackedVec.getNumElements();
    00048     buf.pack(coinPackedVec.getIndices(), nonz);
    00049     buf.pack(coinPackedVec.getElements(), nonz);
    00050     buf.pack( weight);
    00051 }
    00052
    00053