本文整理汇总了C++中OsiSolverInterface::unmarkHotStart方法的典型用法代码示例。如果您正苦于以下问题:C++ OsiSolverInterface::unmarkHotStart方法的具体用法?C++ OsiSolverInterface::unmarkHotStart怎么用?C++ OsiSolverInterface::unmarkHotStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsiSolverInterface
的用法示例。
在下文中一共展示了OsiSolverInterface::unmarkHotStart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
else if (!downKeep) {
// Down branch can be fathomed.
lbInd[numLowerTightens] = colInd;
newLB[numLowerTightens++] = ceil(lpX);
}
else if (!upKeep) {
// Up branch can be fathomed.
ubInd[numUpperTightens] = colInd;
newUB[numUpperTightens++] = floor(lpX);
}
}
//--------------------------------------------------
// Set new bounds in lp solver for resolving
//--------------------------------------------------
if (bStatus != -2) {
if (numUpperTightens > 0) {
bStatus = -1;
for (i = 0; i < numUpperTightens; ++i) {
solver->setColUpper(ubInd[i], newUB[i]);
}
}
if (numLowerTightens > 0) {
bStatus = -1;
for (i = 0; i < numLowerTightens; ++i) {
solver->setColLower(lbInd[i], newLB[i]);
}
}
}
//--------------------------------------------------
// Unmark hotstart and recover LP solver.
//--------------------------------------------------
solver->unmarkHotStart();
solver->setColSolution(saveSolution);
solver->setIntParam(OsiMaxNumIterationHotStart, saveLimit);
solver->setWarmStart(ws);
delete ws;
}
if (bStatus < 0) {
goto TERM_CREATE;
}
else {
// Create a set of candidate branching objects.
numBranchObjects_ = numInfs;
branchObjects_ = new BcpsBranchObject* [numInfs];
// NOTE: it set model->savedLpSolution.
sumDeg = 0.0;
for (i = 0; i < numInfs; ++i) {
if (infObjects[i]->pseudocost().getUpCost() <
infObjects[i]->pseudocost().getDownCost()) {
preferDir = 1;
}
else {
preferDir = -1;
}
branchObjects_[i] = infObjects[i]->createBranchObject(model,
preferDir);
score = infObjects[i]->pseudocost().getScore();
branchObjects_[i]->setUpScore(score);
sumDeg += score;
#ifdef BLIS_DEBUG_MORE
std::cout << "col[" << infObjects[i]->columnIndex() << "]: score="
<< score << ", dir=" << branchObjects_[i]->getDirection()
<< ", up=" << infObjects[i]->pseudocost().getUpCost()
<< ", down=" << infObjects[i]->pseudocost().getDownCost()
<< std::endl;
#endif
}
model->setSolEstimate(objValue + sumDeg);
}
TERM_CREATE:
//------------------------------------------------------
// Cleanup.
//------------------------------------------------------
delete [] lbInd;
delete [] ubInd;
delete [] newLB;
delete [] newUB;
delete [] saveSolution;
delete [] saveLower;
delete [] saveUpper;
return bStatus;
}
示例2: if
//.........这里部分代码省略.........
// Update pseudocost.
if(downGood) {
firstObjects[i]->pseudocost().update(-1, downDeg, lpX);
}
if(downGood) {
firstObjects[i]->pseudocost().update(1, upDeg, lpX);
}
}
//--------------------------------------------------
// Set new bounds in lp solver for resolving
//--------------------------------------------------
if (bStatus != -2) {
if (numUpperTightens > 0) {
bStatus = -1;
for (i = 0; i < numUpperTightens; ++i) {
solver->setColUpper(ubInd[i], newUB[i]);
}
}
if (numLowerTightens > 0) {
bStatus = -1;
for (i = 0; i < numLowerTightens; ++i) {
solver->setColLower(lbInd[i], newLB[i]);
}
}
}
//--------------------------------------------------
// Unmark hotstart and recover LP solver.
//--------------------------------------------------
solver->unmarkHotStart();
solver->setColSolution(saveSolution);
solver->setIntParam(OsiMaxNumIterationHotStart, saveLimit);
solver->setWarmStart(ws);
delete ws;
}
//std::cout << "REL: bStatus = " << bStatus << std::endl;
if (bStatus < 0) {
// Infeasible or monotone.
goto TERM_CREATE;
}
else {
// All object's pseudocost have been initialized.
// Sort them, and do strong branch for the unreliable one
// NOTE: it set model->savedLpSolution.
// model->feasibleSolution(numIntegerInfs, numObjectInfs);
sumDeg = 0.0;
for (i = 0; i < numInfs; ++i) {
score = infObjects[i]->pseudocost().getScore();
sumDeg += score;
std::pair<const double, BlisObjectInt*> sa(score, infObjects[i]);
sortedObjects.insert(sa);
#ifdef BLIS_DEBUG_MORE
std::cout << "col[" << infObjects[i]->columnIndex() << "]="
<< score << ", "<< std::endl;
#endif
}