这篇教程C++ CoinMax函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CoinMax函数的典型用法代码示例。如果您正苦于以下问题:C++ CoinMax函数的具体用法?C++ CoinMax怎么用?C++ CoinMax使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CoinMax函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: assert// Apply boundsvoid OsiSolverBranch::applyBounds(OsiSolverInterface &solver, int way) const{ int base = way + 1; assert(way == -1 || way == 1); int numberColumns = solver.getNumCols(); const double *columnLower = solver.getColLower(); int i; for (i = start_[base]; i < start_[base + 1]; i++) { int iColumn = indices_[i]; if (iColumn < numberColumns) { double value = CoinMax(bound_[i], columnLower[iColumn]); solver.setColLower(iColumn, value); } else { int iRow = iColumn - numberColumns; const double *rowLower = solver.getRowLower(); double value = CoinMax(bound_[i], rowLower[iRow]); solver.setRowLower(iRow, value); } } const double *columnUpper = solver.getColUpper(); for (i = start_[base + 1]; i < start_[base + 2]; i++) { int iColumn = indices_[i]; if (iColumn < numberColumns) { double value = CoinMin(bound_[i], columnUpper[iColumn]); solver.setColUpper(iColumn, value); } else { int iRow = iColumn - numberColumns; const double *rowUpper = solver.getRowUpper(); double value = CoinMin(bound_[i], rowUpper[iRow]); solver.setRowUpper(iRow, value); } }}
开发者ID:coin-or,项目名称:Osi,代码行数:34,
示例2: CoinMax// Return "down" estimatedoubleCbcSimpleIntegerPseudoCost::downEstimate() const{ OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); if (upper[columnNumber_] == lower[columnNumber_]) { // fixed return 0.0; } double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); double below = floor(value + integerTolerance); double above = below + 1.0; if (above > upper[columnNumber_]) { above = below; below = above - 1; } double downCost = CoinMax((value - below) * downPseudoCost_, 0.0); return downCost;}
开发者ID:amosr,项目名称:limp-cbc,代码行数:26,
示例3: CoinMaxdoubleCbcNWay::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const{ int numberUnsatis = 0; int j; OsiSolverInterface * solver = model_->solver(); const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double largestValue = 0.0; double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); for (j = 0; j < numberMembers_; j++) { int iColumn = members_[j]; double value = solution[iColumn]; value = CoinMax(value, lower[iColumn]); value = CoinMin(value, upper[iColumn]); double distance = CoinMin(value - lower[iColumn], upper[iColumn] - value); if (distance > integerTolerance) { numberUnsatis++; largestValue = CoinMax(distance, largestValue); } } preferredWay = 1; if (numberUnsatis) { return largestValue; } else { return 0.0; // satisfied }}
开发者ID:SnowyJune973,项目名称:future_net,代码行数:33,
示例4: subsetTransposeTimes// Updates second array for steepest and does devex weights (need not be coded)voidClpMatrixBase::subsetTimes2(const ClpSimplex * model, CoinIndexedVector * dj1, const CoinIndexedVector * pi2, CoinIndexedVector * dj2, double referenceIn, double devex, // Array for exact devex to say what is in reference framework unsigned int * reference, double * weights, double scaleFactor){ // get subset which have nonzero tableau elements subsetTransposeTimes(model, pi2, dj1, dj2); bool killDjs = (scaleFactor == 0.0); if (!scaleFactor) scaleFactor = 1.0; // columns int number = dj1->getNumElements(); const int * index = dj1->getIndices(); double * updateBy = dj1->denseVector(); double * updateBy2 = dj2->denseVector(); for (int j = 0; j < number; j++) { double thisWeight; double pivot; double pivotSquared; int iSequence = index[j]; double value2 = updateBy[j]; if (killDjs) updateBy[j] = 0.0; double modification = updateBy2[j]; updateBy2[j] = 0.0; ClpSimplex::Status status = model->getStatus(iSequence); if (status != ClpSimplex::basic && status != ClpSimplex::isFixed) { thisWeight = weights[iSequence]; pivot = value2 * scaleFactor; pivotSquared = pivot * pivot; thisWeight += pivotSquared * devex + pivot * modification; if (thisWeight < DEVEX_TRY_NORM) { if (referenceIn < 0.0) { // steepest thisWeight = CoinMax(DEVEX_TRY_NORM, DEVEX_ADD_ONE + pivotSquared); } else { // exact thisWeight = referenceIn * pivotSquared; if (reference(iSequence)) thisWeight += 1.0; thisWeight = CoinMax(thisWeight, DEVEX_TRY_NORM); } } weights[iSequence] = thisWeight; } } dj2->setNumElements(0);}
开发者ID:e2bsq,项目名称:Symphony,代码行数:57,
示例5: CoinZeroN/* Just for debug if odd type matrix. Returns number and sum of primal infeasibilities.*/intClpMatrixBase::checkFeasible(ClpSimplex * model, double & sum) const{ int numberRows = model->numberRows(); double * rhs = new double[numberRows]; int numberColumns = model->numberColumns(); int iRow; CoinZeroN(rhs, numberRows); times(1.0, model->solutionRegion(), rhs, model->rowScale(), model->columnScale()); int iColumn; int logLevel = model->messageHandler()->logLevel(); int numberInfeasible = 0; const double * rowLower = model->lowerRegion(0); const double * rowUpper = model->upperRegion(0); const double * solution; solution = model->solutionRegion(0); double tolerance = model->primalTolerance() * 1.01; sum = 0.0; for (iRow = 0; iRow < numberRows; iRow++) { double value = rhs[iRow]; double value2 = solution[iRow]; if (logLevel > 3) { if (fabs(value - value2) > 1.0e-8) printf("Row %d stored %g, computed %g/n", iRow, value2, value); } if (value < rowLower[iRow] - tolerance || value > rowUpper[iRow] + tolerance) { numberInfeasible++; sum += CoinMax(rowLower[iRow] - value, value - rowUpper[iRow]); } if (value2 > rowLower[iRow] + tolerance && value2 < rowUpper[iRow] - tolerance && model->getRowStatus(iRow) != ClpSimplex::basic) { assert (model->getRowStatus(iRow) == ClpSimplex::superBasic); } } const double * columnLower = model->lowerRegion(1); const double * columnUpper = model->upperRegion(1); solution = model->solutionRegion(1); for (iColumn = 0; iColumn < numberColumns; iColumn++) { double value = solution[iColumn]; if (value < columnLower[iColumn] - tolerance || value > columnUpper[iColumn] + tolerance) { numberInfeasible++; sum += CoinMax(columnLower[iColumn] - value, value - columnUpper[iColumn]); } if (value > columnLower[iColumn] + tolerance && value < columnUpper[iColumn] - tolerance && model->getColumnStatus(iColumn) != ClpSimplex::basic) { assert (model->getColumnStatus(iColumn) == ClpSimplex::superBasic); } } delete [] rhs; return numberInfeasible;}
开发者ID:e2bsq,项目名称:Symphony,代码行数:58,
示例6: CbcSimpleInteger/** Useful constructor Loads actual upper & lower bounds for the specified variable.*/CbcSimpleIntegerPseudoCost::CbcSimpleIntegerPseudoCost (CbcModel * model, int iColumn, double downPseudoCost, double upPseudoCost) : CbcSimpleInteger(model, iColumn){ downPseudoCost_ = CoinMax(1.0e-10, downPseudoCost); upPseudoCost_ = CoinMax(1.0e-10, upPseudoCost); breakEven_ = upPseudoCost_ / (upPseudoCost_ + downPseudoCost_); upDownSeparator_ = -1.0; method_ = 0;}
开发者ID:amosr,项目名称:limp-cbc,代码行数:15,
示例7: pdxxxresid1inline void pdxxxresid1(ClpPdco *model, const int nlow, const int nupp, const int nfix, int *low, int *upp, int *fix, CoinDenseVector <double> &b, double *bl, double *bu, double d1, double d2, CoinDenseVector <double> &grad, CoinDenseVector <double> &rL, CoinDenseVector <double> &rU, CoinDenseVector <double> &x, CoinDenseVector <double> &x1, CoinDenseVector <double> &x2, CoinDenseVector <double> &y, CoinDenseVector <double> &z1, CoinDenseVector <double> &z2, CoinDenseVector <double> &r1, CoinDenseVector <double> &r2, double *Pinf, double *Dinf){// Form residuals for the primal and dual equations.// rL, rU are output, but we input them as full vectors// initialized (permanently) with any relevant zeros.// Get some element pointers for efficiency double *x_elts = x.getElements(); double *r2_elts = r2.getElements(); for (int k = 0; k < nfix; k++) x_elts[fix[k]] = 0; r1.clear(); r2.clear(); model->matVecMult( 1, r1, x ); model->matVecMult( 2, r2, y ); for (int k = 0; k < nfix; k++) r2_elts[fix[k]] = 0; r1 = b - r1 - d2 * d2 * y; r2 = grad - r2 - z1; // grad includes d1*d1*x if (nupp > 0) r2 = r2 + z2; for (int k = 0; k < nlow; k++) rL[low[k]] = bl[low[k]] - x[low[k]] + x1[low[k]]; for (int k = 0; k < nupp; k++) rU[upp[k]] = - bu[upp[k]] + x[upp[k]] + x2[upp[k]]; double normL = 0.0; double normU = 0.0; for (int k = 0; k < nlow; k++) if (rL[low[k]] > normL) normL = rL[low[k]]; for (int k = 0; k < nupp; k++) if (rU[upp[k]] > normU) normU = rU[upp[k]]; *Pinf = CoinMax(normL, normU); *Pinf = CoinMax( r1.infNorm() , *Pinf ); *Dinf = r2.infNorm(); *Pinf = CoinMax( *Pinf, 1e-99 ); *Dinf = CoinMax( *Dinf, 1e-99 );}
开发者ID:e2bsq,项目名称:Symphony,代码行数:53,
示例8: pdxxxresid2inline void pdxxxresid2(double mu, int nlow, int nupp, int *low, int *upp, CoinDenseVector <double> &cL, CoinDenseVector <double> &cU, CoinDenseVector <double> &x1, CoinDenseVector <double> &x2, CoinDenseVector <double> &z1, CoinDenseVector <double> &z2, double *center, double *Cinf, double *Cinf0){// Form residuals for the complementarity equations.// cL, cU are output, but we input them as full vectors// initialized (permanently) with any relevant zeros.// Cinf is the complementarity residual for X1 z1 = mu e, etc.// Cinf0 is the same for mu=0 (i.e., for the original problem). double maxXz = -1e20; double minXz = 1e20; double *x1_elts = x1.getElements(); double *z1_elts = z1.getElements(); double *cL_elts = cL.getElements(); for (int k = 0; k < nlow; k++) { double x1z1 = x1_elts[low[k]] * z1_elts[low[k]]; cL_elts[low[k]] = mu - x1z1; if (x1z1 > maxXz) maxXz = x1z1; if (x1z1 < minXz) minXz = x1z1; } double *x2_elts = x2.getElements(); double *z2_elts = z2.getElements(); double *cU_elts = cU.getElements(); for (int k = 0; k < nupp; k++) { double x2z2 = x2_elts[upp[k]] * z2_elts[upp[k]]; cU_elts[upp[k]] = mu - x2z2; if (x2z2 > maxXz) maxXz = x2z2; if (x2z2 < minXz) minXz = x2z2; } maxXz = CoinMax( maxXz, 1e-99 ); minXz = CoinMax( minXz, 1e-99 ); *center = maxXz / minXz; double normL = 0.0; double normU = 0.0; for (int k = 0; k < nlow; k++) if (cL_elts[low[k]] > normL) normL = cL_elts[low[k]]; for (int k = 0; k < nupp; k++) if (cU_elts[upp[k]] > normU) normU = cU_elts[upp[k]]; *Cinf = CoinMax( normL, normU); *Cinf0 = maxXz;}
开发者ID:e2bsq,项目名称:Symphony,代码行数:49,
示例9: CoinMaxdoubleCbcBranchToFixLots::infeasibility(const OsiBranchingInformation * /*info*/, int &preferredWay) const{ preferredWay = -1; CbcNode * node = model_->currentNode(); int depth; if (node) depth = CoinMax(node->depth(), 0); else return 0.0; if (depth_ < 0) { return 0.0; } else if (depth_ > 0) { if ((depth % depth_) != 0) return 0.0; } if (djTolerance_ != -1.234567) { if (!shallWe()) return 0.0; else return 1.0e20; } else { // See if 3 in same row and sum <FIX_IF_LESS? int numberRows = matrixByRow_.getNumRows(); const double * solution = model_->testSolution(); const int * column = matrixByRow_.getIndices(); const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts(); const int * rowLength = matrixByRow_.getVectorLengths(); double bestSum = 1.0; int nBest = -1; OsiSolverInterface * solver = model_->solver(); for (int i = 0; i < numberRows; i++) { int numberUnsatisfied = 0; double sum = 0.0; for (int j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { int iColumn = column[j]; if (solver->isInteger(iColumn)) { double solValue = solution[iColumn]; if (solValue > 1.0e-5 && solValue < FIX_IF_LESS) { numberUnsatisfied++; sum += solValue; } } } if (numberUnsatisfied >= 3 && sum < FIX_IF_LESS) { // possible if (numberUnsatisfied > nBest || (numberUnsatisfied == nBest && sum < bestSum)) { nBest = numberUnsatisfied; bestSum = sum; } } } if (nBest > 0) return 1.0e20; else return 0.0; }}
开发者ID:amosr,项目名称:limp-cbc,代码行数:60,
示例10: CoinMaxvoidOsiTestSolverInterface::rowRimResize_(const int newSize){ if (newSize > maxNumrows_) { double* rub = rowupper_; double* rlb = rowlower_; char* sense = rowsense_; double* right = rhs_; double* range = rowrange_; double* dual = rowprice_; double* left = lhs_; maxNumrows_ = CoinMax(1000, (newSize * 5) / 4); rowRimAllocator_(); const int rownum = getNumRows(); CoinDisjointCopyN(rub , rownum, rowupper_); CoinDisjointCopyN(rlb , rownum, rowlower_); CoinDisjointCopyN(sense, rownum, rowsense_); CoinDisjointCopyN(right, rownum, rhs_); CoinDisjointCopyN(range, rownum, rowrange_); CoinDisjointCopyN(dual , rownum, rowprice_); CoinDisjointCopyN(left , rownum, lhs_); delete[] rub; delete[] rlb; delete[] sense; delete[] right; delete[] range; delete[] dual; delete[] left; }}
开发者ID:NealCaffrey989,项目名称:CBC,代码行数:30,
示例11: CoinMax// Creates a branching objectCbcBranchingObject * CbcSimpleIntegerFixed::createBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) { const double * solution = model_->testSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnNumber_]; value = CoinMax(value, lower[columnNumber_]); value = CoinMin(value, upper[columnNumber_]); assert (upper[columnNumber_]>lower[columnNumber_]); if (!model_->hotstartSolution()) { double nearest = floor(value+0.5); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); if (fabs(value-nearest)<integerTolerance) { // adjust value if (nearest!=upper[columnNumber_]) value = nearest+2.0*integerTolerance; else value = nearest-2.0*integerTolerance; } } else { const double * hotstartSolution = model_->hotstartSolution(); double targetValue = hotstartSolution[columnNumber_]; if (way>0) value = targetValue-0.1; else value = targetValue+0.1; } CbcBranchingObject * branch = new CbcIntegerBranchingObject(model_,columnNumber_,way, value); branch->setOriginalObject(this); return branch;}
开发者ID:aykutbulut,项目名称:Cbc,代码行数:36,
示例12: if// Returns true if y better than xbool CbcCompareUser::test (CbcNode * x, CbcNode * y){ if (weight_==-1.0&&(y->depth()>7||x->depth()>7)) { // before solution /* printf("x %d %d %g, y %d %d %g/n", x->numberUnsatisfied(),x->depth(),x->objectiveValue(), y->numberUnsatisfied(),y->depth(),y->objectiveValue()); */ if (x->numberUnsatisfied() > y->numberUnsatisfied()) { return true; } else if (x->numberUnsatisfied() < y->numberUnsatisfied()) { return false; } else { int testX = x->depth(); int testY = y->depth(); if (testX!=testY) return testX < testY; else return equalityTest(x,y); // so ties will be broken in consistent manner } } else { // after solution double weight = CoinMax(weight_,0.0); double testX = x->objectiveValue()+ weight*x->numberUnsatisfied(); double testY = y->objectiveValue() + weight*y->numberUnsatisfied(); if (testX!=testY) return testX > testY; else return equalityTest(x,y); // so ties will be broken in consistent manner }}
开发者ID:SnowyJune973,项目名称:future_net,代码行数:32,
示例13: indexSetvoidCoinPackedVector::append(const CoinPackedVectorBase & caboose){ const int cs = caboose.getNumElements(); if (cs == 0) { return; } if (testForDuplicateIndex()) { // Just to initialize the index heap indexSet("append (1st call)", "CoinPackedVector"); } const int s = nElements_; // Make sure there is enough room for the caboose if ( capacity_ < s + cs) reserve(CoinMax(s + cs, 2 * capacity_)); const int * cind = caboose.getIndices(); const double * celem = caboose.getElements(); CoinDisjointCopyN(cind, cs, indices_ + s); CoinDisjointCopyN(celem, cs, elements_ + s); CoinIotaN(origIndices_ + s, cs, s); nElements_ += cs; if (testForDuplicateIndex()) { std::set<int>& is = *indexSet("append (2nd call)", "CoinPackedVector"); for (int i = 0; i < cs; ++i) { if (!is.insert(cind[i]).second) throw CoinError("duplicate index", "append", "CoinPackedVector"); } }}
开发者ID:rafapaz,项目名称:FlopCpp,代码行数:30,
示例14: CoinMax//-------------------------------------------------------------------// Generate Stored cuts//------------------------------------------------------------------- void CglStoredUser::generateCuts(const OsiSolverInterface & si, OsiCuts & cs, const CglTreeInfo info) const{ // Get basic problem information const double * solution = si.getColSolution(); if (info.inTree&&info.pass>numberPasses_) { // only continue if integer feasible int numberColumns=si.getNumCols(); int i; const double * colUpper = si.getColUpper(); const double * colLower = si.getColLower(); int numberAway=0; for (i=0;i<numberColumns;i++) { double value = solution[i]; // In case slightly away from bounds value = CoinMax(colLower[i],value); value = CoinMin(colUpper[i],value); if (si.isInteger(i)&&fabs(value-fabs(value+0.5))>1.0e-5) numberAway++; } if (numberAway) return; // let code branch } int numberRowCuts = cuts_.sizeRowCuts(); for (int i=0;i<numberRowCuts;i++) { const OsiRowCut * rowCutPointer = cuts_.rowCutPtr(i); double violation = rowCutPointer->violated(solution); if (violation>=requiredViolation_) cs.insert(*rowCutPointer); }}
开发者ID:Flymir,项目名称:coin-all,代码行数:35,
示例15: CoinMax// Creates a branching objectCbcBranchingObject * CbcLink::createBranch(int way) { int j; const double * solution = model_->testSolution(); double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance); OsiSolverInterface * solver = model_->solver(); const double * upper = solver->getColUpper(); int firstNonFixed=-1; int lastNonFixed=-1; int firstNonZero=-1; int lastNonZero = -1; double weight = 0.0; double sum =0.0; int base=0; for (j=0;j<numberMembers_;j++) { for (int k=0;k<numberLinks_;k++) { int iColumn = which_[base+k]; if (upper[iColumn]) { double value = CoinMax(0.0,solution[iColumn]); sum += value; if (firstNonFixed<0) firstNonFixed=j; lastNonFixed=j; if (value>integerTolerance) { weight += weights_[j]*value; if (firstNonZero<0) firstNonZero=j; lastNonZero=j; } } } base += numberLinks_; } assert (lastNonZero-firstNonZero>=sosType_) ; // find where to branch assert (sum>0.0); weight /= sum; int iWhere; double separator=0.0; for (iWhere=firstNonZero;iWhere<lastNonZero;iWhere++) if (weight<weights_[iWhere+1]) break; if (sosType_==1) { // SOS 1 separator = 0.5 *(weights_[iWhere]+weights_[iWhere+1]); } else { // SOS 2 if (iWhere==firstNonFixed) iWhere++;; if (iWhere==lastNonFixed-1) iWhere = lastNonFixed-2; separator = weights_[iWhere+1]; } // create object CbcBranchingObject * branch; branch = new CbcLinkBranchingObject(model_,this,way,separator); return branch;}
开发者ID:rafapaz,项目名称:FlopCpp,代码行数:61,
示例16: assert// Set up a startLower for a single membervoidCbcFixVariable::applyToSolver(OsiSolverInterface * solver, int state) const{ assert (state == -9999 || state == 9999); // Find state int find; for (find = 0; find < numberStates_; find++) if (states_[find] == state) break; if (find == numberStates_) return; int i; // Set new lower bounds for (i = startLower_[find]; i < startUpper_[find]; i++) { int iColumn = variable_[i]; double value = newBound_[i]; double oldValue = solver->getColLower()[iColumn]; //printf("for %d old lower bound %g, new %g",iColumn,oldValue,value); solver->setColLower(iColumn, CoinMax(value, oldValue)); //printf(" => %g/n",solver->getColLower()[iColumn]); } // Set new upper bounds for (i = startUpper_[find]; i < startLower_[find+1]; i++) { int iColumn = variable_[i]; double value = newBound_[i]; double oldValue = solver->getColUpper()[iColumn]; //printf("for %d old upper bound %g, new %g",iColumn,oldValue,value); solver->setColUpper(iColumn, CoinMin(value, oldValue)); //printf(" => %g/n",solver->getColUpper()[iColumn]); }}
开发者ID:Flymir,项目名称:coin-all,代码行数:32,
示例17: ClpObjective//-------------------------------------------------------------------// Useful Constructor//-------------------------------------------------------------------ClpQuadraticObjective::ClpQuadraticObjective(const double *objective, int numberColumns, const CoinBigIndex *start, const int *column, const double *element, int numberExtendedColumns) : ClpObjective(){ type_ = 2; numberColumns_ = numberColumns; if (numberExtendedColumns >= 0) numberExtendedColumns_ = CoinMax(numberColumns_, numberExtendedColumns); else numberExtendedColumns_ = numberColumns_; if (objective) { objective_ = new double[numberExtendedColumns_]; CoinMemcpyN(objective, numberColumns_, objective_); memset(objective_ + numberColumns_, 0, (numberExtendedColumns_ - numberColumns_) * sizeof(double)); } else { objective_ = new double[numberExtendedColumns_]; memset(objective_, 0, numberExtendedColumns_ * sizeof(double)); } if (start) quadraticObjective_ = new CoinPackedMatrix(true, numberColumns, numberColumns, start[numberColumns], element, column, start, NULL); else quadraticObjective_ = NULL; gradient_ = NULL; activated_ = 1; fullMatrix_ = false;}
开发者ID:coin-or,项目名称:Clp,代码行数:33,
示例18: maximumAbsElementdoublemaximumAbsElement(const double * region, int size){ int i; double maxValue = 0.0; for (i = 0; i < size; i++) maxValue = CoinMax(maxValue, fabs(region[i])); return maxValue;}
开发者ID:sednanref,项目名称:tesis,代码行数:9,
示例19: getElementsdoubleCoinPackedVectorBase::infNorm() const{ register double norm = 0.0; register const double* elements = getElements(); for (int i = getNumElements() - 1; i >= 0; --i) { norm = CoinMax(norm, fabs(elements[i])); } return norm;}
开发者ID:Teino1978-Corp,项目名称:CoinUtils,代码行数:10,
示例20: getNormsvoidgetNorms(const CoinWorkDouble * region, int size, CoinWorkDouble & norm1, CoinWorkDouble & norm2){ norm1 = 0.0; norm2 = 0.0; int i; for (i = 0; i < size; i++) { norm2 += region[i] * region[i]; norm1 = CoinMax(norm1, CoinAbs(region[i])); }}
开发者ID:sednanref,项目名称:tesis,代码行数:11,
示例21: CoinMaxdoubleBlisConstraint::violation(const double *lpSolution){ int k, varInd; double activity = 0.0; double rowLower = CoinMax(lbHard_, lbSoft_); double rowUpper = CoinMin(ubHard_, ubSoft_); double violation = -ALPS_DBL_MAX; // Any negative number is OK for (k = 0; k < size_; ++k) { varInd = indices_[k]; activity += values_[varInd] * lpSolution[varInd]; } if (rowLower > -ALPS_INFINITY) { violation = rowLower - activity; } if (rowUpper < ALPS_INFINITY) { violation = CoinMax(violation, activity - rowUpper); } return violation;}
开发者ID:elspeth0,项目名称:CHiPPS-BLIS,代码行数:23,
示例22: CoinMax/* Preallocate scratch work arrays, arrays to hold row lhs bound information, and an array of random numbers.*/void CoinPresolveMatrix::initializeStuff (){ usefulRowInt_ = new int [3*nrows_] ; usefulRowDouble_ = new double [2*nrows_] ; usefulColumnInt_ = new int [2*ncols_] ; usefulColumnDouble_ = new double[ncols_] ; int k = CoinMax(ncols_+1,nrows_+1) ; randomNumber_ = new double [k] ; coin_init_random_vec(randomNumber_,k) ; infiniteUp_ = new int [nrows_] ; sumUp_ = new double [nrows_] ; infiniteDown_ = new int [nrows_] ; sumDown_ = new double [nrows_] ; return ;}
开发者ID:tkelman,项目名称:Bonmin,代码行数:19,
示例23: CoinMax// Creates a branching object from this infeasible object.BcpsBranchObject * BlisObjectInt::createBranchObject(BcpsModel *m, int direction) const{ BlisModel *model = dynamic_cast<BlisModel* >(m); OsiSolverInterface * solver = model->solver(); double integerTolerance = model->BlisPar()->entry(BlisParams::integerTol); const double * solution = solver->getColSolution(); const double * lower = solver->getColLower(); const double * upper = solver->getColUpper(); double value = solution[columnIndex_]; //std::cout << "COL"<< columnIndex_ << ": x = " << value << std::endl; // Force value in bounds. value = CoinMax(value, lower[columnIndex_]); value = CoinMin(value, upper[columnIndex_]); double nearest = floor(value + 0.5); assert (upper[columnIndex_] > lower[columnIndex_]); int hotstartStrategy = model->getHotstartStrategy(); if (hotstartStrategy <= 0) { if (fabs(value - nearest) < integerTolerance) { // Already integeral. std::cout << "ERROR: COL" << columnIndex_ << ": x=" << value << ", nearest=" << nearest << ", intTol=" << integerTolerance << std::endl; assert(0); } } else { const double * incumbent = model->incumbent(); double targetValue = incumbent[columnIndex_]; if (direction > 0) { value = targetValue - 0.1; } else { value = targetValue + 0.1; } } return new BlisBranchObjectInt(model, objectIndex_, direction, value);}
开发者ID:aykutbulut,项目名称:CHiPPS-BiCePS,代码行数:48,
注:本文中的CoinMax函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CoinMin函数代码示例 C++ CoinError函数代码示例 |