# Changeset 777

Ignore:
Timestamp:
May 9, 2007 11:15:41 PM (7 years ago)
Message:

Location:
Blis/trunk/Blis/src
Files:
6 edited

Unmodified
Removed
• ## Blis/trunk/Blis/src/BlisMessage.cpp

 r760 static Blis_message us_english[]= { {BLIS_CUTOFF_INC, 43, 1, "Objective coefficients are multiples of %g"}, {BLIS_CUT_STAT_FINAL, 53, 1, "Called %s cut generator %d times, generated %d cuts, CPU time %.4f seconds, current strategy %d"}, {BLIS_CUT_STAT_NODE, 55, 1, "Node %d, called %s cut generator %d times, generated %d cuts, CPU time %.4f seconds, current strategy %d"},
• ## Blis/trunk/Blis/src/BlisMessage.h

 r671 enum BLIS_Message { BLIS_CUTOFF_INC, BLIS_CUT_STAT_FINAL, BLIS_CUT_STAT_NODE,
• ## Blis/trunk/Blis/src/BlisModel.cpp

 r764 //############################################################################# //------------------------------------------------------------------- // Returns the greatest common denominator of two // positive integers, a and b, found using Euclid's algorithm //------------------------------------------------------------------- static int gcd(int a, int b) { int remainder = -1; // make sure a<=b (will always remain so) if(a > b) { // Swap a and b int temp = a; a = b; b = temp; } // if zero then gcd is nonzero (zero may occur in rhs of packed) if (!a) { if (b) { return b; } else { printf("**** gcd given two zeros!!\n"); abort(); } } while (remainder) { remainder = b % a; b = a; a = remainder; } return b; } //############################################################################# void //------------------------------------------------------ // Create integer objects. // Create integer objects and analyze objective coef. //------------------------------------------------------ createIntgerObjects(true); // Do this after loading LP. analyzeObjective(); //------------------------------------------------------ // Allocate memory. //############################################################################# // Borrow from CBC void BlisModel::analyzeObjective() { const double *objective = getObjCoef(); const double *lower = getColLower(); const double *upper = getColUpper(); /*------------------------------------------------------ * Take a first scan to see if there are unfixed continuous * variables in the objective.  If so, the minimum objective change * could be arbitrarily small. Also pick off the maximum * coefficient of an unfixed integer variable. * If the objective is found to contain only integer variables, * set the fathoming discipline to strict. *------------------------------------------------------*/ double maximumCost = 0.0; bool possibleMultiple = true; int iColumn; int numberColumns = getNumCols(); for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn]+1.0e-8) { if (colType_[iColumn] == 'I' || colType_[iColumn] == 'B') { maximumCost = CoinMax(maximumCost, fabs(objective[iColumn])); } else if (objective[iColumn]) { possibleMultiple = false; } } } //setIntParam(CbcModel::CbcFathomDiscipline,possibleMultiple); /*------------------------------------------------------ * If a nontrivial increment is possible, try and figure * it out. We're looking for gcd(c) for all c that * are coefficients of unfixed integer variables. Since * the c might not be integers, try and inflate them * sufficiently that they look like integers (and we'll * deflate the gcd later). * 2520.0 is used as it is a nice multiple of 2,3,5,7 *-----------------------------------------------------*/ if (possibleMultiple && maximumCost) { int increment = 0; double multiplier = 2520.0; while (10.0*multiplier * maximumCost < 1.0e8) { multiplier *= 10.0; } for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn]+1.0e-8) { if ( (colType_[iColumn] == 'I' || colType_[iColumn] == 'B') && objective[iColumn] ) { double value = fabs(objective[iColumn])*multiplier; int nearest = (int) floor(value+0.5); if (fabs(value-floor(value+0.5)) > 1.0e-8) { increment = 0; break; } else if (!increment) { increment = nearest; } else { increment = gcd(increment,nearest); } } } } /*-------------------------------------------------- * If the increment beats the current value for objective * change, install it. *--------------------------------------------------*/ if (increment) { double value = increment; double cutoffInc = BlisPar_->entry(BlisParams::cutoffInc); value /= multiplier; if (value * 0.999 > cutoffInc) { blisMessageHandler()->message(BLIS_CUTOFF_INC, blisMessages()) << value << CoinMessageEol; BlisPar_->setEntry(BlisParams::cutoffInc, -value*0.999); } } } } //#############################################################################
• ## Blis/trunk/Blis/src/BlisModel.h

 r764 } void analyzeObjective(); //------------------------------------------------------ // HEURISTICS.
• ## Blis/trunk/Blis/src/BlisSolution.h

 r767 /** Print out the solution.*/ /** Print the solution.*/ virtual void print(std::ostream& os) const { double nearInt = 0.0; for (int j = 0; j < size_; ++j) { if (values_[j] > 1.0e-15 || values_[j] < -1.0e-15) { os << "x[" << j << "] = " << values_[j] << std::endl; nearInt = floor(values_[j] + 0.5); if (ALPS_FABS(nearInt - values_[j]) < 1.0e-6) { os << "x[" << j << "] = " << nearInt << std::endl; } else { os << "x[" << j << "] = " << values_[j] << std::endl; } } }
• ## Blis/trunk/Blis/src/BlisTreeNode.cpp

 r770 #define REMOVE_SLACK 1 #define BLIS_SLACK_MAX 3 #define BLIS_SLACK_MAX 10 //############################################################################# ++maxPass; } if (cutoff < ALPS_INC_MAX) { cutoff += BlisPar->entry(BlisParams::cutoffInc); } //------------------------------------------------------ //std::cout << "parentObjValue = " << parentObjValue << std::endl; if (parentObjValue - primalTolerance > cutoff) { if (parentObjValue > cutoff) { setStatus(AlpsNodeStatusFathomed); //std::cout << "fathom!" <getIncumbentValue(); cutoff += BlisPar->entry(BlisParams::cutoffInc); } setStatus(AlpsNodeStatusFathomed); else { cutoff = getKnowledgeBroker()->getIncumbentValue(); cutoff += BlisPar->entry(BlisParams::cutoffInc); if (quality_ > cutoff) { setStatus(AlpsNodeStatusFathomed); if (rowStatus == CoinWarmStartBasis::basic) { delIndices.push_back(k); int count; if (k < numStartRows) { if (tmpCon->getNumInactive() > BLIS_SLACK_MAX){ oldDelMark[(k-numCoreRows)] = 1; delIndices.push_back(k); } } if (tmpCon->getNumInactive() > BLIS_SLACK_MAX){ newDelMark[(k-numStartRows)] = 1; delIndices.push_back(k); } } numDelRows = delIndices.size(); #if 0 std::cout << "PROCESS: new cuts=" << numNewCons << ", slack cuts=" << numDelRows << ", numRows=" << numRows << ", numStartRows=" < 100) { std::cout << "PROCESS: new cuts=" << numNewCons << ", slack cuts=" << numDelRows << ", numRows=" << numRows << ", numStartRows=" < 0) { // Update cutoff cutoff = getKnowledgeBroker()->getIncumbentValue(); cutoff += BlisPar->entry(BlisParams::cutoffInc); if (quality_ > cutoff) { setStatus(AlpsNodeStatusFathomed); model->solver()->getObjValue(), model->solver()->getNumRows(), model->getCutoff()); cutoff; #endif if (lpFeasible) { setQuality(model->solver()->getObjValue() * model->solver()->getObjSense()); if (getQuality() > model->getCutoff()) { if (getQuality() > cutoff) { bStatus = -2; }
Note: See TracChangeset for help on using the changeset viewer.