本文整理汇总了C++中OsiSolverInterface::markHotStart方法的典型用法代码示例。如果您正苦于以下问题:C++ OsiSolverInterface::markHotStart方法的具体用法?C++ OsiSolverInterface::markHotStart怎么用?C++ OsiSolverInterface::markHotStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsiSolverInterface
的用法示例。
在下文中一共展示了OsiSolverInterface::markHotStart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
objValue = solver->getObjSense() * solver->getObjValue();
}
}
else {
delete ws;
break;
}
}
} // EOF 2 pass
//--------------------------------------------------
// If we have a set of first time object,
// branch up and down to initialize pseudo-cost.
//--------------------------------------------------
numFirsts = static_cast<int> (firstObjects.size());
//std::cout << "PSEUDO: numFirsts = " << numFirsts << std::endl;
if (numFirsts > 0) {
//std::cout << "PSEUDO: numFirsts = " << numFirsts << std::endl;
//--------------------------------------------------
// Backup solver status and mark hot start.
//--------------------------------------------------
saveLower = new double[numCols];
saveUpper = new double[numCols];
memcpy(saveLower, lower, numCols * sizeof(double));
memcpy(saveUpper, upper, numCols * sizeof(double));
CoinWarmStart * ws = solver->getWarmStart();
solver->getIntParam(OsiMaxNumIterationHotStart, saveLimit);
aveIterations = ALPS_MIN(50, aveIterations);
solver->setIntParam(OsiMaxNumIterationHotStart, aveIterations);
solver->markHotStart();
lbInd = new int [numFirsts];
ubInd = new int [numFirsts];
newLB = new double [numFirsts];
newUB = new double [numFirsts];
for (i = 0; i < numFirsts && bStatus != -2; ++i) {
colInd = firstObjects[i]->columnIndex();
lpX = saveSolution[colInd];
BlisStrongBranch(model, objValue, colInd, lpX,
saveLower, saveUpper,
downKeep, downGood, downDeg,
upKeep, upGood, upDeg);
if(!downKeep && !upKeep) {
// Both branch can be fathomed
bStatus = -2;
}
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);
}
示例2: if
//.........这里部分代码省略.........
if (!solver->isProvenOptimal()) {
// Become infeasible, can do nothing.
bStatus = -2;
goto TERM_CREATE;
}
else {
// Save new lp solution.
memcpy(saveSolution, solver->getColSolution(),
numCols * sizeof(double));
objValue = solver->getObjSense() * solver->getObjValue();
}
}
else {
delete ws;
break;
}
}
} // EOF 2 pass
//--------------------------------------------------
// If we have a set of first time object,
// branch up and down to initialize pseudo-cost.
//--------------------------------------------------
numFirsts = static_cast<int> (firstObjects.size());
if (numFirsts > 0) {
CoinWarmStart * ws = solver->getWarmStart();
solver->getIntParam(OsiMaxNumIterationHotStart, saveLimit);
int maxIter = ALPS_MAX(model->getAveIterations(), 50);
solver->setIntParam(OsiMaxNumIterationHotStart, maxIter);
solver->markHotStart();
lbInd = new int [numFirsts];
ubInd = new int [numFirsts];
newLB = new double [numFirsts];
newUB = new double [numFirsts];
for (i = 0; i < numFirsts && bStatus != -2; ++i) {
colInd = firstObjects[i]->columnIndex();
lpX = saveSolution[colInd];
BlisStrongBranch(model, objValue, colInd, lpX,
saveLower, saveUpper,
downKeep, downGood, downDeg,
upKeep, upGood, upDeg);
if(!downKeep && !upKeep) {
// Both branch can be fathomed
bStatus = -2;
}
else if (!downKeep) {
// Down branch can be fathomed.
lbInd[numLowerTightens] = colInd;
newLB[numLowerTightens++] = ceil(lpX);
//break;
}
else if (!upKeep) {
// Up branch can be fathomed.
ubInd[numUpperTightens] = colInd;
newUB[numUpperTightens++] = floor(lpX);