[Bonmin] does cpu time limit change the result?
Giuseppe Aprea
giuseppe.aprea at gmail.com
Wed Jul 8 09:25:46 EDT 2009
I know, it's again me. Please be patient and forgive me.
I am still not able to retrieve the solution from the code. It seems I
can't stop
bonmin.
Here is my main:
BonminSetup bonmin;
bonmin.initializeOptionsAndJournalist();
//Register an additional option
bonmin.roptions()->AddStringOption2("print_solution","Do we print
the solution or not?",
"yes",
"no", "No, we don't.",
"yes", "Yes, we do.",
"A longer comment can be put here");
// Here we can change the default value of some Bonmin or Ipopt option
//bonmin.options()->SetNumericValue("bonmin.time_limit", 5);
//changes bonmin's time limit
//bonmin.options()->SetStringValue("mu_oracle","loqo");
//Here we read several option files
bonmin.readOptionsFile("Mybonmin.opt");
bonmin.readOptionsFile();// This reads the default file "bonmin.opt"
// Options can also be set by using a string with a format similar
to the bonmin.opt file
// bonmin.readOptionsString("bonmin.algorithm B-BB\n");
// Now we can obtain the value of the new option
int printSolution;
bonmin.options()->GetEnumValue("print_solution", printSolution,"");
if(printSolution == 1){
tminlp->printSolutionAtEndOfAlgorithm();
}
//Now initialize from tminlp
bonmin.initialize(GetRawPtr(tminlp));
//Set up done, now let's branch and bound
double time1 = CoinCpuTime();
double sol[VARSNUM];
try {
Bab bb;
bb(bonmin);//process parameter file using Ipopt and do branch and
bound using Cbc
if(bb.bestSolution()!=NULL){
for(i=0;i<VARSNUM;i++){
sol[i]=*(bb.bestSolution()+i);
printf("\n%f",sol[i]);
}
}
else{
printf("\n\n\tNo feasible solution!\n\n");
}
printf("\n");
}
catch(TNLPSolver::UnsolvedError *E) {
//There has been a failure to solve a problem with Ipopt.
std::cerr<<"Ipopt has failed to solve a problem"<<std::endl;
}
catch(OsiTMINLPInterface::SimpleError &E) {
std::cerr<<E.className()<<"::"<<E.methodName()
<<std::endl
<<E.message()<<std::endl;
}
catch(CoinError &E) {
std::cerr<<E.className()<<"::"<<E.methodName()
<<std::endl
<<E.message()<<std::endl;
}
return 0;
here is the option file:
print_solution yes
#derivative_test second-order
bonmin.bb_log_level 5
bonmin.algorithm B-BB
#print_level 6
max_cpu_time 7200
#bound_relax_factor 1e-6
#bonmin.iteration_limit 4
bonmin.time_limit 60
and this is the output (the process is running since 11 hours despite
bonmin.time_limit set to 60!!!!):
CppExample$ make clean ; make ;time ./CppExample
rm -rf CppExample MyBonmin.o MyTMINLP.o
g++ -g -O0 -fomit-frame-pointer -pipe -DNDEBUG -pedantic-errors
-Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall
-Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas
-I`echo /home/gaprea/usr/local/include/coin` -I`echo
/home/gaprea/usr/local/include/coin/ipopt` -c -o MyBonmin.o `test -f
'MyBonmin.cpp' || echo '/'`MyBonmin.cpp
MyBonmin.cpp: In function ‘int main(int, char**)’:
MyBonmin.cpp:239: warning: unused variable ‘time1’
g++ -g -O0 -fomit-frame-pointer -pipe -DNDEBUG -pedantic-errors
-Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall
-Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas
-I`echo /home/gaprea/usr/local/include/coin` -I`echo
/home/gaprea/usr/local/include/coin/ipopt` -c -o MyTMINLP.o `test -f
'MyTMINLP.cpp' || echo '/'`MyTMINLP.cpp
bla=;\
for file in MyBonmin.o MyTMINLP.o; do bla="$bla `echo $file`"; done; \
g++ -Wl,--rpath -Wl,/home/gaprea/usr/local/lib -g -O0
-fomit-frame-pointer -pipe -DNDEBUG -pedantic-errors -Wimplicit
-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith
-Wwrite-strings -Wconversion -Wno-unknown-pragmas -o CppExample $bla
-L/home/gaprea/usr/local/lib -lbonmin -lipopt -lCbc -lCgl -lOsiClp
-lOsi -lClp -lCoinUtils
/home/gaprea/000_System_Biology/SOFTWARE/MINLP/Bonmin-1.0/build/ThirdParty/ASL/amplsolver.a
-ldl -lm `cat /home/gaprea/usr/local/lib/../share/doc/coin/Ipopt/ipopt_addlibs_cpp.txt`
`cat /home/gaprea/usr/local/lib/../share/doc/coin/Cgl/cgl_addlibs.txt`
`cat /home/gaprea/usr/local/lib/../share/doc/coin/Osi/osi_addlibs.txt`
`cat /home/gaprea/usr/local/lib/../share/doc/coin/Clp/clp_addlibs.txt`
`cat /home/gaprea/usr/local/lib/../share/doc/coin/CoinUtils/coinutils_addlibs.txt`
******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Common Public License (CPL).
For more information visit http://projects.coin-or.org/Ipopt
******************************************************************************
NOTE: You are using Ipopt by default with the MUMPS linear solver.
Other linear solvers might be more efficient (see Ipopt documentation).
NLP0012I
Num Status Obj It time
NLP0013I 1 OPT -75.00000003473977 492 890.812
BON0001I 105 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 104 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 103 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 102 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 101 up 0 0.00000000e+00 down 0 0.00000000e+00
....................................
BON0001I 13 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 12 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 11 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 10 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 9 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 8 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 7 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 6 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 5 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 4 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 3 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 2 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 1 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0001I 0 up 0 0.00000000e+00 down 0 0.00000000e+00
BON0002I upMultiplier = 1.000000e+00 downMultiplier = 1.000000e+00
BON0003I 0 value = 3.214075e-01 upEstimate = 5.351865e-02
downEstimate = 9.464813e-01 infeas = 5.351865e-02 value2 =
5.351865e-02
BON0003I 1 value = 3.218285e-01 upEstimate = 5.457120e-02
downEstimate = 9.454288e-01 infeas = 5.457120e-02 value2 =
5.457120e-02
BON0003I 2 value = 3.218306e-01 upEstimate = 5.457658e-02
downEstimate = 9.454234e-01 infeas = 5.457658e-02 value2 =
5.457658e-02
BON0003I 3 value = 3.215331e-01 upEstimate = 5.383283e-02
downEstimate = 9.461672e-01 infeas = 5.383283e-02 value2 =
5.383283e-02
......................................................
BON0003I 104 value = 3.229850e-01 upEstimate = 5.746239e-02
downEstimate = 9.425376e-01 infeas = 5.746239e-02 value2 =
5.746239e-02
BON0003I 105 value = 3.229850e-01 upEstimate = 5.746239e-02
downEstimate = 9.425376e-01 infeas = 5.746239e-02 value2 =
5.746239e-02
BON0005I list_[ 0] = 0 useful_[ 0] = -3.214075e-01
BON0005I list_[ 1] = 1 useful_[ 1] = -3.218285e-01
BON0005I list_[ 2] = 2 useful_[ 2] = -3.218306e-01
.........................................
BON0006I list2[ 50] = 50 useful2[ 50] = 5.756897e-02
BON0006I list2[ 51] = 68 useful2[ 51] = 5.706160e-02
BON0006I list2[ 52] = 52 useful2[ 52] = 5.756941e-02
BON0004I list_[ 0] = 21, usefull_[ 0] =
-1.0620419692890424e+150 6.2041969289042376e-02
BON0004I list_[ 1] = 65, usefull_[ 1] =
-1.0603499841862923e+150 6.0349984186292338e-02
BON0004I list_[ 2] = 45, usefull_[ 2] =
-1.0580582195624974e+150 5.8058219562497460e-02
BON0004I list_[ 3] = 62, usefull_[ 3] =
-1.0579476520448998e+150 5.7947652044899711e-02
........................................................
BON0004I list_[ 103] = 86, usefull_[ 103] =
-3.2140746297613371e-01 5.3518657440334128e-02
BON0004I list_[ 104] = 0, usefull_[ 104] =
-3.2140746165193834e-01 5.3518654129845800e-02
BON0004I list_[ 105] = 23, usefull_[ 105] =
-3.1875385045788662e-01 4.6884626144716446e-02
NLP0013I 2 OPT -75.00000003322431 574 505.896
NLP0013I 3 OPT -74.9999999873914 252 241.371
NLP0013I 4 OPT -74.99999998750623 523 529.597
NLP0013I 5 OPT -75.00000003116291 437 382.544
NLP0013I 6 OPT -74.99999998735127 378 265.133
NLP0013I 7 OPT -74.99999998749557 519 439.447
NLP0013I 8 OPT -74.9999999875126 445 315.852
NLP0013I 9 OPT -74.9999999874956 439 493.555
NLP0013I 10 OPT -75.00000003005148 569 670.742
NLP0013I 11 OPT -75.00000003466486 296 317.04
NLP0013I 12 OPT -75.00000003310092 435 460.289
NLP0013I 13 OPT -74.99999998737427 253 198.54
NLP0013I 14 OPT -74.99999998728373 547 337.825
NLP0013I 15 OPT -75.00000003314065 436 421.158
NLP0013I 16 OPT -74.99999998751224 668 767.376
NLP0013I 17 OPT -75.00000003492561 475 744.463
NLP0013I 18 OPT -74.99999998738807 569 510.66
NLP0013I 19 OPT -74.99999998751285 757 643.148
NLP0013I 20 OPT -74.9999999874247 549 551.082
NLP0012I
Num Status Obj It time
NLP0013I 21 OPT -75.00000003496038 450 454.336
NLP0013I 22 OPT -74.99999998752237 585 1072.19
NLP0013I 23 OPT -74.9999999874547 401 1041.68
NLP0013I 24 OPT -75.00000003262794 545 486.982
...............................................
NLP0013I 86 OPT -75.00000003314067 303 381.704
NLP0013I 87 OPT -74.99999998749439 165 281.238
NLP0013I 88 OPT -75.00000003234817 583 755.575
NLP0013I 89 OPT -74.99999998737553 325 291.038
NLP0013I 90 OPT -74.99999998737404 109 122.04
according to me there is no reason why it should be still running. I
really think that
Bonmin should have worked 60 secs in 11 hours. At least I have no
reason to think
different. I believe I have followed properly all instructions.
max_cpu_time is set to
2 hours to give time ipopt to solve the nlp problem, and I also tried
to push bb_log_level
to its maximum in order to peek in the solution but this is still
unreachable for me.
I have also tried to use the option iteration_limit (by the way, this
number has nothing
to do with the numbers in the second column of the output, does it?)
but it seem that
the right option to stop Bonmin should be bonmin.time_limit. Is 60 sec too much?
cheers,
Giuseppe
More information about the Bonmin
mailing list