# Changeset 1057

Ignore:
Timestamp:
Jul 31, 2007 5:33:14 AM (13 years ago)
Message:

nonlinear plus fixes to perturbation

Location:
trunk/Clp/src
Files:
3 edited

Unmodified
Added
Removed
• ## trunk/Clp/src/ClpSimplex.cpp

 r1056 //printf("ret after %d pivots\n",factorization_->pivots()); return 1; } else { if (forceFactorization_>0&& factorization_->pivots()==forceFactorization_) { // relax forceFactorization_ = (3+5*forceFactorization_)/4; if (forceFactorization_>factorization_->maximumPivots()) forceFactorization_ = -1; //off } else if (forceFactorization_>0&& factorization_->pivots()==forceFactorization_) { // relax forceFactorization_ = (3+5*forceFactorization_)/4; if (forceFactorization_>factorization_->maximumPivots()) forceFactorization_ = -1; //off return 1; } else if (numberIterations_>1000+10*(numberRows_+(numberColumns_>>2))) { double random = CoinDrand48(); int maxNumber = (forceFactorization_<0) ? maximumPivots : CoinMin(forceFactorization_,maximumPivots); if (factorization_->pivots()>=random*maxNumber) { return 1; } else if (numberIterations_>1000000+10*(numberRows_+(numberColumns_>>2))&& numberIterations_<1001000+10*(numberRows_+(numberColumns_>>2))) { return 1; } else { return 0; } } else { // carry on iterating return 0; } }
• ## trunk/Clp/src/ClpSimplexNonlinear.cpp

 r1056 int numberArtificials=0; // We could use nonlinearcost to do segments - maybe later #define SEGMENTS 3 #define SEGMENTS 3 // Penalties may be adjusted by duals // Both these should be modified depending on problem // Possibly start with big bounds double penalties[]={1.0e-2,1.0,1.0e9}; //double bounds[] = {1.0e-2,1.0,COIN_DBL_MAX}; double bounds[] = {1.0e-1,1.0e2,COIN_DBL_MAX}; // see how many extra we need CoinBigIndex numberExtra=0; } int numberColumns2 = numberColumns_; // Penalties may be adjusted by duals // Both these should be modified depending on problem double penalties[]={1.0e-2,1.0,1.0e9}; double bounds[] = {1.0e-2,1.0,COIN_DBL_MAX}; if (numberArtificials) { numberArtificials *= SEGMENTS; delete [] addUpper; delete [] addCost; //    newModel.primal(1); } // find nonlinear columns newModel.primal(1); // still infeasible if (newModel.numberPrimalInfeasibilities()) { if (newModel.problemStatus()==1) { delete [] listNonLinearColumn; return 0; } else if (newModel.problemStatus()==2) { // unbounded - add bounds double * columnLower = newModel.columnLower(); double * columnUpper = newModel.columnUpper(); for (int i=0;itrueUpper[jNon]) solution[iColumn]=trueUpper[jNon]; if (solution[iColumn]upper) solution[iColumn]=upper; #if 0 double large = CoinMax(1000.0,10.0*fabs(solution[iColumn])); } double infPenalty=0.0; // This penalty is for target drop double infPenalty2=0.0; for (iConstraint=0;iConstraint
• ## trunk/Clp/src/ClpSimplexPrimal.cpp

 r1034 // printf("Pert type %d perturbation %g, maxF %g\n",type,perturbation,maximumFraction); if (type==1) { double tolerance = 100.0*primalTolerance_; //double multiplier = perturbation*maximumFraction; for (iSequence=0;iSequencelowerValue+tolerance) { double solutionValue = solution_[iSequence]; double difference = upperValue-lowerValue; difference = CoinMin(difference,perturbation); difference = CoinMin(difference,fabs(solutionValue)+1.0); double value = maximumFraction*(difference+1.0); value = CoinMin(value,0.1); value *= CoinDrand48(); if (solutionValue-lowerValue<=primalTolerance_) { lower_[iSequence] -= value; } else if (upperValue-solutionValue<=primalTolerance_) { upper_[iSequence] += value; } else { #if 0 if (iSequence>=numberColumns_) { // may not be at bound - but still perturb (unless free) if (upperValue>1.0e30&&lowerValue<-1.0e30) value=0.0; else value = - value; // as -1.0 in matrix } else { value = 0.0; if (iSequence>=numberColumns_) { // may not be at bound - but still perturb (unless free) if (upperValue>1.0e30&&lowerValue<-1.0e30) value=0.0; else value = - value; // as -1.0 in matrix } else { value = 0.0; } #else value=0.0; #endif } #else value=0.0; #endif } if (value) { if (printOut) printf("col %d lower from %g to %g, upper from %g to %g\n", iSequence,lower_[iSequence],lowerValue,upper_[iSequence],upperValue); if (solutionValue) { largest = CoinMax(largest,value); if (value>(fabs(solutionValue)+1.0)*largestPerCent) largestPerCent=value/(fabs(solutionValue)+1.0); } else { largestZero = CoinMax(largestZero,value); } if (value) { if (printOut) printf("col %d lower from %g to %g, upper from %g to %g\n", iSequence,lower_[iSequence],lowerValue,upper_[iSequence],upperValue); if (solutionValue) { largest = CoinMax(largest,value); if (value>(fabs(solutionValue)+1.0)*largestPerCent) largestPerCent=value/(fabs(solutionValue)+1.0); } else { largestZero = CoinMax(largestZero,value); } } } }
Note: See TracChangeset for help on using the changeset viewer.