本文整理汇总了C++中Row::coeff方法的典型用法代码示例。如果您正苦于以下问题:C++ Row::coeff方法的具体用法?C++ Row::coeff怎么用?C++ Row::coeff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row::coeff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addCons
void LpSub::addCons(ArrayBuffer<Constraint*> &newCons)
{
// LpSub::addCons(): local variables
ArrayBuffer<Row*> newRows(newCons.size(),false); //!< the new constraints in row format
ArrayBuffer<int> delVar(sub_->nVar(),false); //!< buffer of deletable components of row format
double rhsDelta; //!< correction of right hand side
InfeasCon::INFEAS infeas; //!< infeasibility mode (TooLarge, TooSmall)
Row *nr;
constraint2row(newCons, newRows);
// eliminate variables in added constraints
/* Also the elimination of variables in an added constraint might
* cause a void left hand side (interpreted as 0) violated the right hand
* side of the constraint. These infeasible constraints are recognized,
* but the resolution is currently not implemented.
*/
const int nNewRows = newRows.size();
for (int c = 0; c < nNewRows; c++) {
//! eliminate variables in constraint \a c
delVar.clear();
rhsDelta = 0.0;
nr = newRows[c];
const int nrNnz = nr->nnz();
for(int i = 0; i < nrNnz; i++)
if(eliminated(nr->support(i))) {
delVar.push(i);
rhsDelta += nr->coeff(i)*elimVal(nr->support(i));
}
nr->delInd(delVar,rhsDelta);
nr->rename(orig2lp_);
// check if constraint \a c has become infeasible
if(nr->nnz() == 0) {
infeas = newCons[c]->voidLhsViolated(nr->rhs());
if (infeas != InfeasCon::Feasible) {
infeasCons_.push(new InfeasCon(master_, newCons[c], infeas));
Logger::ifout() << "LpSub::addCons(): infeasible constraint added.\nAll variables with nonzero coefficients are eliminated and constraint is violated.\nSorry, resolution not implemented yet.\n";
OGDF_THROW_PARAM(AlgorithmFailureException, ogdf::afcLpSub);
}
}
}
LP::addRows(newRows);
for (int i = 0; i < newRows.size(); i++)
delete newRows[i];
}