8 #include "CoinPackedVector.hpp"
23 const std::string & mpsDir);
34 const int * colIndices,
35 const double * lbElements );
38 inline void setLbs(
const CoinPackedVector &
lbs );
43 const int * colIndices,
44 const double * ubElements );
47 inline void setUbs(
const CoinPackedVector &
ubs );
54 inline const CoinPackedVector &
lbs()
const;
57 inline const CoinPackedVector &
ubs()
const;
63 using OsiCut::operator== ;
71 using OsiCut::operator!= ;
113 virtual double violated(
const double * solution)
const;
138 virtual void print()
const;
146 CoinPackedVector
lbs_;
161 const int * colIndices,
162 const double * lbElements )
164 lbs_.setVector(size,colIndices,lbElements);
169 const int * colIndices,
170 const double * ubElements )
172 ubs_.setVector(size,colIndices,ubElements);
205 if ( this->OsiCut::operator!=(rhs) )
218 return !( (*this)==rhs );
226 const CoinPackedVector & lb =
lbs();
227 const CoinPackedVector & ub =
ubs();
230 lb.duplicateIndex(
"consistent",
"OsiColCut");
231 ub.duplicateIndex(
"consistent",
"OsiColCut");
232 if ( lb.getMinIndex() < 0 )
return false;
233 if ( ub.getMinIndex() < 0 )
return false;
239 const CoinPackedVector & lb =
lbs();
240 const CoinPackedVector & ub =
ubs();
243 if ( lb.getMaxIndex() >= im.
getNumCols() )
return false;
244 if ( ub.getMaxIndex() >= im.
getNumCols() )
return false;
254 const CoinPackedVector & cutLbs =
lbs();
255 const CoinPackedVector & cutUbs =
ubs();
258 for ( i=0; i<cutLbs.size(); i++ ) {
259 int colIndx = cutLbs.indices()[i];
261 if ( cutLbs.elements()[i] > oldColLb[colIndx] )
262 newLb = cutLbs.elements()[i];
264 newLb = oldColLb[colIndx];
266 double newUb = oldColUb[colIndx];
267 if ( cutUbs.indexExists(colIndx) )
268 if ( cutUbs[colIndx] < newUb ) newUb = cutUbs[colIndx];
273 for ( i=0; i<cutUbs.size(); i++ ) {
274 int colIndx = cutUbs.indices()[i];
275 double newUb = cutUbs.elements()[i] < oldColUb[colIndx] ? cutUbs.elements()[i] : oldColUb[colIndx];
276 double newLb = oldColLb[colIndx];
277 if ( cutLbs.indexExists(colIndx) )
278 if ( cutLbs[colIndx] > newLb ) newLb = cutLbs[colIndx];
292 const CoinPackedVector & cutLbs =
lbs();
293 const CoinPackedVector & cutUbs =
ubs();
296 for ( i=0; i<cutLbs.getNumElements(); i++ ) {
297 int colIndx = cutLbs.getIndices()[i];
298 double newLb= cutLbs.getElements()[i] > oldColLb[colIndx] ?
299 cutLbs.getElements()[i] : oldColLb[colIndx];
301 double newUb = oldColUb[colIndx];
302 if ( cutUbs.isExistingIndex(colIndx) )
303 if ( cutUbs[colIndx] < newUb ) newUb = cutUbs[colIndx];
308 for ( i=0; i<cutUbs.getNumElements(); i++ ) {
309 int colIndx = cutUbs.getIndices()[i];
310 double newUb = cutUbs.getElements()[i] < oldColUb[colIndx] ?
311 cutUbs.getElements()[i] : oldColUb[colIndx];
312 double newLb = oldColLb[colIndx];
313 if ( cutLbs.isExistingIndex(colIndx) )
314 if ( cutLbs[colIndx] > newLb ) newLb = cutLbs[colIndx];
330 const std::string & mpsDir);