本文整理汇总了C++中CoinPackedVector::equivalent方法的典型用法代码示例。如果您正苦于以下问题:C++ CoinPackedVector::equivalent方法的具体用法?C++ CoinPackedVector::equivalent怎么用?C++ CoinPackedVector::equivalent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoinPackedVector
的用法示例。
在下文中一共展示了CoinPackedVector::equivalent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eq
//.........这里部分代码省略.........
assert( remainder.getIndices()[0] == 2);
assert( remainder.getElements()[0] == 68.0);
// test liftCoverCut
CoinPackedVector cut;
double * rowupper = ekk_rowupper(model);
double cutRhs = cover.getNumElements() - 1.0;
kccg.liftCoverCut(b, krow.getNumElements(),
cover, remainder,
cut);
assert ( cut.getNumElements() == 3 );
assert ( cut.getIndices()[0] == 0 );
assert ( cut.getIndices()[1] == 1 );
assert ( cut.getIndices()[2] == 2 );
assert( cut.getElements()[0] == 1 );
assert( cut.getElements()[1] == 1 );
assert( eq(cut.getElements()[2], 0.087719) );
// test liftAndUncomplementAndAdd
OsiCuts cuts;
kccg.liftAndUncomplementAndAdd(*siP.getRowUpper()[0],krow,b,complement,0,
cover,remainder,cuts);
int sizerowcuts = cuts.sizeRowCuts();
assert ( sizerowcuts== 1 );
OsiRowCut testRowCut = cuts.rowCut(0);
CoinPackedVector testRowPV = testRowCut.row();
OsiRowCut sampleRowCut;
const int sampleSize = 3;
int sampleCols[sampleSize]={0,1,2};
double sampleElems[sampleSize]={1.0,-1.0,-0.087719};
sampleRowCut.setRow(sampleSize,sampleCols,sampleElems);
sampleRowCut.setLb(-DBL_MAX);
sampleRowCut.setUb(-0.087719);
bool equiv = testRowPV.equivalent(sampleRowCut.row(),CoinRelFltEq(1.0e-05) );
assert ( equiv );
#endif
// test find PseudoJohnAndEllisCover
cover.setVector(0,NULL, NULL);
remainder.setVector(0,NULL,NULL);
rind = ( siP->getRowSense()[0] == 'N' ) ? 1 : 0;
int findPJE = kccg.findPseudoJohnAndEllisCover( rind, krow,
b, xstar, cover, remainder );
assert( findPJE == 1 );
assert ( cover.getIndices()[0] == 0 );
assert ( cover.getIndices()[1] == 2 );
assert ( cover.getElements()[0] == 161 );
assert ( cover.getElements()[1] == 68 );
assert ( remainder.getIndices()[0] == 1 );
assert ( remainder.getElements()[0] == 120 );
OsiCuts cuts;
kccg.liftAndUncomplementAndAdd((*siP).getRowUpper()[rind],krow,b, complement, rind,
cover,remainder,cuts);
assert (cuts.sizeRowCuts() == 1 );
OsiRowCut testRowCut = cuts.rowCut(0);
CoinPackedVector testRowPV = testRowCut.row();
const int sampleSize = 3;
int sampleCols[sampleSize]={0,1,2};
double sampleElems[sampleSize]={1.0, -1.0, -1.0};
OsiRowCut sampleRowCut;
sampleRowCut.setRow(sampleSize,sampleCols,sampleElems);
sampleRowCut.setLb(-COIN_DBL_MAX);