本文整理汇总了C++中OsiClpSolverInterface::getModelPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ OsiClpSolverInterface::getModelPtr方法的具体用法?C++ OsiClpSolverInterface::getModelPtr怎么用?C++ OsiClpSolverInterface::getModelPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsiClpSolverInterface
的用法示例。
在下文中一共展示了OsiClpSolverInterface::getModelPtr方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
try{
// Set up lp solver
OsiClpSolverInterface lpSolver;
lpSolver.getModelPtr()->setDualBound(1.0e10);
lpSolver.messageHandler()->setLogLevel(0);
// Create BLIS model
BlisModel model;
model.setSolver(&lpSolver);
#ifdef COIN_HAS_MPI
AlpsKnowledgeBrokerMPI broker(argc, argv, model);
#else
AlpsKnowledgeBrokerSerial broker(argc, argv, model);
#endif
// Search for best solution
broker.search(&model);
// Report the best solution found and its ojective value
broker.printBestSolution();
}
catch(CoinError& er) {
std::cerr << "\nBLIS ERROR: \"" << er.message()
<< "\""<< std::endl
<< " from function \"" << er.methodName()
<< "\""<< std::endl
<< " from class \"" << er.className()
<< "\"" << std::endl;
}
catch(...) {
std::cerr << "Something went wrong!" << std::endl;
}
return 0;
}
示例2: CbcSubProblem
// inner part of dive
int
CbcHeuristicDive::solution(double & solutionValue, int & numberNodes,
int & numberCuts, OsiRowCut ** cuts,
CbcSubProblem ** & nodes,
double * newSolution)
{
#ifdef DIVE_DEBUG
int nRoundInfeasible = 0;
int nRoundFeasible = 0;
#endif
int reasonToStop = 0;
double time1 = CoinCpuTime();
int numberSimplexIterations = 0;
int maxSimplexIterations = (model_->getNodeCount()) ? maxSimplexIterations_
: maxSimplexIterationsAtRoot_;
// but can't be exactly coin_int_max
maxSimplexIterations = CoinMin(maxSimplexIterations,COIN_INT_MAX>>3);
OsiSolverInterface * solver = cloneBut(6); // was model_->solver()->clone();
# ifdef COIN_HAS_CLP
OsiClpSolverInterface * clpSolver
= dynamic_cast<OsiClpSolverInterface *> (solver);
if (clpSolver) {
ClpSimplex * clpSimplex = clpSolver->getModelPtr();
int oneSolveIts = clpSimplex->maximumIterations();
oneSolveIts = CoinMin(1000+2*(clpSimplex->numberRows()+clpSimplex->numberColumns()),oneSolveIts);
clpSimplex->setMaximumIterations(oneSolveIts);
if (!nodes) {
// say give up easily
clpSimplex->setMoreSpecialOptions(clpSimplex->moreSpecialOptions() | 64);
} else {
// get ray
int specialOptions = clpSimplex->specialOptions();
specialOptions &= ~0x3100000;
specialOptions |= 32;
clpSimplex->setSpecialOptions(specialOptions);
clpSolver->setSpecialOptions(clpSolver->specialOptions() | 1048576);
if ((model_->moreSpecialOptions()&16777216)!=0) {
// cutoff is constraint
clpSolver->setDblParam(OsiDualObjectiveLimit, COIN_DBL_MAX);
}
}
}
# endif
const double * lower = solver->getColLower();
const double * upper = solver->getColUpper();
const double * rowLower = solver->getRowLower();
const double * rowUpper = solver->getRowUpper();
const double * solution = solver->getColSolution();
const double * objective = solver->getObjCoefficients();
double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance);
double primalTolerance;
solver->getDblParam(OsiPrimalTolerance, primalTolerance);
int numberRows = matrix_.getNumRows();
assert (numberRows <= solver->getNumRows());
int numberIntegers = model_->numberIntegers();
const int * integerVariable = model_->integerVariable();
double direction = solver->getObjSense(); // 1 for min, -1 for max
double newSolutionValue = direction * solver->getObjValue();
int returnCode = 0;
// Column copy
const double * element = matrix_.getElements();
const int * row = matrix_.getIndices();
const CoinBigIndex * columnStart = matrix_.getVectorStarts();
const int * columnLength = matrix_.getVectorLengths();
#ifdef DIVE_FIX_BINARY_VARIABLES
// Row copy
const double * elementByRow = matrixByRow_.getElements();
const int * column = matrixByRow_.getIndices();
const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts();
const int * rowLength = matrixByRow_.getVectorLengths();
#endif
// Get solution array for heuristic solution
int numberColumns = solver->getNumCols();
memcpy(newSolution, solution, numberColumns*sizeof(double));
// vectors to store the latest variables fixed at their bounds
int* columnFixed = new int [numberIntegers];
double* originalBound = new double [numberIntegers+2*numberColumns];
double * lowerBefore = originalBound+numberIntegers;
double * upperBefore = lowerBefore+numberColumns;
memcpy(lowerBefore,lower,numberColumns*sizeof(double));
memcpy(upperBefore,upper,numberColumns*sizeof(double));
double * lastDjs=newSolution+numberColumns;
bool * fixedAtLowerBound = new bool [numberIntegers];
PseudoReducedCost * candidate = new PseudoReducedCost [numberIntegers];
double * random = new double [numberIntegers];
int maxNumberAtBoundToFix = static_cast<int> (floor(percentageToFix_ * numberIntegers));
assert (!maxNumberAtBoundToFix||!nodes);
// count how many fractional variables
int numberFractionalVariables = 0;
for (int i = 0; i < numberIntegers; i++) {
random[i] = randomNumberGenerator_.randomDouble() + 0.3;
int iColumn = integerVariable[i];
double value = newSolution[iColumn];
if (fabs(floor(value + 0.5) - value) > integerTolerance) {
//.........这里部分代码省略.........
示例3: reducedCostFix
int CbcHeuristicDive::reducedCostFix (OsiSolverInterface* solver)
{
//return 0; // temp
#ifndef JJF_ONE
if (!model_->solverCharacteristics()->reducedCostsAccurate())
return 0; //NLP
#endif
double cutoff = model_->getCutoff() ;
if (cutoff > 1.0e20)
return 0;
#ifdef DIVE_DEBUG
std::cout << "cutoff = " << cutoff << std::endl;
#endif
double direction = solver->getObjSense() ;
double gap = cutoff - solver->getObjValue() * direction ;
gap *= 0.5; // Fix more
double tolerance;
solver->getDblParam(OsiDualTolerance, tolerance) ;
if (gap <= 0.0)
gap = tolerance; //return 0;
gap += 100.0 * tolerance;
double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance);
const double *lower = solver->getColLower() ;
const double *upper = solver->getColUpper() ;
const double *solution = solver->getColSolution() ;
const double *reducedCost = solver->getReducedCost() ;
int numberIntegers = model_->numberIntegers();
const int * integerVariable = model_->integerVariable();
int numberFixed = 0 ;
# ifdef COIN_HAS_CLP
OsiClpSolverInterface * clpSolver
= dynamic_cast<OsiClpSolverInterface *> (solver);
ClpSimplex * clpSimplex = NULL;
if (clpSolver)
clpSimplex = clpSolver->getModelPtr();
# endif
for (int i = 0 ; i < numberIntegers ; i++) {
int iColumn = integerVariable[i] ;
double djValue = direction * reducedCost[iColumn] ;
if (upper[iColumn] - lower[iColumn] > integerTolerance) {
if (solution[iColumn] < lower[iColumn] + integerTolerance && djValue > gap) {
#ifdef COIN_HAS_CLP
// may just have been fixed before
if (clpSimplex) {
if (clpSimplex->getColumnStatus(iColumn) == ClpSimplex::basic) {
#ifdef COIN_DEVELOP
printf("DJfix %d has status of %d, dj of %g gap %g, bounds %g %g\n",
iColumn, clpSimplex->getColumnStatus(iColumn),
djValue, gap, lower[iColumn], upper[iColumn]);
#endif
} else {
assert(clpSimplex->getColumnStatus(iColumn) == ClpSimplex::atLowerBound ||
clpSimplex->getColumnStatus(iColumn) == ClpSimplex::isFixed);
}
}
#endif
solver->setColUpper(iColumn, lower[iColumn]) ;
numberFixed++ ;
} else if (solution[iColumn] > upper[iColumn] - integerTolerance && -djValue > gap) {
#ifdef COIN_HAS_CLP
// may just have been fixed before
if (clpSimplex) {
if (clpSimplex->getColumnStatus(iColumn) == ClpSimplex::basic) {
#ifdef COIN_DEVELOP
printf("DJfix %d has status of %d, dj of %g gap %g, bounds %g %g\n",
iColumn, clpSimplex->getColumnStatus(iColumn),
djValue, gap, lower[iColumn], upper[iColumn]);
#endif
} else {
assert(clpSimplex->getColumnStatus(iColumn) == ClpSimplex::atUpperBound ||
clpSimplex->getColumnStatus(iColumn) == ClpSimplex::isFixed);
}
}
#endif
solver->setColLower(iColumn, upper[iColumn]) ;
numberFixed++ ;
}
}
}
return numberFixed;
}
示例4: assert
CbcBranchingObject *
CbcGeneralDepth::createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int /*way*/)
{
int numberDo = numberNodes_;
if (whichSolution_ >= 0 && (model_->moreSpecialOptions()&33554432)==0)
numberDo--;
assert (numberDo > 0);
// create object
CbcGeneralBranchingObject * branch = new CbcGeneralBranchingObject(model_);
// skip solution
branch->numberSubProblems_ = numberDo;
// If parentBranch_ back in then will have to be 2*
branch->numberSubLeft_ = numberDo;
branch->setNumberBranches(numberDo);
CbcSubProblem * sub = new CbcSubProblem[numberDo];
int iProb = 0;
branch->subProblems_ = sub;
branch->numberRows_ = model_->solver()->getNumRows();
int iNode;
//OsiSolverInterface * solver = model_->solver();
OsiClpSolverInterface * clpSolver
= dynamic_cast<OsiClpSolverInterface *> (solver);
assert (clpSolver);
ClpSimplex * simplex = clpSolver->getModelPtr();
int numberColumns = simplex->numberColumns();
if ((model_->moreSpecialOptions()&33554432)==0) {
double * lowerBefore = CoinCopyOfArray(simplex->getColLower(),
numberColumns);
double * upperBefore = CoinCopyOfArray(simplex->getColUpper(),
numberColumns);
ClpNodeStuff * info = nodeInfo_;
double * weight = new double[numberNodes_];
int * whichNode = new int [numberNodes_];
// Sort
for (iNode = 0; iNode < numberNodes_; iNode++) {
if (iNode != whichSolution_) {
double objectiveValue = info->nodeInfo_[iNode]->objectiveValue();
double sumInfeasibilities = info->nodeInfo_[iNode]->sumInfeasibilities();
int numberInfeasibilities = info->nodeInfo_[iNode]->numberInfeasibilities();
double thisWeight = 0.0;
#if 1
// just closest
thisWeight = 1.0e9 * numberInfeasibilities;
thisWeight += sumInfeasibilities;
thisWeight += 1.0e-7 * objectiveValue;
// Try estimate
thisWeight = info->nodeInfo_[iNode]->estimatedSolution();
#else
thisWeight = 1.0e-3 * numberInfeasibilities;
thisWeight += 1.0e-5 * sumInfeasibilities;
thisWeight += objectiveValue;
#endif
whichNode[iProb] = iNode;
weight[iProb++] = thisWeight;
}
}
assert (iProb == numberDo);
CoinSort_2(weight, weight + numberDo, whichNode);
for (iProb = 0; iProb < numberDo; iProb++) {
iNode = whichNode[iProb];
ClpNode * node = info->nodeInfo_[iNode];
// move bounds
node->applyNode(simplex, 3);
// create subproblem
sub[iProb] = CbcSubProblem(clpSolver, lowerBefore, upperBefore,
node->statusArray(), node->depth());
sub[iProb].objectiveValue_ = node->objectiveValue();
sub[iProb].sumInfeasibilities_ = node->sumInfeasibilities();
sub[iProb].numberInfeasibilities_ = node->numberInfeasibilities();
#ifdef CHECK_PATH
if (simplex->numberColumns() == numberColumns_Z) {
bool onOptimal = true;
const double * columnLower = simplex->columnLower();
const double * columnUpper = simplex->columnUpper();
for (int i = 0; i < numberColumns_Z; i++) {
if (iNode == gotGoodNode_Z)
printf("good %d %d %g %g\n", iNode, i, columnLower[i], columnUpper[i]);
if (columnUpper[i] < debuggerSolution_Z[i] || columnLower[i] > debuggerSolution_Z[i] && simplex->isInteger(i)) {
onOptimal = false;
break;
}
}
if (onOptimal) {
printf("adding to node %x as %d - objs\n", this, iProb);
for (int j = 0; j <= iProb; j++)
printf("%d %g\n", j, sub[j].objectiveValue_);
}
}
#endif
}
delete [] weight;
delete [] whichNode;
const double * lower = solver->getColLower();
const double * upper = solver->getColUpper();
// restore bounds
for ( int j = 0; j < numberColumns; j++) {
if (lowerBefore[j] != lower[j])
solver->setColLower(j, lowerBefore[j]);
if (upperBefore[j] != upper[j])
solver->setColUpper(j, upperBefore[j]);
//.........这里部分代码省略.........
示例5: CoinMax
// Infeasibility - large is 0.5
double
CbcGeneralDepth::infeasibility(const OsiBranchingInformation * /*info*/,
int &/*preferredWay*/) const
{
whichSolution_ = -1;
// should use genuine OsiBranchingInformation usefulInfo = model_->usefulInformation();
// for now assume only called when correct
//if (usefulInfo.depth_>=4&&!model_->parentModel()
// &&(usefulInfo.depth_%2)==0) {
if (true) {
OsiSolverInterface * solver = model_->solver();
OsiClpSolverInterface * clpSolver
= dynamic_cast<OsiClpSolverInterface *> (solver);
if (clpSolver) {
if ((model_->moreSpecialOptions()&33554432)==0) {
ClpNodeStuff * info = nodeInfo_;
info->integerTolerance_ = model_->getIntegerTolerance();
info->integerIncrement_ = model_->getCutoffIncrement();
info->numberBeforeTrust_ = model_->numberBeforeTrust();
info->stateOfSearch_ = model_->stateOfSearch();
// Compute "small" change in branch
int nBranches = model_->getIntParam(CbcModel::CbcNumberBranches);
if (nBranches) {
double average = model_->getDblParam(CbcModel::CbcSumChange) / static_cast<double>(nBranches);
info->smallChange_ =
CoinMax(average * 1.0e-5, model_->getDblParam(CbcModel::CbcSmallestChange));
info->smallChange_ = CoinMax(info->smallChange_, 1.0e-8);
} else {
info->smallChange_ = 1.0e-8;
}
int numberIntegers = model_->numberIntegers();
double * down = new double[numberIntegers];
double * up = new double[numberIntegers];
int * priority = new int[numberIntegers];
int * numberDown = new int[numberIntegers];
int * numberUp = new int[numberIntegers];
int * numberDownInfeasible = new int[numberIntegers];
int * numberUpInfeasible = new int[numberIntegers];
model_->fillPseudoCosts(down, up, priority, numberDown, numberUp,
numberDownInfeasible, numberUpInfeasible);
info->fillPseudoCosts(down, up, priority, numberDown, numberUp,
numberDownInfeasible,
numberUpInfeasible, numberIntegers);
info->presolveType_ = 1;
delete [] down;
delete [] up;
delete [] numberDown;
delete [] numberUp;
delete [] numberDownInfeasible;
delete [] numberUpInfeasible;
bool takeHint;
OsiHintStrength strength;
solver->getHintParam(OsiDoReducePrint, takeHint, strength);
ClpSimplex * simplex = clpSolver->getModelPtr();
int saveLevel = simplex->logLevel();
if (strength != OsiHintIgnore && takeHint && saveLevel == 1)
simplex->setLogLevel(0);
clpSolver->setBasis();
whichSolution_ = simplex->fathomMany(info);
//printf("FAT %d nodes, %d iterations\n",
//info->numberNodesExplored_,info->numberIterations_);
//printf("CbcBranch %d rows, %d columns\n",clpSolver->getNumRows(),
// clpSolver->getNumCols());
model_->incrementExtra(info->numberNodesExplored_,
info->numberIterations_);
// update pseudo costs
double smallest = 1.0e50;
double largest = -1.0;
OsiObject ** objects = model_->objects();
#ifndef NDEBUG
const int * integerVariable = model_->integerVariable();
#endif
for (int i = 0; i < numberIntegers; i++) {
#ifndef NDEBUG
CbcSimpleIntegerDynamicPseudoCost * obj =
dynamic_cast <CbcSimpleIntegerDynamicPseudoCost *>(objects[i]) ;
assert (obj && obj->columnNumber() == integerVariable[i]);
#else
CbcSimpleIntegerDynamicPseudoCost * obj =
static_cast <CbcSimpleIntegerDynamicPseudoCost *>(objects[i]) ;
#endif
if (info->numberUp_[i] > 0) {
if (info->downPseudo_[i] > largest)
largest = info->downPseudo_[i];
if (info->downPseudo_[i] < smallest)
smallest = info->downPseudo_[i];
if (info->upPseudo_[i] > largest)
largest = info->upPseudo_[i];
if (info->upPseudo_[i] < smallest)
smallest = info->upPseudo_[i];
obj->updateAfterMini(info->numberDown_[i],
info->numberDownInfeasible_[i],
info->downPseudo_[i],
info->numberUp_[i],
info->numberUpInfeasible_[i],
info->upPseudo_[i]);
}
}
//printf("range of costs %g to %g\n",smallest,largest);
//.........这里部分代码省略.........
示例6: equal
// Generate cuts
void
CglFakeClique::generateCuts(const OsiSolverInterface& si, OsiCuts & cs,
const CglTreeInfo info)
{
if (fakeSolver_) {
assert (si.getNumCols()==fakeSolver_->getNumCols());
fakeSolver_->setColLower(si.getColLower());
const double * solution = si.getColSolution();
fakeSolver_->setColSolution(solution);
fakeSolver_->setColUpper(si.getColUpper());
// get and set branch and bound cutoff
double cutoff;
si.getDblParam(OsiDualObjectiveLimit,cutoff);
fakeSolver_->setDblParam(OsiDualObjectiveLimit,COIN_DBL_MAX);
#ifdef COIN_HAS_CLP
OsiClpSolverInterface * clpSolver
= dynamic_cast<OsiClpSolverInterface *> (fakeSolver_);
if (clpSolver) {
// fix up fake solver
const ClpSimplex * siSimplex = clpSolver->getModelPtr();
// need to set djs
memcpy(siSimplex->primalColumnSolution(),
si.getReducedCost(),si.getNumCols()*sizeof(double));
fakeSolver_->setDblParam(OsiDualObjectiveLimit,cutoff);
}
#endif
const CoinPackedMatrix * matrixByRow = si.getMatrixByRow();
const double * elementByRow = matrixByRow->getElements();
const int * column = matrixByRow->getIndices();
const CoinBigIndex * rowStart = matrixByRow->getVectorStarts();
const int * rowLength = matrixByRow->getVectorLengths();
const double * rowUpper = si.getRowUpper();
const double * rowLower = si.getRowLower();
// Scan all rows looking for possibles
int numberRows = si.getNumRows();
double tolerance = 1.0e-3;
for (int iRow=0;iRow<numberRows;iRow++) {
CoinBigIndex start = rowStart[iRow];
CoinBigIndex end = start + rowLength[iRow];
double upRhs = rowUpper[iRow];
double loRhs = rowLower[iRow];
double sum = 0.0;
for (CoinBigIndex j=start;j<end;j++) {
int iColumn=column[j];
double value = elementByRow[j];
sum += solution[iColumn]*value;
}
if (sum<loRhs-tolerance||sum>upRhs+tolerance) {
// add as cut
OsiRowCut rc;
rc.setLb(loRhs);
rc.setUb(upRhs);
rc.setRow(end-start,column+start,elementByRow+start,false);
CoinAbsFltEq equal(1.0e-12);
cs.insertIfNotDuplicate(rc,equal);
}
}
CglClique::generateCuts(*fakeSolver_,cs,info);
if (probing_) {
probing_->generateCuts(*fakeSolver_,cs,info);
}
} else {
// just use real solver
CglClique::generateCuts(si,cs,info);
}
}
示例7: setWhen
/*
Randomized Rounding Heuristic
Returns 1 if solution, 0 if not
*/
int
CbcHeuristicRandRound::solution(double & solutionValue,
double * betterSolution)
{
// rlh: Todo: Memory Cleanup
// std::cout << "Entering the Randomized Rounding Heuristic" << std::endl;
setWhen(1); // setWhen(1) didn't have the effect I expected (e.g., run once).
// Run only once.
//
// See if at root node
bool atRoot = model_->getNodeCount() == 0;
int passNumber = model_->getCurrentPassNumber();
// Just do once
if (!atRoot || passNumber > 1) {
// std::cout << "Leaving the Randomized Rounding Heuristic" << std::endl;
return 0;
}
std::cout << "Entering the Randomized Rounding Heuristic" << std::endl;
typedef struct {
int numberSolutions;
int maximumSolutions;
int numberColumns;
double ** solution;
int * numberUnsatisfied;
} clpSolution;
double start = CoinCpuTime();
numCouldRun_++; //
#ifdef HEURISTIC_INFORM
printf("Entering heuristic %s - nRuns %d numCould %d when %d\n",
heuristicName(),numRuns_,numCouldRun_,when_);
#endif
// Todo: Ask JJHF what "number of times
// the heuristic could run" means.
OsiSolverInterface * solver = model_->solver()->clone();
double primalTolerance ;
solver->getDblParam(OsiPrimalTolerance, primalTolerance) ;
OsiClpSolverInterface * clpSolver = dynamic_cast<OsiClpSolverInterface *> (solver);
assert (clpSolver);
ClpSimplex * simplex = clpSolver->getModelPtr();
// Initialize the structure holding the solutions for the Simplex iterations
clpSolution solutions;
// Set typeStruct field of ClpTrustedData struct to 1 to indicate
// desired behavior for RandRound heuristic (which is what?)
ClpTrustedData trustedSolutions;
trustedSolutions.typeStruct = 1;
trustedSolutions.data = &solutions;
solutions.numberSolutions = 0;
solutions.maximumSolutions = 0;
solutions.numberColumns = simplex->numberColumns();
solutions.solution = NULL;
solutions.numberUnsatisfied = NULL;
simplex->setTrustedUserPointer(&trustedSolutions);
// Solve from all slack to get some points
simplex->allSlackBasis();
// Calling primal() invalidates pointers to some rim vectors,
// like...row sense (!)
simplex->primal();
// 1. Okay - so a workaround would be to copy the data I want BEFORE
// calling primal.
// 2. Another approach is to ask the simplex solvers NOT to mess up my
// rims.
// 3. See freeCachedResults() for what is getting
// deleted. Everything else points into the structure.
// ...or use collower and colupper rather than rowsense.
// ..store address of where one of these
// Store the basic problem information
// -Get the number of columns, rows and rhs vector
int numCols = clpSolver->getNumCols();
int numRows = clpSolver->getNumRows();
// Find the integer variables (use columnType(?))
// One if not continuous, that is binary or general integer)
// columnType() = 0 continuous
// = 1 binary
// = 2 general integer
bool * varClassInt = new bool[numCols];
const char* columnType = clpSolver->columnType();
int numGenInt = 0;
for (int i = 0; i < numCols; i++) {
if (clpSolver->isContinuous(i))
varClassInt[i] = 0;
else
varClassInt[i] = 1;
if (columnType[i] == 2) numGenInt++;
}
//.........这里部分代码省略.........
示例8: NoBasisError
//.........这里部分代码省略.........
// int numRows = m->getNumRows();
CoinFillN(integers_ ,n, true);
for (int i = 0 ; i < numCols ; i++)
{
if (si.isContinuous(i))
integers_[i] = false;
}
bool * integerSlacks = integers_ + numCols;
for (int i = 0 ; i < nBasics ; i++)
{
if (rowLower[i] > -1e50 && INT_INFEAS(rowLower[i]) > 1e-15)
integerSlacks[i] = false;
if (rowUpper[i] < 1e50 && INT_INFEAS(rowUpper[i]) > 1e-15)
integerSlacks[i] = false;
}
for (int i = 0 ; i < numCols ; i++)
{
CoinBigIndex end = starts[i] + lengths[i];
if (integers_[i])
{
for (CoinBigIndex k=starts[i] ; k < end; k++)
{
if (integerSlacks[inds[k]] && INT_INFEAS(elems[k])>1e-15 )
integerSlacks[inds[k]] = false;
}
}
else
{
for (CoinBigIndex k=starts[i] ; k < end; k++)
{
if (integerSlacks[inds[k]])
integerSlacks[inds[k]] = false;
}
}
}
CoinCopyN(si.getColSolution(), si.getNumCols(), colsol_);
CoinCopyN(si.getRowActivity(), si.getNumRows(), slacks_);
for (int i = 0 ; i < si.getNumRows() ; i++)
{
slacks_[i]*=-1;
if (rowLower[i]>-1e50)
{
slacks_[i] += rowLower[i];
}
else
{
slacks_[i] += rowUpper[i];
}
}
//Now get the fill the arrays;
nNonBasics = 0;
nBasics = 0;
//For having the index variables correctly ordered we need to access to OsiSimplexInterface
{
OsiSolverInterface * ncSi = (const_cast<OsiSolverInterface *>(&si));
ncSi->enableSimplexInterface(0);
ncSi->getBasics(basics_);
// Save enabled solver
solver_ = si.clone();
#ifdef COIN_HAS_OSICLP
OsiClpSolverInterface * clpSi = dynamic_cast<OsiClpSolverInterface *>(solver_);
const OsiClpSolverInterface * clpSiRhs = dynamic_cast<const OsiClpSolverInterface *>(&si);
if (clpSi)
clpSi->getModelPtr()->copyEnabledStuff(clpSiRhs->getModelPtr());;
#endif
ncSi->disableSimplexInterface();
}
int numStructural = basis_->getNumStructural();
for (int i = 0 ; i < numStructural ; i++)
{
if (basis_->getStructStatus(i)== CoinWarmStartBasis::basic)
{
nBasics++;
//Basically do nothing
}
else
{
nonBasics_[nNonBasics++] = i;
}
}
int numArtificial = basis_->getNumArtificial();
for (int i = 0 ; i < numArtificial ; i++)
{
if (basis_->getArtifStatus(i)== CoinWarmStartBasis::basic)
{
//Just check number of basics
nBasics++;
}
else
{
nonBasics_[nNonBasics++] = i + basis_->getNumStructural();
}
}
}