From a5226ab2f3584325e3599f4a3ebb1960bb361453 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Wed, 25 Mar 2020 09:53:33 -0400 Subject: [PATCH 01/28] Try adding Blas and Lapack dependencies. In and attampt to get a static bulid going. --- .coin-or/Dependencies | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index e40290c8c..781d0ae0b 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,6 @@ -ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 -ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 -ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 -ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 +ThirdParty/Blas https://github.com/coin-or-tools/ThirdParty-Blas stable/1.4 +ThirdParty/Lapack https://github.com/coin-or-tools/ThirdParty-Lapack stable/1.6 +ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 +ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 +ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 +ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From bafe334005538944dc283496adfe66d478d5c9a3 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Wed, 25 Mar 2020 10:37:45 -0400 Subject: [PATCH 02/28] Okay, that's not helping --- .coin-or/Dependencies | 2 -- 1 file changed, 2 deletions(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 781d0ae0b..216188b8c 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,5 +1,3 @@ -ThirdParty/Blas https://github.com/coin-or-tools/ThirdParty-Blas stable/1.4 -ThirdParty/Lapack https://github.com/coin-or-tools/ThirdParty-Lapack stable/1.6 ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 From b2ab85e99c97586abeac176ca911bde30e180821 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Wed, 25 Mar 2020 12:51:18 -0400 Subject: [PATCH 03/28] Add a little to the HSL unknown name mangling to be sure the name mangling warning is for HSL --- configure | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure b/configure index 954706608..978163720 100755 --- a/configure +++ b/configure @@ -23982,7 +23982,7 @@ $as_echo "$ac_cv_hsl_namemangling" >&6; } $as_echo "#define IPOPT_HSL_FUNC_(name,NAME) NAME ## __" >>confdefs.h ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unsupported or unknown name-mangling scheme: $ac_cv_hsl_namemangling" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING (HSL): Unsupported or unknown name-mangling scheme: $ac_cv_hsl_namemangling" >&5 $as_echo "$as_me: WARNING: Unsupported or unknown name-mangling scheme: $ac_cv_hsl_namemangling" >&2;} ;; esac @@ -29485,4 +29485,3 @@ fi #AC_MSG_NOTICE([In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting]) { $as_echo "$as_me:${as_lineno-$LINENO}: Configuration of $PACKAGE_NAME successful" >&5 $as_echo "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} - From 900e78fd3b6c806cf3d83fa163ba3d7c113d9e2f Mon Sep 17 00:00:00 2001 From: John Eslick Date: Wed, 25 Mar 2020 13:01:25 -0400 Subject: [PATCH 04/28] Add the HSL test back --- configure | 2 +- src/Algorithm/IpIpoptAlg.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 978163720..f4b9c997d 100755 --- a/configure +++ b/configure @@ -23983,7 +23983,7 @@ $as_echo "$ac_cv_hsl_namemangling" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING (HSL): Unsupported or unknown name-mangling scheme: $ac_cv_hsl_namemangling" >&5 -$as_echo "$as_me: WARNING: Unsupported or unknown name-mangling scheme: $ac_cv_hsl_namemangling" >&2;} +$as_echo "$as_me: WARNING (HSL): Unsupported or unknown name-mangling scheme: $ac_cv_hsl_namemangling" >&2;} ;; esac diff --git a/src/Algorithm/IpIpoptAlg.cpp b/src/Algorithm/IpIpoptAlg.cpp index 403e0b3e6..e244fdc45 100644 --- a/src/Algorithm/IpIpoptAlg.cpp +++ b/src/Algorithm/IpIpoptAlg.cpp @@ -988,6 +988,16 @@ void IpoptAlgorithm::print_copyright_message( "This program contains Ipopt, a library for large-scale nonlinear optimization.\n" " Ipopt is released as open source code under the Eclipse Public License (EPL).\n" " For more information visit http://projects.coin-or.org/Ipopt\n" + "\nThis version of Ipopt was compiled from source code available at\n" + " https://github.com/IDAES/Ipopt as part of the Institute for the Design of\n" + " Advanced Energy Systems Process Systems Engineering Framework (IDAES PSE\n" + " Framework) Copyright (c) 2018-2019. See https://github.com/IDAES/idaes-pse.\n" + "\nThis version of Ipopt was compiled using HSL, a collection of Fortran codes\n" + " for large-scale scientific computation. All technical papers, sales and\n" + " publicity material resulting from use of the HSL codes within IPOPT must\n" + " contain the following acknowledgement:\n" + " HSL, a collection of Fortran codes for large-scale scientific\n" + " computation. See http://www.hsl.rl.ac.uk.\n" "******************************************************************************\n\n"); copyright_message_printed = true; } From 62f8ef8b53cef4be6eb0ee270300f9effeb5c91b Mon Sep 17 00:00:00 2001 From: John Eslick Date: Wed, 25 Mar 2020 13:17:09 -0400 Subject: [PATCH 05/28] Guess and default name mangling for the HSL in the ipopt config script. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index f4b9c997d..6c5a18c3b 100755 --- a/configure +++ b/configure @@ -23929,7 +23929,7 @@ rm -f core conftest.err conftest.$ac_objext \ done done if test "$ac_success" = "no" ; then - ac_cv_hsl_namemangling=unknown + ac_cv_hsl_namemangling="lower case, underscore, no extra underscore" fi LIBS=$ac_save_LIBS fi From 22fbfeb12074e951a10f8f6ab62f5aea77df4fed Mon Sep 17 00:00:00 2001 From: John Eslick Date: Wed, 25 Mar 2020 14:25:34 -0400 Subject: [PATCH 06/28] Slightly better hsl name magle guess --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 6c5a18c3b..04768d7d9 100755 --- a/configure +++ b/configure @@ -23929,7 +23929,7 @@ rm -f core conftest.err conftest.$ac_objext \ done done if test "$ac_success" = "no" ; then - ac_cv_hsl_namemangling="lower case, underscore, no extra underscore" + ac_cv_hsl_namemangling="$ac_cv_f77_mangling" fi LIBS=$ac_save_LIBS fi From 3e6d36695ea28607e0c88fc40c36375b7f1b7d9e Mon Sep 17 00:00:00 2001 From: John Eslick Date: Thu, 26 Mar 2020 15:24:42 -0400 Subject: [PATCH 07/28] Add LDFLAGS at the end of the ac_link --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 04768d7d9..2e638ee86 100755 --- a/configure +++ b/configure @@ -3009,7 +3009,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu From 3f2946f6d3eb9feda598ec479ea878e3be6eb964 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Thu, 26 Mar 2020 16:02:42 -0400 Subject: [PATCH 08/28] Add ldflags to end of ipopt configure ac_link --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 2e638ee86..ae33432f4 100755 --- a/configure +++ b/configure @@ -5723,7 +5723,7 @@ if test -n "$F77" ; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to get verbose linking output from $F77" >&5 $as_echo_n "checking how to get verbose linking output from $F77... " >&6; } From 7ab6bab6720de4803ce11f4245ff0bd058ee25dd Mon Sep 17 00:00:00 2001 From: John Eslick Date: Thu, 26 Mar 2020 16:12:50 -0400 Subject: [PATCH 09/28] A lot more flagging. --- configure | 98 +++++++++++++++++++++++++++---------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/configure b/configure index ae33432f4..e87e5381b 100755 --- a/configure +++ b/configure @@ -4096,7 +4096,7 @@ done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in gcc clang cc icc icl cl cc xlc xlc_r pgcc @@ -4687,13 +4687,13 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } @@ -4745,7 +4745,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -4952,7 +4952,7 @@ done ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then @@ -5203,7 +5203,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= @@ -5340,7 +5340,7 @@ fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX understands -c and -o together" >&5 $as_echo_n "checking whether $CXX understands -c and -o together... " >&6; } @@ -5399,7 +5399,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_cv_prog_cxx_c_o = no ; then @@ -5486,7 +5486,7 @@ done if test $enable_msvc = no || test -n "$F77" ; then ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in gfortran ifort g95 fort77 f77 f95 f90 g77 pgf90 pgf77 ifc frt af77 xlf_r fl32 @@ -5692,7 +5692,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi @@ -6065,13 +6065,13 @@ FLIBS="$ac_cv_f77_libs" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dummy main to link with Fortran 77 libraries" >&5 @@ -6085,7 +6085,7 @@ else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # First, try linking without a dummy main: @@ -6146,7 +6146,7 @@ rm -f core conftest.err conftest.$ac_objext \ fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_cv_f77_dummy_main=$ac_cv_fortran_dummy_main rm -rf conftest* @@ -6179,12 +6179,12 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 name-mangling scheme" >&5 $as_echo_n "checking for Fortran 77 name-mangling scheme... " >&6; } @@ -6208,7 +6208,7 @@ if ac_fn_f77_try_compile "$LINENO"; then : ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS>&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success=no for ac_foobar in foobar FOOBAR; do @@ -6249,7 +6249,7 @@ rm -f core conftest.err conftest.$ac_objext \ done ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success" = "yes"; then @@ -6267,7 +6267,7 @@ ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success_extra=no for ac_extra in "" "_"; do @@ -6306,7 +6306,7 @@ rm -f core conftest.err conftest.$ac_objext \ done ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success_extra" = "yes"; then @@ -6346,7 +6346,7 @@ $as_echo "$ac_cv_f77_mangling" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -6356,7 +6356,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # F77_LIBRARY_LDFLAGS, etc.) ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in "lower case, no underscore, no extra underscore") @@ -6408,14 +6408,14 @@ esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # check whether compile script should be used to wrap around Fortran 77 compiler ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $F77 understands -c and -o together" >&5 $as_echo_n "checking whether $F77 understands -c and -o together... " >&6; } @@ -6469,7 +6469,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_cv_prog_f77_c_o = no ; then @@ -9053,7 +9053,7 @@ else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9085,7 +9085,7 @@ rm -f core conftest.err conftest.$ac_objext \ ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi @@ -9927,7 +9927,7 @@ func_munge_path_list () ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } @@ -10058,7 +10058,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -10335,7 +10335,7 @@ else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am_cv_ar_interface=ar @@ -10372,7 +10372,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi @@ -11152,7 +11152,7 @@ lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -15027,7 +15027,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC @@ -15038,7 +15038,7 @@ CC=$lt_save_CC ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } @@ -15165,7 +15165,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else @@ -15175,7 +15175,7 @@ fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no @@ -18357,14 +18357,14 @@ fi # test yes != "$_lt_caught_CXX_error" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -z "$F77" || test no = "$F77"; then @@ -21300,7 +21300,7 @@ fi # test yes != "$_lt_disable_F77" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -21427,7 +21427,7 @@ fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu @@ -21510,7 +21510,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -24622,7 +24622,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # The cast to long int works around a bug in the HP C Compiler @@ -24661,7 +24661,7 @@ _ACEOF ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -24686,7 +24686,7 @@ esac ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu @@ -24938,7 +24938,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -24952,7 +24952,7 @@ if test "$cross_compiling" = no && test "$is_bg" != yes; then ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -24972,7 +24972,7 @@ $as_echo "#define IPOPT_FORTRAN_INTEGER_TYPE int" >>confdefs.h ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else @@ -25807,7 +25807,7 @@ fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" @@ -25897,7 +25897,7 @@ done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS $LDFLAGS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu From 91d315d7fd71c62d1add0516eb0598aedb3d38fc Mon Sep 17 00:00:00 2001 From: John Eslick Date: Thu, 26 Mar 2020 21:53:47 -0400 Subject: [PATCH 10/28] Update Dependencies Get our version of the ASL build tools --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 216188b8c..80ed98c85 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 +ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/2.0 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From bb5e41b92f27fab98f892c1d426aab6c80e874f1 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Thu, 26 Mar 2020 22:58:58 -0400 Subject: [PATCH 11/28] Take the AMPL app from 3.12 --- src/Apps/AmplSolver/AmplTNLP.cpp | 2904 ++++++++---------- src/Apps/AmplSolver/AmplTNLP.hpp | 1060 +++---- src/Apps/AmplSolver/Makefile.am | 69 +- src/Apps/AmplSolver/Makefile.in | 878 +++--- src/Apps/AmplSolver/ampl_ipopt.cpp | 161 +- src/Apps/AmplSolver/ipoptamplinterface.pc.in | 15 +- 6 files changed, 2377 insertions(+), 2710 deletions(-) diff --git a/src/Apps/AmplSolver/AmplTNLP.cpp b/src/Apps/AmplSolver/AmplTNLP.cpp index 7b72d8cc7..f6b53f328 100644 --- a/src/Apps/AmplSolver/AmplTNLP.cpp +++ b/src/Apps/AmplSolver/AmplTNLP.cpp @@ -2,6 +2,8 @@ // All Rights Reserved. // This code is published under the Eclipse Public License. // +// $Id$ +// // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 #include "IpoptConfig.h" @@ -12,7 +14,15 @@ #include "IpSymTMatrix.hpp" #include "IpBlas.hpp" -#include +#ifdef HAVE_CSTRING +# include +#else +# ifdef HAVE_STRING_H +# include +# else +# error "don't have header file for string" +# endif +#endif /* AMPL includes */ #include "asl.h" @@ -21,362 +31,317 @@ namespace Ipopt { -#if IPOPT_VERBOSITY > 0 -static const Index dbg_verbosity = 0; +#if COIN_IPOPT_VERBOSITY > 0 + static const Index dbg_verbosity = 0; #endif -AmplTNLP::AmplTNLP( - const SmartPtr& jnlst, - const SmartPtr options, - char**& argv, - SmartPtr suffix_handler /* = NULL */, - bool allow_discrete /* = false */, - SmartPtr ampl_options_list /* = NULL */, - const char* ampl_option_string /* = NULL */, - const char* ampl_invokation_string /* = NULL */, - const char* ampl_banner_string /* = NULL */, - std::string* nl_file_content /* = NULL */ -) - : TNLP(), - jnlst_(jnlst), - asl_(NULL), - obj_sign_(1), - nz_h_full_(-1), - x_sol_(NULL), - z_L_sol_(NULL), - z_U_sol_(NULL), - g_sol_(NULL), - lambda_sol_(NULL), - obj_sol_(0.0), - objval_called_with_current_x_(false), - conval_called_with_current_x_(false), - hesset_called_(false), - set_active_objective_called_(false), - Oinfo_ptr_(NULL), - suffix_handler_(suffix_handler) -{ - DBG_START_METH("AmplTNLP::AmplTNLP", dbg_verbosity); - - // The ASL include files #define certain - // variables that they expect you to work with. - // These variables then appear as though they are - // global variables when, in fact, they are not - // Most of them are data members of an asl object - - // Create the ASL structure - ASL_pfgh* asl = (ASL_pfgh*) ASL_alloc(ASL_read_pfgh); - DBG_ASSERT(asl); - asl_ = asl; // keep the pointer for ourselves to use later... - - // First assume that we don't want to halt on error (default) - fint* fint_nerror = new fint; - *fint_nerror = 0; - nerror_ = (void*) fint_nerror; - - // Read the options and stub - char* stub = get_options(options, ampl_options_list, ampl_option_string, ampl_invokation_string, ampl_banner_string, - argv); - FILE* nl = NULL; - if( nl_file_content ) - { - nl = jac0dim(const_cast(nl_file_content->c_str()), -(ftnlen )nl_file_content->length()); - } - else - { - if( !stub ) - { - jnlst_->Printf(J_ERROR, J_MAIN, "No .nl file given!\n"); - THROW_EXCEPTION(INVALID_TNLP, "No .nl file given!\n"); - } - nl = jac0dim(stub, (fint )strlen(stub)); + AmplTNLP::AmplTNLP(const SmartPtr& jnlst, + const SmartPtr options, + char**& argv, + SmartPtr suffix_handler /* = NULL */, + bool allow_discrete /* = false */, + SmartPtr ampl_options_list /* = NULL */, + const char* ampl_option_string /* = NULL */, + const char* ampl_invokation_string /* = NULL */, + const char* ampl_banner_string /* = NULL */, + std::string* nl_file_content /* = NULL */) + : + TNLP(), + jnlst_(jnlst), + asl_(NULL), + obj_sign_(1), + nz_h_full_(-1), + x_sol_(NULL), + z_L_sol_(NULL), + z_U_sol_(NULL), + g_sol_(NULL), + lambda_sol_(NULL), + obj_sol_(0.0), + objval_called_with_current_x_(false), + conval_called_with_current_x_(false), + hesset_called_(false), + set_active_objective_called_(false), + Oinfo_ptr_(NULL), + suffix_handler_(suffix_handler) + { + DBG_START_METH("AmplTNLP::AmplTNLP", + dbg_verbosity); + + // The ASL include files #define certain + // variables that they expect you to work with. + // These variables then appear as though they are + // global variables when, in fact, they are not + // Most of them are data members of an asl object + + // Create the ASL structure + ASL_pfgh* asl = (ASL_pfgh*)ASL_alloc(ASL_read_pfgh); + DBG_ASSERT(asl); + asl_ = asl; // keep the pointer for ourselves to use later... + + // First assume that we don't want to halt on error (default) + fint* fint_nerror = new fint; + *fint_nerror = 0; + nerror_ = (void*) fint_nerror; + + // Read the options and stub + char* stub = get_options(options, ampl_options_list, + ampl_option_string, ampl_invokation_string, + ampl_banner_string, argv); + FILE*nl = NULL; + if (nl_file_content) { + nl = jac0dim(const_cast(nl_file_content->c_str()), + -(ftnlen)nl_file_content->length()); + } + else { + if (!stub) { + jnlst_->Printf(J_ERROR, J_MAIN, "No .nl file given!\n"); + THROW_EXCEPTION(INVALID_TNLP, "No .nl file given!\n"); + } + nl = jac0dim(stub, (fint)strlen(stub)); DBG_ASSERT(nl); - } - jnlst_->Printf(J_SUMMARY, J_MAIN, "\n"); - - // check the problem statistics (see Table 1 in AMPL doc) - DBG_ASSERT(n_var > 0); // need some continuous variables - if( !allow_discrete && (nbv > 0 || niv > 0 || nlvbi > 0 || nlvci > 0 || nlvoi > 0) ) - { - jnlst_->Printf(J_WARNING, J_MAIN, "==> Warning: Treating %d binary and %d integer variables as continous.\n\n", - nbv, niv + nlvbi + nlvci + nlvoi); + } + jnlst_->Printf(J_SUMMARY, J_MAIN, "\n"); + + // check the problem statistics (see Table 1 in AMPL doc) + DBG_ASSERT(n_var > 0); // need some continuous variables + if (!allow_discrete && (nbv>0 || niv>0 || nlvbi>0 || nlvci>0 || nlvoi>0) ) { + jnlst_->Printf(J_WARNING, J_MAIN, "==> Warning: Treating %d binary and %d integer variables as continous.\n\n", nbv, niv+nlvbi+nlvci+nlvoi); allow_discrete = true; - } - allow_discrete = true; - ASSERT_EXCEPTION(allow_discrete || (nbv == 0 && niv == 0 && nlvbi == 0 && nlvci == 0 && nlvoi == 0), IpoptException, - "Discrete variables not allowed when the allow_discrete flag is false, " - "Either remove the integer variables, or change the flag in the constructor of AmplTNLP"); - - if( n_cc != 0 ) - { - jnlst_->Printf(J_ERROR, J_MAIN, - "\n\n***** Currently, the AMPL interface to Ipopt does not support\n complementarity constraints. Aborting. *****\n\n"); + } + allow_discrete = true; + ASSERT_EXCEPTION(allow_discrete || (nbv == 0 && niv == 0 && nlvbi == 0 && nlvci == 0 && nlvoi == 0), + IpoptException, + "Discrete variables not allowed when the allow_discrete flag is false, " + "Either remove the integer variables, or change the flag in the constructor of AmplTNLP" + ); + + if (n_cc != 0) { + jnlst_->Printf(J_ERROR, J_MAIN, "\n\n***** Currently, the AMPL interface to Ipopt does not support\n complementarity constraints. Aborting. *****\n\n"); ASSERT_EXCEPTION(n_cc == 0, IpoptException, - "Currently, the AMPL interface to Ipopt does not support complementarity constraints."); - } - - DBG_ASSERT(nlo == 0 || nlo == 1); // Can handle nonlinear obj. - DBG_ASSERT(nwv == 0); // Don't know what "linear arc" variables are - DBG_ASSERT(nlnc == 0); // Don't know what "nonlinear network"constraints are - DBG_ASSERT(lnc == 0); // Don't know what "linear network" constraints are - - // Set options in the asl structure - want_xpi0 = 1 | 2; // allocate initial values for primal and dual if available - obj_no = 0; - DBG_ASSERT((want_xpi0 & 1) == 1 && (want_xpi0 & 2) == 2); - - // allocate space for initial values - X0 = new real[n_var]; - havex0 = new char[n_var]; - pi0 = new real[n_con]; - havepi0 = new char[n_con]; - - // prepare for suffixes - if( IsValid(suffix_handler) ) - { + "Currently, the AMPL interface to Ipopt does not support complementarity constraints."); + } + + DBG_ASSERT(nlo == 0 || nlo == 1); // Can handle nonlinear obj. + DBG_ASSERT(nwv == 0); // Don't know what "linear arc" variables are + DBG_ASSERT(nlnc == 0); // Don't know what "nonlinear network"constraints are + DBG_ASSERT(lnc == 0); // Don't know what "linear network" constraints are + + // Set options in the asl structure + want_xpi0 = 1 | 2; // allocate initial values for primal and dual if available + obj_no = 0; + DBG_ASSERT((want_xpi0 & 1) == 1 && (want_xpi0 & 2) == 2); + + // allocate space for initial values + X0 = new real[n_var]; + havex0 = new char[n_var]; + pi0 = new real[n_con]; + havepi0 = new char[n_con]; + + // prepare for suffixes + if (IsValid(suffix_handler)) { suffix_handler->PrepareAmplForSuffixes(asl_); - } - - // read the rest of the nl file - int retcode = pfgh_read(nl, ASL_return_read_err | ASL_findgroups); - - switch( retcode ) - { - case ASL_readerr_none: - { - break; - } - case ASL_readerr_nofile: - { - jnlst_->Printf(J_ERROR, J_MAIN, "Cannot open .nl file\n"); - THROW_EXCEPTION(INVALID_TNLP, "Cannot open .nl file"); - break; - } - case ASL_readerr_nonlin: - { - DBG_ASSERT(false); // this better not be an error! - jnlst_->Printf(J_ERROR, J_MAIN, "model involves nonlinearities (ed0read)\n"); - THROW_EXCEPTION(INVALID_TNLP, "model involves nonlinearities (ed0read)"); - break; - } - case ASL_readerr_argerr: - { - jnlst_->Printf(J_ERROR, J_MAIN, "user-defined function with bad args\n"); - THROW_EXCEPTION(INVALID_TNLP, "user-defined function with bad args"); - break; - } - case ASL_readerr_unavail: - { - jnlst_->Printf(J_ERROR, J_MAIN, "user-defined function not available\n"); - THROW_EXCEPTION(INVALID_TNLP, "user-defined function not available"); - break; - } - case ASL_readerr_corrupt: - { - jnlst_->Printf(J_ERROR, J_MAIN, "corrupt .nl file\n"); - THROW_EXCEPTION(INVALID_TNLP, "corrupt .nl file"); - break; - } - case ASL_readerr_bug: - { - jnlst_->Printf(J_ERROR, J_MAIN, "bug in .nl reader\n"); - THROW_EXCEPTION(INVALID_TNLP, "bug in .nl reader"); - break; - } - case ASL_readerr_CLP: - { - jnlst_->Printf(J_ERROR, J_MAIN, "Ampl model contains a constraint without \"=\", \">=\", or \"<=\".\n"); - THROW_EXCEPTION(INVALID_TNLP, "Ampl model contains a constraint without \"=\", \">=\", or \"<=\"."); - break; - } - default: - { - jnlst_->Printf(J_ERROR, J_MAIN, "Unknown error in stub file read. retcode = %d\n", retcode); - THROW_EXCEPTION(INVALID_TNLP, "Unknown error in stub file read"); - break; - } - } -} - -void AmplTNLP::set_active_objective( - Index in_obj_no -) -{ - if( hesset_called_ ) - { - jnlst_->Printf(J_ERROR, J_MAIN, - "Internal error: AmplTNLP::set_active_objective called after AmplTNLP::call_hesset.\n"); - THROW_EXCEPTION(INVALID_TNLP, - "Internal error: AmplTNLP::set_active_objective called after AmplTNLP::call_hesset."); - } - ASL_pfgh* asl = asl_; - obj_no = in_obj_no; - set_active_objective_called_ = true; -} - -void AmplTNLP::call_hesset() -{ - if( hesset_called_ ) - { + } + + // read the rest of the nl file + int retcode = pfgh_read(nl, ASL_return_read_err | ASL_findgroups); + + switch (retcode) { + case ASL_readerr_none : {} + break; + case ASL_readerr_nofile : { + jnlst_->Printf(J_ERROR, J_MAIN, "Cannot open .nl file\n"); + THROW_EXCEPTION(INVALID_TNLP, "Cannot open .nl file"); + } + break; + case ASL_readerr_nonlin : { + DBG_ASSERT(false); // this better not be an error! + jnlst_->Printf(J_ERROR, J_MAIN, "model involves nonlinearities (ed0read)\n"); + THROW_EXCEPTION(INVALID_TNLP, "model involves nonlinearities (ed0read)"); + } + break; + case ASL_readerr_argerr : { + jnlst_->Printf(J_ERROR, J_MAIN, "user-defined function with bad args\n"); + THROW_EXCEPTION(INVALID_TNLP, "user-defined function with bad args"); + } + break; + case ASL_readerr_unavail : { + jnlst_->Printf(J_ERROR, J_MAIN, "user-defined function not available\n"); + THROW_EXCEPTION(INVALID_TNLP, "user-defined function not available"); + } + break; + case ASL_readerr_corrupt : { + jnlst_->Printf(J_ERROR, J_MAIN, "corrupt .nl file\n"); + THROW_EXCEPTION(INVALID_TNLP, "corrupt .nl file"); + } + break; + case ASL_readerr_bug : { + jnlst_->Printf(J_ERROR, J_MAIN, "bug in .nl reader\n"); + THROW_EXCEPTION(INVALID_TNLP, "bug in .nl reader"); + } + break; + case ASL_readerr_CLP : { + jnlst_->Printf(J_ERROR, J_MAIN, "Ampl model contains a constraint without \"=\", \">=\", or \"<=\".\n"); + THROW_EXCEPTION(INVALID_TNLP, "Ampl model contains a constraint without \"=\", \">=\", or \"<=\"."); + } + break; + default: { + jnlst_->Printf(J_ERROR, J_MAIN, "Unknown error in stub file read. retcode = %d\n", retcode); + THROW_EXCEPTION(INVALID_TNLP, "Unknown error in stub file read"); + } + break; + } + } + + void AmplTNLP::set_active_objective(Index in_obj_no) + { + if (hesset_called_) { + jnlst_->Printf(J_ERROR, J_MAIN, "Internal error: AmplTNLP::set_active_objective called after AmplTNLP::call_hesset.\n"); + THROW_EXCEPTION(INVALID_TNLP, "Internal error: AmplTNLP::set_active_objective called after AmplTNLP::call_hesset."); + } + ASL_pfgh* asl = asl_; + obj_no = in_obj_no; + set_active_objective_called_ = true; + } + + void AmplTNLP::call_hesset() + { + if (hesset_called_) { jnlst_->Printf(J_ERROR, J_MAIN, "Internal error: AmplTNLP::call_hesset is called twice.\n"); THROW_EXCEPTION(INVALID_TNLP, "Internal error: AmplTNLP::call_hesset is called twice."); - } - - ASL_pfgh* asl = asl_; - - if( n_obj == 0 ) - { - hesset(1, 0, 0, 0, nlc); - } - else - { - if( n_obj > 1 && !set_active_objective_called_ ) - { - jnlst_->Printf(J_ERROR, J_MAIN, - "There is more than one objective function in the AMPL model, but AmplTNLP::set_active_objective has not been called.\n"); - THROW_EXCEPTION(INVALID_TNLP, - "There is more than one objective function in the AMPL model, but AmplTNLP::set_active_objective has not been called"); + } + + ASL_pfgh* asl = asl_; + + if (n_obj == 0) { + hesset(1,0,0,0,nlc); + } + else { + if (n_obj>1 && !set_active_objective_called_) { + jnlst_->Printf(J_ERROR, J_MAIN, + "There is more than one objective function in the AMPL model, but AmplTNLP::set_active_objective has not been called.\n"); + THROW_EXCEPTION(INVALID_TNLP, "There is more than one objective function in the AMPL model, but AmplTNLP::set_active_objective has not been called"); } // see "changes" in solvers directory of ampl code... - hesset(1, obj_no, 1, 0, nlc); - } + hesset(1,obj_no,1,0,nlc); + } - obj_sign_ = 1; // minimization - if( n_obj > 0 && objtype[obj_no] != 0 ) - { + obj_sign_ = 1; // minimization + if (n_obj > 0 && objtype[obj_no] != 0) { obj_sign_ = -1; - } + } - // find the nonzero structure for the hessian parameters to - // sphsetup: - int coeff_obj = 1; - int mult_supplied = 1; // multipliers will be supplied - int uptri = 1; // only need the upper triangular part - nz_h_full_ = sphsetup(-1, coeff_obj, mult_supplied, uptri); + // find the nonzero structure for the hessian parameters to + // sphsetup: + int coeff_obj = 1; + int mult_supplied = 1; // multipliers will be supplied + int uptri = 1; // only need the upper triangular part + nz_h_full_ = sphsetup(-1, coeff_obj, mult_supplied, uptri); - hesset_called_ = true; -} + hesset_called_ = true; + } -AmplTNLP::~AmplTNLP() -{ - ASL_pfgh* asl = asl_; - - if( asl ) - { - if( X0 ) - { - delete[] X0; - X0 = NULL; + AmplTNLP::~AmplTNLP() + { + ASL_pfgh* asl = asl_; + + if (asl) { + if (X0) { + delete [] X0; + X0 = NULL; } - if( havex0 ) - { - delete[] havex0; - havex0 = NULL; + if (havex0) { + delete [] havex0; + havex0 = NULL; } - if( pi0 ) - { - delete[] pi0; - pi0 = NULL; + if (pi0) { + delete [] pi0; + pi0 = NULL; } - if( havepi0 ) - { - delete[] havepi0; - havepi0 = NULL; + if (havepi0) { + delete [] havepi0; + havepi0 = NULL; } - ASL* asl_to_free = (ASL*) asl_; + ASL* asl_to_free = (ASL*)asl_; ASL_free(&asl_to_free); asl_ = NULL; - } - - delete[] x_sol_; - x_sol_ = NULL; - delete[] z_L_sol_; - z_L_sol_ = NULL; - delete[] z_U_sol_; - z_U_sol_ = NULL; - delete[] g_sol_; - g_sol_ = NULL; - delete[] lambda_sol_; - lambda_sol_ = NULL; - - if( Oinfo_ptr_ ) - { + } + + delete [] x_sol_; + x_sol_ = NULL; + delete [] z_L_sol_; + z_L_sol_ = NULL; + delete [] z_U_sol_; + z_U_sol_ = NULL; + delete [] g_sol_; + g_sol_ = NULL; + delete [] lambda_sol_; + lambda_sol_ = NULL; + + if (Oinfo_ptr_) { Option_Info* Oinfo = (Option_Info*) Oinfo_ptr_; - delete[] Oinfo->sname; - delete[] Oinfo->bsname; - delete[] Oinfo->opname; + delete [] Oinfo->sname; + delete [] Oinfo->bsname; + delete [] Oinfo->opname; delete Oinfo; - } - - delete (fint*) nerror_; -} - -bool AmplTNLP::get_nlp_info( - Index& n, - Index& m, - Index& nnz_jac_g, - Index& nnz_h_lag, - IndexStyleEnum& index_style -) -{ - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + } - if( !hesset_called_ ) - { - call_hesset(); - } - - n = n_var; // # of variables (variable types have been asserted in the constructor - m = n_con; // # of constraints - nnz_jac_g = nzc; // # of non-zeros in the jacobian - nnz_h_lag = nz_h_full_; // # of non-zeros in the hessian - - index_style = TNLP::FORTRAN_STYLE; - - return true; -} - -bool AmplTNLP::get_var_con_metadata( - Index n, - StringMetaDataMapType& var_string_md, - IntegerMetaDataMapType& var_integer_md, - NumericMetaDataMapType& var_numeric_md, - Index m, - StringMetaDataMapType& con_string_md, - IntegerMetaDataMapType& con_integer_md, - NumericMetaDataMapType& con_numeric_md -) -{ - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + delete (fint*) nerror_; + } - // pick up the variable and constraints names if available - Index rlen = maxrownamelen; - Index clen = maxcolnamelen; + bool AmplTNLP::get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, + Index& nnz_h_lag, IndexStyleEnum& index_style) + { + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); - if( clen > 0 ) - { + if (!hesset_called_) { + call_hesset(); + } + + n = n_var; // # of variables (variable types have been asserted in the constructor + m = n_con; // # of constraints + nnz_jac_g = nzc; // # of non-zeros in the jacobian + nnz_h_lag = nz_h_full_; // # of non-zeros in the hessian + + index_style = TNLP::FORTRAN_STYLE; + + return true; + } + + bool AmplTNLP::get_var_con_metadata(Index n, + StringMetaDataMapType& var_string_md, + IntegerMetaDataMapType& var_integer_md, + NumericMetaDataMapType& var_numeric_md, + Index m, + StringMetaDataMapType& con_string_md, + IntegerMetaDataMapType& con_integer_md, + NumericMetaDataMapType& con_numeric_md) + { + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); + + // pick up the variable and constraints names if available + Index rlen = maxrownamelen; + Index clen = maxcolnamelen; + + if (clen > 0) { std::vector var_names(n); - for( Index i = 0; i < n; i++ ) - { - var_names[i] = var_name(i); + for (Index i=0; i 0 ) - { + if (rlen > 0) { std::vector con_names(m); - for( Index i = 0; i < m; i++ ) - { - con_names[i] = con_name(i); + for (Index i=0; i 0 || var_integer_md_.size() > 0 || var_numeric_md_.size() > 0 - || con_string_md_.size() > 0 || con_integer_md_.size() > 0 || con_numeric_md_.size() > 0 ) - { + if (var_string_md_.size() > 0 || var_integer_md_.size() > 0 || var_numeric_md_.size() > 0 + || con_string_md_.size() > 0 || con_integer_md_.size() > 0 || con_numeric_md_.size() > 0) { var_string_md = var_string_md_; var_integer_md = var_integer_md_; var_numeric_md = var_numeric_md_; @@ -384,536 +349,398 @@ bool AmplTNLP::get_var_con_metadata( con_integer_md = con_integer_md_; con_numeric_md = con_numeric_md_; return true; - } - - return false; -} - -bool AmplTNLP::get_bounds_info( - Index n, - Number* x_l, - Number* x_u, - Index m, - Number* g_l, - Number* g_u -) -{ - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - - DBG_ASSERT(n == n_var); - DBG_ASSERT(m == n_con); - - for( Index i = 0; i < n; i++ ) - { - x_l[i] = LUv[2 * i]; - x_u[i] = LUv[2 * i + 1]; - } - - for( Index i = 0; i < m; i++ ) - { - g_l[i] = LUrhs[2 * i]; - g_u[i] = LUrhs[2 * i + 1]; - } - - return true; -} - -bool AmplTNLP::get_constraints_linearity( - Index n, - LinearityType* const_types -) -{ - ASL_pfgh* asl = AmplSolverObject(); - //check that n is good - DBG_ASSERT(n == n_con); - (void) n; - // check that there are no network constraints - DBG_ASSERT(nlnc == 0 && lnc == 0); - //the first nlc constraints are non linear the rest is linear - for( Index i = 0; i < nlc; i++ ) - { - const_types[i] = NON_LINEAR; - } - // the rest is linear - for( Index i = nlc; i < n_con; i++ ) - { - const_types[i] = LINEAR; - } - return true; -} - -bool AmplTNLP::get_starting_point( - Index n, - bool init_x, - Number* x, - bool init_z, - Number* z_L, - Number* z_U, - Index m, - bool init_lambda, - Number* lambda -) -{ - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - DBG_ASSERT(n == n_var); - DBG_ASSERT(m == n_con); - - if( init_x ) - for( Index i = 0; i < n; i++ ) - { - x[i] = havex0[i] ? X0[i] : Max(LUv[2 * i], Min(LUv[2 * i + 1], 0.0)); - } - - if( init_z ) - { + } + + return false; + } + + bool AmplTNLP::get_bounds_info(Index n, Number* x_l, Number* x_u, Index m, Number* g_l, Number* g_u) + { + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); + + DBG_ASSERT(n == n_var); + DBG_ASSERT(m == n_con); + + for (Index i=0; iGetNumberSuffixValues("ipopt_zL_in", AmplSuffixHandler::Variable_Source); const double* zU_init = suffix_handler_->GetNumberSuffixValues("ipopt_zU_in", AmplSuffixHandler::Variable_Source); - for( Index i = 0; i < n; i++ ) - { - z_L[i] = zL_init != NULL ? obj_sign_ * zL_init[i] : 1.0; - z_U[i] = zU_init != NULL ? -obj_sign_ * zU_init[i] : 1.0; + for (Index i=0; i(x), grad_f, (fint* )nerror_); - if( !nerror_ok(nerror_) ) - { - return false; + } + else { + objgrd(obj_no, const_cast(x), grad_f, (fint*)nerror_); + if (!nerror_ok(nerror_)) { + return false; } - if( obj_sign_ == -1 ) - { - for( Index i = 0; i < n; i++ ) - { - grad_f[i] *= -1.; - } + if (obj_sign_==-1) { + for (Index i=0; inext ) - { - iRow[cg->goff] = i + 1; - jCol[cg->goff] = cg->varno + 1; - // iRow[current_nz] = i + 1; - // jCol[current_nz] = cg->varno+1; - current_nz++; - } + for (Index i=0; inext) { + iRow[cg->goff] = i + 1; + jCol[cg->goff] = cg->varno + 1; + // iRow[current_nz] = i + 1; + // jCol[current_nz] = cg->varno+1; + current_nz++; + } } DBG_ASSERT(current_nz == nele_jac); - (void) nele_jac; return true; - } - else if( !iRow && !jCol && values ) - { - if( !apply_new_x(new_x, n, x) ) - { - return false; + } + else if (!iRow && !jCol && values) { + if (!apply_new_x(new_x, n, x)) { + return false; } - jacval(const_cast(x), values, (fint* )nerror_); - if( nerror_ok(nerror_) ) - { - return true; + jacval(const_cast(x), values, (fint*)nerror_); + if (nerror_ok(nerror_)) { + return true; } - } - else - { + } + else { DBG_ASSERT(false && "Invalid combination of iRow, jCol, and values pointers"); - } - - return false; -} - -bool AmplTNLP::eval_h( - Index n, - const Number* x, - bool new_x, - Number obj_factor, - Index m, - const Number* lambda, - bool /*new_lambda*/, - Index nele_hess, - Index* iRow, - Index* jCol, - Number* values -) -{ - DBG_START_METH("AmplTNLP::eval_h", - dbg_verbosity); - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - DBG_ASSERT(n == n_var); - DBG_ASSERT(m == n_con); - - if( iRow && jCol && !values ) - { + } + + return false; + } + + bool AmplTNLP::eval_h(Index n, const Number* x, bool new_x, + Number obj_factor, Index m, const Number* lambda, + bool new_lambda, Index nele_hess, Index* iRow, + Index* jCol, Number* values) + { + DBG_START_METH("AmplTNLP::eval_h", + dbg_verbosity); + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); + DBG_ASSERT(n == n_var); + DBG_ASSERT(m == n_con); + + if (iRow && jCol && !values) { // setup the structure - int k = 0; - for( int i = 0; i < n; i++ ) - { - for( int j = sputinfo->hcolstarts[i]; j < sputinfo->hcolstarts[i + 1]; j++ ) - { - iRow[k] = i + 1; - jCol[k] = sputinfo->hrownos[j] + 1; - k++; - } - } - DBG_ASSERT(k == nele_hess); - (void) nele_hess; + int k=0; + for (int i=0; ihcolstarts[i]; jhcolstarts[i+1]; j++) { + iRow[k] = i + 1; + jCol[k] = sputinfo->hrownos[j]+1; + k++; + } + } + DBG_ASSERT(k==nele_hess); return true; - } - else if( !iRow && !jCol && values ) - { - if( !apply_new_x(new_x, n, x) ) - { - return false; + } + else if (!iRow && !jCol && values) { + if (!apply_new_x(new_x, n, x)) { + return false; } - if( !objval_called_with_current_x_ ) - { - Number dummy; - internal_objval(x, dummy); - internal_conval(x, m); + if (!objval_called_with_current_x_) { + Number dummy; + internal_objval(x, dummy); + internal_conval(x, m); } - if( !conval_called_with_current_x_ ) - { - internal_conval(x, m); + if (!conval_called_with_current_x_) { + internal_conval(x, m); } - real* OW = new real[Max(1, n_obj)]; - if( n_obj > 0 ) - { - for( Index i = 0; i < n_obj; i++ ) - { - OW[i] = 0.; - } - OW[obj_no] = obj_sign_ * obj_factor; + real* OW = new real[Max(1,n_obj)]; + if (n_obj>0) { + for (Index i=0; i(lambda)); - delete[] OW; + delete [] OW; return true; - } - else - { + } + else { DBG_ASSERT(false && "Invalid combination of iRow, jCol, and values pointers"); - } - - return false; -} - -void AmplTNLP::finalize_solution( - SolverReturn status, - Index n, - const Number* x, - const Number* z_L, - const Number* z_U, - Index m, - const Number* g, - const Number* lambda, - Number obj_value, - const IpoptData* /*ip_data*/, - IpoptCalculatedQuantities* /*ip_cq*/ -) -{ - ASL_pfgh* asl = asl_; + } - if( !x_sol_ ) - { + return false; + } + + void AmplTNLP::finalize_solution(SolverReturn status, + Index n, const Number* x, const Number* z_L, const Number* z_U, + Index m, const Number* g, const Number* lambda, + Number obj_value, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq) + { + ASL_pfgh* asl = asl_; + + if (!x_sol_) { x_sol_ = new Number[n]; - } - if( !z_L_sol_ ) - { + } + if (!z_L_sol_) { z_L_sol_ = new Number[n]; - } - if( !z_U_sol_ ) - { + } + if (!z_U_sol_) { z_U_sol_ = new Number[n]; - } - if( !g_sol_ ) - { + } + if (!g_sol_) { g_sol_ = new Number[m]; - } - if( !lambda_sol_ ) - { + } + if (!lambda_sol_) { lambda_sol_ = new Number[m]; - } + } - IpBlasDcopy(n, x, 1, x_sol_, 1); - IpBlasDcopy(m, g, 1, g_sol_, 1); - if( obj_sign_ == -1.0 ) // maximization - { + IpBlasDcopy(n, x, 1, x_sol_, 1); + IpBlasDcopy(m, g, 1, g_sol_, 1); + if( obj_sign_ == -1.0 ) // maximization + { for( int i = 0; i < n; ++i ) - { - z_L_sol_[i] = -z_L[i]; - } + z_L_sol_[i] = -z_L[i]; IpBlasDcopy(n, z_U, 1, z_U_sol_, 1); IpBlasDcopy(m, lambda, 1, lambda_sol_, 1); - } - else - { + } + else + { IpBlasDcopy(n, z_L, 1, z_L_sol_, 1); for( int i = 0; i < n; ++i ) - { - z_U_sol_[i] = -z_U[i]; - } + z_U_sol_[i] = -z_U[i]; for( int i = 0; i < m; ++i ) - { - lambda_sol_[i] = -lambda[i]; - } - } - obj_sol_ = obj_value; + lambda_sol_[i] = -lambda[i]; + } + obj_sol_ = obj_value; - std::string message; - if( status == SUCCESS ) - { + std::string message; + if (status == SUCCESS) { message = "Optimal Solution Found"; solve_result_num = 0; - } - else if( status == MAXITER_EXCEEDED ) - { + } + else if (status == MAXITER_EXCEEDED) { message = "Maximum Number of Iterations Exceeded."; solve_result_num = 400; - } - else if( status == CPUTIME_EXCEEDED ) - { + } + else if (status == CPUTIME_EXCEEDED) { message = "Maximum CPU Time Exceeded."; solve_result_num = 401; - } - else if( status == STOP_AT_TINY_STEP ) - { + } + else if (status == STOP_AT_TINY_STEP) { message = "Search Direction becomes Too Small."; solve_result_num = 500; - } - else if( status == STOP_AT_ACCEPTABLE_POINT ) - { + } + else if (status == STOP_AT_ACCEPTABLE_POINT) { message = "Solved To Acceptable Level."; solve_result_num = 1; - } - else if( status == FEASIBLE_POINT_FOUND ) - { + } + else if (status == FEASIBLE_POINT_FOUND) { message = "Found feasible point for square problem."; solve_result_num = 2; - } - else if( status == LOCAL_INFEASIBILITY ) - { + } + else if (status == LOCAL_INFEASIBILITY) { message = "Converged to a locally infeasible point. Problem may be infeasible."; solve_result_num = 200; - } - else if( status == RESTORATION_FAILURE ) - { + } + else if (status == RESTORATION_FAILURE) { message = "Restoration Phase Failed."; solve_result_num = 501; - } - else if( status == DIVERGING_ITERATES ) - { + } + else if (status == DIVERGING_ITERATES) { message = "Iterates diverging; problem might be unbounded."; solve_result_num = 300; - } - else - { + } + else { message = "Unknown Error"; solve_result_num = 502; - } + } - if( IsValid(suffix_handler_) ) - { + if (IsValid(suffix_handler_)) { // Modified for warm-start from AMPL. Assign Bound Multipliers as Suffixes - suf_rput("ipopt_zL_out", ASL_Sufkind_var, z_L_sol_); - suf_rput("ipopt_zU_out", ASL_Sufkind_var, z_U_sol_); - } - - // Write the .sol file - message = " \nIpopt " IPOPT_VERSION ": " + message; - write_solution_file(message.c_str()); -} - -bool AmplTNLP::internal_objval( - const Number* x, - Number& obj_val -) -{ - DBG_START_METH("AmplTNLP::internal_objval", - dbg_verbosity); - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - objval_called_with_current_x_ = false; // in case the call below fails - - if( n_obj == 0 ) - { + suf_rput("ipopt_zL_out", ASL_Sufkind_var, z_L_sol_); + suf_rput("ipopt_zU_out", ASL_Sufkind_var, z_U_sol_); + } + + // Write the .sol file + message = " \nIpopt " IPOPT_VERSION ": " + message; + write_solution_file(message.c_str()); + } + + bool AmplTNLP::internal_objval(const Number* x, Number& obj_val) + { + DBG_START_METH("AmplTNLP::internal_objval", + dbg_verbosity); + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); + objval_called_with_current_x_ = false; // in case the call below fails + + if (n_obj==0) { obj_val = 0; objval_called_with_current_x_ = true; return true; - } - else - { - Number retval = objval(obj_no, const_cast(x), (fint* )nerror_); - if( nerror_ok(nerror_) ) - { - obj_val = obj_sign_ * retval; - objval_called_with_current_x_ = true; - return true; - } - } - - return false; -} - -bool AmplTNLP::internal_conval( - const Number* x, - Index m, - Number* g -) -{ - DBG_START_METH("AmplTNLP::internal_conval", - dbg_verbosity); - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - DBG_ASSERT(m == n_con); - conval_called_with_current_x_ = false; // in case the call below fails - - bool allocated = false; - if( !g ) - { + } + else { + Number retval = objval(obj_no, const_cast(x), (fint*)nerror_); + if (nerror_ok(nerror_)) { + obj_val = obj_sign_*retval; + objval_called_with_current_x_ = true; + return true; + } + } + + return false; + } + + bool AmplTNLP::internal_conval(const Number* x, Index m, Number* g) + { + DBG_START_METH("AmplTNLP::internal_conval", + dbg_verbosity); + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); + DBG_ASSERT(m == n_con); + conval_called_with_current_x_ = false; // in case the call below fails + + bool allocated = false; + if (!g) { g = new double[m]; allocated = true; - } - conval(const_cast(x), g, (fint* )nerror_); + } + conval(const_cast(x), g, (fint*)nerror_); - if( allocated ) - { - delete[] g; + if (allocated) { + delete [] g; g = NULL; - } + } - if( nerror_ok(nerror_) ) - { + if (nerror_ok(nerror_)) { conval_called_with_current_x_ = true; return true; - } - return false; -} - -bool AmplTNLP::apply_new_x( - bool new_x, - Index /*n*/, - const Number* x -) -{ - DBG_START_METH("AmplTNLP::apply_new_x", - dbg_verbosity); + } + return false; + } + + + bool AmplTNLP::apply_new_x(bool new_x, Index n, const Number* x) + { + DBG_START_METH("AmplTNLP::apply_new_x", + dbg_verbosity); - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); - if( new_x ) - { - if( !hesset_called_ ) - { - call_hesset(); + if (new_x) { + if (!hesset_called_) { + call_hesset(); } DBG_PRINT((1, "Set new x.\n")); @@ -923,212 +750,175 @@ bool AmplTNLP::apply_new_x( objval_called_with_current_x_ = false; // tell ampl that we have a new x - xknowne(const_cast(x), (fint* )nerror_); + xknowne(const_cast(x), (fint*)nerror_); return nerror_ok(nerror_); - } - - return true; -} - -void AmplTNLP::write_solution_file( - const std::string& message -) const -{ - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl); - DBG_ASSERT(x_sol_ && lambda_sol_); - - // We need to copy the message into a non-const char array to make - // it work with the AMPL C function. - char* cmessage = new char[message.length() + 1]; - strcpy(cmessage, message.c_str()); - - write_sol(cmessage, x_sol_, lambda_sol_, (Option_Info* )Oinfo_ptr_); - - delete[] cmessage; -} - -void AmplTNLP::get_discrete_info( - Index& nlvb_, - Index& nlvbi_, - Index& nlvc_, - Index& nlvci_, - Index& nlvo_, - Index& nlvoi_, - Index& nbv_, - Index& niv_ -) const -{ - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl); - - nlvb_ = nlvb; - nlvbi_ = nlvbi; - nlvc_ = nlvc; - nlvci_ = nlvci; - nlvo_ = nlvo; - nlvoi_ = nlvoi; - nbv_ = nbv; - niv_ = niv; -} - -bool AmplTNLP::get_scaling_parameters( - Number& obj_scaling, - bool& use_x_scaling, - Index n, - Number* x_scaling, - bool& use_g_scaling, - Index m, - Number* g_scaling -) -{ - DBG_ASSERT(IsValid(suffix_handler_)); - const double* obj = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Objective_Source); - obj_scaling = (obj) ? obj[0] : 1.0; - - const double* x = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Variable_Source); - if( x ) - { + } + + return true; + } + + void AmplTNLP::write_solution_file(const std::string& message) const + { + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl); + DBG_ASSERT(x_sol_ && lambda_sol_); + + // We need to copy the message into a non-const char array to make + // it work with the AMPL C function. + char* cmessage = new char[message.length()+1]; + strcpy(cmessage, message.c_str()); + + write_sol(cmessage, x_sol_, lambda_sol_, (Option_Info*)Oinfo_ptr_); + + delete [] cmessage; + } + + void AmplTNLP::get_discrete_info(Index& nlvb_, + Index& nlvbi_, + Index& nlvc_, + Index& nlvci_, + Index& nlvo_, + Index& nlvoi_, + Index& nbv_, + Index& niv_) const + { + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl); + + nlvb_ = nlvb; + nlvbi_ = nlvbi; + nlvc_ = nlvc; + nlvci_ = nlvci; + nlvo_ = nlvo; + nlvoi_ = nlvoi; + nbv_ = nbv; + niv_ = niv; + } + + bool AmplTNLP::get_scaling_parameters(Number& obj_scaling, + bool& use_x_scaling, Index n, + Number* x_scaling, + bool& use_g_scaling, Index m, + Number* g_scaling) + { + DBG_ASSERT(IsValid(suffix_handler_)); + const double* obj = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Objective_Source); + obj_scaling = (obj) ? obj[0] : 1.0; + + const double* x = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Variable_Source); + if (x) { use_x_scaling = true; - for( int i = 0; i < n; i++ ) - { - if( x[i] > 0.0 ) - { - x_scaling[i] = x[i]; - } - else - { - x_scaling[i] = 1.0; - } - } - } - else - { + for (int i=0; i < n; i++) { + if (x[i] > 0.0) { + x_scaling[i] = x[i]; + } + else { + x_scaling[i] = 1.0; + } + } + } + else { use_x_scaling = false; - } + } - const double* g = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Constraint_Source); - if( g ) - { + const double* g = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Constraint_Source); + if (g) { use_g_scaling = true; - for( int i = 0; i < m; i++ ) - { - if( g[i] > 0 ) - { - g_scaling[i] = g[i]; - } - else - { - g_scaling[i] = 1.0; - } - } - } - else - { + for (int i=0; i < m; i++) { + if (g[i] > 0) { + g_scaling[i] = g[i]; + } + else { + g_scaling[i] = 1.0; + } + } + } + else { use_g_scaling = false; - } - - return true; -} - -Index AmplTNLP::get_number_of_nonlinear_variables() -{ - ASL_pfgh* asl = asl_; - return Max(nlvo, nlvc); -} - -bool AmplTNLP::get_list_of_nonlinear_variables( - Index num_nonlin_vars, - Index* pos_nonlin_vars -) -{ - DBG_DO(ASL_pfgh* asl = asl_;) - DBG_ASSERT(num_nonlin_vars == Max(nlvo, nlvc)); - - // The first variables are the nonlinear ones (using Fortran - // numbering) - for( Index i = 0; i < num_nonlin_vars; i++ ) - { - pos_nonlin_vars[i] = i + 1; - } - return true; -} - -extern "C" -{ - static char* get_num_opt( - Option_Info* oi, - keyword* kw, - char* value - ) - { - AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; + } + + return true; + } + + Index AmplTNLP::get_number_of_nonlinear_variables() + { + ASL_pfgh* asl = asl_; + return Max(nlvo,nlvc); + } + + bool AmplTNLP::get_list_of_nonlinear_variables(Index num_nonlin_vars, + Index* pos_nonlin_vars) + { + DBG_DO(ASL_pfgh* asl = asl_;) + DBG_ASSERT(num_nonlin_vars == Max(nlvo,nlvc)); + + // The first variables are the nonlinear ones (using Fortran + // numbering) + for (Index i=0; iinfo; real real_val; kw->info = &real_val; char* retval = D_val(oi, kw, value); kw->info = (void*) pinfo; - if( !pinfo->Options()->SetNumericValue(pinfo->IpoptName().c_str(), real_val) ) - { - pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, "\nInvalid value \"%s\" for option %s.\n", value, kw->name); - THROW_EXCEPTION(OPTION_INVALID, "Invalid numeric option"); + if (!pinfo->Options()->SetNumericValue(pinfo->IpoptName().c_str(), real_val)) { + pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, + "\nInvalid value \"%s\" for option %s.\n", value, kw->name); + THROW_EXCEPTION(OPTION_INVALID, "Invalid numeric option"); } return retval; - } + } - static char* get_int_opt( - Option_Info* oi, - keyword* kw, - char* value - ) - { - AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; + static char* get_int_opt(Option_Info *oi, keyword *kw, char *value) { + AmplOptionsList::PrivatInfo* + pinfo = (AmplOptionsList::PrivatInfo*) kw->info; int int_val; kw->info = &int_val; char* retval = I_val(oi, kw, value); kw->info = (void*) pinfo; - if( !pinfo->Options()->SetIntegerValue(pinfo->IpoptName().c_str(), int_val) ) - { - pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, "\nInvalid value \"%s\" for option %s.\n", value, kw->name); - THROW_EXCEPTION(OPTION_INVALID, "Invalid integer option"); + if (!pinfo->Options()->SetIntegerValue(pinfo->IpoptName().c_str(), int_val)) { + pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, + "\nInvalid value \"%s\" for option %s.\n", value, kw->name); + THROW_EXCEPTION(OPTION_INVALID, "Invalid integer option"); } return retval; - } + } - static char* get_str_opt( - Option_Info* oi, - keyword* kw, - char* value - ) - { - AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; + static char* get_str_opt(Option_Info *oi, keyword *kw, char *value) { + AmplOptionsList::PrivatInfo* + pinfo = (AmplOptionsList::PrivatInfo*) kw->info; char* str_val; kw->info = &str_val; char* retval = C_val(oi, kw, value); kw->info = (void*) pinfo; - if( !pinfo->Options()->SetStringValue(pinfo->IpoptName().c_str(), str_val) ) - { - pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, "\nInvalid value \"%s\" for option %s.\n", value, kw->name); - THROW_EXCEPTION(OPTION_INVALID, "Invalid string option"); + if (!pinfo->Options()->SetStringValue(pinfo->IpoptName().c_str(), str_val)) { + pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, + "\nInvalid value \"%s\" for option %s.\n", value, kw->name); + THROW_EXCEPTION(OPTION_INVALID, "Invalid string option"); } return retval; - } + } - static char* get_haltonerror_opt( - Option_Info* oi, - keyword* kw, - char* value - ) - { - AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; + static char* get_haltonerror_opt(Option_Info *oi, keyword *kw, char *value) { + AmplOptionsList::PrivatInfo* + pinfo = (AmplOptionsList::PrivatInfo*) kw->info; char* str_val; kw->info = &str_val; @@ -1137,682 +927,696 @@ extern "C" fint** nerror = (fint**) pinfo->NError(); - if( strcmp(str_val, "yes") == 0 ) - { - delete *nerror; - *nerror = NULL; + if (strcmp(str_val, "yes")==0) { + delete *nerror; + *nerror = NULL; } - else if( strcmp(str_val, "no") == 0 ) - { - delete *nerror; - *nerror = new fint; - ** nerror = 0; + else if (strcmp(str_val, "no")==0) { + delete *nerror; + *nerror = new fint; + **nerror = 0; } - else - { - pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, "\nInvalid value \"%s\" for option %s.\n", value, kw->name); - THROW_EXCEPTION(OPTION_INVALID, "Invalid option"); + else { + pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, + "\nInvalid value \"%s\" for option %s.\n", value, kw->name); + THROW_EXCEPTION(OPTION_INVALID, "Invalid option"); } return retval; - } -} - -AmplOptionsList::AmplOption::AmplOption( - const std::string ipopt_option_name, - AmplOptionType type, - const std::string description -) - : ipopt_option_name_(ipopt_option_name), - type_(type) -{ - description_ = new char[description.size() + 1]; - strcpy(description_, description.c_str()); -} - -AmplOptionsList::~AmplOptionsList() -{ - if( keywds_ ) - { - DBG_ASSERT(nkeywds_ > 0); + } + } + + + AmplOptionsList::AmplOption::AmplOption(const std::string ipopt_option_name, + AmplOptionType type, + const std::string description) + : + ipopt_option_name_(ipopt_option_name), + type_(type) + { + description_ = new char[description.size()+1]; + strcpy(description_, description.c_str()); + } + + AmplOptionsList::~AmplOptionsList() + { + if (keywds_) { + DBG_ASSERT(nkeywds_>0); keyword* keywords = (keyword*) keywds_; - for( Index i = 0; i < nkeywds_; i++ ) - { - PrivatInfo* pinfo = (PrivatInfo*) keywords[i].info; - delete pinfo; - delete[] keywords[i].name; - } - delete[] keywords; - } -} - -void* AmplOptionsList::Keywords( - const SmartPtr& options, - SmartPtr jnlst, - void** nerror -) -{ - if( keywds_ ) - { - DBG_ASSERT(nkeywds_ > 0); + for (Index i=0; i& options, + SmartPtr jnlst, + void** nerror) + { + if (keywds_) { + DBG_ASSERT(nkeywds_>0); keyword* keywords = (keyword*) keywds_; - for( Index i = 0; i < nkeywds_; i++ ) - { - PrivatInfo* pinfo = (PrivatInfo*) keywords[i].info; - delete pinfo; - delete[] keywords[i].name; + for (Index i=0; i >::iterator iter = ampl_options_map_.begin(); - iter != ampl_options_map_.end(); iter++ ) - { - keywords[ioption].name = new char[iter->first.size() + 1]; + Index ioption = 0; + for (std::map >::iterator + iter = ampl_options_map_.begin(); + iter != ampl_options_map_.end(); iter++) { + keywords[ioption].name = new char[iter->first.size()+1]; strcpy(keywords[ioption].name, iter->first.c_str()); keywords[ioption].desc = iter->second->Description(); - switch( iter->second->Type() ) - { - case String_Option: - { - PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); - keywords[ioption].info = (void*) pinfo; - keywords[ioption].kf = get_str_opt; - } - break; - case Number_Option: - { - PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); - keywords[ioption].info = (void*) pinfo; - keywords[ioption].kf = get_num_opt; - } - break; - case Integer_Option: - { - PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); - keywords[ioption].info = (void*) pinfo; - keywords[ioption].kf = get_int_opt; - } - break; - case WS_Option: - keywords[ioption].info = NULL; - keywords[ioption].kf = WS_val; - break; - case HaltOnError_Option: - PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst, nerror); - keywords[ioption].info = (void*) pinfo; - keywords[ioption].kf = get_haltonerror_opt; - break; + switch (iter->second->Type()) { + case String_Option: { + PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); + keywords[ioption].info = (void*) pinfo; + keywords[ioption].kf = get_str_opt; + } + break; + case Number_Option: { + PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); + keywords[ioption].info = (void*) pinfo; + keywords[ioption].kf = get_num_opt; + } + break; + case Integer_Option: { + PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); + keywords[ioption].info = (void*) pinfo; + keywords[ioption].kf = get_int_opt; + } + break; + case WS_Option: + keywords[ioption].info = NULL; + keywords[ioption].kf = WS_val; + break; + case HaltOnError_Option: + PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst, nerror); + keywords[ioption].info = (void*) pinfo; + keywords[ioption].kf = get_haltonerror_opt; + break; } ioption++; - } - - DBG_ASSERT(ioption == n_options); - nkeywds_ = n_options; - keywds_ = (void*) keywords; - return keywds_; -} - -void AmplOptionsList::MakeValidLatexString( - std::string source, - std::string& dest -) const -{ - std::string::iterator c; - for( c = source.begin(); c != source.end(); c++ ) - { - if( *c == '_' ) - { - dest.append("\\_"); - } - else if( *c == '^' ) - { - dest.append("\\^"); - } - else if( *c == '>' || *c == '<' ) - { - ; - } - else if( *c == '\n' ) - { - dest += ", "; - } - else - { - dest += *c; - } - } -} - -void AmplOptionsList::PrintLatex( - SmartPtr jnlst -) -{ - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\begin{description}\n"); - for( std::map >::iterator iter = ampl_options_map_.begin(); - iter != ampl_options_map_.end(); ++iter ) - { - std::string amplname; - std::string ipoptname; - std::string descr; - - MakeValidLatexString(iter->first.c_str(), amplname); - MakeValidLatexString(iter->second->IpoptOptionName(), ipoptname); - MakeValidLatexString(iter->second->Description(), descr); - - if( ipoptname.length() > 0 ) - { - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\item[{\\htmlref{%s}{opt:%s}}]", amplname.c_str(), - iter->second->IpoptOptionName().c_str()); - if( amplname != ipoptname ) - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " (Ipopt name: \\htmlref{%s}{opt:%s})", ipoptname.c_str(), - iter->second->IpoptOptionName().c_str()); - } - else - { - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\item[%s]", amplname.c_str()); - } - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " %s\n", descr.c_str()); - } - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\end{description}\n"); -} - -void AmplOptionsList::PrintDoxygen( - SmartPtr jnlst -) -{ - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "| Option | Description |\n"); - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "|:-------|:------------|\n"); - for( std::map >::iterator iter = ampl_options_map_.begin(); - iter != ampl_options_map_.end(); ++iter ) - { - if( iter->second->IpoptOptionName().length() > 0 ) - { - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "| \\ref OPT_%s \"%s\"", iter->second->IpoptOptionName().c_str(), iter->first.c_str()); - - if( iter->first != iter->second->IpoptOptionName() ) - { - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " (Ipopt name: %s)", iter->second->IpoptOptionName().c_str()); - } - } - else - { - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "| %s", iter->first.c_str()); - } - - std::string descr = iter->second->Description(); - for( std::string::iterator it = descr.begin(); it != descr.end(); ++it ) - if( *it == '\n' ) - { - *it = ';'; - } - - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " | %s |\n", descr.c_str()); - } -} - -char* -AmplTNLP::get_options( - const SmartPtr& options, - SmartPtr& ampl_options_list, - const char* ampl_option_string, - const char* ampl_invokation_string, - const char* ampl_banner_string, - char**& argv -) -{ - ASL_pfgh* asl = asl_; - - if( !IsValid(ampl_options_list) ) - { + } + + DBG_ASSERT(ioption==n_options); + nkeywds_ = n_options; + keywds_ = (void*) keywords; + return keywds_; + } + + void AmplOptionsList::MakeValidLatexString(std::string source, std::string& dest) const + { + std::string::iterator c; + for (c=source.begin(); c!=source.end(); c++) { + if (*c == '_') { + dest.append("\\_"); + } + else if (*c == '^') { + dest.append("\\^"); + } + else if (*c == '>' || *c == '<') { + ; + } + else if (*c == '\n') { + dest += ", "; + } + else { + dest += *c; + } + } + } + + void AmplOptionsList::PrintLatex(SmartPtr jnlst) + { + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\begin{description}\n"); + for( std::map >::iterator iter = ampl_options_map_.begin(); + iter != ampl_options_map_.end(); ++iter) + { + std::string amplname; + std::string ipoptname; + std::string descr; + + MakeValidLatexString(iter->first.c_str(), amplname); + MakeValidLatexString(iter->second->IpoptOptionName(), ipoptname); + MakeValidLatexString(iter->second->Description(), descr); + + if( ipoptname.length() > 0 ) + { + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\item[{\\htmlref{%s}{opt:%s}}]", + amplname.c_str(), iter->second->IpoptOptionName().c_str()); + if( amplname != ipoptname ) + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " (Ipopt name: \\htmlref{%s}{opt:%s})", + ipoptname.c_str(), iter->second->IpoptOptionName().c_str()); + } + else + { + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\item[%s]", amplname.c_str()); + } + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " %s\n", descr.c_str()); + } + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\end{description}\n"); + } + + char* + AmplTNLP::get_options(const SmartPtr& options, + SmartPtr& ampl_options_list, + const char* ampl_option_string, + const char* ampl_invokation_string, + const char* ampl_banner_string, char**& argv) + { + ASL_pfgh* asl = asl_; + + if (!IsValid(ampl_options_list)) { ampl_options_list = new AmplOptionsList(); - } - - // Output - ampl_options_list->AddAmplOption("print_level", "print_level", AmplOptionsList::Integer_Option, "Verbosity level"); - ampl_options_list->AddAmplOption("outlev", "print_level", AmplOptionsList::Integer_Option, "Verbosity level"); - ampl_options_list->AddAmplOption("print_user_options", "print_user_options", AmplOptionsList::String_Option, - "Toggle printing of user options"); - ampl_options_list->AddAmplOption("print_options_documentation", "print_options_documentation", - AmplOptionsList::String_Option, "Print all available options (for ipopt.opt)"); - ampl_options_list->AddAmplOption("output_file", "output_file", AmplOptionsList::String_Option, - "File name of an output file (leave unset for no file output)"); - ampl_options_list->AddAmplOption("file_print_level", "file_print_level", AmplOptionsList::Integer_Option, - "Verbosity level for output file"); - ampl_options_list->AddAmplOption("option_file_name", "option_file_name", AmplOptionsList::String_Option, - "File name of options file (default: ipopt.opt)"); - - // Termination - ampl_options_list->AddAmplOption("tol", "tol", AmplOptionsList::Number_Option, - "Desired convergence tolerance (relative)"); - ampl_options_list->AddAmplOption("max_iter", "max_iter", AmplOptionsList::Integer_Option, - "Maximum number of iterations"); - ampl_options_list->AddAmplOption("maxit", "max_iter", AmplOptionsList::Integer_Option, - "Maximum number of iterations"); - ampl_options_list->AddAmplOption("max_cpu_time", "max_cpu_time", AmplOptionsList::Number_Option, "CPU time limit"); - ampl_options_list->AddAmplOption("compl_inf_tol", "compl_inf_tol", AmplOptionsList::Number_Option, - "Acceptance threshold for the complementarity conditions"); - ampl_options_list->AddAmplOption("dual_inf_tol", "dual_inf_tol", AmplOptionsList::Number_Option, - "Desired threshold for the dual infeasibility"); - ampl_options_list->AddAmplOption("constr_viol_tol", "constr_viol_tol", AmplOptionsList::Number_Option, - "Desired threshold for the constraint violation"); - ampl_options_list->AddAmplOption("acceptable_tol", "acceptable_tol", AmplOptionsList::Number_Option, - "Acceptable convergence tolerance (relative)"); - ampl_options_list->AddAmplOption("acceptable_compl_inf_tol", "acceptable_compl_inf_tol", - AmplOptionsList::Number_Option, "Acceptance threshold for the complementarity conditions"); - ampl_options_list->AddAmplOption("acceptable_dual_inf_tol", "acceptable_dual_inf_tol", - AmplOptionsList::Number_Option, "Acceptance threshold for the dual infeasibility"); - ampl_options_list->AddAmplOption("acceptable_constr_viol_tol", "acceptable_constr_viol_tol", - AmplOptionsList::Number_Option, "Acceptance threshold for the constraint violation"); - - ampl_options_list->AddAmplOption("diverging_iterates_tol", "diverging_iterates_tol", AmplOptionsList::Number_Option, - "Threshold for maximal value of primal iterates"); - - // NLP scaling - ampl_options_list->AddAmplOption("obj_scaling_factor", "obj_scaling_factor", AmplOptionsList::Number_Option, - "Scaling factor for the objective function"); - ampl_options_list->AddAmplOption("nlp_scaling_method", "nlp_scaling_method", AmplOptionsList::String_Option, - "Select the technique used for scaling the NLP"); - ampl_options_list->AddAmplOption("nlp_scaling_max_gradient", "nlp_scaling_max_gradient", - AmplOptionsList::Number_Option, "Maximum gradient after scaling"); - - // NLP corrections - ampl_options_list->AddAmplOption("bound_relax_factor", "bound_relax_factor", AmplOptionsList::Number_Option, - "Factor for initial relaxation of the bounds"); - ampl_options_list->AddAmplOption("honor_original_bounds", "honor_original_bounds", AmplOptionsList::String_Option, - "If no, solution might slightly violate bounds"); - - // Barrier parameter - ampl_options_list->AddAmplOption("mu_strategy", "mu_strategy", AmplOptionsList::String_Option, - "Update strategy for barrier parameter"); - ampl_options_list->AddAmplOption("mu_oracle", "mu_oracle", AmplOptionsList::String_Option, - "Oracle for a new barrier parameter in the adaptive strategy"); - // Barrier parameter - ampl_options_list->AddAmplOption("mu_max", "mu_max", AmplOptionsList::Number_Option, - "Maximal value for barrier parameter for adaptive strategy"); - ampl_options_list->AddAmplOption("mu_init", "mu_init", AmplOptionsList::Number_Option, - "Initial value for the barrier parameter"); - - // Initialization - ampl_options_list->AddAmplOption("bound_frac", "bound_frac", AmplOptionsList::Number_Option, - "Desired minimal relative distance of initial point to bound"); - ampl_options_list->AddAmplOption("bound_push", "bound_push", AmplOptionsList::Number_Option, - "Desired minimal absolute distance of initial point to bound"); - ampl_options_list->AddAmplOption("slack_bound_frac", "slack_bound_frac", AmplOptionsList::Number_Option, - "Desired minimal relative distance of initial slack to bound"); - ampl_options_list->AddAmplOption("slack_bound_push", "slack_bound_push", AmplOptionsList::Number_Option, - "Desired minimal absolute distance of initial slack to bound"); - ampl_options_list->AddAmplOption("bound_mult_init_val", "bound_mult_init_val", AmplOptionsList::Number_Option, - "Initial value for the bound multipliers"); - ampl_options_list->AddAmplOption("constr_mult_init_max", "constr_mult_init_max", AmplOptionsList::Number_Option, - "Maximal allowed least-square guess of constraint multipliers"); - - // Multiplier updates - ampl_options_list->AddAmplOption("alpha_for_y", "alpha_for_y", AmplOptionsList::String_Option, - "Step size for constraint multipliers"); - - // Line search - ampl_options_list->AddAmplOption("max_soc", "max_soc", AmplOptionsList::Integer_Option, - "Maximal number of second order correction trial steps"); - ampl_options_list->AddAmplOption("watchdog_shortened_iter_trigger", "watchdog_shortened_iter_trigger", - AmplOptionsList::Integer_Option, "Trigger counter for watchdog procedure"); - - // Restoration phase - ampl_options_list->AddAmplOption("expect_infeasible_problem", "expect_infeasible_problem", - AmplOptionsList::String_Option, "Enable heuristics to quickly detect an infeasible problem"); - ampl_options_list->AddAmplOption("required_infeasibility_reduction", "required_infeasibility_reduction", - AmplOptionsList::Number_Option, "Required infeasibility reduction in restoration phase"); - - // Added for Warm-Start - ampl_options_list->AddAmplOption("warm_start_init_point", "warm_start_init_point", AmplOptionsList::String_Option, - "Enables to specify bound multiplier values"); - ampl_options_list->AddAmplOption("warm_start_bound_push", "warm_start_bound_push", AmplOptionsList::Number_Option, - "Enables to specify how much should variables should be pushed inside the feasible region"); - ampl_options_list->AddAmplOption("warm_start_mult_bound_push", "warm_start_mult_bound_push", - AmplOptionsList::Number_Option, - "Enables to specify how much should bound multipliers should be pushed inside the feasible region"); - - // Quasi-Newton - ampl_options_list->AddAmplOption("hessian_approximation", "hessian_approximation", AmplOptionsList::String_Option, - "Can enable Quasi-Newton approximation of hessian"); - // Linear solver - ampl_options_list->AddAmplOption("linear_solver", "linear_solver", AmplOptionsList::String_Option, - "Linear solver to be used for step calculation"); - ampl_options_list->AddAmplOption("linear_system_scaling", "linear_system_scaling", AmplOptionsList::String_Option, - "Method for scaling the linear systems"); - ampl_options_list->AddAmplOption("linear_scaling_on_demand", "linear_scaling_on_demand", - AmplOptionsList::String_Option, "Enables heuristic for scaling only when seems required"); - ampl_options_list->AddAmplOption("max_refinement_steps", "max_refinement_steps", AmplOptionsList::Integer_Option, - "Maximal number of iterative refinement steps per linear system solve"); - ampl_options_list->AddAmplOption("min_refinement_steps", "min_refinement_steps", AmplOptionsList::Integer_Option, - "Minimum number of iterative refinement steps per linear system solve"); - - // Quasi-Newton - ampl_options_list->AddAmplOption("hessian_approximation", "hessian_approximation", AmplOptionsList::String_Option, - "Can enable Quasi-Newton approximation of hessian"); - - // Special linear solver options - ampl_options_list->AddAmplOption("ma27_pivtol", "ma27_pivtol", AmplOptionsList::Number_Option, - "Pivot tolerance for the linear solver MA27"); - ampl_options_list->AddAmplOption("ma27_pivtolmax", "ma27_pivtolmax", AmplOptionsList::Number_Option, - "Maximal pivot tolerance for the linear solver MA27"); - - ampl_options_list->AddAmplOption("ma57_pivtol", "ma57_pivtol", AmplOptionsList::Number_Option, - "Pivot tolerance for the linear solver MA57"); - ampl_options_list->AddAmplOption("ma57_pivtolmax", "ma57_pivtolmax", AmplOptionsList::Number_Option, - "Maximal pivot tolerance for the linear solver MA57"); - ampl_options_list->AddAmplOption("ma57_pivot_order", "ma57_pivot_order", AmplOptionsList::Integer_Option, - "Controls pivot order in MA57"); - - ampl_options_list->AddAmplOption("pardiso_matching_strategy", "pardiso_matching_strategy", - AmplOptionsList::String_Option, "Matching strategy for linear solver Pardiso"); - //ampl_options_list->AddAmplOption("pardiso_out_of_core_power", - // "pardiso_out_of_core_power", - // AmplOptionsList::Integer_Option, - // "Enables out-of-core version of linear solver Pardiso"); + } + + // Output + ampl_options_list->AddAmplOption("print_level", + "print_level", + AmplOptionsList::Integer_Option, + "Verbosity level"); + ampl_options_list->AddAmplOption("outlev", + "print_level", + AmplOptionsList::Integer_Option, + "Verbosity level"); + ampl_options_list->AddAmplOption("print_user_options", + "print_user_options", + AmplOptionsList::String_Option, + "Toggle printing of user options"); + ampl_options_list->AddAmplOption("print_options_documentation", + "print_options_documentation", + AmplOptionsList::String_Option, + "Print all available options (for ipopt.opt)"); + ampl_options_list->AddAmplOption("output_file", + "output_file", + AmplOptionsList::String_Option, + "File name of an output file (leave unset for no file output)"); + ampl_options_list->AddAmplOption("file_print_level", + "file_print_level", + AmplOptionsList::Integer_Option, + "Verbosity level for output file"); + ampl_options_list->AddAmplOption("option_file_name", + "option_file_name", + AmplOptionsList::String_Option, + "File name of options file (default: ipopt.opt)"); + + // Termination + ampl_options_list->AddAmplOption("tol", + "tol", + AmplOptionsList::Number_Option, + "Desired convergence tolerance (relative)"); + ampl_options_list->AddAmplOption("max_iter", + "max_iter", + AmplOptionsList::Integer_Option, + "Maximum number of iterations"); + ampl_options_list->AddAmplOption("maxit", + "max_iter", + AmplOptionsList::Integer_Option, + "Maximum number of iterations"); + ampl_options_list->AddAmplOption("max_cpu_time", + "max_cpu_time", + AmplOptionsList::Number_Option, + "CPU time limit"); + ampl_options_list->AddAmplOption("compl_inf_tol", + "compl_inf_tol", + AmplOptionsList::Number_Option, + "Acceptance threshold for the complementarity conditions"); + ampl_options_list->AddAmplOption("dual_inf_tol", + "dual_inf_tol", + AmplOptionsList::Number_Option, + "Desired threshold for the dual infeasibility"); + ampl_options_list->AddAmplOption("constr_viol_tol", + "constr_viol_tol", + AmplOptionsList::Number_Option, + "Desired threshold for the constraint violation"); + ampl_options_list->AddAmplOption("acceptable_tol", + "acceptable_tol", + AmplOptionsList::Number_Option, + "Acceptable convergence tolerance (relative)"); + ampl_options_list->AddAmplOption("acceptable_compl_inf_tol", + "acceptable_compl_inf_tol", + AmplOptionsList::Number_Option, + "Acceptance threshold for the complementarity conditions"); + ampl_options_list->AddAmplOption("acceptable_dual_inf_tol", + "acceptable_dual_inf_tol", + AmplOptionsList::Number_Option, + "Acceptance threshold for the dual infeasibility"); + ampl_options_list->AddAmplOption("acceptable_constr_viol_tol", + "acceptable_constr_viol_tol", + AmplOptionsList::Number_Option, + "Acceptance threshold for the constraint violation"); + + ampl_options_list->AddAmplOption("diverging_iterates_tol", + "diverging_iterates_tol", + AmplOptionsList::Number_Option, + "Threshold for maximal value of primal iterates"); + + // NLP scaling + ampl_options_list->AddAmplOption("obj_scaling_factor", + "obj_scaling_factor", + AmplOptionsList::Number_Option, + "Scaling factor for the objective function"); + ampl_options_list->AddAmplOption("nlp_scaling_method", + "nlp_scaling_method", + AmplOptionsList::String_Option, + "Select the technique used for scaling the NLP"); + ampl_options_list->AddAmplOption("nlp_scaling_max_gradient", + "nlp_scaling_max_gradient", + AmplOptionsList::Number_Option, + "Maximum gradient after scaling"); + + // NLP corrections + ampl_options_list->AddAmplOption("bound_relax_factor", + "bound_relax_factor", + AmplOptionsList::Number_Option, + "Factor for initial relaxation of the bounds"); + ampl_options_list->AddAmplOption("honor_original_bounds", + "honor_original_bounds", + AmplOptionsList::String_Option, + "If no, solution might slightly violate bounds"); + + // Barrier parameter + ampl_options_list->AddAmplOption("mu_strategy", + "mu_strategy", + AmplOptionsList::String_Option, + "Update strategy for barrier parameter"); + ampl_options_list->AddAmplOption("mu_oracle", + "mu_oracle", + AmplOptionsList::String_Option, + "Oracle for a new barrier parameter in the adaptive strategy"); + // Barrier parameter + ampl_options_list->AddAmplOption("mu_max", + "mu_max", + AmplOptionsList::Number_Option, + "Maximal value for barrier parameter for adaptive strategy"); + ampl_options_list->AddAmplOption("mu_init", + "mu_init", + AmplOptionsList::Number_Option, + "Initial value for the barrier parameter"); + + // Initialization + ampl_options_list->AddAmplOption("bound_frac", + "bound_frac", + AmplOptionsList::Number_Option, + "Desired minimal relative distance of initial point to bound"); + ampl_options_list->AddAmplOption("bound_push", + "bound_push", + AmplOptionsList::Number_Option, + "Desired minimal absolute distance of initial point to bound"); + ampl_options_list->AddAmplOption("slack_bound_frac", + "slack_bound_frac", + AmplOptionsList::Number_Option, + "Desired minimal relative distance of initial slack to bound"); + ampl_options_list->AddAmplOption("slack_bound_push", + "slack_bound_push", + AmplOptionsList::Number_Option, + "Desired minimal absolute distance of initial slack to bound"); + ampl_options_list->AddAmplOption("bound_mult_init_val", + "bound_mult_init_val", + AmplOptionsList::Number_Option, + "Initial value for the bound multipliers"); + ampl_options_list->AddAmplOption("constr_mult_init_max", + "constr_mult_init_max", + AmplOptionsList::Number_Option, + "Maximal allowed least-square guess of constraint multipliers"); + + // Multiplier updates + ampl_options_list->AddAmplOption("alpha_for_y", + "alpha_for_y", + AmplOptionsList::String_Option, + "Step size for constraint multipliers"); + + // Line search + ampl_options_list->AddAmplOption("max_soc", + "max_soc", + AmplOptionsList::Integer_Option, + "Maximal number of second order correction trial steps"); + ampl_options_list->AddAmplOption("watchdog_shortened_iter_trigger", + "watchdog_shortened_iter_trigger", + AmplOptionsList::Integer_Option, + "Trigger counter for watchdog procedure"); + + // Restoration phase + ampl_options_list->AddAmplOption("expect_infeasible_problem", + "expect_infeasible_problem", + AmplOptionsList::String_Option, + "Enable heuristics to quickly detect an infeasible problem"); + ampl_options_list->AddAmplOption("required_infeasibility_reduction", + "required_infeasibility_reduction", + AmplOptionsList::Number_Option, + "Required infeasibility reduction in restoration phase"); + + // Added for Warm-Start + ampl_options_list->AddAmplOption("warm_start_init_point", + "warm_start_init_point", + AmplOptionsList::String_Option, + "Enables to specify bound multiplier values"); + ampl_options_list->AddAmplOption("warm_start_bound_push", + "warm_start_bound_push", + AmplOptionsList::Number_Option, + "Enables to specify how much should variables should be pushed inside the feasible region"); + ampl_options_list->AddAmplOption("warm_start_mult_bound_push", + "warm_start_mult_bound_push", + AmplOptionsList::Number_Option, + "Enables to specify how much should bound multipliers should be pushed inside the feasible region"); + + // Quasi-Newton + ampl_options_list->AddAmplOption("hessian_approximation", + "hessian_approximation", + AmplOptionsList::String_Option, + "Can enable Quasi-Newton approximation of hessian"); + // Linear solver + ampl_options_list->AddAmplOption("linear_solver", + "linear_solver", + AmplOptionsList::String_Option, + "Linear solver to be used for step calculation"); + ampl_options_list->AddAmplOption("linear_system_scaling", + "linear_system_scaling", + AmplOptionsList::String_Option, + "Method for scaling the linear systems"); + ampl_options_list->AddAmplOption("linear_scaling_on_demand", + "linear_scaling_on_demand", + AmplOptionsList::String_Option, + "Enables heuristic for scaling only when seems required"); + ampl_options_list->AddAmplOption("max_refinement_steps", + "max_refinement_steps", + AmplOptionsList::Integer_Option, + "Maximal number of iterative refinement steps per linear system solve"); + ampl_options_list->AddAmplOption("min_refinement_steps", + "min_refinement_steps", + AmplOptionsList::Integer_Option, + "Minimum number of iterative refinement steps per linear system solve"); + + + // Quasi-Newton + ampl_options_list->AddAmplOption("hessian_approximation", + "hessian_approximation", + AmplOptionsList::String_Option, + "Can enable Quasi-Newton approximation of hessian"); + + // Special linear solver options + ampl_options_list->AddAmplOption("ma27_pivtol", + "ma27_pivtol", + AmplOptionsList::Number_Option, + "Pivot tolerance for the linear solver MA27"); + ampl_options_list->AddAmplOption("ma27_pivtolmax", + "ma27_pivtolmax", + AmplOptionsList::Number_Option, + "Maximal pivot tolerance for the linear solver MA27"); + + ampl_options_list->AddAmplOption("ma57_pivtol", + "ma57_pivtol", + AmplOptionsList::Number_Option, + "Pivot tolerance for the linear solver MA57"); + ampl_options_list->AddAmplOption("ma57_pivtolmax", + "ma57_pivtolmax", + AmplOptionsList::Number_Option, + "Maximal pivot tolerance for the linear solver MA57"); + ampl_options_list->AddAmplOption("ma57_pivot_order", + "ma57_pivot_order", + AmplOptionsList::Integer_Option, + "Controls pivot order in MA57"); + + ampl_options_list->AddAmplOption("pardiso_matching_strategy", + "pardiso_matching_strategy", + AmplOptionsList::String_Option, + "Matching strategy for linear solver Pardiso"); + //ampl_options_list->AddAmplOption("pardiso_out_of_core_power", + // "pardiso_out_of_core_power", + // AmplOptionsList::Integer_Option, + // "Enables out-of-core version of linear solver Pardiso"); #ifdef HAVE_WSMP - ampl_options_list->AddAmplOption("wsmp_num_threads", - "wsmp_num_threads", - AmplOptionsList::Integer_Option, - "Number of threads to be used in WSMP"); - ampl_options_list->AddAmplOption("wsmp_pivtol", - "wsmp_pivtol", - AmplOptionsList::Number_Option, - "Pivot tolerance for the linear solver WSMP"); - ampl_options_list->AddAmplOption("wsmp_pivtolmax", - "wsmp_pivtolmax", - AmplOptionsList::Number_Option, - "Maximum pivot tolerance for the linear solver WSMP"); - ampl_options_list->AddAmplOption("wsmp_scaling", - "wsmp_scaling", - AmplOptionsList::Integer_Option, - "Determines how the matrix is scaled by WSMP"); + ampl_options_list->AddAmplOption("wsmp_num_threads", + "wsmp_num_threads", + AmplOptionsList::Integer_Option, + "Number of threads to be used in WSMP"); + ampl_options_list->AddAmplOption("wsmp_pivtol", + "wsmp_pivtol", + AmplOptionsList::Number_Option, + "Pivot tolerance for the linear solver WSMP"); + ampl_options_list->AddAmplOption("wsmp_pivtolmax", + "wsmp_pivtolmax", + AmplOptionsList::Number_Option, + "Maximum pivot tolerance for the linear solver WSMP"); + ampl_options_list->AddAmplOption("wsmp_scaling", + "wsmp_scaling", + AmplOptionsList::Integer_Option, + "Determines how the matrix is scaled by WSMP"); #endif - // AMPL's wantsol option - // description was originally taken from WS_desc_ASL+5, but that didn't make it through DLL boundaries - ampl_options_list->AddAmplOption("wantsol", "", AmplOptionsList::WS_Option, - "solution report without -AMPL: sum of 1 (write .sol file), 2 (print primal variable values), 4 (print dual variable values), 8 (do not print solution message)"); - - // special AMPL option to exit when there is in error in the - // function evaluation - ampl_options_list->AddAmplOption("halt_on_ampl_error", "", AmplOptionsList::HaltOnError_Option, - "Exit with message on evaluation error"); - - int n_options = ampl_options_list->NumberOfAmplOptions(); - - keyword* keywds = (keyword*) ampl_options_list->Keywords(options, jnlst_, (void**) &nerror_); - - static const char sname_default[] = "ipopt"; - static const char bsname_default[] = "Ipopt " IPOPT_VERSION; - static const char opname_default[] = "ipopt_options"; - const char* sname; - const char* bsname; - const char* opname; - if( ampl_option_string ) - { + // AMPL's wantsol option + ampl_options_list->AddAmplOption("wantsol", "", + AmplOptionsList::WS_Option, + WS_desc_ASL+5); + + // special AMPL option to exit when there is in error in the + // function evaluation + ampl_options_list->AddAmplOption("halt_on_ampl_error", "", + AmplOptionsList::HaltOnError_Option, + "Exit with message on evaluation error"); + + int n_options = ampl_options_list->NumberOfAmplOptions(); + + keyword* keywds = + (keyword*) ampl_options_list->Keywords(options, jnlst_, + (void**)&nerror_); + + static const char sname_default[] = "ipopt"; + static const char bsname_default[] = "Ipopt " IPOPT_VERSION; + static const char opname_default[] = "ipopt_options"; + const char* sname; + const char* bsname; + const char* opname; + if (ampl_option_string) { opname = ampl_option_string; - } - else - { + } + else { opname = opname_default; - } - if( ampl_invokation_string ) - { + } + if (ampl_invokation_string) { sname = ampl_invokation_string; - } - else - { + } + else { sname = sname_default; - } - if( ampl_banner_string ) - { + } + if (ampl_banner_string) { bsname = ampl_banner_string; - } - else - { + } + else { bsname = bsname_default; - } - - DBG_ASSERT(!Oinfo_ptr_); - Option_Info* Oinfo = new Option_Info; - Oinfo->sname = new char[strlen(sname) + 1]; - strcpy(Oinfo->sname, sname); - Oinfo->bsname = new char[strlen(bsname) + 1]; - strcpy(Oinfo->bsname, bsname); - Oinfo->opname = new char[strlen(opname) + 1]; - strcpy(Oinfo->opname, opname); - Oinfo->keywds = keywds; - Oinfo->n_keywds = n_options; - // Set the default for the remaining entries - Oinfo->flags = 0; - Oinfo->version = NULL; - Oinfo->usage = NULL; - Oinfo->kwf = NULL; - Oinfo->feq = NULL; - Oinfo->options = NULL; - Oinfo->n_options = 0; - Oinfo->driver_date = 0; - Oinfo->wantsol = 0; - Oinfo->nS = 0; - Oinfo->S = NULL; - Oinfo->uinfo = NULL; - Oinfo->asl = NULL; - Oinfo->eqsign = NULL; - Oinfo->n_badopts = 0; - Oinfo->option_echo = 0; - Oinfo->nnl = 0; - - Oinfo_ptr_ = Oinfo; - - char* stub = getstops(argv, Oinfo); - - return stub; -} - -bool AmplTNLP::nerror_ok( - void* nerror -) -{ - DBG_START_METH("AmplTNLP::nerror_ok", - dbg_verbosity); - - if( nerror == NULL || *((fint*) nerror) == 0 ) - { + } + + DBG_ASSERT(!Oinfo_ptr_); + Option_Info* Oinfo = new Option_Info; + Oinfo->sname = new char[strlen(sname)+1]; + strcpy(Oinfo->sname, sname); + Oinfo->bsname = new char[strlen(bsname)+1]; + strcpy(Oinfo->bsname, bsname); + Oinfo->opname = new char[strlen(opname)+1]; + strcpy(Oinfo->opname, opname); + Oinfo->keywds = keywds; + Oinfo->n_keywds = n_options; + // Set the default for the remaining entries + Oinfo->flags = 0; + Oinfo->version = NULL; + Oinfo->usage = NULL; + Oinfo->kwf = NULL; + Oinfo->feq = NULL; + Oinfo->options = NULL; + Oinfo->n_options = 0; + Oinfo->driver_date = 0; + Oinfo->wantsol = 0; + Oinfo->nS = 0; + Oinfo->S = NULL; + Oinfo->uinfo = NULL; + Oinfo->asl = NULL; + Oinfo->eqsign = NULL; + Oinfo->n_badopts = 0; + Oinfo->option_echo = 0; + Oinfo->nnl = 0; + + Oinfo_ptr_ = Oinfo; + + char* stub = getstops(argv, Oinfo); + + return stub; + } + + bool AmplTNLP::nerror_ok(void* nerror) + { + DBG_START_METH("AmplTNLP::nerror_ok", + dbg_verbosity); + + if (nerror == NULL || *((fint*)nerror) == 0) { return true; - } - jnlst_->Printf(J_ERROR, J_MAIN, - "Error in an AMPL evaluation. Run with \"halt_on_ampl_error yes\" to see details.\n"); - DBG_PRINT((1, "nerror = %d\n", *((fint*)nerror))); - return false; -} - -AmplSuffixHandler::AmplSuffixHandler() - : asl_(NULL), - suftab_(NULL) -{ -} - -AmplSuffixHandler::~AmplSuffixHandler() -{ - if( suftab_ ) - { - Index n = (Index) suffix_ids_.size(); - for( Index i = 0; i < n; i++ ) - { - delete[] suftab_[i].name; - suftab_[i].name = NULL; - } - } - delete[] suftab_; - suftab_ = NULL; -} - -void AmplSuffixHandler::PrepareAmplForSuffixes( - ASL_pfgh* asl -) -{ - DBG_ASSERT(asl); - asl_ = asl; - - Index n = (Index) suffix_ids_.size(); - suftab_ = new SufDecl[n]; - for( Index i = 0; i < n; i++ ) - { - Index id_len = (Index) strlen(suffix_ids_[i].c_str()); + } + jnlst_->Printf(J_ERROR, J_MAIN, "Error in an AMPL evaluation. Run with \"halt_on_ampl_error yes\" to see details.\n"); + DBG_PRINT((1, "nerror = %d\n", *((fint*)nerror))); + return false; + } + + AmplSuffixHandler::AmplSuffixHandler() + : + asl_(NULL), + suftab_ (NULL) + {} + + AmplSuffixHandler::~AmplSuffixHandler() + { + if (suftab_) { + Index n = (Index)suffix_ids_.size(); + for (Index i=0; iu.i; -} - -std::vector AmplSuffixHandler::GetIntegerSuffixValues( - Index n, - std::string suffix_string, - Suffix_Source source -) const -{ - std::vector ret; - const Index* ptr = GetIntegerSuffixValues(suffix_string, source); - if( ptr ) - { + } + SufDesc* dp = suf_get(suffix_string.c_str(), kind); + return dp->u.i; + } + + std::vector + AmplSuffixHandler::GetIntegerSuffixValues(Index n, std::string suffix_string, + Suffix_Source source) const + { + std::vector ret; + const Index* ptr = GetIntegerSuffixValues(suffix_string, source); + if (ptr) { ret.reserve(n); - for( Index i = 0; i < n; i++ ) - { - ret.push_back(ptr[i]); - } - } - return ret; -} - -const Number* -AmplSuffixHandler::GetNumberSuffixValues( - std::string suffix_string, - Suffix_Source source -) const -{ - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl); - - int kind; - if( source == Variable_Source ) - { + for (Index i=0; iu.r; -} - -std::vector AmplSuffixHandler::GetNumberSuffixValues( - Index n, - std::string suffix_string, - Suffix_Source source) const -{ - std::vector ret; - const Number* ptr = GetNumberSuffixValues(suffix_string, source); - if( ptr ) - { + } + SufDesc* dp = suf_get(suffix_string.c_str(), kind); + return dp->u.r; + } + + std::vector + AmplSuffixHandler::GetNumberSuffixValues(Index n, std::string suffix_string, + Suffix_Source source) const + { + std::vector ret; + const Number* ptr = GetNumberSuffixValues(suffix_string, source); + if (ptr) { ret.reserve(n); - for( Index i = 0; i < n; i++ ) - { - ret.push_back(ptr[i]); + for (Index i=0; i GetIntegerSuffixValues( - Index n, - std::string suffix_string, - Suffix_Source source - ) const; - - std::vector GetNumberSuffixValues( - Index n, - std::string suffix_string, - Suffix_Source source - ) const; - -private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. - */ - //@{ - /** Default Constructor */ - //AmplSuffixHandler(); - /** Copy Constructor */ - AmplSuffixHandler( - const AmplSuffixHandler& - ); - - /** Default Assignment Operator */ - void operator=( - const AmplSuffixHandler& - ); - //@} - - mutable ASL_pfgh* asl_; - - SufDecl* suftab_; - - std::vector suffix_ids_; - std::vector suffix_types_; - std::vector suffix_sources_; - - /** Method called by AmplTNLP to prepare the asl for the suffixes */ - void PrepareAmplForSuffixes( - ASL_pfgh* asl - ); - - /** Method called by AmplTNLP to retrieve the suffixes from asl */ - // void RetrieveSuffixesFromAmpl(ASL_pfgh* asl); - friend class AmplTNLP; -}; - -/** Class for storing a number of AMPL options that should be - * registered to the AMPL Solver library interface - */ -class IPOPTAMPLINTERFACELIB_EXPORT AmplOptionsList: public ReferencedObject -{ -public: - enum AmplOptionType - { + } + + const Index* GetIntegerSuffixValues(std::string suffix_string, Suffix_Source source) const; + + const Number* GetNumberSuffixValues(std::string suffix_string, Suffix_Source source) const; + + std::vector GetIntegerSuffixValues(Index n, std::string suffix_string, Suffix_Source source) const; + + std::vector GetNumberSuffixValues(Index n, std::string suffix_string, Suffix_Source source) const; + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + //AmplSuffixHandler(); + + /** Copy Constructor */ + AmplSuffixHandler(const AmplSuffixHandler&); + + /** Overloaded Equals Operator */ + void operator=(const AmplSuffixHandler&); + //@} + + mutable ASL_pfgh* asl_; + + SufDecl* suftab_; + + std::vector suffix_ids_; + std::vector suffix_types_; + std::vector suffix_sources_; + + /** Method called by AmplTNLP to prepare the asl for the suffixes */ + void PrepareAmplForSuffixes(ASL_pfgh* asl); + + /** Method called by AmplTNLP to retrieve the suffixes from asl */ + // void RetrieveSuffixesFromAmpl(ASL_pfgh* asl); + + friend class AmplTNLP; + }; + + /** Class for storing a number of AMPL options that should be + * registered to the AMPL Solver library interface */ + class AmplOptionsList : public ReferencedObject + { + public: + enum AmplOptionType { String_Option, Number_Option, Integer_Option, - WS_Option, /**< this is for AMPL's internal wantsol callback */ - HaltOnError_Option /**< this is for our setting of the nerror_ member */ - }; - - /** Ampl Option class containing name, type and description for an AMPL option */ - class IPOPTAMPLINTERFACELIB_EXPORT AmplOption: public ReferencedObject - { - public: - AmplOption( - const std::string ipopt_option_name, - AmplOptionType type, - const std::string description); + WS_Option, /* this is for AMPL's internal wantsol callback */ + HaltOnError_Option /* this is for our setting of the nerror_ member */ + }; + + /** Ampl Option class, contains name, type and description for an + * AMPL option */ + class AmplOption : public ReferencedObject + { + public: + AmplOption(const std::string ipopt_option_name, + AmplOptionType type, + const std::string description); ~AmplOption() { - delete[] description_; + delete [] description_; } const std::string& IpoptOptionName() const { - return ipopt_option_name_; + return ipopt_option_name_; } AmplOptionType Type() const { - return type_; + return type_; } char* Description() const { - return description_; + return description_; } - private: + private: /**@name Default Compiler Generated Methods * (Hidden to avoid implicit creation/calling). - * - * These methods are not implemented and + * These methods are not implemented and * we do not want the compiler to implement * them for us, so we declare them private * and do not define them. This ensures that - * they will not be implicitly created/called. - */ + * they will not be implicitly created/called. */ //@{ /** Default Constructor */ AmplOption(); /** Copy Constructor */ - AmplOption( - const AmplOption&); + AmplOption(const AmplOption&); - /** Default Assignment Operator */ - void operator=( - const AmplOption&); + /** Overloaded Equals Operator */ + void operator=(const AmplOption&); //@} const std::string ipopt_option_name_; const AmplOptionType type_; char* description_; - }; - - class PrivatInfo - { - public: - PrivatInfo( - const std::string ipopt_name, - SmartPtr options, - SmartPtr jnlst, - void** nerror = NULL - ) - : ipopt_name_(ipopt_name), - options_(options), - jnlst_(jnlst), - nerror_(nerror) - { - } + }; + + class PrivatInfo + { + public: + PrivatInfo(const std::string ipopt_name, + SmartPtr options, + SmartPtr jnlst, + void** nerror = NULL) + : + ipopt_name_(ipopt_name), + options_(options), + jnlst_(jnlst), + nerror_(nerror) + {} const std::string& IpoptName() const { - return ipopt_name_; + return ipopt_name_; } const SmartPtr& Options() const { - return options_; + return options_; } const SmartPtr& Jnlst() const { - return jnlst_; + return jnlst_; } void** NError() { - return nerror_; + return nerror_; } - private: + private: const std::string ipopt_name_; const SmartPtr options_; const SmartPtr jnlst_; void** nerror_; - }; + }; -public: - /** Default Constructor */ - AmplOptionsList() - : keywds_(NULL), + public: + /** Default Constructor */ + AmplOptionsList() + : + keywds_(NULL), nkeywds_(0) - { } - - /** Destructor */ - ~AmplOptionsList(); - - /** Adding a new AMPL Option */ - void AddAmplOption( - const std::string ampl_option_name, - const std::string ipopt_option_name, - AmplOptionsList::AmplOptionType type, - const std::string description - ) - { - SmartPtr new_option = new AmplOption(ipopt_option_name, type, description); + {} + + /** Destructor */ + ~AmplOptionsList(); + + /** Adding a new AMPL Option */ + void AddAmplOption(const std::string ampl_option_name, + const std::string ipopt_option_name, + AmplOptionsList::AmplOptionType type, + const std::string description) + { + SmartPtr new_option = + new AmplOption(ipopt_option_name, type, description); ampl_options_map_[ampl_option_name] = ConstPtr(new_option); - } - - /** Number of AMPL Options */ - Index NumberOfAmplOptions() - { - return (Index) ampl_options_map_.size(); - } - - /** ASL keywords list for the stored options. */ - void* Keywords( - const SmartPtr& options, - SmartPtr jnlst, - void** nerror - ); - -private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. - */ - //@{ - /** Default Constructor */ - //AmplOptionsList(); - /** Copy Constructor */ - AmplOptionsList( - const AmplOptionsList& - ); - - /** Default Assignment Operator */ - void operator=( - const AmplOptionsList& - ); - //@} - - void MakeValidLatexString( - std::string source, - std::string& dest - ) const; - - void PrintLatex( - SmartPtr jnlst - ); - - void PrintDoxygen( - SmartPtr jnlst - ); - - /** map for storing registered AMPL options */ - std::map > ampl_options_map_; - // AW: I think it should be with const like in the following line - // but with const the AIX compiler fails - // std::map > ampl_options_map_; - - /** pointer to the keywords */ - void* keywds_; - - /** Number of entries stored in keywds_ */ - Index nkeywds_; -}; - -/** Ampl Interface, implemented as a TNLP. */ -class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP -{ -public: - /**@name Constructors/Destructors */ - //@{ - /** Constructor. */ - AmplTNLP( - const SmartPtr& jnlst, - const SmartPtr options, - char**& argv, - SmartPtr suffix_handler = NULL, - bool allow_discrete = false, - SmartPtr ampl_options_list = NULL, - const char* ampl_option_string = NULL, - const char* ampl_invokation_string = NULL, - const char* ampl_banner_string = NULL, - std::string* nl_file_content = NULL - ); - - /** Default destructor */ - virtual ~AmplTNLP(); - //@} - - /** Exceptions */ - DECLARE_STD_EXCEPTION(NONPOSITIVE_SCALING_FACTOR); - - /**@name methods to gather information about the NLP */ - //@{ - virtual bool get_nlp_info( - Index& n, - Index& m, - Index& nnz_jac_g, - Index& nnz_h_lag, - IndexStyleEnum& index_style - ); - - virtual bool get_var_con_metadata( - Index n, - StringMetaDataMapType& var_string_md, - IntegerMetaDataMapType& var_integer_md, - NumericMetaDataMapType& var_numeric_md, - Index m, - StringMetaDataMapType& con_string_md, - IntegerMetaDataMapType& con_integer_md, - NumericMetaDataMapType& con_numeric_md - ); - - /** returns bounds of the nlp. Overloaded from TNLP */ - virtual bool get_bounds_info( - Index n, - Number* x_l, - Number* x_u, - Index m, - Number* g_l, - Number* g_u - ); - - virtual bool get_constraints_linearity( - Index m, - LinearityType* const_types - ); - - virtual bool get_starting_point( - Index n, - bool init_x, - Number* x, - bool init_z, - Number* z_L, - Number* z_U, - Index m, - bool init_lambda, - Number* lambda - ); - - virtual bool eval_f( - Index n, - const Number* x, - bool new_x, - Number& obj_value - ); - - virtual bool eval_grad_f( - Index n, - const Number* x, - bool new_x, - Number* grad_f - ); - - virtual bool eval_g( - Index n, - const Number* x, - bool new_x, - Index m, - Number* g - ); - - virtual bool eval_jac_g( - Index n, - const Number* x, - bool new_x, - Index m, - Index nele_jac, - Index* iRow, - Index* jCol, - Number* values - ); - - virtual bool eval_h( - Index n, - const Number* x, - bool new_x, - Number obj_factor, - Index m, - const Number* lambda, - bool new_lambda, - Index nele_hess, - Index* iRow, - Index* jCol, - Number* values - ); - - virtual bool get_scaling_parameters( - Number& obj_scaling, - bool& use_x_scaling, - Index n, - Number* x_scaling, - bool& use_g_scaling, - Index m, - Number* g_scaling - ); - //@} - - /** @name Solution Methods */ - //@{ - virtual void finalize_solution( - SolverReturn status, - Index n, - const Number* x, - const Number* z_L, - const Number* z_U, - Index m, - const Number* g, - const Number* lambda, - Number obj_value, - const IpoptData* ip_data, - IpoptCalculatedQuantities* ip_cq - ); - //@} - - /** @name Method for quasi-Newton approximation information. */ - //@{ - virtual Index get_number_of_nonlinear_variables(); - virtual bool get_list_of_nonlinear_variables( - Index num_nonlin_vars, - Index* pos_nonlin_vars - ); - //@} - - /**@name Ampl specific methods */ - //@{ - /** Return the ampl solver object (ASL*) */ - ASL_pfgh* AmplSolverObject() - { + } + + /** Number of AMPL Options */ + Index NumberOfAmplOptions() + { + return (Index)ampl_options_map_.size(); + } + + /** ASL keywords list for the stored options. */ + void* Keywords(const SmartPtr& options, + SmartPtr jnlst, + void** nerror); + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + //AmplOptionsList(); + + /** Copy Constructor */ + AmplOptionsList(const AmplOptionsList&); + + /** Overloaded Equals Operator */ + void operator=(const AmplOptionsList&); + //@} + + void MakeValidLatexString(std::string source, std::string& dest) const; + + void PrintLatex(SmartPtr jnlst); + + /** map for storing registered AMPL options */ + std::map > ampl_options_map_; + // AW: I think it should be with const like in the following line + // but with const the AIX compiler fails + // std::map > ampl_options_map_; + + /** pointer to the keywords */ + void* keywds_; + + /** Number of entries stored in keywds_ */ + Index nkeywds_; + }; + + /** Ampl Interface. + * Ampl Interface, implemented as a TNLP. + */ + class AmplTNLP : public TNLP + { + public: + /**@name Constructors/Destructors */ + //@{ + /** Constructor. */ + AmplTNLP(const SmartPtr& jnlst, + const SmartPtr options, + char**& argv, SmartPtr + suffix_handler = NULL, bool allow_discrete = false, + SmartPtr ampl_options_list = NULL, + const char* ampl_option_string = NULL, + const char* ampl_invokation_string = NULL, + const char* ampl_banner_string = NULL, + std::string* nl_file_content = NULL); + + /** Default destructor */ + virtual ~AmplTNLP(); + //@} + + /** Exceptions */ + DECLARE_STD_EXCEPTION(NONPOSITIVE_SCALING_FACTOR); + + /**@name methods to gather information about the NLP. These + * methods are overloaded from TNLP. See TNLP for their more + * detailed documentation. */ + //@{ + /** returns dimensions of the nlp. Overloaded from TNLP */ + virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, + Index& nnz_h_lag, IndexStyleEnum& index_style); + + /** returns names and other meta data for the variables and constraints + * Overloaded from TNLP */ + virtual bool get_var_con_metadata(Index n, + StringMetaDataMapType& var_string_md, + IntegerMetaDataMapType& var_integer_md, + NumericMetaDataMapType& var_numeric_md, + Index m, + StringMetaDataMapType& con_string_md, + IntegerMetaDataMapType& con_integer_md, + NumericMetaDataMapType& con_numeric_md); + + /** returns bounds of the nlp. Overloaded from TNLP */ + virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u, + Index m, Number* g_l, Number* g_u); + + /** Returns the constraint linearity. + * array will be alocated with length n. (default implementation + * just return false and does not fill the array). */ + virtual bool get_constraints_linearity(Index m, + LinearityType* const_types); + + /** provides a starting point for the nlp variables. Overloaded + from TNLP */ + virtual bool get_starting_point(Index n, bool init_x, Number* x, + bool init_z, Number* z_L, Number* z_U, + Index m, bool init_lambda, Number* lambda); + + /** evaluates the objective value for the nlp. Overloaded from TNLP */ + virtual bool eval_f(Index n, const Number* x, bool new_x, + Number& obj_value); + + /** evaluates the gradient of the objective for the + nlp. Overloaded from TNLP */ + virtual bool eval_grad_f(Index n, const Number* x, bool new_x, + Number* grad_f); + + /** evaluates the constraint residuals for the nlp. Overloaded from TNLP */ + virtual bool eval_g(Index n, const Number* x, bool new_x, + Index m, Number* g); + + /** specifies the jacobian structure (if values is NULL) and + * evaluates the jacobian values (if values is not NULL) for the + * nlp. Overloaded from TNLP */ + virtual bool eval_jac_g(Index n, const Number* x, bool new_x, + Index m, Index nele_jac, Index* iRow, + Index *jCol, Number* values); + + /** specifies the structure of the hessian of the lagrangian (if + * values is NULL) and evaluates the values (if values is not + * NULL). Overloaded from TNLP */ + virtual bool eval_h(Index n, const Number* x, bool new_x, + Number obj_factor, Index m, const Number* lambda, + bool new_lambda, Index nele_hess, Index* iRow, + Index* jCol, Number* values); + + /** retrieve the scaling parameters for the variables, objective + * function, and constraints. */ + virtual bool get_scaling_parameters(Number& obj_scaling, + bool& use_x_scaling, Index n, + Number* x_scaling, + bool& use_g_scaling, Index m, + Number* g_scaling); + //@} + + /** @name Solution Methods */ + //@{ + virtual void finalize_solution(SolverReturn status, + Index n, const Number* x, const Number* z_L, const Number* z_U, + Index m, const Number* g, const Number* lambda, + Number obj_value, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq); + //@} + + /** @name Method for quasi-Newton approximation information. */ + //@{ + virtual Index get_number_of_nonlinear_variables(); + virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars, + Index* pos_nonlin_vars); + //@} + + + /**@name Ampl specific methods */ + //@{ + /** Return the ampl solver object (ASL*) */ + ASL_pfgh* AmplSolverObject() + { return asl_; - } - - /** Write the solution file. - * - * This is a wrapper for AMPL's write_sol. - * @todo Maybe this should be at a different place, or collect the numbers itself? - */ - void write_solution_file( - const std::string& message - ) const; - - /** Give the number of binary and integer variables. - * - * AMPL orders the variables like (continuous, binary, integer). - * For details, see Tables 3 and 4 in "Hooking Your Solver to AMPL" - */ - void get_discrete_info( - Index& nlvb_, - Index& nlvbi_, - Index& nlvc_, - Index& nlvci_, - Index& nlvo_, - Index& nlvoi_, - Index& nbv_, - Index& niv_ - ) const; - //@} - - /** A method for setting the index of the objective function to be - * considered. - * - * This method must be called after the constructor, - * and before anything else is called. It can only be called - * once, and if there is more than one objective function in the - * AMPL model, it MUST be called. - */ - void set_active_objective( - Index obj_no - ); - - /**@name Methods to set meta data for the variables and constraints. - * - * These values will be passed on to the TNLP in get_var_con_meta_data. - */ - //@{ - void set_string_metadata_for_var( - std::string tag, - std::vector meta_data) - { + } + + /** Write the solution file. This is a wrapper for AMPL's + * write_sol. TODO Maybe this should be at a different place, or + * collect the numbers itself? */ + void write_solution_file(const std::string& message) const; + + /** ampl orders the variables like (continuous, binary, integer). + * This method gives the number of binary and integer variables. + * For details, see Tables 3 and 4 in "Hooking Your Solver to + * AMPL" + */ + void get_discrete_info(Index& nlvb_, + Index& nlvbi_, + Index& nlvc_, + Index& nlvci_, + Index& nlvo_, + Index& nlvoi_, + Index& nbv_, + Index& niv_) const; + //@} + + /** A method for setting the index of the objective function to be + * considered. This method must be called after the constructor, + * and before anything else is called. It can only be called + * once, and if there is more than one objective function in the + * AMPL model, it MUST be called. */ + void set_active_objective(Index obj_no); + + /**@name Methods to set meta data for the variables + * and constraints. These values will be passed on + * to the TNLP in get_var_con_meta_data + */ + //@{ + void set_string_metadata_for_var(std::string tag, std::vector meta_data) + { var_string_md_[tag] = meta_data; - } + } - void set_integer_metadata_for_var( - std::string tag, - std::vector meta_data) - { + void set_integer_metadata_for_var(std::string tag, std::vector meta_data) + { var_integer_md_[tag] = meta_data; - } + } - void set_numeric_metadata_for_var( - std::string tag, - std::vector meta_data) - { + void set_numeric_metadata_for_var(std::string tag, std::vector meta_data) + { var_numeric_md_[tag] = meta_data; - } + } - void set_string_metadata_for_con( - std::string tag, - std::vector meta_data) - { + void set_string_metadata_for_con(std::string tag, std::vector meta_data) + { con_string_md_[tag] = meta_data; - } + } - void set_integer_metadata_for_con( - std::string tag, - std::vector meta_data) - { + void set_integer_metadata_for_con(std::string tag, std::vector meta_data) + { con_integer_md_[tag] = meta_data; - } + } - void set_numeric_metadata_for_con( - std::string tag, - std::vector meta_data) - { + void set_numeric_metadata_for_con(std::string tag, std::vector meta_data) + { con_numeric_md_[tag] = meta_data; - } - //@} + } + //@} - /** Method for returning the suffix handler */ - SmartPtr get_suffix_handler() - { + /** Method for returning the suffix handler */ + SmartPtr get_suffix_handler() + { return suffix_handler_; - } - -private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. - */ - //@{ - /** Default Constructor */ - AmplTNLP(); - - /** Copy Constructor */ - AmplTNLP( - const AmplTNLP& - ); - - /** Default Assignment Operator */ - void operator=( - const AmplTNLP& - ); - //@} - - /** Journalist */ - SmartPtr jnlst_; - - /** pointer to the main ASL structure */ - ASL_pfgh* asl_; - - /** Sign of the objective fn (1 for min, -1 for max) */ - double obj_sign_; - - /**@name Problem Size Data*/ - //@{ - /** number of nonzeros in the full_x Hessian */ - Index nz_h_full_; - /* the rest of the problem size data is available easily through the ampl variables */ - //@} - /**@name Internal copies of solution vectors */ - //@{ - Number* x_sol_; - Number* z_L_sol_; - Number* z_U_sol_; - Number* g_sol_; - Number* lambda_sol_; - Number obj_sol_; - //@} - - /**@name Flags to track internal state */ - //@{ - /** whether the objective value has been calculated with the current x - * - * set to false in apply_new_x, and set to true in internal_objval - */ - bool objval_called_with_current_x_; - /** whether the constraint values have been calculated with the current x - * set to false in apply_new_x, and set to true in internal_conval - */ - bool conval_called_with_current_x_; - /** whether we have called hesset */ - bool hesset_called_; - /** whether set_active_objective has been called */ - bool set_active_objective_called_; - //@} - - /** Pointer to the Oinfo structure */ - void* Oinfo_ptr_; - - /** nerror flag passed to ampl calls - set to NULL to halt on error */ - void* nerror_; - - /** Suffix Handler */ - SmartPtr suffix_handler_; - - /** Make the objective call to ampl */ - bool internal_objval( - const Number* x, - Number& obj_val - ); - - /** Make the constraint call to ampl*/ - bool internal_conval( - const Number* x, - Index m, - Number* g = NULL - ); - - /** Internal function to update the internal and ampl state if the - * x value changes - */ - bool apply_new_x( - bool new_x, - Index n, - const Number* x - ); - - /** Method for obtaining the name of the NL file and the options - * set from AMPL - * - * @return a pointer to a char* with the name of the stub - */ - char* get_options( - const SmartPtr& options, - SmartPtr& ampl_options_list, - const char* ampl_option_string, - const char* ampl_invokation_string, - const char* ampl_banner_string, - char**& argv - ); - - /** whether the ampl nerror code is ok */ - bool nerror_ok( - void* nerror - ); - - /** calls hesset ASL function */ - void call_hesset(); - - /** meta data to pass on to TNLP */ - StringMetaDataMapType var_string_md_; - IntegerMetaDataMapType var_integer_md_; - NumericMetaDataMapType var_numeric_md_; - StringMetaDataMapType con_string_md_; - IntegerMetaDataMapType con_integer_md_; - NumericMetaDataMapType con_numeric_md_; -}; + } + + private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. */ + //@{ + /** Default Constructor */ + AmplTNLP(); + + /** Copy Constructor */ + AmplTNLP(const AmplTNLP&); + + /** Overloaded Equals Operator */ + void operator=(const AmplTNLP&); + //@} + + /** Journlist */ + SmartPtr jnlst_; + + /** pointer to the main ASL structure */ + ASL_pfgh* asl_; + + /** Sign of the objective fn (1 for min, -1 for max) */ + double obj_sign_; + + /**@name Problem Size Data*/ + //@{ + Index nz_h_full_; // number of nonzeros in the full_x hessian + /* the rest of the problem size data is available easily through the ampl variables */ + //@} + + /**@name Internal copies of data */ + //@{ + /** Solution Vectors */ + Number* x_sol_; + Number* z_L_sol_; + Number* z_U_sol_; + Number* g_sol_; + Number* lambda_sol_; + Number obj_sol_; + //@} + + /**@name Flags to track internal state */ + //@{ + /** true when the objective value has been calculated with the + * current x, set to false in apply_new_x, and set to true in + * internal_objval */ + bool objval_called_with_current_x_; + /** true when the constraint values have been calculated with the + * current x, set to false in apply_new_x, and set to true in + * internal_conval */ + bool conval_called_with_current_x_; + /** true when we have called hesset */ + bool hesset_called_; + /** true when set_active_objective has been called */ + bool set_active_objective_called_; + //@} + + /** Pointer to the Oinfo structure */ + void* Oinfo_ptr_; + + /** nerror flag passed to ampl calls - set to NULL to halt on error */ + void* nerror_; + + /** Suffix Handler */ + SmartPtr suffix_handler_; + + /** Make the objective call to ampl */ + bool internal_objval(const Number* x, Number& obj_val); + + /** Make the constraint call to ampl*/ + bool internal_conval(const Number* x, Index m, Number* g=NULL); + + /** Internal function to update the internal and ampl state if the + * x value changes */ + bool apply_new_x(bool new_x, Index n, const Number* x); + + /** Method for obtaining the name of the NL file and the options + * set from AMPL. Returns a pointer to a char* with the name of + * the stub */ + char* get_options(const SmartPtr& options, + SmartPtr& ampl_options_list, + const char* ampl_option_string, + const char* ampl_invokation_string, + const char* ampl_banner_string, char**& argv); + + /** returns true if the ampl nerror code is ok */ + bool nerror_ok(void* nerror); + + /** calls hesset ASL function */ + void call_hesset(); + + /** meta data to pass on to TNLP */ + StringMetaDataMapType var_string_md_; + IntegerMetaDataMapType var_integer_md_; + NumericMetaDataMapType var_numeric_md_; + StringMetaDataMapType con_string_md_; + IntegerMetaDataMapType con_integer_md_; + NumericMetaDataMapType con_numeric_md_; + }; + + } // namespace Ipopt diff --git a/src/Apps/AmplSolver/Makefile.am b/src/Apps/AmplSolver/Makefile.am index ac6c9059f..ccece0446 100644 --- a/src/Apps/AmplSolver/Makefile.am +++ b/src/Apps/AmplSolver/Makefile.am @@ -2,34 +2,79 @@ # All Rights Reserved. # This file is distributed under the Eclipse Public License. +## $Id$ + # Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 +AUTOMAKE_OPTIONS = foreign + lib_LTLIBRARIES = libipoptamplinterface.la bin_PROGRAMS = ipopt libipoptamplinterface_la_SOURCES = \ - AmplTNLP.cpp + AmplTNLP.cpp AmplTNLP.hpp +if DEPENDENCY_LINKING libipoptamplinterface_la_LIBADD = ../../Interfaces/libipopt.la \ - $(IPOPTAMPLINTERFACELIB_LFLAGS) + $(IPOPTAMPLINTERFACELIB_LIBS) +endif + +libipoptamplinterface_la_LDFLAGS = $(LT_LDFLAGS) ipopt_SOURCES = \ ampl_ipopt.cpp -ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la +ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la \ + $(IPOPTAMPLINTERFACELIB_LIBS) $(IPOPTLIB_LIBS) + +ipopt_DEPENDENCIES = libipoptamplinterface.la ../../Interfaces/libipopt.la \ + $(IPOPTAMPLINTERFACELIB_DEPENDENCIES) $(IPOPTLIB_DEPENDENCIES) -AM_LDFLAGS = $(LT_LDFLAGS) +AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../../Common` \ + -I`$(CYGPATH_W) $(srcdir)/../../LinAlg` \ + -I`$(CYGPATH_W) $(srcdir)/../../LinAlg/TMatrices` \ + -I`$(CYGPATH_W) $(srcdir)/../../Algorithm` \ + -I`$(CYGPATH_W) $(srcdir)/../../Interfaces` -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../LinAlg \ - -I$(srcdir)/../../LinAlg/TMatrices \ - -I$(srcdir)/../../Algorithm \ - -I$(srcdir)/../../Interfaces \ - $(IPOPTAMPLINTERFACELIB_CFLAGS) +AM_CPPFLAGS += $(ASL_CFLAGS) -includeipoptdir = $(includedir)/coin-or +includeipoptdir = $(includedir)/coin includeipopt_HEADERS = AmplTNLP.hpp pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = ../../../ipoptamplinterface.pc + +# This line is necessary to allow VPATH compilation +DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Common + +if COIN_CXX_IS_CL +install-exec-hook: + test -s ipopt.exe.manifest && \ + mt -manifest ipopt.exe.manifest -outputresource:ipopt.exe;\ + cp ipopt.exe $(bindir)/ipopt.exe +endif + +# Astyle stuff + +ASTYLE_FILES = \ + AmplTNLP.cppbak AmplTNLP.hppbak \ + ampl_ipopt.cppbak + +ASTYLE = @ASTYLE@ +ASTYLEFLAGS = @ASTYLEFLAGS@ + +DISTCLEANFILES = $(ASTYLE_FILES) + +SUFFIXES = .cppbak .hppbak + +astyle: $(ASTYLE_FILES) + +.hpp.hppbak: + mv $< $@ + $(ASTYLE) $(ASTYLEFLAGS) < $@ > $< + touch $@ + +.cpp.cppbak: + mv $< $@ + $(ASTYLE) $(ASTYLEFLAGS) < $@ > $< + touch $@ diff --git a/src/Apps/AmplSolver/Makefile.in b/src/Apps/AmplSolver/Makefile.in index 487d7f7b9..8f48f979a 100644 --- a/src/Apps/AmplSolver/Makefile.in +++ b/src/Apps/AmplSolver/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -23,67 +23,15 @@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -99,156 +47,157 @@ build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = ipopt$(EXEEXT) subdir = src/Apps/AmplSolver +DIST_COMMON = $(includeipopt_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(includeipopt_HEADERS) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Common/config.h \ - $(top_builddir)/src/Common/config_ipopt.h + $(top_builddir)/src/Common/config_ipopt.h \ + $(top_builddir)/examples/ScalableProblems/config.h CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \ - "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)" -PROGRAMS = $(bin_PROGRAMS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = -libipoptamplinterface_la_DEPENDENCIES = ../../Interfaces/libipopt.la \ - $(am__DEPENDENCIES_1) +@DEPENDENCY_LINKING_TRUE@libipoptamplinterface_la_DEPENDENCIES = \ +@DEPENDENCY_LINKING_TRUE@ ../../Interfaces/libipopt.la \ +@DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) am_libipoptamplinterface_la_OBJECTS = AmplTNLP.lo libipoptamplinterface_la_OBJECTS = \ $(am_libipoptamplinterface_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) am_ipopt_OBJECTS = ampl_ipopt.$(OBJEXT) ipopt_OBJECTS = $(am_ipopt_OBJECTS) -ipopt_DEPENDENCIES = libipoptamplinterface.la \ - ../../Interfaces/libipopt.la -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/Common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/AmplTNLP.Plo \ - ./$(DEPDIR)/ampl_ipopt.Po -am__mv = mv -f +am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libipoptamplinterface_la_SOURCES) $(ipopt_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac +DIST_SOURCES = $(libipoptamplinterface_la_SOURCES) $(ipopt_SOURCES) +pkgconfiglibDATA_INSTALL = $(INSTALL_DATA) DATA = $(pkgconfiglib_DATA) +includeipoptHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includeipopt_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ADD_FFLAGS = @ADD_FFLAGS@ +AIX_FIX_COMPILER_BUG_FALSE = @AIX_FIX_COMPILER_BUG_FALSE@ +AIX_FIX_COMPILER_BUG_TRUE = @AIX_FIX_COMPILER_BUG_TRUE@ +ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ +ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ -AS = @AS@ +ASL_CFLAGS = @ASL_CFLAGS@ +ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ +ASL_DATA = @ASL_DATA@ +ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ +ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ +ASL_LIBS = @ASL_LIBS@ +ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ +ASTYLE = @ASTYLE@ +ASTYLEFLAGS = @ASTYLEFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ +AUX_DIR = @AUX_DIR@ AWK = @AWK@ BIT32FCOMMENT = @BIT32FCOMMENT@ BIT64FCOMMENT = @BIT64FCOMMENT@ BITS_PER_POINTER = @BITS_PER_POINTER@ +BLAS_CFLAGS = @BLAS_CFLAGS@ +BLAS_CFLAGS_INSTALLED = @BLAS_CFLAGS_INSTALLED@ +BLAS_DATA = @BLAS_DATA@ +BLAS_DATA_INSTALLED = @BLAS_DATA_INSTALLED@ +BLAS_DEPENDENCIES = @BLAS_DEPENDENCIES@ +BLAS_LIBS = @BLAS_LIBS@ +BLAS_LIBS_INSTALLED = @BLAS_LIBS_INSTALLED@ +BLUEGENEEXTRA = @BLUEGENEEXTRA@ +BUILDTOOLSDIR = @BUILDTOOLSDIR@ +BUILD_INEXACT_FALSE = @BUILD_INEXACT_FALSE@ +BUILD_INEXACT_TRUE = @BUILD_INEXACT_TRUE@ +BUILD_LINEARSOLVERLOADER_FALSE = @BUILD_LINEARSOLVERLOADER_FALSE@ +BUILD_LINEARSOLVERLOADER_TRUE = @BUILD_LINEARSOLVERLOADER_TRUE@ +BUILD_PARDISOLOADER_FALSE = @BUILD_PARDISOLOADER_FALSE@ +BUILD_PARDISOLOADER_TRUE = @BUILD_PARDISOLOADER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ +CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ +COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ +COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ +COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ +COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ +COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ +COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ +COIN_HAS_BLAS_FALSE = @COIN_HAS_BLAS_FALSE@ +COIN_HAS_BLAS_TRUE = @COIN_HAS_BLAS_TRUE@ +COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ +COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ +COIN_HAS_F77_FALSE = @COIN_HAS_F77_FALSE@ +COIN_HAS_F77_TRUE = @COIN_HAS_F77_TRUE@ +COIN_HAS_HSL_FALSE = @COIN_HAS_HSL_FALSE@ +COIN_HAS_HSL_TRUE = @COIN_HAS_HSL_TRUE@ +COIN_HAS_LAPACK_FALSE = @COIN_HAS_LAPACK_FALSE@ +COIN_HAS_LAPACK_TRUE = @COIN_HAS_LAPACK_TRUE@ +COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ +COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ +COIN_HAS_MUMPS_FALSE = @COIN_HAS_MUMPS_FALSE@ +COIN_HAS_MUMPS_TRUE = @COIN_HAS_MUMPS_TRUE@ +COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ +COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ +COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +CXXAR = @CXXAR@ CXXCPP = @CXXCPP@ +CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXLIBS = @CXXLIBS@ CYGPATH_W = @CYGPATH_W@ +DBG_CFLAGS = @DBG_CFLAGS@ +DBG_CXXFLAGS = @DBG_CXXFLAGS@ +DBG_FFLAGS = @DBG_FFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ +DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ +DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ +ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -256,86 +205,120 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ -FGREP = @FGREP@ FLIBS = @FLIBS@ -GREP = @GREP@ -HSLLIB_CFLAGS = @HSLLIB_CFLAGS@ -HSLLIB_CFLAGS_NOPC = @HSLLIB_CFLAGS_NOPC@ -HSLLIB_LFLAGS = @HSLLIB_LFLAGS@ -HSLLIB_LFLAGS_NOPC = @HSLLIB_LFLAGS_NOPC@ -HSLLIB_PCFILES = @HSLLIB_PCFILES@ -INSTALL = @INSTALL@ +FRAMEWORK_VECLIB = @FRAMEWORK_VECLIB@ +HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ +HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ +HAVE_MA28_FALSE = @HAVE_MA28_FALSE@ +HAVE_MA28_TRUE = @HAVE_MA28_TRUE@ +HAVE_PARDISO_FALSE = @HAVE_PARDISO_FALSE@ +HAVE_PARDISO_TRUE = @HAVE_PARDISO_TRUE@ +HAVE_WSMP_FALSE = @HAVE_WSMP_FALSE@ +HAVE_WSMP_TRUE = @HAVE_WSMP_TRUE@ +HSL_CFLAGS = @HSL_CFLAGS@ +HSL_CFLAGS_INSTALLED = @HSL_CFLAGS_INSTALLED@ +HSL_DATA = @HSL_DATA@ +HSL_DATA_INSTALLED = @HSL_DATA_INSTALLED@ +HSL_DEPENDENCIES = @HSL_DEPENDENCIES@ +HSL_LIBS = @HSL_LIBS@ +HSL_LIBS_INSTALLED = @HSL_LIBS_INSTALLED@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IPALLLIBS = @IPALLLIBS@ IPOPTAMPLINTERFACELIB_CFLAGS = @IPOPTAMPLINTERFACELIB_CFLAGS@ -IPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @IPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ -IPOPTAMPLINTERFACELIB_LFLAGS = @IPOPTAMPLINTERFACELIB_LFLAGS@ -IPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @IPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ -IPOPTAMPLINTERFACELIB_PCFILES = @IPOPTAMPLINTERFACELIB_PCFILES@ +IPOPTAMPLINTERFACELIB_CFLAGS_INSTALLED = @IPOPTAMPLINTERFACELIB_CFLAGS_INSTALLED@ +IPOPTAMPLINTERFACELIB_DEPENDENCIES = @IPOPTAMPLINTERFACELIB_DEPENDENCIES@ +IPOPTAMPLINTERFACELIB_LIBS = @IPOPTAMPLINTERFACELIB_LIBS@ +IPOPTAMPLINTERFACELIB_LIBS_INSTALLED = @IPOPTAMPLINTERFACELIB_LIBS_INSTALLED@ +IPOPTAMPLINTERFACELIB_PCLIBS = @IPOPTAMPLINTERFACELIB_PCLIBS@ +IPOPTAMPLINTERFACELIB_PCREQUIRES = @IPOPTAMPLINTERFACELIB_PCREQUIRES@ IPOPTLIB_CFLAGS = @IPOPTLIB_CFLAGS@ -IPOPTLIB_CFLAGS_NOPC = @IPOPTLIB_CFLAGS_NOPC@ -IPOPTLIB_LFLAGS = @IPOPTLIB_LFLAGS@ -IPOPTLIB_LFLAGS_NOPC = @IPOPTLIB_LFLAGS_NOPC@ -IPOPTLIB_PCFILES = @IPOPTLIB_PCFILES@ -JAR = @JAR@ -JAVA = @JAVA@ -JAVAC = @JAVAC@ -JAVADOC = @JAVADOC@ -LD = @LD@ +IPOPTLIB_CFLAGS_INSTALLED = @IPOPTLIB_CFLAGS_INSTALLED@ +IPOPTLIB_DEPENDENCIES = @IPOPTLIB_DEPENDENCIES@ +IPOPTLIB_LIBS = @IPOPTLIB_LIBS@ +IPOPTLIB_LIBS_INSTALLED = @IPOPTLIB_LIBS_INSTALLED@ +IPOPTLIB_PCLIBS = @IPOPTLIB_PCLIBS@ +IPOPTLIB_PCREQUIRES = @IPOPTLIB_PCREQUIRES@ +IPOPT_SVN_REV = @IPOPT_SVN_REV@ +JAVA_HOME = @JAVA_HOME@ +JIPOPTDLL = @JIPOPTDLL@ +LAPACK_CFLAGS = @LAPACK_CFLAGS@ +LAPACK_CFLAGS_INSTALLED = @LAPACK_CFLAGS_INSTALLED@ +LAPACK_DATA = @LAPACK_DATA@ +LAPACK_DATA_INSTALLED = @LAPACK_DATA_INSTALLED@ +LAPACK_DEPENDENCIES = @LAPACK_DEPENDENCIES@ +LAPACK_LIBS = @LAPACK_LIBS@ +LAPACK_LIBS_INSTALLED = @LAPACK_LIBS_INSTALLED@ LDFLAGS = @LDFLAGS@ +LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ +LIBTOOLM4 = @LIBTOOLM4@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ +MATLAB_CYGPATH_W = @MATLAB_CYGPATH_W@ +MATLAB_HOME = @MATLAB_HOME@ +MEXSUFFIX = @MEXSUFFIX@ +MEX_STATIC_FALSE = @MEX_STATIC_FALSE@ +MEX_STATIC_TRUE = @MEX_STATIC_TRUE@ +MEX_WINDOWS_FALSE = @MEX_WINDOWS_FALSE@ +MEX_WINDOWS_TRUE = @MEX_WINDOWS_TRUE@ +MPICC = @MPICC@ +MPICXX = @MPICXX@ +MPIF77 = @MPIF77@ +MUMPS_CFLAGS = @MUMPS_CFLAGS@ +MUMPS_CFLAGS_INSTALLED = @MUMPS_CFLAGS_INSTALLED@ +MUMPS_DATA = @MUMPS_DATA@ +MUMPS_DATA_INSTALLED = @MUMPS_DATA_INSTALLED@ +MUMPS_DEPENDENCIES = @MUMPS_DEPENDENCIES@ +MUMPS_LIBS = @MUMPS_LIBS@ +MUMPS_LIBS_INSTALLED = @MUMPS_LIBS_INSTALLED@ +MWMA57PATH = @MWMA57PATH@ OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ +OPT_CFLAGS = @OPT_CFLAGS@ +OPT_CXXFLAGS = @OPT_CXXFLAGS@ +OPT_FFLAGS = @OPT_FFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ -SED = @SED@ SET_MAKE = @SET_MAKE@ +SHARED_FLAGS = @SHARED_FLAGS@ SHELL = @SHELL@ -SIPOPTAMPLINTERFACELIB_CFLAGS = @SIPOPTAMPLINTERFACELIB_CFLAGS@ -SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ -SIPOPTAMPLINTERFACELIB_LFLAGS = @SIPOPTAMPLINTERFACELIB_LFLAGS@ -SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ -SIPOPTAMPLINTERFACELIB_PCFILES = @SIPOPTAMPLINTERFACELIB_PCFILES@ STRIP = @STRIP@ VERSION = @VERSION@ -_ACJNI_JAVAC = @_ACJNI_JAVAC@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ +VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ +abs_bin_dir = @abs_bin_dir@ +abs_include_dir = @abs_include_dir@ +abs_lib_dir = @abs_lib_dir@ +abs_source_dir = @abs_source_dir@ +ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -347,7 +330,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ +coin_doxy_excludes = @coin_doxy_excludes@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ @@ -355,85 +338,94 @@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ exec_prefix = @exec_prefix@ +have_autoconf = @have_autoconf@ +have_automake = @have_automake@ +have_svn = @have_svn@ +have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ -htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ -localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ -psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ +sol_cc_compiler = @sol_cc_compiler@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = foreign lib_LTLIBRARIES = libipoptamplinterface.la libipoptamplinterface_la_SOURCES = \ - AmplTNLP.cpp + AmplTNLP.cpp AmplTNLP.hpp -libipoptamplinterface_la_LIBADD = ../../Interfaces/libipopt.la \ - $(IPOPTAMPLINTERFACELIB_LFLAGS) +@DEPENDENCY_LINKING_TRUE@libipoptamplinterface_la_LIBADD = ../../Interfaces/libipopt.la \ +@DEPENDENCY_LINKING_TRUE@ $(IPOPTAMPLINTERFACELIB_LIBS) +libipoptamplinterface_la_LDFLAGS = $(LT_LDFLAGS) ipopt_SOURCES = \ ampl_ipopt.cpp -ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la -AM_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../LinAlg \ - -I$(srcdir)/../../LinAlg/TMatrices \ - -I$(srcdir)/../../Algorithm \ - -I$(srcdir)/../../Interfaces \ - $(IPOPTAMPLINTERFACELIB_CFLAGS) - -includeipoptdir = $(includedir)/coin-or +ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la \ + $(IPOPTAMPLINTERFACELIB_LIBS) $(IPOPTLIB_LIBS) + +ipopt_DEPENDENCIES = libipoptamplinterface.la ../../Interfaces/libipopt.la \ + $(IPOPTAMPLINTERFACELIB_DEPENDENCIES) $(IPOPTLIB_DEPENDENCIES) + +AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../../Common` -I`$(CYGPATH_W) \ + $(srcdir)/../../LinAlg` -I`$(CYGPATH_W) \ + $(srcdir)/../../LinAlg/TMatrices` -I`$(CYGPATH_W) \ + $(srcdir)/../../Algorithm` -I`$(CYGPATH_W) \ + $(srcdir)/../../Interfaces` $(ASL_CFLAGS) +includeipoptdir = $(includedir)/coin includeipopt_HEADERS = AmplTNLP.hpp pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = ../../../ipoptamplinterface.pc + +# This line is necessary to allow VPATH compilation +DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Common + +# Astyle stuff +ASTYLE_FILES = \ + AmplTNLP.cppbak AmplTNLP.hppbak \ + ampl_ipopt.cppbak + +DISTCLEANFILES = $(ASTYLE_FILES) +SUFFIXES = .cppbak .hppbak all: all-am .SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj +.SUFFIXES: .cppbak .hppbak .cpp .hpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Apps/AmplSolver/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Apps/AmplSolver/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Apps/AmplSolver/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Apps/AmplSolver/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -443,98 +435,66 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - list2="$$list2 $$p"; \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ - } + done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -libipoptamplinterface.la: $(libipoptamplinterface_la_OBJECTS) $(libipoptamplinterface_la_DEPENDENCIES) $(EXTRA_libipoptamplinterface_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libipoptamplinterface_la_OBJECTS) $(libipoptamplinterface_la_LIBADD) $(LIBS) - -ipopt$(EXEEXT): $(ipopt_OBJECTS) $(ipopt_DEPENDENCIES) $(EXTRA_ipopt_DEPENDENCIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libipoptamplinterface.la: $(libipoptamplinterface_la_OBJECTS) $(libipoptamplinterface_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libipoptamplinterface_la_LDFLAGS) $(libipoptamplinterface_la_OBJECTS) $(libipoptamplinterface_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +ipopt$(EXEEXT): $(ipopt_OBJECTS) $(ipopt_DEPENDENCIES) @rm -f ipopt$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(ipopt_OBJECTS) $(ipopt_LDADD) $(LIBS) + $(CXXLINK) $(ipopt_LDFLAGS) $(ipopt_OBJECTS) $(ipopt_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -542,146 +502,157 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AmplTNLP.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ampl_ipopt.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AmplTNLP.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ampl_ipopt.Po@am__quote@ .cpp.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: install-pkgconfiglibDATA: $(pkgconfiglib_DATA) @$(NORMAL_INSTALL) - @list='$(pkgconfiglib_DATA)'; test -n "$(pkgconfiglibdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfiglibdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pkgconfiglibdir)" || exit 1; \ - fi; \ - for p in $$list; do \ + test -z "$(pkgconfiglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfiglibdir)" + @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfiglibdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfiglibdir)" || exit $$?; \ + f=$(am__strip_dir) \ + echo " $(pkgconfiglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ + $(pkgconfiglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ done uninstall-pkgconfiglibDATA: @$(NORMAL_UNINSTALL) - @list='$(pkgconfiglib_DATA)'; test -n "$(pkgconfiglibdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(pkgconfiglibdir)'; $(am__uninstall_files_from_dir) + @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ + done install-includeipoptHEADERS: $(includeipopt_HEADERS) @$(NORMAL_INSTALL) - @list='$(includeipopt_HEADERS)'; test -n "$(includeipoptdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(includeipoptdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(includeipoptdir)" || exit 1; \ - fi; \ - for p in $$list; do \ + test -z "$(includeipoptdir)" || $(mkdir_p) "$(DESTDIR)$(includeipoptdir)" + @list='$(includeipopt_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includeipoptdir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(includeipoptdir)" || exit $$?; \ + f=$(am__strip_dir) \ + echo " $(includeipoptHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includeipoptdir)/$$f'"; \ + $(includeipoptHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includeipoptdir)/$$f"; \ done uninstall-includeipoptHEADERS: @$(NORMAL_UNINSTALL) - @list='$(includeipopt_HEADERS)'; test -n "$(includeipoptdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(includeipoptdir)'; $(am__uninstall_files_from_dir) - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags + @list='$(includeipopt_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(includeipoptdir)/$$f'"; \ + rm -f "$(DESTDIR)$(includeipoptdir)/$$f"; \ + done -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique + $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(DATA) $(HEADERS) +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) install-binPROGRAMS: install-libLTLIBRARIES installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -693,37 +664,32 @@ install-am: all-am installcheck: installcheck-am install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@COIN_CXX_IS_CL_FALSE@install-exec-hook: clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/AmplTNLP.Plo - -rm -f ./$(DEPDIR)/ampl_ipopt.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -731,43 +697,24 @@ dvi-am: html: html-am -html-am: - info: info-am info-am: install-data-am: install-includeipoptHEADERS install-pkgconfiglibDATA -install-dvi: install-dvi-am - -install-dvi-am: - install-exec-am: install-binPROGRAMS install-libLTLIBRARIES - -install-html: install-html-am - -install-html-am: + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-info: install-info-am -install-info-am: - install-man: -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/AmplTNLP.Plo - -rm -f ./$(DEPDIR)/ampl_ipopt.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -785,31 +732,42 @@ ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-includeipoptHEADERS \ + uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-pkgconfiglibDATA + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libLTLIBRARIES clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-exec-hook install-includeipoptHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-pkgconfiglibDATA install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-includeipoptHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-pkgconfiglibDATA -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags dvi dvi-am html html-am info info-am install \ - install-am install-binPROGRAMS install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-includeipoptHEADERS \ - install-info install-info-am install-libLTLIBRARIES \ - install-man install-pdf install-pdf-am \ - install-pkgconfiglibDATA install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-includeipoptHEADERS \ - uninstall-libLTLIBRARIES uninstall-pkgconfiglibDATA -.PRECIOUS: Makefile +@COIN_CXX_IS_CL_TRUE@install-exec-hook: +@COIN_CXX_IS_CL_TRUE@ test -s ipopt.exe.manifest && \ +@COIN_CXX_IS_CL_TRUE@ mt -manifest ipopt.exe.manifest -outputresource:ipopt.exe;\ +@COIN_CXX_IS_CL_TRUE@ cp ipopt.exe $(bindir)/ipopt.exe + +astyle: $(ASTYLE_FILES) +.hpp.hppbak: + mv $< $@ + $(ASTYLE) $(ASTYLEFLAGS) < $@ > $< + touch $@ +.cpp.cppbak: + mv $< $@ + $(ASTYLE) $(ASTYLEFLAGS) < $@ > $< + touch $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/src/Apps/AmplSolver/ampl_ipopt.cpp b/src/Apps/AmplSolver/ampl_ipopt.cpp index ae76b7645..82892f2be 100644 --- a/src/Apps/AmplSolver/ampl_ipopt.cpp +++ b/src/Apps/AmplSolver/ampl_ipopt.cpp @@ -2,104 +2,103 @@ // All Rights Reserved. // This code is published under the Eclipse Public License. // +// $Id$ +// // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 #include "AmplTNLP.hpp" #include "IpIpoptApplication.hpp" + #include "IpoptConfig.h" +#ifdef HAVE_CSTRING +# include +#else +# ifdef HAVE_STRING_H +# include +# else +# error "don't have header file for string" +# endif +#endif -#include -#include +// for printf +#ifdef HAVE_CSTDIO +# include +#else +# ifdef HAVE_STDIO_H +# include +# else +# error "don't have header file for stdio" +# endif +#endif -int main( - int argc, - char** args) +int main(int argc, char**args) { - using namespace Ipopt; + using namespace Ipopt; - SmartPtr app = IpoptApplicationFactory(); - app->RethrowNonIpoptException(false); + SmartPtr app = IpoptApplicationFactory(); + app->RethrowNonIpoptException(false); - // Check if executable is run only to print out options documentation - if( argc == 2 ) - { - bool print_options = false; - std::string print_options_mode("text"); - if( !strcmp(args[1], "--print-options=latex") ) - { - print_options = true; - print_options_mode = "latex"; - } - else if( !strcmp(args[1], "--print-options=doxygen") ) - { - print_options = true; - print_options_mode = "doxygen"; - } - else if( !strcmp(args[1], "--print-options") ) - { - print_options = true; + // Check if executable is run only to print out options documentation + if (argc == 2) { + bool print_options = false; + bool print_latex_options = false; + if (!strcmp(args[1],"--print-options")) { + print_options = true; + } + else if (!strcmp(args[1],"--print-latex-options")) { + print_options = true; + print_latex_options = true; + } + if (print_options) { + SmartPtr options = app->Options(); + options->SetStringValue("print_options_documentation", "yes"); + if (print_latex_options) { + options->SetStringValue("print_options_latex_mode", "yes"); } - else if( !strcmp(args[1], "--print-latex-options") ) - { - fprintf(stderr, "ampl_ipopt.cpp: Options --print-latex-options has been replaced by --print-options=latex. Please adjust your call.\n"); - exit(-200); - } - if( print_options ) - { - SmartPtr options = app->Options(); - options->SetStringValue("print_options_documentation", "yes"); - options->SetStringValue("print_options_mode", print_options_mode); - app->Initialize(""); - return 0; - } - } + app->Initialize(""); + return 0; + } + } - // Call Initialize the first time to create a journalist, but ignore - // any options file - ApplicationReturnStatus retval; - retval = app->Initialize(""); - if( retval != Solve_Succeeded ) - { - printf("ampl_ipopt.cpp: Error in first Initialize!!!!\n"); - exit(-100); - } + // Call Initialize the first time to create a journalist, but ignore + // any options file + ApplicationReturnStatus retval; + retval = app->Initialize(""); + if (retval != Solve_Succeeded) { + printf("ampl_ipopt.cpp: Error in first Initialize!!!!\n"); + exit(-100); + } - // Add the suffix handler for scaling - SmartPtr suffix_handler = new AmplSuffixHandler(); - suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Variable_Source, - AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Constraint_Source, - AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Objective_Source, - AmplSuffixHandler::Number_Type); - // Modified for warm-start from AMPL - suffix_handler->AddAvailableSuffix("ipopt_zL_out", AmplSuffixHandler::Variable_Source, - AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("ipopt_zU_out", AmplSuffixHandler::Variable_Source, - AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("ipopt_zL_in", AmplSuffixHandler::Variable_Source, - AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("ipopt_zU_in", AmplSuffixHandler::Variable_Source, - AmplSuffixHandler::Number_Type); + // Add the suffix handler for scaling + SmartPtr suffix_handler = new AmplSuffixHandler(); + suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Objective_Source, AmplSuffixHandler::Number_Type); + // Modified for warm-start from AMPL + suffix_handler->AddAvailableSuffix("ipopt_zL_out", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("ipopt_zU_out", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("ipopt_zL_in", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("ipopt_zU_in", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); - SmartPtr ampl_tnlp = new AmplTNLP(ConstPtr(app->Jnlst()), app->Options(), args, suffix_handler); + SmartPtr ampl_tnlp = new AmplTNLP(ConstPtr(app->Jnlst()), + app->Options(), + args, suffix_handler); - // Call Initialize again to process output related options - retval = app->Initialize(); - if( retval != Solve_Succeeded ) - { - printf("ampl_ipopt.cpp: Error in second Initialize!!!!\n"); - exit(-101); - } + // Call Initialize again to process output related options + retval = app->Initialize(); + if (retval != Solve_Succeeded) { + printf("ampl_ipopt.cpp: Error in second Initialize!!!!\n"); + exit(-101); + } - const int n_loops = 1; // make larger for profiling - for( Index i = 0; i < n_loops; i++ ) - { - retval = app->OptimizeTNLP(ampl_tnlp); - } + const int n_loops = 1; // make larger for profiling + for (Index i=0; iOptimizeTNLP(ampl_tnlp); + } - // finalize_solution method in AmplTNLP writes the solution file + // finalize_solution method in AmplTNLP writes the solution file - return 0; + return 0; } + diff --git a/src/Apps/AmplSolver/ipoptamplinterface.pc.in b/src/Apps/AmplSolver/ipoptamplinterface.pc.in index dd79527ce..60dbfac54 100644 --- a/src/Apps/AmplSolver/ipoptamplinterface.pc.in +++ b/src/Apps/AmplSolver/ipoptamplinterface.pc.in @@ -1,15 +1,12 @@ -@COIN_RELOCATABLE_FALSE@prefix=@prefix@ -@COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. +prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@/coin-or +includedir=@includedir@/coin -Name: IPOPT-AMPL +Name: IPOPT Description: Ampl Interface TNLP to Ipopt -URL: https://github.com/coin-or/Ipopt +URL: https://projects.coin-or.org/Ipopt Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lipoptamplinterface -Libs.private: @IPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ +Libs: -L${libdir} -lipoptamplinterface @IPOPTAMPLINTERFACELIB_PCLIBS@ Cflags: -I${includedir} -Requires: ipopt -Requires.private: @IPOPTAMPLINTERFACELIB_PCFILES@ +Requires: ipopt @IPOPTAMPLINTERFACELIB_PCREQUIRES@ From 547b1397b27c28039d468b52ba28ee1f9732a0a8 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Thu, 26 Mar 2020 23:24:28 -0400 Subject: [PATCH 12/28] Put make file stuff back --- src/Apps/AmplSolver/Makefile.am | 69 +- src/Apps/AmplSolver/Makefile.in | 878 ++++++++++--------- src/Apps/AmplSolver/ipoptamplinterface.pc.in | 15 +- 3 files changed, 481 insertions(+), 481 deletions(-) diff --git a/src/Apps/AmplSolver/Makefile.am b/src/Apps/AmplSolver/Makefile.am index ccece0446..ac6c9059f 100644 --- a/src/Apps/AmplSolver/Makefile.am +++ b/src/Apps/AmplSolver/Makefile.am @@ -2,79 +2,34 @@ # All Rights Reserved. # This file is distributed under the Eclipse Public License. -## $Id$ - # Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 -AUTOMAKE_OPTIONS = foreign - lib_LTLIBRARIES = libipoptamplinterface.la bin_PROGRAMS = ipopt libipoptamplinterface_la_SOURCES = \ - AmplTNLP.cpp AmplTNLP.hpp + AmplTNLP.cpp -if DEPENDENCY_LINKING libipoptamplinterface_la_LIBADD = ../../Interfaces/libipopt.la \ - $(IPOPTAMPLINTERFACELIB_LIBS) -endif - -libipoptamplinterface_la_LDFLAGS = $(LT_LDFLAGS) + $(IPOPTAMPLINTERFACELIB_LFLAGS) ipopt_SOURCES = \ ampl_ipopt.cpp -ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la \ - $(IPOPTAMPLINTERFACELIB_LIBS) $(IPOPTLIB_LIBS) - -ipopt_DEPENDENCIES = libipoptamplinterface.la ../../Interfaces/libipopt.la \ - $(IPOPTAMPLINTERFACELIB_DEPENDENCIES) $(IPOPTLIB_DEPENDENCIES) +ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la -AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../../Common` \ - -I`$(CYGPATH_W) $(srcdir)/../../LinAlg` \ - -I`$(CYGPATH_W) $(srcdir)/../../LinAlg/TMatrices` \ - -I`$(CYGPATH_W) $(srcdir)/../../Algorithm` \ - -I`$(CYGPATH_W) $(srcdir)/../../Interfaces` +AM_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS += $(ASL_CFLAGS) +AM_CPPFLAGS = \ + -I$(srcdir)/../../Common \ + -I$(srcdir)/../../LinAlg \ + -I$(srcdir)/../../LinAlg/TMatrices \ + -I$(srcdir)/../../Algorithm \ + -I$(srcdir)/../../Interfaces \ + $(IPOPTAMPLINTERFACELIB_CFLAGS) -includeipoptdir = $(includedir)/coin +includeipoptdir = $(includedir)/coin-or includeipopt_HEADERS = AmplTNLP.hpp pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = ../../../ipoptamplinterface.pc - -# This line is necessary to allow VPATH compilation -DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Common - -if COIN_CXX_IS_CL -install-exec-hook: - test -s ipopt.exe.manifest && \ - mt -manifest ipopt.exe.manifest -outputresource:ipopt.exe;\ - cp ipopt.exe $(bindir)/ipopt.exe -endif - -# Astyle stuff - -ASTYLE_FILES = \ - AmplTNLP.cppbak AmplTNLP.hppbak \ - ampl_ipopt.cppbak - -ASTYLE = @ASTYLE@ -ASTYLEFLAGS = @ASTYLEFLAGS@ - -DISTCLEANFILES = $(ASTYLE_FILES) - -SUFFIXES = .cppbak .hppbak - -astyle: $(ASTYLE_FILES) - -.hpp.hppbak: - mv $< $@ - $(ASTYLE) $(ASTYLEFLAGS) < $@ > $< - touch $@ - -.cpp.cppbak: - mv $< $@ - $(ASTYLE) $(ASTYLEFLAGS) < $@ > $< - touch $@ diff --git a/src/Apps/AmplSolver/Makefile.in b/src/Apps/AmplSolver/Makefile.in index 8f48f979a..487d7f7b9 100644 --- a/src/Apps/AmplSolver/Makefile.in +++ b/src/Apps/AmplSolver/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -23,15 +23,67 @@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -47,157 +99,156 @@ build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = ipopt$(EXEEXT) subdir = src/Apps/AmplSolver -DIST_COMMON = $(includeipopt_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(includeipopt_HEADERS) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Common/config.h \ - $(top_builddir)/src/Common/config_ipopt.h \ - $(top_builddir)/examples/ScalableProblems/config.h + $(top_builddir)/src/Common/config_ipopt.h CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \ + "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)" +PROGRAMS = $(bin_PROGRAMS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ - "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)" -libLTLIBRARIES_INSTALL = $(INSTALL) +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = -@DEPENDENCY_LINKING_TRUE@libipoptamplinterface_la_DEPENDENCIES = \ -@DEPENDENCY_LINKING_TRUE@ ../../Interfaces/libipopt.la \ -@DEPENDENCY_LINKING_TRUE@ $(am__DEPENDENCIES_1) +libipoptamplinterface_la_DEPENDENCIES = ../../Interfaces/libipopt.la \ + $(am__DEPENDENCIES_1) am_libipoptamplinterface_la_OBJECTS = AmplTNLP.lo libipoptamplinterface_la_OBJECTS = \ $(am_libipoptamplinterface_la_OBJECTS) -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = am_ipopt_OBJECTS = ampl_ipopt.$(OBJEXT) ipopt_OBJECTS = $(am_ipopt_OBJECTS) +ipopt_DEPENDENCIES = libipoptamplinterface.la \ + ../../Interfaces/libipopt.la +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/Common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/AmplTNLP.Plo \ + ./$(DEPDIR)/ampl_ipopt.Po +am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = SOURCES = $(libipoptamplinterface_la_SOURCES) $(ipopt_SOURCES) -DIST_SOURCES = $(libipoptamplinterface_la_SOURCES) $(ipopt_SOURCES) -pkgconfiglibDATA_INSTALL = $(INSTALL_DATA) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac DATA = $(pkgconfiglib_DATA) -includeipoptHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(includeipopt_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABSBUILDDIR = @ABSBUILDDIR@ ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ ADD_FFLAGS = @ADD_FFLAGS@ -AIX_FIX_COMPILER_BUG_FALSE = @AIX_FIX_COMPILER_BUG_FALSE@ -AIX_FIX_COMPILER_BUG_TRUE = @AIX_FIX_COMPILER_BUG_TRUE@ -ALWAYS_FALSE_FALSE = @ALWAYS_FALSE_FALSE@ -ALWAYS_FALSE_TRUE = @ALWAYS_FALSE_TRUE@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ -ASL_CFLAGS = @ASL_CFLAGS@ -ASL_CFLAGS_INSTALLED = @ASL_CFLAGS_INSTALLED@ -ASL_DATA = @ASL_DATA@ -ASL_DATA_INSTALLED = @ASL_DATA_INSTALLED@ -ASL_DEPENDENCIES = @ASL_DEPENDENCIES@ -ASL_LIBS = @ASL_LIBS@ -ASL_LIBS_INSTALLED = @ASL_LIBS_INSTALLED@ -ASTYLE = @ASTYLE@ -ASTYLEFLAGS = @ASTYLEFLAGS@ +AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ -AUX_DIR = @AUX_DIR@ AWK = @AWK@ BIT32FCOMMENT = @BIT32FCOMMENT@ BIT64FCOMMENT = @BIT64FCOMMENT@ BITS_PER_POINTER = @BITS_PER_POINTER@ -BLAS_CFLAGS = @BLAS_CFLAGS@ -BLAS_CFLAGS_INSTALLED = @BLAS_CFLAGS_INSTALLED@ -BLAS_DATA = @BLAS_DATA@ -BLAS_DATA_INSTALLED = @BLAS_DATA_INSTALLED@ -BLAS_DEPENDENCIES = @BLAS_DEPENDENCIES@ -BLAS_LIBS = @BLAS_LIBS@ -BLAS_LIBS_INSTALLED = @BLAS_LIBS_INSTALLED@ -BLUEGENEEXTRA = @BLUEGENEEXTRA@ -BUILDTOOLSDIR = @BUILDTOOLSDIR@ -BUILD_INEXACT_FALSE = @BUILD_INEXACT_FALSE@ -BUILD_INEXACT_TRUE = @BUILD_INEXACT_TRUE@ -BUILD_LINEARSOLVERLOADER_FALSE = @BUILD_LINEARSOLVERLOADER_FALSE@ -BUILD_LINEARSOLVERLOADER_TRUE = @BUILD_LINEARSOLVERLOADER_TRUE@ -BUILD_PARDISOLOADER_FALSE = @BUILD_PARDISOLOADER_FALSE@ -BUILD_PARDISOLOADER_TRUE = @BUILD_PARDISOLOADER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ -CDEFS = @CDEFS@ CFLAGS = @CFLAGS@ -COIN_CC_IS_CL_FALSE = @COIN_CC_IS_CL_FALSE@ -COIN_CC_IS_CL_TRUE = @COIN_CC_IS_CL_TRUE@ -COIN_CXX_IS_CL_FALSE = @COIN_CXX_IS_CL_FALSE@ -COIN_CXX_IS_CL_TRUE = @COIN_CXX_IS_CL_TRUE@ -COIN_HAS_ASL_FALSE = @COIN_HAS_ASL_FALSE@ -COIN_HAS_ASL_TRUE = @COIN_HAS_ASL_TRUE@ -COIN_HAS_BLAS_FALSE = @COIN_HAS_BLAS_FALSE@ -COIN_HAS_BLAS_TRUE = @COIN_HAS_BLAS_TRUE@ -COIN_HAS_DOXYGEN_FALSE = @COIN_HAS_DOXYGEN_FALSE@ -COIN_HAS_DOXYGEN_TRUE = @COIN_HAS_DOXYGEN_TRUE@ -COIN_HAS_F77_FALSE = @COIN_HAS_F77_FALSE@ -COIN_HAS_F77_TRUE = @COIN_HAS_F77_TRUE@ -COIN_HAS_HSL_FALSE = @COIN_HAS_HSL_FALSE@ -COIN_HAS_HSL_TRUE = @COIN_HAS_HSL_TRUE@ -COIN_HAS_LAPACK_FALSE = @COIN_HAS_LAPACK_FALSE@ -COIN_HAS_LAPACK_TRUE = @COIN_HAS_LAPACK_TRUE@ -COIN_HAS_LATEX_FALSE = @COIN_HAS_LATEX_FALSE@ -COIN_HAS_LATEX_TRUE = @COIN_HAS_LATEX_TRUE@ -COIN_HAS_MUMPS_FALSE = @COIN_HAS_MUMPS_FALSE@ -COIN_HAS_MUMPS_TRUE = @COIN_HAS_MUMPS_TRUE@ -COIN_HAS_PKGCONFIG_FALSE = @COIN_HAS_PKGCONFIG_FALSE@ -COIN_HAS_PKGCONFIG_TRUE = @COIN_HAS_PKGCONFIG_TRUE@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -COIN_PKG_CONFIG_PATH_UNINSTALLED = @COIN_PKG_CONFIG_PATH_UNINSTALLED@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ -CXXAR = @CXXAR@ CXXCPP = @CXXCPP@ -CXXDEFS = @CXXDEFS@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXLIBS = @CXXLIBS@ CYGPATH_W = @CYGPATH_W@ -DBG_CFLAGS = @DBG_CFLAGS@ -DBG_CXXFLAGS = @DBG_CXXFLAGS@ -DBG_FFLAGS = @DBG_FFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DEPENDENCY_LINKING_FALSE = @DEPENDENCY_LINKING_FALSE@ -DEPENDENCY_LINKING_TRUE = @DEPENDENCY_LINKING_TRUE@ -ECHO = @ECHO@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -205,120 +256,86 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FLIBS = @FLIBS@ -FRAMEWORK_VECLIB = @FRAMEWORK_VECLIB@ -HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@ -HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@ -HAVE_MA28_FALSE = @HAVE_MA28_FALSE@ -HAVE_MA28_TRUE = @HAVE_MA28_TRUE@ -HAVE_PARDISO_FALSE = @HAVE_PARDISO_FALSE@ -HAVE_PARDISO_TRUE = @HAVE_PARDISO_TRUE@ -HAVE_WSMP_FALSE = @HAVE_WSMP_FALSE@ -HAVE_WSMP_TRUE = @HAVE_WSMP_TRUE@ -HSL_CFLAGS = @HSL_CFLAGS@ -HSL_CFLAGS_INSTALLED = @HSL_CFLAGS_INSTALLED@ -HSL_DATA = @HSL_DATA@ -HSL_DATA_INSTALLED = @HSL_DATA_INSTALLED@ -HSL_DEPENDENCIES = @HSL_DEPENDENCIES@ -HSL_LIBS = @HSL_LIBS@ -HSL_LIBS_INSTALLED = @HSL_LIBS_INSTALLED@ +GREP = @GREP@ +HSLLIB_CFLAGS = @HSLLIB_CFLAGS@ +HSLLIB_CFLAGS_NOPC = @HSLLIB_CFLAGS_NOPC@ +HSLLIB_LFLAGS = @HSLLIB_LFLAGS@ +HSLLIB_LFLAGS_NOPC = @HSLLIB_LFLAGS_NOPC@ +HSLLIB_PCFILES = @HSLLIB_PCFILES@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IPALLLIBS = @IPALLLIBS@ IPOPTAMPLINTERFACELIB_CFLAGS = @IPOPTAMPLINTERFACELIB_CFLAGS@ -IPOPTAMPLINTERFACELIB_CFLAGS_INSTALLED = @IPOPTAMPLINTERFACELIB_CFLAGS_INSTALLED@ -IPOPTAMPLINTERFACELIB_DEPENDENCIES = @IPOPTAMPLINTERFACELIB_DEPENDENCIES@ -IPOPTAMPLINTERFACELIB_LIBS = @IPOPTAMPLINTERFACELIB_LIBS@ -IPOPTAMPLINTERFACELIB_LIBS_INSTALLED = @IPOPTAMPLINTERFACELIB_LIBS_INSTALLED@ -IPOPTAMPLINTERFACELIB_PCLIBS = @IPOPTAMPLINTERFACELIB_PCLIBS@ -IPOPTAMPLINTERFACELIB_PCREQUIRES = @IPOPTAMPLINTERFACELIB_PCREQUIRES@ +IPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @IPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ +IPOPTAMPLINTERFACELIB_LFLAGS = @IPOPTAMPLINTERFACELIB_LFLAGS@ +IPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @IPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ +IPOPTAMPLINTERFACELIB_PCFILES = @IPOPTAMPLINTERFACELIB_PCFILES@ IPOPTLIB_CFLAGS = @IPOPTLIB_CFLAGS@ -IPOPTLIB_CFLAGS_INSTALLED = @IPOPTLIB_CFLAGS_INSTALLED@ -IPOPTLIB_DEPENDENCIES = @IPOPTLIB_DEPENDENCIES@ -IPOPTLIB_LIBS = @IPOPTLIB_LIBS@ -IPOPTLIB_LIBS_INSTALLED = @IPOPTLIB_LIBS_INSTALLED@ -IPOPTLIB_PCLIBS = @IPOPTLIB_PCLIBS@ -IPOPTLIB_PCREQUIRES = @IPOPTLIB_PCREQUIRES@ -IPOPT_SVN_REV = @IPOPT_SVN_REV@ -JAVA_HOME = @JAVA_HOME@ -JIPOPTDLL = @JIPOPTDLL@ -LAPACK_CFLAGS = @LAPACK_CFLAGS@ -LAPACK_CFLAGS_INSTALLED = @LAPACK_CFLAGS_INSTALLED@ -LAPACK_DATA = @LAPACK_DATA@ -LAPACK_DATA_INSTALLED = @LAPACK_DATA_INSTALLED@ -LAPACK_DEPENDENCIES = @LAPACK_DEPENDENCIES@ -LAPACK_LIBS = @LAPACK_LIBS@ -LAPACK_LIBS_INSTALLED = @LAPACK_LIBS_INSTALLED@ +IPOPTLIB_CFLAGS_NOPC = @IPOPTLIB_CFLAGS_NOPC@ +IPOPTLIB_LFLAGS = @IPOPTLIB_LFLAGS@ +IPOPTLIB_LFLAGS_NOPC = @IPOPTLIB_LFLAGS_NOPC@ +IPOPTLIB_PCFILES = @IPOPTLIB_PCFILES@ +JAR = @JAR@ +JAVA = @JAVA@ +JAVAC = @JAVAC@ +JAVADOC = @JAVADOC@ +LD = @LD@ LDFLAGS = @LDFLAGS@ -LIBEXT = @LIBEXT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIBTOOLM4 = @LIBTOOLM4@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_LDFLAGS = @LT_LDFLAGS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ -MATLAB_CYGPATH_W = @MATLAB_CYGPATH_W@ -MATLAB_HOME = @MATLAB_HOME@ -MEXSUFFIX = @MEXSUFFIX@ -MEX_STATIC_FALSE = @MEX_STATIC_FALSE@ -MEX_STATIC_TRUE = @MEX_STATIC_TRUE@ -MEX_WINDOWS_FALSE = @MEX_WINDOWS_FALSE@ -MEX_WINDOWS_TRUE = @MEX_WINDOWS_TRUE@ -MPICC = @MPICC@ -MPICXX = @MPICXX@ -MPIF77 = @MPIF77@ -MUMPS_CFLAGS = @MUMPS_CFLAGS@ -MUMPS_CFLAGS_INSTALLED = @MUMPS_CFLAGS_INSTALLED@ -MUMPS_DATA = @MUMPS_DATA@ -MUMPS_DATA_INSTALLED = @MUMPS_DATA_INSTALLED@ -MUMPS_DEPENDENCIES = @MUMPS_DEPENDENCIES@ -MUMPS_LIBS = @MUMPS_LIBS@ -MUMPS_LIBS_INSTALLED = @MUMPS_LIBS_INSTALLED@ -MWMA57PATH = @MWMA57PATH@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPT_CFLAGS = @OPT_CFLAGS@ -OPT_CXXFLAGS = @OPT_CXXFLAGS@ -OPT_FFLAGS = @OPT_FFLAGS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RPATH_FLAGS = @RPATH_FLAGS@ +SED = @SED@ SET_MAKE = @SET_MAKE@ -SHARED_FLAGS = @SHARED_FLAGS@ SHELL = @SHELL@ +SIPOPTAMPLINTERFACELIB_CFLAGS = @SIPOPTAMPLINTERFACELIB_CFLAGS@ +SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ +SIPOPTAMPLINTERFACELIB_LFLAGS = @SIPOPTAMPLINTERFACELIB_LFLAGS@ +SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ +SIPOPTAMPLINTERFACELIB_PCFILES = @SIPOPTAMPLINTERFACELIB_PCFILES@ STRIP = @STRIP@ VERSION = @VERSION@ -VPATH_DISTCLEANFILES = @VPATH_DISTCLEANFILES@ -abs_bin_dir = @abs_bin_dir@ -abs_include_dir = @abs_include_dir@ -abs_lib_dir = @abs_lib_dir@ -abs_source_dir = @abs_source_dir@ -ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@ +_ACJNI_JAVAC = @_ACJNI_JAVAC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -330,7 +347,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -coin_doxy_excludes = @coin_doxy_excludes@ +builddir = @builddir@ coin_doxy_logname = @coin_doxy_logname@ coin_doxy_tagfiles = @coin_doxy_tagfiles@ coin_doxy_tagname = @coin_doxy_tagname@ @@ -338,94 +355,85 @@ coin_doxy_usedot = @coin_doxy_usedot@ coin_have_doxygen = @coin_have_doxygen@ coin_have_latex = @coin_have_latex@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ -have_autoconf = @have_autoconf@ -have_automake = @have_automake@ -have_svn = @have_svn@ -have_svnversion = @have_svnversion@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -sol_cc_compiler = @sol_cc_compiler@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -AUTOMAKE_OPTIONS = foreign +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ lib_LTLIBRARIES = libipoptamplinterface.la libipoptamplinterface_la_SOURCES = \ - AmplTNLP.cpp AmplTNLP.hpp + AmplTNLP.cpp -@DEPENDENCY_LINKING_TRUE@libipoptamplinterface_la_LIBADD = ../../Interfaces/libipopt.la \ -@DEPENDENCY_LINKING_TRUE@ $(IPOPTAMPLINTERFACELIB_LIBS) +libipoptamplinterface_la_LIBADD = ../../Interfaces/libipopt.la \ + $(IPOPTAMPLINTERFACELIB_LFLAGS) -libipoptamplinterface_la_LDFLAGS = $(LT_LDFLAGS) ipopt_SOURCES = \ ampl_ipopt.cpp -ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la \ - $(IPOPTAMPLINTERFACELIB_LIBS) $(IPOPTLIB_LIBS) - -ipopt_DEPENDENCIES = libipoptamplinterface.la ../../Interfaces/libipopt.la \ - $(IPOPTAMPLINTERFACELIB_DEPENDENCIES) $(IPOPTLIB_DEPENDENCIES) - -AM_CPPFLAGS = -I`$(CYGPATH_W) $(srcdir)/../../Common` -I`$(CYGPATH_W) \ - $(srcdir)/../../LinAlg` -I`$(CYGPATH_W) \ - $(srcdir)/../../LinAlg/TMatrices` -I`$(CYGPATH_W) \ - $(srcdir)/../../Algorithm` -I`$(CYGPATH_W) \ - $(srcdir)/../../Interfaces` $(ASL_CFLAGS) -includeipoptdir = $(includedir)/coin +ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la +AM_LDFLAGS = $(LT_LDFLAGS) +AM_CPPFLAGS = \ + -I$(srcdir)/../../Common \ + -I$(srcdir)/../../LinAlg \ + -I$(srcdir)/../../LinAlg/TMatrices \ + -I$(srcdir)/../../Algorithm \ + -I$(srcdir)/../../Interfaces \ + $(IPOPTAMPLINTERFACELIB_CFLAGS) + +includeipoptdir = $(includedir)/coin-or includeipopt_HEADERS = AmplTNLP.hpp pkgconfiglibdir = $(libdir)/pkgconfig pkgconfiglib_DATA = ../../../ipoptamplinterface.pc - -# This line is necessary to allow VPATH compilation -DEFAULT_INCLUDES = -I. -I`$(CYGPATH_W) $(srcdir)` -I$(top_builddir)/src/Common - -# Astyle stuff -ASTYLE_FILES = \ - AmplTNLP.cppbak AmplTNLP.hppbak \ - ampl_ipopt.cppbak - -DISTCLEANFILES = $(ASTYLE_FILES) -SUFFIXES = .cppbak .hppbak all: all-am .SUFFIXES: -.SUFFIXES: .cppbak .hppbak .cpp .hpp .lo .o .obj +.SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Apps/AmplSolver/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Apps/AmplSolver/Makefile -.PRECIOUS: Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Apps/AmplSolver/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Apps/AmplSolver/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -435,66 +443,98 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + list2="$$list2 $$p"; \ else :; fi; \ - done + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libipoptamplinterface.la: $(libipoptamplinterface_la_OBJECTS) $(libipoptamplinterface_la_DEPENDENCIES) - $(CXXLINK) -rpath $(libdir) $(libipoptamplinterface_la_LDFLAGS) $(libipoptamplinterface_la_OBJECTS) $(libipoptamplinterface_la_LIBADD) $(LIBS) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -ipopt$(EXEEXT): $(ipopt_OBJECTS) $(ipopt_DEPENDENCIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libipoptamplinterface.la: $(libipoptamplinterface_la_OBJECTS) $(libipoptamplinterface_la_DEPENDENCIES) $(EXTRA_libipoptamplinterface_la_DEPENDENCIES) + $(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libipoptamplinterface_la_OBJECTS) $(libipoptamplinterface_la_LIBADD) $(LIBS) + +ipopt$(EXEEXT): $(ipopt_OBJECTS) $(ipopt_DEPENDENCIES) $(EXTRA_ipopt_DEPENDENCIES) @rm -f ipopt$(EXEEXT) - $(CXXLINK) $(ipopt_LDFLAGS) $(ipopt_OBJECTS) $(ipopt_LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(ipopt_OBJECTS) $(ipopt_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -502,157 +542,146 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AmplTNLP.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ampl_ipopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AmplTNLP.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ampl_ipopt.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .cpp.o: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: -@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: install-pkgconfiglibDATA: $(pkgconfiglib_DATA) @$(NORMAL_INSTALL) - test -z "$(pkgconfiglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfiglibdir)" - @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ + @list='$(pkgconfiglib_DATA)'; test -n "$(pkgconfiglibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfiglibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfiglibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(pkgconfiglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ - $(pkgconfiglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfiglibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfiglibdir)" || exit $$?; \ done uninstall-pkgconfiglibDATA: @$(NORMAL_UNINSTALL) - @list='$(pkgconfiglib_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(pkgconfiglibdir)/$$f'"; \ - rm -f "$(DESTDIR)$(pkgconfiglibdir)/$$f"; \ - done + @list='$(pkgconfiglib_DATA)'; test -n "$(pkgconfiglibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfiglibdir)'; $(am__uninstall_files_from_dir) install-includeipoptHEADERS: $(includeipopt_HEADERS) @$(NORMAL_INSTALL) - test -z "$(includeipoptdir)" || $(mkdir_p) "$(DESTDIR)$(includeipoptdir)" - @list='$(includeipopt_HEADERS)'; for p in $$list; do \ + @list='$(includeipopt_HEADERS)'; test -n "$(includeipoptdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includeipoptdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includeipoptdir)" || exit 1; \ + fi; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(includeipoptHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includeipoptdir)/$$f'"; \ - $(includeipoptHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includeipoptdir)/$$f"; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includeipoptdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includeipoptdir)" || exit $$?; \ done uninstall-includeipoptHEADERS: @$(NORMAL_UNINSTALL) - @list='$(includeipopt_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(includeipoptdir)/$$f'"; \ - rm -f "$(DESTDIR)$(includeipoptdir)/$$f"; \ - done + @list='$(includeipopt_HEADERS)'; test -n "$(includeipoptdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includeipoptdir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done check-am: all-am check: check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) +all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(DATA) $(HEADERS) install-binPROGRAMS: install-libLTLIBRARIES installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -664,32 +693,37 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -@COIN_CXX_IS_CL_FALSE@install-exec-hook: clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/AmplTNLP.Plo + -rm -f ./$(DEPDIR)/ampl_ipopt.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am @@ -697,24 +731,43 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: install-data-am: install-includeipoptHEADERS install-pkgconfiglibDATA +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: install-binPROGRAMS install-libLTLIBRARIES - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + +install-html: install-html-am + +install-html-am: install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/AmplTNLP.Plo + -rm -f ./$(DEPDIR)/ampl_ipopt.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -732,42 +785,31 @@ ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-includeipoptHEADERS \ - uninstall-info-am uninstall-libLTLIBRARIES \ - uninstall-pkgconfiglibDATA - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libLTLIBRARIES clean-libtool ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-exec-hook install-includeipoptHEADERS install-info \ - install-info-am install-libLTLIBRARIES install-man \ - install-pkgconfiglibDATA install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-includeipoptHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-pkgconfiglibDATA +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-includeipoptHEADERS \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-pdf install-pdf-am \ + install-pkgconfiglibDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-includeipoptHEADERS \ + uninstall-libLTLIBRARIES uninstall-pkgconfiglibDATA -@COIN_CXX_IS_CL_TRUE@install-exec-hook: -@COIN_CXX_IS_CL_TRUE@ test -s ipopt.exe.manifest && \ -@COIN_CXX_IS_CL_TRUE@ mt -manifest ipopt.exe.manifest -outputresource:ipopt.exe;\ -@COIN_CXX_IS_CL_TRUE@ cp ipopt.exe $(bindir)/ipopt.exe - -astyle: $(ASTYLE_FILES) +.PRECIOUS: Makefile -.hpp.hppbak: - mv $< $@ - $(ASTYLE) $(ASTYLEFLAGS) < $@ > $< - touch $@ -.cpp.cppbak: - mv $< $@ - $(ASTYLE) $(ASTYLEFLAGS) < $@ > $< - touch $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/src/Apps/AmplSolver/ipoptamplinterface.pc.in b/src/Apps/AmplSolver/ipoptamplinterface.pc.in index 60dbfac54..dd79527ce 100644 --- a/src/Apps/AmplSolver/ipoptamplinterface.pc.in +++ b/src/Apps/AmplSolver/ipoptamplinterface.pc.in @@ -1,12 +1,15 @@ -prefix=@prefix@ +@COIN_RELOCATABLE_FALSE@prefix=@prefix@ +@COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@/coin +includedir=@includedir@/coin-or -Name: IPOPT +Name: IPOPT-AMPL Description: Ampl Interface TNLP to Ipopt -URL: https://projects.coin-or.org/Ipopt +URL: https://github.com/coin-or/Ipopt Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lipoptamplinterface @IPOPTAMPLINTERFACELIB_PCLIBS@ +Libs: -L${libdir} -lipoptamplinterface +Libs.private: @IPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ Cflags: -I${includedir} -Requires: ipopt @IPOPTAMPLINTERFACELIB_PCREQUIRES@ +Requires: ipopt +Requires.private: @IPOPTAMPLINTERFACELIB_PCFILES@ From 40d964cd1ac40d692daeb304e6b33795e43d32ed Mon Sep 17 00:00:00 2001 From: John Eslick Date: Fri, 27 Mar 2020 07:56:18 -0400 Subject: [PATCH 13/28] Modified include to just include cstring --- src/Apps/AmplSolver/AmplTNLP.cpp | 11 ----------- src/Apps/AmplSolver/ampl_ipopt.cpp | 12 ++---------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/Apps/AmplSolver/AmplTNLP.cpp b/src/Apps/AmplSolver/AmplTNLP.cpp index f6b53f328..d5374b63a 100644 --- a/src/Apps/AmplSolver/AmplTNLP.cpp +++ b/src/Apps/AmplSolver/AmplTNLP.cpp @@ -14,15 +14,7 @@ #include "IpSymTMatrix.hpp" #include "IpBlas.hpp" -#ifdef HAVE_CSTRING # include -#else -# ifdef HAVE_STRING_H -# include -# else -# error "don't have header file for string" -# endif -#endif /* AMPL includes */ #include "asl.h" @@ -1617,6 +1609,3 @@ namespace Ipopt } } // namespace Ipopt - - - diff --git a/src/Apps/AmplSolver/ampl_ipopt.cpp b/src/Apps/AmplSolver/ampl_ipopt.cpp index 82892f2be..8e340da69 100644 --- a/src/Apps/AmplSolver/ampl_ipopt.cpp +++ b/src/Apps/AmplSolver/ampl_ipopt.cpp @@ -10,15 +10,9 @@ #include "IpIpoptApplication.hpp" #include "IpoptConfig.h" -#ifdef HAVE_CSTRING + # include -#else -# ifdef HAVE_STRING_H -# include -# else -# error "don't have header file for string" -# endif -#endif + // for printf #ifdef HAVE_CSTDIO @@ -100,5 +94,3 @@ int main(int argc, char**args) return 0; } - - From fcce8cfcb7f5fc14cb31302b2752b3594cda0b21 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Fri, 27 Mar 2020 08:03:35 -0400 Subject: [PATCH 14/28] Just import cstdio and remove check --- src/Apps/AmplSolver/ampl_ipopt.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Apps/AmplSolver/ampl_ipopt.cpp b/src/Apps/AmplSolver/ampl_ipopt.cpp index 8e340da69..ced11db90 100644 --- a/src/Apps/AmplSolver/ampl_ipopt.cpp +++ b/src/Apps/AmplSolver/ampl_ipopt.cpp @@ -12,18 +12,7 @@ #include "IpoptConfig.h" # include - - -// for printf -#ifdef HAVE_CSTDIO # include -#else -# ifdef HAVE_STDIO_H -# include -# else -# error "don't have header file for stdio" -# endif -#endif int main(int argc, char**args) { From eed5a92414665ad6f0ed5d72b3f7d69687ad205b Mon Sep 17 00:00:00 2001 From: John Eslick Date: Fri, 27 Mar 2020 10:58:09 -0400 Subject: [PATCH 15/28] Update Dependencies The ASL version was not the problem, so we don't need to use our own fork here. --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 80ed98c85..216188b8c 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/2.0 +ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From 9c1a8deb0305a6a892fafb3e48cab54b8f98f4a9 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Sat, 28 Mar 2020 21:02:08 -0400 Subject: [PATCH 16/28] Update Dependencies Use our ASL build tools fork to get a different version. --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index e40290c8c..2f139a224 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 +ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/2.0 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From 9bb26d317e86f724704760b96d7bf74c9c37afa2 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Sat, 28 Mar 2020 21:18:07 -0400 Subject: [PATCH 17/28] Update Dependencies fix encoding error maybe --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 216188b8c..80ed98c85 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 +ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/2.0 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From aa97b0f6ae6ae50d316cecc82db0838b9bf714c4 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Sat, 28 Mar 2020 22:55:26 -0400 Subject: [PATCH 18/28] Update Dependencies --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 2f139a224..78f08630b 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/2.0 +ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/1.4 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From 4ef88144b088d8afdbe3525236784a2eb97dad95 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Sat, 28 Mar 2020 23:10:55 -0400 Subject: [PATCH 19/28] Update Dependencies --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 80ed98c85..739a68fdb 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/2.0 +ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/1.4 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From c9c67016629402cec004336060942519510a8321 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Sun, 29 Mar 2020 19:18:16 -0400 Subject: [PATCH 20/28] Update Dependencies --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 78f08630b..f5a03ab1a 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/1.4 +ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/1.4 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From 4ae77d285540e75ae402d4aac87b8c5a4a5e888b Mon Sep 17 00:00:00 2001 From: John Eslick Date: Sun, 29 Mar 2020 19:27:32 -0400 Subject: [PATCH 21/28] Switch AMPL App back to 3.13 to test with ASL build tools 1.4 --- src/Apps/AmplSolver/AmplTNLP.cpp | 2895 +++++++++++++++------------- src/Apps/AmplSolver/AmplTNLP.hpp | 1060 +++++----- src/Apps/AmplSolver/ampl_ipopt.cpp | 144 +- 3 files changed, 2231 insertions(+), 1868 deletions(-) diff --git a/src/Apps/AmplSolver/AmplTNLP.cpp b/src/Apps/AmplSolver/AmplTNLP.cpp index d5374b63a..7b72d8cc7 100644 --- a/src/Apps/AmplSolver/AmplTNLP.cpp +++ b/src/Apps/AmplSolver/AmplTNLP.cpp @@ -2,8 +2,6 @@ // All Rights Reserved. // This code is published under the Eclipse Public License. // -// $Id$ -// // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 #include "IpoptConfig.h" @@ -14,7 +12,7 @@ #include "IpSymTMatrix.hpp" #include "IpBlas.hpp" -# include +#include /* AMPL includes */ #include "asl.h" @@ -23,317 +21,362 @@ namespace Ipopt { -#if COIN_IPOPT_VERBOSITY > 0 - static const Index dbg_verbosity = 0; +#if IPOPT_VERBOSITY > 0 +static const Index dbg_verbosity = 0; #endif - AmplTNLP::AmplTNLP(const SmartPtr& jnlst, - const SmartPtr options, - char**& argv, - SmartPtr suffix_handler /* = NULL */, - bool allow_discrete /* = false */, - SmartPtr ampl_options_list /* = NULL */, - const char* ampl_option_string /* = NULL */, - const char* ampl_invokation_string /* = NULL */, - const char* ampl_banner_string /* = NULL */, - std::string* nl_file_content /* = NULL */) - : - TNLP(), - jnlst_(jnlst), - asl_(NULL), - obj_sign_(1), - nz_h_full_(-1), - x_sol_(NULL), - z_L_sol_(NULL), - z_U_sol_(NULL), - g_sol_(NULL), - lambda_sol_(NULL), - obj_sol_(0.0), - objval_called_with_current_x_(false), - conval_called_with_current_x_(false), - hesset_called_(false), - set_active_objective_called_(false), - Oinfo_ptr_(NULL), - suffix_handler_(suffix_handler) - { - DBG_START_METH("AmplTNLP::AmplTNLP", - dbg_verbosity); - - // The ASL include files #define certain - // variables that they expect you to work with. - // These variables then appear as though they are - // global variables when, in fact, they are not - // Most of them are data members of an asl object - - // Create the ASL structure - ASL_pfgh* asl = (ASL_pfgh*)ASL_alloc(ASL_read_pfgh); - DBG_ASSERT(asl); - asl_ = asl; // keep the pointer for ourselves to use later... - - // First assume that we don't want to halt on error (default) - fint* fint_nerror = new fint; - *fint_nerror = 0; - nerror_ = (void*) fint_nerror; - - // Read the options and stub - char* stub = get_options(options, ampl_options_list, - ampl_option_string, ampl_invokation_string, - ampl_banner_string, argv); - FILE*nl = NULL; - if (nl_file_content) { - nl = jac0dim(const_cast(nl_file_content->c_str()), - -(ftnlen)nl_file_content->length()); - } - else { - if (!stub) { - jnlst_->Printf(J_ERROR, J_MAIN, "No .nl file given!\n"); - THROW_EXCEPTION(INVALID_TNLP, "No .nl file given!\n"); - } - nl = jac0dim(stub, (fint)strlen(stub)); +AmplTNLP::AmplTNLP( + const SmartPtr& jnlst, + const SmartPtr options, + char**& argv, + SmartPtr suffix_handler /* = NULL */, + bool allow_discrete /* = false */, + SmartPtr ampl_options_list /* = NULL */, + const char* ampl_option_string /* = NULL */, + const char* ampl_invokation_string /* = NULL */, + const char* ampl_banner_string /* = NULL */, + std::string* nl_file_content /* = NULL */ +) + : TNLP(), + jnlst_(jnlst), + asl_(NULL), + obj_sign_(1), + nz_h_full_(-1), + x_sol_(NULL), + z_L_sol_(NULL), + z_U_sol_(NULL), + g_sol_(NULL), + lambda_sol_(NULL), + obj_sol_(0.0), + objval_called_with_current_x_(false), + conval_called_with_current_x_(false), + hesset_called_(false), + set_active_objective_called_(false), + Oinfo_ptr_(NULL), + suffix_handler_(suffix_handler) +{ + DBG_START_METH("AmplTNLP::AmplTNLP", dbg_verbosity); + + // The ASL include files #define certain + // variables that they expect you to work with. + // These variables then appear as though they are + // global variables when, in fact, they are not + // Most of them are data members of an asl object + + // Create the ASL structure + ASL_pfgh* asl = (ASL_pfgh*) ASL_alloc(ASL_read_pfgh); + DBG_ASSERT(asl); + asl_ = asl; // keep the pointer for ourselves to use later... + + // First assume that we don't want to halt on error (default) + fint* fint_nerror = new fint; + *fint_nerror = 0; + nerror_ = (void*) fint_nerror; + + // Read the options and stub + char* stub = get_options(options, ampl_options_list, ampl_option_string, ampl_invokation_string, ampl_banner_string, + argv); + FILE* nl = NULL; + if( nl_file_content ) + { + nl = jac0dim(const_cast(nl_file_content->c_str()), -(ftnlen )nl_file_content->length()); + } + else + { + if( !stub ) + { + jnlst_->Printf(J_ERROR, J_MAIN, "No .nl file given!\n"); + THROW_EXCEPTION(INVALID_TNLP, "No .nl file given!\n"); + } + nl = jac0dim(stub, (fint )strlen(stub)); DBG_ASSERT(nl); - } - jnlst_->Printf(J_SUMMARY, J_MAIN, "\n"); - - // check the problem statistics (see Table 1 in AMPL doc) - DBG_ASSERT(n_var > 0); // need some continuous variables - if (!allow_discrete && (nbv>0 || niv>0 || nlvbi>0 || nlvci>0 || nlvoi>0) ) { - jnlst_->Printf(J_WARNING, J_MAIN, "==> Warning: Treating %d binary and %d integer variables as continous.\n\n", nbv, niv+nlvbi+nlvci+nlvoi); + } + jnlst_->Printf(J_SUMMARY, J_MAIN, "\n"); + + // check the problem statistics (see Table 1 in AMPL doc) + DBG_ASSERT(n_var > 0); // need some continuous variables + if( !allow_discrete && (nbv > 0 || niv > 0 || nlvbi > 0 || nlvci > 0 || nlvoi > 0) ) + { + jnlst_->Printf(J_WARNING, J_MAIN, "==> Warning: Treating %d binary and %d integer variables as continous.\n\n", + nbv, niv + nlvbi + nlvci + nlvoi); allow_discrete = true; - } - allow_discrete = true; - ASSERT_EXCEPTION(allow_discrete || (nbv == 0 && niv == 0 && nlvbi == 0 && nlvci == 0 && nlvoi == 0), - IpoptException, - "Discrete variables not allowed when the allow_discrete flag is false, " - "Either remove the integer variables, or change the flag in the constructor of AmplTNLP" - ); - - if (n_cc != 0) { - jnlst_->Printf(J_ERROR, J_MAIN, "\n\n***** Currently, the AMPL interface to Ipopt does not support\n complementarity constraints. Aborting. *****\n\n"); + } + allow_discrete = true; + ASSERT_EXCEPTION(allow_discrete || (nbv == 0 && niv == 0 && nlvbi == 0 && nlvci == 0 && nlvoi == 0), IpoptException, + "Discrete variables not allowed when the allow_discrete flag is false, " + "Either remove the integer variables, or change the flag in the constructor of AmplTNLP"); + + if( n_cc != 0 ) + { + jnlst_->Printf(J_ERROR, J_MAIN, + "\n\n***** Currently, the AMPL interface to Ipopt does not support\n complementarity constraints. Aborting. *****\n\n"); ASSERT_EXCEPTION(n_cc == 0, IpoptException, - "Currently, the AMPL interface to Ipopt does not support complementarity constraints."); - } - - DBG_ASSERT(nlo == 0 || nlo == 1); // Can handle nonlinear obj. - DBG_ASSERT(nwv == 0); // Don't know what "linear arc" variables are - DBG_ASSERT(nlnc == 0); // Don't know what "nonlinear network"constraints are - DBG_ASSERT(lnc == 0); // Don't know what "linear network" constraints are - - // Set options in the asl structure - want_xpi0 = 1 | 2; // allocate initial values for primal and dual if available - obj_no = 0; - DBG_ASSERT((want_xpi0 & 1) == 1 && (want_xpi0 & 2) == 2); - - // allocate space for initial values - X0 = new real[n_var]; - havex0 = new char[n_var]; - pi0 = new real[n_con]; - havepi0 = new char[n_con]; - - // prepare for suffixes - if (IsValid(suffix_handler)) { + "Currently, the AMPL interface to Ipopt does not support complementarity constraints."); + } + + DBG_ASSERT(nlo == 0 || nlo == 1); // Can handle nonlinear obj. + DBG_ASSERT(nwv == 0); // Don't know what "linear arc" variables are + DBG_ASSERT(nlnc == 0); // Don't know what "nonlinear network"constraints are + DBG_ASSERT(lnc == 0); // Don't know what "linear network" constraints are + + // Set options in the asl structure + want_xpi0 = 1 | 2; // allocate initial values for primal and dual if available + obj_no = 0; + DBG_ASSERT((want_xpi0 & 1) == 1 && (want_xpi0 & 2) == 2); + + // allocate space for initial values + X0 = new real[n_var]; + havex0 = new char[n_var]; + pi0 = new real[n_con]; + havepi0 = new char[n_con]; + + // prepare for suffixes + if( IsValid(suffix_handler) ) + { suffix_handler->PrepareAmplForSuffixes(asl_); - } - - // read the rest of the nl file - int retcode = pfgh_read(nl, ASL_return_read_err | ASL_findgroups); - - switch (retcode) { - case ASL_readerr_none : {} - break; - case ASL_readerr_nofile : { - jnlst_->Printf(J_ERROR, J_MAIN, "Cannot open .nl file\n"); - THROW_EXCEPTION(INVALID_TNLP, "Cannot open .nl file"); - } - break; - case ASL_readerr_nonlin : { - DBG_ASSERT(false); // this better not be an error! - jnlst_->Printf(J_ERROR, J_MAIN, "model involves nonlinearities (ed0read)\n"); - THROW_EXCEPTION(INVALID_TNLP, "model involves nonlinearities (ed0read)"); - } - break; - case ASL_readerr_argerr : { - jnlst_->Printf(J_ERROR, J_MAIN, "user-defined function with bad args\n"); - THROW_EXCEPTION(INVALID_TNLP, "user-defined function with bad args"); - } - break; - case ASL_readerr_unavail : { - jnlst_->Printf(J_ERROR, J_MAIN, "user-defined function not available\n"); - THROW_EXCEPTION(INVALID_TNLP, "user-defined function not available"); - } - break; - case ASL_readerr_corrupt : { - jnlst_->Printf(J_ERROR, J_MAIN, "corrupt .nl file\n"); - THROW_EXCEPTION(INVALID_TNLP, "corrupt .nl file"); - } - break; - case ASL_readerr_bug : { - jnlst_->Printf(J_ERROR, J_MAIN, "bug in .nl reader\n"); - THROW_EXCEPTION(INVALID_TNLP, "bug in .nl reader"); - } - break; - case ASL_readerr_CLP : { - jnlst_->Printf(J_ERROR, J_MAIN, "Ampl model contains a constraint without \"=\", \">=\", or \"<=\".\n"); - THROW_EXCEPTION(INVALID_TNLP, "Ampl model contains a constraint without \"=\", \">=\", or \"<=\"."); - } - break; - default: { - jnlst_->Printf(J_ERROR, J_MAIN, "Unknown error in stub file read. retcode = %d\n", retcode); - THROW_EXCEPTION(INVALID_TNLP, "Unknown error in stub file read"); - } - break; - } - } - - void AmplTNLP::set_active_objective(Index in_obj_no) - { - if (hesset_called_) { - jnlst_->Printf(J_ERROR, J_MAIN, "Internal error: AmplTNLP::set_active_objective called after AmplTNLP::call_hesset.\n"); - THROW_EXCEPTION(INVALID_TNLP, "Internal error: AmplTNLP::set_active_objective called after AmplTNLP::call_hesset."); - } - ASL_pfgh* asl = asl_; - obj_no = in_obj_no; - set_active_objective_called_ = true; - } - - void AmplTNLP::call_hesset() - { - if (hesset_called_) { - jnlst_->Printf(J_ERROR, J_MAIN, "Internal error: AmplTNLP::call_hesset is called twice.\n"); - THROW_EXCEPTION(INVALID_TNLP, "Internal error: AmplTNLP::call_hesset is called twice."); - } + } - ASL_pfgh* asl = asl_; + // read the rest of the nl file + int retcode = pfgh_read(nl, ASL_return_read_err | ASL_findgroups); - if (n_obj == 0) { - hesset(1,0,0,0,nlc); - } - else { - if (n_obj>1 && !set_active_objective_called_) { - jnlst_->Printf(J_ERROR, J_MAIN, - "There is more than one objective function in the AMPL model, but AmplTNLP::set_active_objective has not been called.\n"); - THROW_EXCEPTION(INVALID_TNLP, "There is more than one objective function in the AMPL model, but AmplTNLP::set_active_objective has not been called"); + switch( retcode ) + { + case ASL_readerr_none: + { + break; + } + case ASL_readerr_nofile: + { + jnlst_->Printf(J_ERROR, J_MAIN, "Cannot open .nl file\n"); + THROW_EXCEPTION(INVALID_TNLP, "Cannot open .nl file"); + break; + } + case ASL_readerr_nonlin: + { + DBG_ASSERT(false); // this better not be an error! + jnlst_->Printf(J_ERROR, J_MAIN, "model involves nonlinearities (ed0read)\n"); + THROW_EXCEPTION(INVALID_TNLP, "model involves nonlinearities (ed0read)"); + break; + } + case ASL_readerr_argerr: + { + jnlst_->Printf(J_ERROR, J_MAIN, "user-defined function with bad args\n"); + THROW_EXCEPTION(INVALID_TNLP, "user-defined function with bad args"); + break; + } + case ASL_readerr_unavail: + { + jnlst_->Printf(J_ERROR, J_MAIN, "user-defined function not available\n"); + THROW_EXCEPTION(INVALID_TNLP, "user-defined function not available"); + break; + } + case ASL_readerr_corrupt: + { + jnlst_->Printf(J_ERROR, J_MAIN, "corrupt .nl file\n"); + THROW_EXCEPTION(INVALID_TNLP, "corrupt .nl file"); + break; + } + case ASL_readerr_bug: + { + jnlst_->Printf(J_ERROR, J_MAIN, "bug in .nl reader\n"); + THROW_EXCEPTION(INVALID_TNLP, "bug in .nl reader"); + break; + } + case ASL_readerr_CLP: + { + jnlst_->Printf(J_ERROR, J_MAIN, "Ampl model contains a constraint without \"=\", \">=\", or \"<=\".\n"); + THROW_EXCEPTION(INVALID_TNLP, "Ampl model contains a constraint without \"=\", \">=\", or \"<=\"."); + break; + } + default: + { + jnlst_->Printf(J_ERROR, J_MAIN, "Unknown error in stub file read. retcode = %d\n", retcode); + THROW_EXCEPTION(INVALID_TNLP, "Unknown error in stub file read"); + break; + } + } +} + +void AmplTNLP::set_active_objective( + Index in_obj_no +) +{ + if( hesset_called_ ) + { + jnlst_->Printf(J_ERROR, J_MAIN, + "Internal error: AmplTNLP::set_active_objective called after AmplTNLP::call_hesset.\n"); + THROW_EXCEPTION(INVALID_TNLP, + "Internal error: AmplTNLP::set_active_objective called after AmplTNLP::call_hesset."); + } + ASL_pfgh* asl = asl_; + obj_no = in_obj_no; + set_active_objective_called_ = true; +} + +void AmplTNLP::call_hesset() +{ + if( hesset_called_ ) + { + jnlst_->Printf(J_ERROR, J_MAIN, "Internal error: AmplTNLP::call_hesset is called twice.\n"); + THROW_EXCEPTION(INVALID_TNLP, "Internal error: AmplTNLP::call_hesset is called twice."); + } + + ASL_pfgh* asl = asl_; + + if( n_obj == 0 ) + { + hesset(1, 0, 0, 0, nlc); + } + else + { + if( n_obj > 1 && !set_active_objective_called_ ) + { + jnlst_->Printf(J_ERROR, J_MAIN, + "There is more than one objective function in the AMPL model, but AmplTNLP::set_active_objective has not been called.\n"); + THROW_EXCEPTION(INVALID_TNLP, + "There is more than one objective function in the AMPL model, but AmplTNLP::set_active_objective has not been called"); } // see "changes" in solvers directory of ampl code... - hesset(1,obj_no,1,0,nlc); - } + hesset(1, obj_no, 1, 0, nlc); + } - obj_sign_ = 1; // minimization - if (n_obj > 0 && objtype[obj_no] != 0) { + obj_sign_ = 1; // minimization + if( n_obj > 0 && objtype[obj_no] != 0 ) + { obj_sign_ = -1; - } - - // find the nonzero structure for the hessian parameters to - // sphsetup: - int coeff_obj = 1; - int mult_supplied = 1; // multipliers will be supplied - int uptri = 1; // only need the upper triangular part - nz_h_full_ = sphsetup(-1, coeff_obj, mult_supplied, uptri); + } - hesset_called_ = true; - } + // find the nonzero structure for the hessian parameters to + // sphsetup: + int coeff_obj = 1; + int mult_supplied = 1; // multipliers will be supplied + int uptri = 1; // only need the upper triangular part + nz_h_full_ = sphsetup(-1, coeff_obj, mult_supplied, uptri); - AmplTNLP::~AmplTNLP() - { - ASL_pfgh* asl = asl_; + hesset_called_ = true; +} - if (asl) { - if (X0) { - delete [] X0; - X0 = NULL; +AmplTNLP::~AmplTNLP() +{ + ASL_pfgh* asl = asl_; + + if( asl ) + { + if( X0 ) + { + delete[] X0; + X0 = NULL; } - if (havex0) { - delete [] havex0; - havex0 = NULL; + if( havex0 ) + { + delete[] havex0; + havex0 = NULL; } - if (pi0) { - delete [] pi0; - pi0 = NULL; + if( pi0 ) + { + delete[] pi0; + pi0 = NULL; } - if (havepi0) { - delete [] havepi0; - havepi0 = NULL; + if( havepi0 ) + { + delete[] havepi0; + havepi0 = NULL; } - ASL* asl_to_free = (ASL*)asl_; + ASL* asl_to_free = (ASL*) asl_; ASL_free(&asl_to_free); asl_ = NULL; - } - - delete [] x_sol_; - x_sol_ = NULL; - delete [] z_L_sol_; - z_L_sol_ = NULL; - delete [] z_U_sol_; - z_U_sol_ = NULL; - delete [] g_sol_; - g_sol_ = NULL; - delete [] lambda_sol_; - lambda_sol_ = NULL; - - if (Oinfo_ptr_) { + } + + delete[] x_sol_; + x_sol_ = NULL; + delete[] z_L_sol_; + z_L_sol_ = NULL; + delete[] z_U_sol_; + z_U_sol_ = NULL; + delete[] g_sol_; + g_sol_ = NULL; + delete[] lambda_sol_; + lambda_sol_ = NULL; + + if( Oinfo_ptr_ ) + { Option_Info* Oinfo = (Option_Info*) Oinfo_ptr_; - delete [] Oinfo->sname; - delete [] Oinfo->bsname; - delete [] Oinfo->opname; + delete[] Oinfo->sname; + delete[] Oinfo->bsname; + delete[] Oinfo->opname; delete Oinfo; - } + } + + delete (fint*) nerror_; +} + +bool AmplTNLP::get_nlp_info( + Index& n, + Index& m, + Index& nnz_jac_g, + Index& nnz_h_lag, + IndexStyleEnum& index_style +) +{ + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); - delete (fint*) nerror_; - } + if( !hesset_called_ ) + { + call_hesset(); + } + + n = n_var; // # of variables (variable types have been asserted in the constructor + m = n_con; // # of constraints + nnz_jac_g = nzc; // # of non-zeros in the jacobian + nnz_h_lag = nz_h_full_; // # of non-zeros in the hessian + + index_style = TNLP::FORTRAN_STYLE; + + return true; +} + +bool AmplTNLP::get_var_con_metadata( + Index n, + StringMetaDataMapType& var_string_md, + IntegerMetaDataMapType& var_integer_md, + NumericMetaDataMapType& var_numeric_md, + Index m, + StringMetaDataMapType& con_string_md, + IntegerMetaDataMapType& con_integer_md, + NumericMetaDataMapType& con_numeric_md +) +{ + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); - bool AmplTNLP::get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, - Index& nnz_h_lag, IndexStyleEnum& index_style) - { - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + // pick up the variable and constraints names if available + Index rlen = maxrownamelen; + Index clen = maxcolnamelen; - if (!hesset_called_) { - call_hesset(); - } - - n = n_var; // # of variables (variable types have been asserted in the constructor - m = n_con; // # of constraints - nnz_jac_g = nzc; // # of non-zeros in the jacobian - nnz_h_lag = nz_h_full_; // # of non-zeros in the hessian - - index_style = TNLP::FORTRAN_STYLE; - - return true; - } - - bool AmplTNLP::get_var_con_metadata(Index n, - StringMetaDataMapType& var_string_md, - IntegerMetaDataMapType& var_integer_md, - NumericMetaDataMapType& var_numeric_md, - Index m, - StringMetaDataMapType& con_string_md, - IntegerMetaDataMapType& con_integer_md, - NumericMetaDataMapType& con_numeric_md) - { - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - - // pick up the variable and constraints names if available - Index rlen = maxrownamelen; - Index clen = maxcolnamelen; - - if (clen > 0) { + if( clen > 0 ) + { std::vector var_names(n); - for (Index i=0; i 0) { + if( rlen > 0 ) + { std::vector con_names(m); - for (Index i=0; i 0 || var_integer_md_.size() > 0 || var_numeric_md_.size() > 0 - || con_string_md_.size() > 0 || con_integer_md_.size() > 0 || con_numeric_md_.size() > 0) { + if( var_string_md_.size() > 0 || var_integer_md_.size() > 0 || var_numeric_md_.size() > 0 + || con_string_md_.size() > 0 || con_integer_md_.size() > 0 || con_numeric_md_.size() > 0 ) + { var_string_md = var_string_md_; var_integer_md = var_integer_md_; var_numeric_md = var_numeric_md_; @@ -341,398 +384,536 @@ namespace Ipopt con_integer_md = con_integer_md_; con_numeric_md = con_numeric_md_; return true; - } - - return false; - } - - bool AmplTNLP::get_bounds_info(Index n, Number* x_l, Number* x_u, Index m, Number* g_l, Number* g_u) - { - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - - DBG_ASSERT(n == n_var); - DBG_ASSERT(m == n_con); - - for (Index i=0; iGetNumberSuffixValues("ipopt_zL_in", AmplSuffixHandler::Variable_Source); const double* zU_init = suffix_handler_->GetNumberSuffixValues("ipopt_zU_in", AmplSuffixHandler::Variable_Source); - for (Index i=0; i(x), grad_f, (fint*)nerror_); - if (!nerror_ok(nerror_)) { - return false; + } + else + { + objgrd(obj_no, const_cast(x), grad_f, (fint* )nerror_); + if( !nerror_ok(nerror_) ) + { + return false; } - if (obj_sign_==-1) { - for (Index i=0; inext) { - iRow[cg->goff] = i + 1; - jCol[cg->goff] = cg->varno + 1; - // iRow[current_nz] = i + 1; - // jCol[current_nz] = cg->varno+1; - current_nz++; - } + for( Index i = 0; i < n_con; i++ ) + { + for( cgrad* cg = Cgrad[i]; cg; cg = cg->next ) + { + iRow[cg->goff] = i + 1; + jCol[cg->goff] = cg->varno + 1; + // iRow[current_nz] = i + 1; + // jCol[current_nz] = cg->varno+1; + current_nz++; + } } DBG_ASSERT(current_nz == nele_jac); + (void) nele_jac; return true; - } - else if (!iRow && !jCol && values) { - if (!apply_new_x(new_x, n, x)) { - return false; + } + else if( !iRow && !jCol && values ) + { + if( !apply_new_x(new_x, n, x) ) + { + return false; } - jacval(const_cast(x), values, (fint*)nerror_); - if (nerror_ok(nerror_)) { - return true; + jacval(const_cast(x), values, (fint* )nerror_); + if( nerror_ok(nerror_) ) + { + return true; } - } - else { + } + else + { DBG_ASSERT(false && "Invalid combination of iRow, jCol, and values pointers"); - } - - return false; - } - - bool AmplTNLP::eval_h(Index n, const Number* x, bool new_x, - Number obj_factor, Index m, const Number* lambda, - bool new_lambda, Index nele_hess, Index* iRow, - Index* jCol, Number* values) - { - DBG_START_METH("AmplTNLP::eval_h", - dbg_verbosity); - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - DBG_ASSERT(n == n_var); - DBG_ASSERT(m == n_con); - - if (iRow && jCol && !values) { + } + + return false; +} + +bool AmplTNLP::eval_h( + Index n, + const Number* x, + bool new_x, + Number obj_factor, + Index m, + const Number* lambda, + bool /*new_lambda*/, + Index nele_hess, + Index* iRow, + Index* jCol, + Number* values +) +{ + DBG_START_METH("AmplTNLP::eval_h", + dbg_verbosity); + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); + DBG_ASSERT(n == n_var); + DBG_ASSERT(m == n_con); + + if( iRow && jCol && !values ) + { // setup the structure - int k=0; - for (int i=0; ihcolstarts[i]; jhcolstarts[i+1]; j++) { - iRow[k] = i + 1; - jCol[k] = sputinfo->hrownos[j]+1; - k++; - } - } - DBG_ASSERT(k==nele_hess); + int k = 0; + for( int i = 0; i < n; i++ ) + { + for( int j = sputinfo->hcolstarts[i]; j < sputinfo->hcolstarts[i + 1]; j++ ) + { + iRow[k] = i + 1; + jCol[k] = sputinfo->hrownos[j] + 1; + k++; + } + } + DBG_ASSERT(k == nele_hess); + (void) nele_hess; return true; - } - else if (!iRow && !jCol && values) { - if (!apply_new_x(new_x, n, x)) { - return false; + } + else if( !iRow && !jCol && values ) + { + if( !apply_new_x(new_x, n, x) ) + { + return false; } - if (!objval_called_with_current_x_) { - Number dummy; - internal_objval(x, dummy); - internal_conval(x, m); + if( !objval_called_with_current_x_ ) + { + Number dummy; + internal_objval(x, dummy); + internal_conval(x, m); } - if (!conval_called_with_current_x_) { - internal_conval(x, m); + if( !conval_called_with_current_x_ ) + { + internal_conval(x, m); } - real* OW = new real[Max(1,n_obj)]; - if (n_obj>0) { - for (Index i=0; i 0 ) + { + for( Index i = 0; i < n_obj; i++ ) + { + OW[i] = 0.; + } + OW[obj_no] = obj_sign_ * obj_factor; } sphes(values, -1, OW, const_cast(lambda)); - delete [] OW; + delete[] OW; return true; - } - else { + } + else + { DBG_ASSERT(false && "Invalid combination of iRow, jCol, and values pointers"); - } - - return false; - } - - void AmplTNLP::finalize_solution(SolverReturn status, - Index n, const Number* x, const Number* z_L, const Number* z_U, - Index m, const Number* g, const Number* lambda, - Number obj_value, - const IpoptData* ip_data, - IpoptCalculatedQuantities* ip_cq) - { - ASL_pfgh* asl = asl_; + } + + return false; +} + +void AmplTNLP::finalize_solution( + SolverReturn status, + Index n, + const Number* x, + const Number* z_L, + const Number* z_U, + Index m, + const Number* g, + const Number* lambda, + Number obj_value, + const IpoptData* /*ip_data*/, + IpoptCalculatedQuantities* /*ip_cq*/ +) +{ + ASL_pfgh* asl = asl_; - if (!x_sol_) { + if( !x_sol_ ) + { x_sol_ = new Number[n]; - } - if (!z_L_sol_) { + } + if( !z_L_sol_ ) + { z_L_sol_ = new Number[n]; - } - if (!z_U_sol_) { + } + if( !z_U_sol_ ) + { z_U_sol_ = new Number[n]; - } - if (!g_sol_) { + } + if( !g_sol_ ) + { g_sol_ = new Number[m]; - } - if (!lambda_sol_) { + } + if( !lambda_sol_ ) + { lambda_sol_ = new Number[m]; - } + } - IpBlasDcopy(n, x, 1, x_sol_, 1); - IpBlasDcopy(m, g, 1, g_sol_, 1); - if( obj_sign_ == -1.0 ) // maximization - { + IpBlasDcopy(n, x, 1, x_sol_, 1); + IpBlasDcopy(m, g, 1, g_sol_, 1); + if( obj_sign_ == -1.0 ) // maximization + { for( int i = 0; i < n; ++i ) - z_L_sol_[i] = -z_L[i]; + { + z_L_sol_[i] = -z_L[i]; + } IpBlasDcopy(n, z_U, 1, z_U_sol_, 1); IpBlasDcopy(m, lambda, 1, lambda_sol_, 1); - } - else - { + } + else + { IpBlasDcopy(n, z_L, 1, z_L_sol_, 1); for( int i = 0; i < n; ++i ) - z_U_sol_[i] = -z_U[i]; + { + z_U_sol_[i] = -z_U[i]; + } for( int i = 0; i < m; ++i ) - lambda_sol_[i] = -lambda[i]; - } - obj_sol_ = obj_value; + { + lambda_sol_[i] = -lambda[i]; + } + } + obj_sol_ = obj_value; - std::string message; - if (status == SUCCESS) { + std::string message; + if( status == SUCCESS ) + { message = "Optimal Solution Found"; solve_result_num = 0; - } - else if (status == MAXITER_EXCEEDED) { + } + else if( status == MAXITER_EXCEEDED ) + { message = "Maximum Number of Iterations Exceeded."; solve_result_num = 400; - } - else if (status == CPUTIME_EXCEEDED) { + } + else if( status == CPUTIME_EXCEEDED ) + { message = "Maximum CPU Time Exceeded."; solve_result_num = 401; - } - else if (status == STOP_AT_TINY_STEP) { + } + else if( status == STOP_AT_TINY_STEP ) + { message = "Search Direction becomes Too Small."; solve_result_num = 500; - } - else if (status == STOP_AT_ACCEPTABLE_POINT) { + } + else if( status == STOP_AT_ACCEPTABLE_POINT ) + { message = "Solved To Acceptable Level."; solve_result_num = 1; - } - else if (status == FEASIBLE_POINT_FOUND) { + } + else if( status == FEASIBLE_POINT_FOUND ) + { message = "Found feasible point for square problem."; solve_result_num = 2; - } - else if (status == LOCAL_INFEASIBILITY) { + } + else if( status == LOCAL_INFEASIBILITY ) + { message = "Converged to a locally infeasible point. Problem may be infeasible."; solve_result_num = 200; - } - else if (status == RESTORATION_FAILURE) { + } + else if( status == RESTORATION_FAILURE ) + { message = "Restoration Phase Failed."; solve_result_num = 501; - } - else if (status == DIVERGING_ITERATES) { + } + else if( status == DIVERGING_ITERATES ) + { message = "Iterates diverging; problem might be unbounded."; solve_result_num = 300; - } - else { + } + else + { message = "Unknown Error"; solve_result_num = 502; - } + } - if (IsValid(suffix_handler_)) { + if( IsValid(suffix_handler_) ) + { // Modified for warm-start from AMPL. Assign Bound Multipliers as Suffixes - suf_rput("ipopt_zL_out", ASL_Sufkind_var, z_L_sol_); - suf_rput("ipopt_zU_out", ASL_Sufkind_var, z_U_sol_); - } - - // Write the .sol file - message = " \nIpopt " IPOPT_VERSION ": " + message; - write_solution_file(message.c_str()); - } - - bool AmplTNLP::internal_objval(const Number* x, Number& obj_val) - { - DBG_START_METH("AmplTNLP::internal_objval", - dbg_verbosity); - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - objval_called_with_current_x_ = false; // in case the call below fails - - if (n_obj==0) { + suf_rput("ipopt_zL_out", ASL_Sufkind_var, z_L_sol_); + suf_rput("ipopt_zU_out", ASL_Sufkind_var, z_U_sol_); + } + + // Write the .sol file + message = " \nIpopt " IPOPT_VERSION ": " + message; + write_solution_file(message.c_str()); +} + +bool AmplTNLP::internal_objval( + const Number* x, + Number& obj_val +) +{ + DBG_START_METH("AmplTNLP::internal_objval", + dbg_verbosity); + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); + objval_called_with_current_x_ = false; // in case the call below fails + + if( n_obj == 0 ) + { obj_val = 0; objval_called_with_current_x_ = true; return true; - } - else { - Number retval = objval(obj_no, const_cast(x), (fint*)nerror_); - if (nerror_ok(nerror_)) { - obj_val = obj_sign_*retval; - objval_called_with_current_x_ = true; - return true; - } - } - - return false; - } - - bool AmplTNLP::internal_conval(const Number* x, Index m, Number* g) - { - DBG_START_METH("AmplTNLP::internal_conval", - dbg_verbosity); - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); - DBG_ASSERT(m == n_con); - conval_called_with_current_x_ = false; // in case the call below fails - - bool allocated = false; - if (!g) { + } + else + { + Number retval = objval(obj_no, const_cast(x), (fint* )nerror_); + if( nerror_ok(nerror_) ) + { + obj_val = obj_sign_ * retval; + objval_called_with_current_x_ = true; + return true; + } + } + + return false; +} + +bool AmplTNLP::internal_conval( + const Number* x, + Index m, + Number* g +) +{ + DBG_START_METH("AmplTNLP::internal_conval", + dbg_verbosity); + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); + DBG_ASSERT(m == n_con); + conval_called_with_current_x_ = false; // in case the call below fails + + bool allocated = false; + if( !g ) + { g = new double[m]; allocated = true; - } - conval(const_cast(x), g, (fint*)nerror_); + } + conval(const_cast(x), g, (fint* )nerror_); - if (allocated) { - delete [] g; + if( allocated ) + { + delete[] g; g = NULL; - } + } - if (nerror_ok(nerror_)) { + if( nerror_ok(nerror_) ) + { conval_called_with_current_x_ = true; return true; - } - return false; - } - - - bool AmplTNLP::apply_new_x(bool new_x, Index n, const Number* x) - { - DBG_START_METH("AmplTNLP::apply_new_x", - dbg_verbosity); + } + return false; +} + +bool AmplTNLP::apply_new_x( + bool new_x, + Index /*n*/, + const Number* x +) +{ + DBG_START_METH("AmplTNLP::apply_new_x", + dbg_verbosity); - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl_); - if (new_x) { - if (!hesset_called_) { - call_hesset(); + if( new_x ) + { + if( !hesset_called_ ) + { + call_hesset(); } DBG_PRINT((1, "Set new x.\n")); @@ -742,175 +923,212 @@ namespace Ipopt objval_called_with_current_x_ = false; // tell ampl that we have a new x - xknowne(const_cast(x), (fint*)nerror_); + xknowne(const_cast(x), (fint* )nerror_); return nerror_ok(nerror_); - } - - return true; - } - - void AmplTNLP::write_solution_file(const std::string& message) const - { - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl); - DBG_ASSERT(x_sol_ && lambda_sol_); - - // We need to copy the message into a non-const char array to make - // it work with the AMPL C function. - char* cmessage = new char[message.length()+1]; - strcpy(cmessage, message.c_str()); - - write_sol(cmessage, x_sol_, lambda_sol_, (Option_Info*)Oinfo_ptr_); - - delete [] cmessage; - } - - void AmplTNLP::get_discrete_info(Index& nlvb_, - Index& nlvbi_, - Index& nlvc_, - Index& nlvci_, - Index& nlvo_, - Index& nlvoi_, - Index& nbv_, - Index& niv_) const - { - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl); - - nlvb_ = nlvb; - nlvbi_ = nlvbi; - nlvc_ = nlvc; - nlvci_ = nlvci; - nlvo_ = nlvo; - nlvoi_ = nlvoi; - nbv_ = nbv; - niv_ = niv; - } - - bool AmplTNLP::get_scaling_parameters(Number& obj_scaling, - bool& use_x_scaling, Index n, - Number* x_scaling, - bool& use_g_scaling, Index m, - Number* g_scaling) - { - DBG_ASSERT(IsValid(suffix_handler_)); - const double* obj = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Objective_Source); - obj_scaling = (obj) ? obj[0] : 1.0; - - const double* x = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Variable_Source); - if (x) { + } + + return true; +} + +void AmplTNLP::write_solution_file( + const std::string& message +) const +{ + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl); + DBG_ASSERT(x_sol_ && lambda_sol_); + + // We need to copy the message into a non-const char array to make + // it work with the AMPL C function. + char* cmessage = new char[message.length() + 1]; + strcpy(cmessage, message.c_str()); + + write_sol(cmessage, x_sol_, lambda_sol_, (Option_Info* )Oinfo_ptr_); + + delete[] cmessage; +} + +void AmplTNLP::get_discrete_info( + Index& nlvb_, + Index& nlvbi_, + Index& nlvc_, + Index& nlvci_, + Index& nlvo_, + Index& nlvoi_, + Index& nbv_, + Index& niv_ +) const +{ + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl); + + nlvb_ = nlvb; + nlvbi_ = nlvbi; + nlvc_ = nlvc; + nlvci_ = nlvci; + nlvo_ = nlvo; + nlvoi_ = nlvoi; + nbv_ = nbv; + niv_ = niv; +} + +bool AmplTNLP::get_scaling_parameters( + Number& obj_scaling, + bool& use_x_scaling, + Index n, + Number* x_scaling, + bool& use_g_scaling, + Index m, + Number* g_scaling +) +{ + DBG_ASSERT(IsValid(suffix_handler_)); + const double* obj = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Objective_Source); + obj_scaling = (obj) ? obj[0] : 1.0; + + const double* x = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Variable_Source); + if( x ) + { use_x_scaling = true; - for (int i=0; i < n; i++) { - if (x[i] > 0.0) { - x_scaling[i] = x[i]; - } - else { - x_scaling[i] = 1.0; - } - } - } - else { + for( int i = 0; i < n; i++ ) + { + if( x[i] > 0.0 ) + { + x_scaling[i] = x[i]; + } + else + { + x_scaling[i] = 1.0; + } + } + } + else + { use_x_scaling = false; - } + } - const double* g = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Constraint_Source); - if (g) { + const double* g = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Constraint_Source); + if( g ) + { use_g_scaling = true; - for (int i=0; i < m; i++) { - if (g[i] > 0) { - g_scaling[i] = g[i]; - } - else { - g_scaling[i] = 1.0; - } - } - } - else { + for( int i = 0; i < m; i++ ) + { + if( g[i] > 0 ) + { + g_scaling[i] = g[i]; + } + else + { + g_scaling[i] = 1.0; + } + } + } + else + { use_g_scaling = false; - } - - return true; - } - - Index AmplTNLP::get_number_of_nonlinear_variables() - { - ASL_pfgh* asl = asl_; - return Max(nlvo,nlvc); - } - - bool AmplTNLP::get_list_of_nonlinear_variables(Index num_nonlin_vars, - Index* pos_nonlin_vars) - { - DBG_DO(ASL_pfgh* asl = asl_;) - DBG_ASSERT(num_nonlin_vars == Max(nlvo,nlvc)); - - // The first variables are the nonlinear ones (using Fortran - // numbering) - for (Index i=0; iinfo; + } + + return true; +} + +Index AmplTNLP::get_number_of_nonlinear_variables() +{ + ASL_pfgh* asl = asl_; + return Max(nlvo, nlvc); +} + +bool AmplTNLP::get_list_of_nonlinear_variables( + Index num_nonlin_vars, + Index* pos_nonlin_vars +) +{ + DBG_DO(ASL_pfgh* asl = asl_;) + DBG_ASSERT(num_nonlin_vars == Max(nlvo, nlvc)); + + // The first variables are the nonlinear ones (using Fortran + // numbering) + for( Index i = 0; i < num_nonlin_vars; i++ ) + { + pos_nonlin_vars[i] = i + 1; + } + return true; +} + +extern "C" +{ + static char* get_num_opt( + Option_Info* oi, + keyword* kw, + char* value + ) + { + AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; real real_val; kw->info = &real_val; char* retval = D_val(oi, kw, value); kw->info = (void*) pinfo; - if (!pinfo->Options()->SetNumericValue(pinfo->IpoptName().c_str(), real_val)) { - pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, - "\nInvalid value \"%s\" for option %s.\n", value, kw->name); - THROW_EXCEPTION(OPTION_INVALID, "Invalid numeric option"); + if( !pinfo->Options()->SetNumericValue(pinfo->IpoptName().c_str(), real_val) ) + { + pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, "\nInvalid value \"%s\" for option %s.\n", value, kw->name); + THROW_EXCEPTION(OPTION_INVALID, "Invalid numeric option"); } return retval; - } + } - static char* get_int_opt(Option_Info *oi, keyword *kw, char *value) { - AmplOptionsList::PrivatInfo* - pinfo = (AmplOptionsList::PrivatInfo*) kw->info; + static char* get_int_opt( + Option_Info* oi, + keyword* kw, + char* value + ) + { + AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; int int_val; kw->info = &int_val; char* retval = I_val(oi, kw, value); kw->info = (void*) pinfo; - if (!pinfo->Options()->SetIntegerValue(pinfo->IpoptName().c_str(), int_val)) { - pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, - "\nInvalid value \"%s\" for option %s.\n", value, kw->name); - THROW_EXCEPTION(OPTION_INVALID, "Invalid integer option"); + if( !pinfo->Options()->SetIntegerValue(pinfo->IpoptName().c_str(), int_val) ) + { + pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, "\nInvalid value \"%s\" for option %s.\n", value, kw->name); + THROW_EXCEPTION(OPTION_INVALID, "Invalid integer option"); } return retval; - } + } - static char* get_str_opt(Option_Info *oi, keyword *kw, char *value) { - AmplOptionsList::PrivatInfo* - pinfo = (AmplOptionsList::PrivatInfo*) kw->info; + static char* get_str_opt( + Option_Info* oi, + keyword* kw, + char* value + ) + { + AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; char* str_val; kw->info = &str_val; char* retval = C_val(oi, kw, value); kw->info = (void*) pinfo; - if (!pinfo->Options()->SetStringValue(pinfo->IpoptName().c_str(), str_val)) { - pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, - "\nInvalid value \"%s\" for option %s.\n", value, kw->name); - THROW_EXCEPTION(OPTION_INVALID, "Invalid string option"); + if( !pinfo->Options()->SetStringValue(pinfo->IpoptName().c_str(), str_val) ) + { + pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, "\nInvalid value \"%s\" for option %s.\n", value, kw->name); + THROW_EXCEPTION(OPTION_INVALID, "Invalid string option"); } return retval; - } + } - static char* get_haltonerror_opt(Option_Info *oi, keyword *kw, char *value) { - AmplOptionsList::PrivatInfo* - pinfo = (AmplOptionsList::PrivatInfo*) kw->info; + static char* get_haltonerror_opt( + Option_Info* oi, + keyword* kw, + char* value + ) + { + AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; char* str_val; kw->info = &str_val; @@ -919,693 +1137,682 @@ namespace Ipopt fint** nerror = (fint**) pinfo->NError(); - if (strcmp(str_val, "yes")==0) { - delete *nerror; - *nerror = NULL; + if( strcmp(str_val, "yes") == 0 ) + { + delete *nerror; + *nerror = NULL; } - else if (strcmp(str_val, "no")==0) { - delete *nerror; - *nerror = new fint; - **nerror = 0; + else if( strcmp(str_val, "no") == 0 ) + { + delete *nerror; + *nerror = new fint; + ** nerror = 0; } - else { - pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, - "\nInvalid value \"%s\" for option %s.\n", value, kw->name); - THROW_EXCEPTION(OPTION_INVALID, "Invalid option"); + else + { + pinfo->Jnlst()->Printf(J_ERROR, J_MAIN, "\nInvalid value \"%s\" for option %s.\n", value, kw->name); + THROW_EXCEPTION(OPTION_INVALID, "Invalid option"); } return retval; - } - } - - - AmplOptionsList::AmplOption::AmplOption(const std::string ipopt_option_name, - AmplOptionType type, - const std::string description) - : - ipopt_option_name_(ipopt_option_name), - type_(type) - { - description_ = new char[description.size()+1]; - strcpy(description_, description.c_str()); - } - - AmplOptionsList::~AmplOptionsList() - { - if (keywds_) { - DBG_ASSERT(nkeywds_>0); + } +} + +AmplOptionsList::AmplOption::AmplOption( + const std::string ipopt_option_name, + AmplOptionType type, + const std::string description +) + : ipopt_option_name_(ipopt_option_name), + type_(type) +{ + description_ = new char[description.size() + 1]; + strcpy(description_, description.c_str()); +} + +AmplOptionsList::~AmplOptionsList() +{ + if( keywds_ ) + { + DBG_ASSERT(nkeywds_ > 0); keyword* keywords = (keyword*) keywds_; - for (Index i=0; i& options, - SmartPtr jnlst, - void** nerror) - { - if (keywds_) { - DBG_ASSERT(nkeywds_>0); + for( Index i = 0; i < nkeywds_; i++ ) + { + PrivatInfo* pinfo = (PrivatInfo*) keywords[i].info; + delete pinfo; + delete[] keywords[i].name; + } + delete[] keywords; + } +} + +void* AmplOptionsList::Keywords( + const SmartPtr& options, + SmartPtr jnlst, + void** nerror +) +{ + if( keywds_ ) + { + DBG_ASSERT(nkeywds_ > 0); keyword* keywords = (keyword*) keywds_; - for (Index i=0; i >::iterator - iter = ampl_options_map_.begin(); - iter != ampl_options_map_.end(); iter++) { - keywords[ioption].name = new char[iter->first.size()+1]; + Index ioption = 0; + for( std::map >::iterator iter = ampl_options_map_.begin(); + iter != ampl_options_map_.end(); iter++ ) + { + keywords[ioption].name = new char[iter->first.size() + 1]; strcpy(keywords[ioption].name, iter->first.c_str()); keywords[ioption].desc = iter->second->Description(); - switch (iter->second->Type()) { - case String_Option: { - PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); - keywords[ioption].info = (void*) pinfo; - keywords[ioption].kf = get_str_opt; - } - break; - case Number_Option: { - PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); - keywords[ioption].info = (void*) pinfo; - keywords[ioption].kf = get_num_opt; - } - break; - case Integer_Option: { - PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); - keywords[ioption].info = (void*) pinfo; - keywords[ioption].kf = get_int_opt; - } - break; - case WS_Option: - keywords[ioption].info = NULL; - keywords[ioption].kf = WS_val; - break; - case HaltOnError_Option: - PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst, nerror); - keywords[ioption].info = (void*) pinfo; - keywords[ioption].kf = get_haltonerror_opt; - break; + switch( iter->second->Type() ) + { + case String_Option: + { + PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); + keywords[ioption].info = (void*) pinfo; + keywords[ioption].kf = get_str_opt; + } + break; + case Number_Option: + { + PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); + keywords[ioption].info = (void*) pinfo; + keywords[ioption].kf = get_num_opt; + } + break; + case Integer_Option: + { + PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst); + keywords[ioption].info = (void*) pinfo; + keywords[ioption].kf = get_int_opt; + } + break; + case WS_Option: + keywords[ioption].info = NULL; + keywords[ioption].kf = WS_val; + break; + case HaltOnError_Option: + PrivatInfo* pinfo = new PrivatInfo(iter->second->IpoptOptionName(), options, jnlst, nerror); + keywords[ioption].info = (void*) pinfo; + keywords[ioption].kf = get_haltonerror_opt; + break; } ioption++; - } - - DBG_ASSERT(ioption==n_options); - nkeywds_ = n_options; - keywds_ = (void*) keywords; - return keywds_; - } - - void AmplOptionsList::MakeValidLatexString(std::string source, std::string& dest) const - { - std::string::iterator c; - for (c=source.begin(); c!=source.end(); c++) { - if (*c == '_') { - dest.append("\\_"); - } - else if (*c == '^') { - dest.append("\\^"); - } - else if (*c == '>' || *c == '<') { - ; - } - else if (*c == '\n') { - dest += ", "; - } - else { - dest += *c; - } - } - } - - void AmplOptionsList::PrintLatex(SmartPtr jnlst) - { - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\begin{description}\n"); - for( std::map >::iterator iter = ampl_options_map_.begin(); - iter != ampl_options_map_.end(); ++iter) - { - std::string amplname; - std::string ipoptname; - std::string descr; - - MakeValidLatexString(iter->first.c_str(), amplname); - MakeValidLatexString(iter->second->IpoptOptionName(), ipoptname); - MakeValidLatexString(iter->second->Description(), descr); - - if( ipoptname.length() > 0 ) - { - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\item[{\\htmlref{%s}{opt:%s}}]", - amplname.c_str(), iter->second->IpoptOptionName().c_str()); - if( amplname != ipoptname ) - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " (Ipopt name: \\htmlref{%s}{opt:%s})", - ipoptname.c_str(), iter->second->IpoptOptionName().c_str()); - } - else - { - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\item[%s]", amplname.c_str()); - } - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " %s\n", descr.c_str()); - } - jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\end{description}\n"); - } - - char* - AmplTNLP::get_options(const SmartPtr& options, - SmartPtr& ampl_options_list, - const char* ampl_option_string, - const char* ampl_invokation_string, - const char* ampl_banner_string, char**& argv) - { - ASL_pfgh* asl = asl_; - - if (!IsValid(ampl_options_list)) { + } + + DBG_ASSERT(ioption == n_options); + nkeywds_ = n_options; + keywds_ = (void*) keywords; + return keywds_; +} + +void AmplOptionsList::MakeValidLatexString( + std::string source, + std::string& dest +) const +{ + std::string::iterator c; + for( c = source.begin(); c != source.end(); c++ ) + { + if( *c == '_' ) + { + dest.append("\\_"); + } + else if( *c == '^' ) + { + dest.append("\\^"); + } + else if( *c == '>' || *c == '<' ) + { + ; + } + else if( *c == '\n' ) + { + dest += ", "; + } + else + { + dest += *c; + } + } +} + +void AmplOptionsList::PrintLatex( + SmartPtr jnlst +) +{ + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\begin{description}\n"); + for( std::map >::iterator iter = ampl_options_map_.begin(); + iter != ampl_options_map_.end(); ++iter ) + { + std::string amplname; + std::string ipoptname; + std::string descr; + + MakeValidLatexString(iter->first.c_str(), amplname); + MakeValidLatexString(iter->second->IpoptOptionName(), ipoptname); + MakeValidLatexString(iter->second->Description(), descr); + + if( ipoptname.length() > 0 ) + { + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\item[{\\htmlref{%s}{opt:%s}}]", amplname.c_str(), + iter->second->IpoptOptionName().c_str()); + if( amplname != ipoptname ) + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " (Ipopt name: \\htmlref{%s}{opt:%s})", ipoptname.c_str(), + iter->second->IpoptOptionName().c_str()); + } + else + { + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\item[%s]", amplname.c_str()); + } + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " %s\n", descr.c_str()); + } + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "\\end{description}\n"); +} + +void AmplOptionsList::PrintDoxygen( + SmartPtr jnlst +) +{ + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "| Option | Description |\n"); + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "|:-------|:------------|\n"); + for( std::map >::iterator iter = ampl_options_map_.begin(); + iter != ampl_options_map_.end(); ++iter ) + { + if( iter->second->IpoptOptionName().length() > 0 ) + { + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "| \\ref OPT_%s \"%s\"", iter->second->IpoptOptionName().c_str(), iter->first.c_str()); + + if( iter->first != iter->second->IpoptOptionName() ) + { + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " (Ipopt name: %s)", iter->second->IpoptOptionName().c_str()); + } + } + else + { + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, "| %s", iter->first.c_str()); + } + + std::string descr = iter->second->Description(); + for( std::string::iterator it = descr.begin(); it != descr.end(); ++it ) + if( *it == '\n' ) + { + *it = ';'; + } + + jnlst->Printf(J_SUMMARY, J_DOCUMENTATION, " | %s |\n", descr.c_str()); + } +} + +char* +AmplTNLP::get_options( + const SmartPtr& options, + SmartPtr& ampl_options_list, + const char* ampl_option_string, + const char* ampl_invokation_string, + const char* ampl_banner_string, + char**& argv +) +{ + ASL_pfgh* asl = asl_; + + if( !IsValid(ampl_options_list) ) + { ampl_options_list = new AmplOptionsList(); - } - - // Output - ampl_options_list->AddAmplOption("print_level", - "print_level", - AmplOptionsList::Integer_Option, - "Verbosity level"); - ampl_options_list->AddAmplOption("outlev", - "print_level", - AmplOptionsList::Integer_Option, - "Verbosity level"); - ampl_options_list->AddAmplOption("print_user_options", - "print_user_options", - AmplOptionsList::String_Option, - "Toggle printing of user options"); - ampl_options_list->AddAmplOption("print_options_documentation", - "print_options_documentation", - AmplOptionsList::String_Option, - "Print all available options (for ipopt.opt)"); - ampl_options_list->AddAmplOption("output_file", - "output_file", - AmplOptionsList::String_Option, - "File name of an output file (leave unset for no file output)"); - ampl_options_list->AddAmplOption("file_print_level", - "file_print_level", - AmplOptionsList::Integer_Option, - "Verbosity level for output file"); - ampl_options_list->AddAmplOption("option_file_name", - "option_file_name", - AmplOptionsList::String_Option, - "File name of options file (default: ipopt.opt)"); - - // Termination - ampl_options_list->AddAmplOption("tol", - "tol", - AmplOptionsList::Number_Option, - "Desired convergence tolerance (relative)"); - ampl_options_list->AddAmplOption("max_iter", - "max_iter", - AmplOptionsList::Integer_Option, - "Maximum number of iterations"); - ampl_options_list->AddAmplOption("maxit", - "max_iter", - AmplOptionsList::Integer_Option, - "Maximum number of iterations"); - ampl_options_list->AddAmplOption("max_cpu_time", - "max_cpu_time", - AmplOptionsList::Number_Option, - "CPU time limit"); - ampl_options_list->AddAmplOption("compl_inf_tol", - "compl_inf_tol", - AmplOptionsList::Number_Option, - "Acceptance threshold for the complementarity conditions"); - ampl_options_list->AddAmplOption("dual_inf_tol", - "dual_inf_tol", - AmplOptionsList::Number_Option, - "Desired threshold for the dual infeasibility"); - ampl_options_list->AddAmplOption("constr_viol_tol", - "constr_viol_tol", - AmplOptionsList::Number_Option, - "Desired threshold for the constraint violation"); - ampl_options_list->AddAmplOption("acceptable_tol", - "acceptable_tol", - AmplOptionsList::Number_Option, - "Acceptable convergence tolerance (relative)"); - ampl_options_list->AddAmplOption("acceptable_compl_inf_tol", - "acceptable_compl_inf_tol", - AmplOptionsList::Number_Option, - "Acceptance threshold for the complementarity conditions"); - ampl_options_list->AddAmplOption("acceptable_dual_inf_tol", - "acceptable_dual_inf_tol", - AmplOptionsList::Number_Option, - "Acceptance threshold for the dual infeasibility"); - ampl_options_list->AddAmplOption("acceptable_constr_viol_tol", - "acceptable_constr_viol_tol", - AmplOptionsList::Number_Option, - "Acceptance threshold for the constraint violation"); - - ampl_options_list->AddAmplOption("diverging_iterates_tol", - "diverging_iterates_tol", - AmplOptionsList::Number_Option, - "Threshold for maximal value of primal iterates"); - - // NLP scaling - ampl_options_list->AddAmplOption("obj_scaling_factor", - "obj_scaling_factor", - AmplOptionsList::Number_Option, - "Scaling factor for the objective function"); - ampl_options_list->AddAmplOption("nlp_scaling_method", - "nlp_scaling_method", - AmplOptionsList::String_Option, - "Select the technique used for scaling the NLP"); - ampl_options_list->AddAmplOption("nlp_scaling_max_gradient", - "nlp_scaling_max_gradient", - AmplOptionsList::Number_Option, - "Maximum gradient after scaling"); - - // NLP corrections - ampl_options_list->AddAmplOption("bound_relax_factor", - "bound_relax_factor", - AmplOptionsList::Number_Option, - "Factor for initial relaxation of the bounds"); - ampl_options_list->AddAmplOption("honor_original_bounds", - "honor_original_bounds", - AmplOptionsList::String_Option, - "If no, solution might slightly violate bounds"); - - // Barrier parameter - ampl_options_list->AddAmplOption("mu_strategy", - "mu_strategy", - AmplOptionsList::String_Option, - "Update strategy for barrier parameter"); - ampl_options_list->AddAmplOption("mu_oracle", - "mu_oracle", - AmplOptionsList::String_Option, - "Oracle for a new barrier parameter in the adaptive strategy"); - // Barrier parameter - ampl_options_list->AddAmplOption("mu_max", - "mu_max", - AmplOptionsList::Number_Option, - "Maximal value for barrier parameter for adaptive strategy"); - ampl_options_list->AddAmplOption("mu_init", - "mu_init", - AmplOptionsList::Number_Option, - "Initial value for the barrier parameter"); - - // Initialization - ampl_options_list->AddAmplOption("bound_frac", - "bound_frac", - AmplOptionsList::Number_Option, - "Desired minimal relative distance of initial point to bound"); - ampl_options_list->AddAmplOption("bound_push", - "bound_push", - AmplOptionsList::Number_Option, - "Desired minimal absolute distance of initial point to bound"); - ampl_options_list->AddAmplOption("slack_bound_frac", - "slack_bound_frac", - AmplOptionsList::Number_Option, - "Desired minimal relative distance of initial slack to bound"); - ampl_options_list->AddAmplOption("slack_bound_push", - "slack_bound_push", - AmplOptionsList::Number_Option, - "Desired minimal absolute distance of initial slack to bound"); - ampl_options_list->AddAmplOption("bound_mult_init_val", - "bound_mult_init_val", - AmplOptionsList::Number_Option, - "Initial value for the bound multipliers"); - ampl_options_list->AddAmplOption("constr_mult_init_max", - "constr_mult_init_max", - AmplOptionsList::Number_Option, - "Maximal allowed least-square guess of constraint multipliers"); - - // Multiplier updates - ampl_options_list->AddAmplOption("alpha_for_y", - "alpha_for_y", - AmplOptionsList::String_Option, - "Step size for constraint multipliers"); - - // Line search - ampl_options_list->AddAmplOption("max_soc", - "max_soc", - AmplOptionsList::Integer_Option, - "Maximal number of second order correction trial steps"); - ampl_options_list->AddAmplOption("watchdog_shortened_iter_trigger", - "watchdog_shortened_iter_trigger", - AmplOptionsList::Integer_Option, - "Trigger counter for watchdog procedure"); - - // Restoration phase - ampl_options_list->AddAmplOption("expect_infeasible_problem", - "expect_infeasible_problem", - AmplOptionsList::String_Option, - "Enable heuristics to quickly detect an infeasible problem"); - ampl_options_list->AddAmplOption("required_infeasibility_reduction", - "required_infeasibility_reduction", - AmplOptionsList::Number_Option, - "Required infeasibility reduction in restoration phase"); - - // Added for Warm-Start - ampl_options_list->AddAmplOption("warm_start_init_point", - "warm_start_init_point", - AmplOptionsList::String_Option, - "Enables to specify bound multiplier values"); - ampl_options_list->AddAmplOption("warm_start_bound_push", - "warm_start_bound_push", - AmplOptionsList::Number_Option, - "Enables to specify how much should variables should be pushed inside the feasible region"); - ampl_options_list->AddAmplOption("warm_start_mult_bound_push", - "warm_start_mult_bound_push", - AmplOptionsList::Number_Option, - "Enables to specify how much should bound multipliers should be pushed inside the feasible region"); - - // Quasi-Newton - ampl_options_list->AddAmplOption("hessian_approximation", - "hessian_approximation", - AmplOptionsList::String_Option, - "Can enable Quasi-Newton approximation of hessian"); - // Linear solver - ampl_options_list->AddAmplOption("linear_solver", - "linear_solver", - AmplOptionsList::String_Option, - "Linear solver to be used for step calculation"); - ampl_options_list->AddAmplOption("linear_system_scaling", - "linear_system_scaling", - AmplOptionsList::String_Option, - "Method for scaling the linear systems"); - ampl_options_list->AddAmplOption("linear_scaling_on_demand", - "linear_scaling_on_demand", - AmplOptionsList::String_Option, - "Enables heuristic for scaling only when seems required"); - ampl_options_list->AddAmplOption("max_refinement_steps", - "max_refinement_steps", - AmplOptionsList::Integer_Option, - "Maximal number of iterative refinement steps per linear system solve"); - ampl_options_list->AddAmplOption("min_refinement_steps", - "min_refinement_steps", - AmplOptionsList::Integer_Option, - "Minimum number of iterative refinement steps per linear system solve"); - - - // Quasi-Newton - ampl_options_list->AddAmplOption("hessian_approximation", - "hessian_approximation", - AmplOptionsList::String_Option, - "Can enable Quasi-Newton approximation of hessian"); - - // Special linear solver options - ampl_options_list->AddAmplOption("ma27_pivtol", - "ma27_pivtol", - AmplOptionsList::Number_Option, - "Pivot tolerance for the linear solver MA27"); - ampl_options_list->AddAmplOption("ma27_pivtolmax", - "ma27_pivtolmax", - AmplOptionsList::Number_Option, - "Maximal pivot tolerance for the linear solver MA27"); - - ampl_options_list->AddAmplOption("ma57_pivtol", - "ma57_pivtol", - AmplOptionsList::Number_Option, - "Pivot tolerance for the linear solver MA57"); - ampl_options_list->AddAmplOption("ma57_pivtolmax", - "ma57_pivtolmax", - AmplOptionsList::Number_Option, - "Maximal pivot tolerance for the linear solver MA57"); - ampl_options_list->AddAmplOption("ma57_pivot_order", - "ma57_pivot_order", - AmplOptionsList::Integer_Option, - "Controls pivot order in MA57"); - - ampl_options_list->AddAmplOption("pardiso_matching_strategy", - "pardiso_matching_strategy", - AmplOptionsList::String_Option, - "Matching strategy for linear solver Pardiso"); - //ampl_options_list->AddAmplOption("pardiso_out_of_core_power", - // "pardiso_out_of_core_power", - // AmplOptionsList::Integer_Option, - // "Enables out-of-core version of linear solver Pardiso"); + } + + // Output + ampl_options_list->AddAmplOption("print_level", "print_level", AmplOptionsList::Integer_Option, "Verbosity level"); + ampl_options_list->AddAmplOption("outlev", "print_level", AmplOptionsList::Integer_Option, "Verbosity level"); + ampl_options_list->AddAmplOption("print_user_options", "print_user_options", AmplOptionsList::String_Option, + "Toggle printing of user options"); + ampl_options_list->AddAmplOption("print_options_documentation", "print_options_documentation", + AmplOptionsList::String_Option, "Print all available options (for ipopt.opt)"); + ampl_options_list->AddAmplOption("output_file", "output_file", AmplOptionsList::String_Option, + "File name of an output file (leave unset for no file output)"); + ampl_options_list->AddAmplOption("file_print_level", "file_print_level", AmplOptionsList::Integer_Option, + "Verbosity level for output file"); + ampl_options_list->AddAmplOption("option_file_name", "option_file_name", AmplOptionsList::String_Option, + "File name of options file (default: ipopt.opt)"); + + // Termination + ampl_options_list->AddAmplOption("tol", "tol", AmplOptionsList::Number_Option, + "Desired convergence tolerance (relative)"); + ampl_options_list->AddAmplOption("max_iter", "max_iter", AmplOptionsList::Integer_Option, + "Maximum number of iterations"); + ampl_options_list->AddAmplOption("maxit", "max_iter", AmplOptionsList::Integer_Option, + "Maximum number of iterations"); + ampl_options_list->AddAmplOption("max_cpu_time", "max_cpu_time", AmplOptionsList::Number_Option, "CPU time limit"); + ampl_options_list->AddAmplOption("compl_inf_tol", "compl_inf_tol", AmplOptionsList::Number_Option, + "Acceptance threshold for the complementarity conditions"); + ampl_options_list->AddAmplOption("dual_inf_tol", "dual_inf_tol", AmplOptionsList::Number_Option, + "Desired threshold for the dual infeasibility"); + ampl_options_list->AddAmplOption("constr_viol_tol", "constr_viol_tol", AmplOptionsList::Number_Option, + "Desired threshold for the constraint violation"); + ampl_options_list->AddAmplOption("acceptable_tol", "acceptable_tol", AmplOptionsList::Number_Option, + "Acceptable convergence tolerance (relative)"); + ampl_options_list->AddAmplOption("acceptable_compl_inf_tol", "acceptable_compl_inf_tol", + AmplOptionsList::Number_Option, "Acceptance threshold for the complementarity conditions"); + ampl_options_list->AddAmplOption("acceptable_dual_inf_tol", "acceptable_dual_inf_tol", + AmplOptionsList::Number_Option, "Acceptance threshold for the dual infeasibility"); + ampl_options_list->AddAmplOption("acceptable_constr_viol_tol", "acceptable_constr_viol_tol", + AmplOptionsList::Number_Option, "Acceptance threshold for the constraint violation"); + + ampl_options_list->AddAmplOption("diverging_iterates_tol", "diverging_iterates_tol", AmplOptionsList::Number_Option, + "Threshold for maximal value of primal iterates"); + + // NLP scaling + ampl_options_list->AddAmplOption("obj_scaling_factor", "obj_scaling_factor", AmplOptionsList::Number_Option, + "Scaling factor for the objective function"); + ampl_options_list->AddAmplOption("nlp_scaling_method", "nlp_scaling_method", AmplOptionsList::String_Option, + "Select the technique used for scaling the NLP"); + ampl_options_list->AddAmplOption("nlp_scaling_max_gradient", "nlp_scaling_max_gradient", + AmplOptionsList::Number_Option, "Maximum gradient after scaling"); + + // NLP corrections + ampl_options_list->AddAmplOption("bound_relax_factor", "bound_relax_factor", AmplOptionsList::Number_Option, + "Factor for initial relaxation of the bounds"); + ampl_options_list->AddAmplOption("honor_original_bounds", "honor_original_bounds", AmplOptionsList::String_Option, + "If no, solution might slightly violate bounds"); + + // Barrier parameter + ampl_options_list->AddAmplOption("mu_strategy", "mu_strategy", AmplOptionsList::String_Option, + "Update strategy for barrier parameter"); + ampl_options_list->AddAmplOption("mu_oracle", "mu_oracle", AmplOptionsList::String_Option, + "Oracle for a new barrier parameter in the adaptive strategy"); + // Barrier parameter + ampl_options_list->AddAmplOption("mu_max", "mu_max", AmplOptionsList::Number_Option, + "Maximal value for barrier parameter for adaptive strategy"); + ampl_options_list->AddAmplOption("mu_init", "mu_init", AmplOptionsList::Number_Option, + "Initial value for the barrier parameter"); + + // Initialization + ampl_options_list->AddAmplOption("bound_frac", "bound_frac", AmplOptionsList::Number_Option, + "Desired minimal relative distance of initial point to bound"); + ampl_options_list->AddAmplOption("bound_push", "bound_push", AmplOptionsList::Number_Option, + "Desired minimal absolute distance of initial point to bound"); + ampl_options_list->AddAmplOption("slack_bound_frac", "slack_bound_frac", AmplOptionsList::Number_Option, + "Desired minimal relative distance of initial slack to bound"); + ampl_options_list->AddAmplOption("slack_bound_push", "slack_bound_push", AmplOptionsList::Number_Option, + "Desired minimal absolute distance of initial slack to bound"); + ampl_options_list->AddAmplOption("bound_mult_init_val", "bound_mult_init_val", AmplOptionsList::Number_Option, + "Initial value for the bound multipliers"); + ampl_options_list->AddAmplOption("constr_mult_init_max", "constr_mult_init_max", AmplOptionsList::Number_Option, + "Maximal allowed least-square guess of constraint multipliers"); + + // Multiplier updates + ampl_options_list->AddAmplOption("alpha_for_y", "alpha_for_y", AmplOptionsList::String_Option, + "Step size for constraint multipliers"); + + // Line search + ampl_options_list->AddAmplOption("max_soc", "max_soc", AmplOptionsList::Integer_Option, + "Maximal number of second order correction trial steps"); + ampl_options_list->AddAmplOption("watchdog_shortened_iter_trigger", "watchdog_shortened_iter_trigger", + AmplOptionsList::Integer_Option, "Trigger counter for watchdog procedure"); + + // Restoration phase + ampl_options_list->AddAmplOption("expect_infeasible_problem", "expect_infeasible_problem", + AmplOptionsList::String_Option, "Enable heuristics to quickly detect an infeasible problem"); + ampl_options_list->AddAmplOption("required_infeasibility_reduction", "required_infeasibility_reduction", + AmplOptionsList::Number_Option, "Required infeasibility reduction in restoration phase"); + + // Added for Warm-Start + ampl_options_list->AddAmplOption("warm_start_init_point", "warm_start_init_point", AmplOptionsList::String_Option, + "Enables to specify bound multiplier values"); + ampl_options_list->AddAmplOption("warm_start_bound_push", "warm_start_bound_push", AmplOptionsList::Number_Option, + "Enables to specify how much should variables should be pushed inside the feasible region"); + ampl_options_list->AddAmplOption("warm_start_mult_bound_push", "warm_start_mult_bound_push", + AmplOptionsList::Number_Option, + "Enables to specify how much should bound multipliers should be pushed inside the feasible region"); + + // Quasi-Newton + ampl_options_list->AddAmplOption("hessian_approximation", "hessian_approximation", AmplOptionsList::String_Option, + "Can enable Quasi-Newton approximation of hessian"); + // Linear solver + ampl_options_list->AddAmplOption("linear_solver", "linear_solver", AmplOptionsList::String_Option, + "Linear solver to be used for step calculation"); + ampl_options_list->AddAmplOption("linear_system_scaling", "linear_system_scaling", AmplOptionsList::String_Option, + "Method for scaling the linear systems"); + ampl_options_list->AddAmplOption("linear_scaling_on_demand", "linear_scaling_on_demand", + AmplOptionsList::String_Option, "Enables heuristic for scaling only when seems required"); + ampl_options_list->AddAmplOption("max_refinement_steps", "max_refinement_steps", AmplOptionsList::Integer_Option, + "Maximal number of iterative refinement steps per linear system solve"); + ampl_options_list->AddAmplOption("min_refinement_steps", "min_refinement_steps", AmplOptionsList::Integer_Option, + "Minimum number of iterative refinement steps per linear system solve"); + + // Quasi-Newton + ampl_options_list->AddAmplOption("hessian_approximation", "hessian_approximation", AmplOptionsList::String_Option, + "Can enable Quasi-Newton approximation of hessian"); + + // Special linear solver options + ampl_options_list->AddAmplOption("ma27_pivtol", "ma27_pivtol", AmplOptionsList::Number_Option, + "Pivot tolerance for the linear solver MA27"); + ampl_options_list->AddAmplOption("ma27_pivtolmax", "ma27_pivtolmax", AmplOptionsList::Number_Option, + "Maximal pivot tolerance for the linear solver MA27"); + + ampl_options_list->AddAmplOption("ma57_pivtol", "ma57_pivtol", AmplOptionsList::Number_Option, + "Pivot tolerance for the linear solver MA57"); + ampl_options_list->AddAmplOption("ma57_pivtolmax", "ma57_pivtolmax", AmplOptionsList::Number_Option, + "Maximal pivot tolerance for the linear solver MA57"); + ampl_options_list->AddAmplOption("ma57_pivot_order", "ma57_pivot_order", AmplOptionsList::Integer_Option, + "Controls pivot order in MA57"); + + ampl_options_list->AddAmplOption("pardiso_matching_strategy", "pardiso_matching_strategy", + AmplOptionsList::String_Option, "Matching strategy for linear solver Pardiso"); + //ampl_options_list->AddAmplOption("pardiso_out_of_core_power", + // "pardiso_out_of_core_power", + // AmplOptionsList::Integer_Option, + // "Enables out-of-core version of linear solver Pardiso"); #ifdef HAVE_WSMP - ampl_options_list->AddAmplOption("wsmp_num_threads", - "wsmp_num_threads", - AmplOptionsList::Integer_Option, - "Number of threads to be used in WSMP"); - ampl_options_list->AddAmplOption("wsmp_pivtol", - "wsmp_pivtol", - AmplOptionsList::Number_Option, - "Pivot tolerance for the linear solver WSMP"); - ampl_options_list->AddAmplOption("wsmp_pivtolmax", - "wsmp_pivtolmax", - AmplOptionsList::Number_Option, - "Maximum pivot tolerance for the linear solver WSMP"); - ampl_options_list->AddAmplOption("wsmp_scaling", - "wsmp_scaling", - AmplOptionsList::Integer_Option, - "Determines how the matrix is scaled by WSMP"); + ampl_options_list->AddAmplOption("wsmp_num_threads", + "wsmp_num_threads", + AmplOptionsList::Integer_Option, + "Number of threads to be used in WSMP"); + ampl_options_list->AddAmplOption("wsmp_pivtol", + "wsmp_pivtol", + AmplOptionsList::Number_Option, + "Pivot tolerance for the linear solver WSMP"); + ampl_options_list->AddAmplOption("wsmp_pivtolmax", + "wsmp_pivtolmax", + AmplOptionsList::Number_Option, + "Maximum pivot tolerance for the linear solver WSMP"); + ampl_options_list->AddAmplOption("wsmp_scaling", + "wsmp_scaling", + AmplOptionsList::Integer_Option, + "Determines how the matrix is scaled by WSMP"); #endif - // AMPL's wantsol option - ampl_options_list->AddAmplOption("wantsol", "", - AmplOptionsList::WS_Option, - WS_desc_ASL+5); - - // special AMPL option to exit when there is in error in the - // function evaluation - ampl_options_list->AddAmplOption("halt_on_ampl_error", "", - AmplOptionsList::HaltOnError_Option, - "Exit with message on evaluation error"); - - int n_options = ampl_options_list->NumberOfAmplOptions(); - - keyword* keywds = - (keyword*) ampl_options_list->Keywords(options, jnlst_, - (void**)&nerror_); - - static const char sname_default[] = "ipopt"; - static const char bsname_default[] = "Ipopt " IPOPT_VERSION; - static const char opname_default[] = "ipopt_options"; - const char* sname; - const char* bsname; - const char* opname; - if (ampl_option_string) { + // AMPL's wantsol option + // description was originally taken from WS_desc_ASL+5, but that didn't make it through DLL boundaries + ampl_options_list->AddAmplOption("wantsol", "", AmplOptionsList::WS_Option, + "solution report without -AMPL: sum of 1 (write .sol file), 2 (print primal variable values), 4 (print dual variable values), 8 (do not print solution message)"); + + // special AMPL option to exit when there is in error in the + // function evaluation + ampl_options_list->AddAmplOption("halt_on_ampl_error", "", AmplOptionsList::HaltOnError_Option, + "Exit with message on evaluation error"); + + int n_options = ampl_options_list->NumberOfAmplOptions(); + + keyword* keywds = (keyword*) ampl_options_list->Keywords(options, jnlst_, (void**) &nerror_); + + static const char sname_default[] = "ipopt"; + static const char bsname_default[] = "Ipopt " IPOPT_VERSION; + static const char opname_default[] = "ipopt_options"; + const char* sname; + const char* bsname; + const char* opname; + if( ampl_option_string ) + { opname = ampl_option_string; - } - else { + } + else + { opname = opname_default; - } - if (ampl_invokation_string) { + } + if( ampl_invokation_string ) + { sname = ampl_invokation_string; - } - else { + } + else + { sname = sname_default; - } - if (ampl_banner_string) { + } + if( ampl_banner_string ) + { bsname = ampl_banner_string; - } - else { + } + else + { bsname = bsname_default; - } - - DBG_ASSERT(!Oinfo_ptr_); - Option_Info* Oinfo = new Option_Info; - Oinfo->sname = new char[strlen(sname)+1]; - strcpy(Oinfo->sname, sname); - Oinfo->bsname = new char[strlen(bsname)+1]; - strcpy(Oinfo->bsname, bsname); - Oinfo->opname = new char[strlen(opname)+1]; - strcpy(Oinfo->opname, opname); - Oinfo->keywds = keywds; - Oinfo->n_keywds = n_options; - // Set the default for the remaining entries - Oinfo->flags = 0; - Oinfo->version = NULL; - Oinfo->usage = NULL; - Oinfo->kwf = NULL; - Oinfo->feq = NULL; - Oinfo->options = NULL; - Oinfo->n_options = 0; - Oinfo->driver_date = 0; - Oinfo->wantsol = 0; - Oinfo->nS = 0; - Oinfo->S = NULL; - Oinfo->uinfo = NULL; - Oinfo->asl = NULL; - Oinfo->eqsign = NULL; - Oinfo->n_badopts = 0; - Oinfo->option_echo = 0; - Oinfo->nnl = 0; - - Oinfo_ptr_ = Oinfo; - - char* stub = getstops(argv, Oinfo); - - return stub; - } - - bool AmplTNLP::nerror_ok(void* nerror) - { - DBG_START_METH("AmplTNLP::nerror_ok", - dbg_verbosity); - - if (nerror == NULL || *((fint*)nerror) == 0) { + } + + DBG_ASSERT(!Oinfo_ptr_); + Option_Info* Oinfo = new Option_Info; + Oinfo->sname = new char[strlen(sname) + 1]; + strcpy(Oinfo->sname, sname); + Oinfo->bsname = new char[strlen(bsname) + 1]; + strcpy(Oinfo->bsname, bsname); + Oinfo->opname = new char[strlen(opname) + 1]; + strcpy(Oinfo->opname, opname); + Oinfo->keywds = keywds; + Oinfo->n_keywds = n_options; + // Set the default for the remaining entries + Oinfo->flags = 0; + Oinfo->version = NULL; + Oinfo->usage = NULL; + Oinfo->kwf = NULL; + Oinfo->feq = NULL; + Oinfo->options = NULL; + Oinfo->n_options = 0; + Oinfo->driver_date = 0; + Oinfo->wantsol = 0; + Oinfo->nS = 0; + Oinfo->S = NULL; + Oinfo->uinfo = NULL; + Oinfo->asl = NULL; + Oinfo->eqsign = NULL; + Oinfo->n_badopts = 0; + Oinfo->option_echo = 0; + Oinfo->nnl = 0; + + Oinfo_ptr_ = Oinfo; + + char* stub = getstops(argv, Oinfo); + + return stub; +} + +bool AmplTNLP::nerror_ok( + void* nerror +) +{ + DBG_START_METH("AmplTNLP::nerror_ok", + dbg_verbosity); + + if( nerror == NULL || *((fint*) nerror) == 0 ) + { return true; - } - jnlst_->Printf(J_ERROR, J_MAIN, "Error in an AMPL evaluation. Run with \"halt_on_ampl_error yes\" to see details.\n"); - DBG_PRINT((1, "nerror = %d\n", *((fint*)nerror))); - return false; - } - - AmplSuffixHandler::AmplSuffixHandler() - : - asl_(NULL), - suftab_ (NULL) - {} - - AmplSuffixHandler::~AmplSuffixHandler() - { - if (suftab_) { - Index n = (Index)suffix_ids_.size(); - for (Index i=0; iPrintf(J_ERROR, J_MAIN, + "Error in an AMPL evaluation. Run with \"halt_on_ampl_error yes\" to see details.\n"); + DBG_PRINT((1, "nerror = %d\n", *((fint*)nerror))); + return false; +} + +AmplSuffixHandler::AmplSuffixHandler() + : asl_(NULL), + suftab_(NULL) +{ +} + +AmplSuffixHandler::~AmplSuffixHandler() +{ + if( suftab_ ) + { + Index n = (Index) suffix_ids_.size(); + for( Index i = 0; i < n; i++ ) + { + delete[] suftab_[i].name; + suftab_[i].name = NULL; + } + } + delete[] suftab_; + suftab_ = NULL; +} + +void AmplSuffixHandler::PrepareAmplForSuffixes( + ASL_pfgh* asl +) +{ + DBG_ASSERT(asl); + asl_ = asl; + + Index n = (Index) suffix_ids_.size(); + suftab_ = new SufDecl[n]; + for( Index i = 0; i < n; i++ ) + { + Index id_len = (Index) strlen(suffix_ids_[i].c_str()); suftab_[i].name = new char[id_len + 1]; strcpy(suftab_[i].name, suffix_ids_[i].c_str()); suftab_[i].table = 0; - if (suffix_sources_[i] == Variable_Source) { - suftab_[i].kind = ASL_Sufkind_var; + if( suffix_sources_[i] == Variable_Source ) + { + suftab_[i].kind = ASL_Sufkind_var; } - else if (suffix_sources_[i] == Constraint_Source) { - suftab_[i].kind = ASL_Sufkind_con; + else if( suffix_sources_[i] == Constraint_Source ) + { + suftab_[i].kind = ASL_Sufkind_con; } - else if (suffix_sources_[i] == Objective_Source) { - suftab_[i].kind = ASL_Sufkind_obj; + else if( suffix_sources_[i] == Objective_Source ) + { + suftab_[i].kind = ASL_Sufkind_obj; } - else if (suffix_sources_[i] == Problem_Source) { - suftab_[i].kind = ASL_Sufkind_prob; + else if( suffix_sources_[i] == Problem_Source ) + { + suftab_[i].kind = ASL_Sufkind_prob; } - else { - DBG_ASSERT(false && "Unknown suffix source in PrepareAmplForSuffixes"); + else + { + DBG_ASSERT(false && "Unknown suffix source in PrepareAmplForSuffixes"); } - if (suffix_types_[i] == Number_Type) { - suftab_[i].kind = suftab_[i].kind | ASL_Sufkind_real; + if( suffix_types_[i] == Number_Type ) + { + suftab_[i].kind = suftab_[i].kind | ASL_Sufkind_real; } suftab_[i].nextra = 0; - } + } - suf_declare(suftab_, n); - } + suf_declare(suftab_, n); +} - const Index* - AmplSuffixHandler::GetIntegerSuffixValues(std::string suffix_string, - Suffix_Source source) const - { - ASL_pfgh* asl = asl_; - DBG_ASSERT(asl); +const Index* +AmplSuffixHandler::GetIntegerSuffixValues( + std::string suffix_string, + Suffix_Source source +) const +{ + ASL_pfgh* asl = asl_; + DBG_ASSERT(asl); - int kind; - if (source == Variable_Source) { + int kind; + if( source == Variable_Source ) + { kind = ASL_Sufkind_var; - } - else if (source == Constraint_Source) { + } + else if( source == Constraint_Source ) + { kind = ASL_Sufkind_con; - } - else if (source == Objective_Source) { + } + else if( source == Objective_Source ) + { kind = ASL_Sufkind_obj; - } - else if (source == Problem_Source) { + } + else if( source == Problem_Source ) + { kind = ASL_Sufkind_prob; - } - else { + } + else + { kind = 0; DBG_ASSERT(false && "Unknown suffix source in GetIntegerSuffixValues"); - } - SufDesc* dp = suf_get(suffix_string.c_str(), kind); - return dp->u.i; - } - - std::vector - AmplSuffixHandler::GetIntegerSuffixValues(Index n, std::string suffix_string, - Suffix_Source source) const - { - std::vector ret; - const Index* ptr = GetIntegerSuffixValues(suffix_string, source); - if (ptr) { + } + SufDesc* dp = suf_get(suffix_string.c_str(), kind); + return dp->u.i; +} + +std::vector AmplSuffixHandler::GetIntegerSuffixValues( + Index n, + std::string suffix_string, + Suffix_Source source +) const +{ + std::vector ret; + const Index* ptr = GetIntegerSuffixValues(suffix_string, source); + if( ptr ) + { ret.reserve(n); - for (Index i=0; iu.r; - } - - std::vector - AmplSuffixHandler::GetNumberSuffixValues(Index n, std::string suffix_string, - Suffix_Source source) const - { - std::vector ret; - const Number* ptr = GetNumberSuffixValues(suffix_string, source); - if (ptr) { + } + SufDesc* dp = suf_get(suffix_string.c_str(), kind); + return dp->u.r; +} + +std::vector AmplSuffixHandler::GetNumberSuffixValues( + Index n, + std::string suffix_string, + Suffix_Source source) const +{ + std::vector ret; + const Number* ptr = GetNumberSuffixValues(suffix_string, source); + if( ptr ) + { ret.reserve(n); - for (Index i=0; i GetIntegerSuffixValues(Index n, std::string suffix_string, Suffix_Source source) const; - - std::vector GetNumberSuffixValues(Index n, std::string suffix_string, Suffix_Source source) const; - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - //AmplSuffixHandler(); - - /** Copy Constructor */ - AmplSuffixHandler(const AmplSuffixHandler&); - - /** Overloaded Equals Operator */ - void operator=(const AmplSuffixHandler&); - //@} - - mutable ASL_pfgh* asl_; - - SufDecl* suftab_; - - std::vector suffix_ids_; - std::vector suffix_types_; - std::vector suffix_sources_; - - /** Method called by AmplTNLP to prepare the asl for the suffixes */ - void PrepareAmplForSuffixes(ASL_pfgh* asl); - - /** Method called by AmplTNLP to retrieve the suffixes from asl */ - // void RetrieveSuffixesFromAmpl(ASL_pfgh* asl); - - friend class AmplTNLP; - }; - - /** Class for storing a number of AMPL options that should be - * registered to the AMPL Solver library interface */ - class AmplOptionsList : public ReferencedObject - { - public: - enum AmplOptionType { + } + + const Index* GetIntegerSuffixValues( + std::string suffix_string, + Suffix_Source source + ) const; + + const Number* GetNumberSuffixValues( + std::string suffix_string, + Suffix_Source source + ) const; + + std::vector GetIntegerSuffixValues( + Index n, + std::string suffix_string, + Suffix_Source source + ) const; + + std::vector GetNumberSuffixValues( + Index n, + std::string suffix_string, + Suffix_Source source + ) const; + +private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. + */ + //@{ + /** Default Constructor */ + //AmplSuffixHandler(); + /** Copy Constructor */ + AmplSuffixHandler( + const AmplSuffixHandler& + ); + + /** Default Assignment Operator */ + void operator=( + const AmplSuffixHandler& + ); + //@} + + mutable ASL_pfgh* asl_; + + SufDecl* suftab_; + + std::vector suffix_ids_; + std::vector suffix_types_; + std::vector suffix_sources_; + + /** Method called by AmplTNLP to prepare the asl for the suffixes */ + void PrepareAmplForSuffixes( + ASL_pfgh* asl + ); + + /** Method called by AmplTNLP to retrieve the suffixes from asl */ + // void RetrieveSuffixesFromAmpl(ASL_pfgh* asl); + friend class AmplTNLP; +}; + +/** Class for storing a number of AMPL options that should be + * registered to the AMPL Solver library interface + */ +class IPOPTAMPLINTERFACELIB_EXPORT AmplOptionsList: public ReferencedObject +{ +public: + enum AmplOptionType + { String_Option, Number_Option, Integer_Option, - WS_Option, /* this is for AMPL's internal wantsol callback */ - HaltOnError_Option /* this is for our setting of the nerror_ member */ - }; - - /** Ampl Option class, contains name, type and description for an - * AMPL option */ - class AmplOption : public ReferencedObject - { - public: - AmplOption(const std::string ipopt_option_name, - AmplOptionType type, - const std::string description); + WS_Option, /**< this is for AMPL's internal wantsol callback */ + HaltOnError_Option /**< this is for our setting of the nerror_ member */ + }; + + /** Ampl Option class containing name, type and description for an AMPL option */ + class IPOPTAMPLINTERFACELIB_EXPORT AmplOption: public ReferencedObject + { + public: + AmplOption( + const std::string ipopt_option_name, + AmplOptionType type, + const std::string description); ~AmplOption() { - delete [] description_; + delete[] description_; } const std::string& IpoptOptionName() const { - return ipopt_option_name_; + return ipopt_option_name_; } AmplOptionType Type() const { - return type_; + return type_; } char* Description() const { - return description_; + return description_; } - private: + private: /**@name Default Compiler Generated Methods * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and + * + * These methods are not implemented and * we do not want the compiler to implement * them for us, so we declare them private * and do not define them. This ensures that - * they will not be implicitly created/called. */ + * they will not be implicitly created/called. + */ //@{ /** Default Constructor */ AmplOption(); /** Copy Constructor */ - AmplOption(const AmplOption&); + AmplOption( + const AmplOption&); - /** Overloaded Equals Operator */ - void operator=(const AmplOption&); + /** Default Assignment Operator */ + void operator=( + const AmplOption&); //@} const std::string ipopt_option_name_; const AmplOptionType type_; char* description_; - }; - - class PrivatInfo - { - public: - PrivatInfo(const std::string ipopt_name, - SmartPtr options, - SmartPtr jnlst, - void** nerror = NULL) - : - ipopt_name_(ipopt_name), - options_(options), - jnlst_(jnlst), - nerror_(nerror) - {} + }; + + class PrivatInfo + { + public: + PrivatInfo( + const std::string ipopt_name, + SmartPtr options, + SmartPtr jnlst, + void** nerror = NULL + ) + : ipopt_name_(ipopt_name), + options_(options), + jnlst_(jnlst), + nerror_(nerror) + { + } const std::string& IpoptName() const { - return ipopt_name_; + return ipopt_name_; } const SmartPtr& Options() const { - return options_; + return options_; } const SmartPtr& Jnlst() const { - return jnlst_; + return jnlst_; } void** NError() { - return nerror_; + return nerror_; } - private: + private: const std::string ipopt_name_; const SmartPtr options_; const SmartPtr jnlst_; void** nerror_; - }; + }; - public: - /** Default Constructor */ - AmplOptionsList() - : - keywds_(NULL), +public: + /** Default Constructor */ + AmplOptionsList() + : keywds_(NULL), nkeywds_(0) - {} - - /** Destructor */ - ~AmplOptionsList(); - - /** Adding a new AMPL Option */ - void AddAmplOption(const std::string ampl_option_name, - const std::string ipopt_option_name, - AmplOptionsList::AmplOptionType type, - const std::string description) - { - SmartPtr new_option = - new AmplOption(ipopt_option_name, type, description); + { } + + /** Destructor */ + ~AmplOptionsList(); + + /** Adding a new AMPL Option */ + void AddAmplOption( + const std::string ampl_option_name, + const std::string ipopt_option_name, + AmplOptionsList::AmplOptionType type, + const std::string description + ) + { + SmartPtr new_option = new AmplOption(ipopt_option_name, type, description); ampl_options_map_[ampl_option_name] = ConstPtr(new_option); - } - - /** Number of AMPL Options */ - Index NumberOfAmplOptions() - { - return (Index)ampl_options_map_.size(); - } - - /** ASL keywords list for the stored options. */ - void* Keywords(const SmartPtr& options, - SmartPtr jnlst, - void** nerror); - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - //AmplOptionsList(); - - /** Copy Constructor */ - AmplOptionsList(const AmplOptionsList&); - - /** Overloaded Equals Operator */ - void operator=(const AmplOptionsList&); - //@} - - void MakeValidLatexString(std::string source, std::string& dest) const; - - void PrintLatex(SmartPtr jnlst); - - /** map for storing registered AMPL options */ - std::map > ampl_options_map_; - // AW: I think it should be with const like in the following line - // but with const the AIX compiler fails - // std::map > ampl_options_map_; - - /** pointer to the keywords */ - void* keywds_; - - /** Number of entries stored in keywds_ */ - Index nkeywds_; - }; - - /** Ampl Interface. - * Ampl Interface, implemented as a TNLP. - */ - class AmplTNLP : public TNLP - { - public: - /**@name Constructors/Destructors */ - //@{ - /** Constructor. */ - AmplTNLP(const SmartPtr& jnlst, - const SmartPtr options, - char**& argv, SmartPtr - suffix_handler = NULL, bool allow_discrete = false, - SmartPtr ampl_options_list = NULL, - const char* ampl_option_string = NULL, - const char* ampl_invokation_string = NULL, - const char* ampl_banner_string = NULL, - std::string* nl_file_content = NULL); - - /** Default destructor */ - virtual ~AmplTNLP(); - //@} - - /** Exceptions */ - DECLARE_STD_EXCEPTION(NONPOSITIVE_SCALING_FACTOR); - - /**@name methods to gather information about the NLP. These - * methods are overloaded from TNLP. See TNLP for their more - * detailed documentation. */ - //@{ - /** returns dimensions of the nlp. Overloaded from TNLP */ - virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, - Index& nnz_h_lag, IndexStyleEnum& index_style); - - /** returns names and other meta data for the variables and constraints - * Overloaded from TNLP */ - virtual bool get_var_con_metadata(Index n, - StringMetaDataMapType& var_string_md, - IntegerMetaDataMapType& var_integer_md, - NumericMetaDataMapType& var_numeric_md, - Index m, - StringMetaDataMapType& con_string_md, - IntegerMetaDataMapType& con_integer_md, - NumericMetaDataMapType& con_numeric_md); - - /** returns bounds of the nlp. Overloaded from TNLP */ - virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u, - Index m, Number* g_l, Number* g_u); - - /** Returns the constraint linearity. - * array will be alocated with length n. (default implementation - * just return false and does not fill the array). */ - virtual bool get_constraints_linearity(Index m, - LinearityType* const_types); - - /** provides a starting point for the nlp variables. Overloaded - from TNLP */ - virtual bool get_starting_point(Index n, bool init_x, Number* x, - bool init_z, Number* z_L, Number* z_U, - Index m, bool init_lambda, Number* lambda); - - /** evaluates the objective value for the nlp. Overloaded from TNLP */ - virtual bool eval_f(Index n, const Number* x, bool new_x, - Number& obj_value); - - /** evaluates the gradient of the objective for the - nlp. Overloaded from TNLP */ - virtual bool eval_grad_f(Index n, const Number* x, bool new_x, - Number* grad_f); - - /** evaluates the constraint residuals for the nlp. Overloaded from TNLP */ - virtual bool eval_g(Index n, const Number* x, bool new_x, - Index m, Number* g); - - /** specifies the jacobian structure (if values is NULL) and - * evaluates the jacobian values (if values is not NULL) for the - * nlp. Overloaded from TNLP */ - virtual bool eval_jac_g(Index n, const Number* x, bool new_x, - Index m, Index nele_jac, Index* iRow, - Index *jCol, Number* values); - - /** specifies the structure of the hessian of the lagrangian (if - * values is NULL) and evaluates the values (if values is not - * NULL). Overloaded from TNLP */ - virtual bool eval_h(Index n, const Number* x, bool new_x, - Number obj_factor, Index m, const Number* lambda, - bool new_lambda, Index nele_hess, Index* iRow, - Index* jCol, Number* values); - - /** retrieve the scaling parameters for the variables, objective - * function, and constraints. */ - virtual bool get_scaling_parameters(Number& obj_scaling, - bool& use_x_scaling, Index n, - Number* x_scaling, - bool& use_g_scaling, Index m, - Number* g_scaling); - //@} - - /** @name Solution Methods */ - //@{ - virtual void finalize_solution(SolverReturn status, - Index n, const Number* x, const Number* z_L, const Number* z_U, - Index m, const Number* g, const Number* lambda, - Number obj_value, - const IpoptData* ip_data, - IpoptCalculatedQuantities* ip_cq); - //@} - - /** @name Method for quasi-Newton approximation information. */ - //@{ - virtual Index get_number_of_nonlinear_variables(); - virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars, - Index* pos_nonlin_vars); - //@} - - - /**@name Ampl specific methods */ - //@{ - /** Return the ampl solver object (ASL*) */ - ASL_pfgh* AmplSolverObject() - { + } + + /** Number of AMPL Options */ + Index NumberOfAmplOptions() + { + return (Index) ampl_options_map_.size(); + } + + /** ASL keywords list for the stored options. */ + void* Keywords( + const SmartPtr& options, + SmartPtr jnlst, + void** nerror + ); + +private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. + */ + //@{ + /** Default Constructor */ + //AmplOptionsList(); + /** Copy Constructor */ + AmplOptionsList( + const AmplOptionsList& + ); + + /** Default Assignment Operator */ + void operator=( + const AmplOptionsList& + ); + //@} + + void MakeValidLatexString( + std::string source, + std::string& dest + ) const; + + void PrintLatex( + SmartPtr jnlst + ); + + void PrintDoxygen( + SmartPtr jnlst + ); + + /** map for storing registered AMPL options */ + std::map > ampl_options_map_; + // AW: I think it should be with const like in the following line + // but with const the AIX compiler fails + // std::map > ampl_options_map_; + + /** pointer to the keywords */ + void* keywds_; + + /** Number of entries stored in keywds_ */ + Index nkeywds_; +}; + +/** Ampl Interface, implemented as a TNLP. */ +class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP +{ +public: + /**@name Constructors/Destructors */ + //@{ + /** Constructor. */ + AmplTNLP( + const SmartPtr& jnlst, + const SmartPtr options, + char**& argv, + SmartPtr suffix_handler = NULL, + bool allow_discrete = false, + SmartPtr ampl_options_list = NULL, + const char* ampl_option_string = NULL, + const char* ampl_invokation_string = NULL, + const char* ampl_banner_string = NULL, + std::string* nl_file_content = NULL + ); + + /** Default destructor */ + virtual ~AmplTNLP(); + //@} + + /** Exceptions */ + DECLARE_STD_EXCEPTION(NONPOSITIVE_SCALING_FACTOR); + + /**@name methods to gather information about the NLP */ + //@{ + virtual bool get_nlp_info( + Index& n, + Index& m, + Index& nnz_jac_g, + Index& nnz_h_lag, + IndexStyleEnum& index_style + ); + + virtual bool get_var_con_metadata( + Index n, + StringMetaDataMapType& var_string_md, + IntegerMetaDataMapType& var_integer_md, + NumericMetaDataMapType& var_numeric_md, + Index m, + StringMetaDataMapType& con_string_md, + IntegerMetaDataMapType& con_integer_md, + NumericMetaDataMapType& con_numeric_md + ); + + /** returns bounds of the nlp. Overloaded from TNLP */ + virtual bool get_bounds_info( + Index n, + Number* x_l, + Number* x_u, + Index m, + Number* g_l, + Number* g_u + ); + + virtual bool get_constraints_linearity( + Index m, + LinearityType* const_types + ); + + virtual bool get_starting_point( + Index n, + bool init_x, + Number* x, + bool init_z, + Number* z_L, + Number* z_U, + Index m, + bool init_lambda, + Number* lambda + ); + + virtual bool eval_f( + Index n, + const Number* x, + bool new_x, + Number& obj_value + ); + + virtual bool eval_grad_f( + Index n, + const Number* x, + bool new_x, + Number* grad_f + ); + + virtual bool eval_g( + Index n, + const Number* x, + bool new_x, + Index m, + Number* g + ); + + virtual bool eval_jac_g( + Index n, + const Number* x, + bool new_x, + Index m, + Index nele_jac, + Index* iRow, + Index* jCol, + Number* values + ); + + virtual bool eval_h( + Index n, + const Number* x, + bool new_x, + Number obj_factor, + Index m, + const Number* lambda, + bool new_lambda, + Index nele_hess, + Index* iRow, + Index* jCol, + Number* values + ); + + virtual bool get_scaling_parameters( + Number& obj_scaling, + bool& use_x_scaling, + Index n, + Number* x_scaling, + bool& use_g_scaling, + Index m, + Number* g_scaling + ); + //@} + + /** @name Solution Methods */ + //@{ + virtual void finalize_solution( + SolverReturn status, + Index n, + const Number* x, + const Number* z_L, + const Number* z_U, + Index m, + const Number* g, + const Number* lambda, + Number obj_value, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq + ); + //@} + + /** @name Method for quasi-Newton approximation information. */ + //@{ + virtual Index get_number_of_nonlinear_variables(); + virtual bool get_list_of_nonlinear_variables( + Index num_nonlin_vars, + Index* pos_nonlin_vars + ); + //@} + + /**@name Ampl specific methods */ + //@{ + /** Return the ampl solver object (ASL*) */ + ASL_pfgh* AmplSolverObject() + { return asl_; - } - - /** Write the solution file. This is a wrapper for AMPL's - * write_sol. TODO Maybe this should be at a different place, or - * collect the numbers itself? */ - void write_solution_file(const std::string& message) const; - - /** ampl orders the variables like (continuous, binary, integer). - * This method gives the number of binary and integer variables. - * For details, see Tables 3 and 4 in "Hooking Your Solver to - * AMPL" - */ - void get_discrete_info(Index& nlvb_, - Index& nlvbi_, - Index& nlvc_, - Index& nlvci_, - Index& nlvo_, - Index& nlvoi_, - Index& nbv_, - Index& niv_) const; - //@} - - /** A method for setting the index of the objective function to be - * considered. This method must be called after the constructor, - * and before anything else is called. It can only be called - * once, and if there is more than one objective function in the - * AMPL model, it MUST be called. */ - void set_active_objective(Index obj_no); - - /**@name Methods to set meta data for the variables - * and constraints. These values will be passed on - * to the TNLP in get_var_con_meta_data - */ - //@{ - void set_string_metadata_for_var(std::string tag, std::vector meta_data) - { + } + + /** Write the solution file. + * + * This is a wrapper for AMPL's write_sol. + * @todo Maybe this should be at a different place, or collect the numbers itself? + */ + void write_solution_file( + const std::string& message + ) const; + + /** Give the number of binary and integer variables. + * + * AMPL orders the variables like (continuous, binary, integer). + * For details, see Tables 3 and 4 in "Hooking Your Solver to AMPL" + */ + void get_discrete_info( + Index& nlvb_, + Index& nlvbi_, + Index& nlvc_, + Index& nlvci_, + Index& nlvo_, + Index& nlvoi_, + Index& nbv_, + Index& niv_ + ) const; + //@} + + /** A method for setting the index of the objective function to be + * considered. + * + * This method must be called after the constructor, + * and before anything else is called. It can only be called + * once, and if there is more than one objective function in the + * AMPL model, it MUST be called. + */ + void set_active_objective( + Index obj_no + ); + + /**@name Methods to set meta data for the variables and constraints. + * + * These values will be passed on to the TNLP in get_var_con_meta_data. + */ + //@{ + void set_string_metadata_for_var( + std::string tag, + std::vector meta_data) + { var_string_md_[tag] = meta_data; - } + } - void set_integer_metadata_for_var(std::string tag, std::vector meta_data) - { + void set_integer_metadata_for_var( + std::string tag, + std::vector meta_data) + { var_integer_md_[tag] = meta_data; - } + } - void set_numeric_metadata_for_var(std::string tag, std::vector meta_data) - { + void set_numeric_metadata_for_var( + std::string tag, + std::vector meta_data) + { var_numeric_md_[tag] = meta_data; - } + } - void set_string_metadata_for_con(std::string tag, std::vector meta_data) - { + void set_string_metadata_for_con( + std::string tag, + std::vector meta_data) + { con_string_md_[tag] = meta_data; - } + } - void set_integer_metadata_for_con(std::string tag, std::vector meta_data) - { + void set_integer_metadata_for_con( + std::string tag, + std::vector meta_data) + { con_integer_md_[tag] = meta_data; - } + } - void set_numeric_metadata_for_con(std::string tag, std::vector meta_data) - { + void set_numeric_metadata_for_con( + std::string tag, + std::vector meta_data) + { con_numeric_md_[tag] = meta_data; - } - //@} + } + //@} - /** Method for returning the suffix handler */ - SmartPtr get_suffix_handler() - { + /** Method for returning the suffix handler */ + SmartPtr get_suffix_handler() + { return suffix_handler_; - } - - private: - /**@name Default Compiler Generated Methods - * (Hidden to avoid implicit creation/calling). - * These methods are not implemented and - * we do not want the compiler to implement - * them for us, so we declare them private - * and do not define them. This ensures that - * they will not be implicitly created/called. */ - //@{ - /** Default Constructor */ - AmplTNLP(); - - /** Copy Constructor */ - AmplTNLP(const AmplTNLP&); - - /** Overloaded Equals Operator */ - void operator=(const AmplTNLP&); - //@} - - /** Journlist */ - SmartPtr jnlst_; - - /** pointer to the main ASL structure */ - ASL_pfgh* asl_; - - /** Sign of the objective fn (1 for min, -1 for max) */ - double obj_sign_; - - /**@name Problem Size Data*/ - //@{ - Index nz_h_full_; // number of nonzeros in the full_x hessian - /* the rest of the problem size data is available easily through the ampl variables */ - //@} - - /**@name Internal copies of data */ - //@{ - /** Solution Vectors */ - Number* x_sol_; - Number* z_L_sol_; - Number* z_U_sol_; - Number* g_sol_; - Number* lambda_sol_; - Number obj_sol_; - //@} - - /**@name Flags to track internal state */ - //@{ - /** true when the objective value has been calculated with the - * current x, set to false in apply_new_x, and set to true in - * internal_objval */ - bool objval_called_with_current_x_; - /** true when the constraint values have been calculated with the - * current x, set to false in apply_new_x, and set to true in - * internal_conval */ - bool conval_called_with_current_x_; - /** true when we have called hesset */ - bool hesset_called_; - /** true when set_active_objective has been called */ - bool set_active_objective_called_; - //@} - - /** Pointer to the Oinfo structure */ - void* Oinfo_ptr_; - - /** nerror flag passed to ampl calls - set to NULL to halt on error */ - void* nerror_; - - /** Suffix Handler */ - SmartPtr suffix_handler_; - - /** Make the objective call to ampl */ - bool internal_objval(const Number* x, Number& obj_val); - - /** Make the constraint call to ampl*/ - bool internal_conval(const Number* x, Index m, Number* g=NULL); - - /** Internal function to update the internal and ampl state if the - * x value changes */ - bool apply_new_x(bool new_x, Index n, const Number* x); - - /** Method for obtaining the name of the NL file and the options - * set from AMPL. Returns a pointer to a char* with the name of - * the stub */ - char* get_options(const SmartPtr& options, - SmartPtr& ampl_options_list, - const char* ampl_option_string, - const char* ampl_invokation_string, - const char* ampl_banner_string, char**& argv); - - /** returns true if the ampl nerror code is ok */ - bool nerror_ok(void* nerror); - - /** calls hesset ASL function */ - void call_hesset(); - - /** meta data to pass on to TNLP */ - StringMetaDataMapType var_string_md_; - IntegerMetaDataMapType var_integer_md_; - NumericMetaDataMapType var_numeric_md_; - StringMetaDataMapType con_string_md_; - IntegerMetaDataMapType con_integer_md_; - NumericMetaDataMapType con_numeric_md_; - }; - - + } + +private: + /**@name Default Compiler Generated Methods + * (Hidden to avoid implicit creation/calling). + * + * These methods are not implemented and + * we do not want the compiler to implement + * them for us, so we declare them private + * and do not define them. This ensures that + * they will not be implicitly created/called. + */ + //@{ + /** Default Constructor */ + AmplTNLP(); + + /** Copy Constructor */ + AmplTNLP( + const AmplTNLP& + ); + + /** Default Assignment Operator */ + void operator=( + const AmplTNLP& + ); + //@} + + /** Journalist */ + SmartPtr jnlst_; + + /** pointer to the main ASL structure */ + ASL_pfgh* asl_; + + /** Sign of the objective fn (1 for min, -1 for max) */ + double obj_sign_; + + /**@name Problem Size Data*/ + //@{ + /** number of nonzeros in the full_x Hessian */ + Index nz_h_full_; + /* the rest of the problem size data is available easily through the ampl variables */ + //@} + /**@name Internal copies of solution vectors */ + //@{ + Number* x_sol_; + Number* z_L_sol_; + Number* z_U_sol_; + Number* g_sol_; + Number* lambda_sol_; + Number obj_sol_; + //@} + + /**@name Flags to track internal state */ + //@{ + /** whether the objective value has been calculated with the current x + * + * set to false in apply_new_x, and set to true in internal_objval + */ + bool objval_called_with_current_x_; + /** whether the constraint values have been calculated with the current x + * set to false in apply_new_x, and set to true in internal_conval + */ + bool conval_called_with_current_x_; + /** whether we have called hesset */ + bool hesset_called_; + /** whether set_active_objective has been called */ + bool set_active_objective_called_; + //@} + + /** Pointer to the Oinfo structure */ + void* Oinfo_ptr_; + + /** nerror flag passed to ampl calls - set to NULL to halt on error */ + void* nerror_; + + /** Suffix Handler */ + SmartPtr suffix_handler_; + + /** Make the objective call to ampl */ + bool internal_objval( + const Number* x, + Number& obj_val + ); + + /** Make the constraint call to ampl*/ + bool internal_conval( + const Number* x, + Index m, + Number* g = NULL + ); + + /** Internal function to update the internal and ampl state if the + * x value changes + */ + bool apply_new_x( + bool new_x, + Index n, + const Number* x + ); + + /** Method for obtaining the name of the NL file and the options + * set from AMPL + * + * @return a pointer to a char* with the name of the stub + */ + char* get_options( + const SmartPtr& options, + SmartPtr& ampl_options_list, + const char* ampl_option_string, + const char* ampl_invokation_string, + const char* ampl_banner_string, + char**& argv + ); + + /** whether the ampl nerror code is ok */ + bool nerror_ok( + void* nerror + ); + + /** calls hesset ASL function */ + void call_hesset(); + + /** meta data to pass on to TNLP */ + StringMetaDataMapType var_string_md_; + IntegerMetaDataMapType var_integer_md_; + NumericMetaDataMapType var_numeric_md_; + StringMetaDataMapType con_string_md_; + IntegerMetaDataMapType con_integer_md_; + NumericMetaDataMapType con_numeric_md_; +}; } // namespace Ipopt diff --git a/src/Apps/AmplSolver/ampl_ipopt.cpp b/src/Apps/AmplSolver/ampl_ipopt.cpp index ced11db90..ae76b7645 100644 --- a/src/Apps/AmplSolver/ampl_ipopt.cpp +++ b/src/Apps/AmplSolver/ampl_ipopt.cpp @@ -2,84 +2,104 @@ // All Rights Reserved. // This code is published under the Eclipse Public License. // -// $Id$ -// // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 #include "AmplTNLP.hpp" #include "IpIpoptApplication.hpp" - #include "IpoptConfig.h" -# include -# include +#include +#include -int main(int argc, char**args) +int main( + int argc, + char** args) { - using namespace Ipopt; + using namespace Ipopt; - SmartPtr app = IpoptApplicationFactory(); - app->RethrowNonIpoptException(false); + SmartPtr app = IpoptApplicationFactory(); + app->RethrowNonIpoptException(false); - // Check if executable is run only to print out options documentation - if (argc == 2) { - bool print_options = false; - bool print_latex_options = false; - if (!strcmp(args[1],"--print-options")) { - print_options = true; - } - else if (!strcmp(args[1],"--print-latex-options")) { - print_options = true; - print_latex_options = true; - } - if (print_options) { - SmartPtr options = app->Options(); - options->SetStringValue("print_options_documentation", "yes"); - if (print_latex_options) { - options->SetStringValue("print_options_latex_mode", "yes"); + // Check if executable is run only to print out options documentation + if( argc == 2 ) + { + bool print_options = false; + std::string print_options_mode("text"); + if( !strcmp(args[1], "--print-options=latex") ) + { + print_options = true; + print_options_mode = "latex"; + } + else if( !strcmp(args[1], "--print-options=doxygen") ) + { + print_options = true; + print_options_mode = "doxygen"; + } + else if( !strcmp(args[1], "--print-options") ) + { + print_options = true; } - app->Initialize(""); - return 0; - } - } + else if( !strcmp(args[1], "--print-latex-options") ) + { + fprintf(stderr, "ampl_ipopt.cpp: Options --print-latex-options has been replaced by --print-options=latex. Please adjust your call.\n"); + exit(-200); + } + if( print_options ) + { + SmartPtr options = app->Options(); + options->SetStringValue("print_options_documentation", "yes"); + options->SetStringValue("print_options_mode", print_options_mode); + app->Initialize(""); + return 0; + } + } - // Call Initialize the first time to create a journalist, but ignore - // any options file - ApplicationReturnStatus retval; - retval = app->Initialize(""); - if (retval != Solve_Succeeded) { - printf("ampl_ipopt.cpp: Error in first Initialize!!!!\n"); - exit(-100); - } + // Call Initialize the first time to create a journalist, but ignore + // any options file + ApplicationReturnStatus retval; + retval = app->Initialize(""); + if( retval != Solve_Succeeded ) + { + printf("ampl_ipopt.cpp: Error in first Initialize!!!!\n"); + exit(-100); + } - // Add the suffix handler for scaling - SmartPtr suffix_handler = new AmplSuffixHandler(); - suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Objective_Source, AmplSuffixHandler::Number_Type); - // Modified for warm-start from AMPL - suffix_handler->AddAvailableSuffix("ipopt_zL_out", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("ipopt_zU_out", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("ipopt_zL_in", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); - suffix_handler->AddAvailableSuffix("ipopt_zU_in", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type); + // Add the suffix handler for scaling + SmartPtr suffix_handler = new AmplSuffixHandler(); + suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Variable_Source, + AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Constraint_Source, + AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("scaling_factor", AmplSuffixHandler::Objective_Source, + AmplSuffixHandler::Number_Type); + // Modified for warm-start from AMPL + suffix_handler->AddAvailableSuffix("ipopt_zL_out", AmplSuffixHandler::Variable_Source, + AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("ipopt_zU_out", AmplSuffixHandler::Variable_Source, + AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("ipopt_zL_in", AmplSuffixHandler::Variable_Source, + AmplSuffixHandler::Number_Type); + suffix_handler->AddAvailableSuffix("ipopt_zU_in", AmplSuffixHandler::Variable_Source, + AmplSuffixHandler::Number_Type); - SmartPtr ampl_tnlp = new AmplTNLP(ConstPtr(app->Jnlst()), - app->Options(), - args, suffix_handler); + SmartPtr ampl_tnlp = new AmplTNLP(ConstPtr(app->Jnlst()), app->Options(), args, suffix_handler); - // Call Initialize again to process output related options - retval = app->Initialize(); - if (retval != Solve_Succeeded) { - printf("ampl_ipopt.cpp: Error in second Initialize!!!!\n"); - exit(-101); - } + // Call Initialize again to process output related options + retval = app->Initialize(); + if( retval != Solve_Succeeded ) + { + printf("ampl_ipopt.cpp: Error in second Initialize!!!!\n"); + exit(-101); + } - const int n_loops = 1; // make larger for profiling - for (Index i=0; iOptimizeTNLP(ampl_tnlp); - } + const int n_loops = 1; // make larger for profiling + for( Index i = 0; i < n_loops; i++ ) + { + retval = app->OptimizeTNLP(ampl_tnlp); + } - // finalize_solution method in AmplTNLP writes the solution file + // finalize_solution method in AmplTNLP writes the solution file - return 0; + return 0; } + From bdda7d9e7db7d862fe24399c7f05ba719191ce87 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Sun, 29 Mar 2020 19:43:35 -0400 Subject: [PATCH 22/28] Update Dependencies --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 739a68fdb..ad8cfdf4b 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/idaes/ThirdParty-ASL stable/1.4 +ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/1.4 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From c95b5c90f202c0a4787a618d2f9d7659ebfdc452 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Thu, 2 Apr 2020 12:46:02 -0400 Subject: [PATCH 23/28] Update Dependencies --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index f5a03ab1a..e40290c8c 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/1.4 +ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From df8bc1e23739faece1a0b22de1f694dbe914c6fd Mon Sep 17 00:00:00 2001 From: John Eslick Date: Thu, 2 Apr 2020 12:46:32 -0400 Subject: [PATCH 24/28] Update Dependencies --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index ad8cfdf4b..216188b8c 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/1.4 +ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From 9b259581c681d7ccaaac5071ae5b2d0d372a4635 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Thu, 2 Apr 2020 13:18:47 -0400 Subject: [PATCH 25/28] Update Dependencies --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 216188b8c..502d93071 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 +ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL master ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From bf3a448b433ed4cebd1603c1aeddaaedd8137fa3 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Fri, 3 Apr 2020 10:09:10 -0400 Subject: [PATCH 26/28] Update Dependencies --- .coin-or/Dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coin-or/Dependencies b/.coin-or/Dependencies index 502d93071..216188b8c 100644 --- a/.coin-or/Dependencies +++ b/.coin-or/Dependencies @@ -1,4 +1,4 @@ -ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL master +ThirdParty/ASL https://github.com/coin-or-tools/ThirdParty-ASL stable/2.0 ThirdParty/Metis https://github.com/coin-or-tools/ThirdParty-Metis stable/2.0 ThirdParty/HSL https://github.com/coin-or-tools/ThirdParty-HSL stable/2.0 ThirdParty/Mumps https://github.com/coin-or-tools/ThirdParty-Mumps stable/2.0 From d8758549a984218b101e4dd6d7a38a14c23cbf7a Mon Sep 17 00:00:00 2001 From: John Eslick Date: Fri, 26 Feb 2021 21:58:42 -0700 Subject: [PATCH 27/28] Update Makefile.am --- contrib/sIPOPT/AmplSolver/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/sIPOPT/AmplSolver/Makefile.am b/contrib/sIPOPT/AmplSolver/Makefile.am index 007e7060d..55ecc457a 100644 --- a/contrib/sIPOPT/AmplSolver/Makefile.am +++ b/contrib/sIPOPT/AmplSolver/Makefile.am @@ -9,7 +9,8 @@ bin_PROGRAMS = ipopt_sens ipopt_sens_SOURCES = ampl_sipopt.cpp SensAmplTNLP.cpp ipopt_sens_LDADD = ../src/libsipopt.la \ - ../../../src/Apps/AmplSolver/libipoptamplinterface.la + ../../../src/Apps/AmplSolver/libipoptamplinterface.la \ + $(SIPOPTAMPLINTERFACELIB_LFLAGS) LDFLAGS += $(LT_LDFLAGS) From 7e48cd71bd271bbfc401625a00ea73c7600c7935 Mon Sep 17 00:00:00 2001 From: John Eslick Date: Fri, 26 Feb 2021 22:00:36 -0700 Subject: [PATCH 28/28] Update Makefile.in --- contrib/sIPOPT/AmplSolver/Makefile.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/sIPOPT/AmplSolver/Makefile.in b/contrib/sIPOPT/AmplSolver/Makefile.in index 647752d9c..3938f2dbe 100644 --- a/contrib/sIPOPT/AmplSolver/Makefile.in +++ b/contrib/sIPOPT/AmplSolver/Makefile.in @@ -109,7 +109,8 @@ PROGRAMS = $(bin_PROGRAMS) am_ipopt_sens_OBJECTS = ampl_sipopt.$(OBJEXT) SensAmplTNLP.$(OBJEXT) ipopt_sens_OBJECTS = $(am_ipopt_sens_OBJECTS) ipopt_sens_DEPENDENCIES = ../src/libsipopt.la \ - ../../../src/Apps/AmplSolver/libipoptamplinterface.la + ../../../src/Apps/AmplSolver/libipoptamplinterface.la \ + $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -345,7 +346,8 @@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign ipopt_sens_SOURCES = ampl_sipopt.cpp SensAmplTNLP.cpp ipopt_sens_LDADD = ../src/libsipopt.la \ - ../../../src/Apps/AmplSolver/libipoptamplinterface.la + ../../../src/Apps/AmplSolver/libipoptamplinterface.la \ + $(SIPOPTAMPLINTERFACELIB_LFLAGS) AM_CPPFLAGS = \ -I$(srcdir)/../src \