Changeset 481


Ignore:
Timestamp:
Apr 24, 2007 11:16:07 AM (12 years ago)
Author:
pbonami
Message:

Change setup of Bonmin. New classes BabSetupBase?, BonminSetup?, CouenneSetup?

Location:
trunk/Bonmin
Files:
21 added
2 deleted
63 edited

Legend:

Unmodified
Added
Removed
  • trunk/Bonmin/configure

    r473 r481  
    11341134  --with-tags[=TAGS]
    11351135                          include additional configurations [automatic]
    1136   --with-cplex-incdir specify the directory with the header files for library
    1137                           Cplex
    1138   --with-cplex-lib specify the flags to link with the library Cplex
    1139   --with-glpk-incdir specify the directory with the header files for library
    1140                           Glpk
    1141   --with-glpk-lib specify the flags to link with the library Glpk
    1142   --with-fortmp-incdir specify the directory with the header files for library
    1143                           FortMP
    1144   --with-fortmp-lib specify the flags to link with the library FortMP
    1145   --with-mosek-incdir specify the directory with the header files for library
    1146                           Mosek
    1147   --with-mosek-lib specify the flags to link with the library Mosek
    1148   --with-osl-incdir specify the directory with the header files for library
    1149                           Osl
    1150   --with-osl-lib specify the flags to link with the library Osl
    1151   --with-soplex-incdir specify the directory with the header files for library
    1152                           Soplex
    1153   --with-soplex-lib specify the flags to link with the library Soplex
    1154   --with-xpress-incdir specify the directory with the header files for library
    1155                           Xpress
    1156   --with-xpress-lib specify the flags to link with the library Xpress
     1136  --with-cplex-incdir specify the header file directory for library Cplex
     1137  --with-cplex-lib specify the flags used to link with the library Cplex
     1138  --with-glpk-incdir specify the header file directory for library Glpk
     1139  --with-glpk-lib specify the flags used to link with the library Glpk
     1140  --with-fortmp-incdir specify the header file directory for library FortMP
     1141  --with-fortmp-lib specify the flags used to link with the library FortMP
     1142  --with-mosek-incdir specify the header file directory for library Mosek
     1143  --with-mosek-lib specify the flags used to link with the library Mosek
     1144  --with-osl-incdir specify the header file directory for library Osl
     1145  --with-osl-lib specify the flags used to link with the library Osl
     1146  --with-soplex-incdir specify the header file directory for library Soplex
     1147  --with-soplex-lib specify the flags used to link with the library Soplex
     1148  --with-xpress-incdir specify the header file directory for library Xpress
     1149  --with-xpress-lib specify the flags used to link with the library Xpress
    11571150  --with-asldir           specify path to AMPL solver directory (or BUILD for
    11581151                          compilation, or "no" for disabling AMPL)
     
    26402633        coin_add_cflags="-pipe"
    26412634        coin_dbg_cflags="-g"
    2642         coin_warn_cflags="-pedantic-errors -Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall"
     2635        coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall"
    26432636        case $enable_doscompile in
    26442637          mingw)
     
    34693462        coin_add_cxxflags="-pipe"
    34703463        coin_dbg_cxxflags="-g"
    3471         coin_warn_cxxflags="-pedantic-errors -Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion"
     3464        coin_warn_cxxflags="-Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion"
    34723465        case $enable_doscompile in
    34733466          mingw)
     
    40584051
    40594052# Provide some information about the compiler.
    4060 echo "$as_me:4060:" \
     4053echo "$as_me:4053:" \
    40614054     "checking for Fortran 77 compiler version" >&5
    40624055ac_compiler=`set X $ac_compile; echo $2`
     
    46214614ac_save_FFLAGS=$FFLAGS
    46224615FFLAGS="$FFLAGS $ac_verb"
    4623 (eval echo $as_me:4623: \"$ac_link\") >&5
     4616(eval echo $as_me:4616: \"$ac_link\") >&5
    46244617ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
    46254618echo "$ac_f77_v_output" >&5
     
    46994692ac_save_FFLAGS=$FFLAGS
    47004693FFLAGS="$FFLAGS $ac_cv_prog_f77_v"
    4701 (eval echo $as_me:4701: \"$ac_link\") >&5
     4694(eval echo $as_me:4694: \"$ac_link\") >&5
    47024695ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
    47034696echo "$ac_f77_v_output" >&5
     
    71837176*-*-irix6*)
    71847177  # Find out which ABI we are using.
    7185   echo '#line 7185 "configure"' > conftest.$ac_ext
     7178  echo '#line 7178 "configure"' > conftest.$ac_ext
    71867179  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
    71877180  (eval $ac_compile) 2>&5
     
    91639156   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    91649157   -e 's:$: $lt_compiler_flag:'`
    9165    (eval echo "\"\$as_me:9165: $lt_compile\"" >&5)
     9158   (eval echo "\"\$as_me:9158: $lt_compile\"" >&5)
    91669159   (eval "$lt_compile" 2>conftest.err)
    91679160   ac_status=$?
    91689161   cat conftest.err >&5
    9169    echo "$as_me:9169: \$? = $ac_status" >&5
     9162   echo "$as_me:9162: \$? = $ac_status" >&5
    91709163   if (exit $ac_status) && test -s "$ac_outfile"; then
    91719164     # The compiler can only warn and ignore the option if not recognized
     
    94319424   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    94329425   -e 's:$: $lt_compiler_flag:'`
    9433    (eval echo "\"\$as_me:9433: $lt_compile\"" >&5)
     9426   (eval echo "\"\$as_me:9426: $lt_compile\"" >&5)
    94349427   (eval "$lt_compile" 2>conftest.err)
    94359428   ac_status=$?
    94369429   cat conftest.err >&5
    9437    echo "$as_me:9437: \$? = $ac_status" >&5
     9430   echo "$as_me:9430: \$? = $ac_status" >&5
    94389431   if (exit $ac_status) && test -s "$ac_outfile"; then
    94399432     # The compiler can only warn and ignore the option if not recognized
     
    95359528   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    95369529   -e 's:$: $lt_compiler_flag:'`
    9537    (eval echo "\"\$as_me:9537: $lt_compile\"" >&5)
     9530   (eval echo "\"\$as_me:9530: $lt_compile\"" >&5)
    95389531   (eval "$lt_compile" 2>out/conftest.err)
    95399532   ac_status=$?
    95409533   cat out/conftest.err >&5
    9541    echo "$as_me:9541: \$? = $ac_status" >&5
     9534   echo "$as_me:9534: \$? = $ac_status" >&5
    95429535   if (exit $ac_status) && test -s out/conftest2.$ac_objext
    95439536   then
     
    1195211945  lt_status=$lt_dlunknown
    1195311946  cat > conftest.$ac_ext <<EOF
    11954 #line 11954 "configure"
     11947#line 11947 "configure"
    1195511948#include "confdefs.h"
    1195611949
     
    1205212045  lt_status=$lt_dlunknown
    1205312046  cat > conftest.$ac_ext <<EOF
    12054 #line 12054 "configure"
     12047#line 12047 "configure"
    1205512048#include "confdefs.h"
    1205612049
     
    1441114404   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1441214405   -e 's:$: $lt_compiler_flag:'`
    14413    (eval echo "\"\$as_me:14413: $lt_compile\"" >&5)
     14406   (eval echo "\"\$as_me:14406: $lt_compile\"" >&5)
    1441414407   (eval "$lt_compile" 2>conftest.err)
    1441514408   ac_status=$?
    1441614409   cat conftest.err >&5
    14417    echo "$as_me:14417: \$? = $ac_status" >&5
     14410   echo "$as_me:14410: \$? = $ac_status" >&5
    1441814411   if (exit $ac_status) && test -s "$ac_outfile"; then
    1441914412     # The compiler can only warn and ignore the option if not recognized
     
    1451514508   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1451614509   -e 's:$: $lt_compiler_flag:'`
    14517    (eval echo "\"\$as_me:14517: $lt_compile\"" >&5)
     14510   (eval echo "\"\$as_me:14510: $lt_compile\"" >&5)
    1451814511   (eval "$lt_compile" 2>out/conftest.err)
    1451914512   ac_status=$?
    1452014513   cat out/conftest.err >&5
    14521    echo "$as_me:14521: \$? = $ac_status" >&5
     14514   echo "$as_me:14514: \$? = $ac_status" >&5
    1452214515   if (exit $ac_status) && test -s out/conftest2.$ac_objext
    1452314516   then
     
    1608416077   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1608516078   -e 's:$: $lt_compiler_flag:'`
    16086    (eval echo "\"\$as_me:16086: $lt_compile\"" >&5)
     16079   (eval echo "\"\$as_me:16079: $lt_compile\"" >&5)
    1608716080   (eval "$lt_compile" 2>conftest.err)
    1608816081   ac_status=$?
    1608916082   cat conftest.err >&5
    16090    echo "$as_me:16090: \$? = $ac_status" >&5
     16083   echo "$as_me:16083: \$? = $ac_status" >&5
    1609116084   if (exit $ac_status) && test -s "$ac_outfile"; then
    1609216085     # The compiler can only warn and ignore the option if not recognized
     
    1618816181   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1618916182   -e 's:$: $lt_compiler_flag:'`
    16190    (eval echo "\"\$as_me:16190: $lt_compile\"" >&5)
     16183   (eval echo "\"\$as_me:16183: $lt_compile\"" >&5)
    1619116184   (eval "$lt_compile" 2>out/conftest.err)
    1619216185   ac_status=$?
    1619316186   cat out/conftest.err >&5
    16194    echo "$as_me:16194: \$? = $ac_status" >&5
     16187   echo "$as_me:16187: \$? = $ac_status" >&5
    1619516188   if (exit $ac_status) && test -s out/conftest2.$ac_objext
    1619616189   then
     
    1839418387   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1839518388   -e 's:$: $lt_compiler_flag:'`
    18396    (eval echo "\"\$as_me:18396: $lt_compile\"" >&5)
     18389   (eval echo "\"\$as_me:18389: $lt_compile\"" >&5)
    1839718390   (eval "$lt_compile" 2>conftest.err)
    1839818391   ac_status=$?
    1839918392   cat conftest.err >&5
    18400    echo "$as_me:18400: \$? = $ac_status" >&5
     18393   echo "$as_me:18393: \$? = $ac_status" >&5
    1840118394   if (exit $ac_status) && test -s "$ac_outfile"; then
    1840218395     # The compiler can only warn and ignore the option if not recognized
     
    1866218655   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1866318656   -e 's:$: $lt_compiler_flag:'`
    18664    (eval echo "\"\$as_me:18664: $lt_compile\"" >&5)
     18657   (eval echo "\"\$as_me:18657: $lt_compile\"" >&5)
    1866518658   (eval "$lt_compile" 2>conftest.err)
    1866618659   ac_status=$?
    1866718660   cat conftest.err >&5
    18668    echo "$as_me:18668: \$? = $ac_status" >&5
     18661   echo "$as_me:18661: \$? = $ac_status" >&5
    1866918662   if (exit $ac_status) && test -s "$ac_outfile"; then
    1867018663     # The compiler can only warn and ignore the option if not recognized
     
    1876618759   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    1876718760   -e 's:$: $lt_compiler_flag:'`
    18768    (eval echo "\"\$as_me:18768: $lt_compile\"" >&5)
     18761   (eval echo "\"\$as_me:18761: $lt_compile\"" >&5)
    1876918762   (eval "$lt_compile" 2>out/conftest.err)
    1877018763   ac_status=$?
    1877118764   cat out/conftest.err >&5
    18772    echo "$as_me:18772: \$? = $ac_status" >&5
     18765   echo "$as_me:18765: \$? = $ac_status" >&5
    1877318766   if (exit $ac_status) && test -s out/conftest2.$ac_objext
    1877418767   then
     
    2148221475            -e 's/$AR t/lib -nologo -list/' \
    2148321476            -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
    21484             -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \\
     21477            -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
    2148521478            -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \
    2148621479        libtool > conftest.bla
     
    2224522238# Check which third party solvers are available ToDo!
    2224622239
    22247 echo "$as_me:$LINENO: checking if user provides library for Cplex" >&5
     22240  echo "$as_me:$LINENO: checking if user provides library for Cplex" >&5
    2224822241echo $ECHO_N "checking if user provides library for Cplex... $ECHO_C" >&6
    2224922242
    2225022243# Check for header file directory
     22244
    2225122245
    2225222246# Check whether --with-cplex-incdir or --without-cplex-incdir was given.
     
    2225522249  CPXINCDIR=`cd $withval; pwd`
    2225622250fi;
     22251
    2225722252# Check for library directory
     22253
    2225822254
    2225922255# Check whether --with-cplex-lib or --without-cplex-lib was given.
     
    2226222258  CPXLIB=$withval
    2226322259fi;
     22260
    2226422261# Switch to disable library check if requested
    22265 # Check whether --enable-cplex-libcheck or --disable-cplex-libcheck was given.
     22262
     22263  # Check whether --enable-cplex-libcheck or --disable-cplex-libcheck was given.
    2226622264if test "${enable_cplex_libcheck+set}" = set; then
    2226722265  enableval="$enable_cplex_libcheck"
     
    2227122269fi;
    2227222270
    22273 if test x"$CPXINCDIR" != x || test x"$CPXLIB" != x; then
    22274   coin_has_cpx=true
    22275 else
    22276   coin_has_cpx=false
    22277 fi
    22278 
    22279 if test $coin_has_cpx = true; then
    22280 # Check either both arguments or none are given
    22281   if test x"$CPXINCDIR" = x || test x"$CPXLIB" = x; then
    22282     { { echo "$as_me:$LINENO: error: You need to specify both --with-cplex-incdir and --with-cplex-lib if you want to use library Cplex" >&5
    22283 echo "$as_me: error: You need to specify both --with-cplex-incdir and --with-cplex-lib if you want to use library Cplex" >&2;}
     22271# At this point, if we're going to use the library, both LBRYINCDIR and
     22272# LBRYLIB must be defined and not empty.
     22273
     22274  if test x"$CPXINCDIR" != x || test x"$CPXLIB" != x; then
     22275    if test x"$CPXINCDIR" = x || test x"$CPXLIB" = x; then
     22276      { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Cplex. Use --with-cplex-incdir of environment variable $CPXINCDIR to specify the include directory. Use --with-cplex-lib or environment variable $CPXLIB to specify link flags." >&5
     22277echo "$as_me: error: You need to specify both an include directory and link flags to use library Cplex. Use --with-cplex-incdir of environment variable $CPXINCDIR to specify the include directory. Use --with-cplex-lib or environment variable $CPXLIB to specify link flags." >&2;}
    2228422278   { (exit 1); exit 1; }; }
     22279    fi
     22280    coin_has_cpx=true
     22281    echo "$as_me:$LINENO: result: yes" >&5
     22282echo "${ECHO_T}yes" >&6
     22283  else
     22284    coin_has_cpx=false
     22285    echo "$as_me:$LINENO: result: no" >&5
     22286echo "${ECHO_T}no" >&6
    2228522287  fi
    22286   echo "$as_me:$LINENO: result: yes" >&5
    22287 echo "${ECHO_T}yes" >&6
    22288   # Check if the given header file is there
    22289   as_ac_File=`echo "ac_cv_file_$CPXINCDIR/cplex.h" | $as_tr_sh`
     22288
     22289# If we have instructions for use, consider header and link checks.
     22290
     22291  if test $coin_has_cpx = true; then
     22292
     22293# If argument 3 (file) is given, check for the file. Typically this will be a
     22294# header file, but that's not assumed.
     22295
     22296    as_ac_File=`echo "ac_cv_file_$CPXINCDIR/cplex.h" | $as_tr_sh`
    2229022297echo "$as_me:$LINENO: checking for $CPXINCDIR/cplex.h" >&5
    2229122298echo $ECHO_N "checking for $CPXINCDIR/cplex.h... $ECHO_C" >&6
     
    2231422321
    2231522322
    22316   # Check if the symbol is provided in the library
    22317   # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER
    22318   if test x"$cplex_libcheck" != xno; then
    22319                     coin_save_LIBS="$LIBS"
    22320                     LIBS="$CPXLIB $ADDLIBS"
    22321                     echo "$as_me:$LINENO: checking whether symbol CPXgetstat is available with CPX" >&5
    22322 echo $ECHO_N "checking whether symbol CPXgetstat is available with CPX... $ECHO_C" >&6
    22323                     ac_ext=c
     22323# Now see if we can link the function. There are arguments for and against
     22324# assuming argument 3 is a header file declaring the function. A correct
     22325# function declaration is the main argument in favour. Having to cope with
     22326# possible dependencies or other oddities are the main arguments against.
     22327# Force the use of C as the best single choice amongst C++, C, and Fortran.
     22328# Obviously, this has limits.
     22329
     22330    if test x"$cplex_libcheck" != xno; then
     22331           coin_save_LIBS="$LIBS"
     22332           LIBS="$CPXLIB $ADDLIBS"
     22333           coin_CPX_link=no
     22334           ac_ext=c
    2232422335ac_cpp='$CPP $CPPFLAGS'
    2232522336ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     
    2232722338ac_compiler_gnu=$ac_cv_c_compiler_gnu
    2232822339
    22329 # ToDo find out what to do about extern "C"
    22330 #                    AC_TRY_LINK([extern "C" {void CPXgetstat();}],[CPXgetstat()],
    22331                     cat >conftest.$ac_ext <<_ACEOF
     22340           for fnm in CPXgetstat ; do
     22341             echo "$as_me:$LINENO: checking whether symbol $fnm is available with CPX" >&5
     22342echo $ECHO_N "checking whether symbol $fnm is available with CPX... $ECHO_C" >&6
     22343             cat >conftest.$ac_ext <<_ACEOF
    2233222344/* confdefs.h.  */
    2233322345_ACEOF
     
    2233522347cat >>conftest.$ac_ext <<_ACEOF
    2233622348/* end confdefs.h.  */
    22337 void CPXgetstat();
     22349
    2233822350#ifdef F77_DUMMY_MAIN
    2233922351
     
    2234722359main ()
    2234822360{
    22349 CPXgetstat()
     22361$fnm()
    2235022362  ;
    2235122363  return 0;
     
    2237622388  echo "$as_me:$LINENO: result: yes" >&5
    2237722389echo "${ECHO_T}yes" >&6
     22390                  coin_CPX_link=yes
     22391                  break
    2237822392else
    2237922393  echo "$as_me: failed program was:" >&5
     
    2238222396echo "$as_me:$LINENO: result: no" >&5
    2238322397echo "${ECHO_T}no" >&6
    22384                                  { { echo "$as_me:$LINENO: error: Cannot find symbol CPXgetstat with CPX" >&5
    22385 echo "$as_me: error: Cannot find symbol CPXgetstat with CPX" >&2;}
    22386    { (exit 1); exit 1; }; }
    2238722398fi
    2238822399rm -f conftest.err conftest.$ac_objext \
    2238922400      conftest$ac_exeext conftest.$ac_ext
    22390                     ac_ext=f
     22401           done
     22402           ac_ext=f
    2239122403ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
    2239222404ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
    2239322405ac_compiler_gnu=$ac_cv_f77_compiler_gnu
    2239422406
    22395                     LIBS="$coin_save_LIBS"
    22396                   fi
    22397 
    22398   ADDLIBS="$CPXLIB $ADDLIBS"
     22407           if test x"$coin_CPX_link" = xyes ; then
     22408             LIBS="$coin_save_LIBS"
     22409           else
     22410             { { echo "$as_me:$LINENO: error: Cannot find symbol(s) CPXgetstat with CPX" >&5
     22411echo "$as_me: error: Cannot find symbol(s) CPXgetstat with CPX" >&2;}
     22412   { (exit 1); exit 1; }; }
     22413           fi
     22414         fi
     22415
     22416
     22417# If we make it this far, we've verified the file and linked the function. Add
     22418# the necessary link flags to ADDLIBS and define the preprocessor symbol
     22419# COIN_HAS_LBRY.
     22420
     22421    ADDLIBS="$CPXLIB $ADDLIBS"
    2239922422
    2240022423cat >>confdefs.h <<\_ACEOF
     
    2240222425_ACEOF
    2240322426
    22404 else
    22405   echo "$as_me:$LINENO: result: no" >&5
    22406 echo "${ECHO_T}no" >&6
    22407 fi
     22427  fi
     22428
     22429# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
     22430# automake conditional. These actions must occur unconditionally.
    2240822431
    2240922432
     
    2242122444
    2242222445
    22423 echo "$as_me:$LINENO: checking if user provides library for Glpk" >&5
     22446  echo "$as_me:$LINENO: checking if user provides library for Glpk" >&5
    2242422447echo $ECHO_N "checking if user provides library for Glpk... $ECHO_C" >&6
    2242522448
    2242622449# Check for header file directory
     22450
    2242722451
    2242822452# Check whether --with-glpk-incdir or --without-glpk-incdir was given.
     
    2243122455  GLPKINCDIR=`cd $withval; pwd`
    2243222456fi;
     22457
    2243322458# Check for library directory
     22459
    2243422460
    2243522461# Check whether --with-glpk-lib or --without-glpk-lib was given.
     
    2243822464  GLPKLIB=$withval
    2243922465fi;
     22466
    2244022467# Switch to disable library check if requested
    22441 # Check whether --enable-glpk-libcheck or --disable-glpk-libcheck was given.
     22468
     22469  # Check whether --enable-glpk-libcheck or --disable-glpk-libcheck was given.
    2244222470if test "${enable_glpk_libcheck+set}" = set; then
    2244322471  enableval="$enable_glpk_libcheck"
     
    2244722475fi;
    2244822476
    22449 if test x"$GLPKINCDIR" != x || test x"$GLPKLIB" != x; then
    22450   coin_has_glpk=true
    22451 else
    22452   coin_has_glpk=false
    22453 fi
    22454 
    22455 if test $coin_has_glpk = true; then
    22456 # Check either both arguments or none are given
    22457   if test x"$GLPKINCDIR" = x || test x"$GLPKLIB" = x; then
    22458     { { echo "$as_me:$LINENO: error: You need to specify both --with-glpk-incdir and --with-glpk-lib if you want to use library Glpk" >&5
    22459 echo "$as_me: error: You need to specify both --with-glpk-incdir and --with-glpk-lib if you want to use library Glpk" >&2;}
     22477# At this point, if we're going to use the library, both LBRYINCDIR and
     22478# LBRYLIB must be defined and not empty.
     22479
     22480  if test x"$GLPKINCDIR" != x || test x"$GLPKLIB" != x; then
     22481    if test x"$GLPKINCDIR" = x || test x"$GLPKLIB" = x; then
     22482      { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Glpk. Use --with-glpk-incdir of environment variable $GLPKINCDIR to specify the include directory. Use --with-glpk-lib or environment variable $GLPKLIB to specify link flags." >&5
     22483echo "$as_me: error: You need to specify both an include directory and link flags to use library Glpk. Use --with-glpk-incdir of environment variable $GLPKINCDIR to specify the include directory. Use --with-glpk-lib or environment variable $GLPKLIB to specify link flags." >&2;}
    2246022484   { (exit 1); exit 1; }; }
     22485    fi
     22486    coin_has_glpk=true
     22487    echo "$as_me:$LINENO: result: yes" >&5
     22488echo "${ECHO_T}yes" >&6
     22489  else
     22490    coin_has_glpk=false
     22491    echo "$as_me:$LINENO: result: no" >&5
     22492echo "${ECHO_T}no" >&6
    2246122493  fi
    22462   echo "$as_me:$LINENO: result: yes" >&5
    22463 echo "${ECHO_T}yes" >&6
    22464   # Check if the given header file is there
    22465   as_ac_File=`echo "ac_cv_file_$GLPKINCDIR/glpk.h" | $as_tr_sh`
     22494
     22495# If we have instructions for use, consider header and link checks.
     22496
     22497  if test $coin_has_glpk = true; then
     22498
     22499# If argument 3 (file) is given, check for the file. Typically this will be a
     22500# header file, but that's not assumed.
     22501
     22502    as_ac_File=`echo "ac_cv_file_$GLPKINCDIR/glpk.h" | $as_tr_sh`
    2246622503echo "$as_me:$LINENO: checking for $GLPKINCDIR/glpk.h" >&5
    2246722504echo $ECHO_N "checking for $GLPKINCDIR/glpk.h... $ECHO_C" >&6
     
    2249022527
    2249122528
    22492   # Check if the symbol is provided in the library
    22493   # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER
    22494   if test x"$glpk_libcheck" != xno; then
    22495                     coin_save_LIBS="$LIBS"
    22496                     LIBS="$GLPKLIB $ADDLIBS"
    22497                     echo "$as_me:$LINENO: checking whether symbol glp_lpx_simplex is available with GLPK" >&5
    22498 echo $ECHO_N "checking whether symbol glp_lpx_simplex is available with GLPK... $ECHO_C" >&6
    22499                     ac_ext=c
     22529# Now see if we can link the function. There are arguments for and against
     22530# assuming argument 3 is a header file declaring the function. A correct
     22531# function declaration is the main argument in favour. Having to cope with
     22532# possible dependencies or other oddities are the main arguments against.
     22533# Force the use of C as the best single choice amongst C++, C, and Fortran.
     22534# Obviously, this has limits.
     22535
     22536    if test x"$glpk_libcheck" != xno; then
     22537           coin_save_LIBS="$LIBS"
     22538           LIBS="$GLPKLIB $ADDLIBS"
     22539           coin_GLPK_link=no
     22540           ac_ext=c
    2250022541ac_cpp='$CPP $CPPFLAGS'
    2250122542ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     
    2250322544ac_compiler_gnu=$ac_cv_c_compiler_gnu
    2250422545
    22505 # ToDo find out what to do about extern "C"
    22506 #                    AC_TRY_LINK([extern "C" {void glp_lpx_simplex();}],[glp_lpx_simplex()],
    22507                     cat >conftest.$ac_ext <<_ACEOF
     22546           for fnm in glp_lpx_simplex ; do
     22547             echo "$as_me:$LINENO: checking whether symbol $fnm is available with GLPK" >&5
     22548echo $ECHO_N "checking whether symbol $fnm is available with GLPK... $ECHO_C" >&6
     22549             cat >conftest.$ac_ext <<_ACEOF
    2250822550/* confdefs.h.  */
    2250922551_ACEOF
     
    2251122553cat >>conftest.$ac_ext <<_ACEOF
    2251222554/* end confdefs.h.  */
    22513 void glp_lpx_simplex();
     22555
    2251422556#ifdef F77_DUMMY_MAIN
    2251522557
     
    2252322565main ()
    2252422566{
    22525 glp_lpx_simplex()
     22567$fnm()
    2252622568  ;
    2252722569  return 0;
     
    2255222594  echo "$as_me:$LINENO: result: yes" >&5
    2255322595echo "${ECHO_T}yes" >&6
     22596                  coin_GLPK_link=yes
     22597                  break
    2255422598else
    2255522599  echo "$as_me: failed program was:" >&5
     
    2255822602echo "$as_me:$LINENO: result: no" >&5
    2255922603echo "${ECHO_T}no" >&6
    22560                                  { { echo "$as_me:$LINENO: error: Cannot find symbol glp_lpx_simplex with GLPK" >&5
    22561 echo "$as_me: error: Cannot find symbol glp_lpx_simplex with GLPK" >&2;}
    22562    { (exit 1); exit 1; }; }
    2256322604fi
    2256422605rm -f conftest.err conftest.$ac_objext \
    2256522606      conftest$ac_exeext conftest.$ac_ext
    22566                     ac_ext=f
     22607           done
     22608           ac_ext=f
    2256722609ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
    2256822610ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
    2256922611ac_compiler_gnu=$ac_cv_f77_compiler_gnu
    2257022612
    22571                     LIBS="$coin_save_LIBS"
    22572                   fi
    22573 
    22574   ADDLIBS="$GLPKLIB $ADDLIBS"
     22613           if test x"$coin_GLPK_link" = xyes ; then
     22614             LIBS="$coin_save_LIBS"
     22615           else
     22616             { { echo "$as_me:$LINENO: error: Cannot find symbol(s) glp_lpx_simplex with GLPK" >&5
     22617echo "$as_me: error: Cannot find symbol(s) glp_lpx_simplex with GLPK" >&2;}
     22618   { (exit 1); exit 1; }; }
     22619           fi
     22620         fi
     22621
     22622
     22623# If we make it this far, we've verified the file and linked the function. Add
     22624# the necessary link flags to ADDLIBS and define the preprocessor symbol
     22625# COIN_HAS_LBRY.
     22626
     22627    ADDLIBS="$GLPKLIB $ADDLIBS"
    2257522628
    2257622629cat >>confdefs.h <<\_ACEOF
     
    2257822631_ACEOF
    2257922632
    22580 else
    22581   echo "$as_me:$LINENO: result: no" >&5
    22582 echo "${ECHO_T}no" >&6
    22583 fi
     22633  fi
     22634
     22635# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
     22636# automake conditional. These actions must occur unconditionally.
    2258422637
    2258522638
     
    2259722650
    2259822651
    22599 echo "$as_me:$LINENO: checking if user provides library for FortMP" >&5
     22652  echo "$as_me:$LINENO: checking if user provides library for FortMP" >&5
    2260022653echo $ECHO_N "checking if user provides library for FortMP... $ECHO_C" >&6
    2260122654
    2260222655# Check for header file directory
     22656
    2260322657
    2260422658# Check whether --with-fortmp-incdir or --without-fortmp-incdir was given.
     
    2260722661  FMPINCDIR=`cd $withval; pwd`
    2260822662fi;
     22663
    2260922664# Check for library directory
     22665
    2261022666
    2261122667# Check whether --with-fortmp-lib or --without-fortmp-lib was given.
     
    2261422670  FMPLIB=$withval
    2261522671fi;
     22672
    2261622673# Switch to disable library check if requested
    22617 # Check whether --enable-fortmp-libcheck or --disable-fortmp-libcheck was given.
     22674
     22675  # Check whether --enable-fortmp-libcheck or --disable-fortmp-libcheck was given.
    2261822676if test "${enable_fortmp_libcheck+set}" = set; then
    2261922677  enableval="$enable_fortmp_libcheck"
     
    2262322681fi;
    2262422682
    22625 if test x"$FMPINCDIR" != x || test x"$FMPLIB" != x; then
    22626   coin_has_fmp=true
    22627 else
    22628   coin_has_fmp=false
    22629 fi
    22630 
    22631 if test $coin_has_fmp = true; then
    22632 # Check either both arguments or none are given
    22633   if test x"$FMPINCDIR" = x || test x"$FMPLIB" = x; then
    22634     { { echo "$as_me:$LINENO: error: You need to specify both --with-fortmp-incdir and --with-fortmp-lib if you want to use library FortMP" >&5
    22635 echo "$as_me: error: You need to specify both --with-fortmp-incdir and --with-fortmp-lib if you want to use library FortMP" >&2;}
     22683# At this point, if we're going to use the library, both LBRYINCDIR and
     22684# LBRYLIB must be defined and not empty.
     22685
     22686  if test x"$FMPINCDIR" != x || test x"$FMPLIB" != x; then
     22687    if test x"$FMPINCDIR" = x || test x"$FMPLIB" = x; then
     22688      { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library FortMP. Use --with-fortmp-incdir of environment variable $FMPINCDIR to specify the include directory. Use --with-fortmp-lib or environment variable $FMPLIB to specify link flags." >&5
     22689echo "$as_me: error: You need to specify both an include directory and link flags to use library FortMP. Use --with-fortmp-incdir of environment variable $FMPINCDIR to specify the include directory. Use --with-fortmp-lib or environment variable $FMPLIB to specify link flags." >&2;}
    2263622690   { (exit 1); exit 1; }; }
     22691    fi
     22692    coin_has_fmp=true
     22693    echo "$as_me:$LINENO: result: yes" >&5
     22694echo "${ECHO_T}yes" >&6
     22695  else
     22696    coin_has_fmp=false
     22697    echo "$as_me:$LINENO: result: no" >&5
     22698echo "${ECHO_T}no" >&6
    2263722699  fi
    22638   echo "$as_me:$LINENO: result: yes" >&5
    22639 echo "${ECHO_T}yes" >&6
    22640   # Check if the given header file is there
    22641 
    22642   # Check if the symbol is provided in the library
    22643   # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER
    22644 
    22645   ADDLIBS="$FMPLIB $ADDLIBS"
     22700
     22701# If we have instructions for use, consider header and link checks.
     22702
     22703  if test $coin_has_fmp = true; then
     22704
     22705# If argument 3 (file) is given, check for the file. Typically this will be a
     22706# header file, but that's not assumed.
     22707
     22708
     22709
     22710# Now see if we can link the function. There are arguments for and against
     22711# assuming argument 3 is a header file declaring the function. A correct
     22712# function declaration is the main argument in favour. Having to cope with
     22713# possible dependencies or other oddities are the main arguments against.
     22714# Force the use of C as the best single choice amongst C++, C, and Fortran.
     22715# Obviously, this has limits.
     22716
     22717
     22718
     22719# If we make it this far, we've verified the file and linked the function. Add
     22720# the necessary link flags to ADDLIBS and define the preprocessor symbol
     22721# COIN_HAS_LBRY.
     22722
     22723    ADDLIBS="$FMPLIB $ADDLIBS"
    2264622724
    2264722725cat >>confdefs.h <<\_ACEOF
     
    2264922727_ACEOF
    2265022728
    22651 else
    22652   echo "$as_me:$LINENO: result: no" >&5
    22653 echo "${ECHO_T}no" >&6
    22654 fi
     22729  fi
     22730
     22731# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
     22732# automake conditional. These actions must occur unconditionally.
    2265522733
    2265622734
     
    2266822746  #ToDo! is Fortran?
    2266922747
    22670 echo "$as_me:$LINENO: checking if user provides library for Mosek" >&5
     22748  echo "$as_me:$LINENO: checking if user provides library for Mosek" >&5
    2267122749echo $ECHO_N "checking if user provides library for Mosek... $ECHO_C" >&6
    2267222750
    2267322751# Check for header file directory
     22752
    2267422753
    2267522754# Check whether --with-mosek-incdir or --without-mosek-incdir was given.
     
    2267822757  MSKINCDIR=`cd $withval; pwd`
    2267922758fi;
     22759
    2268022760# Check for library directory
     22761
    2268122762
    2268222763# Check whether --with-mosek-lib or --without-mosek-lib was given.
     
    2268522766  MSKLIB=$withval
    2268622767fi;
     22768
    2268722769# Switch to disable library check if requested
    22688 # Check whether --enable-mosek-libcheck or --disable-mosek-libcheck was given.
     22770
     22771  # Check whether --enable-mosek-libcheck or --disable-mosek-libcheck was given.
    2268922772if test "${enable_mosek_libcheck+set}" = set; then
    2269022773  enableval="$enable_mosek_libcheck"
     
    2269422777fi;
    2269522778
    22696 if test x"$MSKINCDIR" != x || test x"$MSKLIB" != x; then
    22697   coin_has_msk=true
    22698 else
    22699   coin_has_msk=false
    22700 fi
    22701 
    22702 if test $coin_has_msk = true; then
    22703 # Check either both arguments or none are given
    22704   if test x"$MSKINCDIR" = x || test x"$MSKLIB" = x; then
    22705     { { echo "$as_me:$LINENO: error: You need to specify both --with-mosek-incdir and --with-mosek-lib if you want to use library Mosek" >&5
    22706 echo "$as_me: error: You need to specify both --with-mosek-incdir and --with-mosek-lib if you want to use library Mosek" >&2;}
     22779# At this point, if we're going to use the library, both LBRYINCDIR and
     22780# LBRYLIB must be defined and not empty.
     22781
     22782  if test x"$MSKINCDIR" != x || test x"$MSKLIB" != x; then
     22783    if test x"$MSKINCDIR" = x || test x"$MSKLIB" = x; then
     22784      { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Mosek. Use --with-mosek-incdir of environment variable $MSKINCDIR to specify the include directory. Use --with-mosek-lib or environment variable $MSKLIB to specify link flags." >&5
     22785echo "$as_me: error: You need to specify both an include directory and link flags to use library Mosek. Use --with-mosek-incdir of environment variable $MSKINCDIR to specify the include directory. Use --with-mosek-lib or environment variable $MSKLIB to specify link flags." >&2;}
    2270722786   { (exit 1); exit 1; }; }
     22787    fi
     22788    coin_has_msk=true
     22789    echo "$as_me:$LINENO: result: yes" >&5
     22790echo "${ECHO_T}yes" >&6
     22791  else
     22792    coin_has_msk=false
     22793    echo "$as_me:$LINENO: result: no" >&5
     22794echo "${ECHO_T}no" >&6
    2270822795  fi
    22709   echo "$as_me:$LINENO: result: yes" >&5
    22710 echo "${ECHO_T}yes" >&6
    22711   # Check if the given header file is there
    22712   as_ac_File=`echo "ac_cv_file_$MSKINCDIR/mosekdl.h" | $as_tr_sh`
     22796
     22797# If we have instructions for use, consider header and link checks.
     22798
     22799  if test $coin_has_msk = true; then
     22800
     22801# If argument 3 (file) is given, check for the file. Typically this will be a
     22802# header file, but that's not assumed.
     22803
     22804    as_ac_File=`echo "ac_cv_file_$MSKINCDIR/mosekdl.h" | $as_tr_sh`
    2271322805echo "$as_me:$LINENO: checking for $MSKINCDIR/mosekdl.h" >&5
    2271422806echo $ECHO_N "checking for $MSKINCDIR/mosekdl.h... $ECHO_C" >&6
     
    2273722829
    2273822830
    22739   # Check if the symbol is provided in the library
    22740   # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER
    22741   if test x"$mosek_libcheck" != xno; then
    22742                     coin_save_LIBS="$LIBS"
    22743                     LIBS="$MSKLIB $ADDLIBS"
    22744                     echo "$as_me:$LINENO: checking whether symbol MSK_openmosek is available with MSK" >&5
    22745 echo $ECHO_N "checking whether symbol MSK_openmosek is available with MSK... $ECHO_C" >&6
    22746                     ac_ext=c
     22831# Now see if we can link the function. There are arguments for and against
     22832# assuming argument 3 is a header file declaring the function. A correct
     22833# function declaration is the main argument in favour. Having to cope with
     22834# possible dependencies or other oddities are the main arguments against.
     22835# Force the use of C as the best single choice amongst C++, C, and Fortran.
     22836# Obviously, this has limits.
     22837
     22838    if test x"$mosek_libcheck" != xno; then
     22839           coin_save_LIBS="$LIBS"
     22840           LIBS="$MSKLIB $ADDLIBS"
     22841           coin_MSK_link=no
     22842           ac_ext=c
    2274722843ac_cpp='$CPP $CPPFLAGS'
    2274822844ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     
    2275022846ac_compiler_gnu=$ac_cv_c_compiler_gnu
    2275122847
    22752 # ToDo find out what to do about extern "C"
    22753 #                    AC_TRY_LINK([extern "C" {void MSK_openmosek();}],[MSK_openmosek()],
    22754                     cat >conftest.$ac_ext <<_ACEOF
     22848           for fnm in MSK_openmosek ; do
     22849             echo "$as_me:$LINENO: checking whether symbol $fnm is available with MSK" >&5
     22850echo $ECHO_N "checking whether symbol $fnm is available with MSK... $ECHO_C" >&6
     22851             cat >conftest.$ac_ext <<_ACEOF
    2275522852/* confdefs.h.  */
    2275622853_ACEOF
     
    2275822855cat >>conftest.$ac_ext <<_ACEOF
    2275922856/* end confdefs.h.  */
    22760 void MSK_openmosek();
     22857
    2276122858#ifdef F77_DUMMY_MAIN
    2276222859
     
    2277022867main ()
    2277122868{
    22772 MSK_openmosek()
     22869$fnm()
    2277322870  ;
    2277422871  return 0;
     
    2279922896  echo "$as_me:$LINENO: result: yes" >&5
    2280022897echo "${ECHO_T}yes" >&6
     22898                  coin_MSK_link=yes
     22899                  break
    2280122900else
    2280222901  echo "$as_me: failed program was:" >&5
     
    2280522904echo "$as_me:$LINENO: result: no" >&5
    2280622905echo "${ECHO_T}no" >&6
    22807                                  { { echo "$as_me:$LINENO: error: Cannot find symbol MSK_openmosek with MSK" >&5
    22808 echo "$as_me: error: Cannot find symbol MSK_openmosek with MSK" >&2;}
    22809    { (exit 1); exit 1; }; }
    2281022906fi
    2281122907rm -f conftest.err conftest.$ac_objext \
    2281222908      conftest$ac_exeext conftest.$ac_ext
    22813                     ac_ext=f
     22909           done
     22910           ac_ext=f
    2281422911ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
    2281522912ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
    2281622913ac_compiler_gnu=$ac_cv_f77_compiler_gnu
    2281722914
    22818                     LIBS="$coin_save_LIBS"
    22819                   fi
    22820 
    22821   ADDLIBS="$MSKLIB $ADDLIBS"
     22915           if test x"$coin_MSK_link" = xyes ; then
     22916             LIBS="$coin_save_LIBS"
     22917           else
     22918             { { echo "$as_me:$LINENO: error: Cannot find symbol(s) MSK_openmosek with MSK" >&5
     22919echo "$as_me: error: Cannot find symbol(s) MSK_openmosek with MSK" >&2;}
     22920   { (exit 1); exit 1; }; }
     22921           fi
     22922         fi
     22923
     22924
     22925# If we make it this far, we've verified the file and linked the function. Add
     22926# the necessary link flags to ADDLIBS and define the preprocessor symbol
     22927# COIN_HAS_LBRY.
     22928
     22929    ADDLIBS="$MSKLIB $ADDLIBS"
    2282222930
    2282322931cat >>confdefs.h <<\_ACEOF
     
    2282522933_ACEOF
    2282622934
    22827 else
    22828   echo "$as_me:$LINENO: result: no" >&5
    22829 echo "${ECHO_T}no" >&6
    22830 fi
     22935  fi
     22936
     22937# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
     22938# automake conditional. These actions must occur unconditionally.
    2283122939
    2283222940
     
    2284422952
    2284522953
    22846 echo "$as_me:$LINENO: checking if user provides library for Osl" >&5
     22954  echo "$as_me:$LINENO: checking if user provides library for Osl" >&5
    2284722955echo $ECHO_N "checking if user provides library for Osl... $ECHO_C" >&6
    2284822956
    2284922957# Check for header file directory
     22958
    2285022959
    2285122960# Check whether --with-osl-incdir or --without-osl-incdir was given.
     
    2285422963  OSLINCDIR=`cd $withval; pwd`
    2285522964fi;
     22965
    2285622966# Check for library directory
     22967
    2285722968
    2285822969# Check whether --with-osl-lib or --without-osl-lib was given.
     
    2286122972  OSLLIB=$withval
    2286222973fi;
     22974
    2286322975# Switch to disable library check if requested
    22864 # Check whether --enable-osl-libcheck or --disable-osl-libcheck was given.
     22976
     22977  # Check whether --enable-osl-libcheck or --disable-osl-libcheck was given.
    2286522978if test "${enable_osl_libcheck+set}" = set; then
    2286622979  enableval="$enable_osl_libcheck"
     
    2287022983fi;
    2287122984
    22872 if test x"$OSLINCDIR" != x || test x"$OSLLIB" != x; then
    22873   coin_has_osl=true
    22874 else
    22875   coin_has_osl=false
    22876 fi
    22877 
    22878 if test $coin_has_osl = true; then
    22879 # Check either both arguments or none are given
    22880   if test x"$OSLINCDIR" = x || test x"$OSLLIB" = x; then
    22881     { { echo "$as_me:$LINENO: error: You need to specify both --with-osl-incdir and --with-osl-lib if you want to use library Osl" >&5
    22882 echo "$as_me: error: You need to specify both --with-osl-incdir and --with-osl-lib if you want to use library Osl" >&2;}
     22985# At this point, if we're going to use the library, both LBRYINCDIR and
     22986# LBRYLIB must be defined and not empty.
     22987
     22988  if test x"$OSLINCDIR" != x || test x"$OSLLIB" != x; then
     22989    if test x"$OSLINCDIR" = x || test x"$OSLLIB" = x; then
     22990      { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Osl. Use --with-osl-incdir of environment variable $OSLINCDIR to specify the include directory. Use --with-osl-lib or environment variable $OSLLIB to specify link flags." >&5
     22991echo "$as_me: error: You need to specify both an include directory and link flags to use library Osl. Use --with-osl-incdir of environment variable $OSLINCDIR to specify the include directory. Use --with-osl-lib or environment variable $OSLLIB to specify link flags." >&2;}
    2288322992   { (exit 1); exit 1; }; }
     22993    fi
     22994    coin_has_osl=true
     22995    echo "$as_me:$LINENO: result: yes" >&5
     22996echo "${ECHO_T}yes" >&6
     22997  else
     22998    coin_has_osl=false
     22999    echo "$as_me:$LINENO: result: no" >&5
     23000echo "${ECHO_T}no" >&6
    2288423001  fi
    22885   echo "$as_me:$LINENO: result: yes" >&5
    22886 echo "${ECHO_T}yes" >&6
    22887   # Check if the given header file is there
    22888   as_ac_File=`echo "ac_cv_file_$OSLINCDIR/ekk_c_api.h" | $as_tr_sh`
     23002
     23003# If we have instructions for use, consider header and link checks.
     23004
     23005  if test $coin_has_osl = true; then
     23006
     23007# If argument 3 (file) is given, check for the file. Typically this will be a
     23008# header file, but that's not assumed.
     23009
     23010    as_ac_File=`echo "ac_cv_file_$OSLINCDIR/ekk_c_api.h" | $as_tr_sh`
    2288923011echo "$as_me:$LINENO: checking for $OSLINCDIR/ekk_c_api.h" >&5
    2289023012echo $ECHO_N "checking for $OSLINCDIR/ekk_c_api.h... $ECHO_C" >&6
     
    2291323035
    2291423036
    22915   # Check if the symbol is provided in the library
    22916   # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER
    22917   if test x"$osl_libcheck" != xno; then
    22918                     coin_save_LIBS="$LIBS"
    22919                     LIBS="$OSLLIB $ADDLIBS"
    22920                     echo "$as_me:$LINENO: checking whether symbol ekk_simplex is available with OSL" >&5
    22921 echo $ECHO_N "checking whether symbol ekk_simplex is available with OSL... $ECHO_C" >&6
    22922                     ac_ext=c
     23037# Now see if we can link the function. There are arguments for and against
     23038# assuming argument 3 is a header file declaring the function. A correct
     23039# function declaration is the main argument in favour. Having to cope with
     23040# possible dependencies or other oddities are the main arguments against.
     23041# Force the use of C as the best single choice amongst C++, C, and Fortran.
     23042# Obviously, this has limits.
     23043
     23044    if test x"$osl_libcheck" != xno; then
     23045           coin_save_LIBS="$LIBS"
     23046           LIBS="$OSLLIB $ADDLIBS"
     23047           coin_OSL_link=no
     23048           ac_ext=c
    2292323049ac_cpp='$CPP $CPPFLAGS'
    2292423050ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     
    2292623052ac_compiler_gnu=$ac_cv_c_compiler_gnu
    2292723053
    22928 # ToDo find out what to do about extern "C"
    22929 #                    AC_TRY_LINK([extern "C" {void ekk_simplex();}],[ekk_simplex()],
    22930                     cat >conftest.$ac_ext <<_ACEOF
     23054           for fnm in ekk_simplex ; do
     23055             echo "$as_me:$LINENO: checking whether symbol $fnm is available with OSL" >&5
     23056echo $ECHO_N "checking whether symbol $fnm is available with OSL... $ECHO_C" >&6
     23057             cat >conftest.$ac_ext <<_ACEOF
    2293123058/* confdefs.h.  */
    2293223059_ACEOF
     
    2293423061cat >>conftest.$ac_ext <<_ACEOF
    2293523062/* end confdefs.h.  */
    22936 void ekk_simplex();
     23063
    2293723064#ifdef F77_DUMMY_MAIN
    2293823065
     
    2294623073main ()
    2294723074{
    22948 ekk_simplex()
     23075$fnm()
    2294923076  ;
    2295023077  return 0;
     
    2297523102  echo "$as_me:$LINENO: result: yes" >&5
    2297623103echo "${ECHO_T}yes" >&6
     23104                  coin_OSL_link=yes
     23105                  break
    2297723106else
    2297823107  echo "$as_me: failed program was:" >&5
     
    2298123110echo "$as_me:$LINENO: result: no" >&5
    2298223111echo "${ECHO_T}no" >&6
    22983                                  { { echo "$as_me:$LINENO: error: Cannot find symbol ekk_simplex with OSL" >&5
    22984 echo "$as_me: error: Cannot find symbol ekk_simplex with OSL" >&2;}
    22985    { (exit 1); exit 1; }; }
    2298623112fi
    2298723113rm -f conftest.err conftest.$ac_objext \
    2298823114      conftest$ac_exeext conftest.$ac_ext
    22989                     ac_ext=f
     23115           done
     23116           ac_ext=f
    2299023117ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
    2299123118ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
    2299223119ac_compiler_gnu=$ac_cv_f77_compiler_gnu
    2299323120
    22994                     LIBS="$coin_save_LIBS"
    22995                   fi
    22996 
    22997   ADDLIBS="$OSLLIB $ADDLIBS"
     23121           if test x"$coin_OSL_link" = xyes ; then
     23122             LIBS="$coin_save_LIBS"
     23123           else
     23124             { { echo "$as_me:$LINENO: error: Cannot find symbol(s) ekk_simplex with OSL" >&5
     23125echo "$as_me: error: Cannot find symbol(s) ekk_simplex with OSL" >&2;}
     23126   { (exit 1); exit 1; }; }
     23127           fi
     23128         fi
     23129
     23130
     23131# If we make it this far, we've verified the file and linked the function. Add
     23132# the necessary link flags to ADDLIBS and define the preprocessor symbol
     23133# COIN_HAS_LBRY.
     23134
     23135    ADDLIBS="$OSLLIB $ADDLIBS"
    2299823136
    2299923137cat >>confdefs.h <<\_ACEOF
     
    2300123139_ACEOF
    2300223140
    23003 else
    23004   echo "$as_me:$LINENO: result: no" >&5
    23005 echo "${ECHO_T}no" >&6
    23006 fi
     23141  fi
     23142
     23143# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
     23144# automake conditional. These actions must occur unconditionally.
    2300723145
    2300823146
     
    2302023158
    2302123159
    23022 echo "$as_me:$LINENO: checking if user provides library for Soplex" >&5
     23160  echo "$as_me:$LINENO: checking if user provides library for Soplex" >&5
    2302323161echo $ECHO_N "checking if user provides library for Soplex... $ECHO_C" >&6
    2302423162
    2302523163# Check for header file directory
     23164
    2302623165
    2302723166# Check whether --with-soplex-incdir or --without-soplex-incdir was given.
     
    2303023169  SPXINCDIR=`cd $withval; pwd`
    2303123170fi;
     23171
    2303223172# Check for library directory
     23173
    2303323174
    2303423175# Check whether --with-soplex-lib or --without-soplex-lib was given.
     
    2303723178  SPXLIB=$withval
    2303823179fi;
     23180
    2303923181# Switch to disable library check if requested
    23040 # Check whether --enable-soplex-libcheck or --disable-soplex-libcheck was given.
     23182
     23183  # Check whether --enable-soplex-libcheck or --disable-soplex-libcheck was given.
    2304123184if test "${enable_soplex_libcheck+set}" = set; then
    2304223185  enableval="$enable_soplex_libcheck"
     
    2304623189fi;
    2304723190
    23048 if test x"$SPXINCDIR" != x || test x"$SPXLIB" != x; then
    23049   coin_has_spx=true
    23050 else
    23051   coin_has_spx=false
    23052 fi
    23053 
    23054 if test $coin_has_spx = true; then
    23055 # Check either both arguments or none are given
    23056   if test x"$SPXINCDIR" = x || test x"$SPXLIB" = x; then
    23057     { { echo "$as_me:$LINENO: error: You need to specify both --with-soplex-incdir and --with-soplex-lib if you want to use library Soplex" >&5
    23058 echo "$as_me: error: You need to specify both --with-soplex-incdir and --with-soplex-lib if you want to use library Soplex" >&2;}
     23191# At this point, if we're going to use the library, both LBRYINCDIR and
     23192# LBRYLIB must be defined and not empty.
     23193
     23194  if test x"$SPXINCDIR" != x || test x"$SPXLIB" != x; then
     23195    if test x"$SPXINCDIR" = x || test x"$SPXLIB" = x; then
     23196      { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Soplex. Use --with-soplex-incdir of environment variable $SPXINCDIR to specify the include directory. Use --with-soplex-lib or environment variable $SPXLIB to specify link flags." >&5
     23197echo "$as_me: error: You need to specify both an include directory and link flags to use library Soplex. Use --with-soplex-incdir of environment variable $SPXINCDIR to specify the include directory. Use --with-soplex-lib or environment variable $SPXLIB to specify link flags." >&2;}
    2305923198   { (exit 1); exit 1; }; }
     23199    fi
     23200    coin_has_spx=true
     23201    echo "$as_me:$LINENO: result: yes" >&5
     23202echo "${ECHO_T}yes" >&6
     23203  else
     23204    coin_has_spx=false
     23205    echo "$as_me:$LINENO: result: no" >&5
     23206echo "${ECHO_T}no" >&6
    2306023207  fi
    23061   echo "$as_me:$LINENO: result: yes" >&5
    23062 echo "${ECHO_T}yes" >&6
    23063   # Check if the given header file is there
    23064   as_ac_File=`echo "ac_cv_file_$SPXINCDIR/spxsolver.h" | $as_tr_sh`
     23208
     23209# If we have instructions for use, consider header and link checks.
     23210
     23211  if test $coin_has_spx = true; then
     23212
     23213# If argument 3 (file) is given, check for the file. Typically this will be a
     23214# header file, but that's not assumed.
     23215
     23216    as_ac_File=`echo "ac_cv_file_$SPXINCDIR/spxsolver.h" | $as_tr_sh`
    2306523217echo "$as_me:$LINENO: checking for $SPXINCDIR/spxsolver.h" >&5
    2306623218echo $ECHO_N "checking for $SPXINCDIR/spxsolver.h... $ECHO_C" >&6
     
    2308923241
    2309023242
    23091   # Check if the symbol is provided in the library
    23092   # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER
    23093 
    23094   ADDLIBS="$SPXLIB $ADDLIBS"
     23243# Now see if we can link the function. There are arguments for and against
     23244# assuming argument 3 is a header file declaring the function. A correct
     23245# function declaration is the main argument in favour. Having to cope with
     23246# possible dependencies or other oddities are the main arguments against.
     23247# Force the use of C as the best single choice amongst C++, C, and Fortran.
     23248# Obviously, this has limits.
     23249
     23250
     23251
     23252# If we make it this far, we've verified the file and linked the function. Add
     23253# the necessary link flags to ADDLIBS and define the preprocessor symbol
     23254# COIN_HAS_LBRY.
     23255
     23256    ADDLIBS="$SPXLIB $ADDLIBS"
    2309523257
    2309623258cat >>confdefs.h <<\_ACEOF
     
    2309823260_ACEOF
    2309923261
    23100 else
    23101   echo "$as_me:$LINENO: result: no" >&5
    23102 echo "${ECHO_T}no" >&6
    23103 fi
     23262  fi
     23263
     23264# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
     23265# automake conditional. These actions must occur unconditionally.
    2310423266
    2310523267
     
    2311723279 # ToDo
    2311823280
    23119 echo "$as_me:$LINENO: checking if user provides library for Xpress" >&5
     23281  echo "$as_me:$LINENO: checking if user provides library for Xpress" >&5
    2312023282echo $ECHO_N "checking if user provides library for Xpress... $ECHO_C" >&6
    2312123283
    2312223284# Check for header file directory
     23285
    2312323286
    2312423287# Check whether --with-xpress-incdir or --without-xpress-incdir was given.
     
    2312723290  XPRINCDIR=`cd $withval; pwd`
    2312823291fi;
     23292
    2312923293# Check for library directory
     23294
    2313023295
    2313123296# Check whether --with-xpress-lib or --without-xpress-lib was given.
     
    2313423299  XPRLIB=$withval
    2313523300fi;
     23301
    2313623302# Switch to disable library check if requested
    23137 # Check whether --enable-xpress-libcheck or --disable-xpress-libcheck was given.
     23303
     23304  # Check whether --enable-xpress-libcheck or --disable-xpress-libcheck was given.
    2313823305if test "${enable_xpress_libcheck+set}" = set; then
    2313923306  enableval="$enable_xpress_libcheck"
     
    2314323310fi;
    2314423311
    23145 if test x"$XPRINCDIR" != x || test x"$XPRLIB" != x; then
    23146   coin_has_xpr=true
    23147 else
    23148   coin_has_xpr=false
    23149 fi
    23150 
    23151 if test $coin_has_xpr = true; then
    23152 # Check either both arguments or none are given
    23153   if test x"$XPRINCDIR" = x || test x"$XPRLIB" = x; then
    23154     { { echo "$as_me:$LINENO: error: You need to specify both --with-xpress-incdir and --with-xpress-lib if you want to use library Xpress" >&5
    23155 echo "$as_me: error: You need to specify both --with-xpress-incdir and --with-xpress-lib if you want to use library Xpress" >&2;}
     23312# At this point, if we're going to use the library, both LBRYINCDIR and
     23313# LBRYLIB must be defined and not empty.
     23314
     23315  if test x"$XPRINCDIR" != x || test x"$XPRLIB" != x; then
     23316    if test x"$XPRINCDIR" = x || test x"$XPRLIB" = x; then
     23317      { { echo "$as_me:$LINENO: error: You need to specify both an include directory and link flags to use library Xpress. Use --with-xpress-incdir of environment variable $XPRINCDIR to specify the include directory. Use --with-xpress-lib or environment variable $XPRLIB to specify link flags." >&5
     23318echo "$as_me: error: You need to specify both an include directory and link flags to use library Xpress. Use --with-xpress-incdir of environment variable $XPRINCDIR to specify the include directory. Use --with-xpress-lib or environment variable $XPRLIB to specify link flags." >&2;}
    2315623319   { (exit 1); exit 1; }; }
     23320    fi
     23321    coin_has_xpr=true
     23322    echo "$as_me:$LINENO: result: yes" >&5
     23323echo "${ECHO_T}yes" >&6
     23324  else
     23325    coin_has_xpr=false
     23326    echo "$as_me:$LINENO: result: no" >&5
     23327echo "${ECHO_T}no" >&6
    2315723328  fi
    23158   echo "$as_me:$LINENO: result: yes" >&5
    23159 echo "${ECHO_T}yes" >&6
    23160   # Check if the given header file is there
    23161   as_ac_File=`echo "ac_cv_file_$XPRINCDIR/xprs.h" | $as_tr_sh`
     23329
     23330# If we have instructions for use, consider header and link checks.
     23331
     23332  if test $coin_has_xpr = true; then
     23333
     23334# If argument 3 (file) is given, check for the file. Typically this will be a
     23335# header file, but that's not assumed.
     23336
     23337    as_ac_File=`echo "ac_cv_file_$XPRINCDIR/xprs.h" | $as_tr_sh`
    2316223338echo "$as_me:$LINENO: checking for $XPRINCDIR/xprs.h" >&5
    2316323339echo $ECHO_N "checking for $XPRINCDIR/xprs.h... $ECHO_C" >&6
     
    2318623362
    2318723363
    23188   # Check if the symbol is provided in the library
    23189   # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER
    23190   if test x"$xpress_libcheck" != xno; then
    23191                     coin_save_LIBS="$LIBS"
    23192                     LIBS="$XPRLIB $ADDLIBS"
    23193                     echo "$as_me:$LINENO: checking whether symbol XPRSsetintcontrol is available with XPR" >&5
    23194 echo $ECHO_N "checking whether symbol XPRSsetintcontrol is available with XPR... $ECHO_C" >&6
    23195                     ac_ext=c
     23364# Now see if we can link the function. There are arguments for and against
     23365# assuming argument 3 is a header file declaring the function. A correct
     23366# function declaration is the main argument in favour. Having to cope with
     23367# possible dependencies or other oddities are the main arguments against.
     23368# Force the use of C as the best single choice amongst C++, C, and Fortran.
     23369# Obviously, this has limits.
     23370
     23371    if test x"$xpress_libcheck" != xno; then
     23372           coin_save_LIBS="$LIBS"
     23373           LIBS="$XPRLIB $ADDLIBS"
     23374           coin_XPR_link=no
     23375           ac_ext=c
    2319623376ac_cpp='$CPP $CPPFLAGS'
    2319723377ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
     
    2319923379ac_compiler_gnu=$ac_cv_c_compiler_gnu
    2320023380
    23201 # ToDo find out what to do about extern "C"
    23202 #                    AC_TRY_LINK([extern "C" {void XPRSsetintcontrol();}],[XPRSsetintcontrol()],
    23203                     cat >conftest.$ac_ext <<_ACEOF
     23381           for fnm in XPRSsetintcontrol ; do
     23382             echo "$as_me:$LINENO: checking whether symbol $fnm is available with XPR" >&5
     23383echo $ECHO_N "checking whether symbol $fnm is available with XPR... $ECHO_C" >&6
     23384             cat >conftest.$ac_ext <<_ACEOF
    2320423385/* confdefs.h.  */
    2320523386_ACEOF
     
    2320723388cat >>conftest.$ac_ext <<_ACEOF
    2320823389/* end confdefs.h.  */
    23209 void XPRSsetintcontrol();
     23390
    2321023391#ifdef F77_DUMMY_MAIN
    2321123392
     
    2321923400main ()
    2322023401{
    23221 XPRSsetintcontrol()
     23402$fnm()
    2322223403  ;
    2322323404  return 0;
     
    2324823429  echo "$as_me:$LINENO: result: yes" >&5
    2324923430echo "${ECHO_T}yes" >&6
     23431                  coin_XPR_link=yes
     23432                  break
    2325023433else
    2325123434  echo "$as_me: failed program was:" >&5
     
    2325423437echo "$as_me:$LINENO: result: no" >&5
    2325523438echo "${ECHO_T}no" >&6
    23256                                  { { echo "$as_me:$LINENO: error: Cannot find symbol XPRSsetintcontrol with XPR" >&5
    23257 echo "$as_me: error: Cannot find symbol XPRSsetintcontrol with XPR" >&2;}
    23258    { (exit 1); exit 1; }; }
    2325923439fi
    2326023440rm -f conftest.err conftest.$ac_objext \
    2326123441      conftest$ac_exeext conftest.$ac_ext
    23262                     ac_ext=f
     23442           done
     23443           ac_ext=f
    2326323444ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
    2326423445ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
    2326523446ac_compiler_gnu=$ac_cv_f77_compiler_gnu
    2326623447
    23267                     LIBS="$coin_save_LIBS"
    23268                   fi
    23269 
    23270   ADDLIBS="$XPRLIB $ADDLIBS"
     23448           if test x"$coin_XPR_link" = xyes ; then
     23449             LIBS="$coin_save_LIBS"
     23450           else
     23451             { { echo "$as_me:$LINENO: error: Cannot find symbol(s) XPRSsetintcontrol with XPR" >&5
     23452echo "$as_me: error: Cannot find symbol(s) XPRSsetintcontrol with XPR" >&2;}
     23453   { (exit 1); exit 1; }; }
     23454           fi
     23455         fi
     23456
     23457
     23458# If we make it this far, we've verified the file and linked the function. Add
     23459# the necessary link flags to ADDLIBS and define the preprocessor symbol
     23460# COIN_HAS_LBRY.
     23461
     23462    ADDLIBS="$XPRLIB $ADDLIBS"
    2327123463
    2327223464cat >>confdefs.h <<\_ACEOF
     
    2327423466_ACEOF
    2327523467
    23276 else
    23277   echo "$as_me:$LINENO: result: no" >&5
    23278 echo "${ECHO_T}no" >&6
    23279 fi
     23468  fi
     23469
     23470# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
     23471# automake conditional. These actions must occur unconditionally.
    2328023472
    2328123473
     
    2371823910##############################################################################
    2371923911
    23720                                                                                                                                                       ac_config_files="$ac_config_files Makefile src/Apps/Makefile experimental/Bcp/Makefile src/CbcBonmin/Makefile src/Interfaces/Makefile src/Interfaces/Ipopt/Makefile src/Interfaces/Filter/Makefile src/Interfaces/Ampl/Makefile src/Algorithms/Makefile src/Algorithms/Branching/Makefile src/Algorithms/OaGenerators/Makefile experimental/FP/Makefile experimental/NotConvex/Makefile test/Makefile examples/CppExample/Makefile"
     23912                                                                                                                                                                ac_config_files="$ac_config_files Makefile src/Apps/Makefile experimental/Bcp/Makefile src/CbcBonmin/Makefile src/Interfaces/Makefile src/Interfaces/Ipopt/Makefile src/Interfaces/Filter/Makefile src/Interfaces/Ampl/Makefile src/Algorithms/Makefile src/Algorithms/Ampl/Makefile src/Algorithms/Branching/Makefile src/Algorithms/OaGenerators/Makefile experimental/FP/Makefile experimental/NotConvex/Makefile test/Makefile examples/CppExample/Makefile"
    2372123913
    2372223914
     
    2449924691  "src/Interfaces/Ampl/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Interfaces/Ampl/Makefile" ;;
    2450024692  "src/Algorithms/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Algorithms/Makefile" ;;
     24693  "src/Algorithms/Ampl/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Algorithms/Ampl/Makefile" ;;
    2450124694  "src/Algorithms/Branching/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Algorithms/Branching/Makefile" ;;
    2450224695  "src/Algorithms/OaGenerators/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Algorithms/OaGenerators/Makefile" ;;
  • trunk/Bonmin/configure.ac

    r465 r481  
    193193                 src/Interfaces/Ampl/Makefile
    194194                 src/Algorithms/Makefile
     195                 src/Algorithms/Ampl/Makefile
    195196                 src/Algorithms/Branching/Makefile
    196197                 src/Algorithms/OaGenerators/Makefile
  • trunk/Bonmin/examples/CppExample/MyBonmin.cpp

    r465 r481  
    2121#include "BonIpoptSolver.hpp"
    2222#include "MyTMINLP.hpp"
    23 #include "BonCbc.hpp"
     23#include "BonCbc2.hpp"
     24#include "BonBonminSetup.hpp"
    2425
    2526#include "BonOACutGenerator2.hpp"
     
    3334  using namespace Bonmin;
    3435  SmartPtr<TMINLP> tminlp = new MyTMINLP;
    35   OsiTMINLPInterface nlpSolver(tminlp, new IpoptSolver);
    36   OACutGenerator2::registerOptions(nlpSolver.regOptions());
    37   EcpCuts::registerOptions(nlpSolver.regOptions());
    38   OaNlpOptim::registerOptions(nlpSolver.regOptions());
    39   //Option can be set here directly either to bonmin or ipopt
    40   nlpSolver.retrieve_options()->SetNumericValue("bonmin.time_limit", 1); //changes bonmin's time limit
    41   nlpSolver.retrieve_options()->SetStringValue("mu_oracle","loqo");
     36  BonminSetup bonmin;
     37  bonmin.initializeBonmin(tminlp);
    4238
    43   // we can also try and read an option file (can eventually change options set before, option file always have priority)
    44   nlpSolver.readOptionFile("My_bonmin.opt");
     39  bonmin.options()->SetNumericValue("bonmin.time_limit", 1); //changes bonmin's time limit
     40  bonmin.options()->SetStringValue("mu_oracle","loqo");
     41
     42  // we can also try and read an option file (this can eventually change options set before, option file always have priority)
     43//  bonmin.initialize("My_bonmin.opt");
    4544
    4645  //Set up done, now let's branch and bound
    4746  double time1 = CoinCpuTime();
    4847  try {
    49     BonminCbcParam par;
    50     Bab bb;
    51     par(&nlpSolver);
    52 
    53     bb(&nlpSolver, par);//process parameter file using Ipopt and do branch and bound
     48    Bab2 bb;
     49    bb(bonmin);//process parameter file using Ipopt and do branch and bound
    5450
    5551    std::cout.precision(10);
    56 
    57     std::string message;
    58     if(bb.mipStatus()==Bab::FeasibleOptimal) {
    59       std::cout<<"\t\"Finished\"\t";
    60       message = "\nbonmin: Optimal";
    61     }
    62     else if(bb.mipStatus()==Bab::ProvenInfeasible) {
    63       std::cout<<"\t\"Finished\"\t";
    64       message = "\nbonmin: Infeasible problem";
    65     }
    66     else if(bb.mipStatus()==Bab::Feasible) {
    67       std::cout<<"\t\"Not finished\""<<"\t";
    68       message = "\n Optimization not finished.";
    69     }
    70     else if(bb.mipStatus()==Bab::NoSolutionKnown) {
    71       std::cout<<"\t\"Not finished\""<<"\t";
    72       message = "\n Optimization not finished.";
    73     }
    74     std::cout<<CoinCpuTime()-time1<<"\t"
    75     <<bb.bestObj()<<"\t"
    76     <<bb.numNodes()<<"\t"
    77     <<bb.iterationCount()<<"\t"
    78     <<std::endl;
    7952
    8053  }
  • trunk/Bonmin/examples/CppExample/MyTMINLP.cpp

    r394 r481  
    191191
    192192void
    193 MyTMINLP::finalize_solution(SolverReturn status,
    194                             Index n, const Number* x, const Number* z_L, const Number* z_U,
    195                             Index m, const Number* g, const Number* lambda,
    196                             Number obj_value,
    197                             const IpoptData* ip_data,
    198                             IpoptCalculatedQuantities* ip_cq)
    199 {//don't need anything
    200 }
     193MyTMINLP::finalize_solution(TMINLP::SolverReturn status,
     194                            Index n, const Number* x, Number obj_value)
     195{
     196  std::cout<<"Problem status: "<<status<<std::endl;
     197  std::cout<<"Objective value: "<<obj_value<<std::endl;
     198  if(x != NULL){
     199    std::cout<<"Solution:"<<std::endl;
     200    for(int i = 0 ; i < n ; i++){
     201      std::cout<<"x["<<i<<"] = "<<x[i];
     202      if(i < n-1) std::cout<<", ";}
     203    std::cout<<std::endl;
     204  }
     205}
  • trunk/Bonmin/examples/CppExample/MyTMINLP.hpp

    r394 r481  
    157157 
    158158  /** Method called by Ipopt at the end of optimization.*/ 
    159   virtual void finalize_solution(SolverReturn status,
    160                                  Index n, const Number* x, const Number* z_L, const Number* z_U,
    161                                  Index m, const Number* g, const Number* lambda,
    162                                  Number obj_value,
    163                                  const IpoptData* ip_data,
    164                                  IpoptCalculatedQuantities* ip_cq);
     159  virtual void finalize_solution(TMINLP::SolverReturn status,
     160                                 Index n, const Number* x, Number obj_value);
    165161 
    166162  //@}
  • trunk/Bonmin/experimental/Bcp/BM_pack.cpp

    r465 r481  
    1717#include "BonCbc.hpp"
    1818#include "BM.hpp"
     19
     20#include "BonAmplSetup.hpp"
    1921
    2022//#############################################################################
     
    7981    std::string ipopt_content(ipopt_file_content.c_str());
    8082    std::string nl_content(nl_file_content.c_str());
    81     nlp_.readAmplNlFile(argv, &ipopt_content, &nl_content);
     83
     84    Bonmin::BonminAmplSetup::fillOsiInterface(nlp_, argv, ipopt_content, nl_content);
     85   
    8286    free(argv[1]);
    8387
     
    96100
    97101    /* synchronize bonmin & BCP parameters */
    98     Ipopt::SmartPtr<Ipopt::OptionsList> options = nlp_.retrieve_options();
     102    Ipopt::SmartPtr<Ipopt::OptionsList> options = nlp_.options();
    99103
    100104    int nlpLogLevel;
  • trunk/Bonmin/experimental/Bcp/BM_tm.cpp

    r465 r481  
    1919#include "BonEcpCuts.hpp"
    2020#include "BonOaNlpOptim.hpp"
     21
     22#include "BonAmplSetup.hpp"
    2123
    2224//#############################################################################
     
    6567    argv[2] = NULL;
    6668   
    67     Bonmin::AmplInterface nlpSolver(argv);
    68     Bonmin::OACutGenerator2::registerOptions(nlpSolver.regOptions());
    69     Bonmin::EcpCuts::registerOptions(nlpSolver.regOptions());
    70     Bonmin::OaNlpOptim::registerOptions(nlpSolver.regOptions());
     69    /* Get the basic options. */
     70    Bonmin::BonminAmplSetup bonmin;
     71    bonmin.initializeBonmin(argv);   
     72   
     73    Bonmin::OsiTMINLPInterface& nlpSolver = *bonmin.nonlinearSolver();
    7174   
    7275    free(argv[1]);
     
    7679    int addObjVar = minlpParams_.algo == 0 /* pure B&B */ ? 0 : 1;
    7780    nlpSolver.extractLinearRelaxation(clp, addObjVar);
    78  
    7981    const int numCols = clp.getNumCols();
    8082    const int numRows = clp.getNumRows();
     
    150152  }
    151153  /* Parse again the input file so that we have a nice and clean ampl
    152      setup */
    153   Bonmin::AmplInterface nlpSolver; 
    154   Bonmin::OACutGenerator2::registerOptions(nlpSolver.regOptions());
    155   Bonmin::EcpCuts::registerOptions(nlpSolver.regOptions());
    156   Bonmin::OaNlpOptim::registerOptions(nlpSolver.regOptions());
    157 
     154     setup */ 
     155 
    158156  char* argv_[3];
    159157  char** argv = argv_;
     
    161159  argv[1] = strdup(par.entry(BM_par::NL_filename).c_str());
    162160  argv[2] = NULL;
    163   nlpSolver.readAmplNlFile(argv, 0, 0);
     161  Bonmin::BonminAmplSetup bonmin;
     162  bonmin.initializeBonmin(argv);   
     163 
     164  Bonmin::OsiTMINLPInterface& nlpSolver = *bonmin.nonlinearSolver();
    164165  minlpParams_.extractParams(&nlpSolver);
    165166  free(argv[1]);
     
    202203  if (write_file) {
    203204    /* create the AMPL solfile */
    204     nlpSolver.writeAmplSolFile("\nbon-min: Optimal solution", dsol, NULL);
     205    nlpSolver.model()->finalize_solution(Bonmin::TMINLP::SUCCESS, nlpSolver.getNumCols(),
     206                                         dsol, bs->_objective);
    205207  }
    206208  delete[] dsol;
  • trunk/Bonmin/experimental/Bcp/Makefile.am

    r465 r481  
    4949
    5050bonminbcp_DEPENDENCIES = \
    51         ../../src/Interfaces/Ampl/libamplinterface.la \
     51        ../../src/CbcBonmin/libbonminampl.la \
    5252        ../../src/CbcBonmin/libbonmin.la \
    5353        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
     
    112112        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/OaGenerators` \
    113113        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/Branching` \
     114        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/Ampl` \
    114115        -I`$(CYGPATH_W) $(srcdir)/../../src/Interfaces` \
    115116        -I`$(CYGPATH_W) $(srcdir)/../../src/Interfaces/Ipopt` \
  • trunk/Bonmin/experimental/Bcp/Makefile.in

    r465 r481  
    7676        $(OSIOBJDIR)/src/libOsi.la $(CLPOBJDIR)/src/libClp.la \
    7777        $(COINUTILSOBJDIR)/src/libCoinUtils.la $(am__DEPENDENCIES_3)
    78 am__DEPENDENCIES_5 = ../../src/Interfaces/Ampl/libamplinterface.la \
     78am__DEPENDENCIES_5 = ../../src/CbcBonmin/libbonminampl.la \
    7979        ../../src/CbcBonmin/libbonmin.la \
    8080        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
     
    348348
    349349bonminbcp_DEPENDENCIES = \
    350         ../../src/Interfaces/Ampl/libamplinterface.la \
     350        ../../src/CbcBonmin/libbonminampl.la \
    351351        ../../src/CbcBonmin/libbonmin.la \
    352352        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
     
    377377        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/OaGenerators` \
    378378        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/Branching` \
     379        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/Ampl` \
    379380        -I`$(CYGPATH_W) $(srcdir)/../../src/Interfaces` \
    380381        -I`$(CYGPATH_W) $(srcdir)/../../src/Interfaces/Ipopt` \
  • trunk/Bonmin/experimental/NotConvex/BonCouenne.cpp

    r469 r481  
    2323#include "BonCouenneCbc.hpp"
    2424
    25 #include "BonOACutGenerator2.hpp"
    26 #include "BonEcpCuts.hpp"
    27 #include "BonOaNlpOptim.hpp"
     25#include "BonCouenneSetup.hpp"
    2826
     27#include "BonCbc2.hpp"
    2928#ifdef COIN_HAS_FILTERSQP
    3029#include "BonFilterSolver.hpp"
     
    3837  using namespace Ipopt;
    3938  Bonmin::usingCouenne = 1; 
    40   CouenneInterface * nlp_and_solver;
    41 
    42   // We need to build dummy solver objects to get the options,
    43   // determine which is the solver to use and register all the options
    44   Ipopt::SmartPtr<IpoptSolver> dummy_ipopt = new IpoptSolver;
    45   OsiTMINLPInterface forOption(GetRawPtr(dummy_ipopt));
    46 
    47   int solverUsed = 0; // 0 is Ipopt, 1 is Filter
    48   forOption.solver()->Options()->GetEnumValue("nlp_solver", solverUsed,"bonmin.");
    4939
    5040  char * pbName = NULL;
     
    5343    pbName = new char[strlen(argv[1])+1];
    5444    strcpy(pbName, argv[1]);
    55   }
    56   else //will just output usage
    57   {
    58     Ipopt::SmartPtr<IpoptSolver> ipoptSolver = new IpoptSolver;
    59     nlp_and_solver = new CouenneInterface (argv, GetRawPtr (ipoptSolver));
    60     delete nlp_and_solver;
    61     return 0;
    62   }
    63   double time1 = CoinCpuTime();
     45  }  double time1 = CoinCpuTime();
    6446  try {
    65   Ipopt::SmartPtr<TNLPSolver> solver;
    66   if(solverUsed == 0)
    67     solver = new IpoptSolver;
    68   else if(solverUsed == 1)
    69 #ifdef COIN_HAS_FILTERSQP
    70     solver = new FilterSolver;
    71 #else
    72     {
    73       std::cerr<<"filterSQP is not properly configured for using into Bonmin"<<std::endl
    74                <<"be sure to run the configure script with options:"<<std::endl
    75                <<"--with-filtersqp_lib=\"<path_to_filter_library>\""<<std::endl
    76                <<"--with-filtersqp_incdir=\"\""<<std::endl;
    77                throw -1;
    78       }
    79 #endif
    80   else
    81     {
    82       std::cerr<<"Trying to use unknown solver."<<std::endl;
    83     }
    84     nlp_and_solver = new CouenneInterface(argv, solver);
    85     BonminCbcParam par;
    86     CouenneBab bb;
    87     /** Register options */
    88     Ipopt::SmartPtr<RegisteredOptions> roptions = nlp_and_solver->regOptions();
    89     nlp_and_solver->registerOptions(roptions);
    90     OACutGenerator2::registerOptions(roptions);
    91     EcpCuts::registerOptions(roptions);
    92     OaNlpOptim::registerOptions(roptions);
    93    
    94     roptions->SetRegisteringCategory("Couenne options");
    9547
    96     roptions->AddLowerBoundedIntegerOption("ecp_cuts",
    97                                            "Specify the frequency (in terms of nodes) at which couenne ecp cuts are generated.",
    98                                            0,1,
    99                                            "A frequency of 0 amounts to to never solve the NLP relaxation.");
    100    
    101     roptions->AddStringOption2("nlp_local_solutions",
    102                                "Do we search for local solutions of NLP's",
    103                                "yes",
    104                                "no","",
    105                                "yes","");
    106     // Eventually change some default in a custom application
    107     nlp_and_solver->setAppDefaultOptions(nlp_and_solver->solver()->Options());
    108 
    109     par(nlp_and_solver);
    110     bb(nlp_and_solver, par);//do branch and bound
     48    CouenneSetup bonmin;
     49    bonmin.InitializeBonmin(argv);
     50    Bab2 bb;
     51    bb(bonmin);//do branch and bound
    11152
    11253    std::cout.precision(10);
     
    11455    std::string message;
    11556    std::string status;
    116     if(bb.mipStatus()==Bab::FeasibleOptimal) {
     57    if(bb.mipStatus()==Bab2::FeasibleOptimal) {
    11758      status = "\t\"Finished\"";
    11859      message = "\nbonmin: Optimal";
    11960    }
    120     else if(bb.mipStatus()==Bab::ProvenInfeasible) {
     61    else if(bb.mipStatus()==Bab2::ProvenInfeasible) {
    12162      status = "\t\"Finished\"";
    12263      message = "\nbonmin: Infeasible problem";
    12364    }
    124     else if(bb.mipStatus()==Bab::Feasible) {
     65    else if(bb.mipStatus()==Bab2::Feasible) {
    12566      status = "\t\"Not finished\"";
    12667      message = "\n Optimization not finished.";
    12768    }
    128     else if(bb.mipStatus()==Bab::NoSolutionKnown) {
     69    else if(bb.mipStatus()==Bab2::NoSolutionKnown) {
    12970      status = "\t\"Not finished\"";
    13071      message = "\n Optimization not finished.";
     
    15697    }
    15798
    158     if (0) { // print statistics
    159       std::cout<<pbName << status
    160                <<CoinCpuTime()-time1<<"\t"
    161                <<bb.bestBound()<<"\t"
    162                <<bb.bestObj()<<"\t"
    163                <<bb.numNodes()<<"\t"
    164                <<bb.iterationCount()<<"\t"
    165                <<nlp_and_solver->totalNlpSolveTime()<<"\t"
    166                <<nlp_and_solver->nCallOptimizeTNLP()<<"\t"
    167                <<status
    168                <<std::endl;
    169     }
    170 
    17199    //  nlp_and_solver->writeAmplSolFile(message,bb.bestSolution(),NULL);
    172 
    173100  }
    174101  catch(TNLPSolver::UnsolvedError *E) {
     
    201128
    202129  delete [] pbName;
    203   delete nlp_and_solver;
    204130  return 0;
    205131}
  • trunk/Bonmin/experimental/NotConvex/BonCouenneCbc.cpp

    r469 r481  
    6868#include "CbcBranchUser.hpp"
    6969
     70
    7071bool checkNLP (CglCutGenerator *, const double *, double &);
    7172
     
    7980#ifdef SIGNAL
    8081#include "CoinSignal.hpp"
    81 
     82#include "BonBaseOptions.hpp"
    8283extern "C"
    8384{
     
    120121    nlpSolver->messageHandler()->setLogLevel(par.nlpLogLevel);
    121122
    122     if (par.algo >= OsiTMINLPInterface::B_BB &&
    123         par.algo <= OsiTMINLPInterface::B_Hyb) //Do something classic
     123    if (par.algo >= Bonmin::BaseOptions::B_BB &&
     124        par.algo <= Bonmin::BaseOptions::B_Hyb) //Do something classic
    124125    {
    125126      Bab::branchAndBound (nlpSolver, par);
     
    230231
    231232    /*Setup heuristic to solve nlp problems.*/
    232     Ipopt::SmartPtr<Ipopt::OptionsList> Options = nlpSolver->retrieve_options();
     233    Ipopt::SmartPtr<Ipopt::OptionsList> Options = nlpSolver->options();
    233234    int doNlpHeurisitic = 0;
    234235    Options->GetEnumValue("nlp_local_solutions", doNlpHeurisitic, "couenne.");
  • trunk/Bonmin/experimental/NotConvex/BonCouenneInterface.cpp

    r465 r481  
    2222{}
    2323
    24 /** Constructor with inputed ampl command line.*/
    25 CouenneInterface::CouenneInterface(char **& amplArgs, SmartPtr<TNLPSolver> app):
    26   AmplInterface(amplArgs, app),
    27   couenneCg_(NULL)
    28   {
    29     //    const ASL_pfgh* asl = amplModel()->AmplSolverObject();
    30     //    ASL_pfgh * nc_asl = const_cast< ASL_pfgh *>(asl);
    31 
    32     aslfg_ = readASLfg (amplArgs);
    33 
    34     //Get value of add_only violated option
    35     int addOnlyViolatedOa = true;
    36     app_->Options()->GetEnumValue("add_only_violated_oa", addOnlyViolatedOa,"bonmin.");
    37     couenneCg_ = new CouenneCutGenerator
    38                        (this, aslfg_, true, CURRENT_ONLY,1);
    39    
    40   }
    41 
    4224/** Copy constructor. */
    4325CouenneInterface::CouenneInterface(const CouenneInterface &other):
     
    4527  couenneCg_(NULL)
    4628  {
    47     //    const ASL_pfgh* asl = amplModel()->AmplSolverObject();
    48     //    ASL_pfgh * nc_asl = const_cast< ASL_pfgh *>(asl);
    49     couenneCg_ = new CouenneCutGenerator
    50                        (this, aslfg_, true, CURRENT_ONLY,1);
    5129  }
    5230
     
    6139}
    6240
     41void
     42CouenneInterface::readAmplNlFile(char **& amplArgs, Bonmin::BasicSetup & b){
     43  readAmplNlFile(amplArgs, b.journalist(), b.options(), b.roptions());
     44}
     45
     46
     47void
     48CouenneInterface::readAmplNlFile(char **& argv, Ipopt::SmartPtr<Ipopt::Journalist> journalist,
     49                         Ipopt::SmartPtr<Ipopt::OptionsList> options,
     50                                 Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions){
     51  AmplInterface::readAmplNlFile(argv, journalist, options, roptions);
     52  aslfg_ = readASLfg (argv);
     53  int addOnlyViolatedOa;
     54  options->GetEnumValue("add_only_violated_oa", addOnlyViolatedOa,"bonmin.");
     55  couenneCg_ = new CouenneCutGenerator
     56    (this, aslfg_, true, CURRENT_ONLY,1);
     57}
    6358
    6459/** \name Overloaded methods to build outer approximations */
  • trunk/Bonmin/experimental/NotConvex/BonCouenneInterface.hpp

    r454 r481  
    2727  CouenneInterface();
    2828
    29   /** Constructor with inputed ampl command line.*/
    30   CouenneInterface(char **& amplArgs, SmartPtr<TNLPSolver> app);
    31 
    3229  /** Copy constructor. */
    3330  CouenneInterface(const CouenneInterface &other);
     
    3936  virtual ~CouenneInterface();
    4037
     38 
     39  /** read ampl file*/
     40  virtual void readAmplNlFile(char **& argv, Bonmin::BasicSetup & b);
     41 
     42  /** read ampl file using inputed options, journalist....*/
     43  virtual void readAmplNlFile(char **& argv, Ipopt::SmartPtr<Ipopt::Journalist> journalist,
     44                              Ipopt::SmartPtr<Ipopt::OptionsList> options,
     45                              Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions);
     46 
    4147  /** \name Overloaded methods to build outer approximations */
    4248  //@{
  • trunk/Bonmin/experimental/NotConvex/Makefile.am

    r465 r481  
    4343        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/Branching` \
    4444        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/OaGenerators` \
     45        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/Ampl` \
    4546        -I`$(CYGPATH_W) $(srcdir)/../../src/Interfaces` \
    4647        -I`$(CYGPATH_W) $(srcdir)/../../src/Interfaces/Ipopt` \
     
    9596              BonCouenneCbc.hpp \
    9697              BonCouenneCbc.cpp \
     98              BonCouenneSetup.cpp \
     99              BonCouenneSetup.hpp \
    97100              BonCouenneInterface.hpp \
    98101              BonNlpHeuristic.hpp \
     
    101104
    102105fun_LDADD = \
    103         ../../src/Interfaces/Ampl/libamplinterface.la \
     106        ../../src/CbcBonmin/libbonminampl.la \
    104107        ../../src/CbcBonmin/libbonmin.la \
    105108        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
  • trunk/Bonmin/experimental/NotConvex/Makefile.in

    r465 r481  
    7373PROGRAMS = $(bin_PROGRAMS)
    7474am_fun_OBJECTS = BonCouenne.$(OBJEXT) BonCouenneCbc.$(OBJEXT) \
    75         BonNlpHeuristic.$(OBJEXT) BonCouenneInterface.$(OBJEXT)
     75        BonCouenneSetup.$(OBJEXT) BonNlpHeuristic.$(OBJEXT) \
     76        BonCouenneInterface.$(OBJEXT)
    7677fun_OBJECTS = $(am_fun_OBJECTS)
    7778am__DEPENDENCIES_1 = $(IPOPTOBJDIR)/src/Interfaces/libipopt.la
     
    8990        $(COINUTILSOBJDIR)/src/libCoinUtils.la $(am__DEPENDENCIES_3) \
    9091        $(am__DEPENDENCIES_4)
    91 fun_DEPENDENCIES = ../../src/Interfaces/Ampl/libamplinterface.la \
     92fun_DEPENDENCIES = ../../src/CbcBonmin/libbonminampl.la \
    9293        ../../src/CbcBonmin/libbonmin.la \
    9394        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
     
    354355        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/Branching` \
    355356        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/OaGenerators` \
     357        -I`$(CYGPATH_W) $(srcdir)/../../src/Algorithms/Ampl` \
    356358        -I`$(CYGPATH_W) $(srcdir)/../../src/Interfaces` \
    357359        -I`$(CYGPATH_W) $(srcdir)/../../src/Interfaces/Ipopt` \
     
    383385              BonCouenneCbc.hpp \
    384386              BonCouenneCbc.cpp \
     387              BonCouenneSetup.cpp \
     388              BonCouenneSetup.hpp \
    385389              BonCouenneInterface.hpp \
    386390              BonNlpHeuristic.hpp \
     
    389393
    390394fun_LDADD = \
    391         ../../src/Interfaces/Ampl/libamplinterface.la \
     395        ../../src/CbcBonmin/libbonminampl.la \
    392396        ../../src/CbcBonmin/libbonmin.la \
    393397        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
     
    477481@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonCouenneCbc.Po@am__quote@
    478482@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonCouenneInterface.Po@am__quote@
     483@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonCouenneSetup.Po@am__quote@
    479484@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonNlpHeuristic.Po@am__quote@
    480485
  • trunk/Bonmin/src/Algorithms/Branching/BonLpStrongBranching.cpp

    r464 r481  
    112112     return return_value;
    113113   }
     114 
     115  void
     116  LpStrongBranching::registerOptions(Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions){
     117  roptions->AddLowerBoundedIntegerOption
     118  ("number_ecp_rounds_strong",
     119   "Set the number of rounds of ecp in strong branching.",
     120   0,1,
     121   "");
     122  }
    114123}/* End namespace Bonmin. */
  • trunk/Bonmin/src/Algorithms/Branching/BonLpStrongBranching.hpp

    r464 r481  
    3838                           int numStrong, double* change_down,
    3939                           double* change_up, int& best_way);
     40 
     41 static void registerOptions(Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions);
    4042 private:
    4143 int maxCuttingPlaneIterations_;
  • trunk/Bonmin/src/Algorithms/Branching/Makefile.am

    r464 r481  
    3030AM_CPPFLAGS = \
    3131        -I`$(CYGPATH_W) $(srcdir)/../OaGenerators` \
     32        -I`$(CYGPATH_W) $(srcdir)/..` \
    3233        -I`$(CYGPATH_W) $(srcdir)/../../Interfaces` \
    3334        -I`$(CYGPATH_W) $(srcdir)/../../Interfaces/Ipopt` \
  • trunk/Bonmin/src/Algorithms/Branching/Makefile.in

    r464 r481  
    339339# "cygpath" stuff is necessary to compile with native compilers on Windows
    340340AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../OaGenerators` \
    341         -I`$(CYGPATH_W) $(srcdir)/../../Interfaces` -I`$(CYGPATH_W) \
     341        -I`$(CYGPATH_W) $(srcdir)/..` -I`$(CYGPATH_W) \
     342        $(srcdir)/../../Interfaces` -I`$(CYGPATH_W) \
    342343        $(srcdir)/../../Interfaces/Ipopt` -I`$(CYGPATH_W) \
    343344        $(srcdir)/../../Interfaces/Filter` -I`$(CYGPATH_W) \
  • trunk/Bonmin/src/Algorithms/Makefile.am

    r464 r481  
    1414       OaGenerators \
    1515       Branching
     16if COIN_HAS_ASL
     17SUBDIRS += Ampl
     18endif
    1619
    1720noinst_LTLIBRARIES = libbonalgorithms.la
     
    2225
    2326# List all source files, including headers
    24 libbonalgorithms_la_SOURCES =
     27libbonalgorithms_la_SOURCES = \
     28         BonBabSetupBase.cpp BonBabSetupBase.hpp \
     29         BonBonminSetup.cpp BonBonminSetup.hpp
    2530
    2631libbonalgorithms_la_LIBADD = Branching/libbonbranching.la
     
    3540# "cygpath" stuff is necessary to compile with native compilers on Windows
    3641AM_CPPFLAGS = \
    37         -I`$(CYGPATH_W) $(srcdir)/../../Interfaces` \
    38         -I`$(CYGPATH_W) $(srcdir)/../../Interfaces/Ipopt` \
    39         -I`$(CYGPATH_W) $(srcdir)/../../Interfaces/Filter` \
     42        -I`$(CYGPATH_W) $(srcdir)/Branching` \
     43        -I`$(CYGPATH_W) $(srcdir)/OaGenerators` \
     44        -I`$(CYGPATH_W) $(srcdir)/../CbcBonmin` \
     45        -I`$(CYGPATH_W) $(srcdir)/../Interfaces` \
     46        -I`$(CYGPATH_W) $(srcdir)/../Interfaces/Ipopt` \
     47        -I`$(CYGPATH_W) $(srcdir)/../Interfaces/Filter` \
    4048        -I`$(CYGPATH_W) $(IPOPTOBJDIR)/inc` \
    4149        -I`$(CYGPATH_W) $(IPOPTSRCDIR)/src/Common` \
     
    5765        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglFlowCover` \
    5866        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglMixedIntegerRounding` \
     67        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglMixedIntegerRounding2` \
     68        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglClique` \
     69        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglLandP` \
     70        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglRedSplit` \
    5971        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglTwomir` \
    6072        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglKnapsackCover` \
     
    7991########################################################################
    8092
    81 include_HEADERS =
     93include_HEADERS = \
     94          BonBabSetupBase.hpp \
     95          BonBonminSetup.hpp
     96 
    8297
    8398########################################################################
  • trunk/Bonmin/src/Algorithms/Makefile.in

    r464 r481  
    4444build_triplet = @build@
    4545host_triplet = @host@
    46 @COIN_HAS_CPX_TRUE@am__append_1 = \
     46@COIN_HAS_ASL_TRUE@am__append_1 = Ampl
     47@COIN_HAS_CPX_TRUE@am__append_2 = \
    4748@COIN_HAS_CPX_TRUE@     -I`$(CYGPATH_W) $(OSISRCDIR)/src/OsiCpx` \
    4849@COIN_HAS_CPX_TRUE@     -I`$(CYGPATH_W) $(CPXINCDIR)`
     
    6061CONFIG_CLEAN_FILES =
    6162LTLIBRARIES = $(noinst_LTLIBRARIES)
    62 am_libbonalgorithms_la_OBJECTS =
     63am_libbonalgorithms_la_OBJECTS = BonBabSetupBase.lo BonBonminSetup.lo
    6364libbonalgorithms_la_OBJECTS = $(am_libbonalgorithms_la_OBJECTS)
     65depcomp = $(SHELL) $(top_srcdir)/../depcomp
     66am__depfiles_maybe = depfiles
     67CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
     68        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     69LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
     70        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
     71        $(AM_CXXFLAGS) $(CXXFLAGS)
     72CXXLD = $(CXX)
     73CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
     74        $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    6475COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    6576        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
     
    89100ETAGS = etags
    90101CTAGS = ctags
    91 DIST_SUBDIRS = $(SUBDIRS)
     102DIST_SUBDIRS = OaGenerators Branching Ampl
    92103DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    93104ACLOCAL = @ACLOCAL@
     
    313324
    314325# Name of the library in this directory
    315 SUBDIRS = \
    316        OaGenerators \
    317        Branching
    318 
     326SUBDIRS = OaGenerators Branching $(am__append_1)
    319327noinst_LTLIBRARIES = libbonalgorithms.la
    320328
     
    324332
    325333# List all source files, including headers
    326 libbonalgorithms_la_SOURCES =
     334libbonalgorithms_la_SOURCES = \
     335         BonBabSetupBase.cpp BonBabSetupBase.hpp \
     336         BonBonminSetup.cpp BonBonminSetup.hpp
     337
    327338libbonalgorithms_la_LIBADD = Branching/libbonbranching.la \
    328339        OaGenerators/libbonoagenerators.la
     
    334345# Here list all include flags, relative to this "srcdir" directory.  This
    335346# "cygpath" stuff is necessary to compile with native compilers on Windows
    336 AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../../Interfaces` \
    337         -I`$(CYGPATH_W) $(srcdir)/../../Interfaces/Ipopt` \
    338         -I`$(CYGPATH_W) $(srcdir)/../../Interfaces/Filter` \
    339         -I`$(CYGPATH_W) $(IPOPTOBJDIR)/inc` -I`$(CYGPATH_W) \
    340         $(IPOPTSRCDIR)/src/Common` -I`$(CYGPATH_W) \
    341         $(IPOPTSRCDIR)/src/Interfaces` -I`$(CYGPATH_W) \
     347AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/Branching` -I`$(CYGPATH_W) \
     348        $(srcdir)/OaGenerators` -I`$(CYGPATH_W) \
     349        $(srcdir)/../CbcBonmin` -I`$(CYGPATH_W) \
     350        $(srcdir)/../Interfaces` -I`$(CYGPATH_W) \
     351        $(srcdir)/../Interfaces/Ipopt` -I`$(CYGPATH_W) \
     352        $(srcdir)/../Interfaces/Filter` -I`$(CYGPATH_W) \
     353        $(IPOPTOBJDIR)/inc` -I`$(CYGPATH_W) $(IPOPTSRCDIR)/src/Common` \
     354        -I`$(CYGPATH_W) $(IPOPTSRCDIR)/src/Interfaces` -I`$(CYGPATH_W) \
    342355        $(IPOPTSRCDIR)/src/LinAlg` -I`$(CYGPATH_W) \
    343356        $(IPOPTSRCDIR)/src/Algorithm` -I`$(CYGPATH_W) \
     
    354367        $(CGLSRCDIR)/src/CglFlowCover` -I`$(CYGPATH_W) \
    355368        $(CGLSRCDIR)/src/CglMixedIntegerRounding` -I`$(CYGPATH_W) \
     369        $(CGLSRCDIR)/src/CglMixedIntegerRounding2` -I`$(CYGPATH_W) \
     370        $(CGLSRCDIR)/src/CglClique` -I`$(CYGPATH_W) \
     371        $(CGLSRCDIR)/src/CglLandP` -I`$(CYGPATH_W) \
     372        $(CGLSRCDIR)/src/CglRedSplit` -I`$(CYGPATH_W) \
    356373        $(CGLSRCDIR)/src/CglTwomir` -I`$(CYGPATH_W) \
    357374        $(CGLSRCDIR)/src/CglKnapsackCover` -I`$(CYGPATH_W) \
    358375        $(CGLSRCDIR)/src/CglPreProcess` -I`$(CYGPATH_W) \
    359376        $(CGLSRCDIR)/src` -I`$(CYGPATH_W) $(CBCSRCDIR)/src` \
    360         -I`$(CYGPATH_W) $(CBCSRCDIR)/examples` $(am__append_1)
     377        -I`$(CYGPATH_W) $(CBCSRCDIR)/examples` $(am__append_2)
    361378
    362379# This line is necessary to allow VPATH compilation with MS compilers
     
    367384#                Headers that need to be installed                     #
    368385########################################################################
    369 include_HEADERS =
     386include_HEADERS = \
     387          BonBabSetupBase.hpp \
     388          BonBonminSetup.hpp
     389
    370390
    371391########################################################################
     
    380400
    381401.SUFFIXES:
    382 .SUFFIXES: .cppbak .hppbak .cpp .hpp
     402.SUFFIXES: .cppbak .hppbak .cpp .hpp .lo .o .obj
    383403$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
    384404        @for dep in $?; do \
     
    420440        done
    421441libbonalgorithms.la: $(libbonalgorithms_la_OBJECTS) $(libbonalgorithms_la_DEPENDENCIES)
    422         $(LINK)  $(libbonalgorithms_la_LDFLAGS) $(libbonalgorithms_la_OBJECTS) $(libbonalgorithms_la_LIBADD) $(LIBS)
     442        $(CXXLINK)  $(libbonalgorithms_la_LDFLAGS) $(libbonalgorithms_la_OBJECTS) $(libbonalgorithms_la_LIBADD) $(LIBS)
    423443
    424444mostlyclean-compile:
     
    427447distclean-compile:
    428448        -rm -f *.tab.c
     449
     450@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonBabSetupBase.Plo@am__quote@
     451@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonBonminSetup.Plo@am__quote@
     452
     453.cpp.o:
     454@am__fastdepCXX_TRUE@   if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
     455@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
     456@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
     457@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     458@am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ $<
     459
     460.cpp.obj:
     461@am__fastdepCXX_TRUE@   if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
     462@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
     463@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
     464@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     465@am__fastdepCXX_FALSE@  $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
     466
     467.cpp.lo:
     468@am__fastdepCXX_TRUE@   if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
     469@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
     470@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
     471@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     472@am__fastdepCXX_FALSE@  $(LTCXXCOMPILE) -c -o $@ $<
    429473
    430474mostlyclean-libtool:
     
    668712
    669713distclean: distclean-recursive
     714        -rm -rf ./$(DEPDIR)
    670715        -rm -f Makefile
    671716distclean-am: clean-am distclean-compile distclean-generic \
     
    693738
    694739maintainer-clean: maintainer-clean-recursive
     740        -rm -rf ./$(DEPDIR)
    695741        -rm -f Makefile
    696742maintainer-clean-am: distclean-am maintainer-clean-generic
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonEcpCuts.cpp

    r474 r481  
    1111namespace Bonmin{
    1212
    13 double
     13 
     14  EcpCuts::EcpCuts(BabSetupBase & b):
     15  OaDecompositionBase(b,false, false){
     16  b.options()->GetIntegerValue("number_ecp_rounds", numRounds_,"bonmin.");
     17  }
     18 
     19  double
    1420EcpCuts::doEcpRounds(OsiSolverInterface &si,
    1521                     bool leaveSiUnchanged){
     
    5157    {
    5258      int numberCuts =  - cs.sizeRowCuts();
    53       const double * toCut = parameter().addOnlyViolated_?
     59      const double * toCut = parameter().addOnlyViolated_ ?
    5460        si.getColSolution():NULL;
    5561      nlp_->getOuterApproximation(cs, si.getColSolution(), 1, toCut, parameter().global_);
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonEcpCuts.hpp

    r464 r481  
    2323      numRounds_(numRounds){
    2424    }
     25    EcpCuts(BabSetupBase & b);
    2526   
    2627    /// Copy constructor
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonOACutGenerator2.cpp

    r473 r481  
    1515
    1616#include "CbcModel.hpp"
    17 #include "CbcStrategy.hpp"
     17#include "BonCbcLpStrategy.hpp"
    1818#ifdef COIN_HAS_CPX
    1919#include "OsiCpxSolverInterface.hpp"
     
    4242  {
    4343  }
    44 
     44/// Constructor with basic setup
     45  OACutGenerator2::OACutGenerator2(BabSetupBase & b):
     46  OaDecompositionBase(b, true, false){
     47    int ivalue;
     48    b.options()->GetEnumValue("milp_subsolver",ivalue,"bonmin.");
     49    if(ivalue <= 0){//uses cbc
     50      //nothing to do?
     51    }
     52    else if (ivalue == 1){
     53      int nodeS, nStrong, nTrust, mig, mir, probe, cover, logLevel;
     54      b.options()->GetEnumValue("nodeselect_stra",nodeS,"milp_sub.");
     55      b.options()->GetIntegerValue("number_strong_branch",nStrong,"milp_sub.");
     56      b.options()->GetIntegerValue("number_before_trust", nTrust,"milp_sub.");
     57      b.options()->GetIntegerValue("Gomory_cuts", mig,"milp_sub.");
     58      b.options()->GetIntegerValue("probing_cuts",probe,"milp_sub.");
     59      b.options()->GetIntegerValue("mir_cuts",mir,"milp_sub.");
     60      b.options()->GetIntegerValue("cover_cuts",cover,"milp_sub.");
     61      b.options()->GetIntegerValue("milp_log_level",logLevel,"bonmin.");
     62      CbcStrategy * strategy =
     63            new CbcOaStrategy(mig, probe, mir, cover, nTrust,
     64                        nStrong, nodeS, parameters_.cbcIntegerTolerance_, logLevel);
     65      setStrategy(*strategy);
     66      delete strategy;
     67     
     68    }
     69    else if(ivalue == 2){
     70#ifdef COIN_HAS_CPX
     71      OsiCpxSolverInterface * cpxSolver = new OsiCpxSolverInterface;
     72      b.nonlinearRelaxation()->extractLinearRelaxation(*localSearchSolver);
     73      assignLpSolver(cpxSolver);
     74#else
     75      std::cerr << "You have set an option to use CPLEX as the milp\n"
     76        << "subsolver in oa decomposition. However, apparently\n"
     77        << "CPLEX is not configured to be used in bonmin.\n"
     78        << "See the manual for configuring CPLEX\n";
     79      throw -1;
     80#endif     
     81    }
     82   
     83    double oaTime;
     84    b.options()->GetNumericValue("oa_dec_time_limit",oaTime,"bonmin.");
     85    parameter().localSearchNodeLimit_ = 1000000;
     86    parameter().maxLocalSearch_ = 100000;
     87    parameter().maxLocalSearchPerNode_ = 10000;
     88    parameter().maxLocalSearchTime_ =
     89      Ipopt::Min(b.getDoubleParameter(BabSetupBase::MaxTime), oaTime);
     90  }
    4591  OACutGenerator2::~OACutGenerator2()
    4692  {
     
    263309                                        "");
    264310
     311  roptions->AddBoundedIntegerOption("oa_log_level",
     312                                    "specify OA iterations log level.",
     313                                    0,2,1,
     314                                    "Set the level of output of OA decomposition solver : "
     315                                    "0 - none, 1 - normal, 2 - verbose"
     316                                    );
     317 
     318  roptions->AddLowerBoundedNumberOption("oa_log_frequency",
     319                                        "display an update on lower and upper bounds in OA every n seconds",
     320                                        0.,1.,100.,
     321                                        "");
     322 
     323  roptions->SetRegisteringCategory("bonmin options : Options for MILP subsolver in OA decomposition");
    265324  roptions->AddStringOption3("milp_subsolver",
    266325                             "Choose the subsolver to solve MILPs sub-problems in OA decompositions.",
     
    271330                             " To use Cplex, a valid license is required and you should have compiled OsiCpx in COIN-OR  (see Osi documentation).");
    272331 
    273   roptions->AddBoundedIntegerOption("oa_log_level",
    274                                     "specify OA iterations log level.",
    275                                     0,2,1,
    276                                     "Set the level of output of OA decomposition solver : "
    277                                     "0 - none, 1 - normal, 2 - verbose"
     332 
     333  roptions->AddBoundedIntegerOption("milp_log_level",
     334                                    "specify MILP subsolver log level.",
     335                                    0,3,0,
     336                                    "Set the level of output of the MILP subsolver in OA : "
     337                                    "0 - none, 1 - minimal, 2 - normal low, 3 - normal high"
    278338                                    );
    279  
    280   roptions->AddLowerBoundedNumberOption("oa_log_frequency",
    281                                         "display an update on lower and upper bounds in OA every n seconds",
    282                                         0.,1.,100.,
    283                                         "");
     339
     340 
    284341}
    285342
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonOACutGenerator2.hpp

    r473 r481  
    2828                   );
    2929
     30    /// Constructor with basic setup
     31    OACutGenerator2::OACutGenerator2(BabSetupBase & b);
     32   
    3033    /// Copy constructor
    3134    OACutGenerator2(const OACutGenerator2 &copy)
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonOaDecBase.cpp

    r475 r481  
    4343      handler_(NULL),
    4444      leaveSiUnchanged_(leaveSiUnchanged),
     45    reassignLpsolver_(false),
    4546      timeBegin_(0),
    4647      parameters_()
     
    5556    parameters_.cbcIntegerTolerance_ = cbcIntegerTolerance;
    5657  }
     58  OaDecompositionBase::OaDecompositionBase(BabSetupBase &b, bool leaveSiUnchanged,
     59                             bool reassignLpsolver):
     60  CglCutGenerator(),
     61  nlp_(b.nonlinearSolver()),
     62  lp_(b.linearSolver()),
     63  nLocalSearch_(0),
     64  handler_(NULL),
     65  leaveSiUnchanged_(leaveSiUnchanged),
     66  reassignLpsolver_(reassignLpsolver),
     67  timeBegin_(0),
     68  parameters_()
     69{
     70    handler_ = new CoinMessageHandler();
     71    int logLevel;
     72    b.options()->GetIntegerValue("oa_log_level",logLevel,"bonmin.");
     73    b.options()->GetNumericValue("oa_log_frequency",parameters_.logFrequency_,"bonmin.");
     74
     75    handler_ -> setLogLevel(logLevel);
     76   
     77    messages_ = OaMessages();
     78    timeBegin_ = CoinCpuTime();
     79    b.options()->GetNumericValue("cutoff_decr",parameters_.cbcCutoffIncrement_,"bonmin.");
     80    b.options()->GetNumericValue("integer_tolerance",parameters_.cbcIntegerTolerance_,"bonmin.");
     81    int ivalue;
     82    b.options()->GetEnumValue("add_only_violated_oa", ivalue,"bonmin.");
     83    parameters_.addOnlyViolated_ = ivalue;
     84    b.options()->GetEnumValue("oa_cuts_scope", ivalue,"bonmin.");
     85    parameters_.global_ = ivalue;
     86}
    5787
    5888  OaDecompositionBase::OaDecompositionBase
     
    6696      messages_(other.messages_),
    6797      leaveSiUnchanged_(other.leaveSiUnchanged_),
     98  reassignLpsolver_(other.reassignLpsolver_),
    6899      timeBegin_(0),
    69100      parameters_(other.parameters_)
     
    256287          bool saveBasis,
    257288          bool saveBounds,
    258           bool saveCutoff):
     289          bool saveCutoff,
     290          bool resolve):
    259291  si_(si),
    260292  initialNumberRows_(-1),
     
    278310  if(saveCutoff)
    279311   si->getDblParam(OsiDualObjectiveLimit, cutoff_);
    280    si->resolve();
     312   if (resolve) si->resolve();
    281313}
    282314
     
    360392    if (si_->isInteger(i)) {
    361393      double  value =  colsol[i];
    362       if(value - floor(value+0.5) > 1e-04){
     394      if(fabs(value - floor(value+0.5)) > 1e-04){
    363395        std::cerr<<"Error not integer valued solution"<<std::endl;
    364396        std::cerr<<"---------------- x["<<i<<"] = "<<value<<std::endl;
     
    517549    // babInfo is used to communicate with the b-and-b solver (Cbc or Bcp).
    518550    OsiBabSolver * babInfo = dynamic_cast<OsiBabSolver *> (si.getAuxiliaryInfo());
    519 
     551    if(babInfo)
     552      if(!babInfo->mipFeasible())
     553      return;
     554 
    520555    const int numcols = nlp_->getNumCols();
    521556
     
    548583
    549584    // Save solvers state if needed
    550     solverManip nlpManip(nlp_, false, false, true, false);
     585    solverManip nlpManip(nlp_, false, false, true, false, false);
    551586
    552587    solverManip * lpManip = NULL;
    553588    if(lp_ != NULL){
    554589      if(lp_!=&si){
    555         lpManip = new solverManip(lp_, true, false, false, true);
     590        lpManip = new solverManip(lp_, true, false, false, true, true);
    556591        lpManip->cloneOther(si);
    557592      }
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonOaDecBase.hpp

    r475 r481  
    1111#define BonOaDecBase_HPP
    1212#include "CglCutGenerator.hpp"
    13 #include "BonOsiTMINLPInterface.hpp"
     13#include "BonBabSetupBase.hpp"
    1414#include "BonOAMessages.hpp"
    1515#include "CbcModel.hpp"
     
    3838                     const CbcStrategy * strategy = NULL);
    3939
    40         virtual ~SubMipSolver();
     40        ~SubMipSolver();
    4141
    4242        /** Assign lp solver. */
     
    7878          return iterationCount_;}
    7979       
    80       //AW: I think the following should not be here!  Otherwise we get warning messages about having not a virtual destructor
    81       // /** Register options for that Oa based cut generation method. */
    82         //virtual void registerOptions(Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions){}
    83 protected:
     80
     81       /** Register options for that Oa based cut generation method. */
     82      void registerOptions(Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions){}
    8483      private:
    8584       /** lp (potentially mip solver). */
     
    112111      solverManip(OsiSolverInterface *si , bool saveNumRows=true,
    113112                      bool saveBasis=true, bool saveBounds=false,
    114                       bool saveCutoff = false);
     113                      bool saveCutoff = false, bool resolve=true);
    115114     
    116115      /** Constructor which clone an other interface. */
     
    180179
    181180   };
    182     /// Usefull constructor
     181    /// Old usefull constructor
    183182    OaDecompositionBase(OsiTMINLPInterface * nlp = NULL,
    184183        OsiSolverInterface * si = NULL,
     
    188187        bool leaveSiUnchanged = 0
    189188        );
     189    /// New usefull constructor
     190    OaDecompositionBase(BabSetupBase &b, bool leaveSiUnchanged,
     191                                             bool reassignLpsolver);
    190192
    191193    /// Copy constructor
     
    210212    }
    211213
     214    bool reassignLpsolver(){
     215      return reassignLpsolver_;
     216    }
    212217    /// Set whether to leave the solverinterface unchanged
    213218    inline void setLeaveSiUnchanged(bool yesno)
     
    308313    /** Wether or not we should remove cuts at the end of the procedure */
    309314    bool leaveSiUnchanged_;
     315    /** Do we need to reassign the lp solver with Cbc.*/
     316    bool reassignLpsolver_;
    310317    /** time of construction*/
    311318    double timeBegin_;
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonOaFeasChecker.cpp

    r464 r481  
    3535  }
    3636
     37  /// New usefull constructor
     38  OaFeasibilityChecker::OaFeasibilityChecker(BabSetupBase &b):
     39  OaDecompositionBase(b, false, true){
     40  }
    3741  OaFeasibilityChecker ::~OaFeasibilityChecker ()
    3842  {
     
    6468   for(int i = 0 ; i < numcols ; i++)
    6569     {
    66        std::cout<<"x["<<i<<"] = "<<colsol[i]<<"\t";
     70       std::cerr<<"x["<<i<<"] = "<<colsol[i]<<"\t";
    6771     }
     72   std::cerr<<std::endl;
    6873   lp->writeLp("toto");
    6974#endif
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonOaFeasChecker.hpp

    r464 r481  
    2727                   );
    2828
     29    /// New usefull constructor
     30    OaFeasibilityChecker(BabSetupBase &b);
    2931    /// Copy constructor
    3032    OaFeasibilityChecker(const OaFeasibilityChecker &copy)
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonOaNlpOptim.cpp

    r464 r481  
    2828    messages_ = OaMessages();
    2929  }
     30 
     31  OaNlpOptim::OaNlpOptim(BabSetupBase &b):
     32  CglCutGenerator(),
     33  nlp_(b.nonlinearSolver()),
     34  maxDepth_(10),
     35  nSolve_(0)
     36{
     37  int ivalue;
     38  b.options()->GetEnumValue("add_only_violated_oa", ivalue,"bonmin.");
     39  addOnlyViolated_ = ivalue;
     40  b.options()->GetEnumValue("oa_cuts_scope", ivalue,"bonmin.");
     41  global_ = ivalue;
     42}
    3043/// Assign an OsiTMINLPInterface
    3144  void
  • trunk/Bonmin/src/Algorithms/OaGenerators/BonOaNlpOptim.hpp

    r464 r481  
    1313#include "BonOsiTMINLPInterface.hpp"
    1414#include "BonOAMessages.hpp"
     15#include "BonBabSetupBase.hpp"
    1516namespace Bonmin
    1617{
     
    2324        int maxDepth = 10, bool addOnlyViolated = false,
    2425               bool globalCuts = true);
     26   
     27    /// Constructor with basic setup
     28    OaNlpOptim(BabSetupBase &b);
    2529    /// Copy constructor
    2630    OaNlpOptim(const OaNlpOptim &copy)
  • trunk/Bonmin/src/Algorithms/OaGenerators/Makefile.am

    r464 r481  
    2424        BonOaDecBase.cpp BonOaDecBase.hpp \
    2525        BonEcpCuts.cpp BonEcpCuts.hpp \
     26        BonCbcLpStrategy.cpp BonCbcLpStrategy.hpp \
    2627        BonOAMessages.cpp BonOAMessages.hpp
    2728
     
    3334AM_CPPFLAGS = \
    3435        -I`$(CYGPATH_W) $(srcdir)/../../Interfaces` \
     36        -I`$(CYGPATH_W) $(srcdir)/..` \
    3537        -I`$(CYGPATH_W) $(IPOPTOBJDIR)/inc` \
    3638        -I`$(CYGPATH_W) $(IPOPTSRCDIR)/src/Common` \
     
    4446        -I`$(CYGPATH_W) $(OSISRCDIR)/src/OsiClp` \
    4547        -I`$(CYGPATH_W) $(CGLSRCDIR)/src` \
    46         -I`$(CYGPATH_W) $(CBCSRCDIR)/src`
     48        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglGomory` \
     49        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglProbing` \
     50        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglOddHole` \
     51        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglClique` \
     52        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglFlowCover` \
     53        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglMixedIntegerRounding` \
     54        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglMixedIntegerRounding2` \
     55        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglClique` \
     56        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglLandP` \
     57        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglRedSplit` \
     58        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglTwomir` \
     59        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglKnapsackCover` \
     60        -I`$(CYGPATH_W) $(CGLSRCDIR)/src/CglPreProcess` \
     61        -I`$(CYGPATH_W) $(CBCSRCDIR)/src` \
     62        -I`$(CYGPATH_W) $(CBCSRCDIR)/examples`
    4763
    4864if COIN_HAS_CPX
     
    5571# on Cygwin
    5672DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/inc
     73
     74
     75include_HEADERS = \
     76        BonDummyHeuristic.hpp \
     77        BonOaNlpOptim.hpp \
     78        BonOACutGenerator2.hpp \
     79        BonOaFeasChecker.hpp \
     80        BonOaDecBase.hpp \
     81        BonEcpCuts.hpp \
     82        BonCbcLpStrategy.hpp \
     83        BonOAMessages.hpp
     84 
    5785
    5886########################################################################
  • trunk/Bonmin/src/Algorithms/OaGenerators/Makefile.in

    r464 r481  
    2020
    2121# Author:  Andreas Waechter           IBM    2006-04-13
     22
    2223
    2324srcdir = @srcdir@
     
    4849
    4950subdir = src/Algorithms/OaGenerators
    50 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
     51DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
     52        $(srcdir)/Makefile.in
    5153ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    5254am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
     
    6163am_libbonoagenerators_la_OBJECTS = BonDummyHeuristic.lo \
    6264        BonOaNlpOptim.lo BonOACutGenerator2.lo BonOaFeasChecker.lo \
    63         BonOaDecBase.lo BonEcpCuts.lo BonOAMessages.lo
     65        BonOaDecBase.lo BonEcpCuts.lo BonCbcLpStrategy.lo \
     66        BonOAMessages.lo
    6467libbonoagenerators_la_OBJECTS = $(am_libbonoagenerators_la_OBJECTS)
    6568depcomp = $(SHELL) $(top_srcdir)/../depcomp
     
    8386SOURCES = $(libbonoagenerators_la_SOURCES)
    8487DIST_SOURCES = $(libbonoagenerators_la_SOURCES)
     88am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
     89am__vpath_adj = case $$p in \
     90    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
     91    *) f=$$p;; \
     92  esac;
     93am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
     94am__installdirs = "$(DESTDIR)$(includedir)"
     95includeHEADERS_INSTALL = $(INSTALL_HEADER)
     96HEADERS = $(include_HEADERS)
    8597ETAGS = etags
    8698CTAGS = ctags
     
    322334        BonOaDecBase.cpp BonOaDecBase.hpp \
    323335        BonEcpCuts.cpp BonEcpCuts.hpp \
     336        BonCbcLpStrategy.cpp BonCbcLpStrategy.hpp \
    324337        BonOAMessages.cpp BonOAMessages.hpp
    325338
     
    331344# "cygpath" stuff is necessary to compile with native compilers on Windows
    332345AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../../Interfaces` \
    333         -I`$(CYGPATH_W) $(IPOPTOBJDIR)/inc` -I`$(CYGPATH_W) \
    334         $(IPOPTSRCDIR)/src/Common` -I`$(CYGPATH_W) \
    335         $(IPOPTSRCDIR)/src/Interfaces` -I`$(CYGPATH_W) \
     346        -I`$(CYGPATH_W) $(srcdir)/..` -I`$(CYGPATH_W) \
     347        $(IPOPTOBJDIR)/inc` -I`$(CYGPATH_W) $(IPOPTSRCDIR)/src/Common` \
     348        -I`$(CYGPATH_W) $(IPOPTSRCDIR)/src/Interfaces` -I`$(CYGPATH_W) \
    336349        $(IPOPTSRCDIR)/src/LinAlg` -I`$(CYGPATH_W) \
    337350        $(COINUTILSSRCDIR)/src` -I`$(CYGPATH_W) \
     
    340353        $(OSISRCDIR)/src` -I`$(CYGPATH_W) $(OSISRCDIR)/src/OsiClp` \
    341354        -I`$(CYGPATH_W) $(CGLSRCDIR)/src` -I`$(CYGPATH_W) \
    342         $(CBCSRCDIR)/src` $(am__append_1)
     355        $(CGLSRCDIR)/src/CglGomory` -I`$(CYGPATH_W) \
     356        $(CGLSRCDIR)/src/CglProbing` -I`$(CYGPATH_W) \
     357        $(CGLSRCDIR)/src/CglOddHole` -I`$(CYGPATH_W) \
     358        $(CGLSRCDIR)/src/CglClique` -I`$(CYGPATH_W) \
     359        $(CGLSRCDIR)/src/CglFlowCover` -I`$(CYGPATH_W) \
     360        $(CGLSRCDIR)/src/CglMixedIntegerRounding` -I`$(CYGPATH_W) \
     361        $(CGLSRCDIR)/src/CglMixedIntegerRounding2` -I`$(CYGPATH_W) \
     362        $(CGLSRCDIR)/src/CglClique` -I`$(CYGPATH_W) \
     363        $(CGLSRCDIR)/src/CglLandP` -I`$(CYGPATH_W) \
     364        $(CGLSRCDIR)/src/CglRedSplit` -I`$(CYGPATH_W) \
     365        $(CGLSRCDIR)/src/CglTwomir` -I`$(CYGPATH_W) \
     366        $(CGLSRCDIR)/src/CglKnapsackCover` -I`$(CYGPATH_W) \
     367        $(CGLSRCDIR)/src/CglPreProcess` -I`$(CYGPATH_W) \
     368        $(CBCSRCDIR)/src` -I`$(CYGPATH_W) $(CBCSRCDIR)/examples` \
     369        $(am__append_1)
    343370
    344371# This line is necessary to allow VPATH compilation with MS compilers
    345372# on Cygwin
    346373DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/inc
     374include_HEADERS = \
     375        BonDummyHeuristic.hpp \
     376        BonOaNlpOptim.hpp \
     377        BonOACutGenerator2.hpp \
     378        BonOaFeasChecker.hpp \
     379        BonOaDecBase.hpp \
     380        BonEcpCuts.hpp \
     381        BonCbcLpStrategy.hpp \
     382        BonOAMessages.hpp
     383
    347384
    348385########################################################################
     
    410447        -rm -f *.tab.c
    411448
     449@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonCbcLpStrategy.Plo@am__quote@
    412450@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonDummyHeuristic.Plo@am__quote@
    413451@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonEcpCuts.Plo@am__quote@
     
    448486        -rm -f libtool
    449487uninstall-info-am:
     488install-includeHEADERS: $(include_HEADERS)
     489        @$(NORMAL_INSTALL)
     490        test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
     491        @list='$(include_HEADERS)'; for p in $$list; do \
     492          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
     493          f=$(am__strip_dir) \
     494          echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
     495          $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
     496        done
     497
     498uninstall-includeHEADERS:
     499        @$(NORMAL_UNINSTALL)
     500        @list='$(include_HEADERS)'; for p in $$list; do \
     501          f=$(am__strip_dir) \
     502          echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
     503          rm -f "$(DESTDIR)$(includedir)/$$f"; \
     504        done
    450505
    451506ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
     
    526581check-am: all-am
    527582check: check-am
    528 all-am: Makefile $(LTLIBRARIES)
     583all-am: Makefile $(LTLIBRARIES) $(HEADERS)
    529584installdirs:
     585        for dir in "$(DESTDIR)$(includedir)"; do \
     586          test -z "$$dir" || $(mkdir_p) "$$dir"; \
     587        done
    530588install: install-am
    531589install-exec: install-exec-am
     
    574632info-am:
    575633
    576 install-data-am:
     634install-data-am: install-includeHEADERS
    577635
    578636install-exec-am:
     
    602660ps-am:
    603661
    604 uninstall-am: uninstall-info-am
     662uninstall-am: uninstall-includeHEADERS uninstall-info-am
    605663
    606664.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
     
    609667        distclean-tags distdir dvi dvi-am html html-am info info-am \
    610668        install install-am install-data install-data-am install-exec \
    611         install-exec-am install-info install-info-am install-man \
    612         install-strip installcheck installcheck-am installdirs \
    613         maintainer-clean maintainer-clean-generic mostlyclean \
    614         mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
    615         pdf pdf-am ps ps-am tags uninstall uninstall-am \
     669        install-exec-am install-includeHEADERS install-info \
     670        install-info-am install-man install-strip installcheck \
     671        installcheck-am installdirs maintainer-clean \
     672        maintainer-clean-generic mostlyclean mostlyclean-compile \
     673        mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
     674        tags uninstall uninstall-am uninstall-includeHEADERS \
    616675        uninstall-info-am
    617676
  • trunk/Bonmin/src/Apps/BonMin.cpp

    r473 r481  
    1818
    1919#include "CoinTime.hpp"
    20 #include "BonAmplInterface.hpp"
    21 #include "BonIpoptSolver.hpp"
    22 #include "BonCbc.hpp"
    23 
    24 #include "BonOACutGenerator2.hpp"
    25 #include "BonEcpCuts.hpp"
    26 #include "BonOaNlpOptim.hpp"
     20#include "BonAmplSetup.hpp"
     21#include "BonCbc2.hpp"
    2722
    2823namespace Bonmin{
     
    3227{
    3328  using namespace Ipopt;
    34   AmplInterface * nlp_and_solver;
    3529  char * pbName = NULL;
    36 
     30 
    3731  if(argc > 1) {
    3832    pbName = new char[strlen(argv[1])+1];
    3933    strcpy(pbName, argv[1]);
    4034  }
    41   else { //will just output usage
    42     Ipopt::SmartPtr<IpoptSolver> dummy_ipopt = new IpoptSolver;     
    43     nlp_and_solver = new AmplInterface(argv, GetRawPtr(dummy_ipopt));
    44     delete nlp_and_solver;
    45     return 0;
    46   }
     35 
     36#if 0
     37  try
     38#endif
     39  {
    4740
    48   double time1 = CoinCpuTime();
    49   try {
    50     nlp_and_solver = new AmplInterface();
    51    
    52     OACutGenerator2::registerOptions(nlp_and_solver->regOptions());
    53     EcpCuts::registerOptions(nlp_and_solver->regOptions());
    54     OaNlpOptim::registerOptions(nlp_and_solver->regOptions());
    55     nlp_and_solver->readAmplNlFile(argv);
     41    BonminAmplSetup bonmin;
     42    bonmin.initializeBonmin(argv);
     43    Bab2 bb;
    5644
    57     BonminCbcParam par;
    58     Bab bb;
    59     par(nlp_and_solver);
    60     bb(nlp_and_solver, par);//do branch and bound
    61 
    62     std::cout.precision(10);
    63 
    64     std::cout<<pbName<<" \t";
    65     std::string message;
    66     std::string status;
    67     if(bb.mipStatus()==Bab::FeasibleOptimal) {
    68       status = "\t\"Finished\"";
    69       message = "\nbonmin: Optimal";
    70     }
    71     else if(bb.mipStatus()==Bab::ProvenInfeasible) {
    72       status = "\t\"Finished\"";
    73       message = "\nbonmin: Infeasible problem";
    74     }
    75     else if(bb.mipStatus()==Bab::Feasible) {
    76       status = "\t\"Not finished\"";
    77       message = "\n Optimization not finished.";
    78     }
    79     else if(bb.mipStatus()==Bab::NoSolutionKnown) {
    80       status = "\t\"Not finished\"";
    81       message = "\n Optimization not finished.";
    82     }
    83 
    84     /*
    85     std::cout<<std::endl << "{";
    86     for (int i=0; i<37; i++)
    87       std::cout << bb.bestSolution() [i] << ",";
    88     std::cout << "}" <<std::endl;
    89     */
    90 
    91   if(0)// To output a line for building tables
    92     std::cout<<status<<"\t"<<CoinCpuTime()-time1<<"\t"
    93              <<bb.bestObj()<<"\t"
    94              <<bb.numNodes()<<"\t"
    95              <<bb.iterationCount()<<"\t"
    96              <<nlp_and_solver->totalNlpSolveTime()<<"\t"
    97              <<nlp_and_solver->nCallOptimizeTNLP()<<"\t"
    98              <<std::endl;
    99     nlp_and_solver->writeAmplSolFile(message,bb.bestSolution(),NULL);
     45    bb(bonmin);//do branch and bound
    10046
    10147  }
     48  #if 0
    10249  catch(TNLPSolver::UnsolvedError *E) {
    103      E->writeDiffFiles();
    104      E->printError(std::cerr);
     50    E->writeDiffFiles();
     51    E->printError(std::cerr);
    10552    //There has been a failure to solve a problem with Ipopt.
    10653    //And we will output file with information on what has been changed in the problem to make it fail.
     
    11057  catch(OsiTMINLPInterface::SimpleError &E) {
    11158    std::cerr<<E.className()<<"::"<<E.methodName()
    112              <<std::endl
    113              <<E.message()<<std::endl;
     59    <<std::endl
     60    <<E.message()<<std::endl;
    11461  }
    11562  catch(CoinError &E) {
    11663    std::cerr<<E.className()<<"::"<<E.methodName()
    117              <<std::endl
    118              <<E.message()<<std::endl;
     64    <<std::endl
     65    <<E.message()<<std::endl;
    11966  }
    12067  catch (Ipopt::OPTION_INVALID &E)
    12168  {
    122    std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
     69    std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
    12370  }
    12471  catch(...) {
     
    12774    throw;
    12875  }
    129 
     76#endif
     77 
    13078  delete [] pbName;
    131   delete nlp_and_solver;
    13279  return 0;
    13380}
  • trunk/Bonmin/src/Apps/BonNodeSolver.cpp

    r248 r481  
    2525#include "BonStartPointReader.hpp"
    2626#include "CoinTime.hpp"
     27
     28#include "BonAmplSetup.hpp"
     29
    2730
    2831/************************************************************************
     
    5659  myArgv[2]= NULL;//new char[1];
    5760
    58   Bonmin::AmplInterface nlpSolver(myArgv);
    5961
    60   Ipopt::SmartPtr<Ipopt::OptionsList> Options =
    61     nlpSolver.retrieve_options();
     62    BonminAmplSetup bonmin;
     63    bonmin.initializeBonmin(argv);
     64    Bonmin::OsiTMINLPInterface& nlpSolver = *bonmin.nonlinearSolver();
     65 
     66    Ipopt::SmartPtr<Ipopt::OptionsList> Options =
     67      nlpSolver.options();
    6268
    63   nlpSolver.messageHandler()->setLogLevel(2);
     69    nlpSolver.messageHandler()->setLogLevel(2);
    6470
    6571  try
  • trunk/Bonmin/src/Apps/Makefile.am

    r464 r481  
    4343
    4444bonmin_LDADD = \
    45         ../Interfaces/Ampl/libamplinterface.la\
     45        ../CbcBonmin/libbonminampl.la \
    4646        ../CbcBonmin/libbonmin.la \
    4747        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
     
    6262        -I`$(CYGPATH_W) $(srcdir)/../Algorithms/Branching` \
    6363        -I`$(CYGPATH_W) $(srcdir)/../Algorithms/OaGenerators` \
     64        -I`$(CYGPATH_W) $(srcdir)/../Algorithms/Ampl` \
    6465        -I`$(CYGPATH_W) $(srcdir)/../Interfaces` \
    6566        -I`$(CYGPATH_W) $(srcdir)/../Interfaces/Ipopt` \
     
    9495
    9596nodeSolver_LDADD = \
    96         ../Interfaces/Ampl/libamplinterface.la \
     97        ../CbcBonmin/libbonminampl.la \
    9798        ../CbcBonmin/libbonmin.la \
    9899        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
  • trunk/Bonmin/src/Apps/Makefile.in

    r464 r481  
    7979        $(OSIOBJDIR)/src/libOsi.la $(CLPOBJDIR)/src/libClp.la \
    8080        $(COINUTILSOBJDIR)/src/libCoinUtils.la $(am__DEPENDENCIES_3)
    81 bonmin_DEPENDENCIES = ../Interfaces/Ampl/libamplinterface.la \
     81bonmin_DEPENDENCIES = ../CbcBonmin/libbonminampl.la \
    8282        ../CbcBonmin/libbonmin.la \
    8383        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
     
    8686am_nodeSolver_OBJECTS = BonNodeSolver.$(OBJEXT)
    8787nodeSolver_OBJECTS = $(am_nodeSolver_OBJECTS)
    88 nodeSolver_DEPENDENCIES = ../Interfaces/Ampl/libamplinterface.la \
     88nodeSolver_DEPENDENCIES = ../CbcBonmin/libbonminampl.la \
    8989        ../CbcBonmin/libbonmin.la \
    9090        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
     
    341341bonmin_SOURCES = BonMin.cpp
    342342bonmin_LDADD = \
    343         ../Interfaces/Ampl/libamplinterface.la\
     343        ../CbcBonmin/libbonminampl.la \
    344344        ../CbcBonmin/libbonmin.la \
    345345        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
     
    360360        $(srcdir)/../Algorithms/Branching` -I`$(CYGPATH_W) \
    361361        $(srcdir)/../Algorithms/OaGenerators` -I`$(CYGPATH_W) \
     362        $(srcdir)/../Algorithms/Ampl` -I`$(CYGPATH_W) \
    362363        $(srcdir)/../Interfaces` -I`$(CYGPATH_W) \
    363364        $(srcdir)/../Interfaces/Ipopt` -I`$(CYGPATH_W) \
     
    382383nodeSolver_SOURCES = BonNodeSolver.cpp
    383384nodeSolver_LDADD = \
    384         ../Interfaces/Ampl/libamplinterface.la \
     385        ../CbcBonmin/libbonminampl.la \
    385386        ../CbcBonmin/libbonmin.la \
    386387        $(IPOPTOBJDIR)/src/Apps/AmplSolver/libamplinterface.la \
  • trunk/Bonmin/src/CbcBonmin/BonCbc.cpp

    r474 r481  
    1818#include "BonCbcParam.hpp"
    1919
    20 // AW
    21 #include "BonCurvBranching.hpp"
    22 #include "BonQPStrongBranching.hpp"
    23 #include "BonLpStrongBranching.hpp"
     20
    2421
    2522//OA machinery
     
    6259#include "CbcBranchUser.hpp"
    6360
     61// AW
     62#include "BonCurvBranching.hpp"
     63#include "BonQPStrongBranching.hpp"
     64#include "BonLpStrongBranching.hpp"
    6465
    6566// Code to enable user interuption
     
    125126
    126127    ecpGen.assignNlpInterface(nlpSolver);
    127     ecpGen.parameter().global_ = par.oaCutsGlobal;
    128     ecpGen.parameter().addOnlyViolated_ = par.addOnlyViolatedOa;
    129128    ecpGen.setNumRounds(par.numEcpRounds);
    130129
     
    155154      oaDec.parameter().maxLocalSearchPerNode_ = 10000;
    156155      oaDec.parameter().maxLocalSearchTime_ =
    157           Ipopt::Min(par.maxTime, par.oaDecMaxTime);
    158       oaDec.setLogLevel(par.oaLogLevel);
    159       oaDec.parameter().logFrequency_ = par.oaLogFrequency;
    160       oaDec.parameter().subMilpLogLevel_ = par.milpLogLevel;
    161       oaDec.parameter().global_ = par.oaCutsGlobal;
    162       oaDec.parameter().addOnlyViolated_ = par.addOnlyViolatedOa;
     156        Ipopt::Min(par.maxTime, par.oaDecMaxTime);
    163157    }
    164158    //Setup solver for checking validity of integral solutions
     
    175169      feasCheck.parameter().maxLocalSearch_ = 0;
    176170      feasCheck.parameter().maxLocalSearchPerNode_ = 100000;
    177       feasCheck.parameter().global_ = par.oaCutsGlobal;
    178       feasCheck.parameter().addOnlyViolated_ = par.addOnlyViolatedOa;
    179171    }
    180172   // feasCheck.registerOptions(nlpSolver->regOptions());
     
    224216      si = new OsiClpSolverInterface;
    225217      nlpSolver->extractLinearRelaxation(*si);
     218
    226219      //#define GREAT_STUFF_FOR_ANDREAS
    227220#ifdef GREAT_STUFF_FOR_ANDREAS
     
    571564      <<"************************************************************"<<std::endl;
    572565    }
     566    TMINLP::SolverReturn status;
     567
    573568    if(model.numberObjects()==0){
    574569      if(bestSolution_)
     
    577572      CoinCopyN(nlpSolver->getColSolution(), nlpSolver->getNumCols(),
    578573                bestSolution_);
    579     }
     574      bestObj_ = bestBound_ = nlpSolver->getObjValue();
     575    }
     576   
    580577    if (model.bestSolution()) {
    581578      if (bestSolution_)
     
    584581      CoinCopyN(model.bestSolution(), nlpSolver->getNumCols(), bestSolution_);
    585582    }
    586     if (!model.status()) {
    587       if (bestSolution_)
     583    if (model.status() == 0) {
     584      if (bestSolution_){
     585        status = TMINLP::SUCCESS;
    588586        mipStatus_ = FeasibleOptimal;
    589       else
     587      }
     588      else {
     589        status = TMINLP::INFEASIBLE;
    590590        mipStatus_ = ProvenInfeasible;
    591     }
    592     else {
    593       if (bestSolution_)
     591      }
     592    }
     593    else if(model.status() == 1){
     594      status = TMINLP::LIMIT_EXCEEDED;
     595      if (bestSolution_){
    594596        mipStatus_ = Feasible;
    595       else
     597      }
     598      else {
    596599        mipStatus_ = NoSolutionKnown;
    597     }
    598 
     600      }
     601    }
     602    else if(model.status()==2){
     603      status = TMINLP::MINLP_ERROR;
     604    }
     605
     606    nlpSolver->model()->finalize_solution(status, nlpSolver->getNumCols(), bestSolution_,
     607                                         bestObj_);
     608   
    599609
    600610    if (par.algo > 0)
  • trunk/Bonmin/src/CbcBonmin/BonCbcNode.cpp

    r67 r481  
    7070    return new BonCbcFullNodeInfo(*this);
    7171  }
     72 
     73  void
     74  BonCbcFullNodeInfo::registerOptions(Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions){
     75   
     76   
     77    roptions->SetRegisteringCategory("bonmin options for non-convex problems");
     78    roptions->AddLowerBoundedIntegerOption("max_consecutive_infeasible",
     79                                           "Number of consecutive infeasible subproblems before aborting a"
     80                                           " branch.",
     81                                           0,0,
     82                                           "Will continue exploring a branch of the tree until \"max_consecutive_infeasible\""
     83                                           "consecutive problems are infeasibles by the NLP sub-solver.");
     84   
     85    roptions->SetRegisteringCategory("bonmin options for robustness");
     86    roptions->AddLowerBoundedIntegerOption
     87    ("max_consecutive_failures",
     88   "(temporarily removed) Number $n$ of consecutive unsolved problems before aborting a branch of the tree.",
     89   0,10,
     90   "When $n > 0$, continue exploring a branch of the tree until $n$ "
     91   "consecutive problems in the branch are unsolved (we call unsolved a problem for which Ipopt can not "
     92   "guarantee optimality within the specified tolerances).");
     93 
     94  }
     95 
     96 
    7297  /****************************************************************************************************/
    7398
  • trunk/Bonmin/src/CbcBonmin/BonCbcNode.hpp

    r62 r481  
    1313
    1414#include "CbcNode.hpp"
     15#include "IpRegOptions.hpp"
    1516
    1617
     
    5960      return sequenceOfUnsolvedSize_;
    6061    }
     62    /** Register all the options for class instance.*/
     63    static void registerOptions(Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions);
     64
    6165  private:
    6266    /* Data values */
  • trunk/Bonmin/src/CbcBonmin/BonCbcParam.cpp

    r464 r481  
    1919    bool success = true;
    2020
    21     Ipopt::SmartPtr<Ipopt::OptionsList> Options = solver->retrieve_options();
     21    Ipopt::SmartPtr<Ipopt::OptionsList> Options = solver->options();
    2222
    2323    //extract IpoptInterface special params
    2424    solver->extractInterfaceParams();
    2525
     26    Options->GetEnumValue("algorithm",algo,"bonmin.");
    2627    //log levels
    2728    Options->GetIntegerValue("bb_log_level",bbLogLevel,"bonmin.");
     
    3334    Options->GetIntegerValue("nlp_log_level",nlpLogLevel,"bonmin.");
    3435    //General options
    35     Options->GetEnumValue("algorithm",algo,"bonmin.");
    3636    Options->GetNumericValue("time_limit", maxTime, "bonmin.");
    3737    Options->GetIntegerValue("node_limit",maxNodes,"bonmin.");
  • trunk/Bonmin/src/CbcBonmin/Makefile.am

    r464 r481  
    1111# Name of the library in this directory
    1212lib_LTLIBRARIES = libbonmin.la
    13 
     13if COIN_HAS_ASL
     14lib_LTLIBRARIES += libbonminampl.la
     15endif
    1416########################################################################
    1517#                          bonmin library                              #
     
    1921libbonmin_la_SOURCES = \
    2022        BonCbc.cpp BonCbc.hpp \
    21         BonCbcLpStrategy.cpp BonCbcLpStrategy.hpp \
     23        BonCbc2.cpp BonCbc2.hpp \
    2224        BonCbcNlpStrategy.cpp BonCbcNlpStrategy.hpp \
    2325        BonCbcNode.cpp BonCbcNode.hpp \
     26        BonAuxInfos.cpp BonAuxInfos.hpp \
    2427        BonCbcParam.cpp BonCbcParam.hpp
    2528
     
    3538# This is for libtool (on Windows)
    3639libbonmin_la_LDFLAGS = $(LT_LDFLAGS)
     40
     41########################################################################
     42#                         amplbonmin library                           #
     43########################################################################
     44
     45# List all source files, including headers
     46libbonminampl_la_SOURCES =
     47
     48libbonminampl_la_LIBADD = \
     49        ../Algorithms/Ampl/libbonamplsetup.la \
     50        ../Interfaces/Ampl/libbonamplinterface.la
     51
     52libbonminampl_la_DEPENDENCIES = $(libamplbonmin_la_LIBADD)
     53
     54# This is for libtool (on Windows)
     55libbonminampl_la_LDFLAGS = $(LT_LDFLAGS)
    3756
    3857# Here list all include flags, relative to this "srcdir" directory.  This
     
    99118include_HEADERS = \
    100119        BonCbc.hpp \
     120        BonCbc2.hpp \
     121        BonAuxInfos.hpp \
    101122        BonCbcParam.hpp
    102123
  • trunk/Bonmin/src/CbcBonmin/Makefile.in

    r464 r481  
    4444build_triplet = @build@
    4545host_triplet = @host@
    46 @COIN_HAS_CPX_TRUE@am__append_1 = \
     46@COIN_HAS_ASL_TRUE@am__append_1 = libbonminampl.la
     47@COIN_HAS_CPX_TRUE@am__append_2 = \
    4748@COIN_HAS_CPX_TRUE@     -I`$(CYGPATH_W) $(OSISRCDIR)/src/OsiCpx` \
    4849@COIN_HAS_CPX_TRUE@     -I`$(CYGPATH_W) $(CPXINCDIR)`
     
    6970LTLIBRARIES = $(lib_LTLIBRARIES)
    7071am__DEPENDENCIES_1 =
    71 am_libbonmin_la_OBJECTS = BonCbc.lo BonCbcLpStrategy.lo \
    72         BonCbcNlpStrategy.lo BonCbcNode.lo BonCbcParam.lo
     72am_libbonmin_la_OBJECTS = BonCbc.lo BonCbc2.lo BonCbcNlpStrategy.lo \
     73        BonCbcNode.lo BonAuxInfos.lo BonCbcParam.lo
    7374nodist_libbonmin_la_OBJECTS = CbcCompareUser.lo CbcBranchUser.lo
    7475libbonmin_la_OBJECTS = $(am_libbonmin_la_OBJECTS) \
    7576        $(nodist_libbonmin_la_OBJECTS)
     77am_libbonminampl_la_OBJECTS =
     78libbonminampl_la_OBJECTS = $(am_libbonminampl_la_OBJECTS)
     79@COIN_HAS_ASL_TRUE@am_libbonminampl_la_rpath = -rpath $(libdir)
    7680depcomp = $(SHELL) $(top_srcdir)/../depcomp
    7781am__depfiles_maybe = depfiles
     
    9296LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
    9397        $(AM_LDFLAGS) $(LDFLAGS) -o $@
    94 SOURCES = $(libbonmin_la_SOURCES) $(nodist_libbonmin_la_SOURCES)
    95 DIST_SOURCES = $(libbonmin_la_SOURCES)
     98SOURCES = $(libbonmin_la_SOURCES) $(nodist_libbonmin_la_SOURCES) \
     99        $(libbonminampl_la_SOURCES)
     100DIST_SOURCES = $(libbonmin_la_SOURCES) $(libbonminampl_la_SOURCES)
    96101includeHEADERS_INSTALL = $(INSTALL_HEADER)
    97102HEADERS = $(include_HEADERS)
     
    321326
    322327# Name of the library in this directory
    323 lib_LTLIBRARIES = libbonmin.la
    324 
     328lib_LTLIBRARIES = libbonmin.la $(am__append_1)
    325329########################################################################
    326330#                          bonmin library                              #
     
    330334libbonmin_la_SOURCES = \
    331335        BonCbc.cpp BonCbc.hpp \
    332         BonCbcLpStrategy.cpp BonCbcLpStrategy.hpp \
     336        BonCbc2.cpp BonCbc2.hpp \
    333337        BonCbcNlpStrategy.cpp BonCbcNlpStrategy.hpp \
    334338        BonCbcNode.cpp BonCbcNode.hpp \
     339        BonAuxInfos.cpp BonAuxInfos.hpp \
    335340        BonCbcParam.cpp BonCbcParam.hpp
    336341
     
    345350# This is for libtool (on Windows)
    346351libbonmin_la_LDFLAGS = $(LT_LDFLAGS)
     352
     353########################################################################
     354#                         amplbonmin library                           #
     355########################################################################
     356
     357# List all source files, including headers
     358libbonminampl_la_SOURCES =
     359libbonminampl_la_LIBADD = \
     360        ../Algorithms/Ampl/libbonamplsetup.la \
     361        ../Interfaces/Ampl/libbonamplinterface.la
     362
     363libbonminampl_la_DEPENDENCIES = $(libamplbonmin_la_LIBADD)
     364
     365# This is for libtool (on Windows)
     366libbonminampl_la_LDFLAGS = $(LT_LDFLAGS)
    347367
    348368# Here list all include flags, relative to this "srcdir" directory.  This
     
    375395        $(CGLSRCDIR)/src/CglPreProcess` -I`$(CYGPATH_W) \
    376396        $(CGLSRCDIR)/src` -I`$(CYGPATH_W) $(CBCSRCDIR)/src` \
    377         -I`$(CYGPATH_W) $(CBCSRCDIR)/examples` $(am__append_1)
     397        -I`$(CYGPATH_W) $(CBCSRCDIR)/examples` $(am__append_2)
    378398
    379399# This line is necessary to allow VPATH compilation with MS compilers
     
    386406include_HEADERS = \
    387407        BonCbc.hpp \
     408        BonCbc2.hpp \
     409        BonAuxInfos.hpp \
    388410        BonCbcParam.hpp
    389411
     
    468490libbonmin.la: $(libbonmin_la_OBJECTS) $(libbonmin_la_DEPENDENCIES)
    469491        $(CXXLINK) -rpath $(libdir) $(libbonmin_la_LDFLAGS) $(libbonmin_la_OBJECTS) $(libbonmin_la_LIBADD) $(LIBS)
     492libbonminampl.la: $(libbonminampl_la_OBJECTS) $(libbonminampl_la_DEPENDENCIES)
     493        $(LINK) $(am_libbonminampl_la_rpath) $(libbonminampl_la_LDFLAGS) $(libbonminampl_la_OBJECTS) $(libbonminampl_la_LIBADD) $(LIBS)
    470494
    471495mostlyclean-compile:
     
    475499        -rm -f *.tab.c
    476500
     501@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonAuxInfos.Plo@am__quote@
    477502@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonCbc.Plo@am__quote@
    478 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonCbcLpStrategy.Plo@am__quote@
     503@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonCbc2.Plo@am__quote@
    479504@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonCbcNlpStrategy.Plo@am__quote@
    480505@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BonCbcNode.Plo@am__quote@
  • trunk/Bonmin/src/Interfaces/Ampl/BonAmplInterface.cpp

    r464 r481  
    2424namespace Bonmin
    2525{
    26   /** Default constructor */
    27   AmplInterface::AmplInterface(): OsiTMINLPInterface(), amplTminlp_(NULL)
    28   {}
    29 
    30   /** Constructor with inputed ampl command line (reads model from nl file).*/
    31   AmplInterface::AmplInterface(char **& amplArgs,
    32                                SmartPtr<TNLPSolver> app
    33                                )
    34   :
    35   OsiTMINLPInterface(app),
    36   amplTminlp_(NULL)
    37 {
    38     std::cout<<"Usage of this constructor is deprecated"<<std::endl;
    39     readAmplNlFile(amplArgs, NULL, NULL);
    40 }
    41 
    42 /** Constructor with inputed ampl command line (reads model from nl file)*/
    43 AmplInterface::AmplInterface(char **& amplArgs
    44                              )
    45 :
    46 OsiTMINLPInterface(),
    47 amplTminlp_(NULL)
    48 {
    49   std::cout<<"Usage of this constructor is deprecated"<<std::endl;
    50   readAmplNlFile(amplArgs, NULL, NULL);
    51 }
     26  /** Default constructor no initialization*/
     27  AmplInterface::AmplInterface():
     28  OsiTMINLPInterface(), amplTminlp_(NULL)
     29{}
    5230
    5331/** Copy constructor */
     
    7048  }
    7149
    72   /** Read an ampl . nl file from the given filename */
    73   void
    74   AmplInterface::readAmplNlFile(char**& filename,
    75       std::string* ipopt_file_content /* = NULL */,
    76       std::string* nl_file_content /* = NULL */)
    77   {
    78     SmartPtr<RegisteredOptions> roptions = app_->RegOptions();
    79     registerOptions(roptions);
    8050
    81     // Call initalize to open output
    82     app_->Initialize("");
    83     // Read the bonmin.opt input file
    84     if (ipopt_file_content == NULL) {
    85       app_->Initialize("bonmin.opt");
    86     }
    87     else {
    88       std::stringstream ss(ipopt_file_content->c_str());
    89       app_->Initialize(ss);
    90     }
    91 
    92 
    93     // set the default options... expect_infeasible, etc...
    94     if (!IsValid(tminlp_)) {
    95       amplTminlp_ = new AmplTMINLP(Ipopt::ConstPtr(app_->Jnlst()), app_->Options(), filename,
    96           NULL, appName() , nl_file_content);
     51void AmplInterface::readAmplNlFile(char **& argv, Ipopt::SmartPtr<Ipopt::Journalist> journalist,
     52                                   Ipopt::SmartPtr<Ipopt::OptionsList> options,
     53                                   Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions,
     54                                   std::string* nl_file_content /* = NULL*/
     55                                   )
     56{
     57  if(!IsValid(app_)){
     58    createApplication(journalist, options, roptions);}
     59  // set the default options... expect_infeasible, etc...
     60  if (!IsValid(tminlp_)) {
     61    amplTminlp_ = new AmplTMINLP(Ipopt::ConstPtr(app_->Jnlst()), app_->Options(), argv,
     62                                 NULL, appName() , nl_file_content);
     63    tminlp_ = GetRawPtr(amplTminlp_);
     64  }
     65  else {
     66    AmplTMINLP * amplTMINLP = dynamic_cast<AmplTMINLP *> (GetRawPtr(tminlp_));
     67    if (amplTMINLP) {
     68      AmplTMINLP * newAmpl = amplTMINLP->createEmpty();
     69      newAmpl->Initialize(ConstPtr(app_->Jnlst()), app_->Options(), argv,
     70                          NULL, appName() , nl_file_content);
     71      amplTminlp_ = newAmpl;
    9772      tminlp_ = GetRawPtr(amplTminlp_);
    9873    }
    9974    else {
    100       AmplTMINLP * amplTMINLP = dynamic_cast<AmplTMINLP *> (GetRawPtr(tminlp_));
    101       if (amplTMINLP) {
    102         AmplTMINLP * newAmpl = amplTMINLP->createEmpty();
    103         newAmpl->Initialize(ConstPtr(app_->Jnlst()), app_->Options(), filename,
    104             NULL, appName() , nl_file_content);
    105         amplTminlp_ = newAmpl;
    106         tminlp_ = GetRawPtr(amplTminlp_);
    107       }
    108       else {
    109         amplTminlp_ = new AmplTMINLP(ConstPtr(app_->Jnlst()), app_->Options(), filename,
    110             NULL, appName() , nl_file_content);
    111         tminlp_ = GetRawPtr(amplTminlp_);
    112       }
     75      amplTminlp_ = new AmplTMINLP(ConstPtr(app_->Jnlst()), app_->Options(), argv,
     76                                   NULL, appName() , nl_file_content);
     77      tminlp_ = GetRawPtr(amplTminlp_);
    11378    }
    114     problem_ = new TMINLP2TNLP(tminlp_);//, *app_->Options());
    115 
    116     bool print_options_documentation;
    117     app_->Options()->GetBoolValue("print_options_documentation",
    118         print_options_documentation, "");
    119     if (print_options_documentation) {
    120       std::list<std::string> categories;
    121       categories.push_back("bonmin branch-and-bound options");
    122       categories.push_back("bonmin options for robustness");
    123       categories.push_back("bonmin options for non-convex problems");
    124       categories.push_back("bonmin options : B-Hyb specific options");
    125 //    roptions->OutputLatexOptionDocumentation2(*app_->Jnlst(),categories);
    126       roptions->OutputOptionDocumentation(*(Ipopt::ConstPtr(app_->Jnlst())),categories);
    127     }
    128 
    129     int numcols = getNumCols();
    130     if (obj_)
    131       delete [] obj_;
    132     obj_ = new double[numcols];
    133     CoinFillN(obj_,numcols,1.);
    134     setStrParam(OsiProbName, std::string(filename[1]));
    135     extractInterfaceParams();
    136     hasBeenOptimized_ = false;
    137     feasibilityProblem_ = new TNLP2FPNLP
    138         (Ipopt::SmartPtr<TNLP>(Ipopt::GetRawPtr(problem_)));
     79  }
     80  problem_ = new TMINLP2TNLP(tminlp_);
     81 
     82 
     83  int numcols = getNumCols();
     84  if (obj_)
     85    delete [] obj_;
     86  obj_ = new double[numcols];
     87  CoinFillN(obj_,numcols,1.);
     88  setStrParam(OsiProbName, std::string(argv[1]));
     89  extractInterfaceParams();
     90  hasBeenOptimized_ = false;
     91  feasibilityProblem_ = new TNLP2FPNLP
     92    (Ipopt::SmartPtr<TNLP>(Ipopt::GetRawPtr(problem_)));
     93 
     94}
     95  /** Read an ampl . nl file from the given filename */
     96  void
     97  AmplInterface::readAmplNlFile(char**& argv,
     98                                BasicSetup &b,
     99      std::string* nl_file_content /* = NULL */)
     100  {
     101    readAmplNlFile(argv, b.journalist(), b.options(), b.roptions());
    139102  }
    140103
    141   /** write ampl solution file */
    142   void
    143   AmplInterface::writeAmplSolFile(std::string message,const double * primalSol,const double * dualSol)
    144   {
    145     TMINLP * tminlp = GetRawPtr(tminlp_);
    146     AmplTMINLP * ampl_tminlp = dynamic_cast<AmplTMINLP *> (tminlp);
    147     if (ampl_tminlp)
    148       ampl_tminlp->write_solution(message,primalSol,dualSol);
    149     else
    150       std::cerr<<"Errot can not write .sol file for non ampl problem"<<std::endl;
    151   }
    152104
    153105void
  • trunk/Bonmin/src/Interfaces/Ampl/BonAmplInterface.hpp

    r464 r481  
    1616#include "BonAmplTMINLP.hpp"
    1717
     18class BM_lp;
    1819namespace Bonmin
    1920{
     
    2324  public:
    2425    /** Default constructor */
     26    /** Default constructor only available for Bonmin's friends and child classes.*/
    2527    AmplInterface();
    26     /** Constructor with inputed ampl command line (reads model from nl file). */
    27     AmplInterface(char **& amplArgs);
    28     /** Constructor with inputed ampl command line (reads model from nl file). */
    29     AmplInterface(char **& amplArgs, Ipopt::SmartPtr<TNLPSolver> app);
     28    /**@name Methods to input a problem */
     29    //@{
     30    /** Read an ampl . nl file from the given filename */
     31    virtual void readAmplNlFile(char**& filename,
     32                                BasicSetup &b,
     33                                std::string* nl_file_content  = NULL
     34                                );
     35   
     36   
     37        virtual void readAmplNlFile(char **& argv, Ipopt::SmartPtr<Ipopt::Journalist> journalist,
     38                                    Ipopt::SmartPtr<Ipopt::OptionsList> options,
     39                                    Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions,
     40                                    std::string* nl_file_content  = NULL);
     41    //@}   
    3042    /** Copy constructor */
    3143    AmplInterface(const AmplInterface &other);
     
    3648    virtual ~AmplInterface();
    3749
    38     /**@name Methods to input a problem */
    39     //@{
    40     /** Read an ampl . nl file from the given filename */
    41     virtual void readAmplNlFile(char**& filename,
    42         std::string* ipopt_file_content = NULL,
    43         std::string* nl_file_content = NULL
    44         );
    45     /** write ampl solution file */
    46     void writeAmplSolFile(std::string message,const double * primalSol = NULL,const double * dualSol = NULL);
    47     //@}
    4850
    4951    /** Fast access to AmplTMINLP */
     
    5658
    5759  protected:
    58 
     60   
    5961    /** TMINLP problem (the original problem usually an AmplTMINLP).*/
    6062    Ipopt::SmartPtr<Bonmin::AmplTMINLP> amplTminlp_;
  • trunk/Bonmin/src/Interfaces/Ampl/BonAmplTMINLP.cpp

    r473 r481  
    2929namespace Bonmin
    3030{
    31 
     31 
    3232  AmplTMINLP::AmplTMINLP()
    33       :
    34       TMINLP(),
    35       ampl_tnlp_(NULL),
    36       branch_(),
    37       sos_()
     33  :
     34  TMINLP(),
     35  ampl_tnlp_(NULL),
     36  branch_(),
     37  sos_()
    3838  {}
    39 
    40 
     39 
     40 
    4141  AmplTMINLP::AmplTMINLP(const SmartPtr<const Journalist>& jnlst,
    42       const SmartPtr<OptionsList> options,
    43       char**& argv,
    44       AmplSuffixHandler* suffix_handler /*=NULL*/,
    45       const std::string& appName,
    46       std::string* nl_file_content /* = NULL */)
    47       :
    48       TMINLP(),
    49       ampl_tnlp_(NULL),
    50       branch_(),
    51       sos_(),
    52       suffix_handler_(NULL)
     42                         const SmartPtr<OptionsList> options,
     43                         char**& argv,
     44                         AmplSuffixHandler* suffix_handler /*=NULL*/,
     45                         const std::string& appName,
     46                         std::string* nl_file_content /* = NULL */
     47                         )
     48  :
     49  TMINLP(),
     50  ampl_tnlp_(NULL),
     51  branch_(),
     52  sos_(),
     53  suffix_handler_(NULL)
    5354  {
    5455    Initialize(jnlst, options, argv, suffix_handler, appName, nl_file_content);
    5556  }
    56 
     57 
    5758  void
    5859  AmplTMINLP::Initialize(const SmartPtr<const Journalist>& jnlst,
    59       const SmartPtr<OptionsList> options,
    60       char**& argv,
    61       AmplSuffixHandler* suffix_handler /*=NULL*/,
    62       const std::string& appName,
    63       std::string* nl_file_content /* = NULL */)
    64   {
    65 
    66 
     60                         const SmartPtr<OptionsList> options,
     61                         char**& argv,
     62                         AmplSuffixHandler* suffix_handler /*=NULL*/,
     63                         const std::string& appName,
     64                         std::string* nl_file_content /* = NULL */
     65                         )
     66  {
     67   
     68   
    6769    if (suffix_handler==NULL)
    6870      suffix_handler_ = suffix_handler = new AmplSuffixHandler();
    69 
     71   
    7072    // Add the suffix handler for scaling
    7173    suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
    7274    suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Number_Type);
    7375    suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Objective_Source, AmplSuffixHandler::Number_Type);
    74 
     76   
    7577    // priority suffix
    7678    suffix_handler->AddAvailableSuffix("priority", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Index_Type);
     
    7880    suffix_handler->AddAvailableSuffix("downPseudocost", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
    7981    suffix_handler->AddAvailableSuffix("upPseudocost", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
    80 
    81 
    82 
     82   
     83   
     84   
    8385    // sos suffixes
    8486    suffix_handler->AddAvailableSuffix("ref", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
     
    8991    suffix_handler->AddAvailableSuffix("sstatus", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Index_Type);
    9092    suffix_handler->AddAvailableSuffix("sstatus", AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Index_Type);
    91 
     93   
    9294    // Perturbation radius
    9395    suffix_handler->AddAvailableSuffix("perturb_radius",AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
    94 
     96   
    9597    SmartPtr<AmplOptionsList> ampl_options_list = new AmplOptionsList();
    9698    fillAmplOptionList(GetRawPtr(ampl_options_list));
     
    98100    std::string options_id = appName + "_options";
    99101    ampl_tnlp_ = new AmplTNLP(jnlst, options, argv, suffix_handler, true,
    100         ampl_options_list, options_id.c_str(),
    101         appName.c_str(), appName.c_str(), nl_file_content);
     102                              ampl_options_list, options_id.c_str(),
     103                              appName.c_str(), appName.c_str(), nl_file_content);
    102104    /* Read suffixes */
    103105    read_priorities();
    104106    read_sos();
    105107  }
    106 
     108 
    107109  AmplTMINLP::~AmplTMINLP()
    108110  {
    109111    delete ampl_tnlp_;
    110112  }
    111 
     113 
    112114  void
    113115  AmplTMINLP::read_priorities()
     
    116118    TNLP::IndexStyleEnum index_style;
    117119    ampl_tnlp_->get_nlp_info(numcols, m, dummy1, dummy2, index_style);
    118 
     120   
    119121    const AmplSuffixHandler * suffix_handler = GetRawPtr(suffix_handler_);
    120 
     122   
    121123    const Index* pri = suffix_handler->GetIntegerSuffixValues("priority", AmplSuffixHandler::Variable_Source);
    122124    const Index* brac = suffix_handler->GetIntegerSuffixValues("direction", AmplSuffixHandler::Variable_Source);
    123125    const Number* upPs = suffix_handler->GetNumberSuffixValues("upPseudocost", AmplSuffixHandler::Variable_Source);
    124126    const Number* dwPs = suffix_handler->GetNumberSuffixValues("downPseudocost", AmplSuffixHandler::Variable_Source);
    125 
    126 
     127   
     128   
    127129    branch_.gutsOfDestructor();
    128130    branch_.size = numcols;
     
    138140    if (upPs && !dwPs) dwPs = upPs;
    139141    else if (dwPs && !upPs) upPs = dwPs;
    140 
     142   
    141143    if (upPs) {
    142144      branch_.upPsCosts = CoinCopyOfArray(upPs,numcols);
     
    145147      branch_.downPsCosts = CoinCopyOfArray(dwPs,numcols);
    146148    }
    147 
     149   
    148150    const double* perturb_radius =
    149151      suffix_handler->GetNumberSuffixValues("perturb_radius", AmplSuffixHandler::Variable_Source);
    150152    perturb_info_.SetPerturbationArray(numcols, perturb_radius);
    151153  }
    152 
     154 
    153155  void
    154156  AmplTMINLP::read_sos()
    155157  {
    156158    ASL_pfgh* asl = ampl_tnlp_->AmplSolverObject();
    157 
     159   
    158160    int i = 0;//ASL_suf_sos_explict_free;
    159161    int copri[2], **p_sospri;
     
    166168    int * priorities = NULL;
    167169    p_sospri = &priorities;
    168 
     170   
    169171    sos_.gutsOfDestructor();
    170 
     172   
    171173    sos_.num = suf_sos(i, &sos_.numNz, &types, p_sospri, copri,
    172         &starts, &indices, &weights);
     174                       &starts, &indices, &weights);
    173175    if (sos_.num) {
    174176      //Copy sos information
     
    178180      sos_.types = CoinCopyOfArray(types, sos_.num);
    179181      sos_.weights = CoinCopyOfArray(weights, sos_.numNz);
    180 
     182     
    181183      ampl_utils::sos_kludge(sos_.num, sos_.starts, sos_.weights);
    182184      for (int ii=0;ii<sos_.num;ii++) {
     
    190192    }
    191193  }
    192 
     194 
    193195  bool AmplTMINLP::get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, Index& nnz_h_lag, TNLP::IndexStyleEnum& index_style)
    194196  {
    195197    return ampl_tnlp_->get_nlp_info(n, m, nnz_jac_g, nnz_h_lag, index_style);
    196198  }
    197 
     199 
    198200  bool AmplTMINLP::get_variables_types(Index n, VariableType* var_types)
    199201  {
    200202    // The variables are sorted by type in AMPL, so all we need to
    201203    // know are the counts of each type.
    202 
    203 
     204   
     205   
    204206    Index n_non_linear_b= 0;
    205207    Index n_non_linear_bi= 0;
     
    211213    Index n_integers = 0;
    212214    ampl_tnlp_->get_discrete_info(n_non_linear_b, n_non_linear_bi, n_non_linear_c,
    213         n_non_linear_ci, n_non_linear_o, n_non_linear_oi,
    214         n_binaries, n_integers);
     215                                  n_non_linear_ci, n_non_linear_o, n_non_linear_oi,
     216                                  n_binaries, n_integers);
    215217    int totalNumberOfNonContinuous = 0;
    216218    //begin with variables non-linear both in the objective function and in some constraints
     
    221223      var_types[i] = CONTINUOUS;
    222224    }
    223 
     225   
    224226    // The second ones are integers
    225227    start = end;
     
    229231      totalNumberOfNonContinuous++;
    230232    }
    231 
     233   
    232234    //next variables non-linear in some constraints
    233235    // The first ones are continuous
     
    237239      var_types[i] = CONTINUOUS;
    238240    }
    239 
     241   
    240242    // The second ones are integers
    241243    start = end;
     
    245247      totalNumberOfNonContinuous++;
    246248    }
    247 
     249   
    248250    //next variables non-linear in the objective function
    249251    // The first ones are continuous
     
    253255      var_types[i] = CONTINUOUS;
    254256    }
    255 
     257   
    256258    // The second ones are integers
    257259    start = end;
     
    261263      totalNumberOfNonContinuous++;
    262264    }
    263 
     265   
    264266    //At last the linear variables
    265267    // The first ones are continuous
     
    269271      var_types[i] = CONTINUOUS;
    270272    }
    271 
     273   
    272274    // The second ones are binaries
    273275    start = end;
     
    277279      totalNumberOfNonContinuous++;
    278280    }
    279 
     281   
    280282    // The third ones are integers
    281283    start = end;
     
    288290    return true;
    289291  }
    290 
    291 
     292 
     293 
    292294  /** Returns the constraint linearity.
    293     * array should be alocated with length at least n.*/
     295  * array should be alocated with length at least n.*/
    294296  bool
    295297  AmplTMINLP::get_constraints_linearity(Index m,
     
    298300    return ampl_tnlp_->get_constraints_linearity(m, const_types);
    299301  }
    300 
     302 
    301303  bool AmplTMINLP::get_bounds_info(Index n, Number* x_l, Number* x_u,
    302       Index m, Number* g_l, Number* g_u)
     304                                   Index m, Number* g_l, Number* g_u)
    303305  {
    304306    return ampl_tnlp_->get_bounds_info(n, x_l, x_u, m, g_l, g_u);
    305307  }
    306 
     308 
    307309  bool AmplTMINLP::get_starting_point(Index n, bool init_x, Number* x,
    308       bool init_z, Number* z_L, Number* z_U,
    309       Index m, bool init_lambda, Number* lambda)
     310                                      bool init_z, Number* z_L, Number* z_U,
     311                                      Index m, bool init_lambda, Number* lambda)
    310312  {
    311313    return ampl_tnlp_->get_starting_point(n, init_x, x,
    312         init_z, z_L, z_U,
    313         m, init_lambda, lambda);
    314   }
    315 
     314                                          init_z, z_L, z_U,
     315                                          m, init_lambda, lambda);
     316  }
     317 
    316318  bool AmplTMINLP::eval_f(Index n, const Number* x, bool new_x, Number& obj_value)
    317319  {
    318320    return ampl_tnlp_->eval_f(n, x, new_x, obj_value);
    319321  }
    320 
     322 
    321323  bool AmplTMINLP::eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f)
    322324  {
    323325    return ampl_tnlp_->eval_grad_f(n, x, new_x, grad_f);
    324326  }
    325 
     327 
    326328  bool AmplTMINLP::eval_g(Index n, const Number* x, bool new_x, Index m, Number* g)
    327329  {
    328330    return ampl_tnlp_->eval_g(n, x, new_x, m, g);
    329331  }
    330 
     332 
    331333  bool AmplTMINLP::eval_jac_g(Index n, const Number* x, bool new_x,
    332       Index m, Index nele_jac, Index* iRow,
    333       Index *jCol, Number* values)
     334                              Index m, Index nele_jac, Index* iRow,
     335                              Index *jCol, Number* values)
    334336  {
    335337    return ampl_tnlp_->eval_jac_g(n, x, new_x,
    336         m, nele_jac, iRow, jCol,
    337         values);
    338   }
    339 
     338                                  m, nele_jac, iRow, jCol,
     339                                  values);
     340  }
     341 
    340342  bool AmplTMINLP::eval_h(Index n, const Number* x, bool new_x,
    341       Number obj_factor, Index m, const Number* lambda,
    342       bool new_lambda, Index nele_hess, Index* iRow,
    343       Index* jCol, Number* values)
     343                          Number obj_factor, Index m, const Number* lambda,
     344                          bool new_lambda, Index nele_hess, Index* iRow,
     345                          Index* jCol, Number* values)
    344346  {
    345347    return ampl_tnlp_->eval_h(n, x, new_x, obj_factor,
    346         m, lambda, new_lambda, nele_hess, iRow,
    347         jCol, values);
    348   }
    349 
     348                              m, lambda, new_lambda, nele_hess, iRow,
     349                              jCol, values);
     350  }
     351 
    350352  bool AmplTMINLP::eval_gi(Index n, const Number* x, bool new_x,
    351                            Index i, Number& gi)
     353                           Index i, Number& gi)
    352354  {
    353355    ASL_pfgh* asl = ampl_tnlp_->AmplSolverObject();
    354 
     356   
    355357    // ignore new_x for now
    356358    xunknown();
    357 
     359   
    358360    fint nerror = 0;
    359361    gi = conival(i, const_cast<real*>(x), &nerror);
     
    365367    }
    366368  }
    367 
     369 
    368370  bool AmplTMINLP::eval_grad_gi(Index n, const Number* x, bool new_x,
    369                                 Index i, Index& nele_grad_gi, Index* jCol,
    370                                 Number* values)
     371                                Index i, Index& nele_grad_gi, Index* jCol,
     372                                Number* values)
    371373  {
    372374    ASL_pfgh* asl = ampl_tnlp_->AmplSolverObject();
    373 
     375   
    374376    if (jCol) {
    375377      // Only compute the number of nonzeros and the indices
     
    377379      nele_grad_gi = 0;
    378380      for (cgrad* cg=Cgrad[i]; cg; cg = cg->next) {
    379         jCol[nele_grad_gi++] = cg->varno;
     381        jCol[nele_grad_gi++] = cg->varno;
    380382      }
    381383      return true;
    382384    }
    383385    DBG_ASSERT(values);
    384 
     386   
    385387    // ignore new_x for now
    386388    xunknown();
    387 
     389   
    388390    asl->i.congrd_mode = 1;
    389391    fint nerror = 0;
     
    396398    }
    397399  }
    398 
    399   void AmplTMINLP::finalize_solution(SolverReturn status,
    400       Index n, const Number* x, const Number* z_L, const Number* z_U,
    401       Index m, const Number* g, const Number* lambda,
    402       Number obj_value,
    403       const IpoptData* ip_data,
    404       IpoptCalculatedQuantities* ip_cq)
    405   {
    406     // Not sure if ampl require a different form of solution file
    407     // for MINLPs - we may have to write a different solution file here instead of
    408     // passing this back to ampl.
    409     ampl_tnlp_->finalize_solution(status,
    410         n, x, z_L, z_U,
    411         m, g, lambda,
    412         obj_value, ip_data, ip_cq);
    413 
     400 
     401  void AmplTMINLP::finalize_solution(TMINLP::SolverReturn status,
     402                                     Index n, const Number* x, Number obj_value)
     403  {
     404    std::string message;
     405    std::string status_str;
     406    if(status == TMINLP::SUCCESS) {
     407      status_str = "\t\"Finished\"";
     408      message = "\nbonmin: Optimal";
     409    }
     410    else if(status == TMINLP::INFEASIBLE) {
     411      status_str = "\t\"Finished\"";
     412      message = "\nbonmin: Infeasible problem";
     413    }
     414    else if(status == TMINLP::LIMIT_EXCEEDED) {
     415      status_str = "\t\"Not finished\"";
     416      message = "\n Optimization interupted on limit.";
     417    }
     418    else if(status == TMINLP::MINLP_ERROR) {
     419      status_str = "\t\"Aborted\"";
     420      message = "\n Error encountered in optimization.";
     421    }
     422    write_solution(message, x);
     423    std::cout<<"\n "<<status_str<<std::endl;   
     424  }
     425 
     426  void AmplTMINLP::write_solution(const std::string & message, const Number *x_sol)
     427  {
    414428    ASL_pfgh* asl = ampl_tnlp_->AmplSolverObject();
    415     solve_result_num = 0;
    416   }
    417 
    418   void AmplTMINLP::write_solution(const std::string & message, const Number *x_sol, const Number * lambda_sol)
    419   {
    420     ASL_pfgh* asl = ampl_tnlp_->AmplSolverObject();
    421 
     429   
    422430    DBG_ASSERT(asl);
    423431    //    DBG_ASSERT(x_sol);
    424 
     432   
    425433    // We need to copy the message into a non-const char array to make
    426434    // it work with the AMPL C function.
    427435    char* cmessage = new char[message.length()+1];
    428436    strcpy(cmessage, message.c_str());
    429 
     437   
    430438    // In order to avoid casting into non-const, we copy the data here...
    431439    double* x_sol_copy = NULL;
     
    436444      }
    437445    }
    438     double* lambda_sol_copy = NULL;
    439     if (lambda_sol_copy) {
    440       lambda_sol_copy = new double[n_con];
    441       for (int i=0; i<n_con; i++) {
    442         lambda_sol_copy[i] = lambda_sol[i];
    443       }
    444     }
    445     write_sol(cmessage, x_sol_copy, lambda_sol_copy, NULL);
    446 
     446    write_sol(cmessage, x_sol_copy, NULL, NULL);
     447   
    447448    delete [] x_sol_copy;
    448     delete [] lambda_sol_copy;
    449449    delete [] cmessage;
    450 
    451   }
    452 
    453 
     450   
     451  }
     452 
     453 
    454454  /** This methods gives the linear part of the objective function */
    455455  void AmplTMINLP::getLinearPartOfObjective(double * obj)
     
    468468    Index n_integers = 0;
    469469    ampl_tnlp_->get_discrete_info(n_non_linear_b, n_non_linear_bi, n_non_linear_c,
    470         n_non_linear_ci, n_non_linear_o, n_non_linear_oi,
    471         n_binaries, n_integers);
    472 
     470                                  n_non_linear_ci, n_non_linear_o, n_non_linear_oi,
     471                                  n_binaries, n_integers);
     472   
    473473    // Now get the coefficients of variables wich are linear in the objective
    474474    // The first ones are not
     
    478478      obj[i] = 0.;
    479479    }
    480 
     480   
    481481    //next variables should be linear in the objective just skip them
    482482    // (from current end to (end + n_non_linear_c - n_non_linear_ci - n_non_linear_b;)
    483 
    484 
     483   
     484   
    485485    // Those are nonlinear in the objective
    486486    start = end + n_non_linear_c;
     
    491491    //The rest is linear keep the values of the gradient
    492492  }
    493 
    494 
     493 
     494 
    495495  void
    496496  AmplTMINLP::fillAmplOptionList(AmplOptionsList* amplOptList)
    497497  {
    498498    amplOptList->AddAmplOption("bonmin.algorithm","bonmin.algorithm",
    499         AmplOptionsList::String_Option,
    500         "Choice of the algorithm.");
    501 
     499                               AmplOptionsList::String_Option,
     500                               "Choice of the algorithm.");
     501   
    502502    amplOptList->AddAmplOption("bonmin.bb_log_level","bonmin.bb_log_level",
    503         AmplOptionsList::Integer_Option,
    504         "specify BB log level");
    505 
     503                               AmplOptionsList::Integer_Option,
     504                               "specify BB log level");
     505   
    506506    amplOptList->AddAmplOption("bonmin.lp_log_level","bonmin.lp_log_level",
    507         AmplOptionsList::Integer_Option,
    508         "specify sub-LP log level");
    509 
     507                               AmplOptionsList::Integer_Option,
     508                               "specify sub-LP log level");
     509   
    510510    amplOptList->AddAmplOption("bonmin.milp_log_level","bonmin.milp_log_level",
    511         AmplOptionsList::Integer_Option,
    512         "specify sub-MILP log level");
    513 
     511                               AmplOptionsList::Integer_Option,
     512                               "specify sub-MILP log level");
     513   
    514514    amplOptList->AddAmplOption("bonmin.oa_log_level","bonmin.oa_log_level",
    515         AmplOptionsList::Integer_Option,
    516         "specify OA log level");
    517 
     515                               AmplOptionsList::Integer_Option,
     516                               "specify OA log level");
     517   
    518518    amplOptList->AddAmplOption("bonmin.oa_log_frequency","bonmin.oa_log_frequency",
    519         AmplOptionsList::Number_Option,
    520         "specify OA log frequency");
    521 
     519                               AmplOptionsList::Number_Option,
     520                               "specify OA log frequency");
     521   
    522522    amplOptList->AddAmplOption("bonmin.nlp_log_level","bonmin.nlp_log_level",
    523         AmplOptionsList::Integer_Option,
    524         "specify sub-NLP log level");
    525 
     523                               AmplOptionsList::Integer_Option,
     524                               "specify sub-NLP log level");
     525   
    526526    amplOptList->AddAmplOption("bonmin.print_user_options","bonmin.print_user_options",
    527         AmplOptionsList::String_Option,
    528         "print options list");
    529 
     527                               AmplOptionsList::String_Option,
     528                               "print options list");
     529   
    530530    amplOptList->AddAmplOption("bonmin.bb_log_interval","bonmin.bb_log_interval",
    531         AmplOptionsList::Integer_Option,
    532         "Interval at which bound output is given");
    533 
     531                               AmplOptionsList::Integer_Option,
     532                               "Interval at which bound output is given");
     533   
    534534    amplOptList->AddAmplOption("bonmin.allowable_gap","bonmin.allowable_gap",
    535         AmplOptionsList::Number_Option,
    536         "Specify allowable absolute gap");
    537 
     535                               AmplOptionsList::Number_Option,
     536                               "Specify allowable absolute gap");
     537   
    538538    amplOptList->AddAmplOption("bonmin.allowable_fraction_gap","bonmin.allowable_fraction_gap",
    539         AmplOptionsList::Number_Option,
    540         "Specify allowable relative gap");
    541 
     539                               AmplOptionsList::Number_Option,
     540                               "Specify allowable relative gap");
     541   
    542542    amplOptList->AddAmplOption("bonmin.cutoff_decr","bonmin.cutoff_decr",
    543         AmplOptionsList::Number_Option,
    544         "Specify cutoff decrement");
    545 
     543                               AmplOptionsList::Number_Option,
     544                               "Specify cutoff decrement");
     545   
    546546    amplOptList->AddAmplOption("bonmin.cutoff","bonmin.cutoff",
    547         AmplOptionsList::Number_Option,
    548         "Specify cutoff");
    549 
     547                               AmplOptionsList::Number_Option,
     548                               "Specify cutoff");
     549   
    550550    amplOptList->AddAmplOption("bonmin.nodeselect_stra","bonmin.nodeselect_stra",
    551         AmplOptionsList::String_Option,
    552         "Choose the node selection strategy");
    553 
     551                               AmplOptionsList::String_Option,
     552                               "Choose the node selection strategy");
     553   
    554554    amplOptList->AddAmplOption("bonmin.varselect_stra","bonmin.varselect_stra",
    555555                               AmplOptionsList::String_Option,
    556556                               "Choose the variable selection strategy");
    557 
    558    amplOptList->AddAmplOption("bonmin.varselect_stra","bonmin.varselect_stra",
     557   
     558    amplOptList->AddAmplOption("bonmin.varselect_stra","bonmin.varselect_stra",
    559559                               AmplOptionsList::String_Option,
    560560                               "Choose the variable selection strategy");
    561 
    562    amplOptList->AddAmplOption("bonmin.number_strong_branch", "bonmin.number_strong_branch",
    563         AmplOptionsList::Integer_Option,
    564         "Chooes number of variable for strong branching");
    565 
     561   
     562    amplOptList->AddAmplOption("bonmin.number_strong_branch", "bonmin.number_strong_branch",
     563                               AmplOptionsList::Integer_Option,
     564                               "Chooes number of variable for strong branching");
     565   
    566566    amplOptList->AddAmplOption("bonmin.number_before_trust", "bonmin.number_before_trust",
    567         AmplOptionsList::Integer_Option,
    568         "Set number of branches on a variable before its pseudo-costs are to be believed");
    569 
     567                               AmplOptionsList::Integer_Option,
     568                               "Set number of branches on a variable before its pseudo-costs are to be believed");
     569   
    570570    amplOptList->AddAmplOption("bonmin.time_limit", "bonmin.time_limit",
    571         AmplOptionsList::Number_Option,
    572         "Set maximum computation time for Algorithm");
    573 
     571                               AmplOptionsList::Number_Option,
     572                               "Set maximum computation time for Algorithm");
     573   
    574574    amplOptList->AddAmplOption("bonmin.node_limit","bonmin.node_limit",
    575         AmplOptionsList::Integer_Option,
    576         "Set maximum number of nodes explored");
    577 
     575                               AmplOptionsList::Integer_Option,
     576                               "Set maximum number of nodes explored");
     577   
    578578    amplOptList->AddAmplOption("bonmin.solution_limit","bonmin.solution_limit",
    579         AmplOptionsList::Integer_Option,
    580         "Set maximum of new best integer before aborting.");
    581 
     579                               AmplOptionsList::Integer_Option,
     580                               "Set maximum of new best integer before aborting.");
     581   
    582582    amplOptList->AddAmplOption("bonmin.iteration_limit","bonmin.iteration_limit",
    583         AmplOptionsList::Integer_Option,
    584         "Set cummulated maximum number of iterations in sub-algorithm used for nodes relaxations");
    585 
     583                               AmplOptionsList::Integer_Option,
     584                               "Set cummulated maximum number of iterations in sub-algorithm used for nodes relaxations");
     585   
    586586    amplOptList->AddAmplOption("bonmin.integer_tolerance", "bonmin.integer_tolerance",
    587         AmplOptionsList::Number_Option,
    588         "Set integer tolerance");
    589 
     587                               AmplOptionsList::Number_Option,
     588                               "Set integer tolerance");
     589   
    590590    amplOptList->AddAmplOption("bonmin.warm_start","bonmin.warm_start",
    591         AmplOptionsList::String_Option,
    592         "Set warm start method");
    593 
     591                               AmplOptionsList::String_Option,
     592                               "Set warm start method");
     593   
    594594    amplOptList->AddAmplOption("bonmin.sos_constraints","bonmin.sos_constraints",
    595         AmplOptionsList::String_Option,
    596         "Disable SOS contraints");
    597 
     595                               AmplOptionsList::String_Option,
     596                               "Disable SOS contraints");
     597   
    598598    amplOptList->AddAmplOption("bonmin.max_random_point_radius",
    599         "bonmin.max_random_point_radius",
    600         AmplOptionsList::Number_Option,
    601         "Set max value for a random point");
    602 
     599                               "bonmin.max_random_point_radius",
     600                               AmplOptionsList::Number_Option,
     601                               "Set max value for a random point");
     602   
    603603    amplOptList->AddAmplOption("bonmin.max_consecutive_failures",
    604         "bonmin.max_consecutive_failures",
    605         AmplOptionsList::Integer_Option,
    606         "Number of consecutive unsolved problems before aborting.");
    607 
     604                               "bonmin.max_consecutive_failures",
     605                               AmplOptionsList::Integer_Option,
     606                               "Number of consecutive unsolved problems before aborting.");
     607   
    608608    amplOptList->AddAmplOption("bonmin.num_iterations_suspect",
    609         "bonmin.num_iterations_suspect",
    610         AmplOptionsList::Integer_Option,
    611         "Number of iteration over which a node is considered suspect");
    612 
     609                               "bonmin.num_iterations_suspect",
     610                               AmplOptionsList::Integer_Option,
     611                               "Number of iteration over which a node is considered suspect");
     612   
    613613    amplOptList->AddAmplOption("bonmin.nlp_failure_behavior",
    614         "bonmin.nlp_failure_behavior",
    615         AmplOptionsList::String_Option,
    616         "Set the behavior when the nlp fails.");
    617 
     614                               "bonmin.nlp_failure_behavior",
     615                               AmplOptionsList::String_Option,
     616                               "Set the behavior when the nlp fails.");
     617   
    618618    amplOptList->AddAmplOption("bonmin.num_retry_unsolved_random_point",
    619         "bonmin.num_retry_unsolved_random_point",
    620         AmplOptionsList::Integer_Option,
    621         "Number of tries to resolve a failed NLP with a random starting point");
    622 
     619                               "bonmin.num_retry_unsolved_random_point",
     620                               AmplOptionsList::Integer_Option,
     621                               "Number of tries to resolve a failed NLP with a random starting point");
     622   
    623623    amplOptList->AddAmplOption("bonmin.max_consecutive_infeasible",
    624         "bonmin.max_consecutive_infeasible",
    625         AmplOptionsList::Integer_Option,
    626         "Number of consecutive infeasible problems before continuing a"
    627         " branch.");
    628 
     624                               "bonmin.max_consecutive_infeasible",
     625                               AmplOptionsList::Integer_Option,
     626                               "Number of consecutive infeasible problems before continuing a"
     627                               " branch.");
     628   
    629629    amplOptList->AddAmplOption("bonmin.num_resolve_at_root", "bonmin.num_resolve_at_root",
    630         AmplOptionsList::Integer_Option,
    631         "Number of tries to resolve the root node with different starting point (only usefull in non-convex).");
    632 
     630                               AmplOptionsList::Integer_Option,
     631                               "Number of tries to resolve the root node with different starting point (only usefull in non-convex).");
     632   
    633633    amplOptList->AddAmplOption("bonmin.num_resolve_at_node","bonmin.num_resolve_at_node",
    634         AmplOptionsList::Integer_Option,
    635         "Number of tries to resolve a non root node with different starting point (only usefull in non-convex).");
    636 
    637 
     634                               AmplOptionsList::Integer_Option,
     635                               "Number of tries to resolve a non root node with different starting point (only usefull in non-convex).");
     636   
     637   
    638638    amplOptList->AddAmplOption("bonmin.nlp_solve_frequency","bonmin.nlp_solve_frequency",
    639         AmplOptionsList::Integer_Option,
    640         "Specify the frequency at which nlp relaxations are solved in hybrid.");
    641 
     639                               AmplOptionsList::Integer_Option,
     640                               "Specify the frequency at which nlp relaxations are solved in hybrid.");
     641   
    642642    amplOptList->AddAmplOption("bonmin.filmint_ecp_cuts","bonmin.filmint_ecp_cuts",
    643         AmplOptionsList::Integer_Option,
    644         "Specify the frequency (in terms of nodes) at which some a la filmint ecp cuts are generated.");
    645 
     643                               AmplOptionsList::Integer_Option,
     644                               "Specify the frequency (in terms of nodes) at which some a la filmint ecp cuts are generated.");
     645   
    646646    amplOptList->AddAmplOption("bonmin.couenne_ecp_cuts","bonmin.couenne_ecp_cuts",
    647         AmplOptionsList::Integer_Option,
    648         "Specify the frequency (in terms of nodes) at which couenne cuts are generated.");
    649 
     647                               AmplOptionsList::Integer_Option,
     648                               "Specify the frequency (in terms of nodes) at which couenne cuts are generated.");
     649   
    650650    amplOptList->AddAmplOption("bonmin.oa_dec_time_limit", "bonmin.oa_dec_time_limit",
    651         AmplOptionsList::Number_Option,
    652         "Specify the maximum amount of time spent in OA decomposition iteratrions.");
    653 
     651                               AmplOptionsList::Number_Option,
     652                               "Specify the maximum amount of time spent in OA decomposition iteratrions.");
     653   
    654654    amplOptList->AddAmplOption("bonmin.tiny_element","bonmin.tiny_element",
    655         AmplOptionsList::Number_Option,
    656         "Value for tiny element in OA cut");
    657 
     655                               AmplOptionsList::Number_Option,
     656                               "Value for tiny element in OA cut");
     657   
    658658    amplOptList->AddAmplOption("bonmin.very_tiny_element","bonmin.very_tiny_element",
    659         AmplOptionsList::Number_Option,
    660         "Value for very tiny element in OA cut");
    661 
     659                               AmplOptionsList::Number_Option,
     660                               "Value for very tiny element in OA cut");
     661   
    662662    amplOptList->AddAmplOption("bonmin.milp_subsolver", "bonmin.milp_subsolver",
    663         AmplOptionsList::String_Option,
    664         "Choose the subsolver to solve MILPs sub-problems in OA decompositions.");
    665 
     663                               AmplOptionsList::String_Option,
     664                               "Choose the subsolver to solve MILPs sub-problems in OA decompositions.");
     665   
    666666    amplOptList->AddAmplOption("bonmin.Gomory_cuts", "bonmin.Gomory_cuts",
    667         AmplOptionsList::Integer_Option,
    668         "Frequency for Generating Gomory cuts in branch-and-cut.");
    669 
     667                               AmplOptionsList::Integer_Option,
     668                               "Frequency for Generating Gomory cuts in branch-and-cut.");
     669   
    670670    amplOptList->AddAmplOption("bonmin.probing_cuts", "bonmin.probing_cuts",
    671         AmplOptionsList::Integer_Option,
    672         "Frequency for Generating probing cuts in branch-and-cut");
    673 
     671                               AmplOptionsList::Integer_Option,
     672                               "Frequency for Generating probing cuts in branch-and-cut");
     673   
    674674    amplOptList->AddAmplOption("bonmin.cover_cuts", "bonmin.cover_cuts",
    675         AmplOptionsList::Integer_Option,
    676         "Frequency for Generating cover cuts in branch-and-cut");
    677 
    678 
     675                               AmplOptionsList::Integer_Option,
     676                               "Frequency for Generating cover cuts in branch-and-cut");
     677   
     678   
    679679    amplOptList->AddAmplOption("bonmin.mir_cuts", "bonmin.mir_cuts",
    680         AmplOptionsList::Integer_Option,
    681         "Frequency for Generating MIR cuts in branch-and-cut");
    682 
    683   }
    684 
     680                               AmplOptionsList::Integer_Option,
     681                               "Frequency for Generating MIR cuts in branch-and-cut");
     682   
     683  }
     684 
    685685  /** Return the ampl solver object (ASL*) */
    686686  const ASL_pfgh*
     
    689689    return ampl_tnlp_->AmplSolverObject();
    690690  }
    691 
    692 
     691 
     692 
    693693} // namespace Bonmin
  • trunk/Bonmin/src/Interfaces/Ampl/BonAmplTMINLP.hpp

    r442 r481  
    151151    /** @name Solution Methods */
    152152    //@{
    153     virtual void finalize_solution(SolverReturn status,
    154         Index n, const Number* x, const Number* z_L, const Number* z_U,
    155         Index m, const Number* g, const Number* lambda,
    156         Number obj_value,
    157         const IpoptData* ip_data,
    158         IpoptCalculatedQuantities* ip_cq);
    159 
    160     void write_solution(const std::string & message, const Number *x_sol, const Number * lambda_sol);
     153    virtual void finalize_solution(TMINLP::SolverReturn status,
     154                                   Index n, const Number* x, Number obj_value);
     155
     156    void write_solution(const std::string & message, const Number *x_sol);
    161157    //@}
    162158
  • trunk/Bonmin/src/Interfaces/Ampl/Makefile.am

    r386 r481  
    1515# Name of the library in this directory
    1616if COIN_HAS_ASL
    17   noinst_LTLIBRARIES = libamplinterface.la
     17  noinst_LTLIBRARIES = libbonamplinterface.la
    1818endif
    1919
    2020# List all source files, including headers
    21 libamplinterface_la_SOURCES = \
     21libbonamplinterface_la_SOURCES = \
    2222        BonAmplInterface.cpp BonAmplInterface.hpp \
    2323        BonAmplTMINLP.cpp BonAmplTMINLP.hpp \
     
    2525
    2626# This is for libtool (on Windows)
    27 libamplinterface_la_LDFLAGS = $(LT_LDFLAGS)
     27libbonamplinterface_la_LDFLAGS = $(LT_LDFLAGS)
    2828
    2929# Here list all include flags, relative to this "srcdir" directory.  This
  • trunk/Bonmin/src/Interfaces/Ampl/Makefile.in

    r386 r481  
    5757CONFIG_CLEAN_FILES =
    5858LTLIBRARIES = $(noinst_LTLIBRARIES)
    59 libamplinterface_la_LIBADD =
    60 am_libamplinterface_la_OBJECTS = BonAmplInterface.lo BonAmplTMINLP.lo \
    61         sos_kludge.lo
    62 libamplinterface_la_OBJECTS = $(am_libamplinterface_la_OBJECTS)
    63 @COIN_HAS_ASL_TRUE@am_libamplinterface_la_rpath =
     59libbonamplinterface_la_LIBADD =
     60am_libbonamplinterface_la_OBJECTS = BonAmplInterface.lo \
     61        BonAmplTMINLP.lo sos_kludge.lo
     62libbonamplinterface_la_OBJECTS = $(am_libbonamplinterface_la_OBJECTS)
     63@COIN_HAS_ASL_TRUE@am_libbonamplinterface_la_rpath =
    6464depcomp = $(SHELL) $(top_srcdir)/../depcomp
    6565am__depfiles_maybe = depfiles
     
    8080LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
    8181        $(AM_LDFLAGS) $(LDFLAGS) -o $@
    82 SOURCES = $(libamplinterface_la_SOURCES)
    83 DIST_SOURCES = $(libamplinterface_la_SOURCES)
     82SOURCES = $(libbonamplinterface_la_SOURCES)
     83DIST_SOURCES = $(libbonamplinterface_la_SOURCES)
    8484am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
    8585am__vpath_adj = case $$p in \
     
    320320
    321321# Name of the library in this directory
    322 @COIN_HAS_ASL_TRUE@noinst_LTLIBRARIES = libamplinterface.la
     322@COIN_HAS_ASL_TRUE@noinst_LTLIBRARIES = libbonamplinterface.la
    323323
    324324# List all source files, including headers
    325 libamplinterface_la_SOURCES = \
     325libbonamplinterface_la_SOURCES = \
    326326        BonAmplInterface.cpp BonAmplInterface.hpp \
    327327        BonAmplTMINLP.cpp BonAmplTMINLP.hpp \
     
    330330
    331331# This is for libtool (on Windows)
    332 libamplinterface_la_LDFLAGS = $(LT_LDFLAGS)
     332libbonamplinterface_la_LDFLAGS = $(LT_LDFLAGS)
    333333
    334334# Here list all include flags, relative to this "srcdir" directory.  This
     
    409409          rm -f "$${dir}/so_locations"; \
    410410        done
    411 libamplinterface.la: $(libamplinterface_la_OBJECTS) $(libamplinterface_la_DEPENDENCIES)
    412         $(CXXLINK) $(am_libamplinterface_la_rpath) $(libamplinterface_la_LDFLAGS) $(libamplinterface_la_OBJECTS) $(libamplinterface_la_LIBADD) $(LIBS)
     411libbonamplinterface.la: $(libbonamplinterface_la_OBJECTS) $(libbonamplinterface_la_DEPENDENCIES)
     412        $(CXXLINK) $(am_libbonamplinterface_la_rpath) $(libbonamplinterface_la_LDFLAGS) $(libbonamplinterface_la_OBJECTS) $(libbonamplinterface_la_LIBADD) $(LIBS)
    413413
    414414mostlyclean-compile:
  • trunk/Bonmin/src/Interfaces/BonOsiTMINLPInterface.cpp

    r479 r481  
    3434(SmartPtr<RegisteredOptions> roptions)
    3535{
    36   roptions->SetRegisteringCategory("bonmin output options");
    37 
    38   roptions->AddBoundedIntegerOption("bb_log_level",
    39       "specify main branch-and-bound log level.",
    40       0,5,1,
    41       "Set the level of output of the branch-and-bound : "
    42       "0 - none, 1 - minimal, 2 - normal low, 3 - normal high"
    43                                    );
    44 
    45   roptions->AddLowerBoundedIntegerOption("bb_log_interval",
    46       "Interval at which node level output is printed.",
    47       0,100,
    48       "Set the interval (in terms of number of nodes) at which "
    49       "a log on node resolutions (consisting of lower and upper bounds) is given.");
    50 
    51   roptions->AddBoundedIntegerOption("lp_log_level",
    52       "specify LP log level.",
    53       0,4,0,
    54       "Set the level of output of the linear programming sub-solver in B-Hyb or B-QG : "
    55       "0 - none, 1 - minimal, 2 - normal low, 3 - normal high, 4 - verbose"
    56                                    );
    57 
    58   roptions->AddBoundedIntegerOption("milp_log_level",
    59       "specify MILP subsolver log level.",
    60       0,3,0,
    61       "Set the level of output of the MILP subsolver in OA : "
    62       "0 - none, 1 - minimal, 2 - normal low, 3 - normal high"
    63                                    );
    64 
    65 
     36  roptions->SetRegisteringCategory("bonmin nlp interface option");
    6637
    6738  roptions->AddBoundedIntegerOption("nlp_log_level",
     
    7142      "0 - none, 1 - normal, 2 - verbose"
    7243                                   );
    73 
    74   roptions->SetRegisteringCategory("bonmin branch-and-bound options");
    75 
    76   roptions->AddStringOption2("nlp_solver",
    77       "Choice of the solver for local optima of continuous nlp's",
    78       "Ipopt",
    79       "Ipopt", "Interior Point OPTimizer (https://projects.coin-or.org/Ipopt)",
    80       "filterSQP", "Sequential quadratic programming trust region algorithm (http://www-unix.mcs.anl.gov/~leyffer/solvers.html)",
    81        "");
    82 
    83   roptions->AddStringOption5("algorithm",
    84       "Choice of the algorithm.",
    85       "B-Hyb",
    86       "B-BB","simple branch-and-bound algorithm,",
    87       "B-OA","OA Decomposition algorithm,",
    88       "B-QG","Quesada and Grossmann branch-and-cut algorithm,",
    89       "B-Hyb","hybrid outer approximation based branch-and-cut.",
    90       "B-Couenne","Branch-and-bound using Couenne convexifier (not available through Bonmin excutable)",
    91       "This will preset default values for most options of bonmin but depending on which algorithm "
    92       "some of these can be changed.");
    93   roptions->AddLowerBoundedNumberOption("time_limit",
    94       "Set the global maximum computation time (in secs) for the algorithm.",
    95       0.,1,1e10,
    96       "");
    97 
    98   roptions->AddLowerBoundedIntegerOption("node_limit",
    99                                          "Set the maximum number of nodes explored in the branch-and-bound search.",
    100                                          0,INT_MAX,
    101                                          "");
    102 
    103    roptions->AddLowerBoundedIntegerOption("iteration_limit",
    104       "Set the cummulated maximum number of iteration in the algorithm used to process nodes continuous relaxations in the branch-and-bound.",
    105       0,INT_MAX,
    106       "value 0 deactivates option.");
    107 
    108   roptions->AddLowerBoundedIntegerOption("solution_limit",
    109                                          "Abort after that much integer feasible solution have been found by algorithm",
    110                                          0,INT_MAX,
    111                                          "value 0 deactivates option");
    112 
    113   roptions->AddBoundedNumberOption("integer_tolerance",
    114       "Set integer tolerance.",
    115       0.,1,.5,1,1e-06,
    116       "Any number within that value of an integer is considered integer.");
    117 
    118   roptions->AddBoundedNumberOption("allowable_gap",
    119       "Specify the value of absolute gap under which the algorithm stops.",
    120       -1.e20,0,1.e20,0,0.,
    121       "Stop the tree search when the gap between the objective value of the best known solution"
    122       " and the best bound on the objective of any solution is less than this.");
    123 
    124   roptions->AddBoundedNumberOption("allowable_fraction_gap",
    125       "Specify the value of relative gap under which the algorithm stops.",
    126       -1.e20,0,1.e20,0,0.0,
    127       "Stop the tree search when the gap between the objective value of the best known solution "
    128       "and the best bound on the objective of any solution is less than this "
    129       "fraction of the absolute value of the best known solution value.");
    130 
    131   roptions->AddBoundedNumberOption("cutoff",
    132       "Specify cutoff value.",
    133       -1e100,0,1e100,0,1e100,
    134       "cutoff should be the value of a feasible solution known by the user "
    135       "(if any). The algorithm will only look for solutions better than cutoof.");
    136 
    137 
    138   roptions->AddBoundedNumberOption("cutoff_decr",
    139       "Specify cutoff decrement.",
    140       -1e10,0,1e10,0,1e-05,
    141       "Specify the amount by which cutoff is decremented below "
    142       "a new best upper-bound"
    143       " (usually a small postive value but in non-convex problems it may be a negative value).");
    144 
    145   roptions->AddStringOption4("nodeselect_stra",
    146       "Choose the node selection strategy.",
    147       "dynamic",
    148       "best-bound", "choose node whith the smallest bound,",
    149       "depth-first", "Perform depth first search,",
    150       "breadth-first", "Perform breadth first search,",
    151       "dynamic", "Cbc dynamic strategy (starts with a depth first search and turn to best bound after 3 "
    152       "integer feasible solutions have been found).",
    153       "Choose the strategy for selecting the next node to be processed.");
    154 
    155   roptions->AddStringOption9("varselect_stra",
    156       "Chooses variable selection strategy",
    157       "strong-branching",
    158       "most-fractional", "Choose most fractional variable",
    159       "strong-branching", "Perform strong branching",
    160       "reliability-branching", "Use reliability branching",
    161       "curvature-estimator", "Use curvature estimation to select branching variable",
    162       "qp-strong-branching", "Perform strong branching with QP approximation",
    163       "lp-strong-branching", "Perform strong branching with LP approximation",
    164       "nlp-strong-branching", "Perform strong branching with NLP approximation",
    165       "osi-simple", "Osi method to do simple branching",
    166       "osi-strong", "Osi method to do strong branching","");
    167 
    168   roptions->AddLowerBoundedIntegerOption("number_strong_branch",
    169       "Choose the maximum number of variables considered for strong branching.",
    170       0,20,
    171       "Set the number of variables on which to do strong branching.");
    172 
    173   roptions->AddLowerBoundedIntegerOption
    174   ("number_before_trust",
    175    "Set the number of branches on a variable before its pseudo costs are to be believed "
    176    "in dynamic strong branching.",
    177    0,8,
    178    "A value of 0 disables dynamic strong branching.");
    179 
    180   roptions->AddLowerBoundedIntegerOption
    181   ("number_ecp_rounds_strong",
    182    "Set the number of rounds of ecp in strong branching.",
    183    0,1,
    184    "");
    18544
    18645  roptions->AddStringOption3("warm_start",
     
    19150      "interior_point","Warm start with an interior point of direct parent",
    19251      "This will affect the function getWarmStart(), and as a consequence the wam starting in the various algorithms.");
    193 
    194   roptions->AddStringOption2("sos_constraints",
    195                              "Wether or not to activate SOS constraints.",
    196                              "enable",
    197                              "enable","",
    198                              "disable","",
    199                              "(only type 1 SOS are supported at the moment)");
    20052
    20153  roptions->SetRegisteringCategory("bonmin options for robustness");
     
    21870                                           "");
    21971                                           
    220   roptions->AddLowerBoundedIntegerOption
    221   ("max_consecutive_failures",
    222    "(temporarily removed) Number $n$ of consecutive unsolved problems before aborting a branch of the tree.",
    223    0,10,
    224    "When $n > 0$, continue exploring a branch of the tree until $n$ "
    225    "consecutive problems in the branch are unsolved (we call unsolved a problem for which Ipopt can not "
    226    "guarantee optimality within the specified tolerances).");
    22772
    22873  roptions->AddLowerBoundedIntegerOption
     
    23378   " node is considered to be suspect and it will be outputed in a file (set to -1 to deactivate this).");
    23479
    235   roptions->AddStringOption2("nlp_failure_behavior",
    236       "Set the behavior when an NLP or a series of NLP are unsolved by Ipopt (we call unsolved an NLP for which Ipopt is not "
    237       "able to guarantee optimality within the specified tolerances).",
    238       "stop",
    239       "stop", "Stop when failure happens.",
    240       "fathom", "Continue when failure happens.",
    241       "If set to \"fathom\", the algorithm will fathom the node when Ipopt fails to find a solution to the nlp "
    242       "at that node whithin the specified tolerances. "
    243       "The algorithm then becomes a heuristic, and the user will be warned that the solution might not be optimal.");
     80 
    24481
    24582  roptions->AddLowerBoundedIntegerOption("num_retry_unsolved_random_point",
     
    25491
    25592  roptions->SetRegisteringCategory("bonmin options for non-convex problems");
    256   roptions->AddLowerBoundedIntegerOption("max_consecutive_infeasible",
    257       "Number of consecutive infeasible subproblems before aborting a"
    258       " branch.",
    259       0,0,
    260       "Will continue exploring a branch of the tree until \"max_consecutive_infeasible\""
    261       "consecutive problems are infeasibles by the NLP sub-solver.");
     93
    26294
    26395  roptions->AddLowerBoundedIntegerOption("num_resolve_at_root",
     
    323155      " than this.");
    324156
    325   roptions->AddLowerBoundedIntegerOption("Gomory_cuts",
    326       "Frequency k (in terms of nodes) for generating Gomory cuts in branch-and-cut.",
    327       -100,-5,
    328       "If k > 0, cuts are generated every k nodes, if -99 < k < 0 cuts are generated every -k nodes but "
    329       "Cbc may decide to stop generating cuts, if not enough are generated at the root node, "
    330       "if k=-99 generate cuts only at the root node, if k=0 or 100 do not generate cuts.");
    331   roptions->AddLowerBoundedIntegerOption("probing_cuts",
    332       "Frequency (in terms of nodes) for generating probing cuts in branch-and-cut",
    333       -100,-5,
    334       "If k > 0, cuts are generated every k nodes, if -99 < k < 0 cuts are generated every -k nodes but "
    335       "Cbc may decide to stop generating cuts, if not enough are generated at the root node, "
    336       "if k=-99 generate cuts only at the root node, if k=0 or 100 do not generate cuts.");
    337 
    338   roptions->AddLowerBoundedIntegerOption("cover_cuts",
    339       "Frequency (in terms of nodes) for generating cover cuts in branch-and-cut",
    340       -100,-5,
    341       "If k > 0, cuts are generated every k nodes, if -99 < k < 0 cuts are generated every -k nodes but "
    342       "Cbc may decide to stop generating cuts, if not enough are generated at the root node, "
    343       "if k=-99 generate cuts only at the root node, if k=0 or 100 do not generate cuts.");
    344 
    345   roptions->AddLowerBoundedIntegerOption("mir_cuts",
    346       "Frequency (in terms of nodes) for generating MIR cuts in branch-and-cut",
    347       -100,-5,
    348       "If k > 0, cuts are generated every k nodes, if -99 < k < 0 cuts are generated every -k nodes but "
    349       "Cbc may decide to stop generating cuts, if not enough are generated at the root node, "
    350       "if k=-99 generate cuts only at the root node, if k=0 or 100 do not generate cuts.");
    351 
    352157}
    353158
     
    363168    register_general_options(roptions);
    364169    register_OA_options(roptions);
    365     //Register options for all possible solvers (besides the one used
    366     IpoptSolver * ipopt = dynamic_cast<IpoptSolver *> (GetRawPtr(app_));
    367170#ifdef COIN_HAS_FILTERSQP
    368     FilterSolver * filter = dynamic_cast<FilterSolver *> (GetRawPtr(app_));
     171    FilterSolver::RegisterOptions(roptions);
    369172#endif
    370     if(!ipopt) {
    371       ipopt = new IpoptSolver;
    372       ipopt->RegisterOptions(app_->RegOptions());
    373       delete ipopt;
    374       ipopt = NULL;
    375     }
    376 
    377 #ifdef COIN_HAS_FILTERSQP
    378     if(!filter) {
    379       filter = new FilterSolver;
    380       filter->RegisterOptions(app_->RegOptions());
    381       delete filter;
    382       filter = NULL;
    383     }
    384 #endif         
     173#ifdef COIN_HAS_IPOPT
     174    IpoptSolver::RegisterOptions(roptions);
     175#endif
    385176  }   
    386177  catch(RegisteredOptions::OPTION_ALREADY_REGISTERED) {
     
    466257    reducedCosts_(NULL),
    467258    OsiDualObjectiveLimit_(1e200),
    468 //   optimization_status_(HasNotBeenOptimized),
    469259    varNames_(NULL),
    470260    hasVarNamesFile_(true),
     
    492282    nnz_jac(0),
    493283    constTypes_(NULL),
    494 //    constTypesNum_(NULL),
    495284    nLinear_(0),
    496285    nNonLinear_(0),
     
    501290    firstSolve_(true)
    502291{
    503       createApplication();
    504 }
    505 
    506 /** Constructor with given TNLPSolver and TMINLP */
    507 OsiTMINLPInterface::OsiTMINLPInterface (SmartPtr<TNLPSolver> app):
    508     OsiSolverInterface(),
    509     tminlp_(NULL),
    510     problem_(NULL),
    511     rowsense_(NULL),
    512     rhs_(NULL),
    513     rowrange_(NULL),
    514     reducedCosts_(NULL),
    515     OsiDualObjectiveLimit_(1e200),
    516 //    optimization_status_(HasNotBeenOptimized),
    517     varNames_(NULL),
    518     hasVarNamesFile_(true),
    519     nCallOptimizeTNLP_(0),
    520     totalNlpSolveTime_(0),
    521     totalIterations_(0),
    522     maxRandomRadius_(1e08),
    523     randomGenerationType_(0),
    524     max_perturbation_(DBL_MAX),
    525     pushValue_(1e-02),
    526     numRetryInitial_(-1),
    527     numRetryResolve_(-1),
    528     numRetryInfeasibles_(-1),
    529     numRetryUnsolved_(1),
    530     messages_(),
    531     pretendFailIsInfeasible_(false),
    532     hasContinuedAfterNlpFailure_(false),
    533     numIterationSuspect_(-1),
    534     hasBeenOptimized_(false),
    535     obj_(NULL),
    536     feasibilityProblem_(NULL),
    537     jRow_(NULL),
    538     jCol_(NULL),
    539     jValues_(NULL),
    540     nnz_jac(0),
    541     constTypes_(NULL),
    542 //    constTypesNum_(NULL),
    543     nLinear_(0),
    544     nNonLinear_(0),
    545     tiny_(1e-08),
    546     veryTiny_(1e-17),
    547     infty_(1e100),
    548     expose_warm_start_(false),
    549     firstSolve_(true)
    550 {
    551   app_ = app->clone();
    552 
    553   SmartPtr<RegisteredOptions> roptions = app_->RegOptions();
    554   registerOptions(roptions);
    555   extractInterfaceParams();
    556 }
    557 
    558 /** Constructor with given IpSolver and TMINLP */
    559 OsiTMINLPInterface::OsiTMINLPInterface (SmartPtr<TMINLP> tminlp,
    560                                         SmartPtr<TNLPSolver> app):
    561     OsiSolverInterface(),
    562     tminlp_(tminlp),
    563     problem_(NULL),
    564     rowsense_(NULL),
    565     rhs_(NULL),
    566     rowrange_(NULL),
    567     reducedCosts_(NULL),
    568     OsiDualObjectiveLimit_(1e200),
    569 //    optimization_status_(HasNotBeenOptimized),
    570     varNames_(NULL),
    571     hasVarNamesFile_(true),
    572     nCallOptimizeTNLP_(0),
    573     totalNlpSolveTime_(0),
    574     totalIterations_(0),
    575     maxRandomRadius_(1e08),
    576     randomGenerationType_(0),
    577     max_perturbation_(DBL_MAX),
    578     pushValue_(1e-02),
    579     numRetryInitial_(-1),
    580     numRetryResolve_(-1),
    581     numRetryInfeasibles_(-1),
    582     numRetryUnsolved_(1),
    583     messages_(),
    584     pretendFailIsInfeasible_(false),
    585     hasContinuedAfterNlpFailure_(false),
    586     numIterationSuspect_(-1),
    587     hasBeenOptimized_(false),
    588     obj_(NULL),
    589     feasibilityProblem_(NULL),
    590     jRow_(NULL),
    591     jCol_(NULL),
    592     jValues_(NULL),
    593     nnz_jac(0),
    594     constTypes_(NULL),
    595 //    constTypesNum_(NULL),
    596     nLinear_(0),
    597     nNonLinear_(0),
    598     tiny_(1e-08),
    599     veryTiny_(1e-17),
    600     infty_(1e100),
    601     expose_warm_start_(false),
    602     firstSolve_(true)
    603 {
    604   allocateTMINLP(tminlp,app);
    605 }
    606 
    607 /// Enum for the NLP solver chosen
    608 enum NLPSolverChoice {
    609   Ipopt = 0,
    610   FilterSQP
    611 };
    612 
     292}
     293
     294
     295
     296void
     297OsiTMINLPInterface::initialize(BasicSetup& b,
     298                               Ipopt::SmartPtr<TMINLP> tminlp)
     299{
     300  if(!IsValid(app_))
     301    createApplication(b);
     302  setModel(tminlp);
     303}
     304
     305void
     306OsiTMINLPInterface::initialize(Ipopt::SmartPtr<Ipopt::Journalist> journalist,
     307                Ipopt::SmartPtr<Ipopt::OptionsList> options,
     308                Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions,
     309                Ipopt::SmartPtr<TMINLP> tminlp){
     310  createApplication(journalist, options, roptions);
     311  setModel(tminlp);
     312}
     313
     314void OsiTMINLPInterface::setSolver(Ipopt::SmartPtr<TNLPSolver> app){
     315  app_ = app;}
    613316
    614317/** Facilitator to create an application. */
    615318void
    616 OsiTMINLPInterface::createApplication(){
    617   // AW: The following is not a nice solution, since we read
    618   // everything twice, if FilterSQP was chosen
    619  
    620   //We need to build dummy solver objects to get the options,
    621   //determine which is the solver to use and register all the
    622   //options
     319OsiTMINLPInterface::createApplication(BasicSetup &b){
     320  createApplication(b.journalist(),b.options(),b.roptions());
     321}
     322
     323void
     324OsiTMINLPInterface::createApplication(Ipopt::SmartPtr<Ipopt::Journalist> journalist,
     325                                      Ipopt::SmartPtr<Ipopt::OptionsList> options,
     326                                      Ipopt::SmartPtr<Ipopt::RegisteredOptions> roptions)
     327{
    623328  assert(!IsValid(app_));
    624   app_ = new IpoptSolver();
    625   OsiTMINLPInterface forOption(GetRawPtr(app_));
    626329  int ival;
    627   forOption.solver()->Options()->GetEnumValue("nlp_solver", ival,"bonmin.");
    628   NLPSolverChoice NLPchoice = NLPSolverChoice(ival);
    629  
    630   if(NLPchoice == FilterSQP) {
     330  options->GetEnumValue("nlp_solver", ival, "bonmin.");
     331  BaseOptions::Solver s = (BaseOptions::Solver) ival;
     332  if(s == BaseOptions::FilterSQP){
    631333#ifdef COIN_HAS_FILTERSQP
    632     app_ = new FilterSolver();
     334    app_ = new Bonmin::FilterSolver(roptions, options, journalist);
    633335#else
    634     std::cerr<<"Bonmin not configured to run with FilterSQP"<<std::endl;
     336#endif   
     337  }
     338  else if(s == BaseOptions::Ipopt){
     339#ifdef COIN_HAS_IPOPT
     340    app_ = new IpoptSolver(roptions, options, journalist);
     341#else
     342    std::cerr<<"Bonmin not configured to run with Ipopt"<<std::endl;
    635343    throw -1;
    636344#endif
    637345  }
    638   else if (NLPchoice != Ipopt) {
    639     std::cerr<<"Trying to use unknown solver."<<std::endl;
    640     throw -1;
    641   }
     346  app_->Initialize("");
     347  extractInterfaceParams();
     348 
    642349}
    643350
    644351/** Facilitator to allocate a tminlp and an application. */
    645352void
    646 OsiTMINLPInterface::allocateTMINLP(SmartPtr<TMINLP> tminlp,
    647                                    SmartPtr<TNLPSolver> app)
     353OsiTMINLPInterface::setModel(SmartPtr<TMINLP> tminlp)
    648354{
    649355  assert(IsValid(tminlp));
    650 
    651356  tminlp_ = tminlp;
    652357  problem_ = new TMINLP2TNLP(tminlp_);
    653   app_ = app->clone();
    654 
    655   SmartPtr<RegisteredOptions> roptions = app_->RegOptions();
    656   registerOptions(roptions);
    657   app_->Initialize("");
    658   extractInterfaceParams();
    659358}
    660359
     
    872571}
    873572
    874 SmartPtr<OptionsList> OsiTMINLPInterface::retrieve_options()
     573SmartPtr<OptionsList> OsiTMINLPInterface::options()
    875574{
    876575  if(!IsValid(app_)) {
     
    1103802    std::string probName;
    1104803    getStrParam(OsiProbName,probName);
    1105     throw newUnsolvedError(optimization_status_, problem_,
     804    throw newUnsolvedError(app_->errorCode(), problem_,
    1106805                           probName);
    1107806  }
     
    25162215          std::string probName;
    25172216          getStrParam(OsiProbName, probName);
    2518           throw newUnsolvedError(optimization_status_, problem_, probName);
     2217          throw newUnsolvedError(app_->errorCode(), problem_, probName);
    25192218        }
    25202219      double * saveColLow = CoinCopyOfArray(getColLower(), getNumCols());
     
    25472246    std::string probName;
    25482247    getStrParam(OsiProbName, probName);
    2549     throw newUnsolvedError(optimization_status_, problem_, probName);
     2248    throw newUnsolvedError(app_->errorCode(), problem_, probName);
    25502249  }
    25512250  try{
     
    27152414{
    27162415  if (IsValid(app_)) {
     2416    int logLevel;
     2417    app_->Options()->GetIntegerValue("nlp_log_level", logLevel,"bonmin.");
     2418    messageHandler()->setLogLevel(logLevel);
     2419
    27172420#ifdef COIN_HAS_FILTERSQP
    27182421    FilterSolver * filter = dynamic_cast<FilterSolver *>(GetRawPtr(app_));
  • trunk/Bonmin/src/Interfaces/BonOsiTMINLPInterface.hpp

    r473 r481  
    2727#include "BonTNLPSolver.hpp"
    2828#include "BonCutStrengthener.hpp"
     29#include "BonBasicSetup.hpp"
    2930
    3031namespace Bonmin {
     
    116117