[Coin-osi-devel] OsiRowCut question

Francois Margot fmargot at andrew.cmu.edu
Fri Apr 14 07:42:42 EDT 2006


Lou:

Adding the following to OsiRowCut and CoinPackedVector works for me:

OsiRowCut::OsiRowCut(double cutlb, double cutub,
 		     int capacity, int size,
 		     int **colIndices, double **elements):
   OsiCut(),
   row_(capacity, size, colIndices, elements),
   lb_(cutlb),
   ub_(cutub)
{}

//-----------------------------------------------------------------------------

CoinPackedVector::CoinPackedVector(int capacity, int size,
 				   int **inds, double **elems):
    CoinPackedVectorBase(),
    indices_(*inds),
    elements_(*elems),
    nElements_(size),
    origIndices_(NULL),
    capacity_(capacity)
{
   *inds = NULL;
   *elems = NULL;
   origIndices_ = new int[capacity_];
   CoinIotaN(origIndices_, size, 0);
}

I am not sure what origIndices_ is supposed to be, so I am not sure that
I can write an assign method for CoinPackedVector. I am however 
reasonably confident that the constructor above is correct. Adding 
a check that capacity >= size might be safer.

Francois


On Thu, 13 Apr 2006, Lou Hafer wrote:

> Francois,
>
> 	This makes a fair bit of sense to me. Anyone more familiar with the
> class origins see a problem here?
>
> 	Do you really need a constructor?  From poking about in various parts of
> COIN, the de facto convention seems to be that setXXX copies the arguments,
> while assignXXX takes ownership.  CoinPackedVector::assignVector already exists.
> Shouldn't be too hard to create an OsiRowCut::assignRow method to complement
> OsiRowCut::setRow.
>
> 	Do you want to take a stab at some code?
>
> 							Lou
>
>
>



More information about the Osi mailing list