本文整理汇总了C++中OsiClpSolverInterface::setColLower方法的典型用法代码示例。如果您正苦于以下问题:C++ OsiClpSolverInterface::setColLower方法的具体用法?C++ OsiClpSolverInterface::setColLower怎么用?C++ OsiClpSolverInterface::setColLower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsiClpSolverInterface
的用法示例。
在下文中一共展示了OsiClpSolverInterface::setColLower方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// model.setNumberStrong(0);
// Do more strong branching if small
if (model.getNumCols()<5000)
model.setNumberStrong(10);
model.setNumberStrong(20);
//model.setNumberStrong(5);
model.setNumberBeforeTrust(5);
model.solver()->setIntParam(OsiMaxNumIterationHotStart,100);
// If time is given then stop after that number of minutes
if (minutes>=0.0) {
std::cout<<"Stopping after "<<minutes<<" minutes"<<std::endl;
model.setDblParam(CbcModel::CbcMaximumSeconds,60.0*minutes);
}
// Switch off most output
if (model.getNumCols()<30000) {
model.messageHandler()->setLogLevel(1);
//model.solver()->messageHandler()->setLogLevel(0);
} else {
model.messageHandler()->setLogLevel(2);
model.solver()->messageHandler()->setLogLevel(1);
}
//model.messageHandler()->setLogLevel(2);
//model.solver()->messageHandler()->setLogLevel(2);
//model.setPrintFrequency(50);
//#define DEBUG_CUTS
#ifdef DEBUG_CUTS
// Set up debugger by name (only if no preprocesing)
if (!preProcess) {
std::string problemName ;
model.solver()->getStrParam(OsiProbName,problemName) ;
model.solver()->activateRowCutDebugger(problemName.c_str()) ;
}
#endif
// Do complete search
model.branchAndBound();
std::cout<<mpsFileName<<" took "<<CoinCpuTime()-time1<<" seconds, "
<<model.getNodeCount()<<" nodes with objective "
<<model.getObjValue()
<<(!model.status() ? " Finished" : " Not finished")
<<std::endl;
// Print more statistics
std::cout<<"Cuts at root node changed objective from "<<model.getContinuousObjective()
<<" to "<<model.rootObjectiveAfterCuts()<<std::endl;
for (iGenerator=0;iGenerator<numberGenerators;iGenerator++) {
CbcCutGenerator * generator = model.cutGenerator(iGenerator);
std::cout<<generator->cutGeneratorName()<<" was tried "
<<generator->numberTimesEntered()<<" times and created "
<<generator->numberCutsInTotal()<<" cuts of which "
<<generator->numberCutsActive()<<" were active after adding rounds of cuts";
if (generator->timing())
std::cout<<" ( "<<generator->timeInCutGenerator()<<" seconds)"<<std::endl;
else
std::cout<<std::endl;
}
// Print solution if finished - we can't get names from Osi! - so get from OsiClp
if (model.getMinimizationObjValue()<1.0e50) {
// post process
OsiSolverInterface * solver;
if (preProcess) {
process.postProcess(*model.solver());
// Solution now back in solver1
solver = & solver1;
} else {
solver = model.solver();
}
int numberColumns = solver->getNumCols();
const double * solution = solver->getColSolution();
// Get names from solver1 (as OsiSolverInterface may lose)
std::vector<std::string> columnNames = *solver1.getModelPtr()->columnNames();
int iColumn;
std::cout<<std::setiosflags(std::ios::fixed|std::ios::showpoint)<<std::setw(14);
std::cout<<"--------------------------------------"<<std::endl;
for (iColumn=0;iColumn<numberColumns;iColumn++) {
double value=solution[iColumn];
if (fabs(value)>1.0e-7&&solver->isInteger(iColumn)) {
std::cout<<std::setw(6)<<iColumn<<" "
<<columnNames[iColumn]<<" "
<<value<<std::endl;
solverSave.setColLower(iColumn,value);
solverSave.setColUpper(iColumn,value);
}
}
std::cout<<"--------------------------------------"<<std::endl;
std::cout<<std::resetiosflags(std::ios::fixed|std::ios::showpoint|std::ios::scientific);
solverSave.initialSolve();
}
return 0;
}