Changeset 1095
 Timestamp:
 Sep 3, 2007 12:23:11 PM (12 years ago)
 Location:
 trunk/Clp/src
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Clp/src/ClpSimplexNonlinear.cpp
r1094 r1095 3364 3364 // Both these should be modified depending on problem 3365 3365 // Possibly start with big bounds 3366 double penalties[]={1.0e 2,1.0e3,1.0e9};3366 double penalties[]={1.0e3,1.0e7,1.0e9}; 3367 3367 //double bounds[] = {1.0e2,1.0,COIN_DBL_MAX}; 3368 double bounds[] = {1.0e 1,1.0e2,COIN_DBL_MAX};3368 double bounds[] = {1.0e2,1.0e2,COIN_DBL_MAX}; 3369 3369 // see how many extra we need 3370 3370 CoinBigIndex numberExtra=0; … … 3400 3400 } 3401 3401 int numberColumns2 = numberColumns_; 3402 int numberSmallGap = numberArtificials; 3402 3403 if (numberArtificials) { 3403 3404 numberArtificials *= SEGMENTS; … … 3444 3445 } 3445 3446 // find nonlinear columns 3446 int * listNonLinearColumn = new int [numberColumns_ ];3447 int * listNonLinearColumn = new int [numberColumns_+numberSmallGap]; 3447 3448 char * mark = new char[numberColumns_]; 3448 3449 memset(mark,0,numberColumns_); … … 3458 3459 if (mark[iColumn]) 3459 3460 listNonLinearColumn[numberNonLinearColumns++]=iColumn; 3461 } 3462 // and small gap artificials 3463 for (iColumn=numberColumns_;iColumn<numberColumns2;iColumn+=SEGMENTS) { 3464 listNonLinearColumn[numberNonLinearColumns++]=iColumn; 3460 3465 } 3461 3466 // build row copy of matrix with space for nonzeros … … 3601 3606 int iPass; 3602 3607 double lastObjective=1.0e31; 3608 double lastGoodObjective=1.0e31; 3609 double * bestSolution = NULL; 3603 3610 double * saveSolution = new double [numberColumns2+numberRows]; 3604 3611 char * saveStatus = new char [numberColumns2+numberRows]; … … 3722 3729 sumArt[jNon]=sumArt[jNon+1]; 3723 3730 sumArt[KEEP_SUM1]=sumInfeas; 3724 if (sumInfeas>0.01&&sumInfeas*1.1>sumArt[0]&& objective[numberColumns_+1]<1.0e5) {3731 if (sumInfeas>0.01&&sumInfeas*1.1>sumArt[0]&&penalties[1]<1.0e7) { 3725 3732 // not doing very well  increase  be more sophisticated later 3726 3733 lastObjective=COIN_DBL_MAX; 3727 3734 for (jNon=0;jNon<KEEP_SUM;jNon++) 3728 3735 sumArt[jNon]=COIN_DBL_MAX; 3729 for (iColumn=numberColumns_;iColumn<numberColumns2;iColumn+=SEGMENTS) { 3730 objective[iColumn+1] *= 1.5; 3731 } 3736 //for (iColumn=numberColumns_;iColumn<numberColumns2;iColumn+=SEGMENTS) { 3737 //objective[iColumn+1] *= 1.5; 3738 //} 3739 penalties[1] *= 1.5; 3732 3740 for (jNon=0;jNon<numberNonLinearColumns;jNon++) 3733 3741 if (trust[jNon]>0.1) … … 3858 3866 printf("offset2 %g ",objectiveOffset2); 3859 3867 objValue = objectiveOffset2; 3860 printf("True objective %g or maybe %g\n",objValue,objValue+objectiveOffset2); 3868 printf("True objective %g or maybe %g (with penalty %g) pen2 %g %g\n",objValue, 3869 objValue+objectiveOffset2,objValue+objectiveOffset2+infPenalty,infPenalty2,penalties[1]); 3870 double useObjValue = objValue+objectiveOffset2+infPenalty; 3861 3871 objValue += infPenalty+infPenalty2; 3872 objValue = useObjValue; 3862 3873 if (iPass) { 3863 3874 double drop = lastObjectiveobjValue; … … 3954 3965 <<", smallest nonlinear gap is "<<smallestNonLinearGap 3955 3966 <<std::endl; 3967 if (iPass>200) { 3968 //double useObjValue = objValue+objectiveOffset2+infPenalty; 3969 if (useObjValue+1.0e4> lastGoodObjective&&iPass>250) { 3970 std::cout<<"Exiting as objective not changing much"<<std::endl; 3971 break; 3972 } else if (useObjValue<lastGoodObjective) { 3973 lastGoodObjective = useObjValue; 3974 if (!bestSolution) 3975 bestSolution = new double [numberColumns2]; 3976 memcpy(bestSolution,solution,numberColumns2*sizeof(double)); 3977 } 3978 } 3956 3979 if (maxDelta<deltaTolerance&&!increasing&&iPass>100) { 3957 3980 numberZeroPasses++; … … 4063 4086 delete [] trueUpper; 4064 4087 delete [] trueLower; 4088 objectiveValue_=newModel.objectiveValue(); 4089 if (bestSolution) { 4090 memcpy(solution,bestSolution,numberColumns2*sizeof(double)); 4091 delete [] bestSolution; 4092 printf("restoring objective of %g\n",lastGoodObjective); 4093 objectiveValue_=lastGoodObjective; 4094 } 4065 4095 // Simplest way to get true row activity ? 4066 4096 double * rowActivity = newModel.primalRowSolution(); … … 4083 4113 delete [] gradient; 4084 4114 printf("solution still in newModel  do objective etc!\n"); 4085 objectiveValue_=newModel.objectiveValue();4086 4115 numberIterations_ =newModel.numberIterations(); 4087 4116 problemStatus_ =newModel.problemStatus(); 
trunk/Clp/src/ClpSimplexPrimal.cpp
r1088 r1095 662 662 } else if (returnCode!=1) { 663 663 assert(returnCode==3); 664 problemStatus_=3; 664 if (problemStatus_!=5) 665 problemStatus_=3; 665 666 } 666 667 } else { … … 2888 2889 problemStatus_=5; 2889 2890 secondaryStatus_=ClpEventHandler::endOfIteration; 2890 returnCode= 4;2891 returnCode=3; 2891 2892 } 2892 2893 }
Note: See TracChangeset
for help on using the changeset viewer.