本文整理汇总了C++中OsiClpSolverInterface::getRightHandSide方法的典型用法代码示例。如果您正苦于以下问题:C++ OsiClpSolverInterface::getRightHandSide方法的具体用法?C++ OsiClpSolverInterface::getRightHandSide怎么用?C++ OsiClpSolverInterface::getRightHandSide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsiClpSolverInterface
的用法示例。
在下文中一共展示了OsiClpSolverInterface::getRightHandSide方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setWhen
//.........这里部分代码省略.........
// invalidates the cached data in the OsiClpSolverInterface
// object, which means our precious rowsens is lost. So let's
// not use the line below...
/******* clpSolver->getModelPtr()->primal(1); */
printf("---------------------------------------------------------------- %d\n", i);
}
// Iteratively do this process until...
// either you reach the max number of corner points (aka 10K)
// or all the rows have been used as an objective.
// Look at solutions
int numberSolutions = solutions.numberSolutions;
//const char * integerInfo = simplex->integerInformation();
//const double * columnLower = simplex->columnLower();
//const double * columnUpper = simplex->columnUpper();
printf("there are %d solutions\n", numberSolutions);
// Up to here we have all the corner points
// Now we need to do the random walks and roundings
double ** cornerPoints = new double * [numberSolutions];
for (int j = 0; j < numberSolutions; j++)
cornerPoints[j] = solutions.solution[j];
bool feasibility = 1;
// rlh: use some COIN max instead of 1e30 (?)
double bestObj = 1e30;
std::vector< std::vector <double> > feasibles;
int numFeasibles = 0;
// Check the feasibility of the corner points
int numCornerPoints = numberSolutions;
const double * rhs = clpSolver->getRightHandSide();
// rlh: row sense hasn't changed. why a fresh copy?
// Delete next line.
rowSense = clpSolver->getRowSense();
for (int i = 0; i < numCornerPoints; i++) {
//get the objective value for this this point
double objValue = 0;
for (int k = 0; k < numCols; k++)
objValue += cornerPoints[i][k] * originalObjCoeff[k];
if (objValue < bestObj) {
// check integer feasibility
feasibility = 1;
for (int j = 0; j < numCols; j++) {
if (varClassInt[j]) {
double closest = floor(cornerPoints[i][j] + 0.5);
if (fabs(cornerPoints[i][j] - closest) > primalTolerance) {
feasibility = 0;
break;
}
}
}
// check all constraints satisfied
if (feasibility) {
for (int irow = 0; irow < numRows; irow++) {
double lhs = 0;
for (int j = 0; j < numCols; j++) {
lhs += matrix[irow][j] * cornerPoints[i][j];
}
if (rowSense[irow] == 'L' && lhs > rhs[irow] + primalTolerance) {
feasibility = 0;
break;