本文整理汇总了C++中OsiClpSolverInterface::getPointerToWarmStart方法的典型用法代码示例。如果您正苦于以下问题:C++ OsiClpSolverInterface::getPointerToWarmStart方法的具体用法?C++ OsiClpSolverInterface::getPointerToWarmStart怎么用?C++ OsiClpSolverInterface::getPointerToWarmStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsiClpSolverInterface
的用法示例。
在下文中一共展示了OsiClpSolverInterface::getPointerToWarmStart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// Apply subproblem
void
CbcSubProblem::apply(OsiSolverInterface * solver, int what) const
{
int i;
if ((what&1) != 0) {
#ifndef NDEBUG
int nSame = 0;
#endif
for (i = 0; i < numberChangedBounds_; i++) {
int variable = variables_[i];
int k = variable & 0x3fffffff;
if ((variable&0x80000000) == 0) {
// lower bound changing
//#define CBC_PRINT2
#ifdef CBC_PRINT2
if (solver->getColLower()[k] != newBounds_[i])
printf("lower change for column %d - from %g to %g\n", k, solver->getColLower()[k], newBounds_[i]);
#endif
#ifndef NDEBUG
if ((variable&0x40000000) == 0 && true) {
double oldValue = solver->getColLower()[k];
assert (newBounds_[i] > oldValue - 1.0e-8);
if (newBounds_[i] < oldValue + 1.0e-8) {
#ifdef CBC_PRINT2
printf("bad null lower change for column %d - bound %g\n", k, oldValue);
#endif
if (newBounds_[i] == oldValue)
nSame++;
}
}
#endif
solver->setColLower(k, newBounds_[i]);
} else {
// upper bound changing
#ifdef CBC_PRINT2
if (solver->getColUpper()[k] != newBounds_[i])
printf("upper change for column %d - from %g to %g\n", k, solver->getColUpper()[k], newBounds_[i]);
#endif
#ifndef NDEBUG
if ((variable&0x40000000) == 0 && true) {
double oldValue = solver->getColUpper()[k];
assert (newBounds_[i] < oldValue + 1.0e-8);
if (newBounds_[i] > oldValue - 1.0e-8) {
#ifdef CBC_PRINT2
printf("bad null upper change for column %d - bound %g\n", k, oldValue);
#endif
if (newBounds_[i] == oldValue)
nSame++;
}
}
#endif
solver->setColUpper(k, newBounds_[i]);
}
}
#ifndef NDEBUG
#ifdef CBC_PRINT2
if (nSame && (nSame < numberChangedBounds_ || (what&3) != 3))
printf("%d changes out of %d redundant %d\n",
nSame, numberChangedBounds_, what);
else if (numberChangedBounds_ && what == 7 && !nSame)
printf("%d good changes %d\n",
numberChangedBounds_, what);
#endif
#endif
}
#ifdef JJF_ZERO
if ((what&2) != 0) {
OsiClpSolverInterface * clpSolver
= dynamic_cast<OsiClpSolverInterface *> (solver);
assert (clpSolver);
//assert (clpSolver->getNumRows()==numberRows_);
//clpSolver->setBasis(*status_);
// Current basis
CoinWarmStartBasis * basis = clpSolver->getPointerToWarmStart();
printf("BBBB\n");
basis->print();
assert (basis->fullBasis());
basis->applyDiff(status_);
printf("diff applied %x\n", status_);
printf("CCCC\n");
basis->print();
assert (basis->fullBasis());
#ifndef NDEBUG
if (!basis->fullBasis())
printf("Debug this basis!!\n");
#endif
clpSolver->setBasis(*basis);
}
#endif
if ((what&8) != 0) {
OsiClpSolverInterface * clpSolver
= dynamic_cast<OsiClpSolverInterface *> (solver);
assert (clpSolver);
clpSolver->setBasis(*status_);
delete status_;
status_ = NULL;
}
}