10 #include "CoinPackedVector.hpp"
25 const std::string & mpsDir);
36 const int * colIndices,
37 const double * lbElements );
40 inline void setLbs(
const CoinPackedVector &
lbs );
45 const int * colIndices,
46 const double * ubElements );
49 inline void setUbs(
const CoinPackedVector &
ubs );
56 inline const CoinPackedVector &
lbs()
const;
59 inline const CoinPackedVector &
ubs()
const;
65 using OsiCut::operator== ;
73 using OsiCut::operator!= ;
115 virtual double violated(
const double * solution)
const;
140 virtual void print()
const;
148 CoinPackedVector
lbs_;
163 const int * colIndices,
164 const double * lbElements )
166 lbs_.setVector(size,colIndices,lbElements);
171 const int * colIndices,
172 const double * ubElements )
174 ubs_.setVector(size,colIndices,ubElements);
207 if ( this->OsiCut::operator!=(rhs) )
220 return !( (*this)==rhs );
228 const CoinPackedVector & lb =
lbs();
229 const CoinPackedVector & ub =
ubs();
232 lb.duplicateIndex(
"consistent",
"OsiColCut");
233 ub.duplicateIndex(
"consistent",
"OsiColCut");
234 if ( lb.getMinIndex() < 0 )
return false;
235 if ( ub.getMinIndex() < 0 )
return false;
241 const CoinPackedVector & lb =
lbs();
242 const CoinPackedVector & ub =
ubs();
245 if ( lb.getMaxIndex() >= im.
getNumCols() )
return false;
246 if ( ub.getMaxIndex() >= im.
getNumCols() )
return false;
256 const CoinPackedVector & cutLbs =
lbs();
257 const CoinPackedVector & cutUbs =
ubs();
260 for ( i=0; i<cutLbs.size(); i++ ) {
261 int colIndx = cutLbs.indices()[i];
263 if ( cutLbs.elements()[i] > oldColLb[colIndx] )
264 newLb = cutLbs.elements()[i];
266 newLb = oldColLb[colIndx];
268 double newUb = oldColUb[colIndx];
269 if ( cutUbs.indexExists(colIndx) )
270 if ( cutUbs[colIndx] < newUb ) newUb = cutUbs[colIndx];
275 for ( i=0; i<cutUbs.size(); i++ ) {
276 int colIndx = cutUbs.indices()[i];
277 double newUb = cutUbs.elements()[i] < oldColUb[colIndx] ? cutUbs.elements()[i] : oldColUb[colIndx];
278 double newLb = oldColLb[colIndx];
279 if ( cutLbs.indexExists(colIndx) )
280 if ( cutLbs[colIndx] > newLb ) newLb = cutLbs[colIndx];
294 const CoinPackedVector & cutLbs =
lbs();
295 const CoinPackedVector & cutUbs =
ubs();
298 for ( i=0; i<cutLbs.getNumElements(); i++ ) {
299 int colIndx = cutLbs.getIndices()[i];
300 double newLb= cutLbs.getElements()[i] > oldColLb[colIndx] ?
301 cutLbs.getElements()[i] : oldColLb[colIndx];
303 double newUb = oldColUb[colIndx];
304 if ( cutUbs.isExistingIndex(colIndx) )
305 if ( cutUbs[colIndx] < newUb ) newUb = cutUbs[colIndx];
310 for ( i=0; i<cutUbs.getNumElements(); i++ ) {
311 int colIndx = cutUbs.getIndices()[i];
312 double newUb = cutUbs.getElements()[i] < oldColUb[colIndx] ?
313 cutUbs.getElements()[i] : oldColUb[colIndx];
314 double newLb = oldColLb[colIndx];
315 if ( cutLbs.isExistingIndex(colIndx) )
316 if ( cutLbs[colIndx] > newLb ) newLb = cutLbs[colIndx];