diff --git a/.coin-or/config.yml b/.coin-or/config.yml new file mode 100644 index 000000000..3f08cf457 --- /dev/null +++ b/.coin-or/config.yml @@ -0,0 +1,64 @@ +Description: + Slug: Ipopt + ShortName: Ipopt + LongName: + ShortDescription: A solver for general large-scale nonlinear continuous optimization. + LongDescription: |2 + "Ipopt is an open-source solver for large-scale nonlinear continuous optimization. + It can be used from modeling environments, such as AIMMS, AMPL, GAMS, or Matlab, and it is also available as callable library with interfaces to C++, C, Fortran, Java, and R. + Ipopt uses an interior point method, together with a filter linear search procedure." + Manager: Andreas Waechter + Homepage: https://github.com/coin-or/Ipopt + License: Eclipse Public License 2.0 + LicenseURL: http://www.opensource.org/licenses/EPL-2.0 + Appveyor: + Slug: ipopt-5qaur + Language: + - C++ + Categories: + - Optimization deterministic nonlinear + +Dependencies: + - Description: ThirdParty wrapper for building ASL + URL: https://github.com/coin-or-tools/ThirdParty-ASL + Version: 2.0 + Required: Recommended + - Description: ThirdParty wrapper for building Mumps + URL: https://github.com/coin-or-tools/ThirdParty-Mumps + Version: 3.0 + Required: Recommended + - Description: ThirdParty wrapper for building HSL codes + URL: https://github.com/coin-or-tools/ThirdParty-HSL + Version: 2.2 + Required: Recommended + - Description: Parallel Sparse Direct Solver from Pardiso-Project + URL: http://www.pardiso-project.org/ + Required: Recommended + - Description: Parallel Sparse Direct Solver from Intel MKL + URL: https://software.intel.com/content/www/us/en/develop/tools/math-kernel-library.html + Required: Optional + - Description: Watson Sparse Matrix Package + URL: http://researcher.ibm.com/view_project.php?id=1426 + Required: Optional + - Description: Basic Linear Algebra Subroutines (BLAS) + URL: http://www.netlib.org/blas + Required: Required + - Description: Linear Algebra Package (LAPACK) + URL: http://www.netlib.org/lapack + Required: Required + +DevelopmentStatus: + activityStatus: Active + maturityLevel: 5 + testedPlatforms: + - operatingSystem: Linux + compiler: gcc + - operatingSystem: macOS + compiler: + - gcc + - clang + - operatingSystem: Microsoft Windows with MSys2 + compiler: + - gcc + - cl+ifort + - icl+ifort diff --git a/.coin-or/projDesc.xml b/.coin-or/projDesc.xml index 49085330b..e8f63b06a 100644 --- a/.coin-or/projDesc.xml +++ b/.coin-or/projDesc.xml @@ -1,467 +1,83 @@ - - - - - - - - - - - - - - - - - - - - - - - Ipopt - - - - - - - - - - - - - - - Ipopt is an open-source solver for large-scale nonlinear continuous optimization. It can be used from modeling environments, such as AIMMS, AMPL, GAMS, or Matlab, and it is also available as callable library with interfaces to C++, C, Fortran, Java, and R. Ipopt uses an interior point method, together with a filter linear search procedure. - - - A solver for general large-scale nonlinear continuous optimization. - - - - - - - - - - - - - andreas dot waechter at northwestern dot edu - - - - - - - - - - - - - - https://github.com/coin-or/Ipopt - - - - - - - - - - - - - - - Eclipse Public License - http://opensource.org/licenses/EPL-1.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Blas - - - http://www.netlib.org/blas - - Required (any implementation) - - - - - Lapack - - - http://www.netlib.org/lapack - - Required (any implementation) - - - - - Ampl Solver Library - - - http://www.netlib.org/ampl/solvers - - Optional - - - - - A sparse linear solver (MA27, MA57, HSL_MA86, HSL_MA97, WSMP, Pardiso, MUMPS) - - - - - Required (at least one) - - - - - Metis - - - http://glaros.dtc.umn.edu/gkhome/views/metis - - Optional - - - - - - - - - - - - C++ - - - - - - - - - - - - Active - - - - - - - - - - - 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Microsoft Windows with MSYS2/MinGW - g++ - - - - Microsoft Windows with MSYS2 - cl - - - - Microsoft Windows with MSYS2 - icl+ifort - - - - - Linux - g++ - - - - Mac OSX - g++ - - - - Mac OSX - clang - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Optimization deterministic nonlinear - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - https://coin-or.github.io/Ipopt - - https://github.com/coin-or/Ipopt - - - - http://list.coin-or.org/mailman/listinfo/ipopt - - - - + + + Ipopt + Ipopt is an open-source solver for large-scale nonlinear continuous optimization. + It can be used from modeling environments, such as AIMMS, AMPL, GAMS, or Matlab, and it is also available as callable library with interfaces to C++, C, Fortran, Java, and R. + Ipopt uses an interior point method, together with a filter linear search procedure. + + A solver for general large-scale nonlinear continuous optimization. + Andreas Waechter + https://github.com/coin-or/Ipopt + Eclipse Public License + http://opensource.org/licenses/EPL-2.0 + + + + Blas + http://www.netlib.org/blas + Required (any implementation) + + + Lapack + http://www.netlib.org/lapack + Required (any implementation) + + + Ampl Solver Library + http://www.netlib.org/ampl/solvers + Optional + + + A sparse linear solver (MA27, MA57, HSL_MA86, HSL_MA97, WSMP, Pardiso, MUMPS, SPRAL) + + Required (at least one) + + + C++ + + Active + 5 + + + + Microsoft Windows with MSYS2/MinGW + g++ + + + Microsoft Windows with MSYS2 + cl + + + Microsoft Windows with MSYS2 + icl+ifort + + + Linux + g++ + + + macOS + g++ + + + macOS + clang + + + + + Optimization deterministic nonlinear + + + + https://coin-or.github.io/Ipopt + https://github.com/coin-or/Ipopt + https://github.com/coin-or/Ipopt/releases + https://github.com/coin-or/Ipopt/discussions + diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..b41ae18e8 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: [coin-or] diff --git a/.travis.yml b/.travis.yml index 6e3b693f3..c03ba2bc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,31 @@ language: cpp +git: + depth: 3 + matrix: include: - os: linux + dist: focal addons: apt: packages: - gfortran - liblapack-dev - env: ENABLEDEBUG=true + - libmetis-dev + - libhwloc-dev + - libudev-dev + - cppcheck + env: ENABLEDEBUG=true CPPCHECK=true + - os: linux + dist: focal + addons: + apt: + packages: + - gfortran + - liblapack64-dev + - cppcheck + env: INT64=true CPPCHECK=true - os: linux dist: bionic addons: @@ -16,7 +33,51 @@ matrix: packages: - gfortran - liblapack-dev + - libmetis-dev + env: SINGLEPRECISION=true + - os: linux + dist: xenial + addons: + apt: + packages: + - gfortran + - liblapack-dev + - libmetis-dev + - libhwloc-dev env: VISHIDDEN=true + - os: freebsd + env: NOF77=true + addons: + pkg: + - lapack + - gcc10-devel + - os: linux + arch: arm64 + addons: + apt: + packages: + - gfortran + - liblapack-dev + - libmetis-dev + - libhwloc-dev + - os: linux + arch: ppc64le + addons: + apt: + packages: + - gfortran + - liblapack-dev + - libmetis-dev + - libhwloc-dev + - os: linux + arch: s390x + addons: + apt: + packages: + - gfortran + - liblapack-dev + - libmetis-dev + - libhwloc-dev - os: osx osx_image: xcode11.3 env: OSX=10.14 VISHIDDEN=true @@ -26,37 +87,106 @@ matrix: env: OSX=10.14 VISHIDDEN=true NOF77=true compiler: clang - os: osx - osx_image: xcode10.1 - env: OSX=10.13 ENABLEDEBUG=true + osx_image: xcode11.6 + env: OSX=10.15 ENABLEDEBUG=true compiler: clang - os: osx - osx_image: xcode9.4 - env: OSX=10.13 + osx_image: xcode12.5 + env: OSX=11 SINGLEPRECISION=true compiler: clang before_script: - export VISHIDDEN=${VISHIDDEN:-false} - export NOF77=${NOF77:-false} - export ENABLEDEBUG=${ENABLEDEBUG:-false} - - if [[ "$TRAVIS_OS_NAME" == "osx" ]] && ! $NOF77; then brew update; brew install bash gcc; export CC=gcc-9 ; export CXX=g++-9 ; $CC --version; $CXX --version; gfortran --version; fi + - export SINGLEPRECISION=${SINGLEPRECISION:-false} + - export INT64=${INT64:-false} + - export CPPCHECK=${CPPCHECK:-false} + - > + if [[ "$TRAVIS_OS_NAME" == "osx" ]] && ! $NOF77; then + brew update; + brew install bash gcc metis hwloc; + $SINGLEPRECISION && brew install lapack; + if [[ "$OSX" == 10.14 ]] ; then export CC=gcc-11 ; export CXX=g++-11 ; + elif [[ "$OSX" == 10.15 ]] ; then export CC=gcc-11 ; export CXX=g++-11 ; + elif [[ "$OSX" == 11 ]] ; then export CC=gcc-11 ; export CXX=g++-11 ; fi ; + $CC --version; $CXX --version; gfortran --version; + fi ; + if [[ "$TRAVIS_OS_NAME" == "freebsd" ]] ; then + export CC=gcc ; export CXX=g++ ; + $CC --version; $CXX --version + fi script: - - git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-ASL - - pushd ThirdParty-ASL && ./get.ASL && ./configure --prefix=$HOME/install && make && make install && popd - - if $NOF77 ; then echo "Skipping Metis build." ; else git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-Metis ; pushd ThirdParty-Metis && ./get.Metis && ./configure --prefix=$HOME/install && make && make install && popd ; fi - - if $NOF77 ; then echo "Skipping Mumps build." ; else git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-Mumps ; pushd ThirdParty-Mumps && ./get.Mumps && ./configure --prefix=$HOME/install && make && make install && popd ; fi + # macOS VecLib doesn't work for single-precision routines (https://github.com/mcg1969/vecLibFort) - use homebrew lapack instead + - > + if $NOF77 || $SINGLEPRECISION || $INT64 ; then + echo "Skipping Spral build." ; + else + git clone --depth 1 --branch master https://github.com/ralna/spral.git && + pushd spral && + ./autogen.sh && + if [[ "$TRAVIS_OS_NAME" == "osx" ]] ; then + CFLAGS=-fPIC CXXFLAGS=-fPIC FFLAGS=-fPIC FCFLAGS=-fPIC ./configure --prefix ${HOME}/spral --with-metis="-L/usr/local/Cellar/metis/5.1.0/lib -lmetis" --with-metic-inc-dir=/usr/local/Cellar/metis/5.1.0/include ; + else + CFLAGS=-fPIC CXXFLAGS=-fPIC FFLAGS=-fPIC FCFLAGS=-fPIC ./configure --prefix ${HOME}/spral ; + fi && + make install && + popd ; + fi + - > + mkdir -p $HOME/install/share && touch $HOME/install/share/config.site ; + ( $NOF77 && echo enable_f77=no ; + $ENABLEDEBUG && ( echo enable_debug=yes ; echo with_ipopt_checklevel=5 ; echo with_ipopt_verbosity=5 ) ; + $SINGLEPRECISION && echo "with_precision=single" ; + $SINGLEPRECISION && [[ "$TRAVIS_OS_NAME" == "osx" ]] && ! $NOF77 && echo "with_lapack=\"-L/usr/local/opt/lapack/lib -llapack -lblas\"" ; + $INT64 && echo "with_intsize=64" ; + [[ -d $HOME/spral ]] && echo "with_spral_cflags=-I${HOME}/spral/include" ; + [[ -d $HOME/spral ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]] && echo "with_spral_lflags=\"-L${HOME}/spral/lib -lspral -lgfortran -lhwloc -lm -lmetis -llapack -lblas -fopenmp\"" ; + [[ -d $HOME/spral ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]] && echo "with_spral_lflags=\"-L${HOME}/spral/lib -lspral -lgfortran -L/usr/local/Cellar/hwloc/2.5.0/lib -lhwloc -lm -L/usr/local/Cellar/metis/5.1.0/lib -lmetis -framework Accelerate -fopenmp\"" ; + [[ "$TRAVIS_OS_NAME" == "osx" ]] && ( echo "with_metis_cflags=-I/usr/local/Cellar/metis/5.1.0/include" ; echo "with_metis_lflags=\"-L/usr/local/Cellar/metis/5.1.0/lib -lmetis\"" ) ; + ) > $HOME/install/share/config.site ; + cat $HOME/install/share/config.site + - > + if [[ "$TRAVIS_OS_NAME" == "freebsd" ]] ; then + echo "Skipping ASL build." ; + else + git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-ASL ; + pushd ThirdParty-ASL && + ./get.ASL && + ./configure --prefix=$HOME/install && + make && make install && + popd ; + fi + - > + if $NOF77 ; then + echo "Skipping Mumps build." ; + else + git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-Mumps ; + pushd ThirdParty-Mumps && + ./get.Mumps && + ./configure --prefix=$HOME/install && + make && make install && + popd ; + fi - mkdir build - pushd build - export ADD_CFLAGS="-Wall -Wextra -Werror" - export ADD_CXXFLAGS="-Wall -Wextra -Werror" - - if $VISHIDDEN ; then ADD_CFLAGS="$CFLAGS -fvisibility=hidden" ; fi - - if $VISHIDDEN ; then ADD_CXXFLAGS="$CXXFLAGS -fvisibility=hidden" ; fi - - export CFGFLAGS="" - - if $NOF77 ; then CFGFLAGS="$CFGFLAGS --disable-f77" ; fi - - if $ENABLEDEBUG ; then CFGFLAGS="$CFGFLAGS --enable-debug --with-ipopt-checklevel=5 --with-ipopt-verbosity=5" ; fi - - ../configure --prefix=$HOME/install $CFGFLAGS + - if $VISHIDDEN ; then ADD_CFLAGS="$ADD_CFLAGS -fvisibility=hidden" ; fi + - if $VISHIDDEN ; then ADD_CXXFLAGS="$ADD_CXXFLAGS -fvisibility=hidden" ; fi + - ../configure --prefix=$HOME/install - make - - if $NOF77 ; then echo "skip test as no linear solver" ; else make test ; fi + - export OMP_CANCELLATION=TRUE + - > + if $NOF77 ; then echo "skip test as no linear solver" ; + else + make test || exit 1 ; + if [[ -d $HOME/spral ]] ; then + echo "linear_solver mumps" > test/ipopt.opt ; + make test ; + fi + fi - make install - pushd examples/Cpp_example - make @@ -75,6 +205,23 @@ script: - make - if ! $NOF77 ; then ./solve_problem MBndryCntrl1 10 ; fi - popd + - pushd examples/recursive_nlp + - make + - if ! $NOF77 ; then ./recursive_nlp ; fi + - popd + - pushd contrib/sIPOPT/examples/parametric_cpp + - make + - if ! $NOF77 ; then ./parametric_driver ; fi + - popd + - pushd contrib/sIPOPT/examples/parametric_dsdp_cpp + - make + - if ! $NOF77 ; then ./parametric_dsdp_driver ; fi + - popd + - pushd contrib/sIPOPT/examples/redhess_cpp + - make + - if ! $NOF77 ; then ./redhess_cpp ; fi + - popd + - if $CPPCHECK ; then make cppcheck ; fi after_failure: - find . -name config.log -exec tail -n 1000 {} \; diff --git a/AUTHORS b/AUTHORS index 8d8f42b0b..3760ba9a8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -71,12 +71,9 @@ Contributors: - Stefan Vigerske (GAMS) Dynamic loading of linear solver shared libraries - src/contrib/LinearSolverLoader/HSLLoader.c - src/contrib/LinearSolverLoader/HSLLoader.h - src/contrib/LinearSolverLoader/LibraryHandler.c - src/contrib/LinearSolverLoader/LibraryHandler.h - src/contrib/LinearSolverLoader/PardisoLoader.c - src/contrib/LinearSolverLoader/PardisoLoader.h + src/Common/IpLibraryLoader.hpp + src/Common/IpLibraryLoader.cpp + HSL and Pardiso interface files - Marcel Roelofs (AIMMS) MSVC project files for Intel Fortran compiler, creating a DLL @@ -114,18 +111,35 @@ Contributors: R interface with examples, all files in directory (and subdirectory of) contrib/RInterface - + - Tony Kelman (Berkeley) improvements to Matlab interface - + Ipopt/contrib/MatlabInterface - Gabriel Hackebeil improved use compound component spaces - + - Nai-Yuan Chiang and Victor M. Zavala Tejeda (Argonne National Laboratory) inertia free curvature test in solution of primal-dual system (full approach) +- Brad Bell + recursive NLP example + + examples/recursive_nlp/recursive_nlp.cpp + +- Mitchell Clement + support for use of single-precision floating point number + + many source files affected, see https://github.com/coin-or/Ipopt/pull/428 + +- Byron Tasseff (LANL, University of Michigan) + Spral interface + + src/Algorithm/LinearSolvers/IpSpralSolverInterface.hpp + src/Algorithm/LinearSolvers/IpSpralSolverInterface.cpp + + Contributors of code that is no longer included in Ipopt distribution: - Yifan Hu (Wolfram): Contributed TAUCS interface, implemented in the files diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 9c4628a42..000000000 --- a/ChangeLog +++ /dev/null @@ -1,674 +0,0 @@ -Here we list changes of Ipopt since the release of version 3.0.0. -More detailed information about incremental changes can be found in the -commit history. - -2020-xx-yy: 3.13.2 - - The C-preprocessor defines COIN_IPOPT_CHECKLEVEL, - COIN_IPOPT_VERBOSITY, and FORTRAN_INTEGER_TYPE, which are defined - by IpoptConfig.h, have been renamed to IPOPT_CHECKLEVEL, - IPOPT_VERBOSITY, and IPOPT_FORTRAN_INTEGER_TYPE, respectively. - They are still available under their previous name, but these - will be removed in Ipopt 3.14. - -2020-03-11: 3.13.1 - - Added asserts that check whether sparsity pattern of Jacobian - and Hessian as returned by TNLP are within range w.r.t. number - of variables and constraints. [#350] - - TNLPAdapter::ResortBnds now initializes complete output arrays - with 0.0 before filling in values for non-fixed variables. Use - new argument clearorig to turn this off. [#352] - - bring back configure variables ADD_{C,CXX,F}FLAGS - - added configure option --enable-relocatable to make prefix in - pkg-config files relative to pcfiledir (assuming that --libdir - hasn't been set) - - bring back configall_system.h for build without config header - - minor fixes to buildsystem - -2019-10-19: 3.13.0 - This major release comes with a larger renovation of the build - system and a changed directory structure (eliminated top directory), - which is the result of a long and still on-going effort to use - recent autotools versions for various COIN-OR projects, reduce - future maintenance efforts, and adapting behaviors of standard - autotools-based projects. - As a consequence, a monolithic build of Ipopt, which builds Ipopt - with all its dependencies in one run of configure and make is no - longer possible. Dependencies should now be build and installed - before building Ipopt. - Additionally, support for some outdated versions of dependencies - and unmaintained components of Ipopt have been dropped and some - improvements that may require changes on the users side have been - applied. - A more detailed, probably incomplete, list of changes follows: - - Removed git submodules. Dependencies (HSL, Mumps, ASL, etc) now - need to be build and installed in advance, either manually or - by using coinbrew. - - Dropped support for HSL < 2013. - - Dropped support for MA28 in the linear solver loader. - - Dropped support for Pardiso < 4.0 from pardiso-project.org. - - Added support for Mumps 5.2.x, though initial experiments on - CUTEst indicated that, on average, performance is worse than - when using Mumps 4.10.0. - - Dropped CUTEr interface, the successor CUTEst includes an - interface to Ipopt. - - Dropped Matlab interface as it is unmaintained and it was - reported that it stopped functioning. - Use https://github.com/ebertolazzi/mexIPOPT instead. - - Dropped MSVS project files as unmaintained and not functioning - with current Ipopt anymore. - - Integrated Java interface into the main Ipopt library, that is, - it is handled equivalently to the C and Fortran interfaces: - - The source moved into src/Interfaces. - - The JNI functions are now included in the main Ipopt library, - thus an extra jipopt library is no longer build or necessary. - - The Java class and org.coinor.ipopt.jar package are build and - installed as part of the main Ipopt build. - - The examples moved into examples/*_java. - - A Java interface test is executed by make test. - - To build javadoc, run make javadoc in the main build directory. - - The configure flag --disable-java can be used to disable the - check for Java and build of the Java interface. - - DLLPATH and DLLNAME have been removed from the Ipopt class and - constructors that works without arguments and with only one - argument (specifying the Ipopt library namestem) have been added. - - Method Ipopt::finalize has been marked as deprecated and will - be removed in some future Ipopt version. Users must call - dispose() explicitly. - - Integrated sIpopt into the main Ipopt build, that is, it is now - build together with Ipopt, but installed as separate library - and executable. Use --disable-sipopt to disable building sIpopt. - - IPOPT_THREAD_LOCAL now uses C++11's thread_local keyword if C++11 - is available. - - When using a GCC-compatible compiler, Ipopt and sIpopt interface - functions are now declared with visibility(default)-attribute, - thus building Ipopt with -fvisibility=hidden still produces a - usable library. - - When using a MSVC-compatible compiler, Ipopt and sIpopt interface - functions are now declared with dllimport-attribute, so that an - Ipopt C++ DLL can be used. - - Under Windows/Msys2, DLLs are now build by default. - - Cygwin and MSys1 are not supported. - - pkg-config is now mandatory to use dependencies like ASL or HSL. - On Windows, make sure to use a pkg-config version that produces - Unix-style paths. - - Script "compile" is now used to wrap around calls of cl/icl/ifort - and translate GCC-style compiler flags to MSVC style. - - "Addlibs" files have been removed, pkg-config should be used instead. - - Header files are now installed in the better named - $prefix/include/coin-or instead of $prefix/include/coin - - The default for --prefix is no longer the build directory, but - the autotools-default, probably /usr/local. - - The check for a Fortran compiler can be disabled via --disable-f77 - and Ipopt can easier be build without a Fortran compiler. - - Lapack is no longer optional, but required. The separate check - for Blas and the --with-blas flags have been removed. - - --enable-debug does not imply --disable-shared anymore. - - Removed --enable-debug-ipopt, use --enable-debug instead. - - Removed configure variables ADD/OPT/DBG_C/CXX/F77FLAGS. Use - C/CXX/F77FLAGS instead. - - Silent build output is now enabled by default, use configure - flag --disable-silent-rules or call make with V=1 to disable. - - Also for static builds, PIC objects are now generated by default, - use --without-pic to disable. - - The --with-*-incdir and --with-*-lib configure flags have been - replaced by corresponding --with-*-cflags and --with-*-lflags - flags. Note that the include directories need to be specified - via -I in --with-*-cflags. - - Fixed handling of ma77_default_control in LSL_setMA77(). - - Fixed calculation of quality function when setting option - quality_function_centrality to reciprocal. - - Fixed compiler warnings, in particular when using -Wunused-parameter. - - Changed default for ma97_print_level to -1. This avoids messages - about numerical singular systems written to stdout by default. - -2019-04-08 releases/3.12.13 - - fixed Pardiso settings when using Pardiso from Pardiso project - website (by Olaf Schenk): the new settings should provide much - better performance; the default for option pardiso_order changed - from five to metis - - changed distinction of MKL and Basel Pardiso in configure: to - use MKL Pardiso, only specify MKL for Blas; to use Basel Pardiso, - use --with-pardiso - -2018-11-17 releases/3.12.12 - - allow for --without-matlab-home to disable check for Matlab [r2748] - - add dppsv to v8-ifort [r2746] - - disable error in LibraryHandler.c if snprintf detection failed [r2751] - -2018-09-16 releases/3.12.11 - - fill Mumps struct with zeros when allocating in Mumps interface [r2724] - - minor fix in build-system of ThirdParty/ASL - -2018-06-02 releases/3.12.10 - - fixed setting for parallel solve when using MKL Pardiso - (by t1393988511) [r2711]: parallel solve was disabled (which - is not the default); note, that the setting for parallel - factorization was not affected - - fixed invalid read in AMPL interface for problems without - objective function [r2715, #305] - - updated ThirdParty/ASL to retrieve updated ASL (20180528) [#305] - - name JIpopt library libjipopt.dylib on Mac OS X [r2718, #275] - -2018-01-15 releases/3.12.9 - - fixed memory leak in MA86 interface (by mhahn) [r2700,#283] - - fixed handling of time limit when reoptimizing: CPU time spend - was accumulated when reoptimizing, while it should have been - reset for each solve (by paul-scott) [r2702,r2703] - - fixed sign in Jacobian finite-difference approximation when point - was close to variable upper bounds (by Enrico Bertolazzi) [r2704] - -2017-06-12 releases/3.12.8 - - add define for FORTRAN_INTEGER_TYPE to config_ipopt_default.h - - IpoptApplication::RethrowNonIpoptException() now returns whether - non-ipopt exceptions were rethrown before the method was called. - -2017-02-25 releases/3.12.7 - - removed compiler flag -pedantic-errors to avoid problems with some - configure tests when using recent GCC versions - - fixed rare bug in handling variable/constraint names in AmplTNLP - (by G. Hackebeil) [r2673] - - the get.Mumps script in ThirdParty/Mumps now renames libseq/mpi.h - to libseq/mumps_mpi.h to avoid conflicts when building in a MPI - environment (by T. Ralphs); note that if updating an existing - checkout/download of Ipopt, you may have to rerun get.Mumps - -2016-07-20 releases/3.12.6 - - better support for custom algorithm development [r2659] - (by Gabriel Hackebeil) https://github.com/coin-or/Ipopt/pull/5: - "Reorganization of the AlgorithmBuilder class to allow easier - customization of the Ipopt algorithm. In particular, we wanted to - make use of the code that creates the SymLinearSolver object to - implement our own SymLinearSolver without copy-pasting everything - in AlgorithmBuilder. - AlgorithmBuilder::BuildBasicAlgorithm now consists of 8 method calls - that build the core components passed into the arguments of the - IpoptAlgorithm class. These calls are ordered based on any dependencies - they might have. In addition, all code for creating the PDSystemSolver, - AugSystemSolver, and SymLinearSolver has been moved into separate factory - methods. - Also, included is a change to install a few more header files with Ipopt. - Some of these are required to subclass AlgorithmBuilder, and the others - are simply some matrix types that we require." - - extend build system to work without Fortran compiler [r2660,r2661] - If no Fortran compiler is available (F77=unavailable), then - the build system checks for functions in Blas, Lapack, and - Pardiso via C linkage. This seems to work when using the Intel MKL, - thus allowing to build Ipopt with C/C++ compilers and MKL only. - The linear solver loader and the CuteR interface are disabled when - no Fortran compiler is available. A user may have to adjust the - definition of F77_FUNC in Ipopt/src/Common/IpoptConfig.h. - -2016-04-30 releases/3.12.5 - - changed fptr from long to void*: the Fortran side needs to - make sure that it uses a big enough integer type to store a - C pointer, thus void* can be used on the C side [r2599] - - added additional second-order-correction method, which can be - selected by setting the new option soc_method to 1 (by Wei Wan) - [r2606, r2607] - - added parameter allow_clobber with default value false to - IpoptApplication::Initialize and OptionsList::ReadFromStream - -2015-08-09 releases/3.12.4 - - option to use regularized Hessian when doing a curvature test - without inertia information (neg_curv_test_tol > 0), new - option neg_curv_test_reg to switch back to original behavior - (by N.-Y. Chiang and V. Zavala Tejeda) [r2579] - - sIpopt: Added access to sensitivity directional derivative - vector (ds/dp*(p-p0) Eq. 14 sIpopt implementation paper). Also, - added an option to compute the sensitivity matrix and provide - access to it. Finally, added an example that shows how to - access the new information. (by R. Lopez-Negrete) - - use workaround for failing check for random number generator - with any gcc 4.8.x (x >= 2) - -2015-04-15 releases/3.12.3 and releases/3.11.11 - - fixed bug in MA97 interface that lead to conversion issues - (by J. Hogg) [r2566, #260] - -2015-04-04 releases/3.12.2 - - revised integration of doxygen documentation into build system - (by T. Ralphs) - -2015-02-13 releases/3.12.1 - - fixes to build system for dependency linking and library versioning - - Ipopt will now report an NLP with inconsistent variable bounds - or inconsistent constraints sides as infeasible instead of - throwing an invalid TNLP exception (by T. Kelman) [r2548] - -2015-01-23 releases/3.12.0 - - Library dependencies are now recorded in shared library builds, - which is intended to simplify linking against the Ipopt library. - However, the pkg-config and ipopt_addlibs files do not reflect - this change yet (it is rather experimental, imho). To restore - the previous behavior, use --disable-dependency-linking as - configure option. In case of problems, contact Ted Ralphs. - - If linking against Intel MKL for Blas/lapack, use of Pardiso - from MKL is now automatically enabled. Note, that this will - change the default solver on Ipopt builds without any of the - linear solvers MA27, MA57, MA97, and MA86 (these take preference - over Pardiso). [#216] - - dropped support for old HSL sources (<2013; ThirdParty/HSLold) - - updated ASL sources, now downloaded from AMPL-MP (github) - - some internal changes to data structures (improved use of compound - component spaces) and addition of IpLapackDppsv (by Gabe Hackebeil) - -2015-01-18 releases/3.11.10 - - fix a memory allocation in Java interface in cases where jint - has a different size than int [r2513] - - the buildsystem now tries the Accelerate framework instead of - vecLib for finding Blas/Lapack on MacOS X - -2014-08-16 releases/3.11.9 - - fix compilation issue of Java interface on systems where Index - and jint have different size [r2498, #241] - - work around failing check for random number generator with gcc - 4.8.3 [r2495, r2496] - - readded IpTaggedObject.cpp to list of sources to compile in - MSVS v8-ifort project file [r2492] - - work around missing support for thread-local storage with gcc < 4.5 - on MacOS X [r2491, #243] - - fix call to MKL Pardiso init function [r2489] - - speed up Triplet to CSR converter [r2487, #234] - - fixed a bug in equilibration scaling where average values were - computed incorrectly (by V. Zverovich) [r2483] - -2014-04-08 releases/3.11.8 - - fixed a bug, introduced with Ipopt 3.11.0, where the tag in the - Ipopt's caching mechanism was not unique over time, which lead - ot failures of Ipopt that were difficult to debug or recognize - (e.g., Ipopt may have stopped with an restoration failure for - instances that solved fine with Ipopt 3.10) [r2472, r2473] - I'm very thankful to Gabriel Hackebeil and Kurt Majewski for - their debugging effort on this issue. - - building Mumps with pthreads is now disabled by default [#229] - - fixed setting of LD on Windows (now set to link only iff using - MS/Intel compilers) [#230] - - fixed download link for Gnumex [r2471] - - for some messages about too-few-degrees-of-freedom and restoration - failure, the message level changed from error to strong-warning - [r2460, r2469] - - revised calls to MPI_Init and MPI_Finalize in Mumps interface [r2467] - (MPI_Init is now called only if function MPI_Initialized is available - and MPI has not been initialized already; MPI_Finalize is only called - if Ipopt also called MPI_Init; ...) - -2013-12-18 releases/3.11.7 - - adapted PARDISO parameters when using MKL PARDISO to be close - to using Basel PARDISO - - added options pardiso_max_iterative_refinement_steps and - pardiso_order; the former defaults to 1 in case of MKL PARDISO, - which may help on instances that otherwise fail due to numerical issues - - removed duplicate code in IpQualityFunctionMuOracle.cpp [#225, r2445] - - fixed bug in triplet to csr converter [#226, r2446] - - minor changes in buildsystem - -2013-11-16 releases/3.11.6 - - updates to Matlab Interface build system (by T. Kelman) - - fix to updates of R Interface [r2416, #223] - - fixed SHAREDLIBEXT in v8-ifort's config.h [r2426, #224] - - minor fixes to the buildsystem - -2013-10-26 releases/3.11.5 - - added method IpoptApplication::RethrowNonIpoptException() to enable - rethrowing of non-ipopt and non-bad_alloc exceptions catched in - the *Optimize() and Initialization() methods; default is still to - return with NonIpopt_Exception_Thrown status - - minor fixes to the buildsystem [#215, #222] - -2013-09-12 releases/3.11.4 - - hopefully fixed non-working linear solver loader in DLLs build with - MSVS/v8-ifort project files [r2365] - - allow MC19 to be loaded via linear solver loader (by J. Currie) [r2366] - - fixed new point flag when running dependendency detector [r2368] - - experimental: adapt Pardiso interface to work with MKL Pardiso - (by J. Currie, T. Kelman) [r2369, #216]: - - in a few tests it has been found that Pardiso from Intel MKL nowadays - seems to work fine with Ipopt - - to use Intel MKL with Ipopt 3.11, one has to specify the MKL libs via - --with-pardiso and add -DHAVE_PARDISO_MKL -DHAVE_PARDISO_PARALLEL - to the compiler flags - - note that this is still an experimental feature (and thus not enabled - by default) - - updated Ipopt/R interface to version 0.8.4 [r2373] - - additional variables have been included in the object returned from ipoptr: - z_L : final values for the lower bound multipliers - z_U : final values for the upper bound multipliers - constraints : final values for the constraints - lambda : final values for the Lagrange multipliers - - removed ipoptr_environment as argument in ipoptr (see also r2372) - - fixed bug in penalty term for centrality in quality function (not used by - default) [#219, r2374] - - minor bugfixes in AMPL interface, debug print statements, and compound matrix - (by G. Hackebeil) [#218, r2371, r2377, r2378, r2379] - - download scripts for ASL, Blas, and Lapack now first try to download tarball - copies from the COIN-OR server - -2013-08-08 releases/3.11.3 - - get.* scripts for ThirdParty/{ASL,Blas,Lapack} now work around broken - ftp access to www.netlib.org. - -2013-07-01 releases/3.11.2 - - changed default for option option_file_name to ipopt.opt; specifying an - empty string for this option now disables reading of an option file [r2339] - - missing initial values are now set to 0.0, projected onto variable bounds, - in AMPL interface [r2340, #205] - - fixed missing variable initialization in MA97 interface [r2341, #206] - -2013-06-14 releases/3.11.1 - - the setup for the v8-ifort MSVS project changed to use dynamic runtime - DLLs instead of static linking, which caused crashes in debug mode - (by M. Roelofs) [r2301] - - fixed memory leaks in Java Interface (by javier) [#200, r2312] - - updates and fixes to MA77 and MA87 interfaces, adding support of - HSL 2013 codes (by J. Hogg); - HSL 2012 still supported when compiled with Ipopt, but the linear solver - loader to dynamically load a HSL library at runtime now assumes HSL 2013 - - added option ma97_solve_blas3 (by J. Hogg) [r2329] - - changed default for option ma27_meminc_factor from 10.0 to 2.0 [r2330] - - fixed bug in ipopt_auxdata of MATLAB Interface related to iterfunc [r2325] - -2013-05-07 releases/3.11.0 - - update and extension of Ipopt documentation - - updated build of doxygen documentation to comply with other COIN-OR projects - - localized global variables in TaggedObject and RegisteredOption, - so that Ipopt should now be threadsafe as long as Ipopt objects - (esp. SmartPtr's) are not shared between threads and a threadsafe - linear solver is used (e.g., MA27) [#167] - - no more need for whitespace character at end of options file - - added options print_frequency_iter and print_frequency_time to regulate - which iteration summary lines should be printed [#161] - - function evaluation timings are now available in OrigIpoptNLP [#86] - - some fixes to uncommon issues with the Ipopt SmartPtr [#162] - - - new build system for Harwell codes (ThirdParty/HSL), which requires - the coin-hsl archives from http://www.hsl.rl.ac.uk/ipopt/; - previously downloaded HSL sources can still be used by placing them - into ThirdParty/HSLold, but this option may be removed in a future - Ipopt version - - new interfaces for Harwell codes HSL_MA77, HSL_MA86, and HSL_MA97; - see http://www.hsl.rl.ac.uk/ipopt/ about help on when to use which solver; - especially MA57 and HSL_MA97 should be considered as replacement for MA27; - however, MA27 is still the default for now - - changed default of ma57_automatic_scaling to no (faster in general, - but for higher reliability, you may want to set this option to yes) - - - major improvements for building the MATLAB interface (see documentation) - - MATLAB interface now returns number of function evaluations, too - - the MA57 interface can now be used with the MA57 library that comes with - MATLAB (configure option --enable-matlab-ma57; cannot use Metis) - - auxdata is now handled by a wrapper function ipopt_auxdata.m instead - of internally within the mex code (replace Matlab call to ipopt with - ipopt_auxdata if using auxiliary data in any callbacks) [r2282] - - exposed more intermediate Ipopt information to iterfunc callback [r2283] - - - fixes to JIpopt buildsystem (now may work on windows and uses libtool) - - JIpopt now reads options file ipopt.opt by default, if present - - removed predefined KEY_ strings in JIpopt - - renamed API functions that retrieve solution values in JIpopt - - - simplified installation of R interface - -2013-05-05 releases/3.10.4 - - fixed sign of dual values in AMPL solution again (with help of Gabe) - [r2169, r2170, r2184, #183] - - fixed bugs with reoptimizing a TNLP with all variables fixed [r2172, r2173, #179] - - fixed more issues with sparse data structures and non-double numbers - in Matlab interface (by T. Kelman) [r2191] - - added missing final int for Ipopt return code Maximum_CpuTime_Exceeded - in Java interface [r2216] - - fixed bug when trying to warmstart Ipopt in Java interface [r2253] - - fixed wrong use of SmartPtr's in Java interface [r2255, r2263] - - fixed bug in returning final solution in Java interface [r2258] - - included patch in ThirdParty/Mumps to work around bugs in Mumps - matrix ordering routines AMF and QAMD (now give preference to AMD and METIS) - -2012-11-19 releases/3.10.3 - - minor fixes in MA86 interface (by Jonathan Hogg) [r2069, r2086] - - fix in IpTripletToCSRConverter for CSR forms with - extra entries (by Jonathan Hogg) [r2087] - - workaround problems with MacOSX-Lion's blas library - (by Frederic Hetch) [r2102, #181] - - the C interface now catches also Ipopt exceptions thrown - within the OptimizeTNLP call and returns Ipopt::Unrecoverable_Exception - as status [r2094, #144] - - fixed segmentation fault in adaptive barrier parameter update rule - when using the mehrotra option on unconstrained problems [r2114, #114] - - fixed segmentation fault in case no iterate is available in case of - catastrophic failure in restoration phase [r2115] - - fixed default for mumps_dep_tol to work with current Mumps versions [r2116] - - fixed sign of dual values in AMPL solution [r2123, #183] - - fixed issue with sparse gradients in Matlab interface - (by T. Kelman) [r2133, #187] - - sIPOPT (by H. Pirnay): - - starting values in C++ version of parametric example now - match AMPL version [r2098] - - numerical values in parametric example now match publication [r2099] - - added options n_sens_steps and sens_boundcheck as AMPL options [r2099] - - any non-zero suffix value is now accepted for sens_init_constr [r2100] - - fix typo in AMPL interface (by Weifeng Chen) [r2110] - - fix bug when compiling without AMPL interface [r2113] - - build system: - - updated instruction on using nowadays HSL sources (by T. Kelman) - - fixed issue with libdir being /lib64 - - other minor fixes - -2012-02-12 releases/3.10.2 - - updates to HSL interface (by Jonathan Hogg): - - MC68 can now be loaded dynamically, too - - MA86 exploits built-in scaling - - MA86 can choose best ordering from AMD and Metis - - fix for return code of MA86 for singular matrices - - corrected computation of Upsilon (norm of step SQUARED) - - updates to MSVS v8-ifort project files and addition of vc10 - project files (using vc8-generated IpoptFSS.dll) (by Marcel Roelofs) - - minor bugfixes, include updates in BuildTools - -2011-09-20 releases/3.10.1 - - include updates in BuildTools, including new ThirdParty/Metis - (fix for URL to download Metis 4.0.3 release) - - linear solver loader prints error code when failing to load - library under Windows - - message on failure when reallocating memory in Mumps now includes - size of memory that was tried to be allocated - - added missing include of cstdio/stdio.h to IpJournalist.hpp - - minor fixes to build system - -2011-06-20 releases/3.10.0 - - move to new COIN-OR configuration and installation convention - - primal infeasibility output is now true infeasibility in original - problem formulation - -2011-04-07 releases/3.9.3 - - include updates in BuildTools, including new ThirdParty/Metis - (required to work with current metis release) - -2010-12-22 releases/3.9.2 - - converted from Common Public License to Eclipse Public License - - some bugfixes from BuildTools - -2010-11-26 releases/3.9.1 - - improved Hessian update for restoration phase - - added intermediate callback feature to C and Fortran interface - -2010-11-05 releases/3.9.0 - - switching to new BuildTools system - - added R interface (contributed by Jelmer Ypma) - - updates in AsNMPC (by Hans Pirnay) - -2010-06-29 releases/3.8.3 - - restated SolveStatistics::TotalCPUTime method for backward - compatibility - -2010-06-16 releases/3.8.2 - - uses MUMPS version 4.9 and Lapack version 3.2.1 - - added AsNMPC contribution made by Hans Pirnay - - enhanced MA57 options - - several bug fixes and minor additions - -2009-10-30 releases/3.8.1 - - Bugfix in NLP function evaluation timing measurement. The - time for the objective function gradient had been forgotten. - -2009-10-29 releases/3.8.0 - - Added MSVC solution with Intel Fortran compiler to generate DLLs - (contributed by Marcel Roelofs). To make this work, a lot of methods - in exported headers have been made virtual - - changed default convergence tolerance in restoration phase (now same - as regular tolerance) - - output is flushed after each iteration - -2009-10-06 releases/3.7.1 - - bugfix for square problems - - correct timinig information (obj gradient was forgotten) - - flush output buffer after each iteration - - first code for iterative WSMP version (experimental and undocumented) - -2009-07-16 releases/3.7.0 - - a number of fixes (including those from 2009 COIN Bug Squashing - Party) - - changes in some exposed header files to provide access to internal - data structures for specific applications - -2009-05-01 releases/3.6.1 - - minor corrections in tutorial files - -2009-04-29 releases/3.6.0 - - new Matlab interface - - added new option to limit cpu time (max_cpu_time) - - added ThirdParty directory for Metis to be used with MUMPS or MA57 - - updated CUTEr Makefile to make it work with CUTEr2 - - added files for a tutorial (including coding exercise) - -2009-01-13 releases/3.5.5 - - minor fixes regarding compilation - - undocumented version of inexact method - -2008-09-29 releases/3.5.4 - - changed to MUMPS version 4.8.3 in externals (Mumps developers - seem to have removed 4.8.1). - -2008-09-19 releases/3.5.3 - - changed back to MUMPS version 4.8.1 since there seem to be issues - on Windows - -2008-09-18 releases/3.5.2 - - changed to latest version of MUMPS (4.8.2) - - some bugfixes (linear algebra objects, automatic problem scaling) - - made sure the subversion revision number is correct in all files - - allowed general additional data and cq in IpData and IpCq - -2008-08-26 releases/3.5.1 - - changed to latest version of MUMPS (4.8.1) - -2008-08-25 releases/3.5.0 - - added ComputeRowAMax and ComputeColAMax methods to Matrix base class - - changed externals for MUMPS to stable/1.1 - - call finalize solution in more failure cases - (this means that AMPL writes .sol file in more situations) - - added IpTNLPReducer as simple way to exclude constraints from problem - - several fixes, also from COIN Bug Squashing Party 2008 - -2008-07-18 releases/3.4.2 - - some bug fixes - - added wallclock time routine - - penalty function version does not longer crash if it - wants to go to restoration phase (not that this really helps - converence though) - -2008-05-30 releases/3.4.1 - - some bug fixes - - deleted v9 MSVC files again (since v8 works fine for v9) - - print Ipopt version in default print level - - added option that allows to change name of options file - (option_file_name) - -2008-04-25 releases/3.4.0 - - added support to dynamically load HSL or Pardiso: - If Ipopt has been compiled without some HSL or Pardiso solver, - it can now load those solvers from a shared library at runtime - without recompilation. This will make ditribution of binaries - easier. Does not work on all platforms yet. - - several bugfixes - - ensured compilation of MSVS project files (v8 and v9) - - new special return code for square problems - (Feasible_Point_Found returned if dual inf not small) - - new initialization option for bound multipliers - (see option bound_mult_init_method) - - added simple penalty function line search option - (line_search_method=penalty) - not guaranteed to converge, see - Ipopt implementation paper (in MathProg) - - some very basic method to approximate constraint Jacobian by - finite differences (not efficient, but will hopefully be extended) - -2008-02-28 releases/3.3.5 - - corrected links for Ipopt mailing list - - added missing Makefile.in for Matlab interface - - the addlibs* files are now installed in share/doc/coin/Ipopt - instead of lib - - updates in Matlab interface - - bugfix for ticket #56 - -2007-12-27 releases/3.3.4 - - headers are now installed in include/coin - (no longer in include/ipopt) - - default for dual_inf_tol is now 1 (instead of 1e-4) - - In matlab interface, here the text from Peter Carbonetto: - There have been several significant changes made to the MATLAB interface since the last release. The most important two changes are: 1) Following the "warm start" feature of IPOPT, you may pass in initial estimates for the Lagrange multipliers. 2) Callback routines for computing the objective, gradient (etc.) are now specified using function handles instead of strings. (Thanks to Marcus Brubaker at the University of Toronto for the initial suggestion.) - -2007-09-25 releases/3.3.3 - - minor changes, bug fixes - -2007-06-20 releases/3.3.1 - synchronized with all changes in trunk; probably more than to be - remembered. In the following a few: - - support for Mumps linear solver (contributed by Damian Hocking) - - --print-options flag for ipopt ASL solver executable to see all - Ipopt options (available through ipopt.opt file) - - added Matlab interface (contributed by Peter Carbonetto) - - added support for f2c compiler to compiler Fortran code with - MSVC++ compiler - - new MSVisualStudio support (now within MSVisualStudio project - and also with f2c) - - a number of small changes/bug fixes/improvements - - small change in interface (e.g., FinalizeSolution method) - -2007-04-24 releases/3.2.4 - - updated download script for Blas to fit netlib's - recent changes - - using a more recent version of BuildTools - -2006-11-29 release/3.2.3 - - updated download script for Lapack to fit to netlib's - recent changes - -2006-10-11 stable/3.2 r795 - - Bugfix in L-BFGS update - - fix in configure with detection of sizeof(int *) on Cygwin - -2006-07-14 - version 3.2.1 - dev release number 764 - - Bugfix in least square multiplier estimate. - It mainly showed up in LBFGS with restoration phase as seg fault - -2006-07-07 - version 3.2.0 - dev 757 - - changed installation procedure and directory structure to - conform with new COIN-OR convention - -2006-04-08 - version 3.1.0 - dev release number 714 - Several bug-fixes, improvements and additions. In particular: - - new quasi-Newton approximation using L-BFGS - - interfaces to linear solver MA57, WSMP, Pardiso - (MUMPS and TAUCS not yet completed) - - derivative checker - - unit test - - configure supports compilation under Cygwin with native - Windows compilers - - ScalableExample - - user call-back method in TNLP - -2005-12-04 - version 3.0.1 - fixes independent of dev - (already taken care of there) - Several corrections to Windows files - Fix termination if number of iterations is exceeded in restoration phase -2005-08-26 - version 3.0.0 - dev release number 510 - First official release of the new C++ implementation of Ipopt. - diff --git a/ChangeLog.md b/ChangeLog.md new file mode 100644 index 000000000..b60c0cfcb --- /dev/null +++ b/ChangeLog.md @@ -0,0 +1,1242 @@ +# ChangeLog + +Here we list changes of Ipopt since the release of version 2.2.0. +More detailed information about incremental changes can be found in the +[commit history](https://github.com/coin-or/Ipopt/commits). +[TOC] + +## 3.14 + +### 3.14.13 (2023-11-08) + +- Reduced priority for making Spral the default value for option linear_solver [#677]. +- Adapted to change of integer types in Spral interface. Minimal required Spral version is now v2023.03.29. +- Fixed that return code from `TNLP::eval_jac_g()` was ignored at first call [#697, by + Christoph Hansknecht]. +- Print additional messages when reallocation of MA27 working space failed [#671, by + Daniel Oliveira]. +- Added option `file_append` to specify whether to append to `output_file` instead of + truncating it. Added default argument `file_append` to `Journalist::AddFileJournal()`, + added default argument `fappend` to `FileJournal::Open()`, and added default argument + `file_append` to `IpoptApplication::OpenOutputFile()`. [#720] + +### 3.14.12 (2023-04-05) + +- Fix that a source file was installed and install more header files. + [#641, #642, by Joao Sousa Pinto] +- Fixed crash of GetIpoptCurrentIterate() and GetIpoptCurrentViolations() in + C interface when called before or after IpoptSolve(). [#644, #645, by Robbybp] +- Updated HSL_MA97 header file to the one from HSL MA97 2.8.0 [#646, by Jari Fowkes]. +- Fixed crash when trying to solve problem without variables and constraints. [#648] +- Added optional argument to `AlgorithmBuilder` constructor to provide name of custom solver. [#618] +- Changed handling of dual solution for square problems: When solving a problem + with as many equations as variables, Ipopt used to ignore the violation of + dual feasibility and complementarity in the convergence check and computed + a final dual solution via a least-square estimate. If this failed, Ipopt would + claim a square problem to be solved to optimality without providing a solution + that satisfies optimality conditions. With this version, the behavior has + been changed so that dual feasibility is no longer ignored by the convergence + check, the least-square estimate is only computed if optimality is not proven + already, and the normal Ipopt algorithm continues if the least-square estimate + does not satisfy optimality conditions. +- Updated HSL_MC86 header file to the one from HSL MC68 3.3.3 [#653, by Jari Fowkes]. + +### 3.14.11 (2023-02-07) + +- Added `IpoptData::TimingStats() const` [#611] +- Assume DLL library extension in linear solver library loader on Windows + also when building with other compiler than MSVC/Intel [#628]. +- Updated buildsystem files after upgrading to most recent versions of autotools. +- Install some additional header files [#637]. + +### 3.14.10 (2022-10-11) + +- Added option `grad_f_constant` to specify that objective function is linear. + If set, the gradient of the objective will be requested by Ipopt only once. [#597] +- Added `OrigIpoptNLP::orig_d_L()` and `OrigIpoptNLP::orig_d_U()` to get + original constraint sides (before relaxation due to bound_relax_factor > 0). +- `TNLP::get_curr_violations()` now returns the constraint violation and + complementarity w.r.t. the original (non-relaxed) constraint sides. [#603] + +### 3.14.9 (2022-07-21) + +- Fixed mapping of meta data for variable bounds, e.g., variable names, + from TNLP to Ipopts internal NLP [#590]. + +### 3.14.8 (2022-07-13) + +- Added options ma27_print_level, ma57_print_level, and mumps_print_level + to enable output from these linear solvers. + +### 3.14.7 (2022-06-24) + +- Fixed that ComputeSensitivityMatrix() of sIpopt assumed that there are + no more than two parameters [#578, by Andrea Vescovini]. +- For completeness, added option `gradient_approximation` to enable approximation + of gradient of objective function by finite differences. Do not use. [#573] +- Added function `IPSETPROBLEMSCALING` to Fortran interface to set problem + scaling [#577, by Steven R. Hall] + +### 3.14.6 (2022-05-02) + +- Fixed mapping of meta data for inequalities, e.g., constraint names, + from TNLP to Ipopts internal NLP [#570, by Daniel Oliveira]. +- Fixed that MC68 ordering time was not accounted in symbolic factorization + time of HSL MA86 [#571]. +- Include more header files in IpIpoptCalculatedQuantities.hpp for setups + where forward declarations are not sufficients [#572]. + +### 3.14.5 (2022-02-09) + +- Tried to fix recognition of JNI headers on macOS >= 11 [#516]. +- Fixed that only primal variable values where passed to `finalize_solution()` + when a timelimit was reached [#552]. + +### 3.14.4 (2021-09-20) + +- Skip build of Java interface if either java or jar is not found [#510]. + Only give warning if javac and jar are found, but no java or javadoc. +- Fixed that `--with-lapack-lflags` was ignored if `--with-lapack` was not + specified explicitly [#512,#515]. + +### 3.14.3 (2021-09-03) + +- Fixed timing for iterate initialization if initialization fails due to + an evaluation error. +- Fixed possible integer overflow when reserving space for indices of Jacobian + belonging to fixed variables (introduced with 3.14.0) and reduced memory + usage for indices of Jacobian belonging to fixed variables. + +### 3.14.2 (2021-07-21) + +- Added `OptionsList::UnsetValue()` to remove an option setting. +- Added missing translation of some Ipopt status codes into AMPL solve result codes. +- If using the MPI-parallel version of MUMPS: Moved calls to + `MPI_Init()`/`MPI_Finalize()` in MUMPS interface into global constructor/destructor + of Ipopt library (if building with GCC/clang). Use configure flag + `--disable-mpiinit` to disable. [#500] + +### 3.14.1 (2021-06-25) + +- Fixed invalidation of cached Hessians when reoptimizing with same structure. +- Added `OptionsList::SetBoolValue()` and `OptionsList::SetBoolValueIfUnset()`. [#492] +- Skip check for and link against libdl if linear solver loader is disabled. +- Fixed missing initialization of `BacktrackingLineSearch::in_watchdog_`. +- Fixed a problem with the current solution not being reset when + initialization of a NLP fails in reoptimization. +- Fixed that C++11 capability was not correctly identified with MS/Intel compilers. + +### 3.14.0 (2021-06-15) + +#### Data Types + +- Due to a contribution by Mitchell Clement [#428], it is now possible + to build Ipopt in a variant that uses single-precision floating + point arithmetic instead of the default double-precision. + This can be enabled by specifying the configure flag `--with-precision=single`. + Doing so has a number of consequences on Ipopt interfaces and Ipopt dependencies. + See the Ipopt installation instructions for more details. +- The name of all functions in `IpBlas.hpp` and `IpLapack.hpp` has been + changed to drop the precision-specifier "D" in the name. + Wrapper using the old names are available, but their use is deprecated. +- It is now possible to build Ipopt in a variant that uses 64-bit + integers for its `Index` type. This can be enabled by specifying + the configure flag `--with-intsize=64`. Doing so has a number of + consequences on Ipopt interfaces and Ipopt dependencies. See + the Ipopt installation instructions for more details. [#259] +- Added new header `IpTypes.h` that defines Ipopt types for integer + and real numbers for C users. +- Deprecated almost never used type `Ipopt::Int`, use `int` instead. +- Deprecated `Number`, `Index`, and `Int` (on global namespace) in + `IpStdCInterface.h`, use `ipnumber`, `ipindex`, and `int` instead, respectively. +- Deprecated `Bool` in `IpStdCInterface.h` and replaced it by `bool` + from `stdbool.h`. Note, that `Bool` was defined to be `int`, but `bool` + is likely a shorter type, e.g., `signed char`. Deprecated `TRUE` and + `FALSE`, use `true` and `false` instead. +- Deprecated `IPOPT_EXPORT` macro and introduced `IPOPT_CALLCONV`. +- Deprecated `IPOPT_FORTRAN_INTEGER_TYPE` and `ipfint`. These were + always assumed to be `int`. Use `ipindex` or `ipopt::Index` instead. + +#### Linear Solver Interfaces + +- Due to a contribution by Byron Tasseff [#446], it is now possible to use + the linear solver [SPRAL](https://github.com/ralna/spral) (Sparse Parallel + Robust Algorithms Library) with Ipopt. + SPRAL is open-source and can, optionally, make use of NVIDIA GPUs. + If Ipopt has been build with SPRAL, then option `linear_solver` can be + set to `spral` to enable use of SPRAL. + See the installation instructions on how to build the Ipopt/SPRAL interface + and the options documentation for new options that are available for + the Ipopt/SPRAL interface. +- Added `IpoptLinearSolvers.h` with function `IpoptGetAvailableLinearSolvers()` + to retrieve information which linear solvers are available for Ipopt + (linked in or loaded at runtime). Options `linear_solver` and + `linear_system_scaling` can now only be set to values which corresponding + code is available (linked in or for load at runtime). +- Revised and streamlined implementation of feature that loads libraries + with HSL or Pardiso routines at runtime. Added options `hsllib` and `pardisolib` + to specify name of of HSL and Pardiso libraries, respectively. +- Separated interfaces for Pardiso from [pardiso-project.org](https://pardiso-project.org) + and Pardiso from Intel MKL and allow to have both Pardiso versions available + with the same Ipopt libraries. + - Pardiso from pardiso-project.org can be selected via `linear_solver=pardiso`. + configure option `--with-pardiso` should now specify only a Pardiso + library to be loaded at runtime (the value for `--with-pardiso` decides + the default value for option `pardisolib`). + To avoid conflicts with Pardiso from MKL, it is **no longer possible to + link against Pardiso from pardiso-project.org**. + - Pardiso from MKL can be selected via `linear_solver=pardisomkl`. + - Options that influence Pardiso from MKL are named `pardisomkl_msglvl`, `pardisomkl_order`, etc. + - configure option `--disable-pardisomkl` can be used to disable the check + for MKL Pardiso. [#454] +- Fixed that return code (`info%flag`) of `ma97_solve()` was not checked + in `Ma97SolverInterface::MultiSolve()`. +- Calls into MUMPS are now protected by a mutex if compiling for C++11 or higher. + This prevents Ipopt from calling MUMPS concurrently from several threads. +- An insufficient memory return status is now also given if the memory + required for a working space array of a linear solver exceeds the maximal + value for the working space length variable, e.g., if MA27 requires a + working space array of length higher than 2^31. +- Avoid floating point overflow when computing memory increase in interfaces + to MA27 and MA57. + +#### Algorithm + +- Changed treatment of NLPs with all variables fixed and `fixed_variable_treatment` + set to `make_parameter`: + Ipopt will still terminate early, but initialize its data structures + first and print a solve summary (49a0d3a56). + Changed treatment of NLPs with inconsistent variable bounds or constraint + sides: These will now result in an invalid problem definition error (-11) + (5cdb2624bb). + As a consequence, solve statistics should now always be available if the + return status from `(Re)Optimize()` is larger than -10. +- Bound multipliers are now computed for fixed variables if + `fixed_variable_treatment` is set to `make_parameter` (the default). + This can trigger a reevaluating of the gradient of the objective + function or the Jacobian of the constraint functions. If this + is not desired, then option `fixed_variable_treatment` can be set + to the new value `make_parameter_nodual`. [#308] +- Changed default for `honor_original_bounds` to no. + Variable bounds (see option `bound_relax_factor`) are now relaxed + by at most the value of `constr_viol_tol`. + The solve summary now reports the violation of original bounds + and `SolveStatistics::(Scaled)Infeasibilities()` has been extended + to report the violation of original variable bounds. [#312] +- If Ipopt hits a time or iteration limit during watchdog phase, + the iterate from before the watchdog phase is now restored and + passed to `finalize_solution`. Note that this does not apply if + Ipopt is stopped due to a user-interrupt (`intermediate_callback`). + [#289] +- When `BacktrackingLinesearch` could not find a trial point that + provided sufficient progress, it may resort to call the feasibility + restoration phase. If, however, the current (scaled) constraint + violation was below tol/100, this would result in the infamous + "Restoration phase is called at almost feasible point..." abort + with status code `Restoration_Failure`. Now, this message has been + changed to "Linesearch failed, but no restoration phase or other + fall back is available." and the status code to `Error_In_Step_Computation` + to better reflect that the linesearch failed and not the restoration + phase. Further, the unscaled constraint violation tolerance now + needs to be below `constr_viol_tol/10` as well in order to trigger + this abort. +- When a square problem is solved and the restoration phase only succeeded to + find a point that is feasible w.r.t. constr_viol_tol, but not w.r.t. tol, + then status Feasible_Point_Found is returned now. + +#### Ipopt interfaces + +- Added `TNLP::get_curr_iterate()` and `TNLP::get_curr_violations()` + to request the current iterate (primal and dual variable values) + and primal and dual infeasibility w.r.t. the TNLP. The methods + are meant to be called during `intermediate_callback` to inspect + the current iterate. The C, Fortran, and Java interfaces have + been extended by corresponding functions, too. The hs071 examples + have been extended to show use of the new functions. Added test + `getcurr` to test new functions. [#382, #451] +- Extended the Java interface by the possibility to specify an `intermediate_callback`. +- Added flag to `TNLPAdapter::ResortX()` to specify how to handle fixed variables. + Added flag to `TNLPAdapter::ResortG()` to specify whether to correct by + right-hand-side of equality constraints. + Added `TNLPAdapter::ResortBoundMultipliers()` to generate correct duals + for fixed variables if `fixed_variable_treatment` is `make_constraint`. + Added `TNLPAdapter::GetFullDimensions()`, `TNLPAdapter::GetFixedVariables()`, + `TNLPAdapter::GetPermutationMatrices()`, and `TNLPAdapter::GetC_Rhs()` + to retrieve more information of the transformation in a `TNLPAdapter`. +- Added `TNLPAdapter::ResortBounds()` and deprecated `TNLPAdapter::ResortBnds()`. +- `AmplTNLP` constructor and `AmplTNLP::get_options()` now expect to + receive a pointer to a `RegisteredOptions` object as well. + Previous versions of these methods are still available but deprecated. + Using a NULL pointer for the `RegisteredOptions` argument is + also deprecated. +- `std::overflow_error` exceptions are now caught by Ipopt even if rethrowing + of non-Ipopt exceptions is enabled. + +#### Timing + +- Added option `max_wall_time` to specify a wallclock time limit. + Added `SolverReturn` code `WALLTIME_EXCEEDED` and `ApplicationReturnStatus` + code `Maximum_WallTime_Exceeded`. +- Changed default for `max_cpu_time` to 1e20 to indicate no CPU timelimit. +- Detailed timing statistics are no longer collected by default. + To reenable, set the new option `timing_statistics` to yes or set the + option `print_timing_statistics` to yes [#299]. +- Removed `IpoptData::ResetCpuStartTime()`. Deprecated `IpoptData::cpu_time_start()`, + use `IpoptData::TimingStats()::OverallAlgorithm()::StartCpuTime()` instead. +- Deprecated `SolveStatistics::TotalCPUTime()`, use `SolveStatistics::TotalCpuTime()` + instead. + +#### Option handling + +- All Ipopt options are now also available via the AMPL interface, + that is, can be set in AMPL via an option `ipopt_options "..."` statement. +- Added flag "advanced" for `RegisteredOption` to store whether an + option is rather meant for expert users. +- Added class `RegisteredCategory` to store information on category + of registered option. Next to the name, this is a priority, which + determines the order in which categories are printed. As a + consequence, methods `RegisteredOption::RegisteringCategory()` and + `RegisteredOptions::RegisteringCategory()` now return a + `RegisteredCategory` object instead of a string. Further, + `RegisteredOption::SetRegisteringCategory()` has been removed. +- Deprecated existing `RegisteredOptions::OutputXyz()` methods and + added new variant of `RegisteredOptions::OutputOptionDocumentation()`. + Added parameter `print_advanced_options` to indicate whether to + print documentation for advanced options, too. +- Added previously undocumented advanced options to options reference. + +#### Miscellaneous + +- Updated buildsystem, including improved checks for dependencies, + use of current autotools, and skipping the build of intermediate + non-distributed libraries. +- Fixed missing initialization of `IpoptApplication::smart_jnlst` in + second `IpoptApplication` constructor, if `ipopt verbosity > 0`. +- Add GCC format attribute to `Journalist::Printf` functions to enable + `printf`-formatter check. +- Fixed `DenseVector::SumLogsImpl()` such that it returns 0.0 for + a vector of dimension 0. Returned `nan` for homogeneous 0-vector + of dimension 0 before, which may have caused the restoration phase to + fail for problems with only equality or only inequality constraints. + Also other `DenseVector` methods now skip calculations when dimension + is 0 to avoid (probably harmless) divisions by zero. +- Fixed a problem where moving slack away from 0 did not succeed + when mu was very small. [#212] +- Fixed a problem where moving slacks away from 0 resulted in `nan` + if multipliers were zero. Added `Vector::ElementWiseSelect()`. +- Various tiny bugfixes and improvements in performance and code style + by following suggestions of `cppcheck`. +- Added documentation on some available C preprocessor flags for expert users. +- Fixed static build of sIpopt without GCC. Fixed that installed sIpopt + headers were not usable (`SIPOPTLIB_EXPORT` not defined). +- Fixed wrong gradient of objective function and Lagrangian Hessian in + restoration problem [#478, by Nai-Yuan Chiang]. +- If Ipopt is compiled for checklevel 2 or higher and the GLIBC extension `feenableexcept()` + is available, then floating-pointing exceptions divbyzero, overflow, and + invalid are raised while `IpoptAlgorithm::Optimize()` is running. +- Fixed that norm on unscaled complementarity or scaled complementarity tolerance + were negative when maximizing (by using a negative scaling factor for the + objective). +- Changed formula for relative error in derivative checker. The absolute + error is now scaled up if the approximate derivative value is between + derivative_test_tol and 1. [#487]. +- The second-order derivative checker now uses values for obj_factor and + lambda that are different from 1. + + +## 3.13 + +### 3.13.4 (2021-02-24) + +- Fixed a linking issue for `ipopt_sens` [#418] +- Fixed Makefile for Java example regarding location of jar file +- Fixed build of R interface if using `-fvisibility=hidden`. + +### 3.13.3 (2020-10-16) + +- Members of `AmplTNLP` class are now protected instead of private. +- Updated Eclipse Public License from 1.0 to 2.0. +- Fixed dangling pointer problems with Journalist used for debugging + (`--with-ipopt-verbosity > 0`) when more than one `IpoptApplication` + is used. [#393, thanks to Brad Bell] +- Fixed build problem when using HSL library that does not include + MA27, MA57, or MC19. [#395] +- Added example `recursive_nlp` that uses Ipopt to solves an + optimization problem for the evaluation of the objective function. + [contributed by Brad Bell] +- Fixed build of linear-solver loader on Windows [#408] + +### 3.13.2 (2020-04-30) + +- The C-preprocessor defines `COIN_IPOPT_CHECKLEVEL`, + `COIN_IPOPT_VERBOSITY`, and `FORTRAN_INTEGER_TYPE`, which are defined + by `IpoptConfig.h`, have been renamed to `IPOPT_CHECKLEVEL`, + `IPOPT_VERBOSITY`, and `IPOPT_FORTRAN_INTEGER_TYPE`, respectively. + They are still available under their previous name, but these + will be removed in Ipopt 3.14. +- Changed dependencies as used by coinbrew to use new versions (2.1) + of ThirdParty/HSL and ThirdParty/MUMPS and dropped ThirdParty/Metis. + The new versions of the HSL and MUMPS build scripts now look + for a Metis library in the system and should work with both + Metis 4 and Metis 5. +- Changed location where Java interface jar gets installed from + `$libdir` to `$datadir/java/`. +- minor fixes to buildsystem + +### 3.13.1 (2020-03-11) + +- Added asserts that check whether sparsity pattern of Jacobian + and Hessian as returned by TNLP are within range w.r.t. number + of variables and constraints. [#350] +- `TNLPAdapter::ResortBnds` now initializes complete output arrays + with 0.0 before filling in values for non-fixed variables. Use + new argument `clearorig` to turn this off. [#352] +- bring back configure variables `ADD_{C,CXX,F}FLAGS` +- added configure option `--enable-relocatable` to make prefix in + pkg-config files relative to pcfiledir (assuming that `--libdir` + hasn't been set) +- bring back `configall_system.h` for build without config header +- minor fixes to buildsystem + +### 3.13.0 (2019-10-19) + +This major release comes with a larger renovation of the build +system and a changed directory structure (eliminated top directory), +which is the result of a long and still on-going effort to use +recent autotools versions for various COIN-OR projects, reduce +future maintenance efforts, and adapting behaviors of standard +autotools-based projects. +As a consequence, a monolithic build of Ipopt, which builds Ipopt +with all its dependencies in one run of configure and make is no +longer possible. Dependencies should now be build and installed +before building Ipopt. +Additionally, support for some outdated versions of dependencies +and unmaintained components of Ipopt has been dropped and some +improvements that may require changes on the users side have been +applied. + +A more detailed, probably incomplete, list of changes follows: +- Removed git submodules. Dependencies (HSL, Mumps, ASL, etc) now + need to be build and installed in advance, either manually or + by using coinbrew. +- Dropped support for HSL < 2013. +- Dropped support for MA28 in the linear solver loader. +- Dropped support for Pardiso < 4.0 from pardiso-project.org. +- Added support for Mumps 5.2.x, though initial experiments on + CUTEst indicated that, on average, performance is worse than + when using Mumps 4.10.0. +- Dropped CUTEr interface, the successor CUTEst includes an + interface to Ipopt. +- Dropped Matlab interface as it is unmaintained and it was + reported that it stopped functioning. + Use https://github.com/ebertolazzi/mexIPOPT instead. +- Dropped MSVS project files as unmaintained and not functioning + with current Ipopt anymore. +- Integrated Java interface into the main Ipopt library, that is, + it is handled equivalently to the C and Fortran interfaces: + - The source moved into `src/Interfaces`. + - The JNI functions are now included in the main Ipopt library, + thus an extra jipopt library is no longer build or necessary. + - The Java class and `org.coinor.ipopt.jar` package are build and + installed as part of the main Ipopt build. + - The examples moved into `examples/*_java`. + - A Java interface test is executed by `make test`. + - To build javadoc, run `make javadoc` in the main build directory. + - The configure flag `--disable-java` can be used to disable the + check for Java and build of the Java interface. + - `DLLPATH` and `DLLNAME` have been removed from the Ipopt class and + constructors that works without arguments and with only one + argument (specifying the Ipopt library namestem) have been added. + - Method `Ipopt::finalize` has been marked as deprecated and will + be removed in some future Ipopt version. Users must call + `dispose()` explicitly. +- Integrated sIpopt into the main Ipopt build, that is, it is now + build together with Ipopt, but installed as separate library + and executable. Use `--disable-sipopt` to disable building sIpopt. +- `IPOPT_THREAD_LOCAL` now uses C++11's `thread_local` keyword if C++11 + is available. +- When using a GCC-compatible compiler, Ipopt and sIpopt interface + functions are now declared with `visibility(default)`-attribute, + thus building Ipopt with `-fvisibility=hidden` still produces a + usable library. +- When using a MSVC-compatible compiler, Ipopt and sIpopt interface + functions are now declared with `dllimport`-attribute, so that an + Ipopt C++ DLL can be used. +- Under Windows/Msys2, DLLs are now build by default. +- Cygwin and MSys1 are not supported. +- pkg-config is now mandatory to use dependencies like ASL or HSL. + On Windows, make sure to use a pkg-config version that produces + Unix-style paths. +- Script "`compile`" is now used to wrap around calls of cl/icl/ifort + and translate GCC-style compiler flags to MSVC style. +- "Addlibs" files have been removed, pkg-config should be used instead. +- Header files are now installed in the better named + `$prefix/include/coin-or` instead of `$prefix/include/coin`. +- The default for `--prefix` is no longer the build directory, but + the autotools-default, probably `/usr/local`. +- The check for a Fortran compiler can be disabled via `--disable-f77` + and Ipopt can easier be build without a Fortran compiler. +- Lapack is no longer optional, but required. The separate check + for Blas and the `--with-blas` flags have been removed. +- `--enable-debug` does not imply `--disable-shared` anymore. +- Removed `--enable-debug-ipopt`, use `--enable-debug` instead. +- Removed configure variables `{ADD,OPT,DBG}_{C,CXX,F77}FLAGS`. + Use `{C,CXX,F77}FLAGS` instead. +- Silent build output is now enabled by default, use configure + flag `--disable-silent-rules` or call make with `V=1` to disable. +- Also for static builds, PIC objects are now generated by default, + use `--without-pic` to disable. +- The `--with-*-incdir` and `--with-*-lib` configure flags have been + replaced by corresponding `--with-*-cflags` and `--with-*-lflags` + flags. Note that the include directories need to be specified + via `-I` in `--with-*-cflags`. +- Fixed handling of `ma77_default_control` in `LSL_setMA77()`. +- Fixed calculation of quality function when setting option + `quality_function_centrality` to `reciprocal`. +- Fixed compiler warnings, in particular when using `-Wunused-parameter`. +- Changed default for `ma97_print_level` to -1. This avoids messages + about numerical singular systems written to stdout by default. + +## 3.12 + +### 3.12.13 (2019-04-08) + +- fixed Pardiso settings when using Pardiso from Pardiso project + website (by Olaf Schenk): the new settings should provide much + better performance; the default for option `pardiso_order` changed + from `five` to `metis`. +- changed distinction of MKL and Basel Pardiso in configure: to + use MKL Pardiso, only specify MKL for Blas; to use Basel Pardiso, + use `--with-pardiso` + +### 3.12.12 (2018-11-17) + +- allow for `--without-matlab-home` to disable check for Matlab [r2748] +- add `dppsv` to `v8-ifort` [r2746] +- disable error in `LibraryHandler.c` if `snprintf` detection failed [r2751] + +### 3.12.11 (2018-09-16) + +- fill MUMPS struct with zeros when allocating in MUMPS interface [r2724] +- minor fix in build-system of ThirdParty/ASL + +### 3.12.10 (2018-06-02) + +- fixed setting for parallel solve when using MKL Pardiso + (by t1393988511) [r2711]: parallel solve was disabled (which + is not the default); note, that the setting for parallel + factorization was not affected +- fixed invalid read in AMPL interface for problems without + objective function [r2715, #305] +- updated ThirdParty/ASL to retrieve updated ASL (20180528) [#305] +- name JIpopt library `libjipopt.dylib` on Mac OS X [r2718, #275] + +### 3.12.9 (2018-01-15) + +- fixed memory leak in MA86 interface (by mhahn) [r2700,#283] +- fixed handling of time limit when reoptimizing: CPU time spend + was accumulated when reoptimizing, while it should have been + reset for each solve (by paul-scott) [r2702,r2703] +- fixed sign in Jacobian finite-difference approximation when point + was close to variable upper bounds (by Enrico Bertolazzi) [r2704] + +### 3.12.8 (2017-06-12) + +- add define for `FORTRAN_INTEGER_TYPE` to `config_ipopt_default.h` +- `IpoptApplication::RethrowNonIpoptException()` now returns whether + non-ipopt exceptions were rethrown before the method was called. + +### 3.12.7 (2017-02-25) + +- removed compiler flag `-pedantic-errors` to avoid problems with some + configure tests when using recent GCC versions +- fixed rare bug in handling variable/constraint names in `AmplTNLP` + (by G. Hackebeil) [r2673] +- the `get.Mumps` script in ThirdParty/Mumps now renames `libseq/mpi.h` + to `libseq/mumps_mpi.h` to avoid conflicts when building in a MPI + environment (by T. Ralphs); note that if updating an existing + checkout/download of Ipopt, you may have to rerun get.Mumps + +### 3.12.6 (2016-07-20) + +- better support for custom algorithm development [r2659] (by Gabriel Hackebeil): + "Reorganization of the `AlgorithmBuilder` class to allow easier + customization of the Ipopt algorithm. In particular, we wanted to + make use of the code that creates the `SymLinearSolver` object to + implement our own `SymLinearSolver` without copy-pasting everything + in AlgorithmBuilder. + `AlgorithmBuilder::BuildBasicAlgorithm` now consists of 8 method calls + that build the core components passed into the arguments of the + `IpoptAlgorithm` class. These calls are ordered based on any dependencies + they might have. In addition, all code for creating the `PDSystemSolver`, + `AugSystemSolver`, and `SymLinearSolver` has been moved into separate factory + methods. + Also, included is a change to install a few more header files with Ipopt. + Some of these are required to subclass AlgorithmBuilder, and the others + are simply some matrix types that we require." +- extend build system to work without Fortran compiler [r2660,r2661]: + If no Fortran compiler is available (`F77=unavailable`), then + the build system checks for functions in Blas, Lapack, and + Pardiso via C linkage. This seems to work when using the Intel MKL, + thus allowing to build Ipopt with C/C++ compilers and MKL only. + The linear solver loader and the CuteR interface are disabled when + no Fortran compiler is available. A user may have to adjust the + definition of `F77_FUNC` in `Ipopt/src/Common/IpoptConfig.h`. + +### 3.12.5 (2016-04-30) + +- changed `fptr` from `long` to `void*`: the Fortran side needs to + make sure that it uses a big enough integer type to store a + C pointer, thus `void*` can be used on the C side [r2599] +- added additional second-order-correction method, which can be + selected by setting the new option `soc_method` to 1 (by Wei Wan) + [r2606, r2607] +- added parameter `allow_clobber` with default value false to + `IpoptApplication::Initialize()` and `OptionsList::ReadFromStream()` + +### 3.12.4 (2015-08-09) + +- option to use regularized Hessian when doing a curvature test + without inertia information (`neg_curv_test_tol` > 0), new + option `neg_curv_test_reg` to switch back to original behavior + (by N.-Y. Chiang and V. Zavala Tejeda) [r2579] +- sIpopt: Added access to sensitivity directional derivative + vector (`ds/dp*(p-p0)` Eq. 14 sIpopt implementation paper). Also, + added an option to compute the sensitivity matrix and provide + access to it. Finally, added an example that shows how to + access the new information. (by R. Lopez-Negrete) +- use workaround for failing check for random number generator + with any gcc 4.8.x, x >= 2 + +### 3.12.3 and 3.11.11 (2015-04-15) + +- fixed bug in MA97 interface that lead to conversion issues + (by J. Hogg) [r2566, #260] + +### 3.12.2 (2015-04-04) + +- revised integration of doxygen-generated documentation into build system + (by T. Ralphs) + +### 3.12.1 (2015-02-13) + +- fixes to build system for dependency linking and library versioning +- Ipopt will now report an NLP with inconsistent variable bounds + or inconsistent constraints sides as infeasible instead of + throwing an invalid TNLP exception (by T. Kelman) [r2548] + +### 3.12.0 (2015-01-23) + +- Library dependencies are now recorded in shared library builds, + which is intended to simplify linking against the Ipopt library. + However, the pkg-config and `ipopt_addlibs` files do not reflect + this change yet (it is rather experimental, imho). To restore + the previous behavior, use `--disable-dependency-linking` as + configure option. +- If linking against Intel MKL for Blas/lapack, use of Pardiso + from MKL is now automatically enabled. Note, that this will + change the default solver on Ipopt builds without any of the + linear solvers MA27, MA57, MA97, and MA86 (these take preference + over Pardiso). [#216] +- dropped support for old HSL sources (<2013; ThirdParty/HSLold) +- updated ASL sources, now downloaded from AMPL-MP (github) +- some internal changes to data structures (improved use of compound + component spaces) and addition of `IpLapackDppsv` (by Gabe Hackebeil) + +## 3.11 + +### 3.11.10 (2015-01-18) + +- fix a memory allocation in Java interface in cases where `jint` + has a different size than `int` [r2513] +- the buildsystem now tries the `Accelerate` framework instead of + `vecLib` for finding Blas/Lapack on MacOS X + +### 3.11.9 (2014-08-16) + +- fix compilation issue of Java interface on systems where `Index` + and `jint` have different size [r2498, #241] +- work around failing check for random number generator with gcc + 4.8.3 [r2495, r2496] +- readded `IpTaggedObject.cpp` to list of sources to compile in + MSVS `v8-ifort` project file [r2492] +- work around missing support for thread-local storage with gcc < 4.5 + on MacOS X [r2491, #243] +- fix call to MKL Pardiso init function [r2489] +- speed up Triplet to CSR converter [r2487, #234] +- fixed a bug in equilibration scaling where average values were + computed incorrectly (by V. Zverovich) [r2483] + +### 3.11.8 (2014-04-08) + +- fixed a bug, introduced with Ipopt 3.11.0, where the tag in the + Ipopt's caching mechanism was not unique over time, which lead + to failures of Ipopt that were difficult to debug or recognize + (e.g., Ipopt may have stopped with an restoration failure for + instances that solved fine with Ipopt 3.10) [r2472, r2473] + I'm very thankful to Gabriel Hackebeil and Kurt Majewski for + their debugging effort on this issue. +- building Mumps with pthreads is now disabled by default [#229] +- fixed setting of `LD` on Windows (now set to link only iff using + MS/Intel compilers) [#230] +- fixed download link for Gnumex [r2471] +- for some messages about too-few-degrees-of-freedom and restoration + failure, the message level changed from error to strong-warning + [r2460, r2469] +- revised calls to `MPI_Init` and `MPI_Finalize` in MUMPS interface [r2467] + (`MPI_Init` is now called only if function `MPI_Initialized` is available + and MPI has not been initialized already; `MPI_Finalize` is only called + if Ipopt also called `MPI_Init`; ...) + +### 3.11.7 (2013-12-18) + +- adapted PARDISO parameters when using MKL PARDISO to be close + to using Basel PARDISO +- added options `pardiso_max_iterative_refinement_steps` and + `pardiso_order`; the former defaults to 1 in case of MKL PARDISO, + which may help on instances that otherwise fail due to numerical issues +- removed duplicate code in `IpQualityFunctionMuOracle.cpp` [#225, r2445] +- fixed bug in triplet to csr converter [#226, r2446] +- minor changes in buildsystem + +### 3.11.6 (2013-11-16) + +- updates to Matlab Interface build system (by T. Kelman) +- fix to updates of R Interface [r2416, #223] +- fixed `SHAREDLIBEXT` in `v8-ifort`'s `config.h` [r2426, #224] +- minor fixes to the buildsystem + +### 3.11.5 (2013-10-26) + +- added method `IpoptApplication::RethrowNonIpoptException()` to enable + rethrowing of non-ipopt and non-`bad_alloc` exceptions catched in + the `*Optimize()` and `Initialization()` methods; default is still to + return with `NonIpopt_Exception_Thrown` status +- minor fixes to the buildsystem [#215, #222] + +### 3.11.4 (2013-09-12) + +- hopefully fixed non-working linear solver loader in DLLs build with + MSVS/`v8-ifort` project files [r2365] +- allow MC19 to be loaded via linear solver loader (by J. Currie) [r2366] +- fixed new point flag when running dependency detector [r2368] +- experimental: adapt Pardiso interface to work with MKL Pardiso + (by J. Currie, T. Kelman) [r2369, #216]: + - in a few tests it has been found that Pardiso from Intel MKL nowadays + seems to work fine with Ipopt + - to use Intel MKL with Ipopt 3.11, one has to specify the MKL libs via + `--with-pardiso` and add `-DHAVE_PARDISO_MKL -DHAVE_PARDISO_PARALLEL` + to the compiler flags + - note that this is still an experimental feature (and thus not enabled + by default) +- updated Ipopt/R interface to version 0.8.4 [r2373] + - additional variables have been included in the object returned from `ipoptr`: + - `z_L`: final values for the lower bound multipliers + - `z_U`: final values for the upper bound multipliers + - `constraints`: final values for the constraints + - `lambda`: final values for the Lagrange multipliers + - removed `ipoptr_environment` as argument in `ipoptr` (see also r2372) +- fixed bug in penalty term for centrality in quality function (not used by + default) [#219, r2374] +- minor bugfixes in AMPL interface, debug print statements, and compound matrix + (by G. Hackebeil) [#218, r2371, r2377, r2378, r2379] +- download scripts for ASL, Blas, and Lapack now first try to download tarball + copies from the COIN-OR server + +### 3.11.3 (2013-08-08) + +- `get.*` scripts for ThirdParty/{ASL,Blas,Lapack} now work around broken + ftp access to www.netlib.org. + +### 3.11.2 (2013-07-01) + +- changed default for option `option_file_name` to `ipopt.opt`; specifying an + empty string for this option now disables reading of an option file [r2339] +- missing initial values are now set to 0.0, projected onto variable bounds, + in AMPL interface [r2340, #205] +- fixed missing variable initialization in MA97 interface [r2341, #206] + +### 3.11.1 (2013-06-14) + +- the setup for the `v8-ifort` MSVS project changed to use dynamic runtime + DLLs instead of static linking, which caused crashes in debug mode + (by M. Roelofs) [r2301] +- fixed memory leaks in Java Interface (by javier) [#200, r2312] +- updates and fixes to MA77 and MA87 interfaces, adding support of + HSL 2013 codes (by J. Hogg); + HSL 2012 still supported when compiled with Ipopt, but the linear solver + loader to dynamically load a HSL library at runtime now assumes HSL 2013 +- added option `ma97_solve_blas3` (by J. Hogg) [r2329] +- changed default for option `ma27_meminc_factor` from 10.0 to 2.0 [r2330] +- fixed bug in `ipopt_auxdata` of MATLAB Interface related to `iterfunc` [r2325] + +### 3.11.0 (2013-05-07) + +#### Miscellaneous + +- update and extension of Ipopt documentation +- updated build of doxygen-generated documentation to comply with other + COIN-OR projects +- localized global variables in `TaggedObject` and `RegisteredOption`, + so that Ipopt should now be threadsafe as long as Ipopt objects + (esp. `SmartPtr`'s) are not shared between threads and a threadsafe + linear solver is used (e.g., MA27) [#167] +- no more need for whitespace character at end of options file +- added options `print_frequency_iter` and `print_frequency_time` to regulate + which iteration summary lines should be printed [#161] +- function evaluation timings are now available in `OrigIpoptNLP` [#86] +- some fixes to uncommon issues with the Ipopt `SmartPtr` [#162] + +#### Linear Solver Interfaces + +- new build system for Harwell codes (ThirdParty/HSL), which requires + the coin-hsl archives from http://www.hsl.rl.ac.uk/ipopt/; + previously downloaded HSL sources can still be used by placing them + into ThirdParty/HSLold, but this option will be removed in a future + Ipopt version +- new interfaces for Harwell codes HSL_MA77, HSL_MA86, and HSL_MA97; + see http://www.hsl.rl.ac.uk/ipopt/ about help on when to use which solver; + especially MA57 and HSL_MA97 should be considered as replacement for MA27; + however, MA27 is still the default for now +- changed default of `ma57_automatic_scaling` to `no` (faster in general, + but for higher reliability, you may want to set this option to yes) + +#### Ipopt Interfaces + +- major improvements for building the MATLAB interface (see documentation) +- MATLAB interface now returns number of function evaluations, too +- the MA57 interface can now be used with the MA57 library that comes with + MATLAB (configure option `--enable-matlab-ma57`; cannot use Metis) +- `auxdata` is now handled by a wrapper function `ipopt_auxdata.m` instead + of internally within the MEX code (replace Matlab call to `ipopt` with + `ipopt_auxdata` if using auxiliary data in any callbacks) [r2282] +- exposed more intermediate Ipopt information to `iterfunc` callback [r2283] + +- fixes to JIpopt buildsystem (now may work on windows and uses libtool) +- JIpopt now reads options file `ipopt.opt` by default, if present +- removed predefined `KEY_` strings in JIpopt +- renamed API functions that retrieve solution values in JIpopt + +- simplified installation of R interface + +## 3.10 + +### 3.10.4 (2013-05-05) + +- fixed sign of dual values in AMPL solution again (with help of Gabe) + [r2169, r2170, r2184, #183] +- fixed bugs with reoptimizing a TNLP with all variables fixed [r2172, r2173, #179] +- fixed more issues with sparse data structures and non-double numbers + in Matlab interface (by T. Kelman) [r2191] +- added missing `final int` for Ipopt return code `Maximum_CpuTime_Exceeded` + in Java interface [r2216] +- fixed bug when trying to warmstart Ipopt in Java interface [r2253] +- fixed wrong use of `SmartPtr`'s in Java interface [r2255, r2263] +- fixed bug in returning final solution in Java interface [r2258] +- included patch in ThirdParty/Mumps to work around bugs in Mumps + matrix ordering routines AMF and QAMD (now give preference to AMD and METIS) + +### 3.10.3 (2012-11-19) + +- minor fixes in MA86 interface (by Jonathan Hogg) [r2069, r2086] +- fix in `IpTripletToCSRConverter` for CSR forms with + extra entries (by Jonathan Hogg) [r2087] +- workaround problems with Mac OS X Lion's blas library + (by Frederic Hetch) [r2102, #181] +- the C interface now catches also Ipopt exceptions thrown + within the `OptimizeTNLP` call and returns `Ipopt::Unrecoverable_Exception` + as status [r2094, #144] +- fixed segmentation fault in adaptive barrier parameter update rule + when using the mehrotra option on unconstrained problems [r2114, #114] +- fixed segmentation fault in case no iterate is available in case of + catastrophic failure in restoration phase [r2115] +- fixed default for `mumps_dep_tol` to work with current Mumps versions [r2116] +- fixed sign of dual values in AMPL solution [r2123, #183] +- fixed issue with sparse gradients in Matlab interface + (by T. Kelman) [r2133, #187] +- sIPOPT (by H. Pirnay): + - starting values in C++ version of parametric example now + match AMPL version [r2098] + - numerical values in parametric example now match publication [r2099] + - added options `n_sens_steps` and `sens_boundcheck` as AMPL options [r2099] + - any non-zero suffix value is now accepted for `sens_init_constr` [r2100] + - fix typo in AMPL interface (by Weifeng Chen) [r2110] + - fix bug when compiling without AMPL interface [r2113] +- build system: + - updated instruction on using nowadays HSL sources (by T. Kelman) + - fixed issue with libdir being `/lib64` +- other minor fixes + +### 3.10.2 (2012-02-12) + +- updates to HSL interface (by Jonathan Hogg): + - MC68 can now be loaded dynamically, too + - MA86 exploits built-in scaling + - MA86 can choose best ordering from AMD and Metis + - fix for return code of MA86 for singular matrices +- corrected computation of Upsilon (norm of step SQUARED) +- updates to MSVS `v8-ifort` project files and addition of vc10 + project files (using vc8-generated `IpoptFSS.dll`) (by Marcel Roelofs) +- minor bugfixes, include updates in BuildTools + +### 3.10.1 (2011-09-20) + +- include updates in BuildTools, including new ThirdParty/Metis + (fix for URL to download Metis 4.0.3 release) +- linear solver loader prints error code when failing to load + library under Windows +- message on failure when reallocating memory in Mumps now includes + size of memory that was tried to be allocated +- added missing include of `cstdio/stdio.h` in `IpJournalist.hpp` +- minor fixes to build system + +### 3.10.0 (2011-06-20) + +- move to new COIN-OR configuration and installation convention +- primal infeasibility output is now true infeasibility in original + problem formulation + +## 3.9 + +### 3.9.3 (2011-04-07) + +- include updates in BuildTools, including new ThirdParty/Metis + (required to work with current metis release) + +### 3.9.2 (2010-12-22) + +- converted from Common Public License to Eclipse Public License +- some bugfixes from BuildTools + +### 3.9.1 (2010-11-26) + +- improved Hessian update for restoration phase +- added intermediate callback feature to C and Fortran interface + +### 3.9.0 (2010-11-05) + +- switching to new BuildTools system +- added R interface (contributed by Jelmer Ypma) +- updates in AsNMPC (by Hans Pirnay) + +## 3.8 + +### 3.8.3 (2010-06-29) + +- restated `SolveStatistics::TotalCPUTime` method for backward + compatibility + +### 3.8.2 (2010-06-16) + +- uses MUMPS version 4.9 and Lapack version 3.2.1 +- added AsNMPC contribution made by Hans Pirnay +- enhanced MA57 options +- several bug fixes and minor additions + +### 3.8.1 (2009-10-30) + +- Bugfix in NLP function evaluation timing measurement. The + time for the objective function gradient had been forgotten. + +### 3.8.0 (2009-10-30) + +- Added MSVC solution with Intel Fortran compiler to generate DLLs + (contributed by Marcel Roelofs). To make this work, a lot of methods + in exported headers have been made virtual +- changed default convergence tolerance in restoration phase (now same + as regular tolerance) +- output is flushed after each iteration + +## 3.7 + +### 3.7.1 (2009-10-06) + +- bugfix for square problems +- correct timing information (obj gradient was forgotten) +- flush output buffer after each iteration +- first code for iterative WSMP version (experimental and undocumented) + +### 3.7.0 (2009-07-16) + +- a number of fixes (including those from 2009 COIN-OR Bug Squashing Party) +- changes in some exposed header files to provide access to internal + data structures for specific applications + +## 3.6 + +### 3.6.1 (2009-05-01) + +- minor corrections in tutorial files + +### 3.6.0 (2009-04-29) + +- new Matlab interface +- added new option to limit cpu time: `max_cpu_time` +- added ThirdParty directory for Metis to be used with MUMPS or MA57 +- updated CUTEr Makefile to make it work with CUTEr2 +- added files for a tutorial (including coding exercise) + +## 3.5 + +### 3.5.5 (2009-01-13) + +- minor fixes regarding compilation +- undocumented version of inexact method + +### 3.5.4 (2008-09-29) + +- changed to MUMPS version 4.8.3 in externals (Mumps developers + seem to have removed 4.8.1). + +### 3.5.3 (2008-09-19) + +- changed back to MUMPS version 4.8.1 since there seem to be issues + on Windows + +### 3.5.2 (2008-09-18) + +- changed to latest version of MUMPS (4.8.2) +- some bugfixes (linear algebra objects, automatic problem scaling) +- made sure the subversion revision number is correct in all files +- allowed general additional data and cq in `IpData` and `IpCq` + +### 3.5.1 (2008-08-26) + +- changed to latest version of MUMPS (4.8.1) + +### 3.5.0 (2008-08-25) + +- added `ComputeRowAMax` and `ComputeColAMax` methods to Matrix base class +- changed externals for MUMPS to stable/1.1 +- call `finalize_solution` in more failure cases + (this means that AMPL writes .sol file in more situations) +- added `IpTNLPReducer` as simple way to exclude constraints from problem +- several fixes, also from COIN-OR Bug Squashing Party 2008 + +## 3.4 + +### 3.4.2 (2008-07-18) + +- some bug fixes +- added wallclock time routine +- penalty function version does no longer crash if it + wants to go to restoration phase (not that this really helps + convergence though) + +### 3.4.1 (2008-05-30) + +- some bug fixes +- deleted `v9` MSVC files again (since `v8` works fine for `v9`) +- print Ipopt version in default print level +- added option that allows to change name of options file + (`option_file_name`) + +### 3.4.0 (2008-04-25) + +- added support to dynamically load HSL or Pardiso: + If Ipopt has been compiled without some HSL or Pardiso solver, + it can now load those solvers from a shared library at runtime + without recompilation. This will make distribution of binaries + easier. Does not work on all platforms yet. +- several bugfixes +- ensured compilation of MSVS project files (`v8` and `v9`) +- new special return code for square problems + (`Feasible_Point_Found` returned if dual inf not small) +- new initialization option for bound multipliers + (see option `bound_mult_init_method`) +- added simple penalty function line search option + (`line_search_method=penalty`) - not guaranteed to converge, see + Ipopt implementation paper (in MathProg) +- some very basic method to approximate constraint Jacobian by + finite differences (not efficient, but will hopefully be extended) + +## 3.3 + +### 3.3.5 (2008-02-28) + +- corrected links for Ipopt mailing list +- added missing `Makefile.in` for Matlab interface +- the `addlibs*` files are now installed in `share/doc/coin/Ipopt` + instead of lib +- updates in Matlab interface +- bugfix for ticket #56 + +### 3.3.4 (2007-12-27) + +- headers are now installed in `include/coin` (no longer in `include/ipopt`) +- default for `dual_inf_tol` is now 1 (instead of 1e-4) +- In matlab interface, here the text from Peter Carbonetto: + There have been several significant changes made to the MATLAB interface + since the last release. The most important two changes are: + 1. Following the "warm start" feature of IPOPT, you may pass in initial + estimates for the Lagrange multipliers. + 2. Callback routines for computing the objective, gradient (etc.) are now + specified using function handles instead of strings. + (Thanks to Marcus Brubaker at the University of Toronto for the initial suggestion.) + +### 3.3.3 (2007-09-25) + +- minor changes, bug fixes + +### 3.3.1 (2007-06-20) + +Synchronized with all changes in trunk; probably more than to be +remembered. In the following a few: +- support for Mumps linear solver (contributed by Damian Hocking) +- `--print-options` flag for ipopt ASL solver executable to see all + Ipopt options (available through `ipopt.opt` file) +- added Matlab interface (contributed by Peter Carbonetto) +- added support for `f2c` compiler to compiler Fortran code with + MSVC++ compiler +- new MSVS support (now within MSVS project and also with `f2c`) +- a number of small changes/bug fixes/improvements +- small change in interface (e.g., `FinalizeSolution` method) + +## 3.2 + +### 3.2.4 (2007-04-24) + +- updated download script for Blas to fit netlib's recent changes +- using a more recent version of BuildTools + +### 3.2.3 (2006-11-29) + +- updated download script for Lapack to fit to netlib's recent changes + +### 3.2 r795 (2006-10-11) + +- Bugfix in L-BFGS update +- fix in configure with detection of `sizeof(int*)` on Cygwin + +### 3.2.1 (2006-07-14) - dev release number 764 + +- Bugfix in least square multiplier estimate. + It mainly showed up in LBFGS with restoration phase as seg fault + +### 3.2.0 (2006-07-07) - dev release number 757 + +- changed installation procedure and directory structure to + conform with new COIN-OR convention + +## 3.1 + +### 3.1.0 (2006-04-08) - dev release number 714 + +Several bug-fixes, improvements and additions. In particular: +- new quasi-Newton approximation using L-BFGS +- interfaces to linear solver MA57, WSMP, Pardiso + (MUMPS and TAUCS not yet completed) +- derivative checker +- unit test +- configure supports compilation under Cygwin with native Windows compilers +- ScalableExample +- user call-back method in TNLP + +## 3.0 + +### 3.0.1 (2005-12-04) + +- Several corrections to Windows files +- Fix termination if number of iterations is exceeded in restoration phase + +### 3.0.0 (2005-08-26) - dev release number 510 + +- First official release of the new C++ implementation of Ipopt. + +## 2.2 + +### no new release (2005-08-19) + +- corrected detection of BLAS libraries for SUN (make sure the example Makefiles work) +- upgrade LICENSE file to CPL version 1.0 as retrieved from www.opensource.org + +### 2.2.1e (2005-05-30) + +- fixed sign of multipliers returned to AMPL + (bug reported by Rhoda Baker and Karsten Theissen) +- switched to automake 1.9.5 + +### no new release (2005-01-07) + +- bugfix for the limited memory BFGS in case of square problems + (bug reported by Wanhe Zhang and Ned Nedialkov) + +### 2.2.1d (2004-10-05) + +- Added `outlev` as an option to the AMPL solver as a synonym for `iprint` +- For `iprint` = 0, the output lines per iteration are now suppressed +- corrected two bugs in `configure` script (test for size of `long` etc + before Fortran libraries as added to `LIBS`; prevent cycling in + `make -j 1` test) +- internally renamed subroutine `ERROR` to `OPTERROR` (`ERROR` had a + name clash for some Fortran compiler) +- avoid uninitialized variable in `update_b_lm.f` +- minor correction in computation of residual in `get_step_full.F` +- minor change for slack correction in `filter.F` + +### 2.2.1c (2004-07-20) + +- corrected bug leading to very small `QTAU` in rare circumstances + +### 2.2.1b (2004-05-21) + +- Make `DFILLINFACT` option available through AMPL interface +- Now, later increase of memory requirement for Harwell solvers is also + based on `DFILLINFACT`, instead of using a fixed values of 10. + +### 2.2.1a (2004-05-13) + +- fix in `IPOPT/ipopt/mainloop.F`: + The multipliers were not scaled back for low printlevel. + +### no new release (2004-04-28) + +- fix in `IPOPT/AMPL_interface/ipoptAMPL.c`: + Now the mulitpliers for the constraints are passed back to AMPL. +- Added download scripts using `wget` to get ASL, BLAS, and LAPACK more easily. + Thanks to Frank Wuebbeling for the hint. + +### 2.2.1 (2004-04-25) + +- AMPL solver executable is now called `ipopt` (instead of `ipoptAMPL`). + This fixed also problem with assigning IPOPT options from within + AMPL. (reported by Karsten Theissen) +- default value for number of iterations is now 10000 (instead of 1000) +- new option: `IMAXCPUSEC` to be set to the maximum number of CPU seconds + after which the algorithm should stop. The check is performed only at + certain points in the algorithm, so that the executable might run longer + than specified. + The algorithm also stops (as before) when the file "STOP" is detected in + the current directory. Finally, a call to `USER_REQUESTED_STOP` has + been added if the preprocessor macro `USE_USER_REQUESTED_STOP` has been + defined. If this `LOGICAL` function returns `.TRUE.`, the algorithm also + stops. This feature was requested by David Ternet. +- if IPOPT is run several time in a row, the counting of function + evaluations is restarted after every new call of IPOPT. +- in `get_step_full`, now check if the number of negative eigenvalues is LESS + than then number constraints. If so, increase the pivot tolerance, + and if that doesn't help, pretend that the system is singular. + (this fixed a problem reported by Hans Mittelmann) +- decrease default values for `DPIVTOLMAX` +- suppress superflous leading zeros in iteration output. For long output + (`ioutput=1`) include CPU time +- a few changes regarding the inertia correction (`get_step_full.F`). + This decreases CPU time significantly in a few cases. +- corrected problem in C-files related to names for `struct`'s (some GNU + compiler complained) +- changed default options for GNU compilers (now `-O3 -funroll-loops`, + no longer `-O2` and `-mieee-fp`) +- no reference to MC35 in `resto_tron` if `HAVE_MC35` is not defined +- `#error` preprocessor directive removed from `*.F` files, since not all + compilers understand it (reported by Hans Mittelmann) +- switch to automake 1.8.3 + +### 2.2.0 (2004-03-10) + +Many things have changed since the last official release. +Here a few highlights: +- easier installation procedure with autoconf +- algorithm made more robust and efficient +- new restoration phase for filter method (TRON no longer needed for + full-space option anymore) +- C-interface diff --git a/LICENSE b/LICENSE index 16cc69a52..7c23725fc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,87 +1,260 @@ -Eclipse Public License - v 1.0 +Eclipse Public License - v 2.0 -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + +"Contributor" means any person or entity that Distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which +are necessarily infringed by the use or sale of its Contribution alone +or when combined with the Program. + +"Program" means the Contributions Distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this Agreement +or any Secondary License (as applicable), including Contributors. + +"Derivative Works" shall mean any work, whether in Source Code or other +form, that is based on (or derived from) the Program and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. + +"Modified Works" shall mean any work in Source Code or other form that +results from an addition to, deletion from, or modification of the +contents of the Program, including, for purposes of clarity any new file +in Source Code form that contains any contents of the Program. Modified +Works shall not include works that contain only declarations, +interfaces, types, classes, structures, or files of the Program solely +in each case in order to link to, bind by name, or subclass the Program +or Modified Works thereof. + +"Distribute" means the acts of a) distributing or b) making available +in any manner that enables the transfer of a copy. + +"Source Code" means the form of a Program preferred for making +modifications, including but not limited to software source code, +documentation source, and configuration files. + +"Secondary License" means either the GNU General Public License, +Version 2.0, or any later versions of that license, including any +exceptions or additional permissions as identified by the initial +Contributor. 2. GRANT OF RIGHTS -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). 3. REQUIREMENTS -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and +3.1 If a Contributor Distributes the Program in any form, then: -b) its license agreement: + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. -When the Program is made available in source code form: +3.2 When the Program is Distributed as Source Code: -a) it must be made available under this Agreement; and + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and -b) a copy of this Agreement must be included with each copy of the Program. + b) a copy of this Agreement must be included with each copy of + the Program. -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. +3.3 Contributors may not remove or alter any copyright, patent, +trademark, attribution notices, disclaimers of warranty, or limitations +of liability ("notices") contained within the Program from any copy of +the Program which they Distribute, provided that Contributors may add +their own appropriate notices. 4. COMMERCIAL DISTRIBUTION -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. +Commercial distributors of software may accept certain responsibilities +with respect to end users, business partners and the like. While this +license is intended to facilitate the commercial use of the Program, +the Contributor who includes the Program in a commercial product +offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes +the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and indemnify every +other Contributor ("Indemnified Contributor") against any losses, +damages and costs (collectively "Losses") arising from claims, lawsuits +and other legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such +Commercial Contributor in connection with its distribution of the Program +in a commercial product offering. The obligations in this section do not +apply to any claims or Losses relating to any actual or alleged +intellectual property infringement. In order to qualify, an Indemnified +Contributor must: a) promptly notify the Commercial Contributor in +writing of such claim, and b) allow the Commercial Contributor to control, +and cooperate with the Commercial Contributor in, the defense and any +related settlement negotiations. The Indemnified Contributor may +participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those performance +claims and warranties, and if a court requires any other Contributor to +pay any damages as a result, the Commercial Contributor must pay +those damages. 5. NO WARRANTY -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF +TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all +risks associated with its exercise of rights under this Agreement, +including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs +or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS +SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. 7. GENERAL -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other software +or hardware) infringes such Recipient's patent(s), then such Recipient's +rights granted under Section 2(b) shall terminate as of the date such +litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign the +responsibility to serve as the Agreement Steward to a suitable separate +entity. Each new version of the Agreement will be given a distinguishing +version number. The Program (including Contributions) may always be +Distributed subject to the version of the Agreement under which it was +received. In addition, after a new version of the Agreement is published, +Contributor may elect to Distribute the Program (including its +Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient +receives no rights or licenses to the intellectual property of any +Contributor under this Agreement, whether expressly, by implication, +estoppel or otherwise. All rights in the Program not expressly granted +under this Agreement are reserved. Nothing in this Agreement is intended +to be enforceable by any entity that is not a Contributor or Recipient. +No third-party beneficiary rights are created under this Agreement. diff --git a/Makefile.am b/Makefile.am index d1aea7139..cca4380ea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,36 +1,25 @@ # Copyright (C) 2004, 2008 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. - +# # Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 -SUBDIRS = src/Common src/LinAlg src/Algorithm src/contrib/CGPenalty - -if BUILD_LINEARSOLVERLOADER - SUBDIRS += src/contrib/LinearSolverLoader -endif - -SUBDIRS += src/Interfaces src/Apps +SUBDIRS = src if BUILD_SIPOPT SUBDIRS += contrib/sIPOPT endif -if ALWAYS_FALSE - SUBDIRS += test -endif - -doc_DATA = README.md AUTHORS LICENSE +doc_DATA = README.md AUTHORS LICENSE ChangeLog.md -.PHONY: test unitTest doc javadoc astyle +.PHONY: test doc javadoc astyle cppcheck cppcheck-config -test: unitTest - -unitTest: all +test: all cd test; $(MAKE) test doc : cd doc && doxygen + sed -i -e 's@

@

\▸\ @g' doc/html/OPTIONS.html if BUILD_JAVA javadoc : @@ -44,8 +33,17 @@ clean-doc: clean-local : clean-doc astyle: - cd $(srcdir) && astyle --mode=c -A1 --indent=spaces=3 --indent-switches --min-conditional-indent=1 --convert-tabs --align-pointer=type --pad-oper --add-brackets -n -r "*.hpp" "*.h" "*.cpp" "*.c" - cd $(srcdir) && astyle --mode=java -A1 --indent=spaces=3 --indent-switches --min-conditional-indent=1 --convert-tabs --align-pointer=type --pad-oper --add-brackets -n -r "*.java" - -pkgconfiglibdir = $(libdir)/pkgconfig -pkgconfiglib_DATA = ipopt.pc + cd $(srcdir) && astyle --mode=c -A1 --indent=spaces=3 --indent-switches --min-conditional-indent=1 --convert-tabs --align-pointer=type --pad-oper --add-braces -n -r "*.hpp" "*.h" "*.cpp" "*.c" --exclude=hsl_ma77d.h --exclude=hsl_ma77s.h --exclude=hsl_ma86d.h --exclude=hsl_ma86s.h --exclude=hsl_ma97d.h --exclude=hsl_ma97s.h --exclude=hsl_mc68i.h + cd $(srcdir) && astyle --mode=java -A1 --indent=spaces=3 --indent-switches --min-conditional-indent=1 --convert-tabs --align-pointer=type --pad-oper --add-braces -n -r "*.java" + +cppcheck: + cppcheck -q -j4 --enable=all --suppress=uninitMemberVar --suppress=noExplicitConstructor --inline-suppr \ + --suppress=cstyleCast:src/Apps/AmplSolver/AmplTNLP.cpp --suppress=constArgument:examples/hs071_c/hs071_c.c \ + --addon=threadsafety.py --std=c++03 --std=c99 --error-exitcode=2 --relative-paths=$(srcdir) \ + $(IPOPTLIB_CFLAGS) $(IPOPTAMPLINTERFACELIB_CFLAGS) $(addprefix -I,$(shell find $(srcdir)/src -type d)) -Isrc/Common \ + -DHAVE_CONFIG_H $(srcdir)/src $(srcdir)/test $(srcdir)/examples + +cppcheck-config: + cppcheck -q --check-config --suppress=missingIncludeSystem --std=c++03 --std=c99 --error-exitcode=2 \ + $(IPOPTLIB_CFLAGS) $(IPOPTAMPLINTERFACELIB_CFLAGS) $(addprefix -I,$(shell find $(srcdir)/src -type d)) -Isrc/Common \ + -DHAVE_CONFIG_H $(srcdir)/src $(srcdir)/test $(srcdir)/examples diff --git a/Makefile.in b/Makefile.in index e842551ff..533c041a2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,7 @@ # Copyright (C) 2004, 2008 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. - +# # Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 VPATH = @srcdir@ @@ -94,9 +94,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@BUILD_LINEARSOLVERLOADER_TRUE@am__append_1 = src/contrib/LinearSolverLoader -@BUILD_SIPOPT_TRUE@am__append_2 = contrib/sIPOPT -@ALWAYS_FALSE@am__append_3 = test +@BUILD_SIPOPT_TRUE@am__append_1 = contrib/sIPOPT subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -109,8 +107,8 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/Common/config.h \ $(top_builddir)/src/Common/config_ipopt.h -CONFIG_CLEAN_FILES = ipopt.pc doc/Doxyfile \ - examples/Cpp_example/Makefile examples/hs071_cpp/Makefile \ +CONFIG_CLEAN_FILES = doc/Doxyfile examples/Cpp_example/Makefile \ + examples/recursive_nlp/Makefile examples/hs071_cpp/Makefile \ examples/hs071_c/Makefile examples/ScalableProblems/Makefile \ tutorial/CodingExercise/C/1-skeleton/Makefile \ tutorial/CodingExercise/C/2-mistake/Makefile \ @@ -121,7 +119,8 @@ CONFIG_CLEAN_FILES = ipopt.pc doc/Doxyfile \ tutorial/CodingExercise/Matlab/1-skeleton/startup.m \ tutorial/CodingExercise/Matlab/2-mistake/startup.m \ tutorial/CodingExercise/Matlab/3-solution/startup.m \ - examples/hs071_f/hs071_f.f examples/hs071_f/Makefile \ + examples/hs071_f/Makefile examples/hs071_f/hs071_fs.f \ + examples/hs071_f/hs071_f.f \ tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f \ tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f \ tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f \ @@ -134,7 +133,7 @@ CONFIG_CLEAN_FILES = ipopt.pc doc/Doxyfile \ contrib/sIPOPT/examples/parametric_dsdp_cpp/Makefile \ contrib/sIPOPT/examples/redhess_cpp/Makefile \ contrib/RInterface/src/Makevars.win \ - contrib/RInterface/src/Makevars ipoptamplinterface.pc + contrib/RInterface/src/Makevars CONFIG_CLEAN_VPATH_FILES = contrib/RInterface/DESCRIPTION \ contrib/RInterface/NAMESPACE contrib/RInterface/inst/CITATION \ contrib/RInterface/inst/doc/ipoptr.Rnw \ @@ -168,7 +167,7 @@ CONFIG_CLEAN_VPATH_FILES = contrib/RInterface/DESCRIPTION \ examples/hs071_cpp/hs071_main.cpp \ examples/hs071_cpp/hs071_nlp.cpp \ examples/hs071_cpp/hs071_nlp.hpp examples/hs071_c/hs071_c.c \ - examples/hs071_java/HS071.java \ + examples/hs071_java/HS071s.java examples/hs071_java/HS071.java \ tutorial/AmplExperiments/hs71.mod \ tutorial/AmplExperiments/infeasible.mod \ tutorial/AmplExperiments/MoreAmplModels.txt \ @@ -254,8 +253,8 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfiglibdir)" -DATA = $(doc_DATA) $(pkgconfiglib_DATA) +am__installdirs = "$(DESTDIR)$(docdir)" +DATA = $(doc_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ @@ -281,12 +280,7 @@ am__define_uniq_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 -CSCOPE = cscope -DIST_SUBDIRS = src/Common src/LinAlg src/Algorithm \ - src/contrib/CGPenalty src/contrib/LinearSolverLoader \ - src/Interfaces src/Apps contrib/sIPOPT test +DIST_SUBDIRS = src contrib/sIPOPT ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ @@ -306,8 +300,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -323,10 +318,12 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ +FILECMD = @FILECMD@ FLIBS = @FLIBS@ GREP = @GREP@ HSLLIB_CFLAGS = @HSLLIB_CFLAGS@ @@ -339,7 +336,6 @@ 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@ @@ -393,6 +389,8 @@ SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_LFLAGS = @SIPOPTAMPLINTERFACELIB_LFLAGS@ SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_PCFILES = @SIPOPTAMPLINTERFACELIB_PCFILES@ +SIPOPTLIB_CFLAGS_NOPC = @SIPOPTLIB_CFLAGS_NOPC@ +SIPOPTLIB_LFLAGS_NOPC = @SIPOPTLIB_LFLAGS_NOPC@ STRIP = @STRIP@ VERSION = @VERSION@ _ACJNI_JAVAC = @_ACJNI_JAVAC@ @@ -449,6 +447,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -457,12 +456,8 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = src/Common src/LinAlg src/Algorithm src/contrib/CGPenalty \ - $(am__append_1) src/Interfaces src/Apps $(am__append_2) \ - $(am__append_3) -doc_DATA = README.md AUTHORS LICENSE -pkgconfiglibdir = $(libdir)/pkgconfig -pkgconfiglib_DATA = ipopt.pc +SUBDIRS = src $(am__append_1) +doc_DATA = README.md AUTHORS LICENSE ChangeLog.md all: all-recursive .SUFFIXES: @@ -499,12 +494,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): -ipopt.pc: $(top_builddir)/config.status $(srcdir)/ipopt.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ + +src/Common/config.h: src/Common/stamp-h1 + @test -f $@ || rm -f src/Common/stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) src/Common/stamp-h1 + +src/Common/stamp-h1: $(top_srcdir)/src/Common/config.h.in $(top_builddir)/config.status + @rm -f src/Common/stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/Common/config.h +$(top_srcdir)/src/Common/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f src/Common/stamp-h1 + touch $@ + +src/Common/config_ipopt.h: src/Common/stamp-h2 + @test -f $@ || rm -f src/Common/stamp-h2 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) src/Common/stamp-h2 + +src/Common/stamp-h2: $(top_srcdir)/src/Common/config_ipopt.h.in $(top_builddir)/config.status + @rm -f src/Common/stamp-h2 + cd $(top_builddir) && $(SHELL) ./config.status src/Common/config_ipopt.h + +distclean-hdr: + -rm -f src/Common/config.h src/Common/stamp-h1 src/Common/config_ipopt.h src/Common/stamp-h2 doc/Doxyfile: $(top_builddir)/config.status $(top_srcdir)/doc/Doxyfile.in cd $(top_builddir) && $(SHELL) ./config.status $@ examples/Cpp_example/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/Cpp_example/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/recursive_nlp/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/recursive_nlp/Makefile.in + cd $(top_builddir) && $(SHELL) ./config.status $@ examples/hs071_cpp/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/hs071_cpp/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ examples/hs071_c/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/hs071_c/Makefile.in @@ -529,10 +547,12 @@ tutorial/CodingExercise/Matlab/2-mistake/startup.m: $(top_builddir)/config.statu cd $(top_builddir) && $(SHELL) ./config.status $@ tutorial/CodingExercise/Matlab/3-solution/startup.m: $(top_builddir)/config.status $(top_srcdir)/tutorial/CodingExercise/Matlab/3-solution/startup.m.in cd $(top_builddir) && $(SHELL) ./config.status $@ -examples/hs071_f/hs071_f.f: $(top_builddir)/config.status $(top_srcdir)/examples/hs071_f/hs071_f.f.in - cd $(top_builddir) && $(SHELL) ./config.status $@ examples/hs071_f/Makefile: $(top_builddir)/config.status $(top_srcdir)/examples/hs071_f/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/hs071_f/hs071_fs.f: $(top_builddir)/config.status $(top_srcdir)/examples/hs071_f/hs071_fs.f.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +examples/hs071_f/hs071_f.f: $(top_builddir)/config.status $(top_srcdir)/examples/hs071_f/hs071_f.f.in + cd $(top_builddir) && $(SHELL) ./config.status $@ tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f: $(top_builddir)/config.status $(top_srcdir)/tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f.in cd $(top_builddir) && $(SHELL) ./config.status $@ tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f: $(top_builddir)/config.status $(top_srcdir)/tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f.in @@ -559,8 +579,6 @@ contrib/RInterface/src/Makevars.win: $(top_builddir)/config.status $(top_srcdir) cd $(top_builddir) && $(SHELL) ./config.status $@ contrib/RInterface/src/Makevars: $(top_builddir)/config.status $(top_srcdir)/contrib/RInterface/src/Makevars.in cd $(top_builddir) && $(SHELL) ./config.status $@ -ipoptamplinterface.pc: $(top_builddir)/config.status $(top_srcdir)/src/Apps/AmplSolver/ipoptamplinterface.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo @@ -591,27 +609,6 @@ uninstall-docDATA: @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) -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 \ - 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 $$?; \ - 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) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. @@ -723,7 +720,7 @@ check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfiglibdir)"; do \ + for dir in "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive @@ -763,8 +760,8 @@ clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags dvi: dvi-recursive @@ -778,7 +775,7 @@ info: info-recursive info-am: -install-data-am: install-docDATA install-pkgconfiglibDATA +install-data-am: install-docDATA install-dvi: install-dvi-recursive @@ -824,37 +821,36 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-docDATA uninstall-pkgconfiglibDATA +uninstall-am: uninstall-docDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool clean-local cscope cscopelist-am ctags ctags-am \ - distclean distclean-generic distclean-libtool distclean-tags \ - dvi dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-docDATA install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-pkgconfiglibDATA install-ps \ + distclean distclean-generic distclean-hdr distclean-libtool \ + distclean-tags dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-docDATA \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-docDATA uninstall-pkgconfiglibDATA + uninstall-am uninstall-docDATA .PRECIOUS: Makefile -.PHONY: test unitTest doc javadoc astyle - -test: unitTest +.PHONY: test doc javadoc astyle cppcheck cppcheck-config -unitTest: all +test: all cd test; $(MAKE) test doc : cd doc && doxygen + sed -i -e 's@

@

\▸\ @g' doc/html/OPTIONS.html @BUILD_JAVA_TRUE@javadoc : @BUILD_JAVA_TRUE@ $(JAVADOC) -d javadoc -windowtitle "JIpopt API documentation" $(srcdir)/src/Interfaces/Ipopt.java @@ -866,8 +862,20 @@ clean-doc: clean-local : clean-doc astyle: - cd $(srcdir) && astyle --mode=c -A1 --indent=spaces=3 --indent-switches --min-conditional-indent=1 --convert-tabs --align-pointer=type --pad-oper --add-brackets -n -r "*.hpp" "*.h" "*.cpp" "*.c" - cd $(srcdir) && astyle --mode=java -A1 --indent=spaces=3 --indent-switches --min-conditional-indent=1 --convert-tabs --align-pointer=type --pad-oper --add-brackets -n -r "*.java" + cd $(srcdir) && astyle --mode=c -A1 --indent=spaces=3 --indent-switches --min-conditional-indent=1 --convert-tabs --align-pointer=type --pad-oper --add-braces -n -r "*.hpp" "*.h" "*.cpp" "*.c" --exclude=hsl_ma77d.h --exclude=hsl_ma77s.h --exclude=hsl_ma86d.h --exclude=hsl_ma86s.h --exclude=hsl_ma97d.h --exclude=hsl_ma97s.h --exclude=hsl_mc68i.h + cd $(srcdir) && astyle --mode=java -A1 --indent=spaces=3 --indent-switches --min-conditional-indent=1 --convert-tabs --align-pointer=type --pad-oper --add-braces -n -r "*.java" + +cppcheck: + cppcheck -q -j4 --enable=all --suppress=uninitMemberVar --suppress=noExplicitConstructor --inline-suppr \ + --suppress=cstyleCast:src/Apps/AmplSolver/AmplTNLP.cpp --suppress=constArgument:examples/hs071_c/hs071_c.c \ + --addon=threadsafety.py --std=c++03 --std=c99 --error-exitcode=2 --relative-paths=$(srcdir) \ + $(IPOPTLIB_CFLAGS) $(IPOPTAMPLINTERFACELIB_CFLAGS) $(addprefix -I,$(shell find $(srcdir)/src -type d)) -Isrc/Common \ + -DHAVE_CONFIG_H $(srcdir)/src $(srcdir)/test $(srcdir)/examples + +cppcheck-config: + cppcheck -q --check-config --suppress=missingIncludeSystem --std=c++03 --std=c99 --error-exitcode=2 \ + $(IPOPTLIB_CFLAGS) $(IPOPTAMPLINTERFACELIB_CFLAGS) $(addprefix -I,$(shell find $(srcdir)/src -type d)) -Isrc/Common \ + -DHAVE_CONFIG_H $(srcdir)/src $(srcdir)/test $(srcdir)/examples # 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. diff --git a/README.md b/README.md index fe6017735..7d5ff8924 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Background Ipopt is written in C++ and is released as open source code under the [Eclipse Public License (EPL)](LICENSE). The code has been written by [Andreas Wächter](http://www.mccormick.northwestern.edu/directory/profiles/Andreas-Waechter.html) and [Carl Laird](http://allthingsoptimal.com/biography/). -The COIN-OR project managers for Ipopt are [Andreas Wächter](http://users.iems.northwestern.edu/~andreasw) und [Stefan Vigerske](https://www.gams.com/~stefan). +The COIN-OR project managers for Ipopt are [Andreas Wächter](http://users.iems.northwestern.edu/~andreasw) und [Stefan Vigerske](https://www.gams.com/~svigerske). For a list of **all contributors**, see the [AUTHORS file](AUTHORS). The C++ version has first been [released on Aug 26, 2005](http://list.coin-or.org/pipermail/ipopt/2005-August/000331.html) as version 3.0.0. @@ -37,7 +37,7 @@ The previously released [pre-3.0 Fortran version](https://github.com/coin-or/Ipo The Ipopt distribution can be used to generate a library that can be linked to one's own C++, C, Fortran, or Java code, as well as a solver executable for the [AMPL](http://www.ampl.com) modeling environment. The package includes an interface to the [R](http://www.r-project.org/) programming environment. -IPOPT can be used on Linux/UNIX, Mac OS X, and Windows platforms. +IPOPT can be used on Linux/UNIX, macOS, and Windows platforms. As open source software, the source code for Ipopt is provided without charge. You are free to use it, also for commercial purposes. @@ -47,38 +47,73 @@ And we are certainly very keen on feedback from users, including contributions! In order to compile Ipopt, certain third party code is required (such as some linear algebra routines). Those are available under different conditions/licenses. -If you want to learn more about Ipopt, you can find references in the [bibliography of the documentation](https://coin-or.github.io/Ipopt/citelist.html) and this ["Papers about Ipopt" page](https://github.com/coin-or/Ipopt/wiki/IpoptPapers). +If you want to learn more about Ipopt, you can find references in the [bibliography of the documentation](https://coin-or.github.io/Ipopt/citelist.html). -For information on projects that use Ipopt, refer to the [Success Stories page](https://github.com/coin-or/Ipopt/wiki/SuccessStories). +For information on projects or papers that use Ipopt, refer to the [Ipopt usage stories and papers](https://github.com/coin-or/Ipopt/discussions/497) discussion. Getting Started --------------- -On sufficiently prepared systems, a quick way to build and install Ipopt -is to get the coinbrew script from https://coin-or.github.io/coinbrew/ -and running +Please consult the [detailed installation instructions](https://coin-or.github.io/Ipopt/INSTALL.html) +in the Ipopt documentation. In the following, we only summarize some main points. - /path/to/coinbrew fetch Ipopt - /path/to/coinbrew build Ipopt --prefix=/dir/to/install --test - /path/to/coinbrew install Ipopt +### Dependencies -The coinbrew script will take care of building and installing the -dependencies ASL, Metis, and Mumps before building Ipopt. +Ipopt requires at least one of the following solvers for systems of linear equations: +- MA27, MA57, HSL_MA77, HSL_MA86, or HSL_MA97 from the [Harwell Subroutines Library](http://hsl.rl.ac.uk) (HSL). + It is recommended to use project [ThirdParty-HSL](https://github.com/coin-or-tools/ThirdParty-HSL) to build a HSL library for use by Ipopt. + Alternatively, prebuild libraries are available from JuliaHSL, see the [Ipopt installation instruction](https://coin-or.github.io/Ipopt/INSTALL.html#DOWNLOAD_HSL). +- [Parallel Sparse Direct Linear Solver](http://www.pardiso-project.org) (Pardiso). + Note, that the Intel Math Kernel Library (MKL) also includes a version of Pardiso, but the one from Pardiso Project often offers better performance. +- [Sparse Parallel Robust Algorithms Library](https://github.com/ralna/spral) (SPRAL). +- [MUltifrontal Massively Parallel sparse direct Solver](http://mumps.enseeiht.fr/) (MUMPS). + It is highly recommended to use project [ThirdParty-Mumps](https://github.com/coin-or-tools/ThirdParty-Mumps) to build a MUMPS library for use by Ipopt. +- [Watson Sparse Matrix Package](http://www.research.ibm.com/projects/wsmp) + +A fast implementation of BLAS and LAPACK is required by Ipopt. + +To build the AMPL interface of Ipopt, the AMPL Solver Library (ASL) is required. +It is recommended to use project [ThirdParty-ASL](https://github.com/coin-or-tools/ThirdParty-ASL) to build a ASL library for use by Ipopt. + +### Build + +After installation of dependencies, an Ipopt build and installation follows these 4 steps: + +1. Run `./configure`. Use `./configure --help` to see available options. + +2. Run `make` to build the Ipopt libraries. If ASL was made available, also Ipopt executables will be build. + +3. Run `make test` to test the Ipopt build. + +4. Run `make install` to install Ipopt (libraries, executables, and header files). + +It is suggested to use the same installation prefix (`--prefix` option of `configure`) +when configuring the build of ThirdParty-ASL, ThirdParty-HSL, ThirdParty-MUMPS, and Ipopt. + +### Using coinbrew + +An alternative to the above steps is to use the `coinbrew` script from +https://coin-or.github.io/coinbrew/. +`coinbrew` automates the download of the source code for ASL, MUMPS, and Ipopt +and the sequential build and installation of these three packages. + +After obtaining the `coinbrew` script, run + + /path/to/coinbrew fetch Ipopt --no-prompt + /path/to/coinbrew build Ipopt --prefix=/dir/to/install --test --no-prompt --verbosity=3 + /path/to/coinbrew install Ipopt --no-prompt More details on using coinbrew can be found at the instructions on [Getting Started with the COIN-OR Optimization Suite](https://coin-or.github.io/user_introduction). -If using coinbrew is not sufficient, then the -[installation instructions in the Ipopt documentation](https://coin-or.github.io/Ipopt/INSTALL.html) -should be studied. +### Precompiled binaries Some precompiled binaries of Ipopt are also available: -- **[JuliaOpt provides Ipopt binaries](https://github.com/JuliaOpt/IpoptBuilder/releases)** -- **[AMPL provides binaries](http://ampl.com/products/solvers/open-source/#ipopt)** for using Ipopt through AMPL -- **[Pardiso project provides binaries](https://pardiso-project.org/index.html#binaries)** for using Ipopt with Pardiso through Matlab - +- **[Ipopt releases page](https://github.com/coin-or/Ipopt/releases)** provides libraries and executables for Windows +- **[JuliaBinaryWrappers](https://github.com/JuliaBinaryWrappers/Ipopt_jll.jl/releases)** provides libraries and executables; [JuliaHSL](https://licences.stfc.ac.uk/product/julia-hsl) provides prebuild HSL libraries +- **[IDEAS](https://github.com/IDAES/idaes-ext/releases)** provides executables; these executables include HSL solvers Getting Help ------------ @@ -86,18 +121,42 @@ Getting Help * **[Ipopt Documentation](https://coin-or.github.io/Ipopt/)** with installation instructions, options reference, and more * **[Issue tracking system](https://github.com/coin-or/Ipopt/issues/)**: If you believe you found a **bug** in the code, please use the issue tracking system. Please include as much information as possible, and if possible some (ideally simple) example code so that we can reproduce the error. - * **[Mailing list](http://list.coin-or.org/mailman/listinfo/ipopt)**: subscribe to get notifications about updates and to post questions and comments regarding Ipopt - * **[Mailing list archive](http://list.coin-or.org/pipermail/ipopt/)** - * **[Ipopt Wiki](https://github.com/coin-or/Ipopt/wiki)** with hints and tricks - * [short Ipopt tutorial](http://drops.dagstuhl.de/volltexte/2009/2089/pdf/09061.WaechterAndreas.Paper.2089.pdf) + * **[Discussions](https://github.com/coin-or/Ipopt/discussions)**: ask questions, share ideas, engage with the Ipopt community + * **[Mailing list archive](http://list.coin-or.org/pipermail/ipopt/)** (2002-2020): predecessor of Discussions + * External resources: + * [short Ipopt tutorial](http://drops.dagstuhl.de/volltexte/2009/2089/pdf/09061.WaechterAndreas.Paper.2089.pdf) Please Cite Us -------------- We provide this program in the hope that it may be useful to others, and we would very much like to hear about your experience with it. -If you found it helpful and are using it within our software, we encourage you to add your feedback to the [Success Stories page](https://github.com/coin-or/Ipopt/wiki/SuccessStories). +If you found it helpful and are using it within our software, we encourage you to add your feedback to the [Ipopt usage stories and papers](https://github.com/coin-or/Ipopt/discussions/497) discussion. Since a lot of time and effort has gone into Ipopt's development, **please cite the following publication if you are using Ipopt for your own research**: * A. Wächter and L. T. Biegler, **[On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming](http://dx.doi.org/10.1007/s10107-004-0559-y)**, _Mathematical Programming_ 106(1), pp. 25-57, 2006 ([preprint](http://www.optimization-online.org/DB_HTML/2004/03/836.html)) + +Versioning +---------- + +Ipopts version numbers have the form x.y.z. +x.y specifies the major and minor version number of Ipopt. +An increase in x or y can mean the addition or removal of features, backward-incompatible API changes, etc. +Increases in y indicate less severe changes than increases in x. For example, the change from Ipopt 2 to Ipopt 3 came due to a complete rewrite of Ipopt in a different programming language. +z specifies the release number of Ipopt. +An increase in z usually means bugfixes or additions of small feature. Changes to the API, if any, are done in a backward-compatible way. However, the ABI may changed in a backward-incompatible way. + +Source code is organized in branches named stable/x.y. +Development towards a next x.y.z release is happening on the stable/x.y branch. +The code on branch stable/x.y already caries a x.y.z version number, which can correspond to the next x.y.z release that will be made from this branch. +The default branch of the repository is the latest stable/x.y branch, even if x.y is still in beta testing. + +An Ipopt x.y.z release is associated with a tag releases/x.y.z on branch stable/x.y. +Releases are fixed and don't change. + +Additional branches may exist where development of bugfixes or features is taking place. +A branch devel may collect development for the next Ipopt x.y version. It will be renamed to stable/x.y when it is considered stable enough for beta testing. + +If you want to contribute a bugfix or small feature, please create a pull-request to the latest stable/x.y branch. +If you want to contribute a larger feature or something else that changes the API, please create a pull-request to branch devel, if existing, and latest stable/x.y otherwise. diff --git a/appveyor.yml b/appveyor.yml index 00d96f774..af3efaba8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,10 @@ environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 ARCH: win64-mingw + PRECISION: double + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + ARCH: win64-mingw + PRECISION: single #- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 # ARCH: win64-msvc15 #- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 @@ -15,15 +19,14 @@ install: - IF %ARCH%==win64-msvc14 (CALL C:\"Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64) - IF %ARCH%==win64-msvc15 (CALL C:\"Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 8.1) - IF %ARCH%==win64-msvc16 (CALL C:\"Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 8.1) - - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "pacman -S mingw-w64-x86_64-lapack --noconfirm") + - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "pacman -S mingw-w64-x86_64-lapack mingw-w64-x86_64-metis --noconfirm") - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "PATH=/mingw64/bin:$PATH ; gcc --version; g++ --version; gfortran --version; pkg-config --libs lapack ; echo PATH=$PATH") build_script: - - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "PATH=/mingw64/bin:$PATH ; git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-ASL && cd ThirdParty-ASL && ./get.ASL && ./configure --prefix=$HOME/install && make && make install") - - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "PATH=/mingw64/bin:$PATH ; git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-Metis && cd ThirdParty-Metis && ./get.Metis && ./configure --prefix=$HOME/install && make && make install") - - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "PATH=/mingw64/bin:$PATH ; git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-Mumps && cd ThirdParty-Mumps && ./get.Mumps && ./configure --prefix=$HOME/install && make && make install") - - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "PATH=/mingw64/bin:$PATH ; JAVA_HOME=/c/Progra~2/Java/jdk1.8.0 ; /c/projects/ipopt-5qaur/configure --prefix=$HOME/install && make && make install") - - IF %ARCH%==win64-msvc15 (CALL C:\msys64\usr\bin\bash -lc "/c/projects/ipopt-5qaur/configure --enable-msvc && make") + - IF %ARCH%-%PRECISION%==win64-mingw-double (CALL C:\msys64\usr\bin\bash -lc "PATH=/mingw64/bin:$PATH ; git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-ASL && cd ThirdParty-ASL && ./get.ASL && ./configure --prefix=$HOME/install && make && make install") + - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "PATH=/mingw64/bin:$PATH ; git clone --depth 1 https://github.com/coin-or-tools/ThirdParty-Mumps && cd ThirdParty-Mumps && ./get.Mumps && ./configure --prefix=$HOME/install --with-precision=%PRECISION% && make && make install") + - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "PATH=/mingw64/bin:$PATH ; JAVA_HOME=/c/Progra~2/Java/jdk1.8.0 ; /c/projects/ipopt/configure --prefix=$HOME/install --with-precision=%PRECISION% && make && make install") + - IF %ARCH%==win64-msvc15 (CALL C:\msys64\usr\bin\bash -lc "/c/projects/ipopt/configure --enable-msvc && make") test_script: - IF %ARCH%==win64-mingw (CALL C:\msys64\usr\bin\bash -lc "PATH=/mingw64/bin:$PATH ; make test") diff --git a/ar-lib b/ar-lib index 99882fae1..c349042c3 100755 --- a/ar-lib +++ b/ar-lib @@ -2,9 +2,9 @@ # Wrapper for Microsoft lib.exe me=ar-lib -scriptversion=2012-03-01.08; # UTC +scriptversion=2019-07-04.01; # UTC -# Copyright (C) 2010-2018 Free Software Foundation, Inc. +# Copyright (C) 2010-2021 Free Software Foundation, Inc. # Written by Peter Rosin . # # This program is free software; you can redistribute it and/or modify @@ -50,10 +50,10 @@ func_file_conv () if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in - MINGW* | MSYS*) + MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -65,7 +65,7 @@ func_file_conv () mingw) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin) + cygwin | msys) file=`cygpath -m "$file" || echo "$file"` ;; wine) @@ -224,10 +224,11 @@ elif test -n "$extract"; then esac done else - $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member - do - $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? - done + $AR -NOLOGO -LIST "$archive" | tr -d '\r' | sed -e 's/\\/\\\\/g' \ + | while read member + do + $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? + done fi elif test -n "$quick$replace"; then diff --git a/compile b/compile index 0abe04200..4b50e7ee8 100755 --- a/compile +++ b/compile @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -50,10 +50,10 @@ func_file_conv () if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in - MINGW* | MSYS* ) + MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) @@ -206,6 +206,10 @@ func_cl_wrapper () eat=1 linker_opts="$linker_opts $2" ;; + -std=*) + set x "$@" -std:"${1#-std=}" + shift + ;; -*) set x "$@" "$1" shift diff --git a/config.guess b/config.guess index 256083a70..e81d3ae7c 100755 --- a/config.guess +++ b/config.guess @@ -1,8 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright 1992-2021 Free Software Foundation, Inc. -timestamp='2018-03-08' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2021-06-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -27,11 +29,19 @@ timestamp='2018-03-08' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ @@ -50,7 +60,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,7 +94,8 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' 1 2 15 +# Just in case it came from the environment. +GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -96,73 +107,90 @@ trap 'exit 1' 1 2 15 # Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > "$dummy.c" ; - for c in cc gcc c89 c99 ; do - if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "$UNAME_SYSTEM" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown - eval "$set_cc_for_build" + set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -174,12 +202,12 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; @@ -188,18 +216,18 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine="${arch}${endian}"-unknown + machine=${arch}${endian}-unknown ;; - *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval "$set_cc_for_build" + set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -215,7 +243,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ;; esac # Determine ABI tags. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` @@ -226,7 +254,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "$UNAME_VERSION" in + case $UNAME_VERSION in Debian*) release='-gnu' ;; @@ -237,45 +265,57 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi}" - exit ;; + GUESS=$machine-${os}${release}${abi-} + ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; *:MidnightBSD:*:*) - echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; *:ekkoBSD:*:*) - echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; *:SolidBSD:*:*) - echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; *:MirBSD:*:*) - echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; *:Sortix:*:*) - echo "$UNAME_MACHINE"-unknown-sortix - exit ;; + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; *:Redox:*:*) - echo "$UNAME_MACHINE"-unknown-redox - exit ;; + GUESS=$UNAME_MACHINE-unknown-redox + ;; mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; + GUESS=mips-dec-osf1 + ;; alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -289,7 +329,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in + case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") @@ -326,75 +366,76 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; + GUESS=m68k-unknown-sysv4 + ;; *:[Aa]miga[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-amigaos - exit ;; + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; *:[Mm]orph[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-morphos - exit ;; + GUESS=$UNAME_MACHINE-unknown-morphos + ;; *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; + GUESS=i370-ibm-openedition + ;; *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; + GUESS=s390-ibm-zvmoe + ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; + GUESS=powerpc-ibm-os400 + ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix"$UNAME_RELEASE" - exit ;; + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; + GUESS=arm-unknown-riscos + ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; + GUESS=hppa1.1-hitachi-hiuxmpp + ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; + GUESS=pyramid-pyramid-svr4 + ;; DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; + GUESS=sparc-icl-nx6 + ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux"$UNAME_RELEASE" - exit ;; + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval "$set_cc_for_build" + set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null @@ -402,41 +443,44 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case "`/bin/arch`" in + case `/bin/arch` in sun3) - echo m68k-sun-sunos"$UNAME_RELEASE" + GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) - echo sparc-sun-sunos"$UNAME_RELEASE" + GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac - exit ;; + ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -446,43 +490,43 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; m68k:machten:*:*) - echo m68k-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; powerpc:machten:*:*) - echo powerpc-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; + GUESS=mips-dec-mach_bsd4.3 + ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix"$UNAME_RELEASE" - exit ;; + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ @@ -508,78 +552,79 @@ EOF dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos"$UNAME_RELEASE" - exit ;; + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; + GUESS=powerpc-motorola-powermax + ;; Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; + GUESS=powerpc-harris-powerunix + ;; m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; + GUESS=m88k-harris-cxux7 + ;; m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; + GUESS=m88k-motorola-sysv4 + ;; m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$TARGET_BINARY_INTERFACE"x = x ] + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x then - echo m88k-dg-dgux"$UNAME_RELEASE" + GUESS=m88k-dg-dgux$UNAME_RELEASE else - echo m88k-dg-dguxbcs"$UNAME_RELEASE" + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else - echo i586-dg-dgux"$UNAME_RELEASE" + GUESS=i586-dg-dgux$UNAME_RELEASE fi - exit ;; + ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; + GUESS=m88k-dolphin-sysv3 + ;; M88*:*:R3*:*) # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; + GUESS=m88k-tektronix-sysv3 + ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; + GUESS=m68k-tektronix-bsd + ;; *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" - exit ;; + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; + GUESS=i386-ibm-aix + ;; ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then + if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include @@ -593,16 +638,16 @@ EOF EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then - echo "$SYSTEM_NAME" + GUESS=$SYSTEM_NAME else - echo rs6000-ibm-aix3.2.5 + GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 + GUESS=rs6000-ibm-aix3.2.4 else - echo rs6000-ibm-aix3.2 + GUESS=rs6000-ibm-aix3.2 fi - exit ;; + ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then @@ -610,57 +655,57 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$IBM_ARCH"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; + GUESS=rs6000-ibm-aix + ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - echo romp-ibm-bsd4.4 - exit ;; + GUESS=romp-ibm-bsd4.4 + ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; + GUESS=rs6000-bull-bosx + ;; DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; + GUESS=m68k-bull-sysv3 + ;; 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; + GUESS=m68k-hp-bsd + ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; + GUESS=m68k-hp-bsd4.4 + ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - case "$UNAME_MACHINE" in + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then + if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "$sc_cpu_version" in + case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "$sc_kernel_bits" in + case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi - if [ "$HP_ARCH" = "" ]; then - eval "$set_cc_for_build" + if test "$HP_ARCH" = ""; then + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE @@ -698,9 +743,9 @@ EOF test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ "$HP_ARCH" = hppa2.0w ] + if test "$HP_ARCH" = hppa2.0w then - eval "$set_cc_for_build" + set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -719,14 +764,14 @@ EOF HP_ARCH=hppa64 fi fi - echo "$HP_ARCH"-hp-hpux"$HPUX_REV" - exit ;; + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux"$HPUX_REV" - exit ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; 3050*:HI-UX:*:*) - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int @@ -754,36 +799,36 @@ EOF EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; + GUESS=unknown-hitachi-hiuxwe2 + ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - echo hppa1.1-hp-bsd - exit ;; + GUESS=hppa1.1-hp-bsd + ;; 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; + GUESS=hppa1.0-hp-bsd + ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; + GUESS=hppa1.0-hp-mpeix + ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - echo hppa1.1-hp-osf - exit ;; + GUESS=hppa1.1-hp-osf + ;; hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; + GUESS=hppa1.0-hp-osf + ;; i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo "$UNAME_MACHINE"-unknown-osf1mk + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk else - echo "$UNAME_MACHINE"-unknown-osf1 + GUESS=$UNAME_MACHINE-unknown-osf1 fi - exit ;; + ;; parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; + GUESS=hppa1.1-hp-lites + ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; + GUESS=c1-convex-bsd + ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd @@ -791,17 +836,18 @@ EOF fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; + GUESS=c34-convex-bsd + ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; + GUESS=c38-convex-bsd + ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; + GUESS=c4-convex-bsd + ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ @@ -809,103 +855,126 @@ EOF -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; *:BSD/OS:*:*) - echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` - case "$UNAME_PROCESSOR" in + case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; i*:CYGWIN*:*) - echo "$UNAME_MACHINE"-pc-cygwin - exit ;; + GUESS=$UNAME_MACHINE-pc-cygwin + ;; *:MINGW64*:*) - echo "$UNAME_MACHINE"-pc-mingw64 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; *:MINGW*:*) - echo "$UNAME_MACHINE"-pc-mingw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; *:MSYS*:*) - echo "$UNAME_MACHINE"-pc-msys - exit ;; + GUESS=$UNAME_MACHINE-pc-msys + ;; i*:PW*:*) - echo "$UNAME_MACHINE"-pc-pw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-pw32 + ;; *:Interix*:*) - case "$UNAME_MACHINE" in + case $UNAME_MACHINE in x86) - echo i586-pc-interix"$UNAME_RELEASE" - exit ;; + GUESS=i586-pc-interix$UNAME_RELEASE + ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; IA64) - echo ia64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; esac ;; i*:UWIN*:*) - echo "$UNAME_MACHINE"-pc-uwin - exit ;; + GUESS=$UNAME_MACHINE-pc-uwin + ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; + GUESS=x86_64-pc-cygwin + ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; *:GNU:*:*) # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" - exit ;; + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" - exit ;; - i*86:Minix:*:*) - echo "$UNAME_MACHINE"-pc-minix - exit ;; + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; aarch64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; @@ -916,183 +985,225 @@ EOF esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; arm*:Linux:*:*) - eval "$set_cc_for_build" + set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi - exit ;; + ;; avr32*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; cris:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; crisv32:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; e2k:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; frv:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; hexagon:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; ia64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; k1om:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m32r*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m68*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; mips:Linux:*:* | mips64:Linux:*:*) - eval "$set_cc_for_build" + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el + MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} + MIPS_ENDIAN= #else - CPU= + MIPS_ENDIAN= #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" - test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; openrisc*:Linux:*:*) - echo or1k-unknown-linux-"$LIBC" - exit ;; + GUESS=or1k-unknown-linux-$LIBC + ;; or32:Linux:*:* | or1k*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; padre:Linux:*:*) - echo sparc-unknown-linux-"$LIBC" - exit ;; + GUESS=sparc-unknown-linux-$LIBC + ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-"$LIBC" - exit ;; + GUESS=hppa64-unknown-linux-$LIBC + ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; - PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; - *) echo hppa-unknown-linux-"$LIBC" ;; + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; esac - exit ;; + ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64-unknown-linux-$LIBC + ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc-unknown-linux-$LIBC + ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64le-unknown-linux-$LIBC + ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-"$LIBC" - exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; sh64*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sh*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; tile*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; vax:Linux:*:*) - echo "$UNAME_MACHINE"-dec-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; x86_64:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; + set_cc_for_build + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI=${LIBC}x32 + fi + fi + GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI + ;; xtensa*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; + GUESS=i386-sequent-sysv4 + ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" - exit ;; + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo "$UNAME_MACHINE"-pc-os2-emx - exit ;; + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; i*86:XTS-300:*:STOP) - echo "$UNAME_MACHINE"-unknown-stop - exit ;; + GUESS=$UNAME_MACHINE-unknown-stop + ;; i*86:atheos:*:*) - echo "$UNAME_MACHINE"-unknown-atheos - exit ;; + GUESS=$UNAME_MACHINE-unknown-atheos + ;; i*86:syllable:*:*) - echo "$UNAME_MACHINE"-pc-syllable - exit ;; + GUESS=$UNAME_MACHINE-pc-syllable + ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; i*86:*DOS:*:*) - echo "$UNAME_MACHINE"-pc-msdosdjgpp - exit ;; + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi - exit ;; + ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in @@ -1100,12 +1211,12 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" - exit ;; + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1115,11 +1226,11 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv32 + GUESS=$UNAME_MACHINE-pc-sysv32 fi - exit ;; + ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -1127,31 +1238,31 @@ EOF # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + GUESS=i586-pc-msdosdjgpp + ;; Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; + GUESS=i386-pc-mach3 + ;; paragon:*:*:*) - echo i860-intel-osf1 - exit ;; + GUESS=i860-intel-osf1 + ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi - exit ;; + ;; mini*:CTIX:SYS*5:*) # "miniframe" - echo m68010-convergent-sysv - exit ;; + GUESS=m68010-convergent-sysv + ;; mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; + GUESS=m68k-convergent-sysv + ;; M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; + GUESS=m68k-diab-dnix + ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) @@ -1176,249 +1287,401 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; + GUESS=m68k-atari-sysv4 + ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv"$UNAME_RELEASE" - exit ;; + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo "$UNAME_MACHINE"-sni-sysv4 + GUESS=$UNAME_MACHINE-sni-sysv4 else - echo ns32k-sni-sysv + GUESS=ns32k-sni-sysv fi - exit ;; + ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says - echo i586-unisys-sysv4 - exit ;; + GUESS=i586-unisys-sysv4 + ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; + GUESS=hppa1.1-stratus-sysv4 + ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; + GUESS=i860-stratus-sysv4 + ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo "$UNAME_MACHINE"-stratus-vos - exit ;; + GUESS=$UNAME_MACHINE-stratus-vos + ;; *:VOS:*:*) # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; + GUESS=hppa1.1-stratus-vos + ;; mc68*:A/UX:*:*) - echo m68k-apple-aux"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; + GUESS=mips-sony-newsos6 + ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv"$UNAME_RELEASE" + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE else - echo mips-unknown-sysv"$UNAME_RELEASE" + GUESS=mips-unknown-sysv$UNAME_RELEASE fi - exit ;; + ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; + GUESS=powerpc-be-beos + ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; + GUESS=powerpc-apple-beos + ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; + GUESS=i586-pc-beos + ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; + GUESS=i586-pc-haiku + ;; x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; + GUESS=x86_64-unknown-haiku + ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; *:Rhapsody:*:*) - echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval "$set_cc_for_build" - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build fi - if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE fi - echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; *:QNX:*:4*) - echo i386-pc-qnx - exit ;; + GUESS=i386-pc-qnx + ;; NEO-*:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; NSR-*:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; NSV-*:NONSTOP_KERNEL:*:*) - echo nsv-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; NSX-*:NONSTOP_KERNEL:*:*) - echo nsx-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; + GUESS=mips-compaq-nonstopux + ;; BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; + GUESS=bs2000-siemens-sysv + ;; DS/*:UNIX_System_V:*:*) - echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = 386; then + if test "${cputype-}" = 386; then UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype fi - echo "$UNAME_MACHINE"-unknown-plan9 - exit ;; + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; + GUESS=pdp10-unknown-tops10 + ;; *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; + GUESS=pdp10-unknown-tenex + ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; + GUESS=pdp10-dec-tops20 + ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; + GUESS=pdp10-xkl-tops20 + ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; + GUESS=pdp10-unknown-tops20 + ;; *:ITS:*:*) - echo pdp10-unknown-its - exit ;; + GUESS=pdp10-unknown-its + ;; SEI:*:*:SEIUX) - echo mips-sei-seiux"$UNAME_RELEASE" - exit ;; + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "$UNAME_MACHINE" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; + GUESS=i386-pc-xenix + ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" - exit ;; + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; i*86:rdos:*:*) - echo "$UNAME_MACHINE"-pc-rdos - exit ;; - i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros - exit ;; + GUESS=$UNAME_MACHINE-pc-rdos + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; x86_64:VMkernel:*:*) - echo "$UNAME_MACHINE"-unknown-esx - exit ;; + GUESS=$UNAME_MACHINE-unknown-esx + ;; amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; esac +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + echo "$0: unable to guess system type" >&2 -case "$UNAME_MACHINE:$UNAME_SYSTEM" in +case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 exit 1 ;; *local*) @@ -110,1223 +119,1181 @@ case $# in exit 1;; esac -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo "$1" | sed 's/-[^-]*$//'` - if [ "$basic_machine" != "$1" ] - then os=`echo "$1" | sed 's/.*-/-/'` - else os=; fi - ;; -esac +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 ;; - -lynx*) - os=-lynxos + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 ;; - -ptx*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac ;; - -psos*) - os=-psos + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac ;; esac -# Decode aliases for certain CPU-COMPANY combinations. +# Decode 1-component or ad-hoc basic machines case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | ba \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia16 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ - | wasm32 \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none + op50n) + cpu=hppa1.1 + vendor=oki ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) + op60c) + cpu=hppa1.1 + vendor=oki ;; - ms1) - basic_machine=mt-unknown + ibm*) + cpu=i370 + vendor=ibm ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none + orion105) + cpu=clipper + vendor=highlevel ;; - xscaleeb) - basic_machine=armeb-unknown + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple ;; - - xscaleel) - basic_machine=armel-unknown + pmac | pmac-mpw) + cpu=powerpc + vendor=apple ;; - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | ba-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ - | pyramid-* \ - | riscv32-* | riscv64-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | visium-* \ - | wasm32-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-pc - os=-bsd - ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att + cpu=m68000 + vendor=att ;; 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - asmjs) - basic_machine=asmjs-unknown - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux + cpu=we32k + vendor=att ;; bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec + cpu=powerpc + vendor=ibm + basic_os=cnk ;; decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 + cpu=pdp10 + vendor=dec + basic_os=tops10 ;; decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 + cpu=pdp10 + vendor=dec + basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx + cpu=m68k + vendor=motorola ;; dpx2*) - basic_machine=m68k-bull - os=-sysv3 - ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" - ;; - e500v[12]-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=$os"spe" - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd + cpu=m68k + vendor=bull + basic_os=sysv3 ;; encore | umax | mmax) - basic_machine=ns32k-encore + cpu=ns32k + vendor=encore ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} ;; fx2800) - basic_machine=i860-alliant + cpu=i860 + vendor=alliant ;; genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 + cpu=ns32k + vendor=ns ;; h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp + cpu=m68000 + vendor=hp ;; hp9k3[2-9][0-9]) - basic_machine=m68k-hp + cpu=m68k + vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm + cpu=hppa1.0 + vendor=hp ;; i*86v32) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv32 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 ;; i*86v4*) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv4 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 ;; i*86v) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv ;; i*86sol2) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-solaris2 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - vsta) - basic_machine=i386-unknown - os=-vsta + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} ;; iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) + cpu=mips + vendor=sgi + case $basic_os in + irix*) ;; *) - os=-irix4 + basic_os=irix4 ;; esac ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos + cpu=m68000 + vendor=convergent ;; - ms1-*) - basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint ;; news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv + cpu=mips + vendor=sony + basic_os=newsos ;; next | m*-next) - basic_machine=m68k-next - case $os in - -nextstep* ) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) ;; - -ns2*) - os=-nextstep2 + ns2*) + basic_os=nextstep2 ;; *) - os=-nextstep3 + basic_os=nextstep3 ;; esac ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - nsv-tandem) - basic_machine=nsv-tandem - ;; - nsx-tandem) - basic_machine=nsx-tandem + cpu=np1 + vendor=gould ;; op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k + cpu=hppa1.1 + vendor=oki + basic_os=proelf ;; pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; pbd) - basic_machine=sparc-tti + cpu=sparc + vendor=tti ;; pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` + cpu=m68k + vendor=tti ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` + pc532) + cpu=ns32k + vendor=pc532 ;; pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle) - basic_machine=powerpcle-unknown + cpu=pn + vendor=gould ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` + power) + cpu=power + vendor=ibm ;; - ppc64) basic_machine=powerpc64-unknown + ps2) + cpu=i386 + vendor=ibm ;; - ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + rm[46]00) + cpu=mips + vendor=siemens ;; - ppc64le | powerpc64little) - basic_machine=powerpc64le-unknown + rtpc | rtpc-*) + cpu=romp + vendor=ibm ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} ;; - ps2) - basic_machine=i386-ibm + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks ;; - pw32) - basic_machine=i586-unknown - os=-pw32 + tower | tower-32) + cpu=m68k + vendor=ncr ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu ;; - rdos32) - basic_machine=i386-pc - os=-rdos + w65) + cpu=w65 + vendor=wdc ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf ;; - rm[46]00) - basic_machine=mips-siemens + none) + cpu=none + vendor=none ;; - rtpc | rtpc-*) - basic_machine=romp-ibm + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine ;; - s390 | s390-*) - basic_machine=s390-ibm + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; - s390x | s390x-*) - basic_machine=s390x-ibm + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 - exit 1 + # Recognize the canonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ + | arc | arceb | arc32 | arc64 \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bpf | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | loongarch32 | loongarch64 | loongarchx32 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64eb | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r3 | mipsisa32r3el \ + | mipsisa32r5 | mipsisa32r5el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r3 | mipsisa64r3el \ + | mipsisa64r5 | mipsisa64r5el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k | nvptx \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | picochip \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ + | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ + | score \ + | sh | shl \ + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 + exit 1 + ;; + esac ;; esac # Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` +case $vendor in + digital*) + vendor=dec ;; - *-commodore*) - basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` + commodore*) + vendor=cbm ;; *) ;; @@ -1334,203 +1301,215 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x"$os" != x"" ] +if test x$basic_os != x then + +# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 - exit 1 + # No normalization, but not necessarily accepted, that comes below. ;; esac + else # Here we handle the default operating systems that come with various machines. @@ -1543,254 +1522,358 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. -case $basic_machine in +kernel= +case $cpu-$vendor in score-*) - os=-elf + os=elf ;; spu-*) - os=-elf + os=elf ;; *-acorn) - os=-riscix1.2 + os=riscix1.2 ;; arm*-rebel) - os=-linux + kernel=linux + os=gnu ;; arm*-semi) - os=-aout + os=aout ;; c4x-* | tic4x-*) - os=-coff + os=coff ;; c8051-*) - os=-elf + os=elf + ;; + clipper-intergraph) + os=clix ;; hexagon-*) - os=-elf + os=elf ;; tic54x-*) - os=-coff + os=coff ;; tic55x-*) - os=-coff + os=coff ;; tic6x-*) - os=-coff + os=coff ;; # This must come before the *-dec entry. pdp10-*) - os=-tops20 + os=tops20 ;; pdp11-*) - os=-none + os=none ;; *-dec | vax-*) - os=-ultrix4.2 + os=ultrix4.2 ;; m68*-apollo) - os=-domain + os=domain ;; i386-sun) - os=-sunos4.0.2 + os=sunos4.0.2 ;; m68000-sun) - os=-sunos3 + os=sunos3 ;; m68*-cisco) - os=-aout + os=aout ;; mep-*) - os=-elf + os=elf ;; mips*-cisco) - os=-elf + os=elf ;; mips*-*) - os=-elf + os=elf ;; or32-*) - os=-coff + os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 + os=sysv3 ;; sparc-* | *-sun) - os=-sunos4.1.1 + os=sunos4.1.1 ;; pru-*) - os=-elf + os=elf ;; *-be) - os=-beos + os=beos ;; *-ibm) - os=-aix + os=aix ;; *-knuth) - os=-mmixware + os=mmixware ;; *-wec) - os=-proelf + os=proelf ;; *-winbond) - os=-proelf + os=proelf ;; *-oki) - os=-proelf + os=proelf ;; *-hp) - os=-hpux + os=hpux ;; *-hitachi) - os=-hiux + os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv + os=sysv ;; *-cbm) - os=-amigaos + os=amigaos ;; *-dg) - os=-dgux + os=dgux ;; *-dolphin) - os=-sysv3 + os=sysv3 ;; m68k-ccur) - os=-rtu + os=rtu ;; m88k-omron*) - os=-luna + os=luna ;; *-next) - os=-nextstep + os=nextstep ;; *-sequent) - os=-ptx + os=ptx ;; *-crds) - os=-unos + os=unos ;; *-ns) - os=-genix + os=genix ;; i370-*) - os=-mvs + os=mvs ;; *-gould) - os=-sysv + os=sysv ;; *-highlevel) - os=-bsd + os=bsd ;; *-encore) - os=-bsd + os=bsd ;; *-sgi) - os=-irix + os=irix ;; *-siemens) - os=-sysv4 + os=sysv4 ;; *-masscomp) - os=-rtu + os=rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=-uxpv + os=uxpv ;; *-rom68k) - os=-coff + os=coff ;; *-*bug) - os=-coff + os=coff ;; *-apple) - os=-macos + os=macos ;; *-atari*) - os=-mint + os=mint + ;; + *-wrs) + os=vxworks ;; *) - os=-none + os=none ;; esac + fi +# Now, validate our (potentially fixed-up) OS. +case $os in + # Sometimes we do "kernel-libc", so those need to count as OSes. + musl* | newlib* | relibc* | uclibc*) + ;; + # Likewise for "kernel-abi" + eabi* | gnueabi*) + ;; + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + none) + ;; + *) + echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) vendor=acorn ;; - -sunos*) + *-sunos*) vendor=sun ;; - -cnk*|-aix*) + *-cnk* | *-aix*) vendor=ibm ;; - -beos*) + *-beos*) vendor=be ;; - -hpux*) + *-hpux*) vendor=hp ;; - -mpeix*) + *-mpeix*) vendor=hp ;; - -hiux*) + *-hiux*) vendor=hitachi ;; - -unos*) + *-unos*) vendor=crds ;; - -dgux*) + *-dgux*) vendor=dg ;; - -luna*) + *-luna*) vendor=omron ;; - -genix*) + *-genix*) vendor=ns ;; - -mvs* | -opened*) + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) vendor=ibm ;; - -os400*) + s390-* | s390x-*) vendor=ibm ;; - -ptx*) + *-ptx*) vendor=sequent ;; - -tpf*) + *-tpf*) vendor=ibm ;; - -vxsim* | -vxworks* | -windiss*) + *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; - -aux*) + *-aux*) vendor=apple ;; - -hms*) + *-hms*) vendor=hitachi ;; - -mpw* | -macos*) + *-mpw* | *-macos*) vendor=apple ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; - -vos*) + *-vos*) vendor=stratus ;; esac - basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac -echo "$basic_machine$os" +echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: diff --git a/configure b/configure index e87e5381b..728782555 100755 --- a/configure +++ b/configure @@ -1,16 +1,18 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Ipopt 3.13.2. +# Generated by GNU Autoconf 2.71 for Ipopt 3.14.13. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # +# # Copyright 2004, 2011 International Business Machines and others. # All Rights Reserved. # This file is part of the open source package IPOPT which is distributed @@ -21,14 +23,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -38,46 +42,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -86,13 +90,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -101,8 +98,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -114,30 +115,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -159,20 +140,22 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -192,12 +175,15 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO @@ -212,30 +198,38 @@ test -x / || exit 1" test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -243,14 +237,21 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -268,18 +269,19 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: https://github.com/coin-or/Ipopt/issues/new about your $0: system, including any error possibly output before this $0: message. Then install a modern shell, or manually run @@ -307,6 +309,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -324,6 +327,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -338,7 +349,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -347,7 +358,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -386,12 +397,13 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -403,18 +415,27 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -426,9 +447,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -455,7 +476,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -499,7 +520,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -513,6 +534,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -526,6 +551,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -595,63 +627,58 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Ipopt' PACKAGE_TARNAME='ipopt' -PACKAGE_VERSION='3.13.2' -PACKAGE_STRING='Ipopt 3.13.2' +PACKAGE_VERSION='3.14.13' +PACKAGE_STRING='Ipopt 3.14.13' PACKAGE_BUGREPORT='https://github.com/coin-or/Ipopt/issues/new' PACKAGE_URL='https://github.com/coin-or/Ipopt' ac_unique_file="src/Common/IpDebug.hpp" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" +ac_header_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC +SIPOPTLIB_CFLAGS_NOPC +SIPOPTLIB_LFLAGS_NOPC IPOPTAMPLINTERFACELIB_CFLAGS_NOPC IPOPTAMPLINTERFACELIB_LFLAGS_NOPC IPOPTLIB_CFLAGS_NOPC IPOPTLIB_LFLAGS_NOPC BUILD_SIPOPT_FALSE BUILD_SIPOPT_TRUE -BUILD_LINEARSOLVERLOADER_FALSE -BUILD_LINEARSOLVERLOADER_TRUE -IPALLLIBS BUILD_JAVA_FALSE BUILD_JAVA_TRUE JAVADOC @@ -666,8 +693,10 @@ BIT32FCOMMENT BITS_PER_POINTER HAVE_WSMP_FALSE HAVE_WSMP_TRUE -HAVE_PARDISO_FALSE -HAVE_PARDISO_TRUE +COIN_HAS_SPRAL_FALSE +COIN_HAS_SPRAL_TRUE +HAVE_PARDISO_MKL_FALSE +HAVE_PARDISO_MKL_TRUE HAVE_MA28_FALSE HAVE_MA28_TRUE HSLLIB_CFLAGS_NOPC @@ -679,6 +708,7 @@ HSLLIB_CFLAGS HSLLIB_LFLAGS COIN_HAS_MUMPS_FALSE COIN_HAS_MUMPS_TRUE +IPOPTLIB_CFLAGS COIN_HAS_ASL_FALSE COIN_HAS_ASL_TRUE SIPOPTAMPLINTERFACELIB_PCFILES @@ -695,8 +725,11 @@ COIN_HAS_PKGCONFIG_TRUE ac_ct_PKG_CONFIG PKG_CONFIG IPOPTLIB_PCFILES -IPOPTLIB_CFLAGS IPOPTLIB_LFLAGS +IPOPT_INT64_FALSE +IPOPT_INT64_TRUE +IPOPT_SINGLE_FALSE +IPOPT_SINGLE_TRUE coin_doxy_tagfiles COIN_HAS_LATEX_FALSE COIN_HAS_LATEX_TRUE @@ -709,9 +742,10 @@ coin_have_latex coin_have_doxygen CXXLIBS RPATH_FLAGS +COIN_STATIC_BUILD_FALSE +COIN_STATIC_BUILD_TRUE LT_LDFLAGS CXXCPP -CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL @@ -720,6 +754,7 @@ NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB +FILECMD LN_S NM ac_ct_DUMPBIN @@ -767,9 +802,9 @@ LDFLAGS CFLAGS COIN_RELOCATABLE_FALSE COIN_RELOCATABLE_TRUE -MAINT -MAINTAINER_MODE_FALSE -MAINTAINER_MODE_TRUE +CSCOPE +ETAGS +CTAGS am__untar am__tar AMTAR @@ -793,6 +828,9 @@ am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V @@ -806,8 +844,6 @@ build_os build_vendor build_cpu build -ALWAYS_FALSE_FALSE -ALWAYS_FALSE_TRUE target_alias host_alias build_alias @@ -827,6 +863,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -868,6 +905,8 @@ enable_libtool_lock with_dot with_ipopt_verbosity with_ipopt_checklevel +with_precision +with_intsize with_lapack with_lapack_lflags with_asl @@ -876,10 +915,15 @@ with_asl_cflags with_mumps with_mumps_lflags with_mumps_cflags +enable_mpiinit with_hsl with_hsl_lflags with_hsl_cflags with_pardiso +enable_pardisomkl +with_spral +with_spral_lflags +with_spral_cflags with_wsmp enable_inexact_solver enable_java @@ -903,7 +947,6 @@ F77 FFLAGS ADD_FFLAGS LT_SYS_LIBRARY_PATH -CPP CXXCPP LT_LDFLAGS CXXLIBS @@ -946,6 +989,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -975,8 +1019,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -1017,9 +1059,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1043,9 +1085,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1198,6 +1240,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1247,9 +1298,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1263,9 +1314,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1309,9 +1360,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1327,7 +1378,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1335,7 +1386,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1391,7 +1442,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1448,7 +1499,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Ipopt 3.13.2 to adapt to many kinds of systems. +\`configure' configures Ipopt 3.14.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1488,6 +1539,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1518,7 +1570,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Ipopt 3.13.2:";; + short | recursive ) echo "Configuration of Ipopt 3.14.13:";; esac cat <<\_ACEOF @@ -1547,11 +1599,15 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --disable-mpiinit disable that (un)loading the Ipopt library + initalizes (finalizes) MPI if the MPI version of + MUMPS is linked + --disable-pardisomkl disable check for MKL version of Pardiso in Lapack --enable-inexact-solver enable inexact linear solver version EXPERIMENTAL! (default: no) --disable-java disable building of Java interface --disable-linear-solver-loader - disable build of linear solver loader + disable use of linear solver loader --disable-sipopt disable build of sIpopt Optional Packages: @@ -1569,37 +1625,42 @@ Optional Packages: with doxygen if available; --without-dot to disable --with-ipopt-verbosity specify the debug verbosity level --with-ipopt-checklevel specify the sanity check level - --with-lapack Use lapack. If an argument is given, 'yes' is - equivalent to --with-lapack, 'no' is - equivalent to --without-lapack. Any other argument - is applied as for --with-lapack-lflags + --with-precision floating-point precision to use: single or double + (default) + --with-intsize integer type to use: specify 32 for int or 64 for + int64_t + --without-lapack Do not use lapack. If an argument is given to + --with-lapack, then 'yes' is equivalent + to --with-lapack, 'no' is equivalent to + --without-lapack and any other argument is applied + as for --with-lapack-lflags. --with-lapack-lflags Linker flags for lapack appropriate for your environment. (Most often, -l specs for libraries.) - --with-asl Use ASL. If an argument is given, 'yes' is - equivalent to --with-asl, 'no' is - equivalent to --without-asl, 'build' will look for a - COIN ThirdParty package. Any other argument is - applied as for --with-asl-lflags + --without-asl Do not use ASL. If an argument is given to + --with-asl, then 'yes' is equivalent to + --with-asl, 'no' is equivalent to + --without-asl and any other argument is applied as + for --with-asl-lflags. --with-asl-lflags Linker flags for ASL appropriate for your environment. (Most often, -l specs for libraries.) --with-asl-cflags Compiler flags for ASL appropriate for your environment. (Most often, -I specs for header file directories.) - --with-mumps Use Mumps. If an argument is given, 'yes' is - equivalent to --with-mumps, 'no' is - equivalent to --without-mumps, 'build' will look for - a COIN ThirdParty package. Any other argument is - applied as for --with-mumps-lflags + --without-mumps Do not use Mumps. If an argument is given to + --with-mumps, then 'yes' is equivalent + to --with-mumps, 'no' is equivalent to + --without-mumps and any other argument is applied as + for --with-mumps-lflags. --with-mumps-lflags Linker flags for Mumps appropriate for your environment. (Most often, -l specs for libraries.) --with-mumps-cflags Compiler flags for Mumps appropriate for your environment. (Most often, -I specs for header file directories.) - --with-hsl Use HSL. If an argument is given, 'yes' is - equivalent to --with-hsl, 'no' is - equivalent to --without-hsl, 'build' will look for a - COIN ThirdParty package. Any other argument is - applied as for --with-hsl-lflags + --without-hsl Do not use HSL. If an argument is given to + --with-hsl, then 'yes' is equivalent to + --with-hsl, 'no' is equivalent to + --without-hsl and any other argument is applied as + for --with-hsl-lflags. --with-hsl-lflags Linker flags for HSL appropriate for your environment. (Most often, -l specs for libraries.) --with-hsl-cflags Compiler flags for HSL appropriate for your @@ -1607,6 +1668,16 @@ Optional Packages: directories.) --with-pardiso specify Pardiso library (>= 4.0) from pardiso-project.org + --without-spral Do not use Spral. If an argument is given to + --with-spral, then 'yes' is equivalent + to --with-spral, 'no' is equivalent to + --without-spral and any other argument is applied as + for --with-spral-lflags. + --with-spral-lflags Linker flags for Spral appropriate for your + environment. (Most often, -l specs for libraries.) + --with-spral-cflags Compiler flags for Spral appropriate for your + environment. (Most often, -I specs for header file + directories.) --with-wsmp specify WSMP library Some influential environment variables: @@ -1628,7 +1699,6 @@ Some influential environment variables: FFLAGS) LT_SYS_LIBRARY_PATH User-defined run-time library search path. - CPP C preprocessor CXXCPP C++ preprocessor LT_LDFLAGS Flags passed to libtool when building libraries or executables that are installed @@ -1655,9 +1725,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1685,7 +1755,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1693,7 +1764,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1702,13 +1773,14 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Ipopt configure 3.13.2 -generated by GNU Autoconf 2.69 +Ipopt configure 3.14.13 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. + Copyright 2004, 2011 International Business Machines and others. All Rights Reserved. This file is part of the open source package IPOPT which is distributed @@ -1727,14 +1799,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1742,14 +1814,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1765,14 +1838,14 @@ fi ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1780,14 +1853,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1803,14 +1877,14 @@ fi ac_fn_f77_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1818,14 +1892,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1841,14 +1916,14 @@ fi ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1856,17 +1931,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1888,120 +1964,44 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -2009,16 +2009,9 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -2044,24 +2037,25 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -2078,7 +2072,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2086,14 +2080,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2109,14 +2104,14 @@ fi ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2124,17 +2119,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2155,14 +2151,14 @@ fi ac_fn_f77_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2170,17 +2166,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2195,6 +2192,49 @@ fi } # ac_fn_f77_try_link +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes @@ -2217,7 +2257,7 @@ $4 #endif int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; @@ -2227,7 +2267,8 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2242,7 +2283,7 @@ $4 #endif int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -2252,9 +2293,10 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid; break -else +else $as_nop as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= @@ -2262,9 +2304,9 @@ else fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 @@ -2277,7 +2319,7 @@ $4 #endif int -main () +main (void) { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; @@ -2287,7 +2329,8 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2302,7 +2345,7 @@ $4 #endif int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; @@ -2312,9 +2355,10 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=$ac_mid; break -else +else $as_nop as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= @@ -2322,14 +2366,14 @@ else fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop ac_lo= ac_hi= fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val @@ -2345,7 +2389,7 @@ $4 #endif int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -2355,12 +2399,13 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid -else +else $as_nop as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; @@ -2370,8 +2415,8 @@ esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } +static long int longval (void) { return $2; } +static unsigned long int ulongval (void) { return $2; } #include #include #ifdef F77_DUMMY_MAIN @@ -2383,7 +2428,7 @@ static unsigned long int ulongval () { return $2; } #endif int -main () +main (void) { FILE *f = fopen ("conftest.val", "w"); @@ -2411,9 +2456,10 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : echo >>conftest.val; read $3 &5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no +if ac_fn_cxx_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------------------------------- ## -## Report this to https://github.com/coin-or/Ipopt/issues/new ## -## ---------------------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_cxx_check_header_mongrel +} # ac_fn_cxx_check_header_compile -# ac_fn_cxx_check_decl LINENO SYMBOL VAR INCLUDES -# ----------------------------------------------- +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_cxx_check_decl () +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 @@ -2543,7 +2534,7 @@ $4 #endif int -main () +main (void) { #ifndef $as_decl_name #ifdef __cplusplus @@ -2557,118 +2548,120 @@ main () return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_cxx_check_decl +} # ac_fn_check_decl -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () +# ac_fn_cxx_check_func LINENO FUNC VAR +# ------------------------------------ +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_cxx_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------------------------------- ## -## Report this to https://github.com/coin-or/Ipopt/issues/new ## -## ---------------------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +#ifdef F77_DUMMY_MAIN + +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } + +#endif +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_header_mongrel +} # ac_fn_cxx_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Ipopt $as_me 3.13.2, which was -generated by GNU Autoconf 2.69. Invocation command line was +It was created by Ipopt $as_me 3.14.13, which was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -2701,8 +2694,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -2737,7 +2734,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2772,11 +2769,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2787,8 +2786,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2812,7 +2811,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2820,14 +2819,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2835,15 +2834,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2851,8 +2850,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2866,63 +2865,48 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2932,252 +2916,857 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif -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 $LDFLAGS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' -# List one file in the package so that the configure script can test -# whether the package is actually there +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} -# Do some project-level initialization work (version numbers, ...) -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +struct incomplete_array +{ + int datasize; + double data[]; +}; +struct named_init { + int number; + const wchar_t *name; + double average; +}; -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 +typedef const char *ccp; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + const char *str = ""; + int number = 0; + float fnumber = 0; + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + return *str && number && fnumber; +} +' +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' - # Check whether --enable-msvc was given. -if test "${enable_msvc+set}" = set; then : - enableval=$enable_msvc; enable_msvc=$enableval -else - enable_msvc=no - case $build in - *-mingw* | *-cygwin* | *-msys* ) - for ac_prog in gcc clang icl cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); - test -n "$CC" && break -done +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } - case "$CC" in *cl ) enable_msvc=yes ;; esac - ;; - esac -fi +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; - # We want --enable-msvc setup and checked +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' - # Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then : - enableval=$enable_debug; enable_debug=$enableval -else - enable_debug=no -fi +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" -# This macro should run before the compiler checks (doesn't seem to be -# sufficient for CFLAGS) +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include -# change default compiler flags -# - debugging enabled: enable debug symbols (-g/-Z7) -# - debugging disabled: disable debug code (-DNDEBUG); enable (more) optimization (-O2) -# - enable exceptions for (i)cl +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} - if test "$enable_debug" = yes ; then - if test "$enable_msvc" = yes ; then - : ${FFLAGS:="-nologo -fpp -Z7 -MDd $ADD_FFLAGS"} - : ${FCFLAGS:="-nologo -fpp -Z7 -MDd $ADD_FCFLAGS"} - : ${CFLAGS:="-nologo -Z7 -MDd $ADD_CFLAGS"} - : ${CXXFLAGS:="-nologo -EHs -Z7 -MDd $ADD_CXXFLAGS"} - else +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" + +# Auxiliary files required by this configure script. +ac_aux_files="ltmain.sh ar-lib compile missing install-sh config.guess config.sub" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +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_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + +# List one file in the package so that the configure script can test +# whether the package is actually there + + +# Do some project-level initialization work (version numbers, ...) + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + + + + + # Check whether --enable-msvc was given. +if test ${enable_msvc+y} +then : + enableval=$enable_msvc; enable_msvc=$enableval +else $as_nop + enable_msvc=no + case $build in + *-mingw* | *-cygwin* | *-msys* ) + for ac_prog in gcc clang icl cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break +done + + case "$CC" in *cl ) enable_msvc=yes ;; esac + ;; + esac +fi + + + + + + # Check whether --enable-debug was given. +if test ${enable_debug+y} +then : + enableval=$enable_debug; enable_debug=$enableval +else $as_nop + enable_debug=no +fi + + + + + + + + if test "$enable_debug" = yes ; then + if test "$enable_msvc" = yes ; then + : ${FFLAGS:="-nologo -fpp -Z7 -MDd $ADD_FFLAGS"} + : ${FCFLAGS:="-nologo -fpp -Z7 -MDd $ADD_FCFLAGS"} + : ${CFLAGS:="-nologo -Z7 -MDd $ADD_CFLAGS"} + : ${CXXFLAGS:="-nologo -EHs -Z7 -MDd -Zc:__cplusplus $ADD_CXXFLAGS"} + else : ${FFLAGS:="-g $ADD_FFLAGS"} : ${FCFLAGS:="-g $ADD_FCFLAGS"} : ${CFLAGS:="-g $ADD_CFLAGS"} @@ -3188,7 +3777,7 @@ fi : ${FFLAGS:="-nologo -fpp -O2 -MD $ADD_FFLAGS"} : ${FCFLAGS:="-nologo -fpp -O2 -MD $ADD_FCFLAGS"} : ${CFLAGS:="-nologo -DNDEBUG -O2 -MD $ADD_CFLAGS"} - : ${CXXFLAGS:="-nologo -EHs -DNDEBUG -O2 -MD $ADD_CXXFLAGS"} + : ${CXXFLAGS:="-nologo -EHs -DNDEBUG -O2 -MD -Zc:__cplusplus $ADD_CXXFLAGS"} else : ${FFLAGS:="-O2 $ADD_FFLAGS"} : ${FCFLAGS:="-O2 $ADD_FCFLAGS"} @@ -3197,21 +3786,22 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; @@ -3232,7 +3822,8 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac am__api_version='1.16' -# Find a good install program. We prefer a C program (faster), + + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -3246,20 +3837,25 @@ am__api_version='1.16' # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -3269,13 +3865,13 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -3283,12 +3879,12 @@ case $as_dir/ in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -3304,7 +3900,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -3314,8 +3910,8 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -3325,8 +3921,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -3380,8 +3976,8 @@ else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -3400,26 +3996,23 @@ test "$program_suffix" != NONE && # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -3439,11 +4032,12 @@ if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -3451,11 +4045,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3466,11 +4064,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3479,11 +4077,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -3491,11 +4090,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3506,11 +4109,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -3518,8 +4121,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -3531,25 +4134,31 @@ fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done @@ -3560,7 +4169,7 @@ IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then + if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -3570,18 +4179,19 @@ fi MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -3589,11 +4199,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3604,24 +4218,25 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -3637,12 +4252,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -3656,67 +4271,35 @@ fi rmdir .tst 2>/dev/null -# Enforce the required autoconf version - - - -# Set the project's version numbers - - - # break up package version number in major.minor.release - # AC_PACKAGE_VERSION is defined by AC_INIT - - - # ac-define AC_PACKAGE_VERSION macros, use 9999 for missing values -cat >>confdefs.h <<_ACEOF -#define IPOPT_VERSION "3.13.2" -_ACEOF -cat >>confdefs.h <<_ACEOF -#define IPOPT_VERSION_MAJOR 3 -_ACEOF -cat >>confdefs.h <<_ACEOF -#define IPOPT_VERSION_MINOR 13 -_ACEOF +printf "%s\n" "#define IPOPT_VERSION \"3.14.13\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define IPOPT_VERSION_RELEASE 2 -_ACEOF +printf "%s\n" "#define IPOPT_VERSION_MAJOR 3" >>confdefs.h +printf "%s\n" "#define IPOPT_VERSION_MINOR 14" >>confdefs.h -# A useful makefile conditional that is always false - - if false; then - ALWAYS_FALSE_TRUE= - ALWAYS_FALSE_FALSE='#' -else - ALWAYS_FALSE_TRUE='#' - ALWAYS_FALSE_FALSE= -fi +printf "%s\n" "#define IPOPT_VERSION_RELEASE 13" >>confdefs.h -# Change the default compiler flags. This needs to run before -# AC_CANONICAL_BUILD. -# Get the build and host types -# libtool has some magic for host_os and build_os being mingw, but doesn't know about msys + # libtool has some magic for host_os and build_os being mingw, but doesn't know about msys if test $host_os = msys ; then host_os=mingw host=`echo $host | sed -e 's/msys/mingw/'` @@ -3727,12 +4310,9 @@ fi build=`echo $build | sed -e 's/msys/mingw/'` fi -# Make silent build rules the default (https://www.gnu.org/software/automake/ -# manual/html_node/Automake-Silent-Rules.html). Run before AM_INIT_AUTOMAKE, -# which will AC_REQUIRE it anyway. - # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -3742,12 +4322,13 @@ case $enable_silent_rules in # ((( *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -3759,8 +4340,8 @@ else am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -3771,13 +4352,30 @@ fi AM_BACKSLASH='\' -# Initialize automake -# - do not be as strict as for GNU projects -# - don't AC_DEFINE PACKAGE or VERSION (but there're still defined as shell -# variables in configure, and as make variables). -# - disable dist target -# - place objects from sources in subdirs into corresponding subdirs -# - enable all automake warnings + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test ${enable_maintainer_mode+y} +then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else $as_nop + USE_MAINTAINER_MODE=no +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output @@ -3801,7 +4399,7 @@ fi # Define the identity of the package. PACKAGE='ipopt' - VERSION='3.13.2' + VERSION='3.14.13' # Some tools Automake needs. @@ -3842,6 +4440,20 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -3886,38 +4498,12 @@ END fi -# Disable automatic rebuild of configure/Makefile. Use run_autotools. - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 -$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } - # Check whether --enable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then : - enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 -$as_echo "$USE_MAINTAINER_MODE" >&6; } - if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - - -# Figure out the path where libraries are installed. -# Unless the user specifies --prefix, prefix is set to NONE until the -# end of configuration, at which point it will be set to $ac_default_prefix. -# Unless the user specifies --exec-prefix, exec-prefix is set to NONE until -# the end of configuration, at which point it's set to '${prefix}'. -# Sheesh. So do the expansion, then back it out. + # Figure out the path where libraries are installed. + # Unless the user specifies --prefix, prefix is set to NONE until the + # end of configuration, at which point it will be set to $ac_default_prefix. + # Unless the user specifies --exec-prefix, exec-prefix is set to NONE until + # the end of configuration, at which point it's set to '${prefix}'. + # Sheesh. So do the expansion, then back it out. save_prefix=$prefix save_exec_prefix=$exec_prefix if test "x$prefix" = xNONE ; then @@ -3933,12 +4519,11 @@ fi prefix=$save_prefix exec_prefix=$save_exec_prefix -# add a configure flag to indicate whether .pc files should be made relocatable -# off by default, as it creates libtool warnings # Check whether --enable-relocatable was given. -if test "${enable_relocatable+set}" = set; then : +if test ${enable_relocatable+y} +then : enableval=$enable_relocatable; coin_enable_relocatable=$enableval -else +else $as_nop coin_enable_relocatable=no fi @@ -3957,12 +4542,21 @@ fi ############################################################################# # Get the name of the C, C++, and Fortran compilers and appropriate compiler options. + + + + + + + + + DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out @@ -3998,11 +4592,12 @@ esac fi done rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test ${enable_dependency_tracking+y} +then : enableval=$enable_dependency_tracking; fi @@ -4023,28 +4618,19 @@ fi - # Setting up libtool with LT_INIT will AC_REQUIRE AC_PROG_CC, but we want - # to invoke it from this macro first so that we can supply a parameter. - # If enable-msvc, then test for Intel (on Windows) and MS C compiler - # explicitly and add the compile wrapper before AC_PROG_CC. The compile - # wrapper works around issues related to finding MS link.exe. (Unix link.exe - # occurs first in PATH, which causes compile and link checks to fail.) For - # the same reason, set LD to use the compile wrapper. If CC remains unset - # (neither icl or cl was found, and CC was not set by the user), stop with - # an error. - if test $enable_msvc = yes ; then for ac_prog in icl cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4052,11 +4638,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4067,11 +4657,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4088,26 +4678,22 @@ done fi fi - # Look for some C compiler and check that it works. If the user has set CC - # or we found icl/cl above, this shouldn't overwrite CC. Unlike the macros - # that establish C++ or Fortran compilers, PROG_CC also takes care of adding - # the compile wrapper if needed. - 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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 do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4115,11 +4701,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4130,11 +4720,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4147,11 +4737,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -4159,11 +4750,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4174,11 +4769,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4190,8 +4785,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -4199,23 +4794,23 @@ esac fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -4225,7 +4820,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -4233,7 +4828,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -4245,9 +4840,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -4268,11 +4863,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -4289,7 +4885,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -4305,44 +4901,46 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -4356,15 +4954,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -4373,7 +4971,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -4385,8 +4983,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -4394,10 +4992,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -4405,39 +5003,40 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -4451,11 +5050,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -4464,31 +5064,32 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -4498,29 +5099,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -4529,57 +5134,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -4594,117 +5202,169 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_ext=c + + 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -4732,8 +5392,8 @@ _ACEOF rm -f core conftest* unset am_i fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. @@ -4745,17 +5405,18 @@ 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -4862,8 +5523,8 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if @@ -4878,31 +5539,29 @@ fi - # Declare precious variable for additional compiler flags - # If enable-msvc, then test for Intel (on Windows) and MS C compiler - # explicitly and add the compile wrapper before AC_PROG_CXX. The compile - # wrapper works around issues related to finding MS link.exe. (Unix link.exe - # occurs first in PATH, which causes compile and link checks to fail.) For - # the same reason, set LD to use the compile wrapper. If CC remains unset - # (neither icl or cl was found, and CC was not set by the user), stop with - # an error. + + + + + if test $enable_msvc = yes ; then for ac_prog in icl cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -4910,11 +5569,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4925,11 +5588,11 @@ fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4946,13 +5609,10 @@ done fi fi - # Look for some C++ compiler and check that it works. If the user has set - # CXX or we found icl/cl above, this shouldn't overwrite CXX. - 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 $LDFLAGS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then @@ -4963,11 +5623,12 @@ if test -z "$CXX"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -4975,11 +5636,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4990,11 +5655,11 @@ fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5007,11 +5672,12 @@ if test -z "$CXX"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else @@ -5019,11 +5685,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5034,11 +5704,11 @@ fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5050,8 +5720,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX @@ -5061,7 +5731,7 @@ fi fi fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -5071,7 +5741,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -5081,20 +5751,21 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -5104,29 +5775,33 @@ main () return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi -ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no @@ -5135,57 +5810,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes -else +else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : -else +else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then @@ -5200,19 +5878,114 @@ else CXXFLAGS= fi fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -5319,8 +6092,8 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if @@ -5335,23 +6108,22 @@ fi - # If the compiler does not support -c -o, wrap it with the compile script. - 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 $LDFLAGS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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; } -if ${ac_cv_prog_cxx_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX understands -c and -o together" >&5 +printf %s "checking whether $CXX understands -c and -o together... " >&6; } +if test ${ac_cv_prog_cxx_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -5367,10 +6139,10 @@ if { { case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in @@ -5378,45 +6150,44 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then ac_cv_prog_cxx_c_o=yes else ac_cv_prog_cxx_c_o=no fi -rm -f conftest* +rm -rf conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_c_o" >&5 -$as_echo "$ac_cv_prog_cxx_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_c_o" >&5 +printf "%s\n" "$ac_cv_prog_cxx_c_o" >&6; } if test $ac_cv_prog_cxx_c_o = no; then -$as_echo "#define CXX_NO_MINUS_C_MINUS_O 1" >>confdefs.h +printf "%s\n" "#define CXX_NO_MINUS_C_MINUS_O 1" >>confdefs.h 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_cv_prog_cxx_c_o = no ; then CXX="$am_aux_dir/compile $CXX" fi - # Declare precious variable for additional compiler flags - # AC_MSG_NOTICE([In COIN_PROG_F77]) # Check whether --enable-f77 was given. -if test "${enable_f77+set}" = set; then : +if test ${enable_f77+y} +then : enableval=$enable_f77; enable_f77=$enableval -else +else $as_nop enable_f77=yes fi @@ -5426,20 +6197,21 @@ fi unset F77 else # If enable-msvc, then test for Intel Fortran compiler for Windows - # explicitly and add the compile wrapper before AC_PROG_F77. The compile - # wrapper works around issues related to finding MS link.exe. (Unix - # link.exe occurs first in PATH, which causes compile and link checks to - # fail.) For the same reason, set LD to use the compile wrapper. + # explicitly and add the compile wrapper. The compile wrapper works + # around issues related to finding MS link.exe. (Unix link.exe occurs + # first in PATH, which causes compile and link checks to fail.) + # For the same reason, set LD to use the compile wrapper. if test $enable_msvc = yes ; then for ac_prog in ifort do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else @@ -5447,11 +6219,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5462,11 +6238,11 @@ fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $F77" >&5 -$as_echo "$F77" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $F77" >&5 +printf "%s\n" "$F77" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5486,18 +6262,19 @@ 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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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 do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else @@ -5505,11 +6282,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5520,11 +6301,11 @@ fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $F77" >&5 -$as_echo "$F77" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $F77" >&5 +printf "%s\n" "$F77" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5537,11 +6318,12 @@ if test -z "$F77"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else @@ -5549,11 +6331,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5564,11 +6350,11 @@ fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_F77" >&5 -$as_echo "$ac_ct_F77" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_F77" >&5 +printf "%s\n" "$ac_ct_F77" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5580,8 +6366,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac F77=$ac_ct_F77 @@ -5590,7 +6376,7 @@ fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -5600,7 +6386,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -5610,7 +6396,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done rm -f a.out @@ -5619,11 +6405,12 @@ rm -f a.out # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran 77 compiler" >&5 -$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; } -if ${ac_cv_f77_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU Fortran 77" >&5 +printf %s "checking whether the compiler supports GNU Fortran 77... " >&6; } +if test ${ac_cv_f77_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat > conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ @@ -5632,43 +6419,48 @@ else end _ACEOF -if ac_fn_f77_try_compile "$LINENO"; then : +if ac_fn_f77_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_compiler_gnu" >&5 -$as_echo "$ac_cv_f77_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_f77_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + ac_ext=$ac_save_ext -ac_test_FFLAGS=${FFLAGS+set} +ac_test_FFLAGS=${FFLAGS+y} ac_save_FFLAGS=$FFLAGS FFLAGS= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $F77 accepts -g" >&5 -$as_echo_n "checking whether $F77 accepts -g... " >&6; } -if ${ac_cv_prog_f77_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $F77 accepts -g" >&5 +printf %s "checking whether $F77 accepts -g... " >&6; } +if test ${ac_cv_prog_f77_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop FFLAGS=-g cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF -if ac_fn_f77_try_compile "$LINENO"; then : +if ac_fn_f77_try_compile "$LINENO" +then : ac_cv_prog_f77_g=yes -else +else $as_nop ac_cv_prog_f77_g=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_g" >&5 -$as_echo "$ac_cv_prog_f77_g" >&6; } -if test "$ac_test_FFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_g" >&5 +printf "%s\n" "$ac_cv_prog_f77_g" >&6; } +if test $ac_test_FFLAGS; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then @@ -5692,7 +6484,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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi @@ -5700,8 +6492,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Allow for the possibility that there is no Fortran compiler on the system. if test -z "$F77" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: No Fortran 77 compiler available." >&5 -$as_echo "$as_me: No Fortran 77 compiler available." >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No Fortran 77 compiler available." >&5 +printf "%s\n" "$as_me: No Fortran 77 compiler available." >&6;} fi if test -n "$F77"; then COIN_HAS_F77_TRUE= @@ -5712,10 +6504,7 @@ else fi - # Declare precious variable for additional compiler flags - - # AC_MSG_NOTICE([Leaving COIN_PROG_F77]) # If there is a Fortran compiler, then setup everything to use it, including F77_FUNC @@ -5723,19 +6512,21 @@ 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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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; } -if ${ac_cv_prog_f77_v+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to get verbose linking output from $F77" >&5 +printf %s "checking how to get verbose linking output from $F77... " >&6; } +if test ${ac_cv_prog_f77_v+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF -if ac_fn_f77_try_compile "$LINENO"; then : +if ac_fn_f77_try_compile "$LINENO" +then : ac_cv_prog_f77_v= # Try some options frequently used verbose output for ac_verb in -v -verbose --verbose -V -\#\#\#; do @@ -5753,13 +6544,13 @@ ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" eval "set x $ac_link" shift -$as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: $*" >&5 # gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH, # LIBRARY_PATH; skip all such settings. ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | sed '/^Driving:/d; /^Configured with:/d; '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"` -$as_echo "$ac_f77_v_output" >&5 +printf "%s\n" "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS rm -rf conftest* @@ -5826,23 +6617,24 @@ esac done done if test -z "$ac_cv_prog_f77_v"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine how to obtain linking information from $F77" >&5 -$as_echo "$as_me: WARNING: cannot determine how to obtain linking information from $F77" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine how to obtain linking information from $F77" >&5 +printf "%s\n" "$as_me: WARNING: cannot determine how to obtain linking information from $F77" >&2;} fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compilation failed" >&5 -$as_echo "$as_me: WARNING: compilation failed" >&2;} +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: compilation failed" >&5 +printf "%s\n" "$as_me: WARNING: compilation failed" >&2;} fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_v" >&5 -$as_echo "$ac_cv_prog_f77_v" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 libraries of $F77" >&5 -$as_echo_n "checking for Fortran 77 libraries of $F77... " >&6; } -if ${ac_cv_f77_libs+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_v" >&5 +printf "%s\n" "$ac_cv_prog_f77_v" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 libraries of $F77" >&5 +printf %s "checking for Fortran 77 libraries of $F77... " >&6; } +if test ${ac_cv_f77_libs+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test "x$FLIBS" != "x"; then ac_cv_f77_libs="$FLIBS" # Let the user override the test. else @@ -5861,13 +6653,13 @@ ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" eval "set x $ac_link" shift -$as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: $*" >&5 # gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH, # LIBRARY_PATH; skip all such settings. ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | sed '/^Driving:/d; /^Configured with:/d; '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"` -$as_echo "$ac_f77_v_output" >&5 +printf "%s\n" "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS rm -rf conftest* @@ -5944,9 +6736,10 @@ while test $# != 1; do fi done - if test x"$ac_exists" = xtrue; then : + if test x"$ac_exists" = xtrue +then : -else +else $as_nop ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi ;; @@ -5959,9 +6752,10 @@ fi fi done - if test x"$ac_exists" = xtrue; then : + if test x"$ac_exists" = xtrue +then : -else +else $as_nop if test "$ac_compiler_gnu" = yes; then for ac_link_opt in $ac_arg; do ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" @@ -5976,9 +6770,24 @@ fi |-LANG:=* | -LIST:* | -LNO:* | -link) ;; -lkernel32) + # Ignore this library only on Windows-like systems. case $host_os in - *cygwin*) ;; - *) ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" + cygwin* | msys* ) ;; + *) + ac_exists=false + for ac_i in $ac_cv_f77_libs; do + if test x"$ac_arg" = x"$ac_i"; then + ac_exists=true + break + fi + done + + if test x"$ac_exists" = xtrue +then : + +else $as_nop + ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" +fi ;; esac ;; @@ -5996,7 +6805,7 @@ fi esac ;; -YP,*) - for ac_j in `$as_echo "$ac_arg" | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do + for ac_j in `printf "%s\n" "$ac_arg" | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_j" = x"$ac_i"; then @@ -6005,9 +6814,10 @@ fi fi done - if test x"$ac_exists" = xtrue; then : + if test x"$ac_exists" = xtrue +then : -else +else $as_nop ac_arg="$ac_arg $ac_j" ac_cv_f77_libs="$ac_cv_f77_libs $ac_j" fi @@ -6022,15 +6832,17 @@ fi fi done - if test x"$ac_exists" = xtrue; then : + if test x"$ac_exists" = xtrue +then : -else +else $as_nop ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi ;; -zallextract*| -zdefaultextract) ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" ;; + -mllvm) ${2+shift};; # Defend against 'clang -mllvm -loopopt=0'. # Ignore everything else. esac done @@ -6042,7 +6854,7 @@ set X $ac_save_positional; shift # must begin with a "/"). case `(uname -sr) 2>/dev/null` in "SunOS 5"*) - ac_ld_run_path=`$as_echo "$ac_f77_v_output" | + ac_ld_run_path=`printf "%s\n" "$ac_f77_v_output" | sed -n 's,^.*LD_RUN_PATH *= *\(/[^ ]*\).*$,-R\1,p'` test "x$ac_ld_run_path" != x && if test "$ac_compiler_gnu" = yes; then @@ -6057,35 +6869,36 @@ esac fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_libs" >&5 -$as_echo "$ac_cv_f77_libs" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_libs" >&5 +printf "%s\n" "$ac_cv_f77_libs" >&6; } 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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 -$as_echo_n "checking for dummy main to link with Fortran 77 libraries... " >&6; } -if ${ac_cv_f77_dummy_main+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dummy main to link with Fortran 77 libraries" >&5 +printf %s "checking for dummy main to link with Fortran 77 libraries... " >&6; } +if test ${ac_cv_f77_dummy_main+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_f77_dm_save_LIBS=$LIBS LIBS="$LIBS $FLIBS" ac_fortran_dm_var=F77_DUMMY_MAIN 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # First, try linking without a dummy main: @@ -6101,19 +6914,20 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_fortran_dummy_main=none -else +else $as_nop ac_cv_fortran_dummy_main=unknown fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test $ac_cv_fortran_dummy_main = unknown; then @@ -6130,48 +6944,48 @@ rm -f core conftest.err conftest.$ac_objext \ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_fortran_dummy_main=$ac_func; break fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done 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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_cv_f77_dummy_main=$ac_cv_fortran_dummy_main rm -rf conftest* LIBS=$ac_f77_dm_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_dummy_main" >&5 -$as_echo "$ac_cv_f77_dummy_main" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_dummy_main" >&5 +printf "%s\n" "$ac_cv_f77_dummy_main" >&6; } F77_DUMMY_MAIN=$ac_cv_f77_dummy_main -if test "$F77_DUMMY_MAIN" != unknown; then : +if test "$F77_DUMMY_MAIN" != unknown +then : if test $F77_DUMMY_MAIN != none; then -cat >>confdefs.h <<_ACEOF -#define F77_DUMMY_MAIN $F77_DUMMY_MAIN -_ACEOF +printf "%s\n" "#define F77_DUMMY_MAIN $F77_DUMMY_MAIN" >>confdefs.h if test "x$ac_cv_fc_dummy_main" = "x$ac_cv_f77_dummy_main"; then -$as_echo "#define FC_DUMMY_MAIN_EQ_F77 1" >>confdefs.h +printf "%s\n" "#define FC_DUMMY_MAIN_EQ_F77 1" >>confdefs.h fi fi -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "linking to Fortran libraries from C fails See \`config.log' for more details" "$LINENO" 5; } fi @@ -6179,18 +6993,19 @@ 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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; } -if ${ac_cv_f77_mangling+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 name-mangling scheme" >&5 +printf %s "checking for Fortran 77 name-mangling scheme... " >&6; } +if test ${ac_cv_f77_mangling+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat > conftest.$ac_ext <<_ACEOF subroutine foobar() return @@ -6199,7 +7014,8 @@ else return end _ACEOF -if ac_fn_f77_try_compile "$LINENO"; then : +if ac_fn_f77_try_compile "$LINENO" +then : mv conftest.$ac_objext cfortran_test.$ac_objext ac_save_LIBS=$LIBS @@ -6208,7 +7024,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 $LDFLAGS>&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success=no for ac_foobar in foobar FOOBAR; do @@ -6220,9 +7036,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char $ac_func (); #ifdef F77_DUMMY_MAIN @@ -6233,23 +7046,24 @@ char $ac_func (); #endif int -main () +main (void) { return $ac_func (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_success=yes; break 2 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done 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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success" = "yes"; then @@ -6267,7 +7081,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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success_extra=no for ac_extra in "" "_"; do @@ -6278,9 +7092,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char $ac_func (); #ifdef F77_DUMMY_MAIN @@ -6291,22 +7102,23 @@ char $ac_func (); #endif int -main () +main (void) { return $ac_func (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_success_extra=yes; break fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext 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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success_extra" = "yes"; then @@ -6331,97 +7143,94 @@ ac_compiler_gnu=$ac_cv_f77_compiler_gnu LIBS=$ac_save_LIBS rm -rf conftest* rm -f cfortran_test* -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compile a simple Fortran program See \`config.log' for more details" "$LINENO" 5; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_mangling" >&5 -$as_echo "$ac_cv_f77_mangling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_mangling" >&5 +printf "%s\n" "$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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - # AC_MSG_NOTICE([In COIN_F77_SETUP]) - -# F77_WRAPPERS will trigger the necessary F77 setup macros (F77_MAIN, -# 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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in "lower case, no underscore, no extra underscore") - $as_echo "#define F77_FUNC(name,NAME) name" >>confdefs.h + printf "%s\n" "#define F77_FUNC(name,NAME) name" >>confdefs.h - $as_echo "#define F77_FUNC_(name,NAME) name" >>confdefs.h + printf "%s\n" "#define F77_FUNC_(name,NAME) name" >>confdefs.h ;; "lower case, no underscore, extra underscore") - $as_echo "#define F77_FUNC(name,NAME) name" >>confdefs.h + printf "%s\n" "#define F77_FUNC(name,NAME) name" >>confdefs.h - $as_echo "#define F77_FUNC_(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define F77_FUNC_(name,NAME) name ## _" >>confdefs.h ;; "lower case, underscore, no extra underscore") - $as_echo "#define F77_FUNC(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define F77_FUNC(name,NAME) name ## _" >>confdefs.h - $as_echo "#define F77_FUNC_(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define F77_FUNC_(name,NAME) name ## _" >>confdefs.h ;; "lower case, underscore, extra underscore") - $as_echo "#define F77_FUNC(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define F77_FUNC(name,NAME) name ## _" >>confdefs.h - $as_echo "#define F77_FUNC_(name,NAME) name ## __" >>confdefs.h + printf "%s\n" "#define F77_FUNC_(name,NAME) name ## __" >>confdefs.h ;; "upper case, no underscore, no extra underscore") - $as_echo "#define F77_FUNC(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define F77_FUNC(name,NAME) NAME" >>confdefs.h - $as_echo "#define F77_FUNC_(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define F77_FUNC_(name,NAME) NAME" >>confdefs.h ;; "upper case, no underscore, extra underscore") - $as_echo "#define F77_FUNC(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define F77_FUNC(name,NAME) NAME" >>confdefs.h - $as_echo "#define F77_FUNC_(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define F77_FUNC_(name,NAME) NAME ## _" >>confdefs.h ;; "upper case, underscore, no extra underscore") - $as_echo "#define F77_FUNC(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define F77_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define F77_FUNC_(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define F77_FUNC_(name,NAME) NAME ## _" >>confdefs.h ;; "upper case, underscore, extra underscore") - $as_echo "#define F77_FUNC(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define F77_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define F77_FUNC_(name,NAME) NAME ## __" >>confdefs.h + printf "%s\n" "#define F77_FUNC_(name,NAME) NAME ## __" >>confdefs.h ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unknown Fortran name-mangling scheme" >&5 -$as_echo "$as_me: WARNING: unknown Fortran name-mangling scheme" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unknown Fortran name-mangling scheme" >&5 +printf "%s\n" "$as_me: WARNING: unknown Fortran name-mangling scheme" >&2;} ;; 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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; } -if ${ac_cv_prog_f77_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $F77 understands -c and -o together" >&5 +printf %s "checking whether $F77 understands -c and -o together... " >&6; } +if test ${ac_cv_prog_f77_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat > conftest.$ac_ext <<_ACEOF program main @@ -6436,10 +7245,10 @@ if { { case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in @@ -6447,41 +7256,34 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then ac_cv_prog_f77_c_o=yes else ac_cv_prog_f77_c_o=no fi -rm -f conftest* +rm -rf conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_c_o" >&5 -$as_echo "$ac_cv_prog_f77_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_c_o" >&5 +printf "%s\n" "$ac_cv_prog_f77_c_o" >&6; } if test $ac_cv_prog_f77_c_o = no; then -$as_echo "#define F77_NO_MINUS_C_MINUS_O 1" >>confdefs.h +printf "%s\n" "#define F77_NO_MINUS_C_MINUS_O 1" >>confdefs.h 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_cv_prog_f77_c_o = no ; then F77="$am_aux_dir/compile $F77" - else - case "$F77" in *ifort ) - case $build in - *-mingw* | *-cygwin* | *-msys* ) F77="$am_aux_dir/compile $F77" ;; esac - ;; - esac fi - # AC_MSG_NOTICE([Leaving COIN_F77_SETUP]) fi @@ -6491,14 +7293,15 @@ fi # Initialize libtool case `pwd` in *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac -macro_version='2.4.6' -macro_revision='2.4.6' +macro_version='2.4.7' +macro_revision='2.4.7' + @@ -6535,8 +7338,8 @@ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +printf %s "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then @@ -6562,12 +7365,12 @@ func_echo_all () } case $ECHO in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; + printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +printf "%s\n" "printf" >&6; } ;; + print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +printf "%s\n" "print -r" >&6; } ;; + *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +printf "%s\n" "cat" >&6; } ;; esac @@ -6583,11 +7386,12 @@ esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +printf %s "checking for a sed that does not truncate output... " >&6; } +if test ${ac_cv_path_SED+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" @@ -6601,10 +7405,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in sed gsed + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED @@ -6613,13 +7422,13 @@ case `"$ac_path_SED" --version 2>&1` in ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" + printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -6647,8 +7456,8 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed @@ -6665,11 +7474,12 @@ Xsed="$SED -e 1s/^X//" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST @@ -6677,10 +7487,15 @@ else for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP @@ -6689,13 +7504,13 @@ case `"$ac_path_GREP" --version 2>&1` in ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -6723,16 +7538,17 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else @@ -6743,10 +7559,15 @@ else for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP @@ -6755,13 +7576,13 @@ case `"$ac_path_EGREP" --version 2>&1` in ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -6790,16 +7611,17 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +printf %s "checking for fgrep... " >&6; } +if test ${ac_cv_path_FGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else @@ -6810,10 +7632,15 @@ else for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in fgrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP @@ -6822,13 +7649,13 @@ case `"$ac_path_FGREP" --version 2>&1` in ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" + printf "%s\n" 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -6857,8 +7684,8 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +printf "%s\n" "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" @@ -6883,17 +7710,18 @@ test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : +if test ${with_gnu_ld+y} +then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else +else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw @@ -6922,15 +7750,16 @@ $as_echo_n "checking for ld used by $CC... " >&6; } ;; esac elif test yes = "$with_gnu_ld"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do @@ -6959,18 +7788,19 @@ fi LD=$lt_cv_path_LD if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld @@ -6993,11 +7823,12 @@ with_gnu_ld=$lt_cv_prog_gnu_ld -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test ${lt_cv_path_NM+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM @@ -7022,13 +7853,13 @@ else mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 @@ -7047,8 +7878,8 @@ else : ${lt_cv_path_NM=no} fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +printf "%s\n" "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else @@ -7061,11 +7892,12 @@ else do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else @@ -7073,11 +7905,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7088,11 +7924,11 @@ fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +printf "%s\n" "$DUMPBIN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7105,11 +7941,12 @@ if test -z "$DUMPBIN"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else @@ -7117,11 +7954,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7132,11 +7973,11 @@ fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +printf "%s\n" "$ac_ct_DUMPBIN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7148,15 +7989,15 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; @@ -7177,11 +8018,12 @@ test -z "$NM" && NM=nm -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +printf %s "checking the name lister ($NM) interface... " >&6; } +if test ${lt_cv_nm_interface+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) @@ -7197,26 +8039,27 @@ else fi rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +printf "%s\n" "$lt_cv_nm_interface" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +printf %s "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +printf "%s\n" "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +printf %s "checking the maximum length of command line arguments... " >&6; } +if test ${lt_cv_sys_max_cmd_len+y} +then : + printf %s "(cached) " >&6 +else $as_nop i=0 teststring=ABCD @@ -7258,7 +8101,7 @@ else lt_cv_sys_max_cmd_len=8192; ;; - bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` @@ -7301,7 +8144,7 @@ else sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi @@ -7343,11 +8186,11 @@ else fi if test -n "$lt_cv_sys_max_cmd_len"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len @@ -7391,11 +8234,12 @@ esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +printf %s "checking how to convert $build file names to $host format... " >&6; } +if test ${lt_cv_to_host_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $host in *-*-mingw* ) case $build in @@ -7431,18 +8275,19 @@ esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +printf %s "checking how to convert $build file names to toolchain format... " >&6; } +if test ${lt_cv_to_tool_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in @@ -7458,44 +8303,153 @@ esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +printf %s "checking for $LD option to reload object files... " >&6; } +if test ${lt_cv_ld_reload_flag+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_reload_flag='-r' +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. +set dummy ${ac_tool_prefix}file; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_FILECMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$FILECMD"; then + ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_FILECMD="${ac_tool_prefix}file" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +FILECMD=$ac_cv_prog_FILECMD +if test -n "$FILECMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 +printf "%s\n" "$FILECMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +fi +if test -z "$ac_cv_prog_FILECMD"; then + ac_ct_FILECMD=$FILECMD + # Extract the first word of "file", so it can be a program name with args. +set dummy file; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_FILECMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_FILECMD"; then + ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_FILECMD="file" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 +fi +fi +ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD +if test -n "$ac_ct_FILECMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 +printf "%s\n" "$ac_ct_FILECMD" >&6; } else - lt_cv_ld_reload_flag='-r' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test yes != "$GCC"; then - reload_cmds=false - fi - ;; - darwin*) - if test yes = "$GCC"; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - + if test "x$ac_ct_FILECMD" = x; then + FILECMD=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + FILECMD=$ac_ct_FILECMD + fi +else + FILECMD="$ac_cv_prog_FILECMD" +fi @@ -7506,11 +8460,12 @@ esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else @@ -7518,11 +8473,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7533,11 +8492,11 @@ fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7546,11 +8505,12 @@ if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else @@ -7558,11 +8518,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7573,11 +8537,11 @@ fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then @@ -7585,8 +8549,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP @@ -7602,11 +8566,12 @@ test -z "$OBJDUMP" && OBJDUMP=objdump -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +printf %s "checking how to recognize dependent libraries... " >&6; } +if test ${lt_cv_deplibs_check_method+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' @@ -7632,7 +8597,7 @@ beos*) bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_cmd='$FILECMD -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; @@ -7666,14 +8631,14 @@ darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | dragonfly*) +freebsd* | dragonfly* | midnightbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac @@ -7687,7 +8652,7 @@ haiku*) ;; hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_cmd=$FILECMD case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' @@ -7734,7 +8699,7 @@ netbsd*) newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; @@ -7802,8 +8767,8 @@ os2*) esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no @@ -7847,11 +8812,12 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else @@ -7859,11 +8825,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7874,11 +8844,11 @@ fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7887,11 +8857,12 @@ if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else @@ -7899,11 +8870,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7914,11 +8889,11 @@ fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then @@ -7926,8 +8901,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL @@ -7944,11 +8919,12 @@ test -z "$DLLTOOL" && DLLTOOL=dlltool -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +printf %s "checking how to associate runtime and link libraries... " >&6; } +if test ${lt_cv_sharedlib_from_linklib_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in @@ -7971,8 +8947,8 @@ cygwin* | mingw* | pw32* | cegcc*) esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO @@ -7987,11 +8963,12 @@ if test -n "$ac_tool_prefix"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else @@ -7999,11 +8976,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8014,11 +8995,11 @@ fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8031,11 +9012,12 @@ if test -z "$AR"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else @@ -8043,11 +9025,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8058,11 +9044,11 @@ fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8074,8 +9060,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR @@ -8083,23 +9069,40 @@ esac fi : ${AR=ar} -: ${AR_FLAGS=cru} +# Use ARFLAGS variable as AR's operation code to sync the variable naming with +# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have +# higher priority because thats what people were doing historically (setting +# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS +# variable obsoleted/removed. +test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} +lt_ar_flags=$AR_FLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else + + +# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override +# by AR_FLAGS because that was never working and AR_FLAGS is about to die. + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +printf %s "checking for archiver @FILE support... " >&6; } +if test ${lt_cv_ar_at_file+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8113,20 +9116,21 @@ else #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. @@ -8134,7 +9138,7 @@ if ac_fn_c_try_compile "$LINENO"; then : { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ @@ -8143,11 +9147,11 @@ if ac_fn_c_try_compile "$LINENO"; then : rm -f conftest.* libconftest.a fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +printf "%s\n" "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= @@ -8164,11 +9168,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -8176,11 +9181,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8191,11 +9200,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8204,11 +9213,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -8216,11 +9226,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8231,11 +9245,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -8243,8 +9257,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -8263,11 +9277,12 @@ test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else @@ -8275,11 +9290,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8290,11 +9309,11 @@ fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8303,11 +9322,12 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else @@ -8315,11 +9335,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8330,11 +9354,11 @@ fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -8342,8 +9366,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -8432,11 +9456,12 @@ compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +printf %s "checking command to parse $NM output from $compiler object... " >&6; } +if test ${lt_cv_sys_global_symbol_pipe+y} +then : + printf %s "(cached) " >&6 +else $as_nop # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] @@ -8491,7 +9516,7 @@ esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. - lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" @@ -8509,20 +9534,20 @@ fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ @@ -8546,7 +9571,7 @@ for ac_symprfx in "" "_"; do if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++, + # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ @@ -8564,9 +9589,9 @@ for ac_symprfx in "" "_"; do " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -8588,14 +9613,14 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then @@ -8664,7 +9689,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi @@ -8699,11 +9724,11 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +printf "%s\n" "failed" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf "%s\n" "ok" >&6; } fi # Response file support. @@ -8749,13 +9774,14 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +printf %s "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : +if test ${with_sysroot+y} +then : withval=$with_sysroot; -else +else $as_nop with_sysroot=no fi @@ -8768,29 +9794,30 @@ case $with_sysroot in #( fi ;; #( /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 -$as_echo "$with_sysroot" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +printf "%s\n" "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +printf "%s\n" "${lt_sysroot:-no}" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 -$as_echo_n "checking for a working dd... " >&6; } -if ${ac_cv_path_lt_DD+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +printf %s "checking for a working dd... " >&6; } +if test ${ac_cv_path_lt_DD+y} +then : + printf %s "(cached) " >&6 +else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} @@ -8801,10 +9828,15 @@ if test -z "$lt_DD"; then for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in dd; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in dd + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" + ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ @@ -8824,15 +9856,16 @@ fi rm -f conftest.i conftest2.i conftest.out fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 -$as_echo "$ac_cv_path_lt_DD" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +printf "%s\n" "$ac_cv_path_lt_DD" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 -$as_echo_n "checking how to truncate binary pipes... " >&6; } -if ${lt_cv_truncate_bin+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +printf %s "checking how to truncate binary pipes... " >&6; } +if test ${lt_cv_truncate_bin+y} +then : + printf %s "(cached) " >&6 +else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= @@ -8843,8 +9876,8 @@ fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 -$as_echo "$lt_cv_truncate_bin" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +printf "%s\n" "$lt_cv_truncate_bin" >&6; } @@ -8867,7 +9900,8 @@ func_cc_basename () } # Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : +if test ${enable_libtool_lock+y} +then : enableval=$enable_libtool_lock; fi @@ -8883,9 +9917,9 @@ ia64-*-hpux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; @@ -8903,10 +9937,10 @@ ia64-*-hpux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; @@ -8918,7 +9952,7 @@ ia64-*-hpux*) ;; esac else - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; @@ -8941,10 +9975,10 @@ mips64*-*linux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; @@ -8952,7 +9986,7 @@ mips64*-*linux*) emul="${emul}64" ;; esac - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; @@ -8960,7 +9994,7 @@ mips64*-*linux*) emul="${emul}ltsmip" ;; esac - case `/usr/bin/file conftest.$ac_objext` in + case `$FILECMD conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; @@ -8982,16 +10016,16 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in + case `$FILECMD conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - case `/usr/bin/file conftest.o` in + case `$FILECMD conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; @@ -9045,15 +10079,16 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +printf %s "checking whether the C compiler needs -belf... " >&6; } +if test ${lt_cv_cc_needs_belf+y} +then : + printf %s "(cached) " >&6 +else $as_nop 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9068,29 +10103,30 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_cv_cc_needs_belf=yes -else +else $as_nop lt_cv_cc_needs_belf=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS @@ -9103,9 +10139,9 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in + case `$FILECMD conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) @@ -9140,11 +10176,12 @@ need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else @@ -9152,11 +10189,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9167,11 +10208,11 @@ fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +printf "%s\n" "$MANIFEST_TOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -9180,11 +10221,12 @@ if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else @@ -9192,11 +10234,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9207,11 +10253,11 @@ fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then @@ -9219,8 +10265,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL @@ -9230,11 +10276,12 @@ else fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if test ${lt_cv_path_mainfest_tool+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out @@ -9244,8 +10291,8 @@ else fi rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi @@ -9260,11 +10307,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else @@ -9272,11 +10320,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9287,11 +10339,11 @@ fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +printf "%s\n" "$DSYMUTIL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -9300,11 +10352,12 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else @@ -9312,11 +10365,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9327,11 +10384,11 @@ fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then @@ -9339,8 +10396,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL @@ -9352,11 +10409,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else @@ -9364,11 +10422,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9379,11 +10441,11 @@ fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +printf "%s\n" "$NMEDIT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -9392,11 +10454,12 @@ if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else @@ -9404,11 +10467,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9419,11 +10486,11 @@ fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +printf "%s\n" "$ac_ct_NMEDIT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then @@ -9431,8 +10498,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT @@ -9444,11 +10511,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else @@ -9456,11 +10524,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9471,11 +10543,11 @@ fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +printf "%s\n" "$LIPO" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -9484,11 +10556,12 @@ if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else @@ -9496,11 +10569,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9511,11 +10588,11 @@ fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +printf "%s\n" "$ac_ct_LIPO" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then @@ -9523,8 +10600,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO @@ -9536,11 +10613,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else @@ -9548,11 +10626,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9563,11 +10645,11 @@ fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +printf "%s\n" "$OTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -9576,11 +10658,12 @@ if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else @@ -9588,11 +10671,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9603,11 +10690,11 @@ fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +printf "%s\n" "$ac_ct_OTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then @@ -9615,8 +10702,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL @@ -9628,11 +10715,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else @@ -9640,11 +10728,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9655,11 +10747,11 @@ fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +printf "%s\n" "$OTOOL64" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -9668,11 +10760,12 @@ if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else @@ -9680,11 +10773,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -9695,11 +10792,11 @@ fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +printf "%s\n" "$ac_ct_OTOOL64" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then @@ -9707,8 +10804,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 @@ -9743,11 +10840,12 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +printf %s "checking for -single_module linker flag... " >&6; } +if test ${lt_cv_apple_cc_single_mod+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override @@ -9776,14 +10874,15 @@ else rm -f conftest.* fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +printf %s "checking for -exported_symbols_list linker flag... " >&6; } +if test ${lt_cv_ld_exported_symbols_list+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym @@ -9800,39 +10899,41 @@ else #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_cv_ld_exported_symbols_list=yes -else +else $as_nop lt_cv_ld_exported_symbols_list=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +printf %s "checking for -force_load linker flag... " >&6; } +if test ${lt_cv_ld_force_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 + echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 + $AR $AR_FLAGS libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF @@ -9852,24 +10953,19 @@ _LT_EOF rm -rf conftest.dSYM fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +printf "%s\n" "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - 10.[012][,.]*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + darwin*) + case $MACOSX_DEPLOYMENT_TARGET,$host in + 10.[012],*|,*powerpc*-darwin[5-8]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + *) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac @@ -9896,322 +10992,71 @@ $as_echo "$lt_cv_ld_force_load" >&6; } # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x$2 in - x) - ;; - *:) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" - ;; - x:*) - eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" - ;; - *) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" - ;; - 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 $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; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -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 $LDFLAGS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -#ifdef F77_DUMMY_MAIN - -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } - -#endif -int -main () +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () { - - ; - return 0; + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac } -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done -else - ac_cv_header_stdc=no -fi -rm -f conftest* -fi -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then -$as_echo "#define STDC_HEADERS 1" >>confdefs.h -fi +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF +if test "x$ac_cv_header_dlfcn_h" = xyes +then : + printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h fi -done - @@ -10224,17 +11069,18 @@ func_stripname_cnf () } # func_stripname_cnf -# checkout AR and decide whether to use ar-lib wrapper + if test -n "$ac_tool_prefix"; then for ac_prog in ar lib "link -lib" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else @@ -10242,11 +11088,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10257,11 +11107,11 @@ fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -10274,11 +11124,12 @@ if test -z "$AR"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else @@ -10286,11 +11137,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10301,11 +11156,11 @@ fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -10317,8 +11172,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR @@ -10327,15 +11182,16 @@ fi : ${AR=ar} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 -$as_echo_n "checking the archiver ($AR) interface... " >&6; } -if ${am_cv_ar_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +printf %s "checking the archiver ($AR) interface... " >&6; } +if test ${am_cv_ar_interface+y} +then : + printf %s "(cached) " >&6 +else $as_nop 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am_cv_ar_interface=ar @@ -10343,12 +11199,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu /* end confdefs.h. */ int some_variable = 0; _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=ar @@ -10357,7 +11214,7 @@ if ac_fn_c_try_compile "$LINENO"; then : { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=lib @@ -10368,16 +11225,16 @@ if ac_fn_c_try_compile "$LINENO"; then : rm -f conftest.lib libconftest.a fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 -$as_echo "$am_cv_ar_interface" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +printf "%s\n" "$am_cv_ar_interface" >&6; } case $am_cv_ar_interface in ar) @@ -10397,14 +11254,14 @@ unknown) esac -# Create libtool. # Set options # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : +if test ${enable_static+y} +then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; @@ -10422,7 +11279,7 @@ if test "${enable_static+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_static=no fi @@ -10434,7 +11291,8 @@ fi # Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : +if test ${with_pic+y} +then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; @@ -10451,7 +11309,7 @@ if test "${with_pic+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop pic_mode=yes fi @@ -10467,11 +11325,12 @@ case $host in if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else @@ -10479,11 +11338,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10494,11 +11357,11 @@ fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +printf "%s\n" "$AS" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -10507,11 +11370,12 @@ if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else @@ -10519,11 +11383,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10534,11 +11402,11 @@ fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +printf "%s\n" "$ac_ct_AS" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_AS" = x; then @@ -10546,8 +11414,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS @@ -10559,11 +11427,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else @@ -10571,11 +11440,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10586,11 +11459,11 @@ fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -10599,11 +11472,12 @@ if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else @@ -10611,11 +11485,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10626,11 +11504,11 @@ fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then @@ -10638,8 +11516,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL @@ -10651,11 +11529,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else @@ -10663,11 +11542,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10678,11 +11561,11 @@ fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -10691,11 +11574,12 @@ if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else @@ -10703,11 +11587,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -10718,11 +11606,11 @@ fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then @@ -10730,8 +11618,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP @@ -10768,7 +11656,8 @@ test -z "$OBJDUMP" && OBJDUMP=objdump # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : +if test ${enable_shared+y} +then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; @@ -10786,7 +11675,7 @@ if test "${enable_shared+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_shared=yes fi @@ -10801,7 +11690,8 @@ fi # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : +if test ${enable_fast_install+y} +then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; @@ -10819,7 +11709,7 @@ if test "${enable_fast_install+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_fast_install=yes fi @@ -10833,11 +11723,12 @@ fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 -$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +printf %s "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. -if test "${with_aix_soname+set}" = set; then : +if test ${with_aix_soname+y} +then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; @@ -10846,18 +11737,19 @@ if test "${with_aix_soname+set}" = set; then : ;; esac lt_cv_with_aix_soname=$with_aix_soname -else - if ${lt_cv_with_aix_soname+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + if test ${lt_cv_with_aix_soname+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 -$as_echo "$with_aix_soname" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +printf "%s\n" "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', @@ -10939,11 +11831,12 @@ if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +printf %s "checking for objdir... " >&6; } +if test ${lt_cv_objdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then @@ -10954,17 +11847,15 @@ else fi rmdir .libs 2>/dev/null fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +printf "%s\n" "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF +printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h @@ -10985,8 +11876,8 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld @@ -11010,11 +11901,12 @@ test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +printf %s "checking for ${ac_tool_prefix}file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. @@ -11063,11 +11955,11 @@ fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -11076,11 +11968,12 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +printf %s "checking for file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. @@ -11129,11 +12022,11 @@ fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -11152,7 +12045,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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -11214,11 +12107,12 @@ if test yes = "$GCC"; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test ${lt_cv_prog_compiler_rtti_exceptions+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -11249,8 +12143,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" @@ -11491,7 +12385,7 @@ lt_prog_compiler_static= lt_prog_compiler_static='-qstaticlink' ;; *) - case `$CC -V 2>&1 | sed 5q` in + case `$CC -V 2>&1 | $SED 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' @@ -11607,26 +12501,28 @@ case $host_os in ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -11657,8 +12553,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in @@ -11686,11 +12582,12 @@ fi # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" @@ -11714,8 +12611,8 @@ else LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : @@ -11729,11 +12626,12 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest @@ -11776,19 +12674,20 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest @@ -11831,8 +12730,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } @@ -11840,19 +12739,19 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -11864,8 +12763,8 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= @@ -11909,15 +12808,15 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) @@ -11969,7 +12868,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie whole_archive_flag_spec= fi supports_anon_versioning=no - case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... @@ -12081,6 +12980,7 @@ _LT_EOF emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes + file_list_spec='@' ;; interix[3-9]*) @@ -12095,7 +12995,7 @@ _LT_EOF # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) @@ -12138,7 +13038,7 @@ _LT_EOF compiler_needs_object=yes ;; esac - case `$CC -V 2>&1 | sed 5q` in + case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes @@ -12150,7 +13050,7 @@ _LT_EOF if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi @@ -12166,7 +13066,7 @@ _LT_EOF archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi @@ -12298,7 +13198,7 @@ _LT_EOF if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no @@ -12420,9 +13320,10 @@ _LT_EOF if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -12435,14 +13336,15 @@ else #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -12457,7 +13359,7 @@ if ac_fn_c_try_link "$LINENO"; then : lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib @@ -12481,9 +13383,10 @@ fi if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -12496,14 +13399,15 @@ else #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -12518,7 +13422,7 @@ if ac_fn_c_try_link "$LINENO"; then : lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib @@ -12585,7 +13489,7 @@ fi # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl* | icl*| ifort*) + cl* | icl* | ifort*) # Native MSVC or ICC or IFORT hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported @@ -12668,8 +13572,8 @@ fi output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + archive_expsym_cmds="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no @@ -12703,7 +13607,7 @@ fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) + freebsd* | dragonfly* | midnightbsd*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes @@ -12769,11 +13673,12 @@ fi # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +printf %s "checking if $CC understands -b... " >&6; } +if test ${lt_cv_prog_compiler__b+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" @@ -12797,8 +13702,8 @@ else LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' @@ -12838,28 +13743,30 @@ fi # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if test ${lt_cv_irix_exported_symbol+y} +then : + printf %s "(cached) " >&6 +else $as_nop save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_cv_irix_exported_symbol=yes -else +else $as_nop lt_cv_irix_exported_symbol=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi @@ -12951,6 +13858,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes + file_list_spec='@' ;; osf3*) @@ -13139,8 +14047,8 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +printf "%s\n" "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld @@ -13176,18 +14084,19 @@ x|xyes) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc+y} +then : + printf %s "(cached) " >&6 +else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest @@ -13205,7 +14114,7 @@ else if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no @@ -13219,8 +14128,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac @@ -13379,8 +14288,8 @@ esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in @@ -13642,7 +14551,7 @@ cygwin* | mingw* | pw32* | cegcc*) case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; @@ -13652,7 +14561,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' @@ -13678,7 +14587,7 @@ cygwin* | mingw* | pw32* | cegcc*) done IFS=$lt_save_ifs # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form @@ -13715,7 +14624,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -13748,7 +14657,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; -freebsd* | dragonfly*) +freebsd* | dragonfly* | midnightbsd*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then @@ -13941,9 +14850,10 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir @@ -13961,19 +14871,21 @@ else #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : +if ac_fn_c_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : lt_cv_shlibpath_overrides_runpath=yes fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir @@ -14205,8 +15117,8 @@ uts4*) dynamic_linker=no ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" @@ -14327,8 +15239,8 @@ configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || @@ -14352,8 +15264,8 @@ else # directories. hardcode_action=unsupported fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +printf "%s\n" "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then @@ -14397,11 +15309,12 @@ else darwin*) # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14410,9 +15323,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); #ifdef F77_DUMMY_MAIN @@ -14423,27 +15333,29 @@ char dlopen (); #endif int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dl_dlopen=yes -else +else $as_nop ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else +else $as_nop lt_cv_dlopen=dyld lt_cv_dlopen_libs= @@ -14463,14 +15375,16 @@ fi *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : +if test "x$ac_cv_func_shl_load" = xyes +then : lt_cv_dlopen=shl_load -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +printf %s "checking for shl_load in -ldld... " >&6; } +if test ${ac_cv_lib_dld_shl_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14479,9 +15393,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char shl_load (); #ifdef F77_DUMMY_MAIN @@ -14492,36 +15403,40 @@ char shl_load (); #endif int -main () +main (void) { return shl_load (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dld_shl_load=yes -else +else $as_nop ac_cv_lib_dld_shl_load=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes +then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld -else +else $as_nop ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +if test "x$ac_cv_func_dlopen" = xyes +then : lt_cv_dlopen=dlopen -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14530,9 +15445,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); #ifdef F77_DUMMY_MAIN @@ -14543,32 +15455,35 @@ char dlopen (); #endif int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dl_dlopen=yes -else +else $as_nop ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +printf %s "checking for dlopen in -lsvld... " >&6; } +if test ${ac_cv_lib_svld_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14577,9 +15492,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); #ifdef F77_DUMMY_MAIN @@ -14590,32 +15502,35 @@ char dlopen (); #endif int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_svld_dlopen=yes -else +else $as_nop ac_cv_lib_svld_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes +then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +printf %s "checking for dld_link in -ldld... " >&6; } +if test ${ac_cv_lib_dld_dld_link+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14624,9 +15539,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dld_link (); #ifdef F77_DUMMY_MAIN @@ -14637,25 +15549,27 @@ char dld_link (); #endif int -main () +main (void) { return dld_link (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dld_dld_link=yes -else +else $as_nop ac_cv_lib_dld_dld_link=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes +then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi @@ -14694,11 +15608,12 @@ fi save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +printf %s "checking whether a program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else @@ -14777,7 +15692,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? @@ -14795,16 +15710,17 @@ rm -fr conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +printf "%s\n" "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +printf %s "checking whether a statically linked program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self_static+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else @@ -14883,7 +15799,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? @@ -14901,8 +15817,8 @@ rm -fr conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS @@ -14940,32 +15856,43 @@ fi striplib= old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP"; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +printf %s "checking whether stripping libraries is possible... " >&6; } +if test -z "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +else + if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + case $host_os in + darwin*) + # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + ;; + freebsd*) + if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; + esac + fi fi @@ -14980,13 +15907,13 @@ fi # Report what library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +printf %s "checking if libtool supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +printf "%s\n" "$can_build_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +printf %s "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and @@ -15010,15 +15937,15 @@ $as_echo_n "checking whether to build shared libraries... " >&6; } fi ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +printf "%s\n" "$enable_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +printf %s "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +printf "%s\n" "$enable_static" >&6; } @@ -15027,7 +15954,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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC @@ -15038,38 +15965,34 @@ 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 $LDFLAGS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +printf %s "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then - if ${ac_cv_prog_CXXCPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" + if test ${ac_cv_prog_CXXCPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CXX needs to be expanded + for CXXCPP in "$CXX -E" cpp /lib/cpp do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include Syntax error _ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : +if ac_fn_cxx_try_cpp "$LINENO" +then : -else +else $as_nop # Broken: fails on valid input. continue fi @@ -15081,10 +16004,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : +if ac_fn_cxx_try_cpp "$LINENO" +then : # Broken: success on invalid input. continue -else +else $as_nop # Passes both tests. ac_preproc_ok=: break @@ -15094,7 +16018,8 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok +then : break fi @@ -15106,29 +16031,24 @@ fi else ac_cv_prog_CXXCPP=$CXXCPP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -$as_echo "$CXXCPP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +printf "%s\n" "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include Syntax error _ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : +if ac_fn_cxx_try_cpp "$LINENO" +then : -else +else $as_nop # Broken: fails on valid input. continue fi @@ -15140,10 +16060,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : +if ac_fn_cxx_try_cpp "$LINENO" +then : # Broken: success on invalid input. continue -else +else $as_nop # Passes both tests. ac_preproc_ok=: break @@ -15153,11 +16074,12 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok +then : -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi @@ -15165,7 +16087,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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else @@ -15175,7 +16097,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 $LDFLAGS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no @@ -15293,17 +16215,18 @@ cc_basename=$func_cc_basename_result # Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : +if test ${with_gnu_ld+y} +then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else +else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw @@ -15332,15 +16255,16 @@ $as_echo_n "checking for ld used by $CC... " >&6; } ;; esac elif test yes = "$with_gnu_ld"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do @@ -15369,18 +16293,19 @@ fi LD=$lt_cv_path_LD if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld @@ -15446,8 +16371,8 @@ with_gnu_ld=$lt_cv_prog_gnu_ld fi # PORTME: fill in a description of your system's C++ link characteristics - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) @@ -15585,9 +16510,10 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15600,14 +16526,15 @@ else #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -15622,7 +16549,7 @@ if ac_fn_cxx_try_link "$LINENO"; then : lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib @@ -15647,9 +16574,10 @@ fi if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15662,14 +16590,15 @@ else #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -15684,7 +16613,7 @@ if ac_fn_cxx_try_link "$LINENO"; then : lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib @@ -15749,7 +16678,7 @@ fi cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in - ,cl* | no,cl* | ,icl* | no,icl* | ,ifort* | no,ifort*) + ,cl* | no,cl* | ,icl* | no,icl* | ,ifort* | no,ifort* ) # Native MSVC or ICC or IFORT # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -15841,11 +16770,11 @@ fi output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds_CXX="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" - archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi else @@ -15880,6 +16809,7 @@ fi emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes + file_list_spec_CXX='@' ;; dgux*) @@ -15910,7 +16840,7 @@ fi archive_cmds_need_lc_CXX=no ;; - freebsd* | dragonfly*) + freebsd* | dragonfly* | midnightbsd*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes @@ -16047,7 +16977,7 @@ fi # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in @@ -16187,13 +17117,13 @@ fi archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) - case `$CC -V 2>&1 | sed 5q` in + case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' @@ -16535,8 +17465,8 @@ fi ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX @@ -16574,7 +17504,7 @@ esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. @@ -16850,7 +17780,7 @@ lt_prog_compiler_static_CXX= ;; esac ;; - freebsd* | dragonfly*) + freebsd* | dragonfly* | midnightbsd*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -16933,7 +17863,7 @@ lt_prog_compiler_static_CXX= lt_prog_compiler_static_CXX='-qstaticlink' ;; *) - case `$CC -V 2>&1 | sed 5q` in + case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' @@ -17055,26 +17985,28 @@ case $host_os in ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } -if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -17105,8 +18037,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in @@ -17128,11 +18060,12 @@ fi # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" @@ -17156,8 +18089,8 @@ else LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : @@ -17168,11 +18101,12 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest @@ -17215,16 +18149,17 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest @@ -17267,8 +18202,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } @@ -17276,19 +18211,19 @@ $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -17297,8 +18232,8 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' @@ -17315,7 +18250,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) @@ -17337,8 +18272,8 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld @@ -17365,18 +18300,19 @@ x|xyes) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest @@ -17394,7 +18330,7 @@ else if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no @@ -17408,8 +18344,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac @@ -17478,8 +18414,8 @@ esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' @@ -17670,7 +18606,7 @@ cygwin* | mingw* | pw32* | cegcc*) case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) @@ -17679,7 +18615,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' @@ -17705,7 +18641,7 @@ cygwin* | mingw* | pw32* | cegcc*) done IFS=$lt_save_ifs # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form @@ -17742,7 +18678,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -17774,7 +18710,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; -freebsd* | dragonfly*) +freebsd* | dragonfly* | midnightbsd*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then @@ -17967,9 +18903,10 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir @@ -17987,19 +18924,21 @@ else #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : +if ac_fn_cxx_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : lt_cv_shlibpath_overrides_runpath=yes fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir @@ -18231,8 +19170,8 @@ uts4*) dynamic_linker=no ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" @@ -18296,8 +19235,8 @@ configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || @@ -18321,8 +19260,8 @@ else # directories. hardcode_action_CXX=unsupported fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 -$as_echo "$hardcode_action_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +printf "%s\n" "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then @@ -18357,14 +19296,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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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 $LDFLAGS >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -z "$F77" || test no = "$F77"; then @@ -18462,13 +19401,13 @@ cc_basename=$func_cc_basename_result GCC=$G77 if test -n "$compiler"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +printf %s "checking if libtool supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +printf "%s\n" "$can_build_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +printf %s "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and @@ -18491,15 +19430,15 @@ $as_echo_n "checking whether to build shared libraries... " >&6; } fi ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +printf "%s\n" "$enable_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +printf %s "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +printf "%s\n" "$enable_static" >&6; } GCC_F77=$G77 LD_F77=$LD @@ -18734,7 +19673,7 @@ lt_prog_compiler_static_F77= lt_prog_compiler_static_F77='-qstaticlink' ;; *) - case `$CC -V 2>&1 | sed 5q` in + case `$CC -V 2>&1 | $SED 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic_F77='-KPIC' @@ -18850,26 +19789,28 @@ case $host_os in ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic_F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic_F77=$lt_prog_compiler_pic_F77 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_F77" >&5 -$as_echo "$lt_cv_prog_compiler_pic_F77" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_F77" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_F77" >&6; } lt_prog_compiler_pic_F77=$lt_cv_prog_compiler_pic_F77 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; } -if ${lt_cv_prog_compiler_pic_works_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works_F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -18900,8 +19841,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_F77" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works_F77" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_F77" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works_F77" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_F77"; then case $lt_prog_compiler_pic_F77 in @@ -18923,11 +19864,12 @@ fi # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works_F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_static_works_F77=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" @@ -18951,8 +19893,8 @@ else LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_F77" >&5 -$as_echo "$lt_cv_prog_compiler_static_works_F77" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_F77" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works_F77" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_F77"; then : @@ -18963,11 +19905,12 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o_F77=no $RM -r conftest 2>/dev/null mkdir conftest @@ -19010,16 +19953,17 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_F77" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o_F77=no $RM -r conftest 2>/dev/null mkdir conftest @@ -19062,8 +20006,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_F77" >&6; } @@ -19071,19 +20015,19 @@ $as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_F77" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -19092,8 +20036,8 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag_F77= @@ -19137,15 +20081,15 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) @@ -19197,7 +20141,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie whole_archive_flag_spec_F77= fi supports_anon_versioning=no - case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... @@ -19309,6 +20253,7 @@ _LT_EOF emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_F77=yes + file_list_spec_F77='@' ;; interix[3-9]*) @@ -19323,7 +20268,7 @@ _LT_EOF # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_F77='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_F77='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) @@ -19366,7 +20311,7 @@ _LT_EOF compiler_needs_object_F77=yes ;; esac - case `$CC -V 2>&1 | sed 5q` in + case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec_F77='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object_F77=yes @@ -19378,7 +20323,7 @@ _LT_EOF if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi @@ -19394,7 +20339,7 @@ _LT_EOF archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi @@ -19526,7 +20471,7 @@ _LT_EOF if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds_F77='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds_F77='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no @@ -19648,15 +20593,17 @@ _LT_EOF if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath__F77+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath__F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF -if ac_fn_f77_try_link "$LINENO"; then : +if ac_fn_f77_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -19671,7 +20618,7 @@ if ac_fn_f77_try_link "$LINENO"; then : lt_cv_aix_libpath__F77=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__F77"; then lt_cv_aix_libpath__F77=/usr/lib:/lib @@ -19695,15 +20642,17 @@ fi if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath__F77+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath__F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF -if ac_fn_f77_try_link "$LINENO"; then : +if ac_fn_f77_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -19718,7 +20667,7 @@ if ac_fn_f77_try_link "$LINENO"; then : lt_cv_aix_libpath__F77=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__F77"; then lt_cv_aix_libpath__F77=/usr/lib:/lib @@ -19785,7 +20734,7 @@ fi # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl* | icl*| ifort*) + cl* | icl* | ifort*) # Native MSVC or ICC or IFORT hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported @@ -19868,8 +20817,8 @@ fi output_verbose_link_cmd=func_echo_all archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds_F77="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds_F77="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + archive_expsym_cmds_F77="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds_F77="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs_F77=no @@ -19903,7 +20852,7 @@ fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) + freebsd* | dragonfly* | midnightbsd*) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes @@ -19999,11 +20948,12 @@ fi # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if test ${lt_cv_irix_exported_symbol+y} +then : + printf %s "(cached) " >&6 +else $as_nop save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat > conftest.$ac_ext <<_ACEOF @@ -20011,17 +20961,18 @@ else subroutine foo end _ACEOF -if ac_fn_f77_try_link "$LINENO"; then : +if ac_fn_f77_try_link "$LINENO" +then : lt_cv_irix_exported_symbol=yes -else +else $as_nop lt_cv_irix_exported_symbol=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi @@ -20113,6 +21064,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_F77='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_F77=yes + file_list_spec_F77='@' ;; osf3*) @@ -20301,8 +21253,8 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_F77" >&5 -$as_echo "$ld_shlibs_F77" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_F77" >&5 +printf "%s\n" "$ld_shlibs_F77" >&6; } test no = "$ld_shlibs_F77" && can_build_shared=no with_gnu_ld_F77=$with_gnu_ld @@ -20329,18 +21281,19 @@ x|xyes) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc_F77+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc_F77+y} +then : + printf %s "(cached) " >&6 +else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest @@ -20358,7 +21311,7 @@ else if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_F77=no @@ -20372,8 +21325,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_F77" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc_F77" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_F77" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc_F77" >&6; } archive_cmds_need_lc_F77=$lt_cv_archive_cmds_need_lc_F77 ;; esac @@ -20442,8 +21395,8 @@ esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' @@ -20634,7 +21587,7 @@ cygwin* | mingw* | pw32* | cegcc*) case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) @@ -20643,7 +21596,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' @@ -20669,7 +21622,7 @@ cygwin* | mingw* | pw32* | cegcc*) done IFS=$lt_save_ifs # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form @@ -20706,7 +21659,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -20738,7 +21691,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; -freebsd* | dragonfly*) +freebsd* | dragonfly* | midnightbsd*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then @@ -20931,9 +21884,10 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir @@ -20944,12 +21898,14 @@ else end _ACEOF -if ac_fn_f77_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : +if ac_fn_f77_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : lt_cv_shlibpath_overrides_runpath=yes fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir @@ -21181,8 +22137,8 @@ uts4*) dynamic_linker=no ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" @@ -21246,8 +22202,8 @@ configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || test -n "$runpath_var_F77" || @@ -21271,8 +22227,8 @@ else # directories. hardcode_action_F77=unsupported fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_F77" >&5 -$as_echo "$hardcode_action_F77" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_F77" >&5 +printf "%s\n" "$hardcode_action_F77" >&6; } if test relink = "$hardcode_action_F77" || test yes = "$inherit_rpath_F77"; then @@ -21300,7 +22256,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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -21324,31 +22280,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Patch libtool to circumvent some issues when using MSVC and MS lib. -# This needs to be run after config.status has created libtool. -# 1. Relax check which libraries can be used when linking a DLL. -# libtool's func_mode_link() would reject linking a .lib file when building a DLL, -# even though this .lib file may just be the one that eventually loads a depending DLL, -# e.g., mkl_core_dll.lib. Setting deplibs_check_method=pass_all will still print a -# warning, but the .lib is still passed to the linker. -# 2. Ensure always_export_symbols=no if win32-dll. Even when we pass win32-dll, -# libtool forces always_export_symbols=yes for --tag=CXX if using MS compiler. -# This leads to a nm call that collects ALL C-functions from a library -# and explicitly dll-exporting them, leading to warnings about duplicates -# regarding those that are properly marked for dll-export in the source. -# 3. Do not add mkl_*.lib to old_deplibs, which can result in trying to unpack and repack -# the MKL libraries (which are pretty big). Instead, treat them like other -l<...> libs. -# 4. Add MKL libraries to dependency_libs in .la file, which I guess should be -# the case due to point 5. -# -# Patch libtool also to circumvent some issues when using MinGW (Msys+GCC). -# 1. Relax check which libraries can be used when linking a DLL. -# libtool's func_mode_link() would reject linking MinGW system libraries, -# e.g., -lmingw32, when building a DLL, because it does not find this -# library in the installation path, and then falls back to build only -# static libraries. Setting deplibs_check_method=pass_all will avoid -# this faulty check. - case "$am_cv_ar_interface" in lib ) ac_config_commands="$ac_config_commands libtoolclpatch" @@ -21364,20 +22295,24 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ;; esac - # Set up LT_LDFLAGS, user can initialize and we augment below - # Use the libtool library info, if defined, otherwise use the project version info, - # if a full major.minor.release number was available - LT_LDFLAGS="$LT_LDFLAGS -version-number 3:13:2" - { $as_echo "$as_me:${as_lineno-$LINENO}: libtool version info: -version-number 3:13:2" >&5 -$as_echo "$as_me: libtool version info: -version-number 3:13:2" >&6;} + LT_LDFLAGS="$LT_LDFLAGS -version-number 3:14:13" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: libtool version info: -version-number 3:14:13" >&5 +printf "%s\n" "$as_me: libtool version info: -version-number 3:14:13" >&6;} - # shared libraries should have no undefined symbols - # for Windows DLLs, it is mandatory to add this LT_LDFLAGS="$LT_LDFLAGS -no-undefined" + if test "$enable_shared" = no; then + COIN_STATIC_BUILD_TRUE= + COIN_STATIC_BUILD_FALSE='#' +else + COIN_STATIC_BUILD_TRUE='#' + COIN_STATIC_BUILD_FALSE= +fi + + # set RPATH_FLAGS to the compiler link flags required to hardcode location # of the shared objects (expanded_libdir is set somewhere in configure before) @@ -21411,8 +22346,8 @@ if test $enable_shared = yes; then esac if test "$RPATH_FLAGS" = ""; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&5 -$as_echo "$as_me: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&5 +printf "%s\n" "$as_me: WARNING: Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries. The test examples might not work if you link against shared objects. You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually." >&2;} fi if test "$RPATH_FLAGS" = "nothing"; then RPATH_FLAGS= @@ -21427,7 +22362,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 $LDFLAGS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu @@ -21440,7 +22375,6 @@ if test -z "$CXXLIBS"; then *) # clang uses libc++ as the default standard C++ library, not libstdc++ # this test is supposed to recognize whether the compiler is clang - # cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -21453,7 +22387,7 @@ if test -z "$CXXLIBS"; then #endif int -main () +main (void) { #ifndef _LIBCPP_VERSION @@ -21464,12 +22398,13 @@ main () return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : CXXLIBS="-lc++" -else +else $as_nop CXXLIBS="-lstdc++ -lm" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac else case $build in @@ -21498,11 +22433,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; fi fi if test -z "$CXXLIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C)." >&5 -$as_echo "$as_me: WARNING: Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C)." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C)." >&5 +printf "%s\n" "$as_me: WARNING: Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C)." >&2;} else - { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming that CXXLIBS is \"$CXXLIBS\"." >&5 -$as_echo "$as_me: Assuming that CXXLIBS is \"$CXXLIBS\"." >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Assuming that CXXLIBS is $CXXLIBS." >&5 +printf "%s\n" "$as_me: Assuming that CXXLIBS is $CXXLIBS." >&6;} fi if test x"$CXXLIBS" = xnothing; then CXXLIBS= @@ -21510,26 +22445,25 @@ 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Doxygen + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: configuring doxygen documentation options" >&5 +printf "%s\n" "$as_me: configuring doxygen documentation options" >&6;} -{ $as_echo "$as_me:${as_lineno-$LINENO}: configuring doxygen documentation options" >&5 -$as_echo "$as_me: configuring doxygen documentation options" >&6;} - -# Check to see if doxygen is available. - -# Extract the first word of "doxygen", so it can be a program name with args. + # Check to see if Doxygen and LaTeX are available. + # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_coin_have_doxygen+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_coin_have_doxygen+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$coin_have_doxygen"; then ac_cv_prog_coin_have_doxygen="$coin_have_doxygen" # Let the user override the test. else @@ -21537,11 +22471,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_doxygen="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -21553,21 +22491,22 @@ fi fi coin_have_doxygen=$ac_cv_prog_coin_have_doxygen if test -n "$coin_have_doxygen"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $coin_have_doxygen" >&5 -$as_echo "$coin_have_doxygen" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_have_doxygen" >&5 +printf "%s\n" "$coin_have_doxygen" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -# Extract the first word of "latex", so it can be a program name with args. + # Extract the first word of "latex", so it can be a program name with args. set dummy latex; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_coin_have_latex+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_coin_have_latex+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$coin_have_latex"; then ac_cv_prog_coin_have_latex="$coin_have_latex" # Let the user override the test. else @@ -21575,11 +22514,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_coin_have_latex="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -21591,40 +22534,41 @@ fi fi coin_have_latex=$ac_cv_prog_coin_have_latex if test -n "$coin_have_latex"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $coin_have_latex" >&5 -$as_echo "$coin_have_latex" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_have_latex" >&5 +printf "%s\n" "$coin_have_latex" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -# Look for the dot tool from the graphviz package, unless the user has -# disabled it. - # Check whether --with-dot was given. -if test "${with_dot+set}" = set; then : +if test ${with_dot+y} +then : withval=$with_dot; -else +else $as_nop withval=yes fi -if test x"$withval" = xno ; then - coin_doxy_usedot=NO - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dot " >&5 -$as_echo_n "checking for dot ... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 -$as_echo "disabled" >&6; } -else - # Extract the first word of "dot", so it can be a program name with args. + + # Look for the dot tool from the graphviz package, unless the user has disabled it. + if test x"$withval" = xno ; then + coin_doxy_usedot=NO + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dot " >&5 +printf %s "checking for dot ... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +printf "%s\n" "disabled" >&6; } + else + # Extract the first word of "dot", so it can be a program name with args. set dummy dot; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_coin_doxy_usedot+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_coin_doxy_usedot+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$coin_doxy_usedot"; then ac_cv_prog_coin_doxy_usedot="$coin_doxy_usedot" # Let the user override the test. else @@ -21632,11 +22576,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_coin_doxy_usedot="YES" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -21648,24 +22596,23 @@ fi fi coin_doxy_usedot=$ac_cv_prog_coin_doxy_usedot if test -n "$coin_doxy_usedot"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $coin_doxy_usedot" >&5 -$as_echo "$coin_doxy_usedot" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_doxy_usedot" >&5 +printf "%s\n" "$coin_doxy_usedot" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -fi + fi -# Generate a tag file name and a log file name. + # Generate a tag file name and a log file name. + coin_doxy_tagname=ipopt_doxy.tag -lc_pkg=`echo ${PACKAGE_NAME} | tr [A-Z] [a-z]` -coin_doxy_tagname=${lc_pkg}_doxy.tag + coin_doxy_logname=ipopt_doxy.log -coin_doxy_logname=${lc_pkg}_doxy.log - if test $coin_have_doxygen = yes; then + if test $coin_have_doxygen = yes; then COIN_HAS_DOXYGEN_TRUE= COIN_HAS_DOXYGEN_FALSE='#' else @@ -21673,7 +22620,7 @@ else COIN_HAS_DOXYGEN_FALSE= fi - if test $coin_have_latex = yes; then + if test $coin_have_latex = yes; then COIN_HAS_LATEX_TRUE= COIN_HAS_LATEX_FALSE='#' else @@ -21682,20 +22629,7 @@ else fi -# Process the list of project names and massage each one into the name of -# a tag file. The value of coin_doxy_tagfiles is substituted for TAGFILES -# in doxygen.conf.in. Further substitution for @baredocdir_nosub@ will happen -# as an edit during make install. See comments in Makemain.inc. - -coin_doxy_tagfiles= -tmp="" -for proj in $tmp ; do - lc_proj=`echo $proj | tr [A-Z] [a-z]` - doxytag=${lc_proj}_doxy.tag - doxydir="@baredocdir_nosub@/coin-or-${lc_proj}/doxydoc" - coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html" -done - + coin_doxy_tagfiles="" @@ -21703,34 +22637,102 @@ done # Check whether --with-ipopt-verbosity was given. -if test "${with_ipopt_verbosity+set}" = set; then : +if test ${with_ipopt_verbosity+y} +then : withval=$with_ipopt_verbosity; if test "$withval" = yes; then withval=1 ; fi coin_verbosity=$withval -else +else $as_nop coin_verbosity=0 fi -cat >>confdefs.h <<_ACEOF -#define IPOPT_VERBOSITY $coin_verbosity -_ACEOF +printf "%s\n" "#define IPOPT_VERBOSITY $coin_verbosity" >>confdefs.h + + + +# Check whether --with-ipopt-checklevel was given. +if test ${with_ipopt_checklevel+y} +then : + withval=$with_ipopt_checklevel; if test "$withval" = yes; then withval=1 ; fi + coin_checklevel=$withval +else $as_nop + coin_checklevel=0 +fi + + +printf "%s\n" "#define IPOPT_CHECKLEVEL $coin_checklevel" >>confdefs.h + + + +######################################################################## +# Floating-point Precision and Integer size # +######################################################################## + + +# Check whether --with-precision was given. +if test ${with_precision+y} +then : + withval=$with_precision; precision=$withval +else $as_nop + precision=double +fi + +case "$precision" in + single ) +printf "%s\n" "#define IPOPT_SINGLE 1" >>confdefs.h + ;; + double ) ;; + *) as_fn_error $? "unsupported value $precision for option --with-precision" "$LINENO" 5 +esac + if test "$precision" = single; then + IPOPT_SINGLE_TRUE= + IPOPT_SINGLE_FALSE='#' +else + IPOPT_SINGLE_TRUE='#' + IPOPT_SINGLE_FALSE= +fi + +# check which integer size to build +# Check whether --with-intsize was given. +if test ${with_intsize+y} +then : + withval=$with_intsize; intsize=$withval +else $as_nop + intsize=32 +fi -# Check whether --with-ipopt-checklevel was given. -if test "${with_ipopt_checklevel+set}" = set; then : - withval=$with_ipopt_checklevel; if test "$withval" = yes; then withval=1 ; fi - coin_checklevel=$withval +case "$intsize" in + 32 ) ;; + 64 ) +printf "%s\n" "#define IPOPT_INT64 1" >>confdefs.h + ;; + *) as_fn_error $? "unsupported value $intsize for option --with-intsize" "$LINENO" 5 ;; +esac + if test "$intsize" = 64; then + IPOPT_INT64_TRUE= + IPOPT_INT64_FALSE='#' else - coin_checklevel=0 + IPOPT_INT64_TRUE='#' + IPOPT_INT64_FALSE= fi -cat >>confdefs.h <<_ACEOF -#define IPOPT_CHECKLEVEL $coin_checklevel -_ACEOF - - +# Specify 8-byte integers if intsize=64 (TODO This should become a macro in BuildTools that figures out the right flag to use) +if test $intsize = 64 ; then + case "$F77" in + *gfortran*) FFLAGS="$FFLAGS -fdefault-integer-8" ;; + *ifort*) + case $build in + *-cygwin* | *-mingw* | *-msys* ) FFLAGS="$FFLAGS -integer-size:64" ;; + *) FFLAGS="$FFLAGS -integer-size 64" ;; + esac + ;; + "" ) ;; # no Fortran compiler, then don't do anything + *) as_fn_error $? "Do not know how to select 8-byte integers for Fortran compiler $FC" "$LINENO" 5 ;; + esac +fi ############################################################################# # Dependencies # @@ -21743,11 +22745,12 @@ _ACEOF coin_save_LIBS="$LIBS" LIBS= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing cos" >&5 -$as_echo_n "checking for library containing cos... " >&6; } -if ${ac_cv_search_cos+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing cos" >&5 +printf %s "checking for library containing cos... " >&6; } +if test ${ac_cv_search_cos+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21755,9 +22758,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char cos (); #ifdef F77_DUMMY_MAIN @@ -21768,41 +22768,46 @@ char cos (); #endif int -main () +main (void) { return cos (); ; return 0; } _ACEOF -for ac_lib in '' m; do +for ac_lib in '' m +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_cos=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_cos+:} false; then : + if test ${ac_cv_search_cos+y} +then : break fi done -if ${ac_cv_search_cos+:} false; then : +if test ${ac_cv_search_cos+y} +then : -else +else $as_nop ac_cv_search_cos=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_cos" >&5 -$as_echo "$ac_cv_search_cos" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_cos" >&5 +printf "%s\n" "$ac_cv_search_cos" >&6; } ac_res=$ac_cv_search_cos -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" if test "$ac_cv_search_cos" != 'none required' ; then IPOPTLIB_LFLAGS="$ac_cv_search_cos $IPOPTLIB_LFLAGS" @@ -21813,16 +22818,8 @@ fi LIBS="$coin_save_LIBS" -#AC_COIN_CHK_BLAS(IpoptLib) -#if test $coin_has_blas != yes; then -# AC_MSG_ERROR([Required package BLAS not found.]) -#fi - - -# pkgconf is the up-and-coming thing, replacing pkg-config, so prefer it. -# The next stanza is a modified version of PKG_PROG_PKG_CONFIG from pkg.m4. if test -z "$PKG_CONFIG" ; then if test -n "$ac_tool_prefix"; then @@ -21830,11 +22827,12 @@ fi do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$PKG_CONFIG"; then ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. else @@ -21842,11 +22840,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_PKG_CONFIG="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -21857,11 +22859,11 @@ fi fi PKG_CONFIG=$ac_cv_prog_PKG_CONFIG if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -21874,11 +22876,12 @@ if test -z "$PKG_CONFIG"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_PKG_CONFIG"; then ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test. else @@ -21886,11 +22889,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_PKG_CONFIG="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -21901,11 +22908,11 @@ fi fi ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG if test -n "$ac_ct_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_PKG_CONFIG" >&5 -$as_echo "$ac_ct_PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_PKG_CONFIG" >&5 +printf "%s\n" "$ac_ct_PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -21917,8 +22924,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_ct_PKG_CONFIG @@ -21928,22 +22935,19 @@ fi fi if test -n "$PKG_CONFIG" ; then pkg_min_version=0.16.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking $PKG_CONFIG is at least version $pkg_min_version" >&5 -$as_echo_n "checking $PKG_CONFIG is at least version $pkg_min_version... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking $PKG_CONFIG is at least version $pkg_min_version" >&5 +printf %s "checking $PKG_CONFIG is at least version $pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $pkg_min_version ; then pkg_version=`$PKG_CONFIG --version` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: $pkg_version" >&5 -$as_echo "yes: $pkg_version" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: $pkg_version" >&5 +printf "%s\n" "yes: $pkg_version" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } PKG_CONFIG="" fi fi -# Check if PKG_CONFIG supports the short-errors flag. The next stanza is a -# modified version of _PKG_SHORT_ERRORS_SUPPORTED from pkg.m4. - if test -n "$PKG_CONFIG" && $PKG_CONFIG --atleast-pkgconfig-version 0.20 ; then pkg_short_errors=" --short-errors " @@ -21951,7 +22955,10 @@ $as_echo "no" >&6; } pkg_short_errors="" fi -# Create a makefile variable and conditional. + pkg_static= + if test -n "$PKG_CONFIG" ; then + case "$LDFLAGS" in "-static" | "* -static*" ) pkg_static=--static ;; esac + fi if test -n "$PKG_CONFIG"; then COIN_HAS_PKGCONFIG_TRUE= @@ -21963,44 +22970,38 @@ fi -# Assemble a PKG_CONFIG search path that will include the installation -# directory for .pc files for COIN packages. Coin .pc files are installed in -# ${libdir}/pkgconfig and COIN_INITIALIZE takes care of setting up -# $expanded_libdir based on $libdir. Of course, -# this whole house of cards balances on the shaky assumption that the user is -# sane and has installed all packages in the same place and does not change -# that place when make executes. If not, well, it's their responsibility to -# augment PKG_CONFIG_PATH in the environment. - COIN_PKG_CONFIG_PATH="${PKG_CONFIG_PATH}" COIN_PKG_CONFIG_PATH="${expanded_libdir}/pkgconfig:${COIN_PKG_CONFIG_PATH}" - { $as_echo "$as_me:${as_lineno-$LINENO}: $PKG_CONFIG path is \"$COIN_PKG_CONFIG_PATH\"" >&5 -$as_echo "$as_me: $PKG_CONFIG path is \"$COIN_PKG_CONFIG_PATH\"" >&6;} - + if test -n "$PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $PKG_CONFIG path is \"$COIN_PKG_CONFIG_PATH\"" >&5 +printf "%s\n" "$as_me: $PKG_CONFIG path is \"$COIN_PKG_CONFIG_PATH\"" >&6;} + fi -# Make sure the necessary variables exist for each client package. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LAPACK" >&5 +printf %s "checking for LAPACK... " >&6; } -# Set up command line arguments with DEF_PRIM_ARGS. # Check whether --with-lapack was given. -if test "${with_lapack+set}" = set; then : +if test ${with_lapack+y} +then : withval=$with_lapack; fi # Check whether --with-lapack-lflags was given. -if test "${with_lapack_lflags+set}" = set; then : +if test ${with_lapack_lflags+y} +then : withval=$with_lapack_lflags; fi @@ -22010,192 +23011,24 @@ fi -# Give FIND_PRIM_PKG a chance to look for user-specified lapack flags, -# but skip any checks via a .pc file. The result (coin_has_lapack) will -# be one of yes (the user specified something), no (user specified nothing), -# or skipping (user said do not use). We'll also have variables -# lapack_lflags, lapack_cflags, lapack_data, and lapack_pcfiles. - - - - dflt_action=yes - -# Initialize variables for the primary package. - - coin_has_lapack=noInfo - lapack_lflags= - lapack_cflags= - lapack_data= - lapack_pcfiles= - -# --with-prim is always present. If the client specified dataonly, its value -# is assigned to prim_data. - - withval="$with_lapack" - if test -n "$withval" ; then - case "$withval" in - no ) - coin_has_lapack=skipping - ;; - yes ) - coin_has_lapack=requested - ;; - build ) - coin_has_lapack=build - ;; - * ) - coin_has_lapack=yes - lapack_lflags="$withval" - ;; - esac - fi - -# --with-prim-libs and --with-prim-cflags are present unless the client -# specified dataonly. Specifying --with-prim=no overrides the individual -# options for libs and cflags. - - if test "$coin_has_lapack" != skipping ; then - withval="$with_lapack_lflags" - if test -n "$withval" ; then - case "$withval" in - build | no | yes ) - as_fn_error $? "\"$withval\" is not valid here; please specify linker flags appropriate for your environment." "$LINENO" 5 - ;; - * ) - coin_has_lapack=yes - lapack_lflags="$withval" - ;; - esac - fi - - withval="$with_lapack_cflags" - if test -n "$withval" ; then - case "$withval" in - build | no | yes ) - as_fn_error $? "\"$withval\" is not valid here; please specify compiler flags appropriate for your environment." "$LINENO" 5 - ;; - * ) - coin_has_lapack=yes - lapack_cflags="$withval" - ;; - esac - fi - fi - -# --with-prim-data will be present unless the client specified nodata. -# Specifying --with-prim=no overrides the individual option for data. - - - -# At this point, coin_has_prim can be one of noInfo (no user options -# specified), skipping (user said no), requested or build (user said yes -# or build and gave no further guidance), or yes (user specified one or -# more --with-prim options). If we're already at yes or skipping, we're -# done looking. - -# If there are no user options (noInfo) and the default is no, we're skipping. -# Otherwise, the default must be yes or build; consider the package requested. -# A default action we don't recognise defaults to yes. - - if test "$coin_has_lapack" = noInfo ; then - case $dflt_action in - no ) - coin_has_lapack=skipping - ;; - build ) - coin_has_lapack=build - ;; - * ) - coin_has_lapack=requested - ;; - esac - fi - -# Now coin_has_prim can be one of skipping, yes, requested, or build. For -# requested or build, try pkgconf, if it's available. If it's not available, -# well, hope that the user knows their system and prim can be used with no -# additional flags. - - case $coin_has_lapack in - requested | build ) - if test -n "$PKG_CONFIG" -a "skip" != skip ; then - pcfile="skip" - - + coin_has_lapack=no + lapack_keep_looking=yes - if test -n "$PKG_CONFIG" ; then - if PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --exists "$pcfile" ; then - LAPACK_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "$pcfile" 2>/dev/null | tr '\n' ' '` - coin_has_lapack=yes - lapack_data=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --variable=datadir "$pcfile" 2>/dev/null` - lapack_pcfiles="$pcfile" - else - LAPACK_PKG_ERRORS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$pcfile"` - coin_has_lapack=no + if test "$with_lapack" != "no" ; then + if test "$with_lapack" != "yes" && test -z "$with_lapack_lflags" ; then + with_lapack_lflags="$with_lapack" fi - else - as_fn_error $? "\"Cannot check for existence of module lapack without pkgconf\"" "$LINENO" 5 - fi - - else - coin_has_lapack=no - # AC_MSG_WARN([skipped check via pkgconf as no pkgconf available]) - fi - ;; - skipping | yes ) - ;; - * ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unexpected status \"$coin_has_lapack\" in COIN_FIND_PRIM_PKG" >&5 -$as_echo "$as_me: WARNING: Unexpected status \"$coin_has_lapack\" in COIN_FIND_PRIM_PKG" >&2;} - ;; - esac - -# The final value of coin_has_prim will be yes, no, or skipping. No means -# we looked (with pkgconfig) and didn't find anything. Skipping means the -# user said `don't use.' Yes means we have something, from the user or -# from pkgconfig. Note that we haven't run a useability test! - -# Define BUILDTOOLS_DEBUG to enable debugging output + if test -n "$with_lapack_lflags" ; then - if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: FIND_PRIM_PKG result for lapack: \"$coin_has_lapack\"" >&5 -$as_echo "$as_me: FIND_PRIM_PKG result for lapack: \"$coin_has_lapack\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Collected values for package 'lapack'" >&5 -$as_echo "$as_me: Collected values for package 'lapack'" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: lapack_lflags is \"$lapack_lflags\"" >&5 -$as_echo "$as_me: lapack_lflags is \"$lapack_lflags\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: lapack_cflags is \"$lapack_cflags\"" >&5 -$as_echo "$as_me: lapack_cflags is \"$lapack_cflags\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: lapack_data is \"$lapack_data\"" >&5 -$as_echo "$as_me: lapack_data is \"$lapack_data\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: lapack_pcfiles is \"$lapack_pcfiles\"" >&5 -$as_echo "$as_me: lapack_pcfiles is \"$lapack_pcfiles\"" >&6;} - fi - - - -# If FIND_PRIM_PKG found something, then we'll do a link check to figure -# out whether it is working and what the name mangling scheme is. -# This sets dsyev_namemangling - if test "$coin_has_lapack" = yes ; then - - # setup LIBS by adding $lapack_lflags and those from $lapack_pcfiles ac_save_LIBS="$LIBS" - LIBS="$lapack_lflags $LIBS" - if test -n "$lapack_pcfiles" ; then + LIBS="$with_lapack_lflags $LIBS" - temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $lapack_pcfiles` - LIBS="$temp_LFLAGS $LIBS" - fi dsyev_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") ac_name=dsyev @@ -22204,17 +23037,20 @@ $as_echo "$as_me: lapack_pcfiles is \"$lapack_pcfiles\"" >&6;} ac_name=DSYEV ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then + ac_name=${ac_name}_ + fi + if test "$ac_extra" = "extra underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -22224,23 +23060,23 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : dsyev_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + if test $ac_success = yes ; then break 3 fi @@ -22250,31 +23086,37 @@ $as_echo "$ac_success" >&6; } LIBS=$ac_save_LIBS if test $ac_success = yes ; then - : - else as_fn_error $? "Could not find dsyev in Lapack" "$LINENO" 5 + coin_has_lapack=yes + lapack_what="user-specified ($with_lapack_lflags)" + lapack_keep_looking=no + lapack_lflags=$with_lapack_lflags + else as_fn_error $? "Cannot link to user-specified Lapack $with_lapack_lflags." "$LINENO" 5 fi + fi + else + lapack_keep_looking=no + lapack_what="user-specified" fi -# If FIND_PRIM_PKG didn't find anything, try a few more guesses for -# optimized blas/lapack libs (based on build system type). - if test "$coin_has_lapack" = no ; then + + if test "$lapack_keep_looking" = yes ; then case $build in *-linux*) + case " int$intsize " in + *\ int64\ * ) coin_mkl="-lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lm" ;; + *) coin_mkl="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm" ;; + esac - # setup LIBS by adding -lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lm and those from ac_save_LIBS="$LIBS" - LIBS="-lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lm $LIBS" + LIBS="$coin_mkl $LIBS" dsyev_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") ac_name=dsyev @@ -22283,94 +23125,20 @@ $as_echo "$ac_success" >&6; } ac_name=DSYEV ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); -#ifdef F77_DUMMY_MAIN - -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } - -#endif -int -main () -{ -$ac_name() - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - dsyev_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" - ac_success=yes -else - ac_success=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } - if test $ac_success = yes ; then - break 3 - fi - done - done - done - LIBS=$ac_save_LIBS - - if test $ac_success = yes ; then - - coin_has_lapack=yes - lapack_lflags="-lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lm" - - fi - - ;; - - *-sgi-*) - - # setup LIBS by adding -lcomplib.sgimath and those from - ac_save_LIBS="$LIBS" - LIBS="-lcomplib.sgimath $LIBS" - - - dsyev_namemangling=unknown - - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do - for ac_case in "lower case" "upper case" ; do - for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) - case $ac_case in - "lower case") - ac_name=dsyev - ;; - "upper case") - ac_name=DSYEV - ;; - esac - if test "$ac_trail" = underscore ; then + if test "$ac_extra" = "extra underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -22380,23 +23148,23 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : dsyev_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + if test $ac_success = yes ; then break 3 fi @@ -22406,36 +23174,28 @@ $as_echo "$ac_success" >&6; } LIBS=$ac_save_LIBS if test $ac_success = yes ; then + coin_has_lapack=yes + lapack_lflags="$coin_mkl" + lapack_what="Intel MKL ($lapack_lflags)" - coin_has_lapack=yes - lapack_lflags=-lcomplib.sgimath fi ;; *-*-solaris*) - # Ideally, we'd use -library=sunperf, but it's an imperfect world. - # Studio cc doesn't recognise -library, it wants -xlic_lib. Studio 12 - # CC doesn't recognise -xlic_lib. Libtool doesn't like -xlic_lib - # anyway. Sun claims that CC and cc will understand -library in Studio - # 13. The main extra function of -xlic_lib and -library is to arrange - # for the Fortran run-time libraries to be linked for C++ and C. We - # can arrange that explicitly. - - # setup LIBS by adding -lsunperf and those from + case " int$intsize " in + *\ int64\ * ) ;; + *) ac_save_LIBS="$LIBS" LIBS="-lsunperf $LIBS" dsyev_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") ac_name=dsyev @@ -22444,17 +23204,20 @@ $as_echo "$ac_success" >&6; } ac_name=DSYEV ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then + ac_name=${ac_name}_ + fi + if test "$ac_extra" = "extra underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -22464,23 +23227,23 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : dsyev_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + if test $ac_success = yes ; then break 3 fi @@ -22490,49 +23253,55 @@ $as_echo "$ac_success" >&6; } LIBS=$ac_save_LIBS if test $ac_success = yes ; then + coin_has_lapack=yes + lapack_lflags=-lsunperf + lapack_what="Sun Performance Library ($lapack_lflags)" - coin_has_lapack=yes - lapack_lflags=-lsunperf fi - + ;; + esac ;; *-cygwin* | *-mingw* | *-msys*) - # check for 64-bit sequential MKL in $LIB old_IFS="$IFS" IFS=";" + coin_mkl="" for d in $LIB ; do - # turn $d into unix-style short path (no spaces); cannot do -us, so first do -ws, then -u + # turn $d into unix-style short path (no spaces); cannot do -us, + # so first do -ws, then -u d=`cygpath -ws "$d"` d=`cygpath -u "$d"` if test "$enable_shared" = yes ; then if test -e "$d/mkl_core_dll.lib" ; then - coin_mkl="$d/mkl_intel_lp64_dll.lib $d/mkl_sequential_dll.lib $d/mkl_core_dll.lib" + case " int$intsize " in + *\ int64\ * ) coin_mkl="$d/mkl_intel_ilp64_dll.lib $d/mkl_sequential_dll.lib $d/mkl_core_dll.lib" ;; + *) coin_mkl="$d/mkl_intel_lp64_dll.lib $d/mkl_sequential_dll.lib $d/mkl_core_dll.lib" ;; + esac break fi else if test -e "$d/mkl_core.lib" ; then - coin_mkl="$d/mkl_intel_lp64.lib $d/mkl_sequential.lib $d/mkl_core.lib" + case " int$intsize " in + *\ int64\ * ) coin_mkl="$d/mkl_intel_ilp64.lib $d/mkl_sequential.lib $d/mkl_core.lib" ;; + *) coin_mkl="$d/mkl_intel_lp64.lib $d/mkl_sequential.lib $d/mkl_core.lib" ;; + esac break fi fi done IFS="$old_IFS" + if test -n "$coin_mkl" ; then - # setup LIBS by adding $coin_mkl and those from ac_save_LIBS="$LIBS" LIBS="$coin_mkl $LIBS" dsyev_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") ac_name=dsyev @@ -22541,17 +23310,20 @@ $as_echo "$ac_success" >&6; } ac_name=DSYEV ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + if test "$ac_extra" = "extra underscore" ; then + ac_name=${ac_name}_ + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -22561,23 +23333,23 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : dsyev_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + if test $ac_success = yes ; then break 3 fi @@ -22588,27 +23360,30 @@ $as_echo "$ac_success" >&6; } if test $ac_success = yes ; then coin_has_lapack=yes - lapack_lflags="$coin_mkl" + lapack_lflags="$coin_mkl" + lapack_what="Intel MKL ($lapack_lflags)" + fi + fi ;; *-darwin*) + case " int$intsize " in + *\ int64\ * ) coin_mkl="-lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lm" ;; + *) coin_mkl="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm" ;; + esac - # setup LIBS by adding -lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lm and those from ac_save_LIBS="$LIBS" - LIBS="-lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lm $LIBS" + LIBS="$coin_mkl $LIBS" dsyev_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") ac_name=dsyev @@ -22617,17 +23392,20 @@ $as_echo "$ac_success" >&6; } ac_name=DSYEV ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then + ac_name=${ac_name}_ + fi + if test "$ac_extra" = "extra underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -22637,23 +23415,23 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : dsyev_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + if test $ac_success = yes ; then break 3 fi @@ -22663,27 +23441,26 @@ $as_echo "$ac_success" >&6; } LIBS=$ac_save_LIBS if test $ac_success = yes ; then + coin_has_lapack=yes + lapack_lflags="$coin_mkl" + lapack_what="Intel MKL ($lapack_lflags)" - coin_has_lapack=yes - lapack_lflags="-lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lm" fi if test "$coin_has_lapack" = no ; then - - # setup LIBS by adding -framework Accelerate and those from + case " int$intsize " in + *\ int64\ * ) ;; + *) ac_save_LIBS="$LIBS" LIBS="-framework Accelerate $LIBS" dsyev_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") ac_name=dsyev @@ -22692,17 +23469,20 @@ $as_echo "$ac_success" >&6; } ac_name=DSYEV ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then + ac_name=${ac_name}_ + fi + if test "$ac_extra" = "extra underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -22712,23 +23492,23 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : dsyev_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + if test $ac_success = yes ; then break 3 fi @@ -22738,49 +23518,48 @@ $as_echo "$ac_success" >&6; } LIBS=$ac_save_LIBS if test $ac_success = yes ; then + coin_has_lapack=yes + lapack_lflags="-framework Accelerate" + lapack_what="Accelerate framework ($lapack_lflags)" - coin_has_lapack=yes - lapack_lflags="-framework Accelerate" fi + ;; + esac fi ;; esac + if test "$coin_has_lapack" = yes ; then + lapack_keep_looking=no + fi fi -# If none of the above worked, check whether lapack.pc blas.pc exists and links -# We check for both to ensure that blas lib also appears on link line in case -# someone wants to use Blas functions but tests only for Lapack. - if test "$coin_has_lapack" = no ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lapack.pc and blas.pc" >&5 -$as_echo_n "checking for lapack.pc and blas.pc... " >&6; } - + if test "$lapack_keep_looking" = yes ; then + case " int$intsize " in + *\ int64\ * ) ;; + *) if test -n "$PKG_CONFIG" ; then if PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --exists "lapack blas" ; then LAPACK_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "lapack blas" 2>/dev/null | tr '\n' ' '` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + lapack_what="generic module (lapack.pc blas.pc)" - # setup LIBS by adding and those from lapack ac_save_LIBS="$LIBS" - if test -n "lapack" ; then - temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs lapack` + if test -n "lapack" ; then + temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $pkg_static lapack` LIBS="$temp_LFLAGS $LIBS" fi + dsyev_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") ac_name=dsyev @@ -22789,17 +23568,20 @@ $as_echo "yes" >&6; } ac_name=DSYEV ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + if test "$ac_extra" = "extra underscore" ; then + ac_name=${ac_name}_ + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -22809,23 +23591,23 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : dsyev_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + if test $ac_success = yes ; then break 3 fi @@ -22836,42 +23618,40 @@ $as_echo "$ac_success" >&6; } if test $ac_success = yes ; then coin_has_lapack=yes - lapack_pcfiles="lapack blas" - else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: lapack.pc and blas.pc present, but could not find dsyev when trying to link with it." >&5 -$as_echo "$as_me: WARNING: lapack.pc and blas.pc present, but could not find dsyev when trying to link with it." >&2;} + lapack_keep_looking=no + lapack_pcfiles="lapack blas" + else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: lapack.pc and blas.pc present, but could not find dsyev when trying to link with LAPACK." >&5 +printf "%s\n" "$as_me: WARNING: lapack.pc and blas.pc present, but could not find dsyev when trying to link with LAPACK." >&2;} fi + else LAPACK_PKG_ERRORS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "lapack blas"` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + fi else as_fn_error $? "\"Cannot check for existence of module lapack without pkgconf\"" "$LINENO" 5 fi + ;; + esac fi -# TODO do we need another check with lapack.pc only? - -# If none of the above worked, try the generic -llapack -lblas as last resort. -# We check for both to ensure that blas lib also appears on link line in case -# someone wants to use Blas functions but tests only for Lapack. - if test "$coin_has_lapack" = no ; then + if test "$lapack_keep_looking" = yes ; then + case " int$intsize " in + *\ int64\ * ) coin_lapack="-llapack64 -lblas64" ;; + *) coin_lapack="-llapack -lblas" ;; + esac - # setup LIBS by adding -llapack -lblas and those from ac_save_LIBS="$LIBS" - LIBS="-llapack -lblas $LIBS" + LIBS="$coin_lapack $LIBS" dsyev_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") ac_name=dsyev @@ -22880,17 +23660,20 @@ $as_echo "no" >&6; } ac_name=DSYEV ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then + ac_name=${ac_name}_ + fi + if test "$ac_extra" = "extra underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -22900,23 +23683,23 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : dsyev_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + if test $ac_success = yes ; then break 3 fi @@ -22926,17 +23709,34 @@ $as_echo "$ac_success" >&6; } LIBS=$ac_save_LIBS if test $ac_success = yes ; then - - coin_has_lapack=yes - lapack_lflags="-llapack -lblas" + coin_has_lapack=yes + lapack_lflags="$coin_lapack" + lapack_what="generic library ($lapack_lflags)" fi fi -# TODO do we need another check with -llapack only? + case "$coin_has_lapack" in + yes) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_lapack: $lapack_what" >&5 +printf "%s\n" "$coin_has_lapack: $lapack_what" >&6; } + ;; + no) + if test -n "$lapack_what" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_lapack ($lapack_what)" >&5 +printf "%s\n" "$coin_has_lapack ($lapack_what)" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_lapack" >&5 +printf "%s\n" "$coin_has_lapack" >&6; } + fi + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: CHK_LAPACK: unexpected result '$coin_has_lapack'" >&5 +printf "%s\n" "$as_me: WARNING: CHK_LAPACK: unexpected result '$coin_has_lapack'" >&2;} + ;; + esac -# Time to set some variables. Create an automake conditional COIN_HAS_LAPACK. if test $coin_has_lapack = yes; then COIN_HAS_LAPACK_TRUE= COIN_HAS_LAPACK_FALSE='#' @@ -22946,65 +23746,64 @@ else fi -# If we've located the package, define preprocessor symbol COIN_HAS_LAPACK -# and COIN_LAPACK_FUNC[_] and augment the necessary variables for the client packages. if test $coin_has_lapack = yes ; then -$as_echo "#define IPOPT_HAS_LAPACK 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_LAPACK 1" >>confdefs.h case "${dsyev_namemangling}" in "lower case, no underscore, no extra underscore") - $as_echo "#define IPOPT_LAPACK_FUNC(name,NAME) name" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC(name,NAME) name" >>confdefs.h - $as_echo "#define IPOPT_LAPACK_FUNC_(name,NAME) name" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC_(name,NAME) name" >>confdefs.h ;; "lower case, no underscore, extra underscore") - $as_echo "#define IPOPT_LAPACK_FUNC(name,NAME) name" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC(name,NAME) name" >>confdefs.h - $as_echo "#define IPOPT_LAPACK_FUNC_(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC_(name,NAME) name ## _" >>confdefs.h ;; "lower case, underscore, no extra underscore") - $as_echo "#define IPOPT_LAPACK_FUNC(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC(name,NAME) name ## _" >>confdefs.h - $as_echo "#define IPOPT_LAPACK_FUNC_(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC_(name,NAME) name ## _" >>confdefs.h ;; "lower case, underscore, extra underscore") - $as_echo "#define IPOPT_LAPACK_FUNC(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC(name,NAME) name ## _" >>confdefs.h - $as_echo "#define IPOPT_LAPACK_FUNC_(name,NAME) name ## __" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC_(name,NAME) name ## __" >>confdefs.h ;; "upper case, no underscore, no extra underscore") - $as_echo "#define IPOPT_LAPACK_FUNC(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC(name,NAME) NAME" >>confdefs.h - $as_echo "#define IPOPT_LAPACK_FUNC_(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC_(name,NAME) NAME" >>confdefs.h ;; "upper case, no underscore, extra underscore") - $as_echo "#define IPOPT_LAPACK_FUNC(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC(name,NAME) NAME" >>confdefs.h - $as_echo "#define IPOPT_LAPACK_FUNC_(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC_(name,NAME) NAME ## _" >>confdefs.h ;; "upper case, underscore, no extra underscore") - $as_echo "#define IPOPT_LAPACK_FUNC(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define IPOPT_LAPACK_FUNC_(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC_(name,NAME) NAME ## _" >>confdefs.h ;; "upper case, underscore, extra underscore") - $as_echo "#define IPOPT_LAPACK_FUNC(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define IPOPT_LAPACK_FUNC_(name,NAME) NAME ## __" >>confdefs.h + printf "%s\n" "#define IPOPT_LAPACK_FUNC_(name,NAME) NAME ## __" >>confdefs.h ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unsupported or unknown name-mangling scheme: ${dsyev_namemangling}" >&5 -$as_echo "$as_me: WARNING: Unsupported or unknown name-mangling scheme: ${dsyev_namemangling}" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Unsupported or unknown name-mangling scheme: ${dsyev_namemangling}" >&5 +printf "%s\n" "$as_me: WARNING: Unsupported or unknown name-mangling scheme: ${dsyev_namemangling}" >&2;} ;; esac - if test -n "$lapack_pcfiles" ; then IPOPTLIB_PCFILES="$lapack_pcfiles $IPOPTLIB_PCFILES" ; fi + if test -n "$lapack_pcfiles" ; then + IPOPTLIB_PCFILES="$lapack_pcfiles $IPOPTLIB_PCFILES" + fi IPOPTLIB_LFLAGS="$lapack_lflags $IPOPTLIB_LFLAGS" - IPOPTLIB_CFLAGS="$lapack_cflags $IPOPTLIB_CFLAGS" fi @@ -23013,13 +23812,18 @@ if test $coin_has_lapack != yes; then # AC_MSG_WARN([Compiling code without LAPACK. Certain options (e.g., quasi-Newton) will not work.]) fi +# check for ASL only if building for double precision +if test $precision = double ; then + - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for package ASL" >&5 -$as_echo_n "checking for package ASL... " >&6; } -# Make sure the necessary variables exist for each client package. + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for package ASL" >&5 +printf %s "checking for package ASL... " >&6; } + @@ -23029,20 +23833,16 @@ $as_echo_n "checking for package ASL... " >&6; } -# Check to see if the user has set an override to skip this primary. coin_has_asl=noInfo if test x"$COIN_SKIP_PROJECTS" != x ; then - for pkg in $COIN_SKIP_PROJECTS ; do - if test "$pkg" = "$asl" ; then + for pkg in `echo $COIN_SKIP_PROJECTS | tr '[:upper:]' '[:lower:]'` ; do + if test "$pkg" = "asl" ; then coin_has_asl=skipping fi done fi -# If we're not skipping this primary, define and process the command line -# options according to the cmdopts parameter. Then invoke FIND_PRIM_PKG to do -# the heavy lifting. if test "$coin_has_asl" != skipping ; then @@ -23050,21 +23850,24 @@ $as_echo_n "checking for package ASL... " >&6; } # Check whether --with-asl was given. -if test "${with_asl+set}" = set; then : +if test ${with_asl+y} +then : withval=$with_asl; fi # Check whether --with-asl-lflags was given. -if test "${with_asl_lflags+set}" = set; then : +if test ${with_asl_lflags+y} +then : withval=$with_asl_lflags; fi # Check whether --with-asl-cflags was given. -if test "${with_asl_cflags+set}" = set; then : +if test ${with_asl_cflags+y} +then : withval=$with_asl_cflags; fi @@ -23074,52 +23877,64 @@ fi - dflt_action=build -# Initialize variables for the primary package. - coin_has_asl=noInfo + + + + coin_has_asl=requested + asl_lflags= asl_cflags= asl_data= - asl_pcfiles= + asl_pcfiles="coinasl" -# --with-prim is always present. If the client specified dataonly, its value -# is assigned to prim_data. withval="$with_asl" if test -n "$withval" ; then case "$withval" in no ) coin_has_asl=skipping + asl_failmode='command line' ;; yes ) coin_has_asl=requested + asl_failmode='' ;; build ) - coin_has_asl=build + coin_has_asl=requested + asl_build=yes + asl_failmode='' ;; * ) - coin_has_asl=yes + coin_has_asl=requested + asl_failmode='' asl_lflags="$withval" + asl_pcfiles='' ;; esac + else + if test -n "$with_asl_lflags" || + test -n "$with_asl_cflags" || + test -n "$with_asl_data" ; then + coin_has_asl=requested + asl_failmode='' + asl_pcfiles='' + fi fi -# --with-prim-libs and --with-prim-cflags are present unless the client -# specified dataonly. Specifying --with-prim=no overrides the individual -# options for libs and cflags. if test "$coin_has_asl" != skipping ; then withval="$with_asl_lflags" if test -n "$withval" ; then case "$withval" in build | no | yes ) - as_fn_error $? "\"$withval\" is not valid here; please specify linker flags appropriate for your environment." "$LINENO" 5 + as_fn_error $? "\"$withval\" is not useful here; please specify link flags appropriate for your environment." "$LINENO" 5 ;; * ) coin_has_asl=yes asl_lflags="$withval" + asl_pcfiles='' ;; esac fi @@ -23128,54 +23943,43 @@ fi if test -n "$withval" ; then case "$withval" in build | no | yes ) - as_fn_error $? "\"$withval\" is not valid here; please specify compiler flags appropriate for your environment." "$LINENO" 5 + as_fn_error $? "\"$withval\" is not useful here; please specify compile flags appropriate for your environment." "$LINENO" 5 ;; * ) coin_has_asl=yes asl_cflags="$withval" + asl_pcfiles='' ;; esac fi fi -# --with-prim-data will be present unless the client specified nodata. -# Specifying --with-prim=no overrides the individual option for data. -# At this point, coin_has_prim can be one of noInfo (no user options -# specified), skipping (user said no), requested or build (user said yes -# or build and gave no further guidance), or yes (user specified one or -# more --with-prim options). If we're already at yes or skipping, we're -# done looking. -# If there are no user options (noInfo) and the default is no, we're skipping. -# Otherwise, the default must be yes or build; consider the package requested. -# A default action we don't recognise defaults to yes. + if test $coin_has_asl = requested ; then + if test -n "$PKG_CONFIG" ; then + if test x"$asl_build" = xyes ; then + pcfile="coin$asl_pcfiles" - if test "$coin_has_asl" = noInfo ; then - case $dflt_action in - no ) - coin_has_asl=skipping - ;; - build ) - coin_has_asl=build - ;; - * ) - coin_has_asl=requested - ;; - esac - fi -# Now coin_has_prim can be one of skipping, yes, requested, or build. For -# requested or build, try pkgconf, if it's available. If it's not available, -# well, hope that the user knows their system and prim can be used with no -# additional flags. - case $coin_has_asl in - requested | build ) - if test -n "$PKG_CONFIG" -a "coinasl" != skip ; then - pcfile="coinasl" + if test -n "$PKG_CONFIG" ; then + if PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --exists "$pcfile" ; then + ASL_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "$pcfile" 2>/dev/null | tr '\n' ' '` + coin_has_asl=yes + else + ASL_PKG_ERRORS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$pcfile"` + coin_has_asl=no + fi + else + as_fn_error $? "\"Cannot check for existence of module asl without pkgconf\"" "$LINENO" 5 + fi + + fi + if ! test $coin_has_asl = yes ; then + pcfile="$asl_pcfiles" @@ -23183,8 +23987,6 @@ fi if PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --exists "$pcfile" ; then ASL_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "$pcfile" 2>/dev/null | tr '\n' ' '` coin_has_asl=yes - asl_data=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --variable=datadir "$pcfile" 2>/dev/null` - asl_pcfiles="$pcfile" else ASL_PKG_ERRORS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$pcfile"` coin_has_asl=no @@ -23193,56 +23995,47 @@ fi as_fn_error $? "\"Cannot check for existence of module asl without pkgconf\"" "$LINENO" 5 fi - else - coin_has_asl=no - # AC_MSG_WARN([skipped check via pkgconf as no pkgconf available]) fi - ;; - skipping | yes ) - ;; - * ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unexpected status \"$coin_has_asl\" in COIN_FIND_PRIM_PKG" >&5 -$as_echo "$as_me: WARNING: Unexpected status \"$coin_has_asl\" in COIN_FIND_PRIM_PKG" >&2;} - ;; - esac - -# The final value of coin_has_prim will be yes, no, or skipping. No means -# we looked (with pkgconfig) and didn't find anything. Skipping means the -# user said `don't use.' Yes means we have something, from the user or -# from pkgconfig. Note that we haven't run a useability test! + if test $coin_has_asl = yes ; then + asl_data=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --variable=datadir "$pcfile" 2>/dev/null` + asl_pcfiles="$pcfile" + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Check for asl via pkg-config could not be performed as there is no pkg-config available. Consider installing pkg-config or provide appropriate values for --with-asl-lflags and --with-asl-cflags." >&5 +printf "%s\n" "$as_me: WARNING: Check for asl via pkg-config could not be performed as there is no pkg-config available. Consider installing pkg-config or provide appropriate values for --with-asl-lflags and --with-asl-cflags." >&2;} + coin_has_asl=no + fi + fi -# Define BUILDTOOLS_DEBUG to enable debugging output if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: FIND_PRIM_PKG result for asl: \"$coin_has_asl\"" >&5 -$as_echo "$as_me: FIND_PRIM_PKG result for asl: \"$coin_has_asl\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Collected values for package 'asl'" >&5 -$as_echo "$as_me: Collected values for package 'asl'" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: asl_lflags is \"$asl_lflags\"" >&5 -$as_echo "$as_me: asl_lflags is \"$asl_lflags\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: asl_cflags is \"$asl_cflags\"" >&5 -$as_echo "$as_me: asl_cflags is \"$asl_cflags\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: asl_data is \"$asl_data\"" >&5 -$as_echo "$as_me: asl_data is \"$asl_data\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: asl_pcfiles is \"$asl_pcfiles\"" >&5 -$as_echo "$as_me: asl_pcfiles is \"$asl_pcfiles\"" >&6;} - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $coin_has_asl" >&5 -$as_echo "$coin_has_asl" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: FIND_PRIM_PKG result for asl: \"$coin_has_asl\"" >&5 +printf "%s\n" "$as_me: FIND_PRIM_PKG result for asl: \"$coin_has_asl\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Collected values for package 'asl'" >&5 +printf "%s\n" "$as_me: Collected values for package 'asl'" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: asl_lflags is \"$asl_lflags\"" >&5 +printf "%s\n" "$as_me: asl_lflags is \"$asl_lflags\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: asl_cflags is \"$asl_cflags\"" >&5 +printf "%s\n" "$as_me: asl_cflags is \"$asl_cflags\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: asl_data is \"$asl_data\"" >&5 +printf "%s\n" "$as_me: asl_data is \"$asl_data\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: asl_pcfiles is \"$asl_pcfiles\"" >&5 +printf "%s\n" "$as_me: asl_pcfiles is \"$asl_pcfiles\"" >&6;} + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_asl" >&5 +printf "%s\n" "$coin_has_asl" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $coin_has_asl due to COIN_SKIP_PROJECTS" >&5 -$as_echo "$coin_has_asl due to COIN_SKIP_PROJECTS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_asl (COIN_SKIP_PROJECTS)" >&5 +printf "%s\n" "$coin_has_asl (COIN_SKIP_PROJECTS)" >&6; } fi -# Possibilities are `yes', 'no', or `skipping'. Normalise to `yes' or `no'. if test "$coin_has_asl" != yes ; then coin_has_asl=no fi -# Create an automake conditional COIN_HAS_PRIM. if test $coin_has_asl = yes; then COIN_HAS_ASL_TRUE= @@ -23253,26 +24046,32 @@ else fi -# If we've located the package, define preprocessor symbol COIN_HAS_PRIM and -# augment the necessary variables for the client packages. if test $coin_has_asl = yes ; then -$as_echo "#define IPOPT_HAS_ASL 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_ASL 1" >>confdefs.h - if test -n "$asl_pcfiles" ; then IPOPTAMPLINTERFACELIB_PCFILES="$asl_pcfiles $IPOPTAMPLINTERFACELIB_PCFILES" ; fi + IPOPTAMPLINTERFACELIB_PCFILES="$asl_pcfiles $IPOPTAMPLINTERFACELIB_PCFILES" IPOPTAMPLINTERFACELIB_LFLAGS="$asl_lflags $IPOPTAMPLINTERFACELIB_LFLAGS" IPOPTAMPLINTERFACELIB_CFLAGS="$asl_cflags $IPOPTAMPLINTERFACELIB_CFLAGS" - if test -n "$asl_pcfiles" ; then SIPOPTAMPLINTERFACELIB_PCFILES="$asl_pcfiles $SIPOPTAMPLINTERFACELIB_PCFILES" ; fi + SIPOPTAMPLINTERFACELIB_PCFILES="$asl_pcfiles $SIPOPTAMPLINTERFACELIB_PCFILES" SIPOPTAMPLINTERFACELIB_LFLAGS="$asl_lflags $SIPOPTAMPLINTERFACELIB_LFLAGS" SIPOPTAMPLINTERFACELIB_CFLAGS="$asl_cflags $SIPOPTAMPLINTERFACELIB_CFLAGS" -# Finally, set up PRIM_DATA, unless the user specified nodata. - fi +else + if false; then + COIN_HAS_ASL_TRUE= + COIN_HAS_ASL_FALSE='#' +else + COIN_HAS_ASL_TRUE='#' + COIN_HAS_ASL_FALSE= +fi + +fi ######### # MUMPS # @@ -23281,30 +24080,29 @@ $as_echo "#define IPOPT_HAS_ASL 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for package Mumps" >&5 -$as_echo_n "checking for package Mumps... " >&6; } -# Make sure the necessary variables exist for each client package. + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for package Mumps" >&5 +printf %s "checking for package Mumps... " >&6; } + -# Check to see if the user has set an override to skip this primary. coin_has_mumps=noInfo if test x"$COIN_SKIP_PROJECTS" != x ; then - for pkg in $COIN_SKIP_PROJECTS ; do - if test "$pkg" = "$mumps" ; then + for pkg in `echo $COIN_SKIP_PROJECTS | tr '[:upper:]' '[:lower:]'` ; do + if test "$pkg" = "mumps" ; then coin_has_mumps=skipping fi done fi -# If we're not skipping this primary, define and process the command line -# options according to the cmdopts parameter. Then invoke FIND_PRIM_PKG to do -# the heavy lifting. if test "$coin_has_mumps" != skipping ; then @@ -23312,21 +24110,24 @@ $as_echo_n "checking for package Mumps... " >&6; } # Check whether --with-mumps was given. -if test "${with_mumps+set}" = set; then : +if test ${with_mumps+y} +then : withval=$with_mumps; fi # Check whether --with-mumps-lflags was given. -if test "${with_mumps_lflags+set}" = set; then : +if test ${with_mumps_lflags+y} +then : withval=$with_mumps_lflags; fi # Check whether --with-mumps-cflags was given. -if test "${with_mumps_cflags+set}" = set; then : +if test ${with_mumps_cflags+y} +then : withval=$with_mumps_cflags; fi @@ -23336,52 +24137,64 @@ fi - dflt_action=build -# Initialize variables for the primary package. - coin_has_mumps=noInfo + + + + coin_has_mumps=requested + mumps_lflags= mumps_cflags= mumps_data= - mumps_pcfiles= + mumps_pcfiles="coinmumps" -# --with-prim is always present. If the client specified dataonly, its value -# is assigned to prim_data. withval="$with_mumps" if test -n "$withval" ; then case "$withval" in no ) coin_has_mumps=skipping + mumps_failmode='command line' ;; yes ) coin_has_mumps=requested + mumps_failmode='' ;; build ) - coin_has_mumps=build + coin_has_mumps=requested + mumps_build=yes + mumps_failmode='' ;; * ) - coin_has_mumps=yes + coin_has_mumps=requested + mumps_failmode='' mumps_lflags="$withval" + mumps_pcfiles='' ;; esac + else + if test -n "$with_mumps_lflags" || + test -n "$with_mumps_cflags" || + test -n "$with_mumps_data" ; then + coin_has_mumps=requested + mumps_failmode='' + mumps_pcfiles='' + fi fi -# --with-prim-libs and --with-prim-cflags are present unless the client -# specified dataonly. Specifying --with-prim=no overrides the individual -# options for libs and cflags. if test "$coin_has_mumps" != skipping ; then withval="$with_mumps_lflags" if test -n "$withval" ; then case "$withval" in build | no | yes ) - as_fn_error $? "\"$withval\" is not valid here; please specify linker flags appropriate for your environment." "$LINENO" 5 + as_fn_error $? "\"$withval\" is not useful here; please specify link flags appropriate for your environment." "$LINENO" 5 ;; * ) coin_has_mumps=yes mumps_lflags="$withval" + mumps_pcfiles='' ;; esac fi @@ -23390,54 +24203,43 @@ fi if test -n "$withval" ; then case "$withval" in build | no | yes ) - as_fn_error $? "\"$withval\" is not valid here; please specify compiler flags appropriate for your environment." "$LINENO" 5 + as_fn_error $? "\"$withval\" is not useful here; please specify compile flags appropriate for your environment." "$LINENO" 5 ;; * ) coin_has_mumps=yes mumps_cflags="$withval" + mumps_pcfiles='' ;; esac fi fi -# --with-prim-data will be present unless the client specified nodata. -# Specifying --with-prim=no overrides the individual option for data. -# At this point, coin_has_prim can be one of noInfo (no user options -# specified), skipping (user said no), requested or build (user said yes -# or build and gave no further guidance), or yes (user specified one or -# more --with-prim options). If we're already at yes or skipping, we're -# done looking. -# If there are no user options (noInfo) and the default is no, we're skipping. -# Otherwise, the default must be yes or build; consider the package requested. -# A default action we don't recognise defaults to yes. + if test $coin_has_mumps = requested ; then + if test -n "$PKG_CONFIG" ; then + if test x"$mumps_build" = xyes ; then + pcfile="coin$mumps_pcfiles" + - if test "$coin_has_mumps" = noInfo ; then - case $dflt_action in - no ) - coin_has_mumps=skipping - ;; - build ) - coin_has_mumps=build - ;; - * ) - coin_has_mumps=requested - ;; - esac - fi -# Now coin_has_prim can be one of skipping, yes, requested, or build. For -# requested or build, try pkgconf, if it's available. If it's not available, -# well, hope that the user knows their system and prim can be used with no -# additional flags. + if test -n "$PKG_CONFIG" ; then + if PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --exists "$pcfile" ; then + MUMPS_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "$pcfile" 2>/dev/null | tr '\n' ' '` + coin_has_mumps=yes + else + MUMPS_PKG_ERRORS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$pcfile"` + coin_has_mumps=no + fi + else + as_fn_error $? "\"Cannot check for existence of module mumps without pkgconf\"" "$LINENO" 5 + fi - case $coin_has_mumps in - requested | build ) - if test -n "$PKG_CONFIG" -a "coinmumps" != skip ; then - pcfile="coinmumps" + fi + if ! test $coin_has_mumps = yes ; then + pcfile="$mumps_pcfiles" @@ -23445,8 +24247,6 @@ fi if PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --exists "$pcfile" ; then MUMPS_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "$pcfile" 2>/dev/null | tr '\n' ' '` coin_has_mumps=yes - mumps_data=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --variable=datadir "$pcfile" 2>/dev/null` - mumps_pcfiles="$pcfile" else MUMPS_PKG_ERRORS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$pcfile"` coin_has_mumps=no @@ -23455,56 +24255,47 @@ fi as_fn_error $? "\"Cannot check for existence of module mumps without pkgconf\"" "$LINENO" 5 fi - else - coin_has_mumps=no - # AC_MSG_WARN([skipped check via pkgconf as no pkgconf available]) fi - ;; - skipping | yes ) - ;; - * ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unexpected status \"$coin_has_mumps\" in COIN_FIND_PRIM_PKG" >&5 -$as_echo "$as_me: WARNING: Unexpected status \"$coin_has_mumps\" in COIN_FIND_PRIM_PKG" >&2;} - ;; - esac - -# The final value of coin_has_prim will be yes, no, or skipping. No means -# we looked (with pkgconfig) and didn't find anything. Skipping means the -# user said `don't use.' Yes means we have something, from the user or -# from pkgconfig. Note that we haven't run a useability test! + if test $coin_has_mumps = yes ; then + mumps_data=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --variable=datadir "$pcfile" 2>/dev/null` + mumps_pcfiles="$pcfile" + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Check for mumps via pkg-config could not be performed as there is no pkg-config available. Consider installing pkg-config or provide appropriate values for --with-mumps-lflags and --with-mumps-cflags." >&5 +printf "%s\n" "$as_me: WARNING: Check for mumps via pkg-config could not be performed as there is no pkg-config available. Consider installing pkg-config or provide appropriate values for --with-mumps-lflags and --with-mumps-cflags." >&2;} + coin_has_mumps=no + fi + fi -# Define BUILDTOOLS_DEBUG to enable debugging output if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: FIND_PRIM_PKG result for mumps: \"$coin_has_mumps\"" >&5 -$as_echo "$as_me: FIND_PRIM_PKG result for mumps: \"$coin_has_mumps\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Collected values for package 'mumps'" >&5 -$as_echo "$as_me: Collected values for package 'mumps'" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: mumps_lflags is \"$mumps_lflags\"" >&5 -$as_echo "$as_me: mumps_lflags is \"$mumps_lflags\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: mumps_cflags is \"$mumps_cflags\"" >&5 -$as_echo "$as_me: mumps_cflags is \"$mumps_cflags\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: mumps_data is \"$mumps_data\"" >&5 -$as_echo "$as_me: mumps_data is \"$mumps_data\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: mumps_pcfiles is \"$mumps_pcfiles\"" >&5 -$as_echo "$as_me: mumps_pcfiles is \"$mumps_pcfiles\"" >&6;} - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $coin_has_mumps" >&5 -$as_echo "$coin_has_mumps" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: FIND_PRIM_PKG result for mumps: \"$coin_has_mumps\"" >&5 +printf "%s\n" "$as_me: FIND_PRIM_PKG result for mumps: \"$coin_has_mumps\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Collected values for package 'mumps'" >&5 +printf "%s\n" "$as_me: Collected values for package 'mumps'" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: mumps_lflags is \"$mumps_lflags\"" >&5 +printf "%s\n" "$as_me: mumps_lflags is \"$mumps_lflags\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: mumps_cflags is \"$mumps_cflags\"" >&5 +printf "%s\n" "$as_me: mumps_cflags is \"$mumps_cflags\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: mumps_data is \"$mumps_data\"" >&5 +printf "%s\n" "$as_me: mumps_data is \"$mumps_data\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: mumps_pcfiles is \"$mumps_pcfiles\"" >&5 +printf "%s\n" "$as_me: mumps_pcfiles is \"$mumps_pcfiles\"" >&6;} + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_mumps" >&5 +printf "%s\n" "$coin_has_mumps" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $coin_has_mumps due to COIN_SKIP_PROJECTS" >&5 -$as_echo "$coin_has_mumps due to COIN_SKIP_PROJECTS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_mumps (COIN_SKIP_PROJECTS)" >&5 +printf "%s\n" "$coin_has_mumps (COIN_SKIP_PROJECTS)" >&6; } fi -# Possibilities are `yes', 'no', or `skipping'. Normalise to `yes' or `no'. if test "$coin_has_mumps" != yes ; then coin_has_mumps=no fi -# Create an automake conditional COIN_HAS_PRIM. if test $coin_has_mumps = yes; then COIN_HAS_MUMPS_TRUE= @@ -23515,49 +24306,64 @@ else fi -# If we've located the package, define preprocessor symbol COIN_HAS_PRIM and -# augment the necessary variables for the client packages. if test $coin_has_mumps = yes ; then -$as_echo "#define IPOPT_HAS_MUMPS 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_MUMPS 1" >>confdefs.h - if test -n "$mumps_pcfiles" ; then IPOPTLIB_PCFILES="$mumps_pcfiles $IPOPTLIB_PCFILES" ; fi + IPOPTLIB_PCFILES="$mumps_pcfiles $IPOPTLIB_PCFILES" IPOPTLIB_LFLAGS="$mumps_lflags $IPOPTLIB_LFLAGS" IPOPTLIB_CFLAGS="$mumps_cflags $IPOPTLIB_CFLAGS" -# Finally, set up PRIM_DATA, unless the user specified nodata. - fi # Check whether MPI_Initialized is available # we assume that MPI_Finalized is present if MPI_Initialized is present -for ac_func in MPI_Initialized -do : - ac_fn_c_check_func "$LINENO" "MPI_Initialized" "ac_cv_func_MPI_Initialized" -if test "x$ac_cv_func_MPI_Initialized" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MPI_INITIALIZED 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "MPI_Initialized" "ac_cv_func_MPI_Initialized" +if test "x$ac_cv_func_MPI_Initialized" = xyes +then : + printf "%s\n" "#define HAVE_MPI_INITIALIZED 1" >>confdefs.h fi -done +# Check whether --enable-mpiinit was given. +if test ${enable_mpiinit+y} +then : + enableval=$enable_mpiinit; case "$enableval" in + no | yes) ;; + *) + as_fn_error $? "invalid argument for --enable-mpiinit: $enableval" "$LINENO" 5;; + esac + mpiinit=$enableval +else $as_nop + mpiinit=yes +fi + +if test $mpiinit = yes ; then + +printf "%s\n" "#define IPOPT_MPIINIT 1" >>confdefs.h + +fi + ####### # HSL # ####### +if test $intsize = 32 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for package HSL" >&5 -$as_echo_n "checking for package HSL... " >&6; } -# Make sure the necessary variables exist for each client package. + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for package HSL" >&5 +printf %s "checking for package HSL... " >&6; } + @@ -23567,20 +24373,16 @@ $as_echo_n "checking for package HSL... " >&6; } -# Check to see if the user has set an override to skip this primary. coin_has_hsl=noInfo if test x"$COIN_SKIP_PROJECTS" != x ; then - for pkg in $COIN_SKIP_PROJECTS ; do - if test "$pkg" = "$hsl" ; then + for pkg in `echo $COIN_SKIP_PROJECTS | tr '[:upper:]' '[:lower:]'` ; do + if test "$pkg" = "hsl" ; then coin_has_hsl=skipping fi done fi -# If we're not skipping this primary, define and process the command line -# options according to the cmdopts parameter. Then invoke FIND_PRIM_PKG to do -# the heavy lifting. if test "$coin_has_hsl" != skipping ; then @@ -23588,21 +24390,24 @@ $as_echo_n "checking for package HSL... " >&6; } # Check whether --with-hsl was given. -if test "${with_hsl+set}" = set; then : +if test ${with_hsl+y} +then : withval=$with_hsl; fi # Check whether --with-hsl-lflags was given. -if test "${with_hsl_lflags+set}" = set; then : +if test ${with_hsl_lflags+y} +then : withval=$with_hsl_lflags; fi # Check whether --with-hsl-cflags was given. -if test "${with_hsl_cflags+set}" = set; then : +if test ${with_hsl_cflags+y} +then : withval=$with_hsl_cflags; fi @@ -23612,52 +24417,64 @@ fi - dflt_action=build -# Initialize variables for the primary package. - coin_has_hsl=noInfo + + + + coin_has_hsl=requested + hsl_lflags= hsl_cflags= hsl_data= - hsl_pcfiles= + hsl_pcfiles="coinhsl" -# --with-prim is always present. If the client specified dataonly, its value -# is assigned to prim_data. withval="$with_hsl" if test -n "$withval" ; then case "$withval" in no ) coin_has_hsl=skipping + hsl_failmode='command line' ;; yes ) coin_has_hsl=requested + hsl_failmode='' ;; build ) - coin_has_hsl=build + coin_has_hsl=requested + hsl_build=yes + hsl_failmode='' ;; * ) - coin_has_hsl=yes + coin_has_hsl=requested + hsl_failmode='' hsl_lflags="$withval" + hsl_pcfiles='' ;; esac + else + if test -n "$with_hsl_lflags" || + test -n "$with_hsl_cflags" || + test -n "$with_hsl_data" ; then + coin_has_hsl=requested + hsl_failmode='' + hsl_pcfiles='' + fi fi -# --with-prim-libs and --with-prim-cflags are present unless the client -# specified dataonly. Specifying --with-prim=no overrides the individual -# options for libs and cflags. if test "$coin_has_hsl" != skipping ; then withval="$with_hsl_lflags" if test -n "$withval" ; then case "$withval" in build | no | yes ) - as_fn_error $? "\"$withval\" is not valid here; please specify linker flags appropriate for your environment." "$LINENO" 5 + as_fn_error $? "\"$withval\" is not useful here; please specify link flags appropriate for your environment." "$LINENO" 5 ;; * ) coin_has_hsl=yes hsl_lflags="$withval" + hsl_pcfiles='' ;; esac fi @@ -23666,54 +24483,43 @@ fi if test -n "$withval" ; then case "$withval" in build | no | yes ) - as_fn_error $? "\"$withval\" is not valid here; please specify compiler flags appropriate for your environment." "$LINENO" 5 + as_fn_error $? "\"$withval\" is not useful here; please specify compile flags appropriate for your environment." "$LINENO" 5 ;; * ) coin_has_hsl=yes hsl_cflags="$withval" + hsl_pcfiles='' ;; esac fi fi -# --with-prim-data will be present unless the client specified nodata. -# Specifying --with-prim=no overrides the individual option for data. -# At this point, coin_has_prim can be one of noInfo (no user options -# specified), skipping (user said no), requested or build (user said yes -# or build and gave no further guidance), or yes (user specified one or -# more --with-prim options). If we're already at yes or skipping, we're -# done looking. -# If there are no user options (noInfo) and the default is no, we're skipping. -# Otherwise, the default must be yes or build; consider the package requested. -# A default action we don't recognise defaults to yes. + if test $coin_has_hsl = requested ; then + if test -n "$PKG_CONFIG" ; then + if test x"$hsl_build" = xyes ; then + pcfile="coin$hsl_pcfiles" + - if test "$coin_has_hsl" = noInfo ; then - case $dflt_action in - no ) - coin_has_hsl=skipping - ;; - build ) - coin_has_hsl=build - ;; - * ) - coin_has_hsl=requested - ;; - esac - fi -# Now coin_has_prim can be one of skipping, yes, requested, or build. For -# requested or build, try pkgconf, if it's available. If it's not available, -# well, hope that the user knows their system and prim can be used with no -# additional flags. + if test -n "$PKG_CONFIG" ; then + if PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --exists "$pcfile" ; then + HSL_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "$pcfile" 2>/dev/null | tr '\n' ' '` + coin_has_hsl=yes + else + HSL_PKG_ERRORS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$pcfile"` + coin_has_hsl=no + fi + else + as_fn_error $? "\"Cannot check for existence of module hsl without pkgconf\"" "$LINENO" 5 + fi - case $coin_has_hsl in - requested | build ) - if test -n "$PKG_CONFIG" -a "coinhsl" != skip ; then - pcfile="coinhsl" + fi + if ! test $coin_has_hsl = yes ; then + pcfile="$hsl_pcfiles" @@ -23721,8 +24527,6 @@ fi if PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --exists "$pcfile" ; then HSL_VERSIONS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --modversion "$pcfile" 2>/dev/null | tr '\n' ' '` coin_has_hsl=yes - hsl_data=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --variable=datadir "$pcfile" 2>/dev/null` - hsl_pcfiles="$pcfile" else HSL_PKG_ERRORS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$pcfile"` coin_has_hsl=no @@ -23731,56 +24535,47 @@ fi as_fn_error $? "\"Cannot check for existence of module hsl without pkgconf\"" "$LINENO" 5 fi - else - coin_has_hsl=no - # AC_MSG_WARN([skipped check via pkgconf as no pkgconf available]) fi - ;; - skipping | yes ) - ;; - * ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unexpected status \"$coin_has_hsl\" in COIN_FIND_PRIM_PKG" >&5 -$as_echo "$as_me: WARNING: Unexpected status \"$coin_has_hsl\" in COIN_FIND_PRIM_PKG" >&2;} - ;; - esac - -# The final value of coin_has_prim will be yes, no, or skipping. No means -# we looked (with pkgconfig) and didn't find anything. Skipping means the -# user said `don't use.' Yes means we have something, from the user or -# from pkgconfig. Note that we haven't run a useability test! + if test $coin_has_hsl = yes ; then + hsl_data=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --variable=datadir "$pcfile" 2>/dev/null` + hsl_pcfiles="$pcfile" + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Check for hsl via pkg-config could not be performed as there is no pkg-config available. Consider installing pkg-config or provide appropriate values for --with-hsl-lflags and --with-hsl-cflags." >&5 +printf "%s\n" "$as_me: WARNING: Check for hsl via pkg-config could not be performed as there is no pkg-config available. Consider installing pkg-config or provide appropriate values for --with-hsl-lflags and --with-hsl-cflags." >&2;} + coin_has_hsl=no + fi + fi -# Define BUILDTOOLS_DEBUG to enable debugging output if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: FIND_PRIM_PKG result for hsl: \"$coin_has_hsl\"" >&5 -$as_echo "$as_me: FIND_PRIM_PKG result for hsl: \"$coin_has_hsl\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Collected values for package 'hsl'" >&5 -$as_echo "$as_me: Collected values for package 'hsl'" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: hsl_lflags is \"$hsl_lflags\"" >&5 -$as_echo "$as_me: hsl_lflags is \"$hsl_lflags\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: hsl_cflags is \"$hsl_cflags\"" >&5 -$as_echo "$as_me: hsl_cflags is \"$hsl_cflags\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: hsl_data is \"$hsl_data\"" >&5 -$as_echo "$as_me: hsl_data is \"$hsl_data\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: hsl_pcfiles is \"$hsl_pcfiles\"" >&5 -$as_echo "$as_me: hsl_pcfiles is \"$hsl_pcfiles\"" >&6;} - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $coin_has_hsl" >&5 -$as_echo "$coin_has_hsl" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: FIND_PRIM_PKG result for hsl: \"$coin_has_hsl\"" >&5 +printf "%s\n" "$as_me: FIND_PRIM_PKG result for hsl: \"$coin_has_hsl\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Collected values for package 'hsl'" >&5 +printf "%s\n" "$as_me: Collected values for package 'hsl'" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: hsl_lflags is \"$hsl_lflags\"" >&5 +printf "%s\n" "$as_me: hsl_lflags is \"$hsl_lflags\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: hsl_cflags is \"$hsl_cflags\"" >&5 +printf "%s\n" "$as_me: hsl_cflags is \"$hsl_cflags\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: hsl_data is \"$hsl_data\"" >&5 +printf "%s\n" "$as_me: hsl_data is \"$hsl_data\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: hsl_pcfiles is \"$hsl_pcfiles\"" >&5 +printf "%s\n" "$as_me: hsl_pcfiles is \"$hsl_pcfiles\"" >&6;} + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_hsl" >&5 +printf "%s\n" "$coin_has_hsl" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $coin_has_hsl due to COIN_SKIP_PROJECTS" >&5 -$as_echo "$coin_has_hsl due to COIN_SKIP_PROJECTS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_hsl (COIN_SKIP_PROJECTS)" >&5 +printf "%s\n" "$coin_has_hsl (COIN_SKIP_PROJECTS)" >&6; } fi -# Possibilities are `yes', 'no', or `skipping'. Normalise to `yes' or `no'. if test "$coin_has_hsl" != yes ; then coin_has_hsl=no fi -# Create an automake conditional COIN_HAS_PRIM. if test $coin_has_hsl = yes; then COIN_HAS_HSL_TRUE= @@ -23791,33 +24586,40 @@ else fi -# If we've located the package, define preprocessor symbol COIN_HAS_PRIM and -# augment the necessary variables for the client packages. if test $coin_has_hsl = yes ; then -$as_echo "#define IPOPT_HAS_HSL 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_HSL 1" >>confdefs.h - if test -n "$hsl_pcfiles" ; then IPOPTLIB_PCFILES="$hsl_pcfiles $IPOPTLIB_PCFILES" ; fi + IPOPTLIB_PCFILES="$hsl_pcfiles $IPOPTLIB_PCFILES" IPOPTLIB_LFLAGS="$hsl_lflags $IPOPTLIB_LFLAGS" IPOPTLIB_CFLAGS="$hsl_cflags $IPOPTLIB_CFLAGS" - if test -n "$hsl_pcfiles" ; then HSLLIB_PCFILES="$hsl_pcfiles $HSLLIB_PCFILES" ; fi + HSLLIB_PCFILES="$hsl_pcfiles $HSLLIB_PCFILES" HSLLIB_LFLAGS="$hsl_lflags $HSLLIB_LFLAGS" HSLLIB_CFLAGS="$hsl_cflags $HSLLIB_CFLAGS" -# Finally, set up PRIM_DATA, unless the user specified nodata. - fi +else + coin_has_hsl=no + if false; then + COIN_HAS_HSL_TRUE= + COIN_HAS_HSL_FALSE='#' +else + COIN_HAS_HSL_TRUE='#' + COIN_HAS_HSL_FALSE= +fi + +fi have_ma28=no if test "$coin_has_hsl" = yes ; then if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: FINALIZE_FLAGS for HSLLib:" >&5 -$as_echo "$as_me: FINALIZE_FLAGS for HSLLib:" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: FINALIZE_FLAGS for HSLLib:" >&5 +printf "%s\n" "$as_me: FINALIZE_FLAGS for HSLLib:" >&6;} fi HSLLIB_LFLAGS_NOPC=$HSLLIB_LFLAGS @@ -23825,7 +24627,7 @@ $as_echo "$as_me: FINALIZE_FLAGS for HSLLib:" >&6;} if test -n "${HSLLIB_PCFILES}" ; then temp_CFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --cflags ${HSLLIB_PCFILES}` - temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs ${HSLLIB_PCFILES}` + temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $pkg_static ${HSLLIB_PCFILES}` HSLLIB_CFLAGS="$temp_CFLAGS ${HSLLIB_CFLAGS}" HSLLIB_LFLAGS="$temp_LFLAGS ${HSLLIB_LFLAGS}" fi @@ -23843,61 +24645,65 @@ $as_echo "$as_me: FINALIZE_FLAGS for HSLLib:" >&6;} esac fi -cat >>confdefs.h <<_ACEOF -#define HSLLIB_EXPORT $libexport_attribute -_ACEOF +printf "%s\n" "#define HSLLIB_EXPORT $libexport_attribute" >>confdefs.h # add -DXYZ_BUILD to XYZ_CFLAGS HSLLIB_CFLAGS="${HSLLIB_CFLAGS} -DHSLLIB_BUILD" -# Define BUILDTOOLS_DEBUG to enable debugging output - + # Define BUILDTOOLS_DEBUG to enable debugging output if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: HSLLIB_LFLAGS_NOPC: \"${HSLLIB_LFLAGS_NOPC}\"" >&5 -$as_echo "$as_me: HSLLIB_LFLAGS_NOPC: \"${HSLLIB_LFLAGS_NOPC}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: HSLLIB_CFLAGS_NOPC: \"${HSLLIB_CFLAGS_NOPC}\"" >&5 -$as_echo "$as_me: HSLLIB_CFLAGS_NOPC: \"${HSLLIB_CFLAGS_NOPC}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: adding \"${HSLLIB_PCFILES}\"" >&5 -$as_echo "$as_me: adding \"${HSLLIB_PCFILES}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: HSLLIB_LFLAGS: \"${HSLLIB_LFLAGS}\"" >&5 -$as_echo "$as_me: HSLLIB_LFLAGS: \"${HSLLIB_LFLAGS}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: HSLLIB_CFLAGS: \"${HSLLIB_CFLAGS}\"" >&5 -$as_echo "$as_me: HSLLIB_CFLAGS: \"${HSLLIB_CFLAGS}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HSLLIB_LFLAGS_NOPC: \"${HSLLIB_LFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: HSLLIB_LFLAGS_NOPC: \"${HSLLIB_LFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HSLLIB_CFLAGS_NOPC: \"${HSLLIB_CFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: HSLLIB_CFLAGS_NOPC: \"${HSLLIB_CFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: adding \"${HSLLIB_PCFILES}\"" >&5 +printf "%s\n" "$as_me: adding \"${HSLLIB_PCFILES}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HSLLIB_LFLAGS: \"${HSLLIB_LFLAGS}\"" >&5 +printf "%s\n" "$as_me: HSLLIB_LFLAGS: \"${HSLLIB_LFLAGS}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HSLLIB_CFLAGS: \"${HSLLIB_CFLAGS}\"" >&5 +printf "%s\n" "$as_me: HSLLIB_CFLAGS: \"${HSLLIB_CFLAGS}\"" >&6;} fi + case $precision in + single ) ma27func=ma27a MA27FUNC=MA27A ;; + double ) ma27func=ma27ad MA27FUNC=MA27AD ;; + * ) as_fn_error $? "HSL cannot be used with --with-precision=$precision" "$LINENO" 5 ;; + esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking HSL name mangling scheme" >&5 -$as_echo_n "checking HSL name mangling scheme... " >&6; } -if ${ac_cv_hsl_namemangling+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_LIBS=$LIBS - LIBS="$HSLLIB_LFLAGS" - for ac_case in "lower case" "upper case" ; do - for ac_trail in "underscore" "no underscore" ; do - for ac_extra in "no extra underscore" "extra underscore" ; do - ac_cv_hsl_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" - # AC_MSG_NOTICE([Attempting link for m4_tolower(ac_cv_HSL_namemangling)]) - case $ac_case in - "lower case") - ac_name=ma27ad - ;; - "upper case") - ac_name=MA27AD - ;; - esac - if test "$ac_trail" = underscore ; then - ac_name=${ac_name}_ - fi - # AC_MSG_CHECKING([ma27ad -> $ac_name]) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_save_LIBS="$LIBS" + LIBS="$HSLLIB_LFLAGS $LIBS" + + + ma27ad_namemangling=unknown + + for ac_extra in "no extra underscore" "extra underscore" ; do + for ac_case in "lower case" "upper case" ; do + for ac_trail in "underscore" "no underscore" ; do + case $ac_case in + "lower case") + ac_name=ma27ad + ;; + "upper case") + ac_name=MA27AD + ;; + esac + if test "$ac_trail" = "underscore" ; then + ac_name=${ac_name}_ + fi + if test "$ac_extra" = "extra underscore" ; then + ac_name=${ac_name}_ + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 +printf %s "checking for function $ac_name in $LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -23907,125 +24713,124 @@ else #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_success=yes -else +if ac_fn_c_try_link "$LINENO" +then : + ma27ad_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" + ac_success=yes +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - # AC_MSG_RESULT([$result]) - if test $ac_success = yes ; then - break 3 - fi - done - done - done - if test "$ac_success" = "no" ; then - ac_cv_hsl_namemangling="$ac_cv_f77_mangling" - fi - LIBS=$ac_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_hsl_namemangling" >&5 -$as_echo "$ac_cv_hsl_namemangling" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 +printf "%s\n" "$ac_success" >&6; } + if test $ac_success = yes ; then + break 3 + fi + done + done + done + LIBS=$ac_save_LIBS - # setup the m4_toupper(HSL)_FUNC and m4_toupper(HSL)_FUNC_ macros + if test $ac_success = yes ; then - case "$ac_cv_hsl_namemangling" in + case "$ma27ad_namemangling" in "lower case, no underscore, no extra underscore") - $as_echo "#define IPOPT_HSL_FUNC(name,NAME) name" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC(name,NAME) name" >>confdefs.h - $as_echo "#define IPOPT_HSL_FUNC_(name,NAME) name" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC_(name,NAME) name" >>confdefs.h ;; "lower case, no underscore, extra underscore") - $as_echo "#define IPOPT_HSL_FUNC(name,NAME) name" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC(name,NAME) name" >>confdefs.h - $as_echo "#define IPOPT_HSL_FUNC_(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC_(name,NAME) name ## _" >>confdefs.h ;; "lower case, underscore, no extra underscore") - $as_echo "#define IPOPT_HSL_FUNC(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC(name,NAME) name ## _" >>confdefs.h - $as_echo "#define IPOPT_HSL_FUNC_(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC_(name,NAME) name ## _" >>confdefs.h ;; "lower case, underscore, extra underscore") - $as_echo "#define IPOPT_HSL_FUNC(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC(name,NAME) name ## _" >>confdefs.h - $as_echo "#define IPOPT_HSL_FUNC_(name,NAME) name ## __" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC_(name,NAME) name ## __" >>confdefs.h ;; "upper case, no underscore, no extra underscore") - $as_echo "#define IPOPT_HSL_FUNC(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC(name,NAME) NAME" >>confdefs.h - $as_echo "#define IPOPT_HSL_FUNC_(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC_(name,NAME) NAME" >>confdefs.h ;; "upper case, no underscore, extra underscore") - $as_echo "#define IPOPT_HSL_FUNC(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC(name,NAME) NAME" >>confdefs.h - $as_echo "#define IPOPT_HSL_FUNC_(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC_(name,NAME) NAME ## _" >>confdefs.h ;; "upper case, underscore, no extra underscore") - $as_echo "#define IPOPT_HSL_FUNC(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define IPOPT_HSL_FUNC_(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC_(name,NAME) NAME ## _" >>confdefs.h ;; "upper case, underscore, extra underscore") - $as_echo "#define IPOPT_HSL_FUNC(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define IPOPT_HSL_FUNC_(name,NAME) NAME ## __" >>confdefs.h + printf "%s\n" "#define IPOPT_HSL_FUNC_(name,NAME) NAME ## __" >>confdefs.h ;; *) - { $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 (HSL): Unsupported or unknown name-mangling scheme: $ac_cv_hsl_namemangling" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Unsupported or unknown name-mangling scheme: $ma27ad_namemangling" >&5 +printf "%s\n" "$as_me: WARNING: Unsupported or unknown name-mangling scheme: $ma27ad_namemangling" >&2;} ;; esac - - # AC_MSG_NOTICE([Done COIN_NAMEMANGLING]) + else as_fn_error $? "Provided package HSL is not working or does not contain MA27. See config.log for details on failed checks." "$LINENO" 5 + fi - # extra check for MA28, since that decides whether we have to build IpMa28Partition.F + # extra check for MA28(s), since that decides whether we have to build IpMa28(s)Partition.F if test -n "$F77" ; then + case $precision in + single ) - # setup LIBS by adding $HSLLIB_LFLAGS and those from ac_save_LIBS="$LIBS" LIBS="$HSLLIB_LFLAGS $LIBS" - ma28ad_namemangling=unknown + ma28a_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") - ac_name=ma28ad + ac_name=ma28a ;; "upper case") - ac_name=MA28AD + ac_name=MA28A ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + if test "$ac_extra" = "extra underscore" ; then + ac_name=${ac_name}_ + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 +printf %s "checking for function $ac_name in $LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -24035,23 +24840,24 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ma28ad_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" +if ac_fn_c_try_link "$LINENO" +then : + ma28a_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 +printf "%s\n" "$ac_success" >&6; } if test $ac_success = yes ; then break 3 fi @@ -24062,81 +24868,50 @@ $as_echo "$ac_success" >&6; } if test $ac_success = yes ; then - if test "$ma28ad_namemangling" != "$ac_cv_f77_mangling" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&5 -$as_echo "$as_me: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&2;} - else - have_ma28=yes - fi - + if test "$ma28a_namemangling" != "$ac_cv_f77_mangling" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&5 +printf "%s\n" "$as_me: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&2;} + else + have_ma28=yes + fi - fi fi -fi - if test "$have_ma28" = yes; then - HAVE_MA28_TRUE= - HAVE_MA28_FALSE='#' -else - HAVE_MA28_TRUE='#' - HAVE_MA28_FALSE= -fi - - -########### -# PARDISO # -########### - - -# Check whether --with-pardiso was given. -if test "${with_pardiso+set}" = set; then : - withval=$with_pardiso; have_pardiso_project=yes; pardiso_lflags=$withval -else - have_pardiso_project=no -fi - - -have_pardiso_mkl=no -if test "$have_pardiso_project" = yes ; then - # check whether flags from --with-pardiso work and figure out name mangling - # if so, define PARDISO_FUNC and keep lflags + ;; + double ) - # setup LIBS by adding $pardiso_lflags $lapack_lflags and those from $lapack_pcfiles ac_save_LIBS="$LIBS" - LIBS="$pardiso_lflags $lapack_lflags $LIBS" - if test -n "$lapack_pcfiles" ; then + LIBS="$HSLLIB_LFLAGS $LIBS" - temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $lapack_pcfiles` - LIBS="$temp_LFLAGS $LIBS" - fi - pardiso_ipopt_newinterface_namemangling=unknown + ma28ad_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") - ac_name=pardiso_ipopt_newinterface + ac_name=ma28ad ;; "upper case") - ac_name=PARDISO_IPOPT_NEWINTERFACE + ac_name=MA28AD ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + if test "$ac_extra" = "extra underscore" ; then + ac_name=${ac_name}_ + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 +printf %s "checking for function $ac_name in $LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -24146,23 +24921,24 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - pardiso_ipopt_newinterface_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" +if ac_fn_c_try_link "$LINENO" +then : + ma28ad_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 +printf "%s\n" "$ac_success" >&6; } if test $ac_success = yes ; then break 3 fi @@ -24173,101 +24949,109 @@ $as_echo "$ac_success" >&6; } if test $ac_success = yes ; then + if test "$ma28ad_namemangling" != "$ac_cv_f77_mangling" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&5 +printf "%s\n" "$as_me: WARNING: Name mangling of MA28 different than Fortran. This will not link. Disabling MA28" >&2;} + else + have_ma28=yes + fi - case "$pardiso_ipopt_newinterface_namemangling" in - "lower case, no underscore, no extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) name" >>confdefs.h - - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) name" >>confdefs.h - ;; - "lower case, no underscore, extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) name" >>confdefs.h - - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) name ## _" >>confdefs.h - ;; - "lower case, underscore, no extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) name ## _" >>confdefs.h - - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) name ## _" >>confdefs.h - ;; - "lower case, underscore, extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) name ## _" >>confdefs.h - - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) name ## __" >>confdefs.h - ;; - "upper case, no underscore, no extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) NAME" >>confdefs.h - - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) NAME" >>confdefs.h - ;; - "upper case, no underscore, extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) NAME" >>confdefs.h - - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) NAME ## _" >>confdefs.h + fi ;; - "upper case, underscore, no extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) NAME ## _" >>confdefs.h + * ) as_fn_error $? "HSL cannot be used with --with-precision=$precision" "$LINENO" 5 ;; + esac + fi +fi + if test "$have_ma28" = yes; then + HAVE_MA28_TRUE= + HAVE_MA28_FALSE='#' +else + HAVE_MA28_TRUE='#' + HAVE_MA28_FALSE= +fi - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) NAME ## _" >>confdefs.h - ;; - "upper case, underscore, extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) NAME ## __" >>confdefs.h - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unsupported or unknown name-mangling scheme: $pardiso_ipopt_newinterface_namemangling" >&5 -$as_echo "$as_me: WARNING: Unsupported or unknown name-mangling scheme: $pardiso_ipopt_newinterface_namemangling" >&2;} - ;; - esac +########### +# PARDISO # +########### - IPOPTLIB_LFLAGS="$pardiso_lflags $IPOPTLIB_LFLAGS" +if test $intsize = 32 ; then -$as_echo "#define IPOPT_HAS_PARDISO 1" >>confdefs.h +# Check whether --with-pardiso was given. +if test ${with_pardiso+y} +then : + withval=$with_pardiso; case "$withval" in + no) have_pardiso_project=no ;; # so with_pardiso=no + yes) as_fn_error $? "\"expected filename as argument for --with-pardiso\"" "$LINENO" 5 ;; + *) +printf "%s\n" "#define PARDISO_LIB \"$withval\"" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Pardiso from pardiso-project.org specified as $withval" >&5 +printf "%s\n" "$as_me: Pardiso from pardiso-project.org specified as $withval" >&6;} + have_pardiso_project=yes + ;; + esac +else $as_nop + have_pardiso_project=no +fi - else as_fn_error $? "Symbol pardiso_ipopt_newinterface not found with Pardiso flags $pardiso_lflags and Lapack. Require Pardiso >= 4.0." "$LINENO" 5 - fi +fi +# check whether Pardiso is available via Lapack, which should then be MKL +# Check whether --enable-pardisomkl was given. +if test ${enable_pardisomkl+y} +then : + enableval=$enable_pardisomkl; case "$enableval" in + no | yes) ;; + *) + as_fn_error $? "invalid argument for --enable-pardisomkl: $enableval" "$LINENO" 5;; + esac + checkpardisomkl=$enableval +else $as_nop + checkpardisomkl=yes +fi +have_pardiso_mkl=no +if test $checkpardisomkl = yes ; then - # setup LIBS by adding $pardiso_lflags $lapack_lflags and those from $lapack_pcfiles ac_save_LIBS="$LIBS" - LIBS="$pardiso_lflags $lapack_lflags $LIBS" - if test -n "$lapack_pcfiles" ; then + LIBS="$lapack_lflags $LIBS" - temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $lapack_pcfiles` + if test -n "$lapack_pcfiles" ; then + temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $pkg_static $lapack_pcfiles` LIBS="$temp_LFLAGS $LIBS" fi - pardiso_exist_parallel_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + pardiso_namemangling=unknown + + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") - ac_name=pardiso_exist_parallel + ac_name=pardiso ;; "upper case") - ac_name=PARDISO_EXIST_PARALLEL + ac_name=PARDISO ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then + ac_name=${ac_name}_ + fi + if test "$ac_extra" = "extra underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 +printf %s "checking for function $ac_name in $LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -24277,23 +25061,24 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - pardiso_exist_parallel_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" +if ac_fn_c_try_link "$LINENO" +then : + pardiso_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 +printf "%s\n" "$ac_success" >&6; } if test $ac_success = yes ; then break 3 fi @@ -24303,53 +25088,161 @@ $as_echo "$ac_success" >&6; } LIBS=$ac_save_LIBS if test $ac_success = yes ; then + have_pardiso_mkl=yes -$as_echo "#define IPOPT_HAS_PARDISO_PARALLEL 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_PARDISO_MKL 1" >>confdefs.h - fi + fi +fi + if test "$have_pardiso_mkl" = yes; then + HAVE_PARDISO_MKL_TRUE= + HAVE_PARDISO_MKL_FALSE='#' else - # check whether Pardiso is available via Lapack, which should then be MKL - # figure out name mangling and define PARDISO_FUNC + HAVE_PARDISO_MKL_TRUE='#' + HAVE_PARDISO_MKL_FALSE= +fi - # setup LIBS by adding $lapack_lflags and those from $lapack_pcfiles - ac_save_LIBS="$LIBS" - LIBS="$lapack_lflags $LIBS" - if test -n "$lapack_pcfiles" ; then - temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $lapack_pcfiles` - LIBS="$temp_LFLAGS $LIBS" +######### +# SPRAL # +######### + +# check for Spral only if building for double precision and 32-bit integers +# spral_ssids seems to support more than 2^31 nonzeros in a matrix, but not dimensions > 2^31 +if test $precision$intsize = double32 ; then + 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_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library Spral with combined link and compile check" >&5 +printf %s "checking for library Spral with combined link and compile check... " >&6; } + + + + + + + + coin_has_spral=noInfo + if test x"$COIN_SKIP_PROJECTS" != x ; then + for pkg in `echo $COIN_SKIP_PROJECTS | tr '[:upper:]' '[:lower:]'` ; do + if test "$pkg" = "spral" ; then + coin_has_spral=skipping + fi + done + fi + + + if test "$coin_has_spral" != skipping ; then + + + + +# Check whether --with-spral was given. +if test ${with_spral+y} +then : + withval=$with_spral; +fi + + + +# Check whether --with-spral-lflags was given. +if test ${with_spral_lflags+y} +then : + withval=$with_spral_lflags; +fi + + + +# Check whether --with-spral-cflags was given. +if test ${with_spral_cflags+y} +then : + withval=$with_spral_cflags; +fi + + + + + + + + + + + spral_lflags="" + spral_cflags="" + spral_data="" + coin_has_spral=skipping + spral_failmode='default' + spral_userflags='no' + + + withval="$with_spral" + if test -n "$withval" ; then + case "$withval" in + no ) + coin_has_spral=skipping + spral_failmode='command line' + ;; + yes ) + coin_has_spral=requested + spral_failmode='' + ;; + * ) + coin_has_spral=requested + spral_failmode='' + spral_lflags="$withval" + spral_userflags='yes' + ;; + esac + else + if test -n "$with_spral_lflags" || + test -n "$with_spral_cflags" || + test -n "$with_spral_data" ; then + coin_has_spral=requested + spral_failmode='' + spral_userflags='yes' fi + fi - pardiso_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do - for ac_case in "lower case" "upper case" ; do - for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) - case $ac_case in - "lower case") - ac_name=pardiso - ;; - "upper case") - ac_name=PARDISO - ;; - esac - if test "$ac_trail" = underscore ; then - ac_name=${ac_name}_ - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$coin_has_spral" != skipping ; then + withval="$with_spral_lflags" + if test -n "$withval" ; then + coin_has_spral=requested + spral_lflags="$withval" + spral_userflags='yes' + fi + + withval="$with_spral_cflags" + if test -n "$withval" ; then + coin_has_spral=requested + spral_cflags="$withval" + spral_userflags='yes' + fi + fi + + + + + + + if test $coin_has_spral != skipping ; then + ac_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$spral_cflags" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); +#include "spral_ssids.h" #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -24359,108 +25252,160 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - pardiso_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" - ac_success=yes -else - ac_success=no +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + coin_has_spral='no' + spral_failmode="header compile" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CPPFLAGS=$ac_save_CPPFLAGS + fi + + + if test "$coin_has_spral" != skipping ; then + ac_save_LIBS=$LIBS + ac_save_CPPFLAGS=$CPPFLAGS + LIBS="$spral_lflags" + CPPFLAGS="$spral_cflags" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include "spral_ssids.h" +#ifdef F77_DUMMY_MAIN + +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } + +#endif +int +main (void) +{ +spral_ssids_solve(0, 0, (double*)0, 0, (void*)0, (void*)0, (const struct spral_ssids_options*)0, (struct spral_ssids_inform*)0); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + +else $as_nop + coin_has_spral='no' + if test -n "$spral_failmode" ; then + spral_failmode="$spral_failmode, link with header" + else + spral_failmode="link with header" + fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } - if test $ac_success = yes ; then - break 3 - fi - done - done - done - LIBS=$ac_save_LIBS - - if test $ac_success = yes ; then - + LIBS=$ac_save_LIBS + CPPFLAGS=$ac_save_CPPFLAGS + fi - case "$pardiso_namemangling" in - "lower case, no underscore, no extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) name" >>confdefs.h + if test $coin_has_spral = requested ; then + coin_has_spral=yes + fi - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) name" >>confdefs.h - ;; - "lower case, no underscore, extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) name" >>confdefs.h - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) name ## _" >>confdefs.h - ;; - "lower case, underscore, no extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) name ## _" >>confdefs.h + # Define BUILDTOOLS_DEBUG to enable debugging output + if test "$BUILDTOOLS_DEBUG" = 1 ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: FIND_PRIM_LIB result for spral: \"$coin_has_spral\"" >&5 +printf "%s\n" "$as_me: FIND_PRIM_LIB result for spral: \"$coin_has_spral\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Collected values for package 'spral'" >&5 +printf "%s\n" "$as_me: Collected values for package 'spral'" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: spral_lflags is \"$spral_lflags\"" >&5 +printf "%s\n" "$as_me: spral_lflags is \"$spral_lflags\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: spral_cflags is \"$spral_cflags\"" >&5 +printf "%s\n" "$as_me: spral_cflags is \"$spral_cflags\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: spral_data is \"$spral_data\"" >&5 +printf "%s\n" "$as_me: spral_data is \"$spral_data\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: spral_pcfiles is \"$spral_pcfiles\"" >&5 +printf "%s\n" "$as_me: spral_pcfiles is \"$spral_pcfiles\"" >&6;} + fi + + if test -n "$spral_failmode" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_spral ($spral_failmode)" >&5 +printf "%s\n" "$coin_has_spral ($spral_failmode)" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_spral" >&5 +printf "%s\n" "$coin_has_spral" >&6; } + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $coin_has_spral (COIN_SKIP_PROJECTS)" >&5 +printf "%s\n" "$coin_has_spral (COIN_SKIP_PROJECTS)" >&6; } + fi - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) name ## _" >>confdefs.h - ;; - "lower case, underscore, extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) name ## _" >>confdefs.h - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) name ## __" >>confdefs.h - ;; - "upper case, no underscore, no extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) NAME" >>confdefs.h + if test "$coin_has_spral" = 'no' ; then + if expr "$spral_failmode" : '.*header.*' &>/dev/null ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Compiler flags were \"$spral_cflags\". Use --with-spral-cflags to overwrite. Check config.log for details of failed compile attempt." >&5 +printf "%s\n" "$as_me: Compiler flags were \"$spral_cflags\". Use --with-spral-cflags to overwrite. Check config.log for details of failed compile attempt." >&6;} + fi + if expr "$spral_failmode" : '.*link.*' &>/dev/null ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Linker flags are \"$spral_lflags\". Use --with-spral-lflags to overwrite. Check config.log for details of failed link attempt." >&5 +printf "%s\n" "$as_me: Linker flags are \"$spral_lflags\". Use --with-spral-lflags to overwrite. Check config.log for details of failed link attempt." >&6;} + fi + if test "$spral_userflags" = 'yes' ; then + as_fn_error $? "user-specified flags for Spral do not work." "$LINENO" 5 + fi + fi - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) NAME" >>confdefs.h - ;; - "upper case, no underscore, extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) NAME" >>confdefs.h - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) NAME ## _" >>confdefs.h - ;; - "upper case, underscore, no extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) NAME ## _" >>confdefs.h + if test "$coin_has_spral" != yes ; then + coin_has_spral=no + fi - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) NAME ## _" >>confdefs.h - ;; - "upper case, underscore, extra underscore") - $as_echo "#define IPOPT_PARDISO_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define IPOPT_PARDISO_FUNC_(name,NAME) NAME ## __" >>confdefs.h - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unsupported or unknown name-mangling scheme: $pardiso_namemangling" >&5 -$as_echo "$as_me: WARNING: Unsupported or unknown name-mangling scheme: $pardiso_namemangling" >&2;} - ;; - esac + if test $coin_has_spral = yes; then + COIN_HAS_SPRAL_TRUE= + COIN_HAS_SPRAL_FALSE='#' +else + COIN_HAS_SPRAL_TRUE='#' + COIN_HAS_SPRAL_FALSE= +fi - have_pardiso_mkl=yes -$as_echo "#define IPOPT_HAS_PARDISO 1" >>confdefs.h - # assume MKL Pardiso is parallel (it never has pardiso_exist_parallel) - # TODO does sequential MKL also have a parallel Pardiso? do we need some check here? + if test $coin_has_spral = yes ; then -$as_echo "#define IPOPT_HAS_PARDISO_PARALLEL 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_SPRAL 1" >>confdefs.h + IPOPTLIB_LFLAGS="$spral_lflags $IPOPTLIB_LFLAGS" + IPOPTLIB_CFLAGS="$spral_cflags $IPOPTLIB_CFLAGS" -$as_echo "#define IPOPT_HAS_PARDISO_MKL 1" >>confdefs.h fi -fi - if test "$have_pardiso_mkl$have_pardiso_project" != nono; then - HAVE_PARDISO_TRUE= - HAVE_PARDISO_FALSE='#' + 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_compiler_gnu=$ac_cv_c_compiler_gnu + +else + if false; then + COIN_HAS_SPRAL_TRUE= + COIN_HAS_SPRAL_FALSE='#' else - HAVE_PARDISO_TRUE='#' - HAVE_PARDISO_FALSE= + COIN_HAS_SPRAL_TRUE='#' + COIN_HAS_SPRAL_FALSE= fi +fi ######## # WSMP # @@ -24468,28 +25413,25 @@ fi # Check whether --with-wsmp was given. -if test "${with_wsmp+set}" = set; then : +if test ${with_wsmp+y} +then : withval=$with_wsmp; have_wsmp=yes; wsmp_lflags=$withval -else +else $as_nop have_wsmp=no fi -if test "$have_wsmp" = "yes"; then +if test $have_wsmp$precision$intsize = yesdouble32 ; then - # setup LIBS by adding $wsmp_lflags and those from ac_save_LIBS="$LIBS" LIBS="$wsmp_lflags $LIBS" wssmp_namemangling=unknown - # FIXME we had "extra underscore" as additional option for ac_extra - # but since there is no use for ac_extra below, was there any use for it? - for ac_extra in "no extra underscore" ; do + for ac_extra in "no extra underscore" "extra underscore" ; do for ac_case in "lower case" "upper case" ; do for ac_trail in "underscore" "no underscore" ; do - #AC_MSG_NOTICE([Attempting link for ${ac_case}, ${ac_trail}, ${ac_extra}]) case $ac_case in "lower case") ac_name=wssmp @@ -24498,17 +25440,21 @@ if test "$have_wsmp" = "yes"; then ac_name=WSSMP ;; esac - if test "$ac_trail" = underscore ; then + if test "$ac_trail" = "underscore" ; then + ac_name=${ac_name}_ + fi + if test "$ac_extra" = "extra underscore" ; then ac_name=${ac_name}_ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 -$as_echo_n "checking for function $ac_name in $LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for function $ac_name in $LIBS" >&5 +printf %s "checking for function $ac_name in $LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __cplusplus - extern "C" - #endif - void $ac_name(); + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char $ac_name (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -24518,23 +25464,24 @@ $as_echo_n "checking for function $ac_name in $LIBS... " >&6; } #endif int -main () +main (void) { -$ac_name() +return $ac_name (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : wssmp_namemangling="${ac_case}, ${ac_trail}, ${ac_extra}" ac_success=yes -else +else $as_nop ac_success=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 -$as_echo "$ac_success" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_success" >&5 +printf "%s\n" "$ac_success" >&6; } if test $ac_success = yes ; then break 3 fi @@ -24549,57 +25496,57 @@ $as_echo "$ac_success" >&6; } case "$wssmp_namemangling" in "lower case, no underscore, no extra underscore") - $as_echo "#define IPOPT_WSMP_FUNC(name,NAME) name" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC(name,NAME) name" >>confdefs.h - $as_echo "#define IPOPT_WSMP_FUNC_(name,NAME) name" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC_(name,NAME) name" >>confdefs.h ;; "lower case, no underscore, extra underscore") - $as_echo "#define IPOPT_WSMP_FUNC(name,NAME) name" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC(name,NAME) name" >>confdefs.h - $as_echo "#define IPOPT_WSMP_FUNC_(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC_(name,NAME) name ## _" >>confdefs.h ;; "lower case, underscore, no extra underscore") - $as_echo "#define IPOPT_WSMP_FUNC(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC(name,NAME) name ## _" >>confdefs.h - $as_echo "#define IPOPT_WSMP_FUNC_(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC_(name,NAME) name ## _" >>confdefs.h ;; "lower case, underscore, extra underscore") - $as_echo "#define IPOPT_WSMP_FUNC(name,NAME) name ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC(name,NAME) name ## _" >>confdefs.h - $as_echo "#define IPOPT_WSMP_FUNC_(name,NAME) name ## __" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC_(name,NAME) name ## __" >>confdefs.h ;; "upper case, no underscore, no extra underscore") - $as_echo "#define IPOPT_WSMP_FUNC(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC(name,NAME) NAME" >>confdefs.h - $as_echo "#define IPOPT_WSMP_FUNC_(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC_(name,NAME) NAME" >>confdefs.h ;; "upper case, no underscore, extra underscore") - $as_echo "#define IPOPT_WSMP_FUNC(name,NAME) NAME" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC(name,NAME) NAME" >>confdefs.h - $as_echo "#define IPOPT_WSMP_FUNC_(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC_(name,NAME) NAME ## _" >>confdefs.h ;; "upper case, underscore, no extra underscore") - $as_echo "#define IPOPT_WSMP_FUNC(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define IPOPT_WSMP_FUNC_(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC_(name,NAME) NAME ## _" >>confdefs.h ;; "upper case, underscore, extra underscore") - $as_echo "#define IPOPT_WSMP_FUNC(name,NAME) NAME ## _" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC(name,NAME) NAME ## _" >>confdefs.h - $as_echo "#define IPOPT_WSMP_FUNC_(name,NAME) NAME ## __" >>confdefs.h + printf "%s\n" "#define IPOPT_WSMP_FUNC_(name,NAME) NAME ## __" >>confdefs.h ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unsupported or unknown name-mangling scheme: $wssmp_namemangling" >&5 -$as_echo "$as_me: WARNING: Unsupported or unknown name-mangling scheme: $wssmp_namemangling" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Unsupported or unknown name-mangling scheme: $wssmp_namemangling" >&5 +printf "%s\n" "$as_me: WARNING: Unsupported or unknown name-mangling scheme: $wssmp_namemangling" >&2;} ;; esac IPOPTLIB_LFLAGS="$wsmp_lflags $IPOPTLIB_LFLAGS" -$as_echo "#define IPOPT_HAS_WSMP 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_WSMP 1" >>confdefs.h - else as_fn_error $? "Symbol wssmp not found with WSMP flags $wsmp_lflags." "$LINENO" 5 + else as_fn_error $? "Symbol wssmp not found with WSMP flags $wsmp_lflags. See config.log for details on failed checks." "$LINENO" 5 fi fi @@ -24622,24 +25569,26 @@ 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5 -$as_echo_n "checking size of int *... " >&6; } -if ${ac_cv_sizeof_int_p+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int *))" "ac_cv_sizeof_int_p" "$ac_includes_default"; then : - -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5 +printf %s "checking size of int *... " >&6; } +if test ${ac_cv_sizeof_int_p+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int *))" "ac_cv_sizeof_int_p" "$ac_includes_default" +then : + +else $as_nop if test "$ac_cv_type_int_p" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int *) See \`config.log' for more details" "$LINENO" 5; } else @@ -24648,20 +25597,18 @@ See \`config.log' for more details" "$LINENO" 5; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int_p" >&5 -$as_echo "$ac_cv_sizeof_int_p" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int_p" >&5 +printf "%s\n" "$ac_cv_sizeof_int_p" >&6; } -cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT_P $ac_cv_sizeof_int_p -_ACEOF +printf "%s\n" "#define SIZEOF_INT_P $ac_cv_sizeof_int_p" >>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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -24674,7 +25621,7 @@ case "$ac_cv_sizeof_int_p" in 8 | 8?) BITS_PER_POINTER=64 BIT32FCOMMENT='C' BIT64FCOMMENT='' ;; - *) as_fn_error $? "Unknown length of int *" "$LINENO" 5;; + *) as_fn_error $? "Unknown length of int*" "$LINENO" 5;; esac ############################################################################ @@ -24686,7 +25633,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 $LDFLAGS >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu @@ -24695,46 +25642,141 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ##################### - - for ac_header in cmath math.h + for ac_header in cmath math.h do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF break fi done - - for ac_header in cfloat float.h + for ac_header in cfloat float.h do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF break fi done - - for ac_header in cieeefp ieeefp.h + for ac_header in cieeefp ieeefp.h do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF break fi done +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX options needed to detect all undeclared functions" >&5 +printf %s "checking for $CXX options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_cxx_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_cxx_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef F77_DUMMY_MAIN + +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } + +#endif +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +#ifdef F77_DUMMY_MAIN + +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } + +#endif +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_cxx_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_cxx_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_cxx_undeclared_builtin_options" >&6; } + case $ac_cv_cxx_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CXX report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_cxx_undeclared_builtin_options='' ;; #( + *) : + ac_cxx_undeclared_builtin_options=$ac_cv_cxx_undeclared_builtin_options ;; +esac @@ -24744,8 +25786,8 @@ done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::isfinite" >&5 -$as_echo_n "checking for std::isfinite... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for std::isfinite" >&5 +printf %s "checking for std::isfinite... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24776,22 +25818,23 @@ $as_echo_n "checking for std::isfinite... " >&6; } return 0 ; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : COIN_C_FINITE=std::isfinite - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test -z "$COIN_C_FINITE"; then for fname in isfinite finite _finite ; do - as_ac_Symbol=`$as_echo "ac_cv_have_decl_$fname" | $as_tr_sh` -ac_fn_cxx_check_decl "$LINENO" "$fname" "$as_ac_Symbol" " + as_ac_Symbol=`printf "%s\n" "ac_cv_have_decl_$fname" | $as_tr_sh` +ac_fn_check_decl "$LINENO" "$fname" "$as_ac_Symbol" " #ifdef HAVE_CMATH # include #else @@ -24814,11 +25857,11 @@ ac_fn_cxx_check_decl "$LINENO" "$fname" "$as_ac_Symbol" " # endif #endif -" -if eval test \"x\$"$as_ac_Symbol"\" = x"yes"; then : +" "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" +if eval test \"x\$"$as_ac_Symbol"\" = x"yes" +then : COIN_C_FINITE=$fname fi - if test -n "$COIN_C_FINITE" ; then break fi @@ -24826,57 +25869,69 @@ fi fi if test -z "$COIN_C_FINITE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find C-function for checking Inf." >&5 -$as_echo "$as_me: WARNING: Cannot find C-function for checking Inf." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find C-function for checking Inf." >&5 +printf "%s\n" "$as_me: WARNING: Cannot find C-function for checking Inf." >&2;} else -cat >>confdefs.h <<_ACEOF -#define IPOPT_C_FINITE $COIN_C_FINITE -_ACEOF +printf "%s\n" "#define IPOPT_C_FINITE $COIN_C_FINITE" >>confdefs.h fi -########### -# va_copy # -########### +######################### +# va_copy and vsnprintf # +######################### -ac_fn_cxx_check_decl "$LINENO" "va_copy" "ac_cv_have_decl_va_copy" "#include -" -if test "x$ac_cv_have_decl_va_copy" = xyes; then : +ac_fn_check_decl "$LINENO" "va_copy" "ac_cv_have_decl_va_copy" "#include +" "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" +if test "x$ac_cv_have_decl_va_copy" = xyes +then : -$as_echo "#define IPOPT_HAS_VA_COPY 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_VA_COPY 1" >>confdefs.h fi + for ac_func in vsnprintf _vsnprintf +do : + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + break +fi + +done ########################### # Random number generator # ########################### -ac_fn_cxx_check_decl "$LINENO" "drand48" "ac_cv_have_decl_drand48" "#include -" -if test "x$ac_cv_have_decl_drand48" = xyes; then : +ac_fn_check_decl "$LINENO" "drand48" "ac_cv_have_decl_drand48" "#include +" "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" +if test "x$ac_cv_have_decl_drand48" = xyes +then : -$as_echo "#define IPOPT_HAS_DRAND48 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_DRAND48 1" >>confdefs.h fi +ac_fn_check_decl "$LINENO" "rand" "ac_cv_have_decl_rand" "#include +" "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" +if test "x$ac_cv_have_decl_rand" = xyes +then : -ac_fn_cxx_check_decl "$LINENO" "rand" "ac_cv_have_decl_rand" "#include -" -if test "x$ac_cv_have_decl_rand" = xyes; then : - -$as_echo "#define IPOPT_HAS_RAND 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_RAND 1" >>confdefs.h fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::srand" >&5 -$as_echo_n "checking for std::srand... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for std::srand" >&5 +printf %s "checking for std::srand... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -24885,35 +25940,48 @@ $as_echo_n "checking for std::srand... " >&6; } return 0 ; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : -$as_echo "#define IPOPT_HAS_STD__RAND 1" >>confdefs.h +printf "%s\n" "#define IPOPT_HAS_STD__RAND 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -########################################################################## +################## +# feenableexcept # +################## + +ac_fn_check_decl "$LINENO" "feenableexcept" "ac_cv_have_decl_feenableexcept" "#include +" "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" +if test "x$ac_cv_have_decl_feenableexcept" = xyes +then : + +printf "%s\n" "#define IPOPT_HAS_FEENABLEEXCEPT 1" >>confdefs.h + +fi ################################################### # Check if user wants inexact algorithm available # ################################################### # Check whether --enable-inexact-solver was given. -if test "${enable_inexact_solver+set}" = set; then : +if test ${enable_inexact_solver+y} +then : enableval=$enable_inexact_solver; case "$enableval" in no | yes) ;; *) as_fn_error $? "invalid argument for --enable-inexact-solver: $enableval" "$LINENO" 5;; esac use_inexact=$enableval -else +else $as_nop use_inexact=no fi @@ -24923,7 +25991,7 @@ if test $use_inexact = yes; then as_fn_error $? "The inexact solver option is currently only available with Pardiso from pardiso-project.org" "$LINENO" 5 fi -$as_echo "#define BUILD_INEXACT 1" >>confdefs.h +printf "%s\n" "#define BUILD_INEXACT 1" >>confdefs.h fi if test $use_inexact = yes; then @@ -24938,77 +26006,41 @@ 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 $LDFLAGS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -###################################### -# Equivalent int Fortran and C types # -###################################### - -# FIXME: The following test should be active, but this requires change in -# code to copy Index* to ipfint* arrays... -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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -$as_echo "#define IPOPT_FORTRAN_INTEGER_TYPE int" >>confdefs.h - -# AC_CHECK_SIZEOF([long]) -# AC_CHECK_SIZEOF([int]) -# AC_CHECK_SIZEOF([double]) -# AC_MSG_CHECKING([for C type corresponding to Fortran INTEGER]) -# if test $ac_cv_sizeof_long = $ac_cv_sizeof_double; then -# AC_DEFINE([IPOPT_FORTRAN_INTEGER_TYPE],[int],[Define to the C type corresponding to Fortran INTEGER]) -# AC_MSG_RESULT([int]) -# else -# AC_DEFINE([IPOPT_FORTRAN_INTEGER_TYPE],[long]) -# AC_MSG_RESULT([long]) -# 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 $LDFLAGS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: We are cross compiling, assuming Fortran 'INTEGER' type corresponds to C 'int' type" >&5 -$as_echo "$as_me: WARNING: We are cross compiling, assuming Fortran 'INTEGER' type corresponds to C 'int' type" >&2;} - $as_echo "#define IPOPT_FORTRAN_INTEGER_TYPE int" >>confdefs.h - -fi - -############# JAVA +######## +# Java # +######## # Check whether --enable-java was given. -if test "${enable_java+set}" = set; then : +if test ${enable_java+y} +then : enableval=$enable_java; enable_java="$enableval" -else +else $as_nop case "$JAVA_HOME" in *\ * ) enable_java=no ;; # do not enable java-check by default, if there are spaces in JAVA_HOME - that causes trouble * ) enable_java="$enable_shared" ;; esac - fi if test "$enable_java" != no ; then # look for javac: required to compile Java code and build C-header # this is a modified version of AX_PROG_JAVAC - if test "x$JAVAPREFIX" = x; then : + if test "x$JAVAPREFIX" = x +then : test "x$JAVAC" = x && for ac_prog in "gcj -C" guavac jikes javac do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAVAC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_JAVAC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$JAVAC"; then ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. else @@ -25016,11 +26048,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_JAVAC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -25031,27 +26067,28 @@ fi fi JAVAC=$ac_cv_prog_JAVAC if test -n "$JAVAC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5 -$as_echo "$JAVAC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5 +printf "%s\n" "$JAVAC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$JAVAC" && break done -else +else $as_nop test "x$JAVAC" = x && for ac_prog in "gcj -C" guavac jikes javac do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAVAC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_JAVAC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$JAVAC"; then ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. else @@ -25059,11 +26096,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $JAVAPREFIX/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_JAVAC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -25074,11 +26115,11 @@ fi fi JAVAC=$ac_cv_prog_JAVAC if test -n "$JAVAC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5 -$as_echo "$JAVAC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5 +printf "%s\n" "$JAVAC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -25088,21 +26129,22 @@ done fi if test -z "$JAVAC" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: No JAVA compiler. Disabling build of Java interface." >&5 -$as_echo "$as_me: No JAVA compiler. Disabling build of Java interface." >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No JAVA compiler. Disabling build of Java interface." >&5 +printf "%s\n" "$as_me: No JAVA compiler. Disabling build of Java interface." >&6;} enable_java=no else -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $JAVAC works" >&5 -$as_echo_n "checking if $JAVAC works... " >&6; } -if ${ac_cv_prog_javac_works+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $JAVAC works" >&5 +printf %s "checking if $JAVAC works... " >&6; } +if test ${ac_cv_prog_javac_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 25105 "configure" */ +/* #line 26147 "configure" */ public class Test { } EOF @@ -25110,7 +26152,7 @@ if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } >/dev/null 2>&1; then ac_cv_prog_javac_works=yes else @@ -25121,9 +26163,27 @@ fi rm -f $JAVA_TEST $CLASS_TEST fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_javac_works" >&5 -$as_echo "$ac_cv_prog_javac_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_javac_works" >&5 +printf "%s\n" "$ac_cv_prog_javac_works" >&6; } + + fi +fi +if test "$enable_java" != no ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if javac supports -h" >&5 +printf %s "checking if javac supports -h... " >&6; } + echo "public abstract class conftest { private native boolean test(); }" > conftest.java + printf "%s\n" "$as_me:${as_lineno-$LINENO}: $JAVAC conftest.java -h conftest.header" >&5 + "$JAVAC" conftest.java -h conftest.header >&5 + if test -e conftest.header/conftest.h ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + echo "configure: failed program was:" >&5 + cat conftest.java >&5 + enable_java=no fi fi @@ -25143,11 +26203,12 @@ else fi # Extract the first word of "$JAVAC", so it can be a program name with args. set dummy $JAVAC; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path__ACJNI_JAVAC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path__ACJNI_JAVAC+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $_ACJNI_JAVAC in [\\/]* | ?:[\\/]*) ac_cv_path__ACJNI_JAVAC="$_ACJNI_JAVAC" # Let the user override the test with a path. @@ -25157,11 +26218,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path__ACJNI_JAVAC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path__ACJNI_JAVAC="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -25174,11 +26239,11 @@ esac fi _ACJNI_JAVAC=$ac_cv_path__ACJNI_JAVAC if test -n "$_ACJNI_JAVAC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_ACJNI_JAVAC" >&5 -$as_echo "$_ACJNI_JAVAC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $_ACJNI_JAVAC" >&5 +printf "%s\n" "$_ACJNI_JAVAC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -25189,16 +26254,16 @@ fi # find the include directory relative to the javac executable _cur=""$_ACJNI_JAVAC"" while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking symlink for $_cur" >&5 -$as_echo_n "checking symlink for $_cur... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking symlink for $_cur" >&5 +printf %s "checking symlink for $_cur... " >&6; } _slink=`ls -ld "$_cur" | sed 's/.* -> //'` case "$_slink" in /*) _cur="$_slink";; # 'X' avoids triggering unwanted echo options. *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[^/]*$::'`"$_slink";; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_cur" >&5 -$as_echo "$_cur" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $_cur" >&5 +printf "%s\n" "$_cur" >&6; } done _ACJNI_FOLLOWED="$_cur" @@ -25207,28 +26272,35 @@ fi case "$host_os" in darwin*) # Apple Java headers are inside the Xcode bundle. - macos_version=$(sw_vers -productVersion | sed -n -e 's/^[0-9]*.\([0-9]*\).[0-9]*/\1/p') - if [ "$macos_version" -gt "7" ]; then - _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework" - _JINC="$_JTOPDIR/Headers" + major_macos_version=$(sw_vers -productVersion | sed -n -e 's/^\([0-9]*\).[0-9]*.[0-9]*/\1/p') + if [ "$major_macos_version" -gt "10" ]; then + _JTOPDIR="$(/usr/libexec/java_home)" + _JINC="$_JTOPDIR/include" else - _JTOPDIR="/System/Library/Frameworks/JavaVM.framework" - _JINC="$_JTOPDIR/Headers" + macos_version=$(sw_vers -productVersion | sed -n -e 's/^[0-9]*.\([0-9]*\).[0-9]*/\1/p') + if [ "$macos_version" -gt "7" ]; then + _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + else + _JTOPDIR="/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + fi fi ;; *) _JINC="$_JTOPDIR/include";; esac -$as_echo "$as_me:${as_lineno-$LINENO}: _JTOPDIR=$_JTOPDIR" >&5 -$as_echo "$as_me:${as_lineno-$LINENO}: _JINC=$_JINC" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: _JTOPDIR=$_JTOPDIR" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: _JINC=$_JINC" >&5 # On Mac OS X 10.6.4, jni.h is a symlink: # /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h # -> ../../CurrentJDK/Headers/jni.h. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking jni headers" >&5 -$as_echo_n "checking jni headers... " >&6; } -if ${ac_cv_jni_header_path+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking jni headers" >&5 +printf %s "checking jni headers... " >&6; } +if test ${ac_cv_jni_header_path+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -f "$_JINC/jni.h"; then ac_cv_jni_header_path="$_JINC" @@ -25244,8 +26316,8 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_jni_header_path" >&5 -$as_echo "$ac_cv_jni_header_path" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_jni_header_path" >&5 +printf "%s\n" "$ac_cv_jni_header_path" >&6; } # get the likely subdirectories for system specific java includes case "$host_os" in @@ -25271,8 +26343,8 @@ if test "x$ac_cv_jni_header_path" != "xnone"; then fi if test -z "$JNI_INCLUDE_DIRS" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: No JNI header directory. Disabling build of Java interface." >&5 -$as_echo "$as_me: No JNI header directory. Disabling build of Java interface." >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No JNI header directory. Disabling build of Java interface." >&5 +printf "%s\n" "$as_me: No JNI header directory. Disabling build of Java interface." >&6;} enable_java=no else for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS ; do @@ -25282,21 +26354,19 @@ $as_echo "$as_me: No JNI header directory. Disabling build of Java interface." > fi if test "$enable_java" != no ; then - # the following macros can make configure stop with an error - # we could work around that, but having javac and no jar, java, or javadoc would be odd anyway - # look for jar: required to pack Java interface - -if test "x$JAVAPREFIX" = x; then : + if test "x$JAVAPREFIX" = x +then : test "x$JAR" = x && for ac_prog in jar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_JAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$JAR"; then ac_cv_prog_JAR="$JAR" # Let the user override the test. else @@ -25304,11 +26374,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_JAR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -25319,27 +26393,28 @@ fi fi JAR=$ac_cv_prog_JAR if test -n "$JAR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5 -$as_echo "$JAR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5 +printf "%s\n" "$JAR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$JAR" && break done -else +else $as_nop test "x$JAR" = x && for ac_prog in jar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_JAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$JAR"; then ac_cv_prog_JAR="$JAR" # Let the user override the test. else @@ -25347,11 +26422,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $JAVAPREFIX/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_JAR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -25362,11 +26441,11 @@ fi fi JAR=$ac_cv_prog_JAR if test -n "$JAR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5 -$as_echo "$JAR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5 +printf "%s\n" "$JAR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -25374,75 +26453,43 @@ fi done fi -test "x$JAR" = x && as_fn_error $? "no acceptable jar program found in \$PATH" "$LINENO" 5 - - # look for more java to run tests and examples and do documentation - -if test "x$JAVAPREFIX" = x; then : - test x$JAVA = x && for ac_prog in kaffe java -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAVA+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$JAVA"; then - ac_cv_prog_JAVA="$JAVA" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_JAVA="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + if test -z "$JAR" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: JAVA compiler found, but no acceptable jar program found in \$PATH. Disabling build of Java interface." >&5 +printf "%s\n" "$as_me: WARNING: JAVA compiler found, but no acceptable jar program found in \$PATH. Disabling build of Java interface." >&2;} + enable_java=no fi -done - done -IFS=$as_save_IFS - -fi -fi -JAVA=$ac_cv_prog_JAVA -if test -n "$JAVA"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5 -$as_echo "$JAVA" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } fi - - test -n "$JAVA" && break -done - -else +if test "$enable_java" != no ; then + # look for java to run tests, but skip check whether java works (so just the test may fail) + if test "x$JAVAPREFIX" = x +then : test x$JAVA = x && for ac_prog in kaffe java do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAVA+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_JAVA+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$JAVA"; then ac_cv_prog_JAVA="$JAVA" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $JAVAPREFIX/bin +for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_JAVA="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -25453,90 +26500,44 @@ fi fi JAVA=$ac_cv_prog_JAVA if test -n "$JAVA"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5 -$as_echo "$JAVA" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5 +printf "%s\n" "$JAVA" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$JAVA" && break done - -fi -test x$JAVA = x && as_fn_error $? "no acceptable Java virtual machine found in \$PATH" "$LINENO" 5 - - if test x$ac_cv_prog_javac_works = xno; then - as_fn_error $? "Cannot compile java source. $JAVAC does not work properly" "$LINENO" 5 - fi - if test x$ac_cv_prog_javac_works = x; then - -if test "x$JAVAPREFIX" = x; then : - test "x$JAVAC" = x && for ac_prog in "gcj -C" guavac jikes javac -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAVAC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$JAVAC"; then - ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_JAVAC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -JAVAC=$ac_cv_prog_JAVAC -if test -n "$JAVAC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5 -$as_echo "$JAVAC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$JAVAC" && break -done - -else - test "x$JAVAC" = x && for ac_prog in "gcj -C" guavac jikes javac + +else $as_nop + test x$JAVA = x && for ac_prog in kaffe java do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAVAC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$JAVAC"; then - ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_JAVA+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$JAVA"; then + ac_cv_prog_JAVA="$JAVA" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $JAVAPREFIX/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_JAVAC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_JAVA="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -25545,114 +26546,38 @@ IFS=$as_save_IFS fi fi -JAVAC=$ac_cv_prog_JAVAC -if test -n "$JAVAC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5 -$as_echo "$JAVAC" >&6; } +JAVA=$ac_cv_prog_JAVA +if test -n "$JAVA"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5 +printf "%s\n" "$JAVA" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi - test -n "$JAVAC" && break + test -n "$JAVA" && break done fi -test "x$JAVAC" = x && as_fn_error $? "no acceptable Java compiler found in \$PATH" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $JAVAC works" >&5 -$as_echo_n "checking if $JAVAC works... " >&6; } -if ${ac_cv_prog_javac_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - -JAVA_TEST=Test.java -CLASS_TEST=Test.class -cat << \EOF > $JAVA_TEST -/* #line 25573 "configure" */ -public class Test { -} -EOF -if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } >/dev/null 2>&1; then - ac_cv_prog_javac_works=yes -else - as_fn_error $? "The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" "$LINENO" 5 - echo "configure: failed program was:" >&5 - cat $JAVA_TEST >&5 -fi -rm -f $JAVA_TEST $CLASS_TEST - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_javac_works" >&5 -$as_echo "$ac_cv_prog_javac_works" >&6; } - - - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $JAVA works" >&5 -$as_echo_n "checking if $JAVA works... " >&6; } -if ${ac_cv_prog_java_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - -JAVA_TEST=Test.java -CLASS_TEST=Test.class -TEST=Test -cat << \EOF > $JAVA_TEST -/* [#]line 25607 "configure" */ -public class Test { -public static void main (String args[]) { - System.exit (0); -} } -EOF - if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } && test -s $CLASS_TEST; then - : - else - echo "configure: failed program was:" >&5 - cat $JAVA_TEST >&5 - as_fn_error $? "The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" "$LINENO" 5 - fi -if { ac_try='$JAVA -classpath . $JAVAFLAGS $TEST' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } >/dev/null 2>&1; then - ac_cv_prog_java_works=yes -else - echo "configure: failed program was:" >&5 - cat $JAVA_TEST >&5 - as_fn_error $? "The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" "$LINENO" 5 -fi -rm -f $JAVA_TEST $CLASS_TEST - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_java_works" >&5 -$as_echo "$ac_cv_prog_java_works" >&6; } - - - + if test -z "$JAVA" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: JAVA compiler found, but no acceptable JAVA executable found in \$PATH. Disabling tests of Java interface. Java example will not run." >&5 +printf "%s\n" "$as_me: WARNING: JAVA compiler found, but no acceptable JAVA executable found in \$PATH. Disabling tests of Java interface. Java example will not run." >&2;} + fi -if test "x$JAVAPREFIX" = x; then : + # look for javadoc to build documentation + if test "x$JAVAPREFIX" = x +then : test "x$JAVADOC" = x && for ac_prog in javadoc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAVADOC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_JAVADOC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$JAVADOC"; then ac_cv_prog_JAVADOC="$JAVADOC" # Let the user override the test. else @@ -25660,11 +26585,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_JAVADOC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -25675,27 +26604,28 @@ fi fi JAVADOC=$ac_cv_prog_JAVADOC if test -n "$JAVADOC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVADOC" >&5 -$as_echo "$JAVADOC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAVADOC" >&5 +printf "%s\n" "$JAVADOC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$JAVADOC" && break done -else +else $as_nop test "x$JAVADOC" = x && for ac_prog in javadoc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_JAVADOC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_JAVADOC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$JAVADOC"; then ac_cv_prog_JAVADOC="$JAVADOC" # Let the user override the test. else @@ -25703,11 +26633,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $JAVAPREFIX/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_JAVADOC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -25718,11 +26652,11 @@ fi fi JAVADOC=$ac_cv_prog_JAVADOC if test -n "$JAVADOC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVADOC" >&5 -$as_echo "$JAVADOC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $JAVADOC" >&5 +printf "%s\n" "$JAVADOC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -25730,8 +26664,10 @@ fi done fi -test "x$JAVADOC" = x && as_fn_error $? "no acceptable javadoc generator found in \$PATH" "$LINENO" 5 - + if test -z "$JAVADOC" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: JAVA compiler found, but no javadoc found in \$PATH. Building the Java documentation (make javadoc) will fail." >&5 +printf "%s\n" "$as_me: WARNING: JAVA compiler found, but no javadoc found in \$PATH. Building the Java documentation (make javadoc) will fail." >&2;} + fi fi if test "$enable_java" != no; then @@ -25743,90 +26679,46 @@ else fi -######################### -# Makefile conditionals # -######################### - -# The following variable collects the names of libraries that should -# be included into libipopt.a (relative to subdir Interfaces, where it -# is made) - - -IPALLLIBS="../contrib/CGPenalty/libcgpenalty.la ../Algorithm/libipoptalg.la ../Algorithm/LinearSolvers/liblinsolvers.la ../Common/libcommon.la ../LinAlg/liblinalg.la ../LinAlg/TMatrices/libtmatrices.la" - - if test $use_inexact = yes; then - BUILD_INEXACT_TRUE= - BUILD_INEXACT_FALSE='#' -else - BUILD_INEXACT_TRUE='#' - BUILD_INEXACT_FALSE= -fi - -if test $use_inexact = yes; then - IPALLLIBS="../Algorithm/Inexact/libinexact.la $IPALLLIBS" -fi - ######################################################################## ## Linear solver loader ## ######################################################################## # Check whether --enable-linear-solver-loader was given. -if test "${enable_linear_solver_loader+set}" = set; then : +if test ${enable_linear_solver_loader+y} +then : enableval=$enable_linear_solver_loader; case "$enableval" in no | yes) ;; *) as_fn_error $? "invalid argument for --enable-linear-solver-loader: $enableval" "$LINENO" 5;; esac use_linearsolverloader=$enableval -else +else $as_nop use_linearsolverloader=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linear solver loader should be compiled" >&5 -$as_echo_n "checking whether the linear solver loader should be compiled... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_linearsolverloader" >&5 -$as_echo "$use_linearsolverloader" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linear solver loader should be used" >&5 +printf %s "checking whether the linear solver loader should be used... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_linearsolverloader" >&5 +printf "%s\n" "$use_linearsolverloader" >&6; } if test $use_linearsolverloader = yes; then -$as_echo "#define IPOPT_HAS_LINEARSOLVERLOADER 1" >>confdefs.h - - IPALLLIBS="../contrib/LinearSolverLoader/libLinearSolverLoader.la $IPALLLIBS" -fi - - if test $use_linearsolverloader = yes; then - BUILD_LINEARSOLVERLOADER_TRUE= - BUILD_LINEARSOLVERLOADER_FALSE='#' -else - BUILD_LINEARSOLVERLOADER_TRUE='#' - BUILD_LINEARSOLVERLOADER_FALSE= -fi +printf "%s\n" "#define IPOPT_HAS_LINEARSOLVERLOADER 1" >>confdefs.h -ac_ext=c + 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&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" -if test "x$ac_cv_header_windows_h" = xyes; then : - -fi - - -ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -25835,9 +26727,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); #ifdef F77_DUMMY_MAIN @@ -25848,72 +26737,61 @@ char dlopen (); #endif int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dl_dlopen=yes -else +else $as_nop ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : IPOPTLIB_LFLAGS="$IPOPTLIB_LFLAGS -ldl" fi -for ac_func in snprintf _snprintf -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - break -fi -done - -for ac_func in vsnprintf _vsnprintf -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - break -fi -done - -ac_ext=c + 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 $LDFLAGS >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +fi + +ac_fn_c_check_header_compile "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" +if test "x$ac_cv_header_windows_h" = xyes +then : + +printf "%s\n" "#define HAVE_WINDOWS_H 1" >>confdefs.h + +fi + ######################################################################## ## sIpopt ## ######################################################################## # Check whether --enable-sipopt was given. -if test "${enable_sipopt+set}" = set; then : +if test ${enable_sipopt+y} +then : enableval=$enable_sipopt; case "$enableval" in no | yes) ;; *) as_fn_error $? "invalid argument for --enable-sipopt: $enableval" "$LINENO" 5;; esac use_sipopt=$enableval -else +else $as_nop use_sipopt=yes fi @@ -26092,10 +26970,16 @@ fi if test "$enable_java" != no ; then + case $precision in + single ) + ac_config_links="$ac_config_links examples/hs071_java/HS071s.java:examples/hs071_java/HS071s.java" + ;; + double ) ac_config_links="$ac_config_links examples/hs071_java/HS071.java:examples/hs071_java/HS071.java" - + ;; + esac fi @@ -26240,10 +27124,11 @@ fi ## Create Makefiles and other stuff ## ######################################################################## +# the SIpoptLib is here to get SIPOPTLIB_EXPORT if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: FINALIZE_FLAGS for IpoptLib:" >&5 -$as_echo "$as_me: FINALIZE_FLAGS for IpoptLib:" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: FINALIZE_FLAGS for IpoptLib:" >&5 +printf "%s\n" "$as_me: FINALIZE_FLAGS for IpoptLib:" >&6;} fi IPOPTLIB_LFLAGS_NOPC=$IPOPTLIB_LFLAGS @@ -26251,7 +27136,7 @@ $as_echo "$as_me: FINALIZE_FLAGS for IpoptLib:" >&6;} if test -n "${IPOPTLIB_PCFILES}" ; then temp_CFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --cflags ${IPOPTLIB_PCFILES}` - temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs ${IPOPTLIB_PCFILES}` + temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $pkg_static ${IPOPTLIB_PCFILES}` IPOPTLIB_CFLAGS="$temp_CFLAGS ${IPOPTLIB_CFLAGS}" IPOPTLIB_LFLAGS="$temp_LFLAGS ${IPOPTLIB_LFLAGS}" fi @@ -26269,31 +27154,28 @@ $as_echo "$as_me: FINALIZE_FLAGS for IpoptLib:" >&6;} esac fi -cat >>confdefs.h <<_ACEOF -#define IPOPTLIB_EXPORT $libexport_attribute -_ACEOF +printf "%s\n" "#define IPOPTLIB_EXPORT $libexport_attribute" >>confdefs.h # add -DXYZ_BUILD to XYZ_CFLAGS IPOPTLIB_CFLAGS="${IPOPTLIB_CFLAGS} -DIPOPTLIB_BUILD" -# Define BUILDTOOLS_DEBUG to enable debugging output - + # Define BUILDTOOLS_DEBUG to enable debugging output if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: IPOPTLIB_LFLAGS_NOPC: \"${IPOPTLIB_LFLAGS_NOPC}\"" >&5 -$as_echo "$as_me: IPOPTLIB_LFLAGS_NOPC: \"${IPOPTLIB_LFLAGS_NOPC}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: IPOPTLIB_CFLAGS_NOPC: \"${IPOPTLIB_CFLAGS_NOPC}\"" >&5 -$as_echo "$as_me: IPOPTLIB_CFLAGS_NOPC: \"${IPOPTLIB_CFLAGS_NOPC}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: adding \"${IPOPTLIB_PCFILES}\"" >&5 -$as_echo "$as_me: adding \"${IPOPTLIB_PCFILES}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: IPOPTLIB_LFLAGS: \"${IPOPTLIB_LFLAGS}\"" >&5 -$as_echo "$as_me: IPOPTLIB_LFLAGS: \"${IPOPTLIB_LFLAGS}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: IPOPTLIB_CFLAGS: \"${IPOPTLIB_CFLAGS}\"" >&5 -$as_echo "$as_me: IPOPTLIB_CFLAGS: \"${IPOPTLIB_CFLAGS}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: IPOPTLIB_LFLAGS_NOPC: \"${IPOPTLIB_LFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: IPOPTLIB_LFLAGS_NOPC: \"${IPOPTLIB_LFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: IPOPTLIB_CFLAGS_NOPC: \"${IPOPTLIB_CFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: IPOPTLIB_CFLAGS_NOPC: \"${IPOPTLIB_CFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: adding \"${IPOPTLIB_PCFILES}\"" >&5 +printf "%s\n" "$as_me: adding \"${IPOPTLIB_PCFILES}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: IPOPTLIB_LFLAGS: \"${IPOPTLIB_LFLAGS}\"" >&5 +printf "%s\n" "$as_me: IPOPTLIB_LFLAGS: \"${IPOPTLIB_LFLAGS}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: IPOPTLIB_CFLAGS: \"${IPOPTLIB_CFLAGS}\"" >&5 +printf "%s\n" "$as_me: IPOPTLIB_CFLAGS: \"${IPOPTLIB_CFLAGS}\"" >&6;} fi if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: FINALIZE_FLAGS for IpoptAmplInterfaceLib:" >&5 -$as_echo "$as_me: FINALIZE_FLAGS for IpoptAmplInterfaceLib:" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: FINALIZE_FLAGS for IpoptAmplInterfaceLib:" >&5 +printf "%s\n" "$as_me: FINALIZE_FLAGS for IpoptAmplInterfaceLib:" >&6;} fi IPOPTAMPLINTERFACELIB_LFLAGS_NOPC=$IPOPTAMPLINTERFACELIB_LFLAGS @@ -26301,7 +27183,7 @@ $as_echo "$as_me: FINALIZE_FLAGS for IpoptAmplInterfaceLib:" >&6;} if test -n "${IPOPTAMPLINTERFACELIB_PCFILES}" ; then temp_CFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --cflags ${IPOPTAMPLINTERFACELIB_PCFILES}` - temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs ${IPOPTAMPLINTERFACELIB_PCFILES}` + temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $pkg_static ${IPOPTAMPLINTERFACELIB_PCFILES}` IPOPTAMPLINTERFACELIB_CFLAGS="$temp_CFLAGS ${IPOPTAMPLINTERFACELIB_CFLAGS}" IPOPTAMPLINTERFACELIB_LFLAGS="$temp_LFLAGS ${IPOPTAMPLINTERFACELIB_LFLAGS}" fi @@ -26319,31 +27201,75 @@ $as_echo "$as_me: FINALIZE_FLAGS for IpoptAmplInterfaceLib:" >&6;} esac fi -cat >>confdefs.h <<_ACEOF -#define IPOPTAMPLINTERFACELIB_EXPORT $libexport_attribute -_ACEOF +printf "%s\n" "#define IPOPTAMPLINTERFACELIB_EXPORT $libexport_attribute" >>confdefs.h # add -DXYZ_BUILD to XYZ_CFLAGS IPOPTAMPLINTERFACELIB_CFLAGS="${IPOPTAMPLINTERFACELIB_CFLAGS} -DIPOPTAMPLINTERFACELIB_BUILD" -# Define BUILDTOOLS_DEBUG to enable debugging output + # Define BUILDTOOLS_DEBUG to enable debugging output + if test "$BUILDTOOLS_DEBUG" = 1 ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: IPOPTAMPLINTERFACELIB_LFLAGS_NOPC: \"${IPOPTAMPLINTERFACELIB_LFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: IPOPTAMPLINTERFACELIB_LFLAGS_NOPC: \"${IPOPTAMPLINTERFACELIB_LFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: IPOPTAMPLINTERFACELIB_CFLAGS_NOPC: \"${IPOPTAMPLINTERFACELIB_CFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: IPOPTAMPLINTERFACELIB_CFLAGS_NOPC: \"${IPOPTAMPLINTERFACELIB_CFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: adding \"${IPOPTAMPLINTERFACELIB_PCFILES}\"" >&5 +printf "%s\n" "$as_me: adding \"${IPOPTAMPLINTERFACELIB_PCFILES}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: IPOPTAMPLINTERFACELIB_LFLAGS: \"${IPOPTAMPLINTERFACELIB_LFLAGS}\"" >&5 +printf "%s\n" "$as_me: IPOPTAMPLINTERFACELIB_LFLAGS: \"${IPOPTAMPLINTERFACELIB_LFLAGS}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: IPOPTAMPLINTERFACELIB_CFLAGS: \"${IPOPTAMPLINTERFACELIB_CFLAGS}\"" >&5 +printf "%s\n" "$as_me: IPOPTAMPLINTERFACELIB_CFLAGS: \"${IPOPTAMPLINTERFACELIB_CFLAGS}\"" >&6;} + fi + if test "$BUILDTOOLS_DEBUG" = 1 ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: FINALIZE_FLAGS for SIpoptLib:" >&5 +printf "%s\n" "$as_me: FINALIZE_FLAGS for SIpoptLib:" >&6;} + fi + SIPOPTLIB_LFLAGS_NOPC=$SIPOPTLIB_LFLAGS + + SIPOPTLIB_CFLAGS_NOPC=$SIPOPTLIB_CFLAGS + + if test -n "${SIPOPTLIB_PCFILES}" ; then + temp_CFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --cflags ${SIPOPTLIB_PCFILES}` + temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $pkg_static ${SIPOPTLIB_PCFILES}` + SIPOPTLIB_CFLAGS="$temp_CFLAGS ${SIPOPTLIB_CFLAGS}" + SIPOPTLIB_LFLAGS="$temp_LFLAGS ${SIPOPTLIB_LFLAGS}" + fi + + # setup XYZ_EXPORT symbol for library users + libexport_attribute= + if test "$enable_shared" = yes ; then + case $build_os in + cygwin* | mingw* | msys* | cegcc* ) + libexport_attribute="__declspec(dllimport)" + if test "$enable_static" = yes ; then + as_fn_error $? "Cannot do DLL and static LIB builds simultaneously. Do not add --enable-static without --disable-shared." "$LINENO" 5 + fi + ;; + esac + fi + +printf "%s\n" "#define SIPOPTLIB_EXPORT $libexport_attribute" >>confdefs.h + + + # add -DXYZ_BUILD to XYZ_CFLAGS + SIPOPTLIB_CFLAGS="${SIPOPTLIB_CFLAGS} -DSIPOPTLIB_BUILD" + # Define BUILDTOOLS_DEBUG to enable debugging output if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: IPOPTAMPLINTERFACELIB_LFLAGS_NOPC: \"${IPOPTAMPLINTERFACELIB_LFLAGS_NOPC}\"" >&5 -$as_echo "$as_me: IPOPTAMPLINTERFACELIB_LFLAGS_NOPC: \"${IPOPTAMPLINTERFACELIB_LFLAGS_NOPC}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: IPOPTAMPLINTERFACELIB_CFLAGS_NOPC: \"${IPOPTAMPLINTERFACELIB_CFLAGS_NOPC}\"" >&5 -$as_echo "$as_me: IPOPTAMPLINTERFACELIB_CFLAGS_NOPC: \"${IPOPTAMPLINTERFACELIB_CFLAGS_NOPC}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: adding \"${IPOPTAMPLINTERFACELIB_PCFILES}\"" >&5 -$as_echo "$as_me: adding \"${IPOPTAMPLINTERFACELIB_PCFILES}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: IPOPTAMPLINTERFACELIB_LFLAGS: \"${IPOPTAMPLINTERFACELIB_LFLAGS}\"" >&5 -$as_echo "$as_me: IPOPTAMPLINTERFACELIB_LFLAGS: \"${IPOPTAMPLINTERFACELIB_LFLAGS}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: IPOPTAMPLINTERFACELIB_CFLAGS: \"${IPOPTAMPLINTERFACELIB_CFLAGS}\"" >&5 -$as_echo "$as_me: IPOPTAMPLINTERFACELIB_CFLAGS: \"${IPOPTAMPLINTERFACELIB_CFLAGS}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: SIPOPTLIB_LFLAGS_NOPC: \"${SIPOPTLIB_LFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: SIPOPTLIB_LFLAGS_NOPC: \"${SIPOPTLIB_LFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: SIPOPTLIB_CFLAGS_NOPC: \"${SIPOPTLIB_CFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: SIPOPTLIB_CFLAGS_NOPC: \"${SIPOPTLIB_CFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: adding \"${SIPOPTLIB_PCFILES}\"" >&5 +printf "%s\n" "$as_me: adding \"${SIPOPTLIB_PCFILES}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: SIPOPTLIB_LFLAGS: \"${SIPOPTLIB_LFLAGS}\"" >&5 +printf "%s\n" "$as_me: SIPOPTLIB_LFLAGS: \"${SIPOPTLIB_LFLAGS}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: SIPOPTLIB_CFLAGS: \"${SIPOPTLIB_CFLAGS}\"" >&5 +printf "%s\n" "$as_me: SIPOPTLIB_CFLAGS: \"${SIPOPTLIB_CFLAGS}\"" >&6;} fi if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: FINALIZE_FLAGS for SIpoptAmplInterfaceLib:" >&5 -$as_echo "$as_me: FINALIZE_FLAGS for SIpoptAmplInterfaceLib:" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: FINALIZE_FLAGS for SIpoptAmplInterfaceLib:" >&5 +printf "%s\n" "$as_me: FINALIZE_FLAGS for SIpoptAmplInterfaceLib:" >&6;} fi SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC=$SIPOPTAMPLINTERFACELIB_LFLAGS @@ -26351,7 +27277,7 @@ $as_echo "$as_me: FINALIZE_FLAGS for SIpoptAmplInterfaceLib:" >&6;} if test -n "${SIPOPTAMPLINTERFACELIB_PCFILES}" ; then temp_CFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --cflags ${SIPOPTAMPLINTERFACELIB_PCFILES}` - temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs ${SIPOPTAMPLINTERFACELIB_PCFILES}` + temp_LFLAGS=`PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" $PKG_CONFIG --libs $pkg_static ${SIPOPTAMPLINTERFACELIB_PCFILES}` SIPOPTAMPLINTERFACELIB_CFLAGS="$temp_CFLAGS ${SIPOPTAMPLINTERFACELIB_CFLAGS}" SIPOPTAMPLINTERFACELIB_LFLAGS="$temp_LFLAGS ${SIPOPTAMPLINTERFACELIB_LFLAGS}" fi @@ -26369,37 +27295,44 @@ $as_echo "$as_me: FINALIZE_FLAGS for SIpoptAmplInterfaceLib:" >&6;} esac fi -cat >>confdefs.h <<_ACEOF -#define SIPOPTAMPLINTERFACELIB_EXPORT $libexport_attribute -_ACEOF +printf "%s\n" "#define SIPOPTAMPLINTERFACELIB_EXPORT $libexport_attribute" >>confdefs.h # add -DXYZ_BUILD to XYZ_CFLAGS SIPOPTAMPLINTERFACELIB_CFLAGS="${SIPOPTAMPLINTERFACELIB_CFLAGS} -DSIPOPTAMPLINTERFACELIB_BUILD" -# Define BUILDTOOLS_DEBUG to enable debugging output - + # Define BUILDTOOLS_DEBUG to enable debugging output if test "$BUILDTOOLS_DEBUG" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC: \"${SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC}\"" >&5 -$as_echo "$as_me: SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC: \"${SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC: \"${SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC}\"" >&5 -$as_echo "$as_me: SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC: \"${SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: adding \"${SIPOPTAMPLINTERFACELIB_PCFILES}\"" >&5 -$as_echo "$as_me: adding \"${SIPOPTAMPLINTERFACELIB_PCFILES}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: SIPOPTAMPLINTERFACELIB_LFLAGS: \"${SIPOPTAMPLINTERFACELIB_LFLAGS}\"" >&5 -$as_echo "$as_me: SIPOPTAMPLINTERFACELIB_LFLAGS: \"${SIPOPTAMPLINTERFACELIB_LFLAGS}\"" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: SIPOPTAMPLINTERFACELIB_CFLAGS: \"${SIPOPTAMPLINTERFACELIB_CFLAGS}\"" >&5 -$as_echo "$as_me: SIPOPTAMPLINTERFACELIB_CFLAGS: \"${SIPOPTAMPLINTERFACELIB_CFLAGS}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC: \"${SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC: \"${SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC: \"${SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC}\"" >&5 +printf "%s\n" "$as_me: SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC: \"${SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: adding \"${SIPOPTAMPLINTERFACELIB_PCFILES}\"" >&5 +printf "%s\n" "$as_me: adding \"${SIPOPTAMPLINTERFACELIB_PCFILES}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: SIPOPTAMPLINTERFACELIB_LFLAGS: \"${SIPOPTAMPLINTERFACELIB_LFLAGS}\"" >&5 +printf "%s\n" "$as_me: SIPOPTAMPLINTERFACELIB_LFLAGS: \"${SIPOPTAMPLINTERFACELIB_LFLAGS}\"" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: SIPOPTAMPLINTERFACELIB_CFLAGS: \"${SIPOPTAMPLINTERFACELIB_CFLAGS}\"" >&5 +printf "%s\n" "$as_me: SIPOPTAMPLINTERFACELIB_CFLAGS: \"${SIPOPTAMPLINTERFACELIB_CFLAGS}\"" >&6;} fi -ac_config_files="$ac_config_files Makefile src/Common/Makefile src/LinAlg/Makefile src/LinAlg/TMatrices/Makefile src/Interfaces/Makefile src/Algorithm/Makefile src/Algorithm/LinearSolvers/Makefile src/Algorithm/Inexact/Makefile src/contrib/CGPenalty/Makefile src/contrib/LinearSolverLoader/Makefile src/Apps/Makefile src/Apps/AmplSolver/Makefile test/Makefile test/run_unitTests ipopt.pc doc/Doxyfile examples/Cpp_example/Makefile examples/hs071_cpp/Makefile examples/hs071_c/Makefile examples/ScalableProblems/Makefile tutorial/CodingExercise/C/1-skeleton/Makefile tutorial/CodingExercise/C/2-mistake/Makefile tutorial/CodingExercise/C/3-solution/Makefile tutorial/CodingExercise/Cpp/1-skeleton/Makefile tutorial/CodingExercise/Cpp/2-mistake/Makefile tutorial/CodingExercise/Cpp/3-solution/Makefile tutorial/CodingExercise/Matlab/1-skeleton/startup.m tutorial/CodingExercise/Matlab/2-mistake/startup.m tutorial/CodingExercise/Matlab/3-solution/startup.m" +ac_config_files="$ac_config_files Makefile src/ipopt.pc src/Makefile src/Apps/AmplSolver/Makefile src/Apps/AmplSolver/ipoptamplinterface.pc test/Makefile test/run_unitTests doc/Doxyfile examples/Cpp_example/Makefile examples/recursive_nlp/Makefile examples/hs071_cpp/Makefile examples/hs071_c/Makefile examples/ScalableProblems/Makefile tutorial/CodingExercise/C/1-skeleton/Makefile tutorial/CodingExercise/C/2-mistake/Makefile tutorial/CodingExercise/C/3-solution/Makefile tutorial/CodingExercise/Cpp/1-skeleton/Makefile tutorial/CodingExercise/Cpp/2-mistake/Makefile tutorial/CodingExercise/Cpp/3-solution/Makefile tutorial/CodingExercise/Matlab/1-skeleton/startup.m tutorial/CodingExercise/Matlab/2-mistake/startup.m tutorial/CodingExercise/Matlab/3-solution/startup.m" if test -n "$F77" ; then - ac_config_files="$ac_config_files examples/hs071_f/hs071_f.f examples/hs071_f/Makefile tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f tutorial/CodingExercise/Fortran/1-skeleton/Makefile tutorial/CodingExercise/Fortran/2-mistake/Makefile tutorial/CodingExercise/Fortran/3-solution/Makefile" + ac_config_files="$ac_config_files examples/hs071_f/Makefile" + + case $precision in + single ) + ac_config_files="$ac_config_files examples/hs071_f/hs071_fs.f" + + ;; + double ) + ac_config_files="$ac_config_files examples/hs071_f/hs071_f.f tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f tutorial/CodingExercise/Fortran/1-skeleton/Makefile tutorial/CodingExercise/Fortran/2-mistake/Makefile tutorial/CodingExercise/Fortran/3-solution/Makefile" + ;; + esac fi if test "$enable_java" != no ; then @@ -26412,7 +27345,6 @@ if test "$use_sipopt" = yes ; then fi - # under Windows, the Makevars file for the R Interface need to be named Makevars.win case $build in *-cygwin* | *-mingw* | *-msys* ) @@ -26425,11 +27357,6 @@ case $build in ;; esac -if test $coin_has_asl = yes ; then - ac_config_files="$ac_config_files ipoptamplinterface.pc:src/Apps/AmplSolver/ipoptamplinterface.pc.in" - -fi - ac_config_headers="$ac_config_headers src/Common/config.h src/Common/config_ipopt.h" @@ -26461,8 +27388,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -26492,15 +27419,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -26514,8 +27441,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -26532,7 +27459,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -26543,18 +27470,18 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs -if test -z "${ALWAYS_FALSE_TRUE}" && test -z "${ALWAYS_FALSE_FALSE}"; then - as_fn_error $? "conditional \"ALWAYS_FALSE\" was never defined. +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -26563,10 +27490,6 @@ else am__EXEEXT_FALSE= fi -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${COIN_RELOCATABLE_TRUE}" && test -z "${COIN_RELOCATABLE_FALSE}"; then as_fn_error $? "conditional \"COIN_RELOCATABLE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -26587,6 +27510,10 @@ if test -z "${COIN_HAS_F77_TRUE}" && test -z "${COIN_HAS_F77_FALSE}"; then as_fn_error $? "conditional \"COIN_HAS_F77\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${COIN_STATIC_BUILD_TRUE}" && test -z "${COIN_STATIC_BUILD_FALSE}"; then + as_fn_error $? "conditional \"COIN_STATIC_BUILD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${COIN_HAS_DOXYGEN_TRUE}" && test -z "${COIN_HAS_DOXYGEN_FALSE}"; then as_fn_error $? "conditional \"COIN_HAS_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -26595,6 +27522,14 @@ if test -z "${COIN_HAS_LATEX_TRUE}" && test -z "${COIN_HAS_LATEX_FALSE}"; then as_fn_error $? "conditional \"COIN_HAS_LATEX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${IPOPT_SINGLE_TRUE}" && test -z "${IPOPT_SINGLE_FALSE}"; then + as_fn_error $? "conditional \"IPOPT_SINGLE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${IPOPT_INT64_TRUE}" && test -z "${IPOPT_INT64_FALSE}"; then + as_fn_error $? "conditional \"IPOPT_INT64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${COIN_HAS_PKGCONFIG_TRUE}" && test -z "${COIN_HAS_PKGCONFIG_FALSE}"; then as_fn_error $? "conditional \"COIN_HAS_PKGCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -26607,6 +27542,10 @@ if test -z "${COIN_HAS_ASL_TRUE}" && test -z "${COIN_HAS_ASL_FALSE}"; then as_fn_error $? "conditional \"COIN_HAS_ASL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${COIN_HAS_ASL_TRUE}" && test -z "${COIN_HAS_ASL_FALSE}"; then + as_fn_error $? "conditional \"COIN_HAS_ASL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${COIN_HAS_MUMPS_TRUE}" && test -z "${COIN_HAS_MUMPS_FALSE}"; then as_fn_error $? "conditional \"COIN_HAS_MUMPS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -26615,32 +27554,36 @@ if test -z "${COIN_HAS_HSL_TRUE}" && test -z "${COIN_HAS_HSL_FALSE}"; then as_fn_error $? "conditional \"COIN_HAS_HSL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${COIN_HAS_HSL_TRUE}" && test -z "${COIN_HAS_HSL_FALSE}"; then + as_fn_error $? "conditional \"COIN_HAS_HSL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_MA28_TRUE}" && test -z "${HAVE_MA28_FALSE}"; then as_fn_error $? "conditional \"HAVE_MA28\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_PARDISO_TRUE}" && test -z "${HAVE_PARDISO_FALSE}"; then - as_fn_error $? "conditional \"HAVE_PARDISO\" was never defined. +if test -z "${HAVE_PARDISO_MKL_TRUE}" && test -z "${HAVE_PARDISO_MKL_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PARDISO_MKL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_WSMP_TRUE}" && test -z "${HAVE_WSMP_FALSE}"; then - as_fn_error $? "conditional \"HAVE_WSMP\" was never defined. +if test -z "${COIN_HAS_SPRAL_TRUE}" && test -z "${COIN_HAS_SPRAL_FALSE}"; then + as_fn_error $? "conditional \"COIN_HAS_SPRAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${BUILD_INEXACT_TRUE}" && test -z "${BUILD_INEXACT_FALSE}"; then - as_fn_error $? "conditional \"BUILD_INEXACT\" was never defined. +if test -z "${COIN_HAS_SPRAL_TRUE}" && test -z "${COIN_HAS_SPRAL_FALSE}"; then + as_fn_error $? "conditional \"COIN_HAS_SPRAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${BUILD_JAVA_TRUE}" && test -z "${BUILD_JAVA_FALSE}"; then - as_fn_error $? "conditional \"BUILD_JAVA\" was never defined. +if test -z "${HAVE_WSMP_TRUE}" && test -z "${HAVE_WSMP_FALSE}"; then + as_fn_error $? "conditional \"HAVE_WSMP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_INEXACT_TRUE}" && test -z "${BUILD_INEXACT_FALSE}"; then as_fn_error $? "conditional \"BUILD_INEXACT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${BUILD_LINEARSOLVERLOADER_TRUE}" && test -z "${BUILD_LINEARSOLVERLOADER_FALSE}"; then - as_fn_error $? "conditional \"BUILD_LINEARSOLVERLOADER\" was never defined. +if test -z "${BUILD_JAVA_TRUE}" && test -z "${BUILD_JAVA_FALSE}"; then + as_fn_error $? "conditional \"BUILD_JAVA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_SIPOPT_TRUE}" && test -z "${BUILD_SIPOPT_FALSE}"; then @@ -26652,8 +27595,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -26676,14 +27619,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -26693,46 +27638,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -26741,13 +27686,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -26756,8 +27694,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -26769,30 +27711,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -26805,13 +27727,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -26838,18 +27761,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -26861,12 +27786,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -26897,7 +27823,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -26919,6 +27845,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -26932,6 +27862,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -26973,7 +27909,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -26982,7 +27918,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -27044,8 +27980,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Ipopt $as_me 3.13.2, which was -generated by GNU Autoconf 2.69. Invocation command line was +This file was extended by Ipopt $as_me 3.14.13, which was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -27112,14 +28048,16 @@ Report bugs to . Ipopt home page: ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -Ipopt config.status 3.13.2 -configured by $0, generated by GNU Autoconf 2.69, +Ipopt config.status 3.14.13 +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -27159,15 +28097,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -27175,7 +28113,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -27184,7 +28122,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -27212,7 +28150,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -27226,7 +28164,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -27281,12 +28219,14 @@ lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_q lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' @@ -27512,13 +28452,13 @@ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ +FILECMD \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ -AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ @@ -27762,6 +28702,7 @@ do "examples/hs071_cpp/hs071_nlp.cpp") CONFIG_LINKS="$CONFIG_LINKS examples/hs071_cpp/hs071_nlp.cpp:examples/hs071_cpp/hs071_nlp.cpp" ;; "examples/hs071_cpp/hs071_nlp.hpp") CONFIG_LINKS="$CONFIG_LINKS examples/hs071_cpp/hs071_nlp.hpp:examples/hs071_cpp/hs071_nlp.hpp" ;; "examples/hs071_c/hs071_c.c") CONFIG_LINKS="$CONFIG_LINKS examples/hs071_c/hs071_c.c:examples/hs071_c/hs071_c.c" ;; + "examples/hs071_java/HS071s.java") CONFIG_LINKS="$CONFIG_LINKS examples/hs071_java/HS071s.java:examples/hs071_java/HS071s.java" ;; "examples/hs071_java/HS071.java") CONFIG_LINKS="$CONFIG_LINKS examples/hs071_java/HS071.java:examples/hs071_java/HS071.java" ;; "tutorial/AmplExperiments/hs71.mod") CONFIG_LINKS="$CONFIG_LINKS tutorial/AmplExperiments/hs71.mod:tutorial/AmplExperiments/hs71.mod" ;; "tutorial/AmplExperiments/infeasible.mod") CONFIG_LINKS="$CONFIG_LINKS tutorial/AmplExperiments/infeasible.mod:tutorial/AmplExperiments/infeasible.mod" ;; @@ -27797,22 +28738,15 @@ do "contrib/sIPOPT/examples/redhess_cpp/MySensTNLP.hpp") CONFIG_LINKS="$CONFIG_LINKS contrib/sIPOPT/examples/redhess_cpp/MySensTNLP.hpp:contrib/sIPOPT/examples/redhess_cpp/MySensTNLP.hpp" ;; "contrib/sIPOPT/examples/redhess_cpp/redhess_cpp.cpp") CONFIG_LINKS="$CONFIG_LINKS contrib/sIPOPT/examples/redhess_cpp/redhess_cpp.cpp:contrib/sIPOPT/examples/redhess_cpp/redhess_cpp.cpp" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "src/Common/Makefile") CONFIG_FILES="$CONFIG_FILES src/Common/Makefile" ;; - "src/LinAlg/Makefile") CONFIG_FILES="$CONFIG_FILES src/LinAlg/Makefile" ;; - "src/LinAlg/TMatrices/Makefile") CONFIG_FILES="$CONFIG_FILES src/LinAlg/TMatrices/Makefile" ;; - "src/Interfaces/Makefile") CONFIG_FILES="$CONFIG_FILES src/Interfaces/Makefile" ;; - "src/Algorithm/Makefile") CONFIG_FILES="$CONFIG_FILES src/Algorithm/Makefile" ;; - "src/Algorithm/LinearSolvers/Makefile") CONFIG_FILES="$CONFIG_FILES src/Algorithm/LinearSolvers/Makefile" ;; - "src/Algorithm/Inexact/Makefile") CONFIG_FILES="$CONFIG_FILES src/Algorithm/Inexact/Makefile" ;; - "src/contrib/CGPenalty/Makefile") CONFIG_FILES="$CONFIG_FILES src/contrib/CGPenalty/Makefile" ;; - "src/contrib/LinearSolverLoader/Makefile") CONFIG_FILES="$CONFIG_FILES src/contrib/LinearSolverLoader/Makefile" ;; - "src/Apps/Makefile") CONFIG_FILES="$CONFIG_FILES src/Apps/Makefile" ;; + "src/ipopt.pc") CONFIG_FILES="$CONFIG_FILES src/ipopt.pc" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/Apps/AmplSolver/Makefile") CONFIG_FILES="$CONFIG_FILES src/Apps/AmplSolver/Makefile" ;; + "src/Apps/AmplSolver/ipoptamplinterface.pc") CONFIG_FILES="$CONFIG_FILES src/Apps/AmplSolver/ipoptamplinterface.pc" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "test/run_unitTests") CONFIG_FILES="$CONFIG_FILES test/run_unitTests" ;; - "ipopt.pc") CONFIG_FILES="$CONFIG_FILES ipopt.pc" ;; "doc/Doxyfile") CONFIG_FILES="$CONFIG_FILES doc/Doxyfile" ;; "examples/Cpp_example/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Cpp_example/Makefile" ;; + "examples/recursive_nlp/Makefile") CONFIG_FILES="$CONFIG_FILES examples/recursive_nlp/Makefile" ;; "examples/hs071_cpp/Makefile") CONFIG_FILES="$CONFIG_FILES examples/hs071_cpp/Makefile" ;; "examples/hs071_c/Makefile") CONFIG_FILES="$CONFIG_FILES examples/hs071_c/Makefile" ;; "examples/ScalableProblems/Makefile") CONFIG_FILES="$CONFIG_FILES examples/ScalableProblems/Makefile" ;; @@ -27825,8 +28759,9 @@ do "tutorial/CodingExercise/Matlab/1-skeleton/startup.m") CONFIG_FILES="$CONFIG_FILES tutorial/CodingExercise/Matlab/1-skeleton/startup.m" ;; "tutorial/CodingExercise/Matlab/2-mistake/startup.m") CONFIG_FILES="$CONFIG_FILES tutorial/CodingExercise/Matlab/2-mistake/startup.m" ;; "tutorial/CodingExercise/Matlab/3-solution/startup.m") CONFIG_FILES="$CONFIG_FILES tutorial/CodingExercise/Matlab/3-solution/startup.m" ;; - "examples/hs071_f/hs071_f.f") CONFIG_FILES="$CONFIG_FILES examples/hs071_f/hs071_f.f" ;; "examples/hs071_f/Makefile") CONFIG_FILES="$CONFIG_FILES examples/hs071_f/Makefile" ;; + "examples/hs071_f/hs071_fs.f") CONFIG_FILES="$CONFIG_FILES examples/hs071_f/hs071_fs.f" ;; + "examples/hs071_f/hs071_f.f") CONFIG_FILES="$CONFIG_FILES examples/hs071_f/hs071_f.f" ;; "tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f") CONFIG_FILES="$CONFIG_FILES tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f" ;; "tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f") CONFIG_FILES="$CONFIG_FILES tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f" ;; "tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f") CONFIG_FILES="$CONFIG_FILES tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f" ;; @@ -27843,7 +28778,6 @@ do "contrib/sIPOPT/examples/redhess_cpp/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/sIPOPT/examples/redhess_cpp/Makefile" ;; "contrib/RInterface/src/Makevars.win") CONFIG_FILES="$CONFIG_FILES contrib/RInterface/src/Makevars.win:contrib/RInterface/src/Makevars.in" ;; "contrib/RInterface/src/Makevars") CONFIG_FILES="$CONFIG_FILES contrib/RInterface/src/Makevars" ;; - "ipoptamplinterface.pc") CONFIG_FILES="$CONFIG_FILES ipoptamplinterface.pc:src/Apps/AmplSolver/ipoptamplinterface.pc.in" ;; "src/Common/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/Common/config.h" ;; "src/Common/config_ipopt.h") CONFIG_HEADERS="$CONFIG_HEADERS src/Common/config_ipopt.h" ;; @@ -27857,10 +28791,10 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_LINKS+y} || CONFIG_LINKS=$config_links + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -28196,7 +29130,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -28204,17 +29138,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -28231,7 +29165,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -28255,9 +29189,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -28319,8 +29253,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -28364,9 +29298,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -28382,20 +29316,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -28415,7 +29349,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | +printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -28447,8 +29381,8 @@ $as_echo X"$_am_arg" | ac_source=$srcdir/$ac_source fi - { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 -$as_echo "$as_me: linking $ac_source to $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 +printf "%s\n" "$as_me: linking $ac_source to $ac_file" >&6;} if test ! -r "$ac_source"; then as_fn_error $? "$ac_source: file not found" "$LINENO" 5 @@ -28466,8 +29400,8 @@ $as_echo "$as_me: linking $ac_source to $ac_file" >&6;} as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 fi ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -28493,7 +29427,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -28505,7 +29439,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -28527,7 +29461,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -28552,10 +29486,12 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -28711,6 +29647,9 @@ to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd +# A file(cmd) program that detects file types. +FILECMD=$lt_FILECMD + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -28729,8 +29668,11 @@ sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR +# Flags to create an archive (by configure). +lt_ar_flags=$lt_ar_flags + # Flags to create an archive. -AR_FLAGS=$lt_AR_FLAGS +AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec @@ -29112,6 +30054,7 @@ _LT_EOF esac + ltmain=$ac_aux_dir/ltmain.sh @@ -29119,7 +30062,7 @@ ltmain=$ac_aux_dir/ltmain.sh # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ + $SED '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || @@ -29477,11 +30420,12 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} 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;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Configuration of $PACKAGE_NAME successful" >&5 +printf "%s\n" "$as_me: Configuration of $PACKAGE_NAME successful" >&6;} + + diff --git a/configure.ac b/configure.ac index f4ff0e0ff..8d2ce6ffd 100644 --- a/configure.ac +++ b/configure.ac @@ -1,19 +1,17 @@ # Copyright (C) 2004, 2011 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. - +# # Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 ############################################################################# # Names and other basic things # ############################################################################# -AC_PREREQ(2.59) - -AC_INIT([Ipopt],[3.13.2],[https://github.com/coin-or/Ipopt/issues/new],,[https://github.com/coin-or/Ipopt]) +AC_INIT([Ipopt],[3.14.13],[https://github.com/coin-or/Ipopt/issues/new],[],[https://github.com/coin-or/Ipopt]) -AC_COPYRIGHT( -[Copyright 2004, 2011 International Business Machines and others. +AC_COPYRIGHT([ +Copyright 2004, 2011 International Business Machines and others. All Rights Reserved. This file is part of the open source package IPOPT which is distributed under the Eclipse Public License.]) @@ -59,55 +57,134 @@ AC_COIN_DOXYGEN # IPOPT_VERBOSITY and IPOPT_DEBUGLEVEL AC_COIN_DEBUGLEVEL +######################################################################## +# Floating-point Precision and Integer size # +######################################################################## + +AC_ARG_WITH([precision], + [AS_HELP_STRING([--with-precision],[floating-point precision to use: single or double (default)])], + [precision=$withval], + [precision=double]) +case "$precision" in + single ) AC_DEFINE([IPOPT_SINGLE],[1],[Define to 1 if using single precision floating point]) ;; + double ) ;; + *) AC_MSG_ERROR([unsupported value $precision for option --with-precision]) +esac +AM_CONDITIONAL([IPOPT_SINGLE],[test "$precision" = single]) + +# check which integer size to build +AC_ARG_WITH([intsize], + [AS_HELP_STRING([--with-intsize],[integer type to use: specify 32 for int or 64 for int64_t])], + [intsize=$withval], + [intsize=32]) +case "$intsize" in + 32 ) ;; + 64 ) AC_DEFINE(IPOPT_INT64, [1], [Define to 1 if Ipopt index type is int64_t]) ;; + *) AC_MSG_ERROR([unsupported value $intsize for option --with-intsize]) ;; +esac +AM_CONDITIONAL([IPOPT_INT64],[test "$intsize" = 64]) + +# Specify 8-byte integers if intsize=64 (TODO This should become a macro in BuildTools that figures out the right flag to use) +if test $intsize = 64 ; then + case "$F77" in + *gfortran*) FFLAGS="$FFLAGS -fdefault-integer-8" ;; + *ifort*) + case $build in + *-cygwin* | *-mingw* | *-msys* ) FFLAGS="$FFLAGS -integer-size:64" ;; + *) FFLAGS="$FFLAGS -integer-size 64" ;; + esac + ;; + "" ) ;; # no Fortran compiler, then don't do anything + *) AC_MSG_ERROR([Do not know how to select 8-byte integers for Fortran compiler $FC]) ;; + esac +fi + ############################################################################# # Dependencies # ############################################################################# AC_COIN_CHK_LIBM(IpoptLib) -#AC_COIN_CHK_BLAS(IpoptLib) -#if test $coin_has_blas != yes; then -# AC_MSG_ERROR([Required package BLAS not found.]) -#fi - -AC_COIN_CHK_LAPACK(IpoptLib) +AC_COIN_CHK_LAPACK(IpoptLib, int$intsize) if test $coin_has_lapack != yes; then AC_MSG_ERROR([Required package LAPACK not found.]) # AC_MSG_WARN([Compiling code without LAPACK. Certain options (e.g., quasi-Newton) will not work.]) fi -AC_COIN_CHK_PKG(ASL,[IpoptAmplInterfaceLib SIpoptAmplInterfaceLib],[coinasl],[build]) +# check for ASL only if building for double precision +if test $precision = double ; then + AC_COIN_CHK_PKG(ASL,[IpoptAmplInterfaceLib SIpoptAmplInterfaceLib],[coinasl]) +else + AM_CONDITIONAL([COIN_HAS_ASL],[false]) +fi ######### # MUMPS # ######### -AC_COIN_CHK_PKG(Mumps,[IpoptLib],[coinmumps],[build]) +AC_COIN_CHK_PKG(Mumps,[IpoptLib],[coinmumps]) # Check whether MPI_Initialized is available # we assume that MPI_Finalized is present if MPI_Initialized is present AC_CHECK_FUNCS([MPI_Initialized]) +AC_ARG_ENABLE([mpiinit], + [AS_HELP_STRING([--disable-mpiinit],[disable that (un)loading the Ipopt library initalizes (finalizes) MPI if the MPI version of MUMPS is linked])], + [case "$enableval" in + no | yes) ;; + *) + AC_MSG_ERROR([invalid argument for --enable-mpiinit: $enableval]);; + esac + mpiinit=$enableval], + [mpiinit=yes]) +if test $mpiinit = yes ; then + AC_DEFINE(IPOPT_MPIINIT,1,[Define to 1 if MPI should be initialized (finalized) when Ipopt library is (un)loaded.]) +fi + ####### # HSL # ####### -AC_COIN_CHK_PKG(HSL,[IpoptLib HSLLib],[coinhsl],[build]) +if test $intsize = 32 ; then + AC_COIN_CHK_PKG(HSL,[IpoptLib HSLLib],[coinhsl]) +else + coin_has_hsl=no + AM_CONDITIONAL([COIN_HAS_HSL],[false]) +fi have_ma28=no if test "$coin_has_hsl" = yes ; then AC_COIN_FINALIZE_FLAGS([HSLLib]) - AC_COIN_NAMEMANGLING([HSL],[ma27ad],[$HSLLIB_LFLAGS]) - - # extra check for MA28, since that decides whether we have to build IpMa28Partition.F + case $precision in + single ) ma27func=ma27a MA27FUNC=MA27A ;; + double ) ma27func=ma27ad MA27FUNC=MA27AD ;; + * ) AC_MSG_ERROR([HSL cannot be used with --with-precision=$precision]) ;; + esac + AC_COIN_TRY_LINK(ma27ad,[$HSLLIB_LFLAGS],, + [AC_COIN_DEFINENAMEMANGLING(IPOPT_HSL,$ma27ad_namemangling)], + [AC_MSG_ERROR([Provided package HSL is not working or does not contain MA27. See config.log for details on failed checks.])]) + + # extra check for MA28(s), since that decides whether we have to build IpMa28(s)Partition.F if test -n "$F77" ; then - AC_COIN_TRY_LINK([ma28ad],[$HSLLIB_LFLAGS],,[ - if test "$ma28ad_namemangling" != "$ac_cv_f77_mangling" ; then - AC_MSG_WARN([Name mangling of MA28 different than Fortran. This will not link. Disabling MA28]) - else - have_ma28=yes - fi - ]) + case $precision in + single ) + AC_COIN_TRY_LINK([ma28a],[$HSLLIB_LFLAGS],,[ + if test "$ma28a_namemangling" != "$ac_cv_f77_mangling" ; then + AC_MSG_WARN([Name mangling of MA28 different than Fortran. This will not link. Disabling MA28]) + else + have_ma28=yes + fi + ]) ;; + double ) + AC_COIN_TRY_LINK([ma28ad],[$HSLLIB_LFLAGS],,[ + if test "$ma28ad_namemangling" != "$ac_cv_f77_mangling" ; then + AC_MSG_WARN([Name mangling of MA28 different than Fortran. This will not link. Disabling MA28]) + else + have_ma28=yes + fi + ]) ;; + * ) AC_MSG_ERROR([HSL cannot be used with --with-precision=$precision]) ;; + esac fi fi AM_CONDITIONAL([HAVE_MA28],[test "$have_ma28" = yes]) @@ -116,57 +193,72 @@ AM_CONDITIONAL([HAVE_MA28],[test "$have_ma28" = yes]) # PARDISO # ########### +if test $intsize = 32 ; then AC_ARG_WITH([pardiso], - AC_HELP_STRING([--with-pardiso],[specify Pardiso library (>= 4.0) from pardiso-project.org]), - [have_pardiso_project=yes; pardiso_lflags=$withval], - [have_pardiso_project=no]) + [AS_HELP_STRING([--with-pardiso],[specify Pardiso library (>= 4.0) from pardiso-project.org])], + [case "$withval" in + no) have_pardiso_project=no ;; # so with_pardiso=no + yes) AC_MSG_ERROR(["expected filename as argument for --with-pardiso"]) ;; + *) AC_DEFINE_UNQUOTED([PARDISO_LIB],["$withval"],[Name of Pardiso library from pardiso-project.org]) + AC_MSG_NOTICE([Pardiso from pardiso-project.org specified as $withval]) + have_pardiso_project=yes + ;; + esac], + [have_pardiso_project=no]) +fi +# check whether Pardiso is available via Lapack, which should then be MKL +AC_ARG_ENABLE([pardisomkl], + [AS_HELP_STRING([--disable-pardisomkl],[disable check for MKL version of Pardiso in Lapack])], + [case "$enableval" in + no | yes) ;; + *) + AC_MSG_ERROR([invalid argument for --enable-pardisomkl: $enableval]);; + esac + checkpardisomkl=$enableval], + [checkpardisomkl=yes]) have_pardiso_mkl=no -if test "$have_pardiso_project" = yes ; then - # check whether flags from --with-pardiso work and figure out name mangling - # if so, define PARDISO_FUNC and keep lflags - AC_COIN_TRY_LINK([pardiso_ipopt_newinterface],[$pardiso_lflags $lapack_lflags],[$lapack_pcfiles], - [AC_COIN_DEFINENAMEMANGLING([IPOPT_PARDISO],[$pardiso_ipopt_newinterface_namemangling]) - IPOPTLIB_LFLAGS="$pardiso_lflags $IPOPTLIB_LFLAGS" - AC_DEFINE(IPOPT_HAS_PARDISO,1,[Define to 1 if Pardiso is available]) - ], - [AC_MSG_ERROR([Symbol pardiso_ipopt_newinterface not found with Pardiso flags $pardiso_lflags and Lapack. Require Pardiso >= 4.0.])]) - - AC_COIN_TRY_LINK([pardiso_exist_parallel],[$pardiso_lflags $lapack_lflags],[$lapack_pcfiles], - [AC_DEFINE(IPOPT_HAS_PARDISO_PARALLEL,1,[Define to 1 if you are using the parallel version of Pardiso])]) - -else - # check whether Pardiso is available via Lapack, which should then be MKL - # figure out name mangling and define PARDISO_FUNC +if test $checkpardisomkl = yes ; then AC_COIN_TRY_LINK([pardiso],[$lapack_lflags],[$lapack_pcfiles], - [AC_COIN_DEFINENAMEMANGLING([IPOPT_PARDISO],[$pardiso_namemangling]) - have_pardiso_mkl=yes - AC_DEFINE(IPOPT_HAS_PARDISO,1,[Define to 1 if Pardiso is available]) - # assume MKL Pardiso is parallel (it never has pardiso_exist_parallel) - # TODO does sequential MKL also have a parallel Pardiso? do we need some check here? - AC_DEFINE(IPOPT_HAS_PARDISO_PARALLEL,1,[Define to 1 if you are using the parallel version of Pardiso]) - AC_DEFINE(IPOPT_HAS_PARDISO_MKL,1,[Define to 1 if you are using Pardiso from MKL]) + [have_pardiso_mkl=yes + AC_DEFINE(IPOPT_HAS_PARDISO_MKL,1,[Define to 1 if Pardiso from MKL is available]) ]) fi +AM_CONDITIONAL([HAVE_PARDISO_MKL],[test "$have_pardiso_mkl" = yes]) -AM_CONDITIONAL([HAVE_PARDISO],[test "$have_pardiso_mkl$have_pardiso_project" != nono]) +######### +# SPRAL # +######### + +# check for Spral only if building for double precision and 32-bit integers +# spral_ssids seems to support more than 2^31 nonzeros in a matrix, but not dimensions > 2^31 +if test $precision$intsize = double32 ; then + AC_LANG_PUSH(C++) + AC_COIN_CHK_LIBHDR(Spral,[IpoptLib],[],[],[], + [spral_ssids_solve(0, 0, (double*)0, 0, (void*)0, (void*)0, (const struct spral_ssids_options*)0, (struct spral_ssids_inform*)0);], + [#include "spral_ssids.h"], + [default_skip]) + AC_LANG_POP(C++) +else + AM_CONDITIONAL([COIN_HAS_SPRAL],[false]) +fi ######## # WSMP # ######## AC_ARG_WITH([wsmp], - AC_HELP_STRING([--with-wsmp],[specify WSMP library]), + AS_HELP_STRING([--with-wsmp],[specify WSMP library]), [have_wsmp=yes; wsmp_lflags=$withval], [have_wsmp=no]) -if test "$have_wsmp" = "yes"; then +if test $have_wsmp$precision$intsize = yesdouble32 ; then AC_COIN_TRY_LINK([wssmp],[$wsmp_lflags],[], [AC_COIN_DEFINENAMEMANGLING([IPOPT_WSMP],[$wssmp_namemangling]) IPOPTLIB_LFLAGS="$wsmp_lflags $IPOPTLIB_LFLAGS" AC_DEFINE(IPOPT_HAS_WSMP,1,[Define to 1 if WSMP is available]) ], - [AC_MSG_ERROR([Symbol wssmp not found with WSMP flags $wsmp_lflags.])]) + [AC_MSG_ERROR([Symbol wssmp not found with WSMP flags $wsmp_lflags. See config.log for details on failed checks.])]) fi AM_CONDITIONAL([HAVE_WSMP],[test $have_wsmp = yes]) @@ -190,7 +282,7 @@ case "$ac_cv_sizeof_int_p" in 8 | 8?) BITS_PER_POINTER=64 BIT32FCOMMENT='C' BIT64FCOMMENT='' ;; - *) AC_MSG_ERROR([Unknown length of int *]);; + *) AC_MSG_ERROR([Unknown length of int*]);; esac ############################################################################ @@ -207,12 +299,13 @@ AC_LANG_PUSH(C++) AC_COIN_CHECK_ISFINITE -########### -# va_copy # -########### +######################### +# va_copy and vsnprintf # +######################### AC_CHECK_DECL([va_copy],[AC_DEFINE([IPOPT_HAS_VA_COPY],[1], [Define to 1 if va_copy is available])],,[#include ]) +AC_CHECK_FUNCS([vsnprintf _vsnprintf],[break]) ########################### # Random number generator # @@ -228,15 +321,20 @@ AC_COIN_CHECK_NAMESPACE_DECL([std::srand],[1], [AC_DEFINE([IPOPT_HAS_STD__RAND],[1],[Define to 1 if function std::rand is available])],[], [#include ]) -########################################################################## +################## +# feenableexcept # +################## + +AC_CHECK_DECL([feenableexcept], + [AC_DEFINE([IPOPT_HAS_FEENABLEEXCEPT],[1],[Define to 1 if function feenableexcept is available])],, + [#include ]) ################################################### # Check if user wants inexact algorithm available # ################################################### AC_ARG_ENABLE([inexact-solver], - [AC_HELP_STRING([--enable-inexact-solver], - [enable inexact linear solver version EXPERIMENTAL! (default: no)])], + [AS_HELP_STRING([--enable-inexact-solver],[enable inexact linear solver version EXPERIMENTAL! (default: no)])], [case "$enableval" in no | yes) ;; *) @@ -255,42 +353,17 @@ AM_CONDITIONAL([BUILD_INEXACT], [test $use_inexact = yes]) AC_LANG_POP(C++) -###################################### -# Equivalent int Fortran and C types # -###################################### - -# FIXME: The following test should be active, but this requires change in -# code to copy Index* to ipfint* arrays... -if test "$cross_compiling" = no && test "$is_bg" != yes; then - AC_LANG_PUSH(C) - AC_DEFINE([IPOPT_FORTRAN_INTEGER_TYPE],[int],[Define to the C type corresponding to Fortran INTEGER]) -# AC_CHECK_SIZEOF([long]) -# AC_CHECK_SIZEOF([int]) -# AC_CHECK_SIZEOF([double]) -# AC_MSG_CHECKING([for C type corresponding to Fortran INTEGER]) -# if test $ac_cv_sizeof_long = $ac_cv_sizeof_double; then -# AC_DEFINE([IPOPT_FORTRAN_INTEGER_TYPE],[int],[Define to the C type corresponding to Fortran INTEGER]) -# AC_MSG_RESULT([int]) -# else -# AC_DEFINE([IPOPT_FORTRAN_INTEGER_TYPE],[long]) -# AC_MSG_RESULT([long]) -# fi - AC_LANG_POP(C) -else - AC_MSG_WARN([We are cross compiling, assuming Fortran 'INTEGER' type corresponds to C 'int' type]) - AC_DEFINE([IPOPT_FORTRAN_INTEGER_TYPE],[int]) -fi - -############# JAVA +######## +# Java # +######## AC_ARG_ENABLE([java], - [AC_HELP_STRING([--disable-java],[disable building of Java interface])], + [AS_HELP_STRING([--disable-java],[disable building of Java interface])], [enable_java="$enableval"], [case "$JAVA_HOME" in *\ * ) enable_java=no ;; # do not enable java-check by default, if there are spaces in JAVA_HOME - that causes trouble * ) enable_java="$enable_shared" ;; - esac - ]) + esac]) if test "$enable_java" != no ; then # look for javac: required to compile Java code and build C-header @@ -309,6 +382,21 @@ if test "$enable_java" != no ; then fi fi +if test "$enable_java" != no ; then + AC_MSG_CHECKING([if javac supports -h]) + echo "public abstract class conftest { private native boolean test(); }" > conftest.java + AS_ECHO(["$as_me:${as_lineno-$LINENO}: $JAVAC conftest.java -h conftest.header"]) >&AS_MESSAGE_LOG_FD + "$JAVAC" conftest.java -h conftest.header >&AS_MESSAGE_LOG_FD + if test -e conftest.header/conftest.h ; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.java >&AS_MESSAGE_LOG_FD + enable_java=no + fi +fi + if test "$enable_java" != no ; then # look for jni header: required to compile C++ part of Java interface AX_JNI_INCLUDE_DIR @@ -323,40 +411,45 @@ if test "$enable_java" != no ; then fi if test "$enable_java" != no ; then - # the following macros can make configure stop with an error - # we could work around that, but having javac and no jar, java, or javadoc would be odd anyway - # look for jar: required to pack Java interface - AX_PROG_JAR - # look for more java to run tests and examples and do documentation - AX_PROG_JAVA - AX_PROG_JAVADOC + dnl copied from AX_PROG_JAR + AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar])], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar], [], [$JAVAPREFIX/bin])]) + if test -z "$JAR" ; then + AC_MSG_WARN([JAVA compiler found, but no acceptable jar program found in \$PATH. Disabling build of Java interface.]) + enable_java=no + fi fi -AM_CONDITIONAL([BUILD_JAVA], [test "$enable_java" != no]) - -######################### -# Makefile conditionals # -######################### - -# The following variable collects the names of libraries that should -# be included into libipopt.a (relative to subdir Interfaces, where it -# is made) - -AC_SUBST(IPALLLIBS) -IPALLLIBS="../contrib/CGPenalty/libcgpenalty.la ../Algorithm/libipoptalg.la ../Algorithm/LinearSolvers/liblinsolvers.la ../Common/libcommon.la ../LinAlg/liblinalg.la ../LinAlg/TMatrices/libtmatrices.la" +if test "$enable_java" != no ; then + # look for java to run tests, but skip check whether java works (so just the test may fail) + dnl copied from AX_PROG_JAVA + AS_IF([test "x$JAVAPREFIX" = x], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [kaffe java])], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [kaffe java], [], [$JAVAPREFIX/bin])]) + if test -z "$JAVA" ; then + AC_MSG_WARN([JAVA compiler found, but no acceptable JAVA executable found in \$PATH. Disabling tests of Java interface. Java example will not run.]) + fi -AM_CONDITIONAL([BUILD_INEXACT], [test $use_inexact = yes]) -if test $use_inexact = yes; then - IPALLLIBS="../Algorithm/Inexact/libinexact.la $IPALLLIBS" + # look for javadoc to build documentation + dnl copied from AX_PROG_JAVADOC + AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAVADOC" = x && AC_CHECK_PROGS([JAVADOC], [javadoc])], + [test "x$JAVADOC" = x && AC_CHECK_PROGS([JAVADOC], [javadoc], [], [$JAVAPREFIX/bin])]) + if test -z "$JAVADOC" ; then + AC_MSG_WARN([JAVA compiler found, but no javadoc found in \$PATH. Building the Java documentation (make javadoc) will fail.]) + fi fi +AM_CONDITIONAL([BUILD_JAVA], [test "$enable_java" != no]) + ######################################################################## ## Linear solver loader ## ######################################################################## AC_ARG_ENABLE([linear-solver-loader], - [AC_HELP_STRING([--disable-linear-solver-loader],[disable build of linear solver loader])], + [AS_HELP_STRING([--disable-linear-solver-loader],[disable use of linear solver loader])], [case "$enableval" in no | yes) ;; *) @@ -365,31 +458,26 @@ AC_ARG_ENABLE([linear-solver-loader], use_linearsolverloader=$enableval], [use_linearsolverloader=yes]) -AC_MSG_CHECKING([whether the linear solver loader should be compiled]) +AC_MSG_CHECKING([whether the linear solver loader should be used]) AC_MSG_RESULT([$use_linearsolverloader]) if test $use_linearsolverloader = yes; then AC_DEFINE([IPOPT_HAS_LINEARSOLVERLOADER],[1], - [Define to 1 if the linear solver loader should be compiled to allow dynamic loading of shared libraries with linear solvers]) - IPALLLIBS="../contrib/LinearSolverLoader/libLinearSolverLoader.la $IPALLLIBS" -fi + [Define to 1 if the linear solver loader should be used to load libraries with linear solvers at runtime]) -AM_CONDITIONAL([BUILD_LINEARSOLVERLOADER],[test $use_linearsolverloader = yes]) + AC_LANG_PUSH(C) + AC_CHECK_LIB(dl,[dlopen],[IPOPTLIB_LFLAGS="$IPOPTLIB_LFLAGS -ldl"],[]) + AC_LANG_POP(C) +fi -AC_LANG_PUSH(C) -AC_CHECK_HEADER([windows.h]) -AC_CHECK_HEADER([dlfcn.h]) -AC_CHECK_LIB(dl,[dlopen],[IPOPTLIB_LFLAGS="$IPOPTLIB_LFLAGS -ldl"],[]) -AC_CHECK_FUNCS([snprintf _snprintf],[break]) -AC_CHECK_FUNCS([vsnprintf _vsnprintf],[break]) -AC_LANG_POP(C) +AC_CHECK_HEADER([windows.h],AC_DEFINE(HAVE_WINDOWS_H,[1],[Define to 1 if windows.h is available.])) ######################################################################## ## sIpopt ## ######################################################################## AC_ARG_ENABLE([sipopt], - [AC_HELP_STRING([--disable-sipopt],[disable build of sIpopt])], + [AS_HELP_STRING([--disable-sipopt],[disable build of sIpopt])], [case "$enableval" in no | yes) ;; *) @@ -458,7 +546,10 @@ AC_COIN_VPATH_LINK(examples/hs071_cpp/hs071_nlp.cpp) AC_COIN_VPATH_LINK(examples/hs071_cpp/hs071_nlp.hpp) AC_COIN_VPATH_LINK(examples/hs071_c/hs071_c.c) if test "$enable_java" != no ; then - AC_COIN_VPATH_LINK(examples/hs071_java/HS071.java) + case $precision in + single ) AC_COIN_VPATH_LINK(examples/hs071_java/HS071s.java) ;; + double ) AC_COIN_VPATH_LINK(examples/hs071_java/HS071.java) ;; + esac fi AC_COIN_VPATH_LINK(tutorial/AmplExperiments/hs71.mod) @@ -504,47 +595,49 @@ fi ## Create Makefiles and other stuff ## ######################################################################## -AC_COIN_FINALIZE_FLAGS([IpoptLib IpoptAmplInterfaceLib SIpoptAmplInterfaceLib]) +# the SIpoptLib is here to get SIPOPTLIB_EXPORT +AC_COIN_FINALIZE_FLAGS([IpoptLib IpoptAmplInterfaceLib SIpoptLib SIpoptAmplInterfaceLib]) AC_CONFIG_FILES([Makefile - src/Common/Makefile - src/LinAlg/Makefile - src/LinAlg/TMatrices/Makefile - src/Interfaces/Makefile - src/Algorithm/Makefile - src/Algorithm/LinearSolvers/Makefile - src/Algorithm/Inexact/Makefile - src/contrib/CGPenalty/Makefile - src/contrib/LinearSolverLoader/Makefile - src/Apps/Makefile - src/Apps/AmplSolver/Makefile - test/Makefile - test/run_unitTests - ipopt.pc - doc/Doxyfile - examples/Cpp_example/Makefile - examples/hs071_cpp/Makefile - examples/hs071_c/Makefile - examples/ScalableProblems/Makefile - tutorial/CodingExercise/C/1-skeleton/Makefile - tutorial/CodingExercise/C/2-mistake/Makefile - tutorial/CodingExercise/C/3-solution/Makefile - tutorial/CodingExercise/Cpp/1-skeleton/Makefile - tutorial/CodingExercise/Cpp/2-mistake/Makefile - tutorial/CodingExercise/Cpp/3-solution/Makefile - tutorial/CodingExercise/Matlab/1-skeleton/startup.m - tutorial/CodingExercise/Matlab/2-mistake/startup.m - tutorial/CodingExercise/Matlab/3-solution/startup.m + src/ipopt.pc + src/Makefile + src/Apps/AmplSolver/Makefile + src/Apps/AmplSolver/ipoptamplinterface.pc + test/Makefile + test/run_unitTests + doc/Doxyfile + examples/Cpp_example/Makefile + examples/recursive_nlp/Makefile + examples/hs071_cpp/Makefile + examples/hs071_c/Makefile + examples/ScalableProblems/Makefile + tutorial/CodingExercise/C/1-skeleton/Makefile + tutorial/CodingExercise/C/2-mistake/Makefile + tutorial/CodingExercise/C/3-solution/Makefile + tutorial/CodingExercise/Cpp/1-skeleton/Makefile + tutorial/CodingExercise/Cpp/2-mistake/Makefile + tutorial/CodingExercise/Cpp/3-solution/Makefile + tutorial/CodingExercise/Matlab/1-skeleton/startup.m + tutorial/CodingExercise/Matlab/2-mistake/startup.m + tutorial/CodingExercise/Matlab/3-solution/startup.m ]) if test -n "$F77" ; then - AC_CONFIG_FILES([examples/hs071_f/hs071_f.f examples/hs071_f/Makefile - tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f - tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f - tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f - tutorial/CodingExercise/Fortran/1-skeleton/Makefile - tutorial/CodingExercise/Fortran/2-mistake/Makefile - tutorial/CodingExercise/Fortran/3-solution/Makefile]) + AC_CONFIG_FILES([examples/hs071_f/Makefile]) + case $precision in + single ) + AC_CONFIG_FILES([examples/hs071_f/hs071_fs.f]) + ;; + double ) + AC_CONFIG_FILES([examples/hs071_f/hs071_f.f + tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f + tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f + tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f + tutorial/CodingExercise/Fortran/1-skeleton/Makefile + tutorial/CodingExercise/Fortran/2-mistake/Makefile + tutorial/CodingExercise/Fortran/3-solution/Makefile]) + ;; + esac fi if test "$enable_java" != no ; then @@ -553,18 +646,17 @@ fi if test "$use_sipopt" = yes ; then AC_CONFIG_FILES([ - contrib/sIPOPT/Makefile - contrib/sIPOPT/src/Makefile - contrib/sIPOPT/AmplSolver/Makefile - contrib/sIPOPT/examples/parametric_cpp/Makefile - contrib/sIPOPT/examples/parametric_dsdp_cpp/Makefile - contrib/sIPOPT/examples/redhess_cpp/Makefile + contrib/sIPOPT/Makefile + contrib/sIPOPT/src/Makefile + contrib/sIPOPT/AmplSolver/Makefile + contrib/sIPOPT/examples/parametric_cpp/Makefile + contrib/sIPOPT/examples/parametric_dsdp_cpp/Makefile + contrib/sIPOPT/examples/redhess_cpp/Makefile ]) fi - # under Windows, the Makevars file for the R Interface need to be named Makevars.win -case $build in +case $build in *-cygwin* | *-mingw* | *-msys* ) AC_CONFIG_FILES([contrib/RInterface/src/Makevars.win:contrib/RInterface/src/Makevars.in]) ;; @@ -573,10 +665,6 @@ case $build in ;; esac -if test $coin_has_asl = yes ; then - AC_CONFIG_FILES([ipoptamplinterface.pc:src/Apps/AmplSolver/ipoptamplinterface.pc.in]) -fi - -AC_CONFIG_HEADER([src/Common/config.h src/Common/config_ipopt.h]) +AC_CONFIG_HEADERS([src/Common/config.h src/Common/config_ipopt.h]) AC_COIN_FINALIZE diff --git a/contrib/RInterface/CHANGELOG b/contrib/RInterface/CHANGELOG index c2071459e..5f4b6722d 100644 --- a/contrib/RInterface/CHANGELOG +++ b/contrib/RInterface/CHANGELOG @@ -1,22 +1,21 @@ -09 March 2012, version 0.8.4: - - * Included additional variables to the object that is returned from ipoptr (thanks to Michael Schedl). These are: - z_L : final values for the lower bound multipliers - z_U : final values for the upper bound multipliers - constraints : final values for the constraints - lambda : final values for the Lagrange mulipliers - After solving the NLP using - R> res <- ipoptr( ... ) - They can be accessed using - R> res$z_L - R> res$z_U - R> res$constraints - R> res$lambda - - * Removed ipoptr_environment as argument in ipoptr because it wasn't useful and it caused undesired behaviour in - combination with the data.table package (thanks to Florian Oswald for reporting). - -20 November 2011, version 0.8.3: - - * Added #include to src/IpoptRNLP.hpp - +09 March 2012, version 0.8.4: + + * Included additional variables to the object that is returned from ipoptr (thanks to Michael Schedl). These are: + z_L : final values for the lower bound multipliers + z_U : final values for the upper bound multipliers + constraints : final values for the constraints + lambda : final values for the Lagrange mulipliers + After solving the NLP using + R> res <- ipoptr( ... ) + They can be accessed using + R> res$z_L + R> res$z_U + R> res$constraints + R> res$lambda + + * Removed ipoptr_environment as argument in ipoptr because it wasn't useful and it caused undesired behaviour in + combination with the data.table package (thanks to Florian Oswald for reporting). + +20 November 2011, version 0.8.3: + + * Added #include to src/IpoptRNLP.hpp diff --git a/contrib/RInterface/R/get.option.types.R b/contrib/RInterface/R/get.option.types.R index 270b224ef..98b606915 100644 --- a/contrib/RInterface/R/get.option.types.R +++ b/contrib/RInterface/R/get.option.types.R @@ -5,8 +5,8 @@ # Author: Jelmer Ypma # Date: 18 April 2010 # -# This function converts a list with ipopt options into -# three sub-lists, where the options are sorted into +# This function converts a list with ipopt options into +# three sub-lists, where the options are sorted into # the different value types (integer, numeric, string). # # Input: list of ipopt options and their values @@ -14,7 +14,7 @@ get.option.types <- function(opts) { - # define types of ipopt options + # define types of ipopt options ipopt.option.types <- list( # Output @@ -174,15 +174,15 @@ get.option.types <- function(opts) { "wsmp_scaling"="integer", "wsmp_singularity_threshold"="numeric" ) - - - - # initialize list with options sorted by type - converted.opts <- list( "integer"=list(), "string"=list(), "numeric"=list() ) - - is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol - - # check if we have at least 1 element in the list, otherwise the + + + + # initialize list with options sorted by type + converted.opts <- list( "integer"=list(), "string"=list(), "numeric"=list() ) + + is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol + + # check if we have at least 1 element in the list, otherwise the # loop runs from 1 to down 0 and we get errors if ( length( opts ) > 0 ) { @@ -200,7 +200,7 @@ get.option.types <- function(opts) { } cat( paste( "Warning: ", names(opts)[i], " is not a recognized option, we try to pass it to Ipopt as ", tmp.type, "\n" ) ) } - + if ( tmp.type=="string" ) { converted.opts$string[[ names(opts)[i] ]] <- as.character(opts[[i]]) } else if ( tmp.type=="integer" ) { @@ -212,6 +212,6 @@ get.option.types <- function(opts) { } } } - - return ( converted.opts ) + + return ( converted.opts ) } diff --git a/contrib/RInterface/R/ipoptr.R b/contrib/RInterface/R/ipoptr.R index dd7e89dd5..1a3d2f530 100644 --- a/contrib/RInterface/R/ipoptr.R +++ b/contrib/RInterface/R/ipoptr.R @@ -7,113 +7,113 @@ # # Changelog: # 09/03/2012: Added outputs, z_L, z_U, constraints, lambda (thanks to Michael Schedl) -# 09/03/2012: Removed ipoptr_environment because this caused a bug in combination with +# 09/03/2012: Removed ipoptr_environment because this caused a bug in combination with # data.table and it wasn't useful (thanks to Florian Oswald for reporting) # -# Input: -# x0 : vector with initial values -# eval_f : function to evaluate objective function -# eval_grad_f : function to evaluate gradient of objective function -# lb : lower bounds of the control -# ub : upper bounds of the control -# eval_g : function to evaluate (non-)linear constraints that should hold in the solution -# eval_jac_g : function to evaluate the jacobian of the (non-)linear constraints that should hold in the solution -# eval_jac_g_structure : sparseness structure of the jacobian -# constraint_lb : lower bounds of the (non-)linear constraints -# constraint_ub : upper bounds of the (non-)linear constraints -# eval_h : function to evaluate the hessian -# eval_h_structure : sparseness structure of the hessian -# opts : list with options that are passed to Ipopt -# ... : arguments that will be passed to user-defined functions +# Input: +# x0 : vector with initial values +# eval_f : function to evaluate objective function +# eval_grad_f : function to evaluate gradient of objective function +# lb : lower bounds of the control +# ub : upper bounds of the control +# eval_g : function to evaluate (non-)linear constraints that should hold in the solution +# eval_jac_g : function to evaluate the jacobian of the (non-)linear constraints that should hold in the solution +# eval_jac_g_structure : sparseness structure of the jacobian +# constraint_lb : lower bounds of the (non-)linear constraints +# constraint_ub : upper bounds of the (non-)linear constraints +# eval_h : function to evaluate the hessian +# eval_h_structure : sparseness structure of the hessian +# opts : list with options that are passed to Ipopt +# ... : arguments that will be passed to user-defined functions # # Output: structure with inputs and -# call : the call that was made to solve -# status : integer value with the status of the optimization (0 is success) -# message : more informative message with the status of the optimization -# iterations : number of iterations that were executed -# objective : final value of the objective function -# solution : final values for the controls -# z_L : final values for the lower bound multipliers -# z_U : final values for the upper bound multipliers -# constraints : final values for the constraints -# lambda : final values for the Lagrange mulipliers +# call : the call that was made to solve +# status : integer value with the status of the optimization (0 is success) +# message : more informative message with the status of the optimization +# iterations : number of iterations that were executed +# objective : final value of the objective function +# solution : final values for the controls +# z_L : final values for the lower bound multipliers +# z_U : final values for the upper bound multipliers +# constraints : final values for the constraints +# lambda : final values for the Lagrange mulipliers ipoptr <- -function( x0, - eval_f, - eval_grad_f, - lb = NULL, - ub = NULL, - eval_g = function( x ) { return( numeric(0) ) }, - eval_jac_g = function( x ) { return( numeric(0) ) }, +function( x0, + eval_f, + eval_grad_f, + lb = NULL, + ub = NULL, + eval_g = function( x ) { return( numeric(0) ) }, + eval_jac_g = function( x ) { return( numeric(0) ) }, eval_jac_g_structure = list(), - constraint_lb = numeric(0), + constraint_lb = numeric(0), constraint_ub = numeric(0), eval_h = NULL, eval_h_structure = NULL, opts = list(), ... ) { - + # define 'infinite' lower and upper bounds of the control if they haven't been set if ( is.null( lb ) ) { lb <- rep( -Inf, length(x0) ) } if ( is.null( ub ) ) { ub <- rep( Inf, length(x0) ) } # internal function to check the arguments of the functions checkFunctionArguments <- function( fun, arglist, funname ) { - if( !is.function(fun) ) stop(paste(funname, " must be a function\n", sep = "")) - + if( !is.function(fun) ) stop(paste(funname, " must be a function\n", sep = "")) + # determine function arguments fargs <- formals(fun) - - if ( length(fargs) > 1 ) { + + if ( length(fargs) > 1 ) { # determine argument names user-defined function - argnames_udf <- names(fargs)[2:length(fargs)] # remove first argument, which is x - + argnames_udf <- names(fargs)[2:length(fargs)] # remove first argument, which is x + # determine argument names that where supplied to ipoptr() - argnames_supplied <- names(arglist) - + argnames_supplied <- names(arglist) + # determine which arguments where required but not supplied - m1 = match(argnames_udf, argnames_supplied) - if( any(is.na(m1)) ){ - mx1 = which( is.na(m1) ) - for( i in 1:length(mx1) ){ - stop(paste(funname, " requires argument '", argnames_udf[mx1], "' but this has not been passed to the 'ipoptr' function.\n", sep = "")) - } - } - + m1 = match(argnames_udf, argnames_supplied) + if( any(is.na(m1)) ){ + mx1 = which( is.na(m1) ) + for( i in 1:length(mx1) ){ + stop(paste(funname, " requires argument '", argnames_udf[mx1], "' but this has not been passed to the 'ipoptr' function.\n", sep = "")) + } + } + # determine which arguments where supplied but not required - m2 = match(argnames_supplied, argnames_udf) - if( any(is.na(m2)) ){ - mx2 = which( is.na(m2) ) - for( i in 1:length(mx2) ){ - stop(paste("'", argnames_supplied[mx2], "' passed to (...) in 'ipoptr' but this is not required in the ", funname, " function.\n", sep = "")) - } - } - } - return( 0 ) - } - + m2 = match(argnames_supplied, argnames_udf) + if( any(is.na(m2)) ){ + mx2 = which( is.na(m2) ) + for( i in 1:length(mx2) ){ + stop(paste("'", argnames_supplied[mx2], "' passed to (...) in 'ipoptr' but this is not required in the ", funname, " function.\n", sep = "")) + } + } + } + return( 0 ) + } + # extract list of additional arguments and check user-defined functions arglist <- list(...) - checkFunctionArguments( eval_f, arglist, 'eval_f' ) - checkFunctionArguments( eval_grad_f, arglist, 'eval_grad_f' ) - + checkFunctionArguments( eval_f, arglist, 'eval_f' ) + checkFunctionArguments( eval_grad_f, arglist, 'eval_grad_f' ) + num.constraints <- length( constraint_lb ) if ( num.constraints > 0 ) { checkFunctionArguments( eval_g, arglist, 'eval_g' ) checkFunctionArguments( eval_jac_g, arglist, 'eval_jac_g' ) } - + # write wrappers around user-defined functions to pass additional arguments eval_f_wrapper = function(x){ eval_f(x, ...) } eval_grad_f_wrapper = function(x){ eval_grad_f(x, ...) } - + if ( num.constraints > 0 ) { eval_g_wrapper = function( x ) { eval_g(x, ...) } eval_jac_g_wrapper = function( x ) { eval_jac_g(x, ...) } } else { - eval_g_wrapper = function( x ) { return( numeric(0) ) } - eval_jac_g_wrapper = function( x ) { return( numeric(0) ) } + eval_g_wrapper = function( x ) { return( numeric(0) ) } + eval_jac_g_wrapper = function( x ) { return( numeric(0) ) } } # approximate Hessian @@ -124,36 +124,35 @@ function( x0, checkFunctionArguments( eval_h, c( arglist, obj_factor=0, hessian_lambda=0 ), 'eval_h' ) eval_h_wrapper = function( x, obj_factor, hessian_lambda ) { eval_h(x, obj_factor, hessian_lambda, ...) } } - # build ipoptr object - ret <- list( "x0"=x0, - "eval_f"=eval_f_wrapper, - "eval_grad_f"=eval_grad_f_wrapper, - "lower_bounds"=lb, - "upper_bounds"=ub, - "eval_g"=eval_g_wrapper, - "eval_jac_g"=eval_jac_g_wrapper, - "constraint_lower_bounds"=constraint_lb, - "constraint_upper_bounds"=constraint_ub, + ret <- list( "x0"=x0, + "eval_f"=eval_f_wrapper, + "eval_grad_f"=eval_grad_f_wrapper, + "lower_bounds"=lb, + "upper_bounds"=ub, + "eval_g"=eval_g_wrapper, + "eval_jac_g"=eval_jac_g_wrapper, + "constraint_lower_bounds"=constraint_lb, + "constraint_upper_bounds"=constraint_ub, "eval_jac_g_structure"=eval_jac_g_structure, "eval_h"=eval_h_wrapper, "eval_h_structure"=eval_h_structure, "options"=get.option.types(opts), "environment" = new.env() ) - + attr(ret, "class") <- "ipoptr" - + # add the current call to the list ret$call <- match.call() - + # check whether we have a correctly formed ipoptr object is.ipoptr( ret ) - + # pass ipoptr object to C code solution <- .Call( IpoptRSolve, ret ) - + # add solution variables to object ret$status <- solution$status ret$message <- solution$message @@ -164,6 +163,6 @@ function( x0, ret$z_U <- solution$z_U ret$constraints <- solution$constraints ret$lambda <- solution$lambda - + return( ret ) } diff --git a/contrib/RInterface/R/is.ipoptr.R b/contrib/RInterface/R/is.ipoptr.R index 780904605..32f1f7b18 100644 --- a/contrib/RInterface/R/is.ipoptr.R +++ b/contrib/RInterface/R/is.ipoptr.R @@ -9,69 +9,69 @@ # Output: bool telling whether the object is an ipoptr or not # # Changelog: -# 09/03/2012: Removed ipoptr_environment because this caused a bug in combination with +# 09/03/2012: Removed ipoptr_environment because this caused a bug in combination with # data.table and it wasn't useful (thanks to Florian Oswald for reporting) is.ipoptr <- function(x) { - + # Check whether the object exists and is a list if( is.null(x) ) { return( FALSE ) } if( !is.list(x) ) { return( FALSE ) } - + # Define local flag defining whether we approximate the Hessian or not flag_hessian_approximation = FALSE if ( !is.null( x$options$string$hessian_approximation ) ) { flag_hessian_approximation = ( x$options$string$hessian_approximation == "limited-memory" ) } - + # Check whether the needed functions are supplied stopifnot( is.function(x$eval_f) ) stopifnot( is.function(x$eval_grad_f) ) stopifnot( is.function(x$eval_g) ) stopifnot( is.function(x$eval_jac_g) ) if ( !flag_hessian_approximation ) { stopifnot( is.function(x$eval_h) ) } - + # Check whether bounds are defined for all controls stopifnot( length( x$x0 ) == length( x$lower_bounds ) ) stopifnot( length( x$x0 ) == length( x$upper_bounds ) ) - + # Check whether the initial value is within the bounds stopifnot( all( x$x0 >= x$lower_bounds ) ) stopifnot( all( x$x0 <= x$upper_bounds ) ) - + num.controls <- length( x$x0 ) num.constraints <- length( x$constraint_lower_bounds ) - + # Check the length of some return values stopifnot( length(x$eval_f( x$x0 ))==1 ) stopifnot( length(x$eval_grad_f( x$x0 ))==num.controls ) stopifnot( length(x$eval_g( x$x0 ))==num.constraints ) - stopifnot( length(x$eval_jac_g( x$x0 ))==length(unlist(x$eval_jac_g_structure)) ) # the number of non-zero elements in the Jacobian - if ( !flag_hessian_approximation ) { - stopifnot( length(x$eval_h( x$x0, 1, rep(1,num.constraints) ))==length(unlist(x$eval_h_structure)) ) # the number of non-zero elements in the Hessian + stopifnot( length(x$eval_jac_g( x$x0 ))==length(unlist(x$eval_jac_g_structure)) ) # the number of non-zero elements in the Jacobian + if ( !flag_hessian_approximation ) { + stopifnot( length(x$eval_h( x$x0, 1, rep(1,num.constraints) ))==length(unlist(x$eval_h_structure)) ) # the number of non-zero elements in the Hessian } - + # Check the whether we don't have NA's in initial values stopifnot( all(!is.na(x$eval_f( x$x0 ))) ) stopifnot( all(!is.na(x$eval_grad_f( x$x0 ))) ) stopifnot( all(!is.na(x$eval_g( x$x0 ))) ) - stopifnot( all(!is.na(x$eval_jac_g( x$x0 ))) ) # the number of non-zero elements in the Jacobian - if ( !flag_hessian_approximation ) { - stopifnot( all(!is.na(x$eval_h( x$x0, 1, rep(1,num.constraints) ))) ) # the number of non-zero elements in the Hessian + stopifnot( all(!is.na(x$eval_jac_g( x$x0 ))) ) # the number of non-zero elements in the Jacobian + if ( !flag_hessian_approximation ) { + stopifnot( all(!is.na(x$eval_h( x$x0, 1, rep(1,num.constraints) ))) ) # the number of non-zero elements in the Hessian } - + # Check whether a correct structure was supplied, and check the size stopifnot( is.list(x$eval_jac_g_structure) ) - + stopifnot( length(x$eval_jac_g_structure)==num.constraints ) if ( !flag_hessian_approximation ) { stopifnot( length(x$eval_h_structure)==num.controls ) stopifnot( is.list(x$eval_h_structure) ) } - + # Check the number of non-linear constraints stopifnot( length(x$constraint_lower_bounds)==length(x$constraint_upper_bounds) ) - + # Check whether none of the non-zero indices are larger than the number of controls # Also, the smallest index should be bigger than 0 if ( length( x$eval_jac_g_structure ) > 0 ) { @@ -82,7 +82,7 @@ is.ipoptr <- function(x) { stopifnot( max(unlist(x$eval_h_structure)) <= num.controls ) stopifnot( min(unlist(x$eval_h_structure)) > 0 ) } - + # Check whether option to approximate hessian and eval_h are both set # If we approximate the hessian, then we don't want to set eval_h if ( flag_hessian_approximation ) { @@ -93,7 +93,7 @@ is.ipoptr <- function(x) { warning("Option supplied to approximate hessian, but eval_h_structure is defined.\nSolution: remove option hessian_approximation=limited-memory to use analytic derivatives.") } } - + return( TRUE ) } diff --git a/contrib/RInterface/R/make.sparse.R b/contrib/RInterface/R/make.sparse.R index 6cb2ab080..1cc73f338 100644 --- a/contrib/RInterface/R/make.sparse.R +++ b/contrib/RInterface/R/make.sparse.R @@ -9,11 +9,11 @@ # Output: list with as elements a vector of indices denoting non-zero (TRUE) elements of the matrix make.sparse <- function( A ) { - + # start with empty list to append to - S <- list() - - # loop over matrix by row + S <- list() + + # loop over matrix by row for ( i in 1:nrow(A) ) { indices <- c() for ( j in 1:ncol(A) ) { @@ -23,6 +23,6 @@ make.sparse <- function( A ) { } S <- c( S, list(indices) ) } - + return( S ) } diff --git a/contrib/RInterface/R/plot.sparseness.R b/contrib/RInterface/R/plot.sparseness.R index 67e2eb7d0..2797e9863 100644 --- a/contrib/RInterface/R/plot.sparseness.R +++ b/contrib/RInterface/R/plot.sparseness.R @@ -1,34 +1,34 @@ -# Copyright (C) 2010 Jelmer Ypma. All Rights Reserved. -# This code is published under the Eclipse Public License. -# -# File: plot.sparseness.R -# Author: Jelmer Ypma -# Date: 23 June 2010 -# -# Input: sparse matrix structure (as list with non-zero indices) -# Output: plot a the non-zero elements in the matrix as dots -# useful for matrices with many elements, for smaller ones -# use print.sparseness - -plot.sparseness <- function( x, pch='.', asp=1, xaxs='i', yaxs='i', ... ) { - # make a list of y indices corresponding to the non-zero x indices - structure.y <- lapply( 1:length( x ), function(i) { rep( i, length( x[[i]] ) ) } ) - - indices.x <- unlist( x ) - indices.y <- unlist( structure.y ) - - # plot non-zero elements, where we revert the y-axis (top-left element is 1,1), - # fix the aspect ratio (asp=1) and do not extend the x and y axis (x/yaxs='i') - plot( indices.x, - indices.y, - xlim=c(min(indices.x), max(indices.x)), - ylim=c(max(indices.y), min(indices.y)), - type='p', - pch=pch, - asp=asp, - xaxs=xaxs, - yaxs=yaxs, - ... ) - - return( list( x=indices.x, y=indices.y ) ) -} +# Copyright (C) 2010 Jelmer Ypma. All Rights Reserved. +# This code is published under the Eclipse Public License. +# +# File: plot.sparseness.R +# Author: Jelmer Ypma +# Date: 23 June 2010 +# +# Input: sparse matrix structure (as list with non-zero indices) +# Output: plot a the non-zero elements in the matrix as dots +# useful for matrices with many elements, for smaller ones +# use print.sparseness + +plot.sparseness <- function( x, pch='.', asp=1, xaxs='i', yaxs='i', ... ) { + # make a list of y indices corresponding to the non-zero x indices + structure.y <- lapply( 1:length( x ), function(i) { rep( i, length( x[[i]] ) ) } ) + + indices.x <- unlist( x ) + indices.y <- unlist( structure.y ) + + # plot non-zero elements, where we revert the y-axis (top-left element is 1,1), + # fix the aspect ratio (asp=1) and do not extend the x and y axis (x/yaxs='i') + plot( indices.x, + indices.y, + xlim=c(min(indices.x), max(indices.x)), + ylim=c(max(indices.y), min(indices.y)), + type='p', + pch=pch, + asp=asp, + xaxs=xaxs, + yaxs=yaxs, + ... ) + + return( list( x=indices.x, y=indices.y ) ) +} diff --git a/contrib/RInterface/R/print.ipoptr.R b/contrib/RInterface/R/print.ipoptr.R index f4d4351eb..1316c54af 100644 --- a/contrib/RInterface/R/print.ipoptr.R +++ b/contrib/RInterface/R/print.ipoptr.R @@ -5,15 +5,15 @@ # Author: Jelmer Ypma # Date: 18 April 2010 # -# This function prints some basic output of a ipoptr -# ojbect. The information is only available after it +# This function prints some basic output of a ipoptr +# ojbect. The information is only available after it # has been solved. print.ipoptr <- function(x, show.controls=TRUE, ...) { - cat("\nCall:\n", deparse(x$call), "\n\n", sep = "", fill=TRUE) - cat( unlist(strsplit(paste( "Ipopt solver status:", x$status, "(", x$message, ")\n" ),' ')), fill=TRUE ) + cat("\nCall:\n", deparse(x$call), "\n\n", sep = "", fill=TRUE) + cat( unlist(strsplit(paste( "Ipopt solver status:", x$status, "(", x$message, ")\n" ),' ')), fill=TRUE ) cat( paste( "Number of Iterations....:", x$iterations, "\n" ) ) - + # if show.controls is TRUE or FALSE, show all or none of the controls if ( is.logical( show.controls ) ) { # show all control variables @@ -21,18 +21,18 @@ print.ipoptr <- function(x, show.controls=TRUE, ...) { controls.indices = 1:length(x$solution) } } - + # if show.controls is a vector with indices, rename this vector # and define show.controls as TRUE if ( is.numeric( show.controls ) ) { controls.indices = show.controls show.controls = TRUE } - - # if solved successfully - if ( x$status<=0 ) { - cat( paste( "Optimal value of objective function: ", x$objective, "\n" ) ) - if ( show.controls ) { + + # if solved successfully + if ( x$status<=0 ) { + cat( paste( "Optimal value of objective function: ", x$objective, "\n" ) ) + if ( show.controls ) { if ( length( controls.indices ) < length(x$solution) ) { cat( "Optimal value of user-defined subset of controls: " ) } else { @@ -41,9 +41,9 @@ print.ipoptr <- function(x, show.controls=TRUE, ...) { cat( x$solution[ controls.indices ], fill=TRUE) cat("\n") } - } else { - cat( paste( "Current value of objective function: ", x$objective, "\n" ) ) - if ( show.controls ) { + } else { + cat( paste( "Current value of objective function: ", x$objective, "\n" ) ) + if ( show.controls ) { if ( length( controls.indices ) < length(x$solution) ) { cat( "Current value of user-defined subset of controls: " ) } else { @@ -53,5 +53,5 @@ print.ipoptr <- function(x, show.controls=TRUE, ...) { cat("\n") } } - cat("\n") + cat("\n") } diff --git a/contrib/RInterface/R/print.sparseness.R b/contrib/RInterface/R/print.sparseness.R index e82affc18..70ba501cb 100644 --- a/contrib/RInterface/R/print.sparseness.R +++ b/contrib/RInterface/R/print.sparseness.R @@ -10,17 +10,17 @@ print.sparseness <- function( x, indices=TRUE, data=NULL, ncol=NULL, ... ) { stopifnot( is.list(x) ) - - # if number of columns is not supplied, take it as the maximum + + # if number of columns is not supplied, take it as the maximum # value of the indices if ( is.null(ncol) ) { ncol <- max(unlist(x)) } - + # create matrix with dots p <- data.frame( matrix( ".", nrow=length(x), ncol ), stringsAsFactors=FALSE ) names( p ) <- 1:ncol - + # change dots by 'x' or count of index cnt=1 for ( row in 1:length(x) ) { @@ -39,8 +39,8 @@ print.sparseness <- function( x, indices=TRUE, data=NULL, ncol=NULL, ... ) { } } cnt = cnt+1 - } + } } - + return( p ) } diff --git a/contrib/RInterface/README b/contrib/RInterface/README index 9ddd45723..2c26d4e56 100644 --- a/contrib/RInterface/README +++ b/contrib/RInterface/README @@ -1,15 +1,15 @@ -Package: ipoptr -Type: Package -Title: R interface to Ipopt -Version: 0.8 -Date: 2010-07-18 -Author: Jelmer Ypma -Maintainer: Jelmer Ypma -Description: ipoptr is an R interface to Ipopt (Interior Point Optimizer), an open source software package for large-scale nonlinear optimization. It can be used to solve general nonlinear programming problems with nonlinear constraints and lower and upper bounds for the controls. Ipopt is written in C++ and is released as open source code under the Eclipse Public License (EPL). It is available from the COIN-OR initiative. The code has been written by Carl Laird and Andreas Waechter, who is the COIN project leader for Ipopt. -License: EPL -Directories follow the standard structure of an R package: - - inst Contains citation information that is displayed by the R citation('ipoptr') command, and the TeX/Sweave code of the documentation. - - man Contains help-files for the commands available in this package. E.g. ?ipoptr in R shows the help-file for the ipoptr command. - - R Contains R code defining the R commands. Each command is defined in a separate file. - - src Contains C++ code interfacing between R and Ipopt. - - tests Contains some examples/tests to show how the R interface works. \ No newline at end of file +Package: ipoptr +Type: Package +Title: R interface to Ipopt +Version: 0.8 +Date: 2010-07-18 +Author: Jelmer Ypma +Maintainer: Jelmer Ypma +Description: ipoptr is an R interface to Ipopt (Interior Point Optimizer), an open source software package for large-scale nonlinear optimization. It can be used to solve general nonlinear programming problems with nonlinear constraints and lower and upper bounds for the controls. Ipopt is written in C++ and is released as open source code under the Eclipse Public License (EPL). It is available from the COIN-OR initiative. The code has been written by Carl Laird and Andreas Waechter, who is the COIN project leader for Ipopt. +License: EPL +Directories follow the standard structure of an R package: + - inst Contains citation information that is displayed by the R citation('ipoptr') command, and the TeX/Sweave code of the documentation. + - man Contains help-files for the commands available in this package. E.g. ?ipoptr in R shows the help-file for the ipoptr command. + - R Contains R code defining the R commands. Each command is defined in a separate file. + - src Contains C++ code interfacing between R and Ipopt. + - tests Contains some examples/tests to show how the R interface works. \ No newline at end of file diff --git a/contrib/RInterface/inst/CITATION b/contrib/RInterface/inst/CITATION index 73d6146dd..a4c454dbf 100644 --- a/contrib/RInterface/inst/CITATION +++ b/contrib/RInterface/inst/CITATION @@ -1,12 +1,12 @@ citHeader("To cite Ipopt in publications use:") citEntry(entry="Article", - title = "On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming", + title = "On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming", author = personList(as.person("A. W\"{a}chter"), as.person("L. T. Biegler")), year = "2006", journal = "Mathematical Programming", volume = "106", number = "1", - pages = "25--57", - textVersion = "A. W\"{a}chter and L. T. Biegler, On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming, Mathematical Programming 106(1), pp. 25-57, 2006" ) + pages = "25--57", + textVersion = "A. W\"{a}chter and L. T. Biegler, On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming, Mathematical Programming 106(1), pp. 25-57, 2006" ) diff --git a/contrib/RInterface/inst/doc/ipoptr.Rnw b/contrib/RInterface/inst/doc/ipoptr.Rnw index 2d5782351..5f1d8e5a3 100644 --- a/contrib/RInterface/inst/doc/ipoptr.Rnw +++ b/contrib/RInterface/inst/doc/ipoptr.Rnw @@ -38,7 +38,7 @@ options(SweaveHooks=list(fig=function() @ \begin{abstract} -This document describes how to use \texttt{ipoptr}, which is an R interface to Ipopt (Interior Point Optimizer). Ipopt is an open source software package for large-scale nonlinear optimization \cite{WachterBiegler2006}. It can be used to solve general nonlinear programming problems with nonlinear constraints and lower and upper bounds for the controls. Ipopt is written in C++ and is released as open source code under the Eclipse Public License (EPL). It is available from the COIN-OR initiative. The code has been written by Carl Laird and Andreas W\"achter, who is the COIN project leader for Ipopt. +This document describes how to use \texttt{ipoptr}, which is an R interface to Ipopt (Interior Point Optimizer). Ipopt is an open source software package for large-scale nonlinear optimization \cite{WachterBiegler2006}. It can be used to solve general nonlinear programming problems with nonlinear constraints and lower and upper bounds for the controls. Ipopt is written in C++ and is released as open source code under the Eclipse Public License (EPL). It is available from the COIN-OR initiative. The code has been written by Carl Laird and Andreas W\"achter, who is the COIN project leader for Ipopt. \end{abstract} \section{Introduction} @@ -50,7 +50,7 @@ Ipopt is designed to find (local) solutions of mathematical optimization problem \end{eqnarray*} where $f(x): R^n \rightarrow R$ is the objective function, and $g(x): R^n \rightarrow R^m$ are the constraint functions. The vectors $g_L$ and $g_U$ denote the lower and upper bounds on the constraints, and the vectors $x_L$ and $x_U$ are the bounds on the variables $x$. The functions $f(x)$ and $g(x)$ can be nonlinear and nonconvex, but should be twice continuously differentiable. Note that equality constraints can be formulated in the above formulation by setting the corresponding components of $g_L$ and $g_U$ to the same value. -This vignette describes how to formulate minimization problems to be solved with the R interface to Ipopt. If you want to use the C++ interface directly or are interested in the Matlab interface, there are other sources of documentation avialable. Some of the information here is heavily based on the Ipopt Wiki\footnote{\texttt{https://projects.coin-or.org/Ipopt}} and generally that is a good source to find additional information, for instance on which options to use. All credit for implementing the C++ code for Ipopt should go to Andreas W\"achter and Carl Laird. Please show your appreciation by citing their paper. +This vignette describes how to formulate minimization problems to be solved with the R interface to Ipopt. If you want to use the C++ interface directly or are interested in the Matlab interface, there are other sources of documentation available. Some of the information here is heavily based on the Ipopt documentation\footnote{\texttt{https://coin-or.github.io/Ipopt/}} and generally that is a good source to find additional information, for instance on which options to use. All credit for implementing the C++ code for Ipopt should go to Andreas W\"achter and Carl Laird. Please show your appreciation by citing their paper. \section{Installation} Installing the \texttt{ipoptr} package is not as straightforward as most other R packages, because it depends on Ipopt. To install (and compile) Ipopt and the R interface a C/C++ compiler has to be available. On Windows I was successful using MSYS to compile Ipopt and then use Rtools\footnote{\texttt{http://www.murdoch-sutherland.com/Rtools/}} to compile the R interface from source. On Ubuntu no additional tools were needed. @@ -59,9 +59,9 @@ The code for the R interface to Ipopt is available from R-Forge and from the Ipo Detailed installation instructions for Ipopt are available on \texttt{http://www.coin-or.org/Ipopt/documentation}. You should follow these first, before trying to install the R interface. Ipopt needs to be configured using the \texttt{-fPIC} flag for all GNU compilers, which usually happens by default. In builds of debug or static libraries, one need to use the option \verb|--with-pic| for configure. -For the installation of the R interface, I will assume that you have a working installation of Ipopt (i.e. \texttt{configure}, \texttt{make} and \texttt{make install} executed without problems). +For the installation of the R interface, I will assume that you have a working installation of Ipopt (i.e. \texttt{configure}, \texttt{make} and \texttt{make install} executed without problems). -During the installation of Ipopt a file \texttt{Makevars} (or \texttt{Makevars.win} on Windows) has been created in the \texttt{src} subdirectory of the build directory of the R interface, e.g., \texttt{\$IPOPTDIR/build/Ipopt/contrib/RInterface/src} if you used the same build directory as in the Ipopt installation notes, \texttt{\$IPOPTDIR/build}. The file \texttt{Makevars}(\texttt{.win}) in this directory has been configured for your system. +During the installation of Ipopt a file \texttt{Makevars} (or \texttt{Makevars.win} on Windows) has been created in the \texttt{src} subdirectory of the build directory of the R interface, e.g., \texttt{\$IPOPTDIR/build/Ipopt/contrib/RInterface/src} if you used the same build directory as in the Ipopt installation notes, \texttt{\$IPOPTDIR/build}. The file \texttt{Makevars}(\texttt{.win}) in this directory has been configured for your system. You can then install the package from R with the command <>= @@ -80,7 +80,7 @@ f( x ) = 100 \left( x_2 - x_1^2 \right)^2 + \left(1 - x_1 \right)^2, \] which is also used as an example in the documentation for the standard R optimizer \texttt{optim}. The gradient of the objective function is given by \[ -\nabla f( x ) = +\nabla f( x ) = \left( \begin{array}[1]{c} -400 \cdot x_1 \cdot (x_2 - x_1^2) - 2 \cdot (1 - x_1) \\ 200 \cdot (x_2 - x_1^2) @@ -93,12 +93,12 @@ library(ipoptr) we start by specifying the objective function and its gradient <>= ## Rosenbrock Banana function -eval_f <- function(x) { +eval_f <- function(x) { return( 100 * (x[2] - x[1] * x[1])^2 + (1 - x[1])^2 ) } ## Gradient of Rosenbrock Banana function -eval_grad_f <- function(x) { +eval_grad_f <- function(x) { return( c( -400 * x[1] * (x[2] - x[1] * x[1]) - 2 * (1 - x[1]), 200 * (x[2] - x[1] * x[1]) ) ) } @@ -108,11 +108,11 @@ We define initial values # initial values x0 <- c( -1.2, 1 ) @ -and then minimize the function using the \texttt{ipoptr} command. This command runs some checks on the supplied inputs and returns an object with the exit code of the solver, the optimal value of the objective function and the solution. The checks do not always return very informative messages, but usually there is something wrong with dimensions (e.g. \texttt{eval\_grad\_f} returns a vector that doesn't have the same size as \texttt{x0}). -<>= +and then minimize the function using the \texttt{ipoptr} command. This command runs some checks on the supplied inputs and returns an object with the exit code of the solver, the optimal value of the objective function and the solution. The checks do not always return very informative messages, but usually there is something wrong with dimensions (e.g. \texttt{eval\_grad\_f} returns a vector that doesn't have the same size as \texttt{x0}). +<>= # solve Rosenbrock Banana function -res <- ipoptr( x0=x0, - eval_f=eval_f, +res <- ipoptr( x0=x0, + eval_f=eval_f, eval_grad_f=eval_grad_f ) @ These are the minimal arguments that have to be supplied. If, like above, no Hessian is defined, Ipopt uses an approximation. The Ipopt website has a detailed explanation of the output. We can see a summary of the results by printing the resulting object. @@ -124,13 +124,13 @@ It's advised to always check the exit code for convergence of the problem and in If you do not want to, or cannot calculate the gradient analytically, you can supply a function \texttt{eval\_grad\_f} that approximates the gradient. However, this is not advisable and might result in convergence problems, for instance by not finding the minimum, or by finding the wrong minimum. We can see this from the following example where we approximate \texttt{eval\_grad\_f} using finite differences <>= # http://en.wikipedia.org/wiki/Numerical_differentiation -finite.diff <- function( func, - x, - minAbsValue=0, +finite.diff <- function( func, + x, + minAbsValue=0, stepSize=sqrt( .Machine$double.eps ), ... ) { - stepSizeVec <- pmax( abs(x), 1 ) * stepSize - + stepSizeVec <- pmax( abs(x), 1 ) * stepSize + fx <- func( x, ... ) approx.gradf.index <- function(i, x, func, fx, stepSizeVec, ...) { x_prime <- x @@ -139,14 +139,14 @@ finite.diff <- function( func, fx_prime <- func( x_prime, ... ) return( ( fx_prime - fx )/stepSizeVec[i] ) } - grad_fx <- sapply( 1:length(x), - approx.gradf.index, - x=x, - func=func, - fx=fx, - stepSizeVec=stepSizeVec, + grad_fx <- sapply( 1:length(x), + approx.gradf.index, + x=x, + func=func, + fx=fx, + stepSizeVec=stepSizeVec, ... ) - + return( grad_fx ) } @@ -159,11 +159,11 @@ and using this approximation to minimize the same Rosenbrock Banana function. We <>= # increase the maximum number of iterations opts <- list("tol"=1.0e-8, "max_iter"=5000, "print_level"=0) - + # solve Rosenbrock Banana function with approximated gradient -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=approx_grad_f, +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=approx_grad_f, opts=opts) ) @ In this case 5000 iterations are not enough to solve the minimization problem to the required tolerance. This has to do with the step size we choose to approximate the gradient @@ -174,11 +174,11 @@ which is of the same order of magnitude. If we decrease the tolerance, the algor <>= # decrease the convergence criterium opts <- list("tol"=1.0e-7, "print_level"=0) - + # solve Rosenbrock Banana function with approximated gradient -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=approx_grad_f, +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=approx_grad_f, opts=opts) ) @ @@ -221,8 +221,8 @@ print.sparseness( A_diag, indices=FALSE ) For larger matrices it is easier to plot them using the \texttt{plot.sparseness} command <>= -s <- do.call( "cbind", lapply( 1:5, function(i) { - diag(5) %x% matrix(1, nrow=5, ncol=20) +s <- do.call( "cbind", lapply( 1:5, function(i) { + diag(5) %x% matrix(1, nrow=5, ncol=20) } ) ) s <- do.call( "rbind", lapply( 1:5, function(i) { s } ) ) s <- cbind( matrix( 1, nrow=nrow(s), ncol=40 ), s ) @@ -243,18 +243,18 @@ Now that we know how to define a sparseness structure we can supply the Hessian \[ \nabla^2 f( x ) = \left( \begin{array}[2]{rr} 2 - 400 \cdot (x_2 - x_1^2) + 800 x_1^2 & -400 x_1 \\ --400 x_1 & 200 +-400 x_1 & 200 \end{array} \right) \] Ipopt needs the Hessian of the Lagrangian in the following form \[ \sigma_f \nabla^2 f(x) + \sum_{i=1}^m \lambda_i \nabla^2 g_i(x), \] -where $g_i(x)$ represents the $i$th of $m$ constraints, $\lambda_i$ are the multipliers of the constraints and $\sigma_f$ is introduced so that Ipopt can ask for the Hessian of the objective or the constraints independently if required. +where $g_i(x)$ represents the $i$th of $m$ constraints, $\lambda_i$ are the multipliers of the constraints and $\sigma_f$ is introduced so that Ipopt can ask for the Hessian of the objective or the constraints independently if required. In this case we don't have any constraints. The user-defined function \texttt{eval\_h} to define the Hessian takes three arguments. The first argument contains the value of the control variables, $x$, the second argument contains the multiplication factor of the Hessian of the objective function, $\sigma_f$, and the third argument contains a vector with the multipliers of the constraints, $\lambda$. We can define the structure of the Hessian and the function to evaluate the Hessian as follows <>= -# The Hessian for this problem is actually dense, +# The Hessian for this problem is actually dense, # This is a symmetric matrix, fill the lower left triangle only. eval_h_structure <- list( c(1), c(1,2) ) @@ -270,15 +270,15 @@ opts <- list("print_level"=0, "file_print_level"=12, "output_file"="banana.out", "tol"=1.0e-8) - + # solve Rosenbrock Banana function with analytic Hessian -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, eval_h=eval_h, eval_h_structure=eval_h_structure, opts=opts) ) -@ +@ Here we also supplied options to not print any intermediate information to the R screen (\texttt{print\_level=0}). Printing output to the screen directly from Ipopt does not work in all R terminals correctly, so it might be that even though you specify a positive number here, there will still be no output visible on the screen. If you want to print things to the screen, a workaround is to do this directly in the R functions you defined, such as \texttt{eval\_f}. Also, to inspect more details about the minimization we can write all the output to a file, which will be created in the current working directory. For larger problems, having a large number for \texttt{file\_print\_level} can easily generate very large files, which is probably not desirable. Many more options are available, and a full list of all the options can be found at the Ipopt website, \texttt{http://www.coin-or.org/Ipopt/documentation/node59.html\#app.options\_ref}. Options can also be supplied from an option file, which can be specified in \texttt{option\_file\_name}. @@ -294,15 +294,15 @@ To look at how we can add constraints to a problem, we take example problem numb \end{eqnarray*} and we use $x = (1, 5, 5, 1)$ as initial values. In this problem we have one inequality constraint, one equality constraint and upper and lower bounds for all the variables. The optimal solution is $(1.00000000, 4.74299963, 3.82114998, 1.37940829)$. First we define the objective function and its gradient <>= -eval_f <- function( x ) { - return( x[1]*x[4]*(x[1] + x[2] + x[3]) + x[3] ) +eval_f <- function( x ) { + return( x[1]*x[4]*(x[1] + x[2] + x[3]) + x[3] ) } eval_grad_f <- function( x ) { return( c( x[1] * x[4] + x[4] * (x[1] + x[2] + x[3]), x[1] * x[4], x[1] * x[4] + 1.0, - x[1] * (x[1] + x[2] + x[3]) ) ) + x[1] * (x[1] + x[2] + x[3]) ) ) } @ Then we define a function that returns the value of the two constraints. We define the bounds of the constraints (in this case the $g_L$ and $g_U$ are $25$ and $40$) later. @@ -330,7 +330,7 @@ eval_jac_g <- function( x ) { @ The Hessian is also dense, but it looks slightly more complicated because we have to take into account the Hessian of the objective function and of the constraints at the same time, although you could write a function to calculate them both separately and then return the combined result in \texttt{eval\_h}. <>= -# The Hessian for this problem is actually dense, +# The Hessian for this problem is actually dense, # This is a symmetric matrix, fill the lower left triangle only. eval_h_structure <- list( c(1), c(1,2), c(1,2,3), c(1,2,3,4) ) @@ -354,7 +354,7 @@ eval_h <- function( x, obj_factor, hessian_lambda ) { # add the portion for the first constraint values[2] = values[2] + hessian_lambda[1] * (x[3] * x[4]) # 2,1 - + values[4] = values[4] + hessian_lambda[1] * (x[2] * x[4]) # 3,1 values[5] = values[5] + hessian_lambda[1] * (x[1] * x[4]) # 3,2 @@ -387,16 +387,16 @@ constraint_ub <- c( Inf, 40 ) opts <- list("print_level"=0, "file_print_level"=12, "output_file"="hs071_nlp.out") - -print( ipoptr( x0 = x0, - eval_f = eval_f, - eval_grad_f = eval_grad_f, - lb = lb, - ub = ub, - eval_g = eval_g, - eval_jac_g = eval_jac_g, - constraint_lb = constraint_lb, - constraint_ub = constraint_ub, + +print( ipoptr( x0 = x0, + eval_f = eval_f, + eval_grad_f = eval_grad_f, + lb = lb, + ub = ub, + eval_g = eval_g, + eval_jac_g = eval_jac_g, + constraint_lb = constraint_lb, + constraint_ub = constraint_ub, eval_jac_g_structure = eval_jac_g_structure, eval_h = eval_h, eval_h_structure = eval_h_structure, @@ -410,24 +410,24 @@ As a very simple example\footnote{A more interesting example is given in \texttt \[ f( x ) = a_1 x^2 + a_2 x + a_3 \] -for different values of the parameters $a_1$, $a_2$ and $a_3$. +for different values of the parameters $a_1$, $a_2$ and $a_3$. First we define the objective function and its gradient using, assuming that there is some variable \texttt{params} that contains the values of the parameters. <>= -eval_f_ex1 <- function(x, params) { - return( params[1]*x^2 + params[2]*x + params[3] ) +eval_f_ex1 <- function(x, params) { + return( params[1]*x^2 + params[2]*x + params[3] ) } -eval_grad_f_ex1 <- function(x, params) { - return( 2*params[1]*x + params[2] ) +eval_grad_f_ex1 <- function(x, params) { + return( 2*params[1]*x + params[2] ) } @ -Note that the first parameter should always be the control variable. All of the user-defined functions should contain the same set of additional parameters. You have to supply them as input argument to all functions, even if you're not using them in some of the functions. +Note that the first parameter should always be the control variable. All of the user-defined functions should contain the same set of additional parameters. You have to supply them as input argument to all functions, even if you're not using them in some of the functions. Then we can solve the problem for a specific set of parameters, in this case $a_1=1$, $a_2=2$ and $a_3=3$, from initial value $x_0=0$, with the following command <>= # solve using ipoptr with additional parameters -ipoptr( x0 = 0, - eval_f = eval_f_ex1, +ipoptr( x0 = 0, + eval_f = eval_f_ex1, eval_grad_f = eval_grad_f_ex1, opts = list("print_level"=0), params = c(1,2,3) ) @@ -435,11 +435,11 @@ ipoptr( x0 = 0, For the second method, we don't have to supply the parameters as additional arguments to the function. <>= -eval_f_ex2 <- function(x) { - return( params[1]*x^2 + params[2]*x + params[3] ) +eval_f_ex2 <- function(x) { + return( params[1]*x^2 + params[2]*x + params[3] ) } -eval_grad_f_ex2 <- function(x) { - return( 2*params[1]*x + params[2] ) +eval_grad_f_ex2 <- function(x) { + return( 2*params[1]*x + params[2] ) } @ Instead, we define an environment that contains specific values of \texttt{params} @@ -451,9 +451,9 @@ auxdata$params <- c(1,2,3) To solve this we supply \texttt{auxdata} as an argument to \texttt{ipoptr}, which will take care of evaluating the functions in the correct environment, so that auxiliary data is available. <>= # pass the environment that should be used to evaluate functions to ipoptr -ipoptr( x0 = 0, - eval_f = eval_f_ex2, - eval_grad_f = eval_grad_f_ex2, +ipoptr( x0 = 0, + eval_f = eval_f_ex2, + eval_grad_f = eval_grad_f_ex2, ipoptr_environment = auxdata, opts = list("print_level"=0) ) @ diff --git a/contrib/RInterface/inst/doc/reflist.bib b/contrib/RInterface/inst/doc/reflist.bib index 7def676d9..12c8308a0 100644 --- a/contrib/RInterface/inst/doc/reflist.bib +++ b/contrib/RInterface/inst/doc/reflist.bib @@ -1,23 +1,21 @@ -@inproceedings{Leisch2002, - author = {Friedrich Leisch}, - title = {Sweave: Dynamic Generation of Statistical Reports Using - Literate Data Analysis}, - booktitle = {Compstat 2002 --- Proceedings in Computational - Statistics}, - pages = {575--580}, - year = 2002, - editor = {Wolfgang H{\"a}rdle and Bernd R{\"o}nz}, - publisher = {Physica Verlag, Heidelberg}, - note = {ISBN 3-7908-1517-9}, - url = {http://www.stat.uni-muenchen.de/~leisch/Sweave} -} - -@article{WachterBiegler2006, - author = {A. W{\"a}chter and L. T. Biegler}, - title = {On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming}, - journal = {Mathematical Programming}, - volume = {106}, - number = {1}, - pages = {25--57}, - year = {2006} -} +@inproceedings{Leisch2002, + author = {Friedrich Leisch}, + title = {Sweave: Dynamic Generation of Statistical Reports Using Literate Data Analysis}, + booktitle = {Compstat 2002 --- Proceedings in Computational Statistics}, + pages = {575--580}, + year = 2002, + editor = {Wolfgang H{\"a}rdle and Bernd R{\"o}nz}, + publisher = {Physica Verlag, Heidelberg}, + note = {ISBN 3-7908-1517-9}, + url = {http://www.stat.uni-muenchen.de/~leisch/Sweave} +} + +@article{WachterBiegler2006, + author = {A. W{\"a}chter and L. T. Biegler}, + title = {On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming}, + journal = {Mathematical Programming}, + volume = {106}, + number = {1}, + pages = {25--57}, + year = {2006} +} diff --git a/contrib/RInterface/man/ipoptr-package.Rd b/contrib/RInterface/man/ipoptr-package.Rd index 04f7feba0..a0c1048a5 100644 --- a/contrib/RInterface/man/ipoptr-package.Rd +++ b/contrib/RInterface/man/ipoptr-package.Rd @@ -5,12 +5,12 @@ R interface to Ipopt } \description{ -ipoptr is an R interface to Ipopt (Interior Point Optimizer), an open source software -package for large-scale nonlinear optimization. It can be used to solve general nonlinear -programming problems with nonlinear constraints and lower and upper bounds for the controls. -Ipopt is written in C++ and is released as open source code under the Eclipse Public License (EPL). -It is available from the COIN-OR initiative. The code has been written by Carl Laird and -Andreas Waechter, who is the COIN project leader for Ipopt. +ipoptr is an R interface to Ipopt (Interior Point Optimizer), an open source software +package for large-scale nonlinear optimization. It can be used to solve general nonlinear +programming problems with nonlinear constraints and lower and upper bounds for the controls. +Ipopt is written in C++ and is released as open source code under the Eclipse Public License (EPL). +It is available from the COIN-OR initiative. The code has been written by Carl Laird and +Andreas Waechter, who is the COIN project leader for Ipopt. Ipopt is designed to find (local) solutions of mathematical optimization problems of the from @@ -20,11 +20,11 @@ x in R^n s.t. g_L <= g(x) <= g_U x_L <= x <= x_U -where f(x): R^n --> R is the objective function, and g(x): R^n --> R^m are the constraint -functions. The vectors g_L and g_U denote the lower and upper bounds on the constraints, -and the vectors x_L and x_U are the bounds on the variables x. The functions f(x) and g(x) -can be nonlinear and nonconvex, but should be twice continuously differentiable. Note that -equality constraints can be formulated in the above formulation by setting the corresponding +where f(x): R^n --> R is the objective function, and g(x): R^n --> R^m are the constraint +functions. The vectors g_L and g_U denote the lower and upper bounds on the constraints, +and the vectors x_L and x_U are the bounds on the variables x. The functions f(x) and g(x) +can be nonlinear and nonconvex, but should be twice continuously differentiable. Note that +equality constraints can be formulated in the above formulation by setting the corresponding components of g_L and g_U to the same value. } \author{ @@ -63,15 +63,15 @@ library('ipoptr') # # f(x) = x1*x4*(x1 + x2 + x3) + x3 # -eval_f <- function( x ) { - return( x[1]*x[4]*(x[1] + x[2] + x[3]) + x[3] ) +eval_f <- function( x ) { + return( x[1]*x[4]*(x[1] + x[2] + x[3]) + x[3] ) } eval_grad_f <- function( x ) { return( c( x[1] * x[4] + x[4] * (x[1] + x[2] + x[3]), x[1] * x[4], x[1] * x[4] + 1.0, - x[1] * (x[1] + x[2] + x[3]) ) ) + x[1] * (x[1] + x[2] + x[3]) ) ) } # constraint functions @@ -94,7 +94,7 @@ eval_jac_g <- function( x ) { 2.0*x[4] ) ) } -# The Hessian for this problem is actually dense, +# The Hessian for this problem is actually dense, # This is a symmetric matrix, fill the lower left triangle only. eval_h_structure <- list( c(1), c(1,2), c(1,2,3), c(1,2,3,4) ) @@ -118,7 +118,7 @@ eval_h <- function( x, obj_factor, hessian_lambda ) { # add the portion for the first constraint values[2] = values[2] + hessian_lambda[1] * (x[3] * x[4]) # 2,1 - + values[4] = values[4] + hessian_lambda[1] * (x[2] * x[4]) # 3,1 values[5] = values[5] + hessian_lambda[1] * (x[1] * x[4]) # 3,2 @@ -150,16 +150,16 @@ constraint_ub <- c( Inf, 40 ) opts <- list("print_level"=0, "file_print_level"=12, "output_file"="hs071_nlp.out") - -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, - lb=lb, - ub=ub, - eval_g=eval_g, - eval_jac_g=eval_jac_g, - constraint_lb=constraint_lb, - constraint_ub=constraint_ub, + +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, + lb=lb, + ub=ub, + eval_g=eval_g, + eval_jac_g=eval_jac_g, + constraint_lb=constraint_lb, + constraint_ub=constraint_ub, eval_jac_g_structure=eval_jac_g_structure, eval_h=eval_h, eval_h_structure=eval_h_structure, diff --git a/contrib/RInterface/man/ipoptr.Rd b/contrib/RInterface/man/ipoptr.Rd index e0cb8fdae..976590baa 100644 --- a/contrib/RInterface/man/ipoptr.Rd +++ b/contrib/RInterface/man/ipoptr.Rd @@ -4,13 +4,13 @@ R interface to Ipopt } \description{ -ipoptr is an R interface to Ipopt (Interior Point Optimizer), an open source -software package for large-scale nonlinear optimization. It can be used to -solve general nonlinear programming problems with nonlinear constraints and -lower and upper bounds for the controls. Ipopt is written in C++ and is released -as open source code under the Eclipse Public License (EPL). It is available from -the COIN-OR initiative. The code has been written by Carl Laird and Andreas Waechter, -who is the COIN project leader for Ipopt. +ipoptr is an R interface to Ipopt (Interior Point Optimizer), an open source +software package for large-scale nonlinear optimization. It can be used to +solve general nonlinear programming problems with nonlinear constraints and +lower and upper bounds for the controls. Ipopt is written in C++ and is released +as open source code under the Eclipse Public License (EPL). It is available from +the COIN-OR initiative. The code has been written by Carl Laird and Andreas Waechter, +who is the COIN project leader for Ipopt. Ipopt is designed to find (local) solutions of mathematical optimization problems of the from @@ -20,23 +20,23 @@ x in R^n s.t. g_L <= g(x) <= g_U x_L <= x <= x_U -where f(x): R^n --> R is the objective function, and g(x): R^n --> R^m are the constraint -functions. The vectors g_L and g_U denote the lower and upper bounds on the constraints, -and the vectors x_L and x_U are the bounds on the variables x. The functions f(x) and g(x) -can be nonlinear and nonconvex, but should be twice continuously differentiable. Note that -equality constraints can be formulated in the above formulation by setting the corresponding +where f(x): R^n --> R is the objective function, and g(x): R^n --> R^m are the constraint +functions. The vectors g_L and g_U denote the lower and upper bounds on the constraints, +and the vectors x_L and x_U are the bounds on the variables x. The functions f(x) and g(x) +can be nonlinear and nonconvex, but should be twice continuously differentiable. Note that +equality constraints can be formulated in the above formulation by setting the corresponding components of g_L and g_U to the same value. } \usage{ -ipoptr( x0, - eval_f, - eval_grad_f, - lb = NULL, - ub = NULL, - eval_g = function( x ) { return( numeric(0) ) }, - eval_jac_g = function( x ) { return( numeric(0) ) }, +ipoptr( x0, + eval_f, + eval_grad_f, + lb = NULL, + ub = NULL, + eval_g = function( x ) { return( numeric(0) ) }, + eval_jac_g = function( x ) { return( numeric(0) ) }, eval_jac_g_structure = list(), - constraint_lb = numeric(0), + constraint_lb = numeric(0), constraint_ub = numeric(0), eval_h = NULL, eval_h_structure = NULL, @@ -69,8 +69,8 @@ ipoptr( x0, function to evaluate the jacobian of the (non-)linear constraints that should hold in the solution. } \item{eval_jac_g_structure}{ - list of vectors with indices defining the sparseness structure of the Jacobian. - Each element of the list corresponds to a row in the matrix. Each index corresponds + list of vectors with indices defining the sparseness structure of the Jacobian. + Each element of the list corresponds to a row in the matrix. Each index corresponds to a non-zero element in the matrix (see also \code{\link[ipoptr:print.sparseness]{print.sparseness}}). } \item{constraint_lb}{ @@ -83,18 +83,18 @@ ipoptr( x0, function to evaluate the hessian. } \item{eval_h_structure}{ - list of vectors with indices defining the sparseness structure of the Hessian. - Each element of the list corresponds to a row in the matrix. Each index corresponds + list of vectors with indices defining the sparseness structure of the Hessian. + Each element of the list corresponds to a row in the matrix. Each index corresponds to a non-zero element in the matrix (see also \code{\link[ipoptr:print.sparseness]{print.sparseness}}). } \item{opts}{ - list with options, see examples below. For a full list of options use the option + list with options, see examples below. For a full list of options use the option "print_options_documentation"='yes', or have a look at the Ipopt documentation at \url{http://www.coin-or.org/Ipopt/documentation/}. } \item{ipoptr_environment}{ - environment that is used to evaluate the functions. Use this to pass - additional data or parameters to a function. See the second example in + environment that is used to evaluate the functions. Use this to pass + additional data or parameters to a function. See the second example in \code{parameters.R} in the \code{tests} directory. } \item{...}{ @@ -130,22 +130,22 @@ Jelmer Ypma library('ipoptr') ## Rosenbrock Banana function -eval_f <- function(x) { +eval_f <- function(x) { return( 100 * (x[2] - x[1] * x[1])^2 + (1 - x[1])^2 ) } ## Gradient of Rosenbrock Banana function -eval_grad_f <- function(x) { +eval_grad_f <- function(x) { c(-400 * x[1] * (x[2] - x[1] * x[1]) - 2 * (1 - x[1]), 200 * (x[2] - x[1] * x[1])) } -# The Hessian for this problem is actually dense, +# The Hessian for this problem is actually dense, # This is a symmetric matrix, fill the lower left triangle only. eval_h_structure <- list( c(1), c(1,2) ) eval_h <- function( x, obj_factor, hessian_lambda ) { - + return( obj_factor*c( 2 - 400*(x[2] - x[1]^2) + 800*x[1]^2, # 1,1 -400*x[1], # 2,1 200 ) ) # 2,2 @@ -158,19 +158,19 @@ opts <- list("print_level"=0, "file_print_level"=12, "output_file"="banana.out", "tol"=1.0e-8) - -# solve Rosenbrock Banana function with analytic hessian -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, + +# solve Rosenbrock Banana function with analytic hessian +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, eval_h=eval_h, eval_h_structure=eval_h_structure, opts=opts) ) -# solve Rosenbrock Banana function with approximated hessian -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, +# solve Rosenbrock Banana function with approximated hessian +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, opts=opts) ) @@ -187,10 +187,10 @@ print( ipoptr( x0=x0, # ## -eval_f <- function( x ) { +eval_f <- function( x ) { print( paste( "In R::eval_f, x = ", paste( c(1,2), collapse=', ' ) ) ) - return( -(x[2] - 2.0)*(x[2] - 2.0) ) + return( -(x[2] - 2.0)*(x[2] - 2.0) ) } eval_grad_f <- function( x ) { @@ -234,17 +234,17 @@ ub <- c( 1, 1.0e19 ) constraint_lb <- 0 constraint_ub <- 0 - + opts <- list("print_level"=0, "file_print_level"=12, "output_file"="ipopttest.out") - -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, - lb=lb, - ub=ub, - eval_g=eval_g, + +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, + lb=lb, + ub=ub, + eval_g=eval_g, eval_jac_g=eval_jac_g, eval_jac_g_structure=eval_jac_g_structure, constraint_lb=constraint_lb, @@ -252,7 +252,7 @@ print( ipoptr( x0=x0, eval_h=eval_h, eval_h_structure=eval_h_structure, opts=opts) ) - + } % Add one or more standard keywords, see file 'KEYWORDS' in the % R documentation directory. diff --git a/contrib/RInterface/man/make.sparse.Rd b/contrib/RInterface/man/make.sparse.Rd index 66bf80328..189024bfc 100644 --- a/contrib/RInterface/man/make.sparse.Rd +++ b/contrib/RInterface/man/make.sparse.Rd @@ -15,7 +15,7 @@ make.sparse( A ) } } \value{ - List of vectors with indices. Each element of the list corresponds to a row in + List of vectors with indices. Each element of the list corresponds to a row in the matrix. Each index corresponds to a non-zero element in the matrix. } \author{ diff --git a/contrib/RInterface/man/plot.sparseness.Rd b/contrib/RInterface/man/plot.sparseness.Rd index 4aaa9965d..0ff2a8727 100644 --- a/contrib/RInterface/man/plot.sparseness.Rd +++ b/contrib/RInterface/man/plot.sparseness.Rd @@ -1,60 +1,60 @@ -\name{plot.sparseness} -\alias{plot.sparseness} -\title{ -Plot sparseness structure of matrix -} -\description{ -This function plots the sparseness structure of a matrix in the format that is required by ipoptr. -} -\usage{ -plot.sparseness( x, pch='.', asp=1, xaxs='i', yaxs='i', ... ) -} -\arguments{ - \item{x}{ - list of vectors with indices. Each element of the list corresponds to a row in - the matrix. Each index corresponds to a non-zero element in the matrix. - } - \item{pch}{ - plotting `character'. See \code{\link[graphics:plot]{points}} for possible values. - } - \item{asp}{ - aspect ratio, default = 1. - } - \item{xaxs, yaxs}{ - style of axis interval calculation, default = 'i' (do not extend the axis). See \code{\link[graphics:plot]{par}} for more information. - } - \item{...}{ - further graphical parameters that will be passed to \code{\link[graphics:plot]{plot}}. - } -} -\value{ - A list with the non-zero x and y indices is returned. -} -\author{ -Jelmer Ypma -} -\seealso{ -\code{\link[ipoptr:ipoptr]{ipoptr}} -\code{\link[ipoptr:print.sparseness]{print.sparseness}} -\code{\link[ipoptr:make.sparse]{make.sparse}} -} -\examples{ -library('ipoptr') - -# use different plotting symbol for small matrices -plot.sparseness( make.sparse(diag(5)), pch='x' ) - -# plot large matrix example -s <- make.sparse( lower.tri( matrix( 1, 500, 500), diag=TRUE ) ) -plot.sparseness( s ) - -# plot another large matrix -s <- do.call( "cbind", lapply( 1:5, function(i) { diag(5) \%x\% matrix(1, nrow=5, ncol=20) } ) ) -s <- do.call( "rbind", lapply( 1:10, function(i) { s } ) ) -s <- cbind( matrix( 1, nrow=nrow(s), ncol=40 ), s ) -plot.sparseness( make.sparse( s ) ) -} -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ optimize } -\keyword{ interface } +\name{plot.sparseness} +\alias{plot.sparseness} +\title{ +Plot sparseness structure of matrix +} +\description{ +This function plots the sparseness structure of a matrix in the format that is required by ipoptr. +} +\usage{ +plot.sparseness( x, pch='.', asp=1, xaxs='i', yaxs='i', ... ) +} +\arguments{ + \item{x}{ + list of vectors with indices. Each element of the list corresponds to a row in + the matrix. Each index corresponds to a non-zero element in the matrix. + } + \item{pch}{ + plotting `character'. See \code{\link[graphics:plot]{points}} for possible values. + } + \item{asp}{ + aspect ratio, default = 1. + } + \item{xaxs, yaxs}{ + style of axis interval calculation, default = 'i' (do not extend the axis). See \code{\link[graphics:plot]{par}} for more information. + } + \item{...}{ + further graphical parameters that will be passed to \code{\link[graphics:plot]{plot}}. + } +} +\value{ + A list with the non-zero x and y indices is returned. +} +\author{ +Jelmer Ypma +} +\seealso{ +\code{\link[ipoptr:ipoptr]{ipoptr}} +\code{\link[ipoptr:print.sparseness]{print.sparseness}} +\code{\link[ipoptr:make.sparse]{make.sparse}} +} +\examples{ +library('ipoptr') + +# use different plotting symbol for small matrices +plot.sparseness( make.sparse(diag(5)), pch='x' ) + +# plot large matrix example +s <- make.sparse( lower.tri( matrix( 1, 500, 500), diag=TRUE ) ) +plot.sparseness( s ) + +# plot another large matrix +s <- do.call( "cbind", lapply( 1:5, function(i) { diag(5) \%x\% matrix(1, nrow=5, ncol=20) } ) ) +s <- do.call( "rbind", lapply( 1:10, function(i) { s } ) ) +s <- cbind( matrix( 1, nrow=nrow(s), ncol=40 ), s ) +plot.sparseness( make.sparse( s ) ) +} +% Add one or more standard keywords, see file 'KEYWORDS' in the +% R documentation directory. +\keyword{ optimize } +\keyword{ interface } diff --git a/contrib/RInterface/man/print.ipoptr.Rd b/contrib/RInterface/man/print.ipoptr.Rd index cf4ef257d..53a3fe8ed 100644 --- a/contrib/RInterface/man/print.ipoptr.Rd +++ b/contrib/RInterface/man/print.ipoptr.Rd @@ -1,32 +1,32 @@ -\name{print.ipoptr} -\alias{print.ipoptr} -\title{ -Print results after running ipoptr -} -\description{ -This function prints the ipoptr object that holds the results from a minimization using \code{ipoptr}. -} -\usage{ -\method{print}{ipoptr}( x, show.controls=TRUE, \dots ) -} -\arguments{ - \item{x}{ - object containing result from minimization. - } - \item{show.controls}{ - Logical or vector with indices. Should we show the value of the control variables in the solution? If code{show.controls} is a vector with indices, it is used to select which control variables should be shown. This can be useful if the model contains a set of parameters of interest and a set of nuisance parameters that are not of immediate interest. - } - \item{...}{ - further arguments passed to or from other methods. - } -} -\author{ -Jelmer Ypma -} -\seealso{ -\code{\link[ipoptr:ipoptr]{ipoptr}} -\code{\link[ipoptr:make.sparse]{make.sparse}} -\code{\link[ipoptr:print.sparseness]{print.sparseness}} -} -\keyword{ optimize } -\keyword{ interface } +\name{print.ipoptr} +\alias{print.ipoptr} +\title{ +Print results after running ipoptr +} +\description{ +This function prints the ipoptr object that holds the results from a minimization using \code{ipoptr}. +} +\usage{ +\method{print}{ipoptr}( x, show.controls=TRUE, \dots ) +} +\arguments{ + \item{x}{ + object containing result from minimization. + } + \item{show.controls}{ + Logical or vector with indices. Should we show the value of the control variables in the solution? If code{show.controls} is a vector with indices, it is used to select which control variables should be shown. This can be useful if the model contains a set of parameters of interest and a set of nuisance parameters that are not of immediate interest. + } + \item{...}{ + further arguments passed to or from other methods. + } +} +\author{ +Jelmer Ypma +} +\seealso{ +\code{\link[ipoptr:ipoptr]{ipoptr}} +\code{\link[ipoptr:make.sparse]{make.sparse}} +\code{\link[ipoptr:print.sparseness]{print.sparseness}} +} +\keyword{ optimize } +\keyword{ interface } diff --git a/contrib/RInterface/man/print.sparseness.Rd b/contrib/RInterface/man/print.sparseness.Rd index 7c605a5a7..f56adaa33 100644 --- a/contrib/RInterface/man/print.sparseness.Rd +++ b/contrib/RInterface/man/print.sparseness.Rd @@ -11,7 +11,7 @@ print.sparseness( x, indices=TRUE, data=NULL, ncol=NULL, ... ) } \arguments{ \item{x}{ - list of vectors with indices. Each element of the list corresponds to a row in + list of vectors with indices. Each element of the list corresponds to a row in the matrix. Each index corresponds to a non-zero element in the matrix. } \item{indices}{ @@ -21,7 +21,7 @@ print.sparseness( x, indices=TRUE, data=NULL, ncol=NULL, ... ) vector with non-zero elements of the sparse matrix. } \item{ncol}{ - integer supplying the number of columns of the sparse matrix. If this is not supplied, + integer supplying the number of columns of the sparse matrix. If this is not supplied, we take the number of columns as the largest index in \code{s}. } \item{...}{ @@ -70,7 +70,7 @@ m <- 5 # number of variables hessian <- function( A ) { H <- t(A) %*% A H <- unlist( lapply( 1:m, function(i) { H[i,1:i] } ) ) - + return( H ) } @@ -80,7 +80,7 @@ hessian_structure <- c( lapply( 1:m, function(x) { return( c(1:x) ) } ), # generate data set.seed( 3141 ) -A <- hessian( matrix( rnorm( n*m ), nrow=n, ncol=m ) ) +A <- hessian( matrix( rnorm( n*m ), nrow=n, ncol=m ) ) print.sparseness( x = hessian_structure, indices = TRUE, data = format( A, digits=2, nsmall=2, justify='right'), diff --git a/contrib/RInterface/src/ipoptr.cpp b/contrib/RInterface/src/ipoptr.cpp index 7b8c96c31..c45447cae 100644 --- a/contrib/RInterface/src/ipoptr.cpp +++ b/contrib/RInterface/src/ipoptr.cpp @@ -119,6 +119,9 @@ void setApplicationOptions( // we want this function to be available in R, so we put extern around it. extern "C" { +#if defined(__GNUC__) && __GNUC__ >= 4 + __attribute__((__visibility__("default"))) +#endif SEXP IpoptRSolve( SEXP args ) diff --git a/contrib/RInterface/tests/approx_banana.R b/contrib/RInterface/tests/approx_banana.R index 30aae8457..11442213a 100644 --- a/contrib/RInterface/tests/approx_banana.R +++ b/contrib/RInterface/tests/approx_banana.R @@ -1,62 +1,61 @@ -# Copyright (C) 2010 Jelmer Ypma. All Rights Reserved. -# This code is published under the Eclipse Public License. -# -# File: approx_banana.R -# Author: Jelmer Ypma -# Date: 5 July 2010 -# -# Example showing how to solve the Rosenbrock Banana function -# with an approximated gradient, which doesn't work so well. - -library('ipoptr') - -# Rosenbrock Banana function -eval_f <- function(x) { - return( 100 * (x[2] - x[1] * x[1])^2 + (1 - x[1])^2 ) -} - -# Approximate eval_f using finite differences -# http://en.wikipedia.org/wiki/Numerical_differentiation -approx_grad_f <- function( x ) { - minAbsValue <- 0 - stepSize <- sqrt( .Machine$double.eps ) - - # if we evaluate at 0, we need a different step size - stepSizeVec <- ifelse(abs(x) <= minAbsValue, stepSize^3, x * stepSize) - - x_prime <- x - f <- eval_f( x ) - grad_f <- rep( 0, length(x) ) - for (i in 1:length(x)) { - x_prime[i] <- x[i] + stepSizeVec[i] - stepSizeVec[i] <- x_prime[i] - x[i] - - f_prime <- eval_f( x_prime ) - grad_f[i] <- ( f_prime - f )/stepSizeVec[i] - x_prime[i] <- x[i] - } - - return( grad_f ) -} - -# initial values -x0 <- c( -1.2, 1 ) - -opts <- list("tol"=1.0e-8, "max_iter"=5000) - -# solve Rosenbrock Banana function with approximated gradient -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=approx_grad_f, - opts=opts) ) - -opts <- list("tol"=1.0e-7) - -# solve Rosenbrock Banana function with approximated gradient -# and lower tolerance -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=approx_grad_f, - opts=opts) ) - - \ No newline at end of file +# Copyright (C) 2010 Jelmer Ypma. All Rights Reserved. +# This code is published under the Eclipse Public License. +# +# File: approx_banana.R +# Author: Jelmer Ypma +# Date: 5 July 2010 +# +# Example showing how to solve the Rosenbrock Banana function +# with an approximated gradient, which doesn't work so well. + +library('ipoptr') + +# Rosenbrock Banana function +eval_f <- function(x) { + return( 100 * (x[2] - x[1] * x[1])^2 + (1 - x[1])^2 ) +} + +# Approximate eval_f using finite differences +# http://en.wikipedia.org/wiki/Numerical_differentiation +approx_grad_f <- function( x ) { + minAbsValue <- 0 + stepSize <- sqrt( .Machine$double.eps ) + + # if we evaluate at 0, we need a different step size + stepSizeVec <- ifelse(abs(x) <= minAbsValue, stepSize^3, x * stepSize) + + x_prime <- x + f <- eval_f( x ) + grad_f <- rep( 0, length(x) ) + for (i in 1:length(x)) { + x_prime[i] <- x[i] + stepSizeVec[i] + stepSizeVec[i] <- x_prime[i] - x[i] + + f_prime <- eval_f( x_prime ) + grad_f[i] <- ( f_prime - f )/stepSizeVec[i] + x_prime[i] <- x[i] + } + + return( grad_f ) +} + +# initial values +x0 <- c( -1.2, 1 ) + +opts <- list("tol"=1.0e-8, "max_iter"=5000) + +# solve Rosenbrock Banana function with approximated gradient +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=approx_grad_f, + opts=opts) ) + +opts <- list("tol"=1.0e-7) + +# solve Rosenbrock Banana function with approximated gradient +# and lower tolerance +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=approx_grad_f, + opts=opts) ) + diff --git a/contrib/RInterface/tests/banana.R b/contrib/RInterface/tests/banana.R index 29f0001b7..4b82aa7fc 100644 --- a/contrib/RInterface/tests/banana.R +++ b/contrib/RInterface/tests/banana.R @@ -10,17 +10,17 @@ library('ipoptr') ## Rosenbrock Banana function -eval_f <- function(x) { +eval_f <- function(x) { return( 100 * (x[2] - x[1] * x[1])^2 + (1 - x[1])^2 ) } ## Gradient of Rosenbrock Banana function -eval_grad_f <- function(x) { +eval_grad_f <- function(x) { return( c( -400 * x[1] * (x[2] - x[1] * x[1]) - 2 * (1 - x[1]), 200 * (x[2] - x[1] * x[1])) ) } -# The Hessian for this problem is actually dense, +# The Hessian for this problem is actually dense, # This is a symmetric matrix, fill the lower left triangle only. eval_h_structure <- list( c(1), c(1,2) ) @@ -37,17 +37,17 @@ opts <- list("print_level"=5, "file_print_level"=12, "output_file"="banana.out", "tol"=1.0e-8) - -# solve Rosenbrock Banana function with analytic hessian -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, + +# solve Rosenbrock Banana function with analytic hessian +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, eval_h=eval_h, eval_h_structure=eval_h_structure, opts=opts) ) -# solve Rosenbrock Banana function with approximated hessian -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, +# solve Rosenbrock Banana function with approximated hessian +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, opts=opts) ) diff --git a/contrib/RInterface/tests/hs071_nlp.R b/contrib/RInterface/tests/hs071_nlp.R index 2cb04985d..bcba6e3ea 100644 --- a/contrib/RInterface/tests/hs071_nlp.R +++ b/contrib/RInterface/tests/hs071_nlp.R @@ -24,15 +24,15 @@ library('ipoptr') # # f(x) = x1*x4*(x1 + x2 + x3) + x3 # -eval_f <- function( x ) { - return( x[1]*x[4]*(x[1] + x[2] + x[3]) + x[3] ) +eval_f <- function( x ) { + return( x[1]*x[4]*(x[1] + x[2] + x[3]) + x[3] ) } eval_grad_f <- function( x ) { return( c( x[1] * x[4] + x[4] * (x[1] + x[2] + x[3]), x[1] * x[4], x[1] * x[4] + 1.0, - x[1] * (x[1] + x[2] + x[3]) ) ) + x[1] * (x[1] + x[2] + x[3]) ) ) } # constraint functions @@ -55,7 +55,7 @@ eval_jac_g <- function( x ) { 2.0*x[4] ) ) } -# The Hessian for this problem is actually dense, +# The Hessian for this problem is actually dense, # This is a symmetric matrix, fill the lower left triangle only. eval_h_structure <- list( c(1), c(1,2), c(1,2,3), c(1,2,3,4) ) @@ -79,7 +79,7 @@ eval_h <- function( x, obj_factor, hessian_lambda ) { # add the portion for the first constraint values[2] = values[2] + hessian_lambda[1] * (x[3] * x[4]) # 2,1 - + values[4] = values[4] + hessian_lambda[1] * (x[2] * x[4]) # 3,1 values[5] = values[5] + hessian_lambda[1] * (x[1] * x[4]) # 3,2 @@ -108,19 +108,19 @@ constraint_lb <- c( 25, 40 ) constraint_ub <- c( Inf, 40 ) -opts <- list("print_level"=0, - "file_print_level"=12, +opts <- list("print_level"=5, + "file_print_level"=6, "output_file"="hs071_nlp.out") - -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, - lb=lb, - ub=ub, - eval_g=eval_g, - eval_jac_g=eval_jac_g, - constraint_lb=constraint_lb, - constraint_ub=constraint_ub, + +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, + lb=lb, + ub=ub, + eval_g=eval_g, + eval_jac_g=eval_jac_g, + constraint_lb=constraint_lb, + constraint_ub=constraint_ub, eval_jac_g_structure=eval_jac_g_structure, eval_h=eval_h, eval_h_structure=eval_h_structure, diff --git a/contrib/RInterface/tests/lasso.R b/contrib/RInterface/tests/lasso.R index 9f9f67784..179badcbe 100644 --- a/contrib/RInterface/tests/lasso.R +++ b/contrib/RInterface/tests/lasso.R @@ -24,7 +24,7 @@ set.seed( ranseed ) # CREATE DATA SET. # Generate the input vectors from the standard normal, and generate the -# responses from the regression with some additional noise. The variable +# responses from the regression with some additional noise. The variable # "beta" is the set of true regression coefficients. m <- length(beta) # Number of features. A <- matrix( rnorm(n*m), nrow=n, ncol=m ) # The n x m matrix of examples. @@ -38,14 +38,14 @@ eval_f <- function(x) { # separate x in two parts w <- x[ 1:m ] # parameters u <- x[ (m+1):(2*m) ] - + return( sum( (y - A %*% w)^2 )/2 + lambda*sum(u) ) } # ------------------------------------------------------------------ eval_grad_f <- function(x) { w <- x[ 1:m ] - return( c( -t(A) %*% (y - A %*% w), + return( c( -t(A) %*% (y - A %*% w), rep(lambda,m) ) ) } @@ -54,10 +54,10 @@ eval_g <- function(x) { # separate x in two parts w <- x[ 1:m ] # parameters u <- x[ (m+1):(2*m) ] - + return( c( w + u, u - w ) ) } - + # ------------------------------------------------------------------ # J = [ I I # -I I ], @@ -80,13 +80,13 @@ eval_jac_g <- function(x) { # . . . . 19 . . . . 20 eval_jac_g_structure <- lapply( c(1:m,1:m), function(x) { return( c(x,m+x) ) } ) - + # ------------------------------------------------------------------ # rename lambda so it doesn't cause confusion with lambda in auxdata eval_h <- function( x, obj_factor, hessian_lambda ) { H <- t(A) %*% A H <- unlist( lapply( 1:m, function(i) { H[i,1:i] } ) ) - + return( obj_factor * H ) } @@ -109,9 +109,9 @@ eval_h_structure <- c( lapply( 1:m, function(x) { return( c(1:x) ) } ), # The starting point. -x0 = c( rep(0, m), +x0 = c( rep(0, m), rep(1, m) ) - + # The constraint functions are bounded from below by zero. constraint_lb = rep( 0, 2*m ) @@ -129,16 +129,16 @@ auxdata$m <- m auxdata$A <- A auxdata$y <- y auxdata$lambda <- lambda - + # COMPUTE SOLUTION WITH IPOPT. # Compute the L1-regularized maximum likelihood estimator. -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, - eval_g=eval_g, +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, + eval_g=eval_g, eval_jac_g=eval_jac_g, eval_jac_g_structure=eval_jac_g_structure, - constraint_lb=constraint_lb, + constraint_lb=constraint_lb, constraint_ub=constraint_ub, eval_h=eval_h, eval_h_structure=eval_h_structure, diff --git a/contrib/RInterface/tests/mynlp.R b/contrib/RInterface/tests/mynlp.R index 91c990fcb..7601181da 100644 --- a/contrib/RInterface/tests/mynlp.R +++ b/contrib/RInterface/tests/mynlp.R @@ -6,7 +6,7 @@ # Date: 18 April 2010 # # Example NLP for interfacing a problem with IPOPT. -# This example is adapted from the C++ example that +# This example is adapted from the C++ example that # goes along with the Ipopt tutorial document. # This example solves the following problem: # @@ -17,10 +17,10 @@ library('ipoptr') -eval_f <- function( x ) { +eval_f <- function( x ) { print( paste( "In R::eval_f, x = ", paste( x, collapse=', ' ) ) ) - return( -(x[2] - 2.0)*(x[2] - 2.0) ) + return( -(x[2] - 2.0)*(x[2] - 2.0) ) } eval_grad_f <- function( x ) { @@ -64,17 +64,17 @@ ub <- c( 1, 1.0e19 ) constraint_lb <- 0 constraint_ub <- 0 - -opts <- list("print_level"=0, - "file_print_level"=12, + +opts <- list("print_level"=5, + "file_print_level"=6, "output_file"="ipopttest.out") - -print( ipoptr( x0=x0, - eval_f=eval_f, - eval_grad_f=eval_grad_f, - lb=lb, - ub=ub, - eval_g=eval_g, + +print( ipoptr( x0=x0, + eval_f=eval_f, + eval_grad_f=eval_grad_f, + lb=lb, + ub=ub, + eval_g=eval_g, eval_jac_g=eval_jac_g, eval_jac_g_structure=eval_jac_g_structure, constraint_lb=constraint_lb, diff --git a/contrib/RInterface/tests/parameters.R b/contrib/RInterface/tests/parameters.R index 54e4a8bf2..e84259d23 100644 --- a/contrib/RInterface/tests/parameters.R +++ b/contrib/RInterface/tests/parameters.R @@ -5,7 +5,7 @@ # Author: Jelmer Ypma # Date: 18 April 2010 # -# Example showing two ways how we can have an objective +# Example showing two ways how we can have an objective # function depend on parameters or data. The objective # function is a simple polynomial. @@ -17,11 +17,11 @@ library('ipoptr') # # objective function and gradient in terms of parameters -eval_f_ex1 <- function(x, params) { - return( params[1]*x^2 + params[2]*x + params[3] ) +eval_f_ex1 <- function(x, params) { + return( params[1]*x^2 + params[2]*x + params[3] ) } -eval_grad_f_ex1 <- function(x, params) { - return( 2*params[1]*x + params[2] ) +eval_grad_f_ex1 <- function(x, params) { + return( 2*params[1]*x + params[2] ) } # define parameters that we want to use @@ -31,8 +31,8 @@ params <- c(1,2,3) x0 <- 0 # solve using ipoptr -ipoptr( x0 = x0, - eval_f = eval_f_ex1, +ipoptr( x0 = x0, + eval_f = eval_f_ex1, eval_grad_f = eval_grad_f_ex1, params = params ) @@ -43,11 +43,11 @@ ipoptr( x0 = x0, # objective function and gradient in terms of parameters # without supplying params as an argument -eval_f_ex2 <- function(x) { - return( params[1]*x^2 + params[2]*x + params[3] ) +eval_f_ex2 <- function(x) { + return( params[1]*x^2 + params[2]*x + params[3] ) } -eval_grad_f_ex2 <- function(x) { - return( 2*params[1]*x + params[2] ) +eval_grad_f_ex2 <- function(x) { + return( 2*params[1]*x + params[2] ) } # define initial value of the optimzation problem @@ -58,9 +58,9 @@ auxdata <- new.env() auxdata$params <- c(1,2,3) # pass the environment that should be used to evaluate functions to ipoptr -ipoptr( x0 = x0, - eval_f = eval_f_ex2, - eval_grad_f = eval_grad_f_ex2, +ipoptr( x0 = x0, + eval_f = eval_f_ex2, + eval_grad_f = eval_grad_f_ex2, ipoptr_environment = auxdata ) diff --git a/contrib/RInterface/tests/sparseness.R b/contrib/RInterface/tests/sparseness.R index 692e513cb..6f47e6ef3 100644 --- a/contrib/RInterface/tests/sparseness.R +++ b/contrib/RInterface/tests/sparseness.R @@ -5,9 +5,9 @@ # Author: Jelmer Ypma # Date: 18 April 2010 # -# Example showing how the functions print.sparseness and -# make.sparse work. These show and create the sparseness -# structure of a matrix as it should be used for input +# Example showing how the functions print.sparseness and +# make.sparse work. These show and create the sparseness +# structure of a matrix as it should be used for input # to ipoptr(). library('ipoptr') @@ -40,7 +40,7 @@ m <- 5 # number of variables hessian <- function( A ) { H <- t(A) %*% A H <- unlist( lapply( 1:m, function(i) { H[i,1:i] } ) ) - + return( H ) } @@ -50,13 +50,13 @@ hessian_structure <- c( lapply( 1:m, function(x) { return( c(1:x) ) } ), # generate data set.seed( 3141 ) -A <- hessian( matrix( rnorm( n*m ), nrow=n, ncol=m ) ) +A <- hessian( matrix( rnorm( n*m ), nrow=n, ncol=m ) ) print.sparseness( x = hessian_structure, indices = TRUE, data = format( A, digits=2, nsmall=2, justify='right'), ncol = 2*m ) -# make a large sparseness structure and use plot +# make a large sparseness structure and use plot s <- do.call( "cbind", lapply( 1:5, function(i) { diag(5) %x% matrix(1, nrow=5, ncol=20) } ) ) s <- do.call( "rbind", lapply( 1:5, function(i) { s } ) ) s <- cbind( matrix( 1, nrow=nrow(s), ncol=40 ), s ) diff --git a/contrib/sIPOPT/AmplSolver/Makefile.in b/contrib/sIPOPT/AmplSolver/Makefile.in index 087b809cb..2d1026c0f 100644 --- a/contrib/sIPOPT/AmplSolver/Makefile.in +++ b/contrib/sIPOPT/AmplSolver/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -108,6 +108,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_ipopt_sens_OBJECTS = ampl_sipopt.$(OBJEXT) SensAmplTNLP.$(OBJEXT) ipopt_sens_OBJECTS = $(am_ipopt_sens_OBJECTS) +am__DEPENDENCIES_1 = ipopt_sens_DEPENDENCIES = ../src/libsipopt.la \ ../../../src/Apps/AmplSolver/libipoptamplinterface.la \ $(am__DEPENDENCIES_1) @@ -174,8 +175,6 @@ am__define_uniq_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 ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ @@ -195,8 +194,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -212,10 +212,12 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ +FILECMD = @FILECMD@ FLIBS = @FLIBS@ GREP = @GREP@ HSLLIB_CFLAGS = @HSLLIB_CFLAGS@ @@ -228,7 +230,6 @@ 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@ @@ -282,6 +283,8 @@ SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_LFLAGS = @SIPOPTAMPLINTERFACELIB_LFLAGS@ SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_PCFILES = @SIPOPTAMPLINTERFACELIB_PCFILES@ +SIPOPTLIB_CFLAGS_NOPC = @SIPOPTLIB_CFLAGS_NOPC@ +SIPOPTLIB_LFLAGS_NOPC = @SIPOPTLIB_LFLAGS_NOPC@ STRIP = @STRIP@ VERSION = @VERSION@ _ACJNI_JAVAC = @_ACJNI_JAVAC@ @@ -338,6 +341,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/contrib/sIPOPT/AmplSolver/SensAmplTNLP.cpp b/contrib/sIPOPT/AmplSolver/SensAmplTNLP.cpp index 2e64bdaa5..e26a28d82 100644 --- a/contrib/sIPOPT/AmplSolver/SensAmplTNLP.cpp +++ b/contrib/sIPOPT/AmplSolver/SensAmplTNLP.cpp @@ -24,6 +24,7 @@ static const Index dbg_verbosity = 1; SensAmplTNLP::SensAmplTNLP( const SmartPtr& jnlst, + const SmartPtr regoptions, const SmartPtr options, char**& argv, SmartPtr suffix_handler /* = NULL */, @@ -36,7 +37,7 @@ SensAmplTNLP::SensAmplTNLP( ) : AmplTNLP( jnlst, // gotta call constructor of base class properly - options, argv, suffix_handler /* = NULL */, allow_discrete /* = false */, ampl_options_list /* = NULL */, + regoptions, options, argv, suffix_handler /* = NULL */, allow_discrete /* = false */, ampl_options_list /* = NULL */, ampl_option_string /* = NULL */, ampl_invokation_string /* = NULL */, ampl_banner_string /* = NULL */, nl_file_content /* = NULL */), jnlst_(jnlst), @@ -50,7 +51,7 @@ SensAmplTNLP::SensAmplTNLP( SmartPtr suff_handler = get_suffix_handler(); ASL_pfgh* asl = AmplSolverObject(); - const Index* parameter_flags = suff_handler->GetIntegerSuffixValues("parameter", AmplSuffixHandler::Variable_Source); + const int* parameter_flags = suff_handler->GetIntegerSuffixValues("parameter", AmplSuffixHandler::Variable_Source); if( parameter_flags_ != NULL ) { @@ -148,7 +149,7 @@ void SensAmplTNLP::set_sens_solution( { DBG_START_METH("SensAmplTNLP::set_sens_solution", dbg_verbosity); - DBG_PRINT((dbg_verbosity, "n_sens_steps=%d\n", sens_sol_.size())); + DBG_PRINT((dbg_verbosity, "n_sens_steps=%zd\n", sens_sol_.size())); DBG_ASSERT(idx > 0); DBG_ASSERT(idx <= (Index)sens_sol_.size()); @@ -221,6 +222,29 @@ void SensAmplTNLP::finalize_solution( AmplTNLP::finalize_solution(status, n, x, z_L, z_U, m, g, lambda, obj_value, ip_data, ip_cq); } +#ifdef IPOPT_INT64 +static +std::vector to_vector_index( + std::vector& v +) +{ + std::vector v2(v.size()); + for( size_t i = 0; i < v.size(); ++i ) + { + v2[i] = v[i]; + } + return v2; +} +#else +static +std::vector& to_vector_index( + std::vector& v +) +{ + return v; +} +#endif + bool SensAmplTNLP::get_var_con_metadata( Index n, StringMetaDataMapType& var_string_md, @@ -240,12 +264,12 @@ bool SensAmplTNLP::get_var_con_metadata( { // Get Sens Suffixes std::string sens_state = "sens_state_"; - std::vector state; + std::vector state; for( Index i = 1; i <= n_sens_steps_; ++i ) { append_Index(sens_state, i); state = get_index_suffix_vec(sens_state.c_str()); - set_integer_metadata_for_var(sens_state, state); + set_integer_metadata_for_var(sens_state, to_vector_index(state)); sens_state = "sens_state_"; } std::string sens_state_value = "sens_state_value_"; @@ -260,8 +284,8 @@ bool SensAmplTNLP::get_var_con_metadata( std::string init_constr = "sens_init_constr"; if( n_sens_steps_ > 0 ) { - std::vector init_idx = get_index_suffix_constr_vec(init_constr.c_str()); - set_integer_metadata_for_con(init_constr, init_idx); + std::vector init_idx = get_index_suffix_constr_vec(init_constr.c_str()); + set_integer_metadata_for_con(init_constr, to_vector_index(init_idx)); } } } @@ -287,8 +311,8 @@ bool SensAmplTNLP::get_var_con_metadata( if( compute_red_hessian_ ) { std::string red_hess_str = "red_hessian"; - std::vector red_hess_idx = get_index_suffix_vec(red_hess_str.c_str()); - set_integer_metadata_for_var(red_hess_str.c_str(), red_hess_idx); + std::vector red_hess_idx = get_index_suffix_vec(red_hess_str.c_str()); + set_integer_metadata_for_var(red_hess_str.c_str(), to_vector_index(red_hess_idx)); } } catch( SUFFIX_EMPTY& exc ) @@ -311,7 +335,7 @@ bool SensAmplTNLP::get_var_con_metadata( return retval; } -const Index* SensAmplTNLP::get_index_suffix( +const int* SensAmplTNLP::get_index_suffix( const char* suffix_name ) { @@ -319,12 +343,12 @@ const Index* SensAmplTNLP::get_index_suffix( SmartPtr suffix_handler = get_suffix_handler(); - const Index* index_suffix = suffix_handler->GetIntegerSuffixValues(suffix_name, AmplSuffixHandler::Variable_Source); + const int* index_suffix = suffix_handler->GetIntegerSuffixValues(suffix_name, AmplSuffixHandler::Variable_Source); return index_suffix; } -std::vector SensAmplTNLP::get_index_suffix_vec( +std::vector SensAmplTNLP::get_index_suffix_vec( const char* suffix_name ) { @@ -334,8 +358,8 @@ std::vector SensAmplTNLP::get_index_suffix_vec( SmartPtr suffix_handler = get_suffix_handler(); DBG_ASSERT(IsValid(suffix_handler)); - std::vector index_suffix = suffix_handler->GetIntegerSuffixValues(n_var, suffix_name, - AmplSuffixHandler::Variable_Source); + std::vector index_suffix = suffix_handler->GetIntegerSuffixValues(n_var, suffix_name, + AmplSuffixHandler::Variable_Source); if( index_suffix.size() == 0 ) { index_suffix.resize(n_var, 0); @@ -386,7 +410,7 @@ std::vector SensAmplTNLP::get_number_suffix_vec( return number_suffix; } -const Index* SensAmplTNLP::get_index_suffix_constr( +const int* SensAmplTNLP::get_index_suffix_constr( const char* suffix_name ) { @@ -394,8 +418,8 @@ const Index* SensAmplTNLP::get_index_suffix_constr( SmartPtr suffix_handler = get_suffix_handler(); - const Index* index_suffix = suffix_handler->GetIntegerSuffixValues(suffix_name, - AmplSuffixHandler::Constraint_Source); + const int* index_suffix = suffix_handler->GetIntegerSuffixValues(suffix_name, + AmplSuffixHandler::Constraint_Source); if( index_suffix == NULL ) { @@ -408,7 +432,7 @@ const Index* SensAmplTNLP::get_index_suffix_constr( return index_suffix; } -std::vector SensAmplTNLP::get_index_suffix_constr_vec( +std::vector SensAmplTNLP::get_index_suffix_constr_vec( const char* suffix_name ) { @@ -416,8 +440,8 @@ std::vector SensAmplTNLP::get_index_suffix_constr_vec( ASL_pfgh* asl = AmplSolverObject(); SmartPtr suffix_handler = get_suffix_handler(); - std::vector index_suffix = suffix_handler->GetIntegerSuffixValues(n_con, suffix_name, - AmplSuffixHandler::Constraint_Source); + std::vector index_suffix = suffix_handler->GetIntegerSuffixValues(n_con, suffix_name, + AmplSuffixHandler::Constraint_Source); if( index_suffix.empty() ) { diff --git a/contrib/sIPOPT/AmplSolver/SensAmplTNLP.hpp b/contrib/sIPOPT/AmplSolver/SensAmplTNLP.hpp index 5aab69f83..1d690cb97 100644 --- a/contrib/sIPOPT/AmplSolver/SensAmplTNLP.hpp +++ b/contrib/sIPOPT/AmplSolver/SensAmplTNLP.hpp @@ -46,6 +46,7 @@ class SensAmplTNLP: public AmplTNLP /** constructor */ SensAmplTNLP( const SmartPtr& jnlst, + const SmartPtr regoptions, const SmartPtr options, char**& argv, SmartPtr suffix_handler = NULL, @@ -99,11 +100,11 @@ class SensAmplTNLP: public AmplTNLP IpoptCalculatedQuantities* ip_cq ); - const Index* get_index_suffix( + const int* get_index_suffix( const char* suffix_name ); - std::vector get_index_suffix_vec( + std::vector get_index_suffix_vec( const char* suffix_name ); @@ -115,11 +116,11 @@ class SensAmplTNLP: public AmplTNLP const char* suffix_name ); - const Index* get_index_suffix_constr( + const int* get_index_suffix_constr( const char* suffix_name ); - std::vector get_index_suffix_constr_vec( + std::vector get_index_suffix_constr_vec( const char* suffix_name ); diff --git a/contrib/sIPOPT/AmplSolver/ampl_sipopt.cpp b/contrib/sIPOPT/AmplSolver/ampl_sipopt.cpp index 2a174ead0..820c23139 100644 --- a/contrib/sIPOPT/AmplSolver/ampl_sipopt.cpp +++ b/contrib/sIPOPT/AmplSolver/ampl_sipopt.cpp @@ -62,7 +62,7 @@ int main( suffix_handler->AddAvailableSuffix("sens_init_constr", AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Index_Type); - int n_sens_steps = 0; + Index n_sens_steps = 0; app_ipopt->Options()->GetIntegerValue("n_sens_steps", n_sens_steps, ""); std::string state; std::string state_value; @@ -123,7 +123,7 @@ int main( "Number of sensitivity steps"); // create AmplSensTNLP from argc. - SmartPtr sens_tnlp = new SensAmplTNLP(ConstPtr(app_ipopt->Jnlst()), app_ipopt->Options(), argc, suffix_handler, + SmartPtr sens_tnlp = new SensAmplTNLP(ConstPtr(app_ipopt->Jnlst()), app_ipopt->RegOptions(), app_ipopt->Options(), argc, suffix_handler, false, ampl_options_list); app_sens->Initialize(); diff --git a/contrib/sIPOPT/Makefile.in b/contrib/sIPOPT/Makefile.in index 88554c5f9..1fca7a4cb 100644 --- a/contrib/sIPOPT/Makefile.in +++ b/contrib/sIPOPT/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -153,8 +153,6 @@ am__define_uniq_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 DIST_SUBDIRS = src AmplSolver ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ @@ -175,8 +173,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -192,10 +191,12 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ +FILECMD = @FILECMD@ FLIBS = @FLIBS@ GREP = @GREP@ HSLLIB_CFLAGS = @HSLLIB_CFLAGS@ @@ -208,7 +209,6 @@ 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@ @@ -262,6 +262,8 @@ SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_LFLAGS = @SIPOPTAMPLINTERFACELIB_LFLAGS@ SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_PCFILES = @SIPOPTAMPLINTERFACELIB_PCFILES@ +SIPOPTLIB_CFLAGS_NOPC = @SIPOPTLIB_CFLAGS_NOPC@ +SIPOPTLIB_LFLAGS_NOPC = @SIPOPTLIB_LFLAGS_NOPC@ STRIP = @STRIP@ VERSION = @VERSION@ _ACJNI_JAVAC = @_ACJNI_JAVAC@ @@ -318,6 +320,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/contrib/sIPOPT/doc/iecrv5.bst b/contrib/sIPOPT/doc/iecrv5.bst index 235833e45..2917ee04b 100644 --- a/contrib/sIPOPT/doc/iecrv5.bst +++ b/contrib/sIPOPT/doc/iecrv5.bst @@ -7,7 +7,7 @@ %% merlin.mbs (with options: `ay,nat,seq-no,nm-rvvc,aunm-semi,xlab-it,keyxyr,blkyear,yr-com,dtbf,note-yr,atit-u,volp-com,jwdpg,pp-last,num-xser,jnm-x,pre-edn,edpar,bkedcap,edby,edbyx,blk-tit,pp,ed,ord,jabr,varand,etal-it,nfss,') %% ---------------------------------------- %% *** iecrv5 *** -%% +%% %% Copyright 1994-2005 Patrick W Daly % =============================================================== % IMPORTANT NOTICE: diff --git a/contrib/sIPOPT/doc/sipopt.bib b/contrib/sIPOPT/doc/sipopt.bib index 2825b5d37..98fb64a3a 100644 --- a/contrib/sIPOPT/doc/sipopt.bib +++ b/contrib/sIPOPT/doc/sipopt.bib @@ -2,8 +2,7 @@ % Encoding: UTF-8 @BOOK{Ascher1988, - title = {Numerical Solution of Boundary Value Problems for Ordinary Differential - Equations.}, + title = {Numerical Solution of Boundary Value Problems for Ordinary Differential Equations.}, publisher = {Prentice Hall}, year = {1988}, author = {Ascher, Uri M. and Mattheij, Robert M. M. and Russell, Robert D.}, @@ -13,8 +12,7 @@ @BOOK{Ascher1988 } @BOOK{Ascher1998, - title = {Computer Methods for Ordinary Differential Equations and Differential-Algebraic - Equations}, + title = {Computer Methods for Ordinary Differential Equations and Differential-Algebraic Equations}, publisher = {SIAM}, year = {1998}, author = {Ascher, Uri M. and Petzold, Linda R.}, @@ -24,8 +22,7 @@ @BOOK{Ascher1998 @INCOLLECTION{Buskens, author = {C. B\"{u}skens and H. Maurer}, - title = {{Sensitivity analysis and real-time control of parametric control - problems using nonlinear programming methods}}, + title = {{Sensitivity analysis and real-time control of parametric control problems using nonlinear programming methods}}, booktitle = {{Online Optimization of Large-scale Systems}}, publisher = {Springer-Verlag}, year = {2001}, @@ -37,8 +34,7 @@ @INCOLLECTION{Buskens @ARTICLE{Bartlett2006, author = {Bartlett, Roscoe A. and Biegler, Lorenz T.}, - title = {QPSchur: A dual, active-set, Schur-complement method for large-scale - and structured convex quadratic programming}, + title = {QPSchur: A dual, active-set, Schur-complement method for large-scale and structured convex quadratic programming}, journal = {Optimization and Engineering}, year = {2006}, volume = {7}, @@ -58,8 +54,7 @@ @TECHREPORT{beltracchi } @BOOK{larrybook, - title = {Nonlinear Programming: Concepts, Algorithms, and Applications to - Chemical Processes}, + title = {Nonlinear Programming: Concepts, Algorithms, and Applications to Chemical Processes}, publisher = {SIAM}, year = {2010}, author = {Lorenz T. Biegler}, @@ -107,14 +102,12 @@ @PHDTHESIS{Diehl2001 } @INBOOK{Diehl2007, - chapter = {A Stabilizing Real-Time Implementation of Nonlinear Model Predictive - Control}, + chapter = {A Stabilizing Real-Time Implementation of Nonlinear Model Predictive Control}, pages = {25-52}, title = {Real-Time PDE-Constrained Optimization}, publisher = {SIAM}, year = {2007}, - editor = {Biegler, Lorenz T. and Keyes, David and Ghattas, Omar and van Bloemen - Waanders, Bart and Heinkenschloss, Mathias}, + editor = {Biegler, Lorenz T. and Keyes, David and Ghattas, Omar and van Bloemen Waanders, Bart and Heinkenschloss, Mathias}, author = {Diehl, Moritz and Findeisen, Rolf and Allg\"ower, Frank}, owner = {hans}, timestamp = {2009.11.09} @@ -133,9 +126,7 @@ @BOOK{Fiacco1983 @TECHREPORT{sensumt, author = {A. V. Fiacco and A. Ghaemi}, - title = {A user's manual for SENSUMT. A penalty function computer program - for solution, sensitivity analysis and optimal bound value calculation - in parametric nonlinear programs}, + title = {A user's manual for SENSUMT. A penalty function computer program for solution, sensitivity analysis and optimal bound value calculation in parametric nonlinear programs}, institution = {Management Science and Engineering, George Washington University}, year = {1980}, number = {T-434}, @@ -156,8 +147,7 @@ @ARTICLE{Fiacco90 @ARTICLE{marlin1, author = {Forbes, J.F. and T. E. Marlin}, - title = {{Design cost: a systematic approach to technology selection for model-based - real-time optimization systems}}, + title = {{Design cost: a systematic approach to technology selection for model-based real-time optimization systems}}, journal = {Comput. Chem. Eng.}, year = {1996}, volume = {20}, @@ -212,8 +202,7 @@ @ARTICLE{Hicks1971 @ARTICLE{Huang2009, author = {Rui Huang and Victor M. Zavala and Lorenz T. Biegler}, - title = {Advanced step nonlinear model predictive control for air separation - units}, + title = {Advanced step nonlinear model predictive control for air separation units}, journal = {Journal of Process Control}, year = {2009}, volume = {19}, @@ -257,8 +246,7 @@ @INCOLLECTION{kadam @ARTICLE{Kameswaran2008, author = {Kameswaran, Shivakumar and Biegler, Lorenz T.}, - title = {Convergence rates for direct transcription of optimal control problems - using collocation at Radau points}, + title = {Convergence rates for direct transcription of optimal control problems using collocation at Radau points}, journal = {Comput. Optim. Appl.}, year = {2008}, volume = {41}, @@ -297,8 +285,7 @@ @ARTICLE{Kojima1984 @ARTICLE{kyparsis90, author = {J. Kyparsis}, - title = {Sensitivity Analysis for Nonlinear Programs and Variational Inequalities - with Nonunique Multipliers}, + title = {Sensitivity Analysis for Nonlinear Programs and Variational Inequalities with Nonunique Multipliers}, journal = {Mathematics of Operations Research}, year = {1990}, volume = {15}, @@ -335,8 +322,7 @@ @MANUAL{askkt organization = {Carnegie Mellon University}, year = {2011}, owner = {rlopezne}, - timestamp = {2011.03.28}, - url = {https://projects.coin-or.org/Ipopt} + timestamp = {2011.03.28} } @UNPUBLISHED{pirnay:2011, @@ -350,8 +336,7 @@ @UNPUBLISHED{pirnay:2011 @ARTICLE{Vassiliadis1994, author = {Vassiliadis, V. S. and Sargent, R. W. H. and Pantelides, C. C.}, - title = {Solution of a class of multistage dynamic optimization problems. - Part one - Algorithmic Framework}, + title = {Solution of a class of multistage dynamic optimization problems. Part one - Algorithmic Framework}, journal = {Journal of Industrial and Engineering Chemistry Research}, year = {1994}, volume = {33}, @@ -362,8 +347,7 @@ @ARTICLE{Vassiliadis1994 @ARTICLE{Vassiliadis1994a, author = {Vassiliadis, V. S. and Sargent, R. W. H. and Pantelides, C. C.}, - title = {Solution of a class of multistage dynamic optimization problems. - Part two - Problems with Path Constraints}, + title = {Solution of a class of multistage dynamic optimization problems. Part two - Problems with Path Constraints}, journal = {Journal of Industrial and Engineering Chemistry Research}, year = {1994}, volume = {33}, @@ -374,8 +358,7 @@ @ARTICLE{Vassiliadis1994a @ARTICLE{Waechter2006, author = {W\"achter, Andreas and Biegler, Lorenz T.}, - title = {On the Implementation of a Primal-Dual Interior Point Filter Line - Search Algorithm for Large-Scale Nonlinear Programming}, + title = {On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming}, journal = {Mathematical Programming}, year = {2006}, volume = {106(1)}, @@ -386,8 +369,7 @@ @ARTICLE{Waechter2006 @ARTICLE{wolbert, author = {Wolbert, D. and X. Joulia and B. Koehret and L. T. Biegler}, - title = {{Flowsheet Optimization and Optimal Sensitivity Analysis Using Exact - Derivatives}}, + title = {{Flowsheet Optimization and Optimal Sensitivity Analysis Using Exact Derivatives}}, journal = {Computers and Chemical Engineering}, year = {1994}, volume = {18}, @@ -398,8 +380,7 @@ @ARTICLE{wolbert @PHDTHESIS{ZavalaPhd, author = {Zavala, Victor M.}, - title = {Computational Strategies for the Operation of Large-Scale Chemical - Processes}, + title = {Computational Strategies for the Operation of Large-Scale Chemical Processes}, school = {Carnegie Mellon University}, year = {2008}, owner = {hans}, @@ -424,8 +405,7 @@ @ARTICLE{Zavala2009 @ARTICLE{Zavala2008, author = {Zavala, Victor M. and Laird, Carl D. and Biegler, Lorenz T.}, - title = {{Fast implementations and rigorous models: Can both be accomodated - in NMPC?}}, + title = {{Fast implementations and rigorous models: Can both be accomodated in NMPC?}}, journal = {International Journal of Robust Nonlinear Control}, year = {2008}, volume = {18}, @@ -436,18 +416,13 @@ @ARTICLE{Zavala2008 @ARTICLE{Zavala2008a, author = {Victor M. Zavala and Carl D. Laird and Lorenz T. Biegler}, - title = {A fast moving horizon estimation algorithm based on nonlinear programming - sensitivity}, + title = {A fast moving horizon estimation algorithm based on nonlinear programming sensitivity}, journal = {Journal of Process Control}, year = {2008}, volume = {18}, pages = {876 - 884}, number = {9}, - note = {Selected Papers From Two Joint Conferences: 8th International Symposium - on Dynamics and Control of Process Systems and the 10th Conference - Applications in Biotechnology, 8th International Symposium on Dynamics - and Control of Process Systems and the 10th Conference Applications - in Biotechnology}, + note = {Selected Papers From Two Joint Conferences: 8th International Symposium on Dynamics and Control of Process Systems and the 10th Conference Applications in Biotechnology, 8th International Symposium on Dynamics and Control of Process Systems and the 10th Conference Applications in Biotechnology}, doi = {DOI: 10.1016/j.jprocont.2008.06.003}, issn = {0959-1524}, keywords = {Estimation algorithms}, @@ -457,8 +432,7 @@ @ARTICLE{Zavala2008a } @PROCEEDINGS{Bock1983, - title = {Numerical Treatment of Inverse Problems in Differential and Integral - Equations: Proceedings of an International Workshop}, + title = {Numerical Treatment of Inverse Problems in Differential and Integral Equations: Proceedings of an International Workshop}, year = {1983}, editor = {Bock, H. G.}, owner = {hans}, diff --git a/contrib/sIPOPT/doc/sipopt_manual.tex b/contrib/sIPOPT/doc/sipopt_manual.tex index a8900029d..ebe64f789 100644 --- a/contrib/sIPOPT/doc/sipopt_manual.tex +++ b/contrib/sIPOPT/doc/sipopt_manual.tex @@ -785,7 +785,7 @@ \section{Installation} found in the following website. \begin{description} -\item \texttt{http://www.coin-or.org/Ipopt/documentation/} +\item \texttt{https://coin-or.github.io/Ipopt/} \end{description} Also note that in the following we refer to {\tt \ipoptf} as the main folder, @@ -901,12 +901,12 @@ \section{Summary of Suffixes} the values may not be repeated. Note that the order of the values is crucial.\\ \hline \multirow{2}{*}{\textbf{\statei{\emph{i}}}} & \multirow{2}{*}{IN } & This is similar to \textbf{\statez}, but it now indicates the order for the parameters at the perturbed value. - You must define one for each $\curls{i: 1 \leq i \leq \mbox{\texttt{\nstepsopt}}}$. \\ + You must define one for each $\curls{i: 1 \leq i \leq \mbox{\texttt{\nstepsopt}}}$. \\ && This suffix should have the same values as \textbf{\statez}. It takes values from 1 to length($p$), and the values may no be repeated.\\ \hline \multirow{2}{*}{\textbf{\statevi{\emph{i}}}} & \multirow{2}{*}{IN} & This is used to communicate the values of the perturbed parameters. - You must define one for each $\curls{i: 1 \leq i \leq \mbox{\texttt{\nstepsopt}}}$. \\ + You must define one for each $\curls{i: 1 \leq i \leq \mbox{\texttt{\nstepsopt}}}$. \\ && It has to be set for the same variables as \textbf{\stateo}.\\ \hline \textbf{\initc} & IN & This is a flag that indicates the constraint is artificial, e.g., $w - p_0=0$ in Problem \eqref{eq:reform}. If the constraint is artificial, set this suffix to 1 (no indexing is necessary). \\ \hline @@ -929,4 +929,4 @@ \section{Summary of Suffixes} \end{tabular} -\end{document} \ No newline at end of file +\end{document} diff --git a/contrib/sIPOPT/examples/hicks_ampl/hicks.dat b/contrib/sIPOPT/examples/hicks_ampl/hicks.dat index 65f6dce5e..dae6d82fe 100644 --- a/contrib/sIPOPT/examples/hicks_ampl/hicks.dat +++ b/contrib/sIPOPT/examples/hicks_ampl/hicks.dat @@ -76,7 +76,7 @@ let t[5,1].sens_state_1 := 2; let c[5,1].sens_state_value_1 := 0.135; let t[5,1].sens_state_value_1 := 0.745; # -# 4. Identify the initial constraints, that will be relaxed +# 4. Identify the initial constraints, that will be relaxed # in favor of the new measurements let c_init_constr.sens_init_constr :=1; let t_init_constr.sens_init_constr :=1; diff --git a/contrib/sIPOPT/examples/hicks_ampl/hicks.mod b/contrib/sIPOPT/examples/hicks_ampl/hicks.mod index 580eeec00..ce882431a 100644 --- a/contrib/sIPOPT/examples/hicks_ampl/hicks.mod +++ b/contrib/sIPOPT/examples/hicks_ampl/hicks.mod @@ -12,7 +12,7 @@ param ncp >= 1 integer ; # define mathematical model parameters -param time ; +param time ; param jj ; param cf ; param alpha ; @@ -48,9 +48,9 @@ param h{fe} ; # finite element length # define the decision variables -var c {fe,cp} >= 0 ; -var t {fe,cp} >= 0 ; -var u {fe,cp} >= 0 ; +var c {fe,cp} >= 0 ; +var t {fe,cp} >= 0 ; +var u {fe,cp} >= 0 ; # auxiliary equations @@ -62,10 +62,10 @@ var cdot{i in fe, j in cp} = (1-c[i,j])/theta-k10*exp(-n/t[i,j])*c[i,j] var tdot{i in fe, j in cp} = (yf-t[i,j])/theta+k10*exp(-n/t[i,j])*c[i,j]-alpha*u[i,j]*(t[i,j]-yc) ; #--------------------------------- -# This is specific to the asNMPC code: +# This is specific to the asNMPC code: # The initial constraints have to be defined as variables. # They have to be set explictly with initial constraints. -# These constraints need to be identified by the +# These constraints need to be identified by the # sens_init_constr suffix. var c_init_var; var t_init_var; diff --git a/contrib/sIPOPT/examples/hicks_ampl/hicks.run b/contrib/sIPOPT/examples/hicks_ampl/hicks.run index d8608d823..3ba137947 100644 --- a/contrib/sIPOPT/examples/hicks_ampl/hicks.run +++ b/contrib/sIPOPT/examples/hicks_ampl/hicks.run @@ -16,11 +16,11 @@ suffix sens_init_constr, IN; option solver ipopt_sens ; option presolve 0; -option ipopt_options 'run_sens no'; +option ipopt_options 'run_sens no'; -model hicks.mod ; -data hicks.dat ; +model hicks.mod ; +data hicks.dat ; -option ipopt_options 'run_sens yes'; +option ipopt_options 'run_sens yes'; solve; -include nmpcresults.inc ; +include nmpcresults.inc ; diff --git a/contrib/sIPOPT/examples/hicks_ampl/nmpcresults.inc b/contrib/sIPOPT/examples/hicks_ampl/nmpcresults.inc index f531f894e..9ecbfdfab 100644 --- a/contrib/sIPOPT/examples/hicks_ampl/nmpcresults.inc +++ b/contrib/sIPOPT/examples/hicks_ampl/nmpcresults.inc @@ -1,98 +1,98 @@ -# =================================================================== -# dynamic optimization formulation of the hicks-ray reactor -# create results file for matlab -# victor m zavala march 2006 -# Adapted for sIPOPT by Hans Pirnay 2009, 2011 -# =================================================================== - -printf "clc\n" >graph.m; -printf "clear all" >graph.m; -printf "\n" >graph.m; - -#display variables and parameters - -printf "c=[" >graph.m; -printf "%5.5f ",c_init>>graph.m; -printf {j in fe,k in cp}: -"%5.5f ",c[j,k]>>graph.m; -printf "]';\n" >>graph.m; - -printf "t=[" >graph.m; -printf "%5.5f ",t_init>>graph.m; -printf {j in fe,k in cp}: -"%5.5f ",t[j,k]>>graph.m; -printf "]';\n" >>graph.m; - -printf "u=[" >graph.m; -printf "%5.5f ",u_init>>graph.m; -printf {j in fe,k in cp}: -"%5.5f ",u[j,k]>>graph.m; -printf "]';\n" >>graph.m; - -printf "c1=[" >graph.m; -printf "%5.5f ",c_init>>graph.m; -printf {j in fe,k in cp}: -"%5.5f ",c[j,k].sens_sol_state_1>>graph.m; -printf "]';\n" >>graph.m; - -printf "t1=[" >graph.m; -printf "%5.5f ",t_init>>graph.m; -printf {j in fe,k in cp}: -"%5.5f ",t[j,k].sens_sol_state_1>>graph.m; -printf "]';\n" >>graph.m; - -printf "u1=[" >graph.m; -printf "%5.5f ",u_init>>graph.m; -printf {j in fe,k in cp}: -"%5.5f ",u[j,k].sens_sol_state_1>>graph.m; -printf "]';\n" >>graph.m; - -printf "nfe= %5i ",nfe>>graph.m; printf ";\n">>graph.m; -printf "ncp= %5i ",ncp>>graph.m; printf ";\n">>graph.m; -printf "ncp= ncp-1">>graph.m; printf ";\n">>graph.m; -printf "tt= %5.5f ",time>>graph.m; printf ";\n">>graph.m; -printf "r1= %5.5f ",r1>>graph.m; printf ";\n">>graph.m; -printf "r2= %5.5f ",r2>>graph.m; printf ";\n">>graph.m; -printf "r3= %5.5f ",r3>>graph.m; printf ";\n">>graph.m; -printf "roots(1)= r1 ">>graph.m; printf ";\n">>graph.m; -printf "roots(2)= r2 ">>graph.m; printf ";\n">>graph.m; -printf "roots(3)= r3 ">>graph.m; printf ";\n">>graph.m; -printf "h= tt/nfe ">>graph.m; printf ";\n">>graph.m; -printf "index= 0 ">>graph.m; printf ";\n">>graph.m; -printf "nelement= 0 ">>graph.m; printf ";\n">>graph.m; -printf "for i=1:nfe,">>graph.m; printf "\n">>graph.m; -printf "nelement=nelement+1">>graph.m; printf ";\n">>graph.m; -printf "for j=1:ncp+1,">>graph.m; printf "\n">>graph.m; -printf "index=index+1">>graph.m; printf ";\n">>graph.m; -printf "if i == 1">>graph.m; printf "\n">>graph.m; -printf "time(index) = h*roots(j)">>graph.m; printf ";\n">>graph.m; -printf "else">>graph.m; printf "\n">>graph.m; -printf "time(index) = (nelement-1)*h+h*roots(j)">>graph.m; printf ";\n">>graph.m; -printf "end">>graph.m; printf "\n">>graph.m; -printf "end">>graph.m; printf "\n">>graph.m; -printf "end">>graph.m; printf "\n">>graph.m; -printf "time= [0,time]'">>graph.m; printf ";\n">>graph.m; - -# plot the results - -printf "subplot(3,1,1)\n" >>graph.m; -printf "plot(time,c,'k')\nhold on\n" >>graph.m; -printf "plot(time,c1,'k')\n" >>graph.m; -printf "xlabel ('time')">>graph.m; printf ";\n">>graph.m; -printf "ylabel ('concentration')">>graph.m; printf ";\n">>graph.m; -printf "subplot(3,1,2)\n" >>graph.m; -printf "plot(time,[t,t1],'k')\n" >>graph.m; -printf "xlabel ('time')">>graph.m; printf ";\n">>graph.m; -printf "ylabel ('temperature')">>graph.m; printf ";\n">>graph.m; -printf "subplot(3,1,3)\n" >>graph.m; -printf "plot(time,[u,u1],'k')\n" >>graph.m; -printf "xlabel ('time')">>graph.m; printf ";\n">>graph.m; -printf "ylabel ('cooling w flowrate')">>graph.m; printf ";\n">>graph.m; - -printf "print -deps hicks.eps\n">>graph.m; - -close graph.m; -printf "output written to matlab m-file: graph.m ...\n"; - -#-- end of the graphshicks.inc file - - +# =================================================================== +# dynamic optimization formulation of the hicks-ray reactor +# create results file for matlab +# victor m zavala march 2006 +# Adapted for sIPOPT by Hans Pirnay 2009, 2011 +# =================================================================== + +printf "clc\n" >graph.m; +printf "clear all" >graph.m; +printf "\n" >graph.m; + +#display variables and parameters + +printf "c=[" >graph.m; +printf "%5.5f ",c_init>>graph.m; +printf {j in fe,k in cp}: +"%5.5f ",c[j,k]>>graph.m; +printf "]';\n" >>graph.m; + +printf "t=[" >graph.m; +printf "%5.5f ",t_init>>graph.m; +printf {j in fe,k in cp}: +"%5.5f ",t[j,k]>>graph.m; +printf "]';\n" >>graph.m; + +printf "u=[" >graph.m; +printf "%5.5f ",u_init>>graph.m; +printf {j in fe,k in cp}: +"%5.5f ",u[j,k]>>graph.m; +printf "]';\n" >>graph.m; + +printf "c1=[" >graph.m; +printf "%5.5f ",c_init>>graph.m; +printf {j in fe,k in cp}: +"%5.5f ",c[j,k].sens_sol_state_1>>graph.m; +printf "]';\n" >>graph.m; + +printf "t1=[" >graph.m; +printf "%5.5f ",t_init>>graph.m; +printf {j in fe,k in cp}: +"%5.5f ",t[j,k].sens_sol_state_1>>graph.m; +printf "]';\n" >>graph.m; + +printf "u1=[" >graph.m; +printf "%5.5f ",u_init>>graph.m; +printf {j in fe,k in cp}: +"%5.5f ",u[j,k].sens_sol_state_1>>graph.m; +printf "]';\n" >>graph.m; + +printf "nfe= %5i ",nfe>>graph.m; printf ";\n">>graph.m; +printf "ncp= %5i ",ncp>>graph.m; printf ";\n">>graph.m; +printf "ncp= ncp-1">>graph.m; printf ";\n">>graph.m; +printf "tt= %5.5f ",time>>graph.m; printf ";\n">>graph.m; +printf "r1= %5.5f ",r1>>graph.m; printf ";\n">>graph.m; +printf "r2= %5.5f ",r2>>graph.m; printf ";\n">>graph.m; +printf "r3= %5.5f ",r3>>graph.m; printf ";\n">>graph.m; +printf "roots(1)= r1 ">>graph.m; printf ";\n">>graph.m; +printf "roots(2)= r2 ">>graph.m; printf ";\n">>graph.m; +printf "roots(3)= r3 ">>graph.m; printf ";\n">>graph.m; +printf "h= tt/nfe ">>graph.m; printf ";\n">>graph.m; +printf "index= 0 ">>graph.m; printf ";\n">>graph.m; +printf "nelement= 0 ">>graph.m; printf ";\n">>graph.m; +printf "for i=1:nfe,">>graph.m; printf "\n">>graph.m; +printf "nelement=nelement+1">>graph.m; printf ";\n">>graph.m; +printf "for j=1:ncp+1,">>graph.m; printf "\n">>graph.m; +printf "index=index+1">>graph.m; printf ";\n">>graph.m; +printf "if i == 1">>graph.m; printf "\n">>graph.m; +printf "time(index) = h*roots(j)">>graph.m; printf ";\n">>graph.m; +printf "else">>graph.m; printf "\n">>graph.m; +printf "time(index) = (nelement-1)*h+h*roots(j)">>graph.m; printf ";\n">>graph.m; +printf "end">>graph.m; printf "\n">>graph.m; +printf "end">>graph.m; printf "\n">>graph.m; +printf "end">>graph.m; printf "\n">>graph.m; +printf "time= [0,time]'">>graph.m; printf ";\n">>graph.m; + +# plot the results + +printf "subplot(3,1,1)\n" >>graph.m; +printf "plot(time,c,'k')\nhold on\n" >>graph.m; +printf "plot(time,c1,'k')\n" >>graph.m; +printf "xlabel ('time')">>graph.m; printf ";\n">>graph.m; +printf "ylabel ('concentration')">>graph.m; printf ";\n">>graph.m; +printf "subplot(3,1,2)\n" >>graph.m; +printf "plot(time,[t,t1],'k')\n" >>graph.m; +printf "xlabel ('time')">>graph.m; printf ";\n">>graph.m; +printf "ylabel ('temperature')">>graph.m; printf ";\n">>graph.m; +printf "subplot(3,1,3)\n" >>graph.m; +printf "plot(time,[u,u1],'k')\n" >>graph.m; +printf "xlabel ('time')">>graph.m; printf ";\n">>graph.m; +printf "ylabel ('cooling w flowrate')">>graph.m; printf ";\n">>graph.m; + +printf "print -deps hicks.eps\n">>graph.m; + +close graph.m; +printf "output written to matlab m-file: graph.m ...\n"; + +#-- end of the graphshicks.inc file - + diff --git a/contrib/sIPOPT/examples/parametric_cpp/parametricTNLP.cpp b/contrib/sIPOPT/examples/parametric_cpp/parametricTNLP.cpp index bd1840232..d4ebe23c9 100644 --- a/contrib/sIPOPT/examples/parametric_cpp/parametricTNLP.cpp +++ b/contrib/sIPOPT/examples/parametric_cpp/parametricTNLP.cpp @@ -325,13 +325,13 @@ void ParametricTNLP::finalize_solution( " Nominal Perturbed\n"); for( Index k = 0; k < (Index) sens_sol_vec.size(); ++k ) { - printf("x[%3d] % .23f % .23f\n", k, x[k], sens_sol_vec[k]); + printf("x[%3d] % .23f % .23f\n", (int)k, x[k], sens_sol_vec[k]); } printf("\n**********\n"); for( Index k = 0; k < m; ++k ) { - printf("lambda[%3d] (nom) % .23f \n", k, lambda[k]); + printf("lambda[%3d] (nom) % .23f \n", (int)k, lambda[k]); } } @@ -355,7 +355,7 @@ void ParametricTNLP::finalize_metadata( { for( Index k = 0; k < n; ++k ) { - printf("z_L[%d] = %f z_U[%d] = %f\n", k, z_L_solution->second[k], k, z_U_solution->second[k]); + printf("z_L[%d] = %f z_U[%d] = %f\n", (int)k, z_L_solution->second[k], (int)k, z_U_solution->second[k]); } } @@ -366,7 +366,7 @@ void ParametricTNLP::finalize_metadata( { for( Index k = 0; k < m; ++k ) { - printf("lambda[%d] (upd) = %.14g\n", k, lambda_solution->second[k]); + printf("lambda[%d] (upd) = %.14g\n", (int)k, lambda_solution->second[k]); } } } diff --git a/contrib/sIPOPT/examples/parametric_dsdp_cpp/parametricTNLP.cpp b/contrib/sIPOPT/examples/parametric_dsdp_cpp/parametricTNLP.cpp index 2df407b78..060d9cad7 100644 --- a/contrib/sIPOPT/examples/parametric_dsdp_cpp/parametricTNLP.cpp +++ b/contrib/sIPOPT/examples/parametric_dsdp_cpp/parametricTNLP.cpp @@ -324,13 +324,13 @@ void ParametricTNLP::finalize_solution( // Print the solution vector printf("\n" " Nominal Perturbed\n"); - for( Index k = 0; k < (Index) sens_sol_vec.size(); ++k ) + for( size_t k = 0; k < sens_sol_vec.size(); ++k ) { - printf("x[%3d] % .23f % .23f\n", k, x[k], sens_sol_vec[k]); + printf("x[%3zd] % .23f % .23f\n", k, x[k], sens_sol_vec[k]); } printf("\n**********\n"); - for( Index k = 0; k < m; ++k ) + for( int k = 0; k < m; ++k ) { printf("lambda[%3d] (nom) % .23f \n", k, lambda[k]); } @@ -356,7 +356,7 @@ void ParametricTNLP::finalize_metadata( { for( Index k = 0; k < n; ++k ) { - printf("z_L[%d] = %f z_U[%d] = %f\n", k, z_L_solution->second[k], k, z_U_solution->second[k]); + printf("z_L[%d] = %f z_U[%d] = %f\n", (int)k, z_L_solution->second[k], (int)k, z_U_solution->second[k]); } } @@ -367,7 +367,7 @@ void ParametricTNLP::finalize_metadata( { for( Index k = 0; k < m; ++k ) { - printf("lambda[%d] (upd) = %.14g\n", k, lambda_solution->second[k]); + printf("lambda[%d] (upd) = %.14g\n", (int)k, lambda_solution->second[k]); } } } diff --git a/contrib/sIPOPT/examples/parametric_dsdp_cpp/parametricTNLP2.cpp b/contrib/sIPOPT/examples/parametric_dsdp_cpp/parametricTNLP2.cpp deleted file mode 100644 index 69f7bf6a7..000000000 --- a/contrib/sIPOPT/examples/parametric_dsdp_cpp/parametricTNLP2.cpp +++ /dev/null @@ -1,397 +0,0 @@ -// Copyright 2010, 2011 Hans Pirnay -// All Rights Reserved. -// This code is published under the Eclipse Public License. -// -// Date : 2010-30-04 - -#include "parametricTNLP.hpp" -#include "IpDenseVector.hpp" -#include "IpIpoptData.hpp" -#include - -using namespace Ipopt; - -/* Constructor */ -ParametricTNLP::ParametricTNLP() - : nominal_eta1_(5.0), - nominal_eta2_(1.0), - eta_1_perturbed_value_(4.5), - eta_2_perturbed_value_(1.0) -{ } - -ParametricTNLP::~ParametricTNLP() -{ } - -bool ParametricTNLP::get_nlp_info( - Index& n, - Index& m, - Index& nnz_jac_g, - Index& nnz_h_lag, - IndexStyleEnum& index_style -) -{ - // x1, x2, x3, eta1, eta2 - n = 5; - - // 2 constraints + 2 parametric initial value constraints - m = 4; //+2; - - nnz_jac_g = 10; //+2; - - nnz_h_lag = 5; - - index_style = FORTRAN_STYLE; - - return true; -} - -bool ParametricTNLP::get_bounds_info( - Index /*n*/, - Number* x_l, - Number* x_u, - Index /*m*/, - Number* g_l, - Number* g_u -) -{ - for( Index k = 0; k < 3; ++k ) - { - x_l[k] = 0.0; - x_u[k] = 1.0e19; - } - x_l[3] = -1.0e19; - x_u[3] = 1.0e19; - x_l[4] = -1.0e19; - x_u[4] = 1.0e19; - - g_l[0] = 0.0; - g_u[0] = 0.0; - g_l[1] = 0.0; - g_u[1] = 0.0; - - // initial value constraints - g_l[2] = nominal_eta1_; - g_u[2] = nominal_eta1_; - g_l[3] = nominal_eta2_; - g_u[3] = nominal_eta2_; - - /* - g_l[4] = 0.0 ; - g_u[4] = 100.0 ; - - g_l[5] = -100.0 ; - g_u[5] = 0.0 ; - */ - - return true; -} - -bool ParametricTNLP::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*/ -) -{ - x[0] = 0.15; - x[1] = 0.15; - x[2] = 0.0; - x[3] = 0.0; - x[4] = 0.0; - - return true; -} - -bool ParametricTNLP::eval_f( - Index /*n*/, - const Number* x, - bool /*new_x*/, - Number& obj_value -) -{ - obj_value = 0; - for( Index k = 0; k < 3; ++k ) - { - obj_value += x[k] * x[k]; - } - return true; -} - -bool ParametricTNLP::eval_grad_f( - Index /*n*/, - const Number* x, - bool /*new_x*/, - Number* grad_f -) -{ - grad_f[0] = 2 * x[0]; - grad_f[1] = 2 * x[1]; - grad_f[2] = 2 * x[2]; - grad_f[3] = 0.0; - grad_f[4] = 0.0; - return true; -} - -bool ParametricTNLP::eval_g( - Index /*n*/, - const Number* x, - bool /*new_x*/, - Index /*m*/, - Number* g -) -{ - Number x1, x2, x3, eta1, eta2; - x1 = x[0]; - x2 = x[1]; - x3 = x[2]; - eta1 = x[3]; - eta2 = x[4]; - g[0] = 6 * x1 + 3 * x2 + 2 * x3 - eta1; - g[1] = eta2 * x1 + x2 - x3 - 1; - g[2] = eta1; - g[3] = eta2; - - /* - g[4] = x1 + 10 ; - g[5] = -100 + x2 ; - */ - - return true; -} - -bool ParametricTNLP::eval_jac_g( - Index /*n*/, - const Number* x, - bool /*new_x*/, - Index /*m*/, - Index /*nele_jac*/, - Index* iRow, - Index* jCol, - Number* values -) -{ - if( values == NULL ) - { - iRow[0] = 1; // dg1/dx1 - jCol[0] = 1; - iRow[1] = 1; // dg1/dx2 - jCol[1] = 2; - iRow[2] = 1; // dg1/dx3 - jCol[2] = 3; - iRow[3] = 1; // dg1/deta1 - jCol[3] = 4; - iRow[4] = 2; // dg2/dx1 - jCol[4] = 1; - iRow[5] = 2; // dg2/dx2 - jCol[5] = 2; - iRow[6] = 2; // dg2/dx3 - jCol[6] = 3; - iRow[7] = 2; // dg2/deta2 - jCol[7] = 5; - iRow[8] = 3; - jCol[8] = 4; - iRow[9] = 4; - jCol[9] = 5; - /* - iRow[10] = 5; - jCol[10] = 1; - iRow[11] = 6; - jCol[11] = 2; - */ - } - else - { - values[0] = 6.0; - values[1] = 3.0; - values[2] = 2.0; - values[3] = -1.0; - values[4] = x[4]; - values[5] = 1.0; - values[6] = -1.0; - values[7] = x[0]; - values[8] = 1.0; - values[9] = 1.0; - /* - values[10] = 1.0 ; - values[11] = 1.0 ; - */ - } - return true; -} - -bool ParametricTNLP::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 -) -{ - if( values == NULL ) - { - iRow[0] = 1; - jCol[0] = 1; - - iRow[1] = 2; - jCol[1] = 2; - - iRow[2] = 3; - jCol[2] = 3; - - iRow[3] = 1; - jCol[3] = 5; - - iRow[4] = 5; - jCol[4] = 1; - } - else - { - values[0] = 2.0 * obj_factor; - values[1] = 2.0 * obj_factor; - values[2] = 2.0 * obj_factor; - values[3] = 0.5 * lambda[1]; - values[4] = 0.5 * lambda[1]; - } - return true; -} - -bool ParametricTNLP::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*/ -) -{ - /* In this function, the indices for the parametric computations are set. - * To keep track of the parameters, each parameter gets an index from 1 to n_parameters. - * In this case, [1] eta_1, [2] eta_2. - * The following metadata vectors are important: - */ - - /* 1. sens_init_constr: in this list, the constraints that set the initial - * values for the parameters are indicated. - * For parameter 1 (eta_1) this is constraint 3 (e.g. C++ index 2), which is - * the constraint eta_1 = eta_1_nominal; - * For parameter 2 (eta_2) this is constraint 4 (e.g. C++ index 3). - */ - std::vector sens_init_constr(m, 0); - sens_init_constr[2] = 1; - sens_init_constr[3] = 2; - con_integer_md["sens_init_constr"] = sens_init_constr; - - /* 2. sens_state_1: in this index list, the parameters are indicated: - * Here: [1] eta_1, [2] eta_2 - */ - std::vector sens_state_1(n, 0); - sens_state_1[3] = 1; - sens_state_1[4] = 2; - var_integer_md["sens_state_1"] = sens_state_1; - - /* 3. sens_state_values_1: In this list of Numbers (=doubles), the perturbed - * values for the parameters are set. - */ - std::vector sens_state_value_1(n, 0); - sens_state_value_1[3] = eta_1_perturbed_value_; - sens_state_value_1[4] = eta_2_perturbed_value_; - var_numeric_md["sens_state_value_1"] = sens_state_value_1; - - return true; -} - -void ParametricTNLP::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*/ -) -{ - // Check whether sIPOPT Algorithm aborted internally - // bool sens_internal_abort; - //options_->GetBoolValue("sens_internal_abort", sens_internal_abort, ""); - - // Get access to the metadata, where the solutions are stored. The metadata is part of the DenseVectorSpace. - SmartPtr x_owner_space = dynamic_cast(GetRawPtr( - ip_data->curr()->x()->OwnerSpace())); - - if( !IsValid(x_owner_space) ) - { - printf("Error IsValid(x_owner_space) failed\n"); - return; - } - std::string state; - std::vector sens_sol_vec; - state = "sens_sol_state_1"; - sens_sol_vec = x_owner_space->GetNumericMetaData(state.c_str()); - - // Print the solution vector - printf("\n" - " Nominal Perturbed\n"); - for( Index k = 0; k < (Index) sens_sol_vec.size(); ++k ) - { - printf("x[%3d] % .23f % .23f\n", k, x[k], sens_sol_vec[k]); - } - - printf("\n**********\n"); - for( Index k = 0; k < m; ++k ) - { - printf("lambda[%3d] (nom) % .23f \n", k, lambda[k]); - } - -} - -void ParametricTNLP::finalize_metadata( - Index n, - const StringMetaDataMapType& /*var_string_md*/, - const IntegerMetaDataMapType& /*var_integer_md*/, - const NumericMetaDataMapType& var_numeric_md, - Index m, - const StringMetaDataMapType& /*con_string_md*/, - const IntegerMetaDataMapType& /*con_integer_md*/, - const NumericMetaDataMapType& con_numeric_md -) -{ - // bound multipliers for lower and upper bounds - printf("\nDual bound multipliers:\n"); - NumericMetaDataMapType::const_iterator z_L_solution = var_numeric_md.find("sens_sol_state_1_z_L"); - NumericMetaDataMapType::const_iterator z_U_solution = var_numeric_md.find("sens_sol_state_1_z_U"); - if( z_L_solution != var_numeric_md.end() && z_U_solution != var_numeric_md.end() ) - { - for( Index k = 0; k < n; ++k ) - { - printf("z_L[%d] = %f z_U[%d] = %f\n", k, z_L_solution->second[k], k, z_U_solution->second[k]); - } - } - - // constraint mutlipliers - printf("\nConstraint multipliers:\n"); - NumericMetaDataMapType::const_iterator lambda_solution = con_numeric_md.find("sens_sol_state_1"); - if( lambda_solution != con_numeric_md.end() ) - { - for( Index k = 0; k < m; ++k ) - { - printf("lambda[%d] (upd) = %.14g\n", k, lambda_solution->second[k]); - } - } -} diff --git a/contrib/sIPOPT/examples/redhess_ampl/red_hess.run b/contrib/sIPOPT/examples/redhess_ampl/red_hess.run index 33a8c4343..ba3301be7 100644 --- a/contrib/sIPOPT/examples/redhess_ampl/red_hess.run +++ b/contrib/sIPOPT/examples/redhess_ampl/red_hess.run @@ -5,17 +5,17 @@ # Date : 2010-10-04 # This AMPL script shows how to use the reduced hessian feature -# of the asNMPC code. +# of the asNMPC code. reset; option solver ipopt_sens; # set option to compute reduced hessian -option ipopt_options 'compute_red_hessian yes'; +option ipopt_options 'compute_red_hessian yes'; # turn presolve off so no variables / equations are eliminated # by AMPL -option presolve 0; +option presolve 0; # Introduce the reduced hessian suffix suffix red_hessian, IN; @@ -25,7 +25,7 @@ var x1:=25e7; var x2:=0; var x3:=0; -# set the variables 2 and 3 free variables. The ordering of the +# set the variables 2 and 3 free variables. The ordering of the # variable suffixes will correspond to the ordering of the columns let x2.red_hessian := 1; let x3.red_hessian := 2; diff --git a/contrib/sIPOPT/readme.txt b/contrib/sIPOPT/readme.txt index d15934a27..d0af744d6 100644 --- a/contrib/sIPOPT/readme.txt +++ b/contrib/sIPOPT/readme.txt @@ -1,7 +1,7 @@ sIPOPT Toolbox for IPOPT ======================== -This is the Sensitivity with IPOPT toolbox. Its purpose is to compute +This is the Sensitivity with IPOPT toolbox. Its purpose is to compute fast approximate solutions when parameters in the NLP change. For more information on the project please see the implementation paper, or the project website. @@ -17,7 +17,7 @@ directory as IPOPT's ampl executable. They are build in the same build process as for main Ipopt, unless --disable-sipopt has been specified for configure. -Contact: The sIPOPT code was developed by Hans Pirnay (RWTH-Aachen), -Rodrigo Lopez-Negrete (CMU), and Prof. Lorenz Biegler (CMU). Any +Contact: The sIPOPT code was developed by Hans Pirnay (RWTH-Aachen), +Rodrigo Lopez-Negrete (CMU), and Prof. Lorenz Biegler (CMU). Any questions / problems / bugs may be sent to the Hans Pirnay or the IPOPT mailing list. diff --git a/contrib/sIPOPT/src/Makefile.am b/contrib/sIPOPT/src/Makefile.am index e89b1ea58..de0bdb16b 100644 --- a/contrib/sIPOPT/src/Makefile.am +++ b/contrib/sIPOPT/src/Makefile.am @@ -6,36 +6,37 @@ includesipoptdir = $(includedir)/coin-or includesipopt_HEADERS = \ - SensAlgorithm.hpp \ - SensApplication.hpp \ - SensBacksolver.hpp \ - SensMeasurement.hpp \ - SensPCalculator.hpp \ - SensRegOp.hpp \ - SensSchurData.hpp \ - SensSchurDriver.hpp \ - SensSimpleBacksolver.hpp \ - SensStepCalc.hpp \ - SensUtils.hpp + SensAlgorithm.hpp \ + SensApplication.hpp \ + SensBacksolver.hpp \ + SensMeasurement.hpp \ + SensPCalculator.hpp \ + SensRegOp.hpp \ + SensSchurData.hpp \ + SensSchurDriver.hpp \ + SensSimpleBacksolver.hpp \ + SensStepCalc.hpp \ + SensUtils.hpp lib_LTLIBRARIES = libsipopt.la libsipopt_la_SOURCES = \ - SensAlgorithm.cpp \ - SensRegOp.cpp \ - SensDenseGenSchurDriver.cpp \ - SensIndexPCalculator.cpp \ - SensIndexSchurData.cpp \ - SensMetadataMeasurement.cpp \ - SensApplication.cpp \ - SensUtils.cpp \ - SensReducedHessianCalculator.cpp \ - SensBuilder.cpp \ - SensSimpleBacksolver.cpp \ - SensStdStepCalc.cpp + SensAlgorithm.cpp \ + SensRegOp.cpp \ + SensDenseGenSchurDriver.cpp \ + SensIndexPCalculator.cpp \ + SensIndexSchurData.cpp \ + SensMetadataMeasurement.cpp \ + SensApplication.cpp \ + SensUtils.cpp \ + SensReducedHessianCalculator.cpp \ + SensBuilder.cpp \ + SensSimpleBacksolver.cpp \ + SensStdStepCalc.cpp -libsipopt_la_LDFLAGS = $(LT_LDFLAGS) -libsipopt_la_LIBADD = ../../../src/Interfaces/libipopt.la +libsipopt_la_LIBADD = ../../../src/libipopt.la + +AM_LDFLAGS = $(LT_LDFLAGS) AM_CPPFLAGS = -DSIPOPTLIB_BUILD \ -I$(srcdir)/../../../src/Common \ diff --git a/contrib/sIPOPT/src/Makefile.in b/contrib/sIPOPT/src/Makefile.in index 62c8e2335..27dad5518 100644 --- a/contrib/sIPOPT/src/Makefile.in +++ b/contrib/sIPOPT/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -136,7 +136,7 @@ am__uninstall_files_from_dir = { \ am__installdirs = "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(includesipoptdir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libsipopt_la_DEPENDENCIES = ../../../src/Interfaces/libipopt.la +libsipopt_la_DEPENDENCIES = ../../../src/libipopt.la am_libsipopt_la_OBJECTS = SensAlgorithm.lo SensRegOp.lo \ SensDenseGenSchurDriver.lo SensIndexPCalculator.lo \ SensIndexSchurData.lo SensMetadataMeasurement.lo \ @@ -148,9 +148,6 @@ 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 = -libsipopt_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(libsipopt_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -218,8 +215,6 @@ am__define_uniq_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 ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ @@ -239,8 +234,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -256,10 +252,12 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ +FILECMD = @FILECMD@ FLIBS = @FLIBS@ GREP = @GREP@ HSLLIB_CFLAGS = @HSLLIB_CFLAGS@ @@ -272,7 +270,6 @@ 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@ @@ -326,6 +323,8 @@ SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_LFLAGS = @SIPOPTAMPLINTERFACELIB_LFLAGS@ SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_PCFILES = @SIPOPTAMPLINTERFACELIB_PCFILES@ +SIPOPTLIB_CFLAGS_NOPC = @SIPOPTLIB_CFLAGS_NOPC@ +SIPOPTLIB_LFLAGS_NOPC = @SIPOPTLIB_LFLAGS_NOPC@ STRIP = @STRIP@ VERSION = @VERSION@ _ACJNI_JAVAC = @_ACJNI_JAVAC@ @@ -382,6 +381,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -392,35 +392,35 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ includesipoptdir = $(includedir)/coin-or includesipopt_HEADERS = \ - SensAlgorithm.hpp \ - SensApplication.hpp \ - SensBacksolver.hpp \ - SensMeasurement.hpp \ - SensPCalculator.hpp \ - SensRegOp.hpp \ - SensSchurData.hpp \ - SensSchurDriver.hpp \ - SensSimpleBacksolver.hpp \ - SensStepCalc.hpp \ - SensUtils.hpp + SensAlgorithm.hpp \ + SensApplication.hpp \ + SensBacksolver.hpp \ + SensMeasurement.hpp \ + SensPCalculator.hpp \ + SensRegOp.hpp \ + SensSchurData.hpp \ + SensSchurDriver.hpp \ + SensSimpleBacksolver.hpp \ + SensStepCalc.hpp \ + SensUtils.hpp lib_LTLIBRARIES = libsipopt.la libsipopt_la_SOURCES = \ - SensAlgorithm.cpp \ - SensRegOp.cpp \ - SensDenseGenSchurDriver.cpp \ - SensIndexPCalculator.cpp \ - SensIndexSchurData.cpp \ - SensMetadataMeasurement.cpp \ - SensApplication.cpp \ - SensUtils.cpp \ - SensReducedHessianCalculator.cpp \ - SensBuilder.cpp \ - SensSimpleBacksolver.cpp \ - SensStdStepCalc.cpp - -libsipopt_la_LDFLAGS = $(LT_LDFLAGS) -libsipopt_la_LIBADD = ../../../src/Interfaces/libipopt.la + SensAlgorithm.cpp \ + SensRegOp.cpp \ + SensDenseGenSchurDriver.cpp \ + SensIndexPCalculator.cpp \ + SensIndexSchurData.cpp \ + SensMetadataMeasurement.cpp \ + SensApplication.cpp \ + SensUtils.cpp \ + SensReducedHessianCalculator.cpp \ + SensBuilder.cpp \ + SensSimpleBacksolver.cpp \ + SensStdStepCalc.cpp + +libsipopt_la_LIBADD = ../../../src/libipopt.la +AM_LDFLAGS = $(LT_LDFLAGS) AM_CPPFLAGS = -DSIPOPTLIB_BUILD \ -I$(srcdir)/../../../src/Common \ -I$(srcdir)/../../../src/Interfaces \ @@ -501,7 +501,7 @@ clean-libLTLIBRARIES: } libsipopt.la: $(libsipopt_la_OBJECTS) $(libsipopt_la_DEPENDENCIES) $(EXTRA_libsipopt_la_DEPENDENCIES) - $(AM_V_CXXLD)$(libsipopt_la_LINK) -rpath $(libdir) $(libsipopt_la_OBJECTS) $(libsipopt_la_LIBADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libsipopt_la_OBJECTS) $(libsipopt_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) diff --git a/contrib/sIPOPT/src/SensAlgorithm.cpp b/contrib/sIPOPT/src/SensAlgorithm.cpp index 190403489..c895ea882 100644 --- a/contrib/sIPOPT/src/SensAlgorithm.cpp +++ b/contrib/sIPOPT/src/SensAlgorithm.cpp @@ -36,7 +36,7 @@ SensAlgorithm::SensAlgorithm( n_sens_steps_(n_sens_steps) // why doesn't he get this from the options? { DBG_START_METH("SensAlgorithm::SensAlgorithm", dbg_verbosity); - DBG_ASSERT(n_sens_steps <= (int)driver_vec.size()); + DBG_ASSERT((size_t)n_sens_steps <= driver_vec.size()); } SensAlgorithm::~SensAlgorithm() @@ -123,7 +123,7 @@ bool SensAlgorithm::InitializeImpl( const std::vector idx_ipopt = x_owner_space_->GetIntegerMetaData(state.c_str()); np_ = 0; - for( Index i = 0; i < (int) idx_ipopt.size(); ++i ) + for( size_t i = 0; i < idx_ipopt.size(); ++i ) { if( idx_ipopt[i] > 0 ) { @@ -207,7 +207,7 @@ SensAlgorithmExitStatus SensAlgorithm::ComputeSensitivityMatrix(void) SmartPtr < IteratesVector > trialcopy; SmartPtr < DenseVectorSpace > delta_u_space; - delta_u_space = new DenseVectorSpace(2); + delta_u_space = new DenseVectorSpace(np_); SmartPtr < DenseVector > delta_u = new DenseVector(GetRawPtr(ConstPtr(delta_u_space))); @@ -228,14 +228,14 @@ SensAlgorithmExitStatus SensAlgorithm::ComputeSensitivityMatrix(void) char buffer[250]; Index col = 0; - for( Index Scol = 0; Scol < (int) idx_ipopt.size(); ++Scol ) + for( size_t Scol = 0; Scol < idx_ipopt.size(); ++Scol ) { if( idx_ipopt[Scol] > 0 ) { // reset rhs vector to zero - for( Index j = 0; j < (int) idx_ipopt.size(); ++j ) + for( size_t j = 0; j < idx_ipopt.size(); ++j ) { if( idx_ipopt[j] > 0 ) { @@ -243,7 +243,7 @@ SensAlgorithmExitStatus SensAlgorithm::ComputeSensitivityMatrix(void) } } - sprintf(buffer, "Column %i", idx_ipopt[Scol]); + sprintf(buffer, "Column %" IPOPT_INDEX_FORMAT, idx_ipopt[Scol]); sens_step_calc_->SetSchurDriver(driver_vec_[0]); @@ -286,7 +286,7 @@ void SensAlgorithm::GetSensitivityMatrix( const Number* X_ = dynamic_cast(GetRawPtr((*SV).x()))->Values(); offset = col * nx_; - for( int i = 0; i < nx_; ++i ) + for( Index i = 0; i < nx_; ++i ) { //printf(" ds/dp(X)[%3d] = %.14g\n", i+1, X_[i]); SensitivityM_X_[i + offset] = X_[i]; @@ -294,7 +294,7 @@ void SensAlgorithm::GetSensitivityMatrix( const Number* Z_L_ = dynamic_cast(GetRawPtr((*SV).z_L()))->Values(); offset = col * nzl_; - for( int i = 0; i < nzl_; ++i ) + for( Index i = 0; i < nzl_; ++i ) { //printf(" ds/dp(X)[%3d] = %.14g\n", i+1, X_[i]); SensitivityM_Z_L_[i + offset] = Z_L_[i]; @@ -302,7 +302,7 @@ void SensAlgorithm::GetSensitivityMatrix( const Number* Z_U_ = dynamic_cast(GetRawPtr((*SV).z_U()))->Values(); offset = col * nzu_; - for( int i = 0; i < nzu_; ++i ) + for( Index i = 0; i < nzu_; ++i ) { //printf(" ds/dp(X)[%3d] = %.14g\n", i+1, X_[i]); SensitivityM_Z_U_[i + offset] = Z_U_[i]; @@ -310,14 +310,14 @@ void SensAlgorithm::GetSensitivityMatrix( const Number* LE_ = dynamic_cast(GetRawPtr((*SV).y_c()))->Values(); offset = col * nl_; - for( int i = 0; i < nceq_; ++i ) + for( Index i = 0; i < nceq_; ++i ) { //printf(" ds/dp(LE)[%3d] = %.14g\n", i+1, LE_[i]); SensitivityM_L_[i + offset] = LE_[i]; } const Number* LIE_ = dynamic_cast(GetRawPtr((*SV).y_d()))->Values(); - for( int i = 0; i < ncineq_; ++i ) + for( Index i = 0; i < ncineq_; ++i ) { //printf(" ds/dp(LIE)[%3d] = %.14g\n", i+1, LIE_[i]); SensitivityM_L_[i + nceq_ + offset] = LIE_[i]; @@ -336,35 +336,35 @@ void SensAlgorithm::GetDirectionalDerivatives(void) const Number* X_ = dynamic_cast(GetRawPtr((*SV).x()))->Values(); - for( int i = 0; i < nx_; ++i ) + for( Index i = 0; i < nx_; ++i ) { //printf(" ds/dp(X)[%3d] = %.14g\n", i+1, X_[i]); DirectionalD_X_[i] = X_[i]; } const Number* Z_L_ = dynamic_cast(GetRawPtr((*SV).z_L()))->Values(); - for( int i = 0; i < nzl_; ++i ) + for( Index i = 0; i < nzl_; ++i ) { //printf(" ds/dp(X)[%3d] = %.14g\n", i+1, X_[i]); DirectionalD_Z_L_[i] = Z_L_[i]; } const Number* Z_U_ = dynamic_cast(GetRawPtr((*SV).z_U()))->Values(); - for( int i = 0; i < nzu_; ++i ) + for( Index i = 0; i < nzu_; ++i ) { //printf(" ds/dp(X)[%3d] = %.14g\n", i+1, X_[i]); DirectionalD_Z_U_[i] = Z_U_[i]; } const Number* LE_ = dynamic_cast(GetRawPtr((*SV).y_c()))->Values(); - for( int i = 0; i < nceq_; ++i ) + for( Index i = 0; i < nceq_; ++i ) { //printf(" ds/dp(LE)[%3d] = %.14g\n", i+1, LE_[i]); DirectionalD_L_[i] = LE_[i]; } const Number* LIE_ = dynamic_cast(GetRawPtr((*SV).y_d()))->Values(); - for( int i = 0; i < ncineq_; ++i ) + for( Index i = 0; i < ncineq_; ++i ) { //printf(" ds/dp(LIE)[%3d] = %.14g\n", i+1, LIE_[i]); DirectionalD_L_[i + nceq_] = LIE_[i]; diff --git a/contrib/sIPOPT/src/SensApplication.cpp b/contrib/sIPOPT/src/SensApplication.cpp index f1bc7092f..90a54cc81 100644 --- a/contrib/sIPOPT/src/SensApplication.cpp +++ b/contrib/sIPOPT/src/SensApplication.cpp @@ -56,53 +56,45 @@ void SensApplication::RegisterOptions( ) { // Options for parameter sensitivity - roptions->SetRegisteringCategory("sIPOPT"); + roptions->SetRegisteringCategory("sIPOPT", 1000000); roptions->AddLowerBoundedIntegerOption("n_sens_steps", "Number of steps computed by sIPOPT", 0, 1); - roptions->AddStringOption2("sens_boundcheck", - "Activate boundcheck and re-solve for sIPOPT", - "no", - "no", "don't check bounds and do another SchurSolve", - "yes", "check bounds and resolve Schur decomposition", - "If this option is activated, the algorithm will check the iterate after an initial Schursolve and will resolve the decomposition if any bounds are not satisfied"); + roptions->AddBoolOption("sens_boundcheck", + "Activate boundcheck and re-solve Schur decomposition for sIPOPT", + false, + "If this option is activated, the algorithm will check the iterate after an initial Schursolve and will resolve the decomposition if any bounds are not satisfied"); roptions->AddLowerBoundedNumberOption("sens_bound_eps", "Bound accuracy within which a bound still is considered to be valid", 0, true, 1e-3, "The schur complement solution cannot make sure that variables stay inside bounds. " "I cannot use the primal-frac-to-the-bound step because I don't know if the initial iterate is feasible. " "To make things easier for me I have decided to make bounds not so strict."); - roptions->AddStringOption2("compute_red_hessian", - "Determines if reduced Hessian should be computed", - "no", - "yes", "compute reduced hessian", - "no", "don't compute reduced hessian"); - roptions->AddStringOption2("compute_dsdp", - "Determines if matrix of sensitivites should be computed", - "no", - "yes", "compute matrix of sensitivites", - "no", "don't compute matrix of sensitivities"); + roptions->AddBoolOption("compute_red_hessian", + "Determines if reduced Hessian should be computed", + false); + roptions->AddBoolOption("compute_dsdp", + "Determines if matrix of sensitivites should be computed", + false); // This option must be in IpInterfacesRegOp.cpp - roptions->AddStringOption2("run_sens", - "Determines if sIPOPT alg runs", - "no", - "yes", "run sIPOPT", - "no", "don't run sIPOPT"); - roptions->AddStringOption2("sens_internal_abort", - "Internal option - if set (internally), sens algorithm is not conducted", - "no", - "yes", "abort sIPOPT", - "no", "run sIPOPT"); - roptions->AddStringOption2("redhess_internal_abort", - "Internal option - if set (internally), reduced hessian computation is not conducted", - "no", - "yes", "abort redhess computation", - "no", "run redhess computation"); - roptions->AddStringOption2("ignore_suffix_error", - "If set, IPOPT runs even if there are errors in the suffixes", - "no", - "yes", "don't abort on suffix error", - "no", "abort on suffix error"); + roptions->AddBoolOption("run_sens", + "Determines if sIPOPT alg runs", + false, + "", + true); + roptions->AddBoolOption("sens_internal_abort", + "Internal option - if set (internally), sens algorithm is not conducted", + false, + "", + true); + roptions->AddBoolOption("redhess_internal_abort", + "Internal option - if set (internally), reduced hessian computation is not conducted", + false, + "", + true); + roptions->AddBoolOption("ignore_suffix_error", + "If set, IPOPT runs even if there are errors in the suffixes", + false); roptions->AddLowerBoundedNumberOption("sens_max_pdpert", "Maximum perturbation of primal dual system, for that the sIPOPT algorithm will not abort", 0.0, true, 1e-3, @@ -111,23 +103,17 @@ void SensApplication::RegisterOptions( "useless for the use with sIPOPT. This option sets an upper bound, which the inertia correction " "may have. If any of the inertia correction values is above this bound, the sIPOPT algorithm " "is aborted."); - roptions->AddStringOption2("rh_eigendecomp", - "If yes, the eigenvalue decomposition of the reduced hessian matrix is computed", - "no", - "yes", "compute eigenvalue decomposition of reduced hessian", - "no", "don't compute eigenvalue decomposition of reduced hessian", - "The eigenvalue decomposition of the reduced hessian has different meanings depending on the specific problem. For parameter estimation problems, the eigenvalues are linked to the confidence interval of the parameters. See for example Victor Zavala's Phd thesis, chapter 4 for details."); - roptions->AddStringOption2("sens_allow_inexact_backsolve", - "Allow inexact computation of backsolve in sIPOPT.", - "yes", - "yes", "Allow inexact computation of backsolve in sIPOPT.", - "no", "Don't allow inexact computation of backsolve in sIPOPT."); - roptions->AddStringOption2("sens_kkt_residuals", - "For sensitivity solution, take KKT residuals into account", - "yes", - "yes", "Take residuals into account", - "no", "Don't take residuals into account", - "The residuals of the KKT conditions should be zero at the optimal solution. However, in practice, especially for large problems and depending on the termination criteria, they may deviate from this theoretical state. If this option is set to yes, the residuals will be taken into account when computing the right hand side for the sensitivity step."); + roptions->AddBoolOption("rh_eigendecomp", + "Whether the eigenvalue decomposition of the reduced hessian matrix is computed", + false, + "The eigenvalue decomposition of the reduced hessian has different meanings depending on the specific problem. For parameter estimation problems, the eigenvalues are linked to the confidence interval of the parameters. See for example Victor Zavala's Phd thesis, chapter 4 for details."); + roptions->AddBoolOption("sens_allow_inexact_backsolve", + "Allow inexact computation of backsolve in sIPOPT.", + true); + roptions->AddBoolOption("sens_kkt_residuals", + "For sensitivity solution, take KKT residuals into account", + true, + "The residuals of the KKT conditions should be zero at the optimal solution. However, in practice, especially for large problems and depending on the termination criteria, they may deviate from this theoretical state. If this option is set to yes, the residuals will be taken into account when computing the right hand side for the sensitivity step."); } SensAlgorithmExitStatus SensApplication::Run() diff --git a/contrib/sIPOPT/src/SensApplication.hpp b/contrib/sIPOPT/src/SensApplication.hpp index c9e62f4d3..1a852596b 100644 --- a/contrib/sIPOPT/src/SensApplication.hpp +++ b/contrib/sIPOPT/src/SensApplication.hpp @@ -76,19 +76,19 @@ class SIPOPTLIB_EXPORT SensApplication: public ReferencedObject && NULL != DirectionalD_Z_U && NULL != DirectionalD_L ) { - for( int i = 0; i < controller->nx(); ++i ) + for( Index i = 0; i < controller->nx(); ++i ) { SX[i] = DirectionalD_X[i]; } - for( int i = 0; i < controller->nzu(); ++i ) + for( Index i = 0; i < controller->nzu(); ++i ) { SZU[i] = DirectionalD_Z_U[i]; } - for( int i = 0; i < controller->nzl(); ++i ) + for( Index i = 0; i < controller->nzl(); ++i ) { SZL[i] = DirectionalD_Z_L[i]; } - for( int i = 0; i < controller->nl(); ++i ) + for( Index i = 0; i < controller->nl(); ++i ) { SL[i] = DirectionalD_L[i]; } @@ -106,19 +106,19 @@ class SIPOPTLIB_EXPORT SensApplication: public ReferencedObject if( GetRawPtr(controller) != NULL && NULL != SensitivityM_X && NULL != SensitivityM_Z_L && NULL != SensitivityM_Z_U && NULL != SensitivityM_L ) { - for( int i = 0; i < controller->nx() * controller->np(); ++i ) + for( Index i = 0; i < controller->nx() * controller->np(); ++i ) { SX[i] = SensitivityM_X[i]; } - for( int i = 0; i < controller->nzu() * controller->np(); ++i ) + for( Index i = 0; i < controller->nzu() * controller->np(); ++i ) { SZU[i] = SensitivityM_Z_U[i]; } - for( int i = 0; i < controller->nzl() * controller->np(); ++i ) + for( Index i = 0; i < controller->nzl() * controller->np(); ++i ) { SZL[i] = SensitivityM_Z_L[i]; } - for( int i = 0; i < controller->nl() * controller->np(); ++i ) + for( Index i = 0; i < controller->nl() * controller->np(); ++i ) { SL[i] = SensitivityM_L[i]; } diff --git a/contrib/sIPOPT/src/SensBuilder.cpp b/contrib/sIPOPT/src/SensBuilder.cpp index 4df819ce3..ae5512799 100644 --- a/contrib/sIPOPT/src/SensBuilder.cpp +++ b/contrib/sIPOPT/src/SensBuilder.cpp @@ -77,7 +77,7 @@ SmartPtr SensBuilder::BuildSensAlg( } // Find out how many steps there are and create as many SchurSolveDrivers - int n_sens_steps; + Index n_sens_steps; options.GetIntegerValue("n_sens_steps", n_sens_steps, prefix); // Create std::vector container in which we are going to keep the SchurDrivers @@ -141,7 +141,7 @@ SmartPtr SensBuilder::BuildRedHessCalc( { jnlst.Printf(J_ERROR, J_MAIN, "\nEXIT: An Error Occured while processing the Indices for the reduced Hessian computation: " - "Something is wrong with index %d\n", setdata_error); + "Something is wrong with index %" IPOPT_INDEX_FORMAT "\n", setdata_error); THROW_EXCEPTION(SENS_BUILDER_ERROR, "Reduced Hessian Index Error"); } diff --git a/contrib/sIPOPT/src/SensIndexPCalculator.cpp b/contrib/sIPOPT/src/SensIndexPCalculator.cpp index e4151f625..02d7ae60f 100644 --- a/contrib/sIPOPT/src/SensIndexPCalculator.cpp +++ b/contrib/sIPOPT/src/SensIndexPCalculator.cpp @@ -79,7 +79,7 @@ bool IndexPCalculator::ComputeP() DBG_ASSERT(retval); /* This part is for displaying norm2(I_z*K^(-1)*I_1) */ - DBG_PRINT((dbg_verbosity, "\ncurr_schur_row=%d, ", curr_schur_row)); + DBG_PRINT((dbg_verbosity, "\ncurr_schur_row=%" IPOPT_INDEX_FORMAT ", ", curr_schur_row)); DBG_PRINT((dbg_verbosity, "norm2(z)=%23.16e\n", sol_vec->x()->Nrm2())); /* end displaying norm2 */ @@ -90,7 +90,7 @@ bool IndexPCalculator::ComputeP() { comp_vec = dynamic_cast(GetRawPtr(sol_vec->GetComp(j))); comp_values = comp_vec->Values(); - IpBlasDcopy(comp_vec->Dim(), comp_values, 1, col_values + curr_dim, 1); + IpBlasCopy(comp_vec->Dim(), comp_values, 1, col_values + curr_dim, 1); curr_dim += comp_vec->Dim(); } cols_[col] = new PColumn(col_values); @@ -184,7 +184,7 @@ void IndexPCalculator::PrintImpl( DBG_START_METH("IndexPCalculator::PrintImpl", dbg_verbosity); const Number* col_val; - jnlst.PrintfIndented(level, category, indent, "%sIndexPCalculator \"%s\" with %d rows and %d columns:\n", + jnlst.PrintfIndented(level, category, indent, "%sIndexPCalculator \"%s\" with %" IPOPT_INDEX_FORMAT " rows and %" IPOPT_INDEX_FORMAT " columns:\n", prefix.c_str(), name.c_str(), nrows_, ncols_); Index col_counter = 0; for( std::map >::const_iterator j = cols_.begin(); j != cols_.end(); ++j ) @@ -192,7 +192,7 @@ void IndexPCalculator::PrintImpl( col_val = j->second->Values(); for( Index i = 0; i < nrows_; ++i ) { - jnlst.PrintfIndented(level, category, indent, "%s%s[%5d,%5d]=%23.16e\n", prefix.c_str(), name.c_str(), i, + jnlst.PrintfIndented(level, category, indent, "%s%s[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "]=%23.16e\n", prefix.c_str(), name.c_str(), i, col_counter, col_val[i]); } col_counter++; @@ -220,7 +220,7 @@ void PColumn::GetSchurMatrixRows( { DBG_START_METH("PColumn::GetSchurMatrixRows", dbg_verbosity); - for( Index i = 0; i < (int) row_idx_B->size(); ++i ) + for( size_t i = 0; i < row_idx_B->size(); ++i ) { S_col[i] = -val_[(*row_idx_B)[i]]; } diff --git a/contrib/sIPOPT/src/SensIndexSchurData.cpp b/contrib/sIPOPT/src/SensIndexSchurData.cpp index 06c442df8..ce4b67a5d 100644 --- a/contrib/sIPOPT/src/SensIndexSchurData.cpp +++ b/contrib/sIPOPT/src/SensIndexSchurData.cpp @@ -115,7 +115,7 @@ Index IndexSchurData::SetData_Index( Index w; (v > 0) ? w = 1 : w = -1; - DBG_PRINT((dbg_verbosity, "Schurdata::w=%d\n", w)); + DBG_PRINT((dbg_verbosity, "Schurdata::w=%" IPOPT_INDEX_FORMAT "\n", w)); Index n_ind = AsIndexMax(dim, index, 1); std::vector sortvec(n_ind, -1); // fill up sortlist @@ -226,7 +226,7 @@ void IndexSchurData::Multiply( Index* v_lens = GetVectorLengths(v); Index v_row, vec_idx; - for( unsigned int i = 0; i < idx_.size(); ++i ) + for( size_t i = 0; i < idx_.size(); ++i ) { v_row = idx_[i]; @@ -282,7 +282,7 @@ void IndexSchurData::TransMultiply( // perform v_vals <- A^T*u Index row, col; Number val; - for( unsigned int i = 0; i < idx_.size(); ++i ) + for( size_t i = 0; i < idx_.size(); ++i ) { row = i; col = idx_[i]; @@ -298,7 +298,7 @@ void IndexSchurData::TransMultiply( { curr_dim = v.GetCompNonConst(i)->Dim(); curr_val = dynamic_cast(GetRawPtr(v.GetCompNonConst(i)))->Values(); - IpBlasDcopy(curr_dim, v_vals + v_idx, 1, curr_val, 1); + IpBlasCopy(curr_dim, v_vals + v_idx, 1, curr_val, 1); v_idx += curr_dim; } @@ -335,13 +335,13 @@ void IndexSchurData::PrintImpl( { DBG_START_METH("IndexSchurData::PrintImpl", dbg_verbosity); - jnlst.PrintfIndented(level, category, indent, "%sIndexSchurData \"%s\" with %d rows:\n", prefix.c_str(), + jnlst.PrintfIndented(level, category, indent, "%sIndexSchurData \"%s\" with %" IPOPT_INDEX_FORMAT " rows:\n", prefix.c_str(), name.c_str(), GetNRowsAdded()); if( Is_Initialized() ) { - for( unsigned int i = 0; i < idx_.size(); i++ ) + for( size_t i = 0; i < idx_.size(); i++ ) { - jnlst.PrintfIndented(level, category, indent, "%s%s[%5d,%5d]=%d\n", prefix.c_str(), name.c_str(), i, idx_[i], + jnlst.PrintfIndented(level, category, indent, "%s%s[%5zd,%5" IPOPT_INDEX_FORMAT "]=%" IPOPT_INDEX_FORMAT "\n", prefix.c_str(), name.c_str(), i, idx_[i], val_[i]); } } @@ -367,7 +367,7 @@ void IndexSchurData::AddData_Flag( if( flags[i] ) { oldindex = false; - for( unsigned int j = 0; j < idx_.size(); ++j ) + for( size_t j = 0; j < idx_.size(); ++j ) { if( i == idx_[j] ) { @@ -398,10 +398,10 @@ void IndexSchurData::AddData_List( new_du_size = (Index) idx_.size(); bool oldindex; - for( unsigned int i = 0; i < cols.size(); ++i ) + for( size_t i = 0; i < cols.size(); ++i ) { oldindex = false; - for( unsigned int j = 0; j < idx_.size(); ++j ) + for( size_t j = 0; j < idx_.size(); ++j ) { if( cols[i] == idx_[j] ) { diff --git a/contrib/sIPOPT/src/SensMetadataMeasurement.cpp b/contrib/sIPOPT/src/SensMetadataMeasurement.cpp index e093d4d4b..c2385dbb4 100644 --- a/contrib/sIPOPT/src/SensMetadataMeasurement.cpp +++ b/contrib/sIPOPT/src/SensMetadataMeasurement.cpp @@ -72,7 +72,7 @@ std::vector MetadataMeasurement::GetInitialEqConstraints() const std::vector constr_metadata = y_c_owner_space_->GetIntegerMetaData("sens_init_constr"); std::vector retval; - for( Index i = 0; i < (int) constr_metadata.size(); ++i ) + for( size_t i = 0; i < constr_metadata.size(); ++i ) { if( constr_metadata[i] != 0 ) { @@ -110,7 +110,7 @@ SmartPtr MetadataMeasurement::GetMeasurement( const Number* u_0_val = dynamic_cast(GetRawPtr(IpData().trial()->x()))->Values(); // Fill up values of delta_u vector - for( Index i = 0; i < (int) val_ipopt.size(); ++i ) + for( size_t i = 0; i < val_ipopt.size(); ++i ) { if( idx_ipopt[i] > 0 ) { diff --git a/contrib/sIPOPT/src/SensStdStepCalc.cpp b/contrib/sIPOPT/src/SensStdStepCalc.cpp index b634ab98e..da8cd1853 100644 --- a/contrib/sIPOPT/src/SensStdStepCalc.cpp +++ b/contrib/sIPOPT/src/SensStdStepCalc.cpp @@ -131,10 +131,10 @@ bool StdStepCalculator::Step( delta_u_space = new DenseVectorSpace(new_du_size); // create new delta_u space new_delta_u = new DenseVector(GetRawPtr(ConstPtr(delta_u_space))); new_du_values = new_delta_u->Values(); - IpBlasDcopy(old_delta_u->Dim(), old_delta_u->Values(), 1, new_du_values, 1); - for( Index i = 0; i < (int) x_bound_violations_idx.size(); ++i ) + IpBlasCopy(old_delta_u->Dim(), old_delta_u->Values(), 1, new_du_values, 1); + for( size_t i = 0; i < x_bound_violations_idx.size(); ++i ) { - // printf("i=%d, delta_u_sort[i]=%d, x_bound_viol_du[i]=%f\n", i, delta_u_sort[i], x_bound_violations_du[i]); + // printf("i=%" IPOPT_INDEX_FORMAT ", delta_u_sort[i]=%" IPOPT_INDEX_FORMAT ", x_bound_viol_du[i]=%f\n", i, delta_u_sort[i], x_bound_violations_du[i]); new_du_values[delta_u_sort[i]] = x_bound_violations_du[i]; } SmartPtr new_sol = sol.MakeNewIteratesVector(); @@ -254,7 +254,7 @@ bool StdStepCalculator::BoundCheck( { x_bound_violations_idx.push_back(i + z_L_ItVec_idx); x_bound_violations_du.push_back(-z_L_trial_val[i]); - //printf("Lower Bound Mult. no. i=%d invalid: delta_u=%f\n", i+z_L_ItVec_idx, z_L_val[i]); + //printf("Lower Bound Mult. no. i=%" IPOPT_INDEX_FORMAT " invalid: delta_u=%f\n", i+z_L_ItVec_idx, z_L_val[i]); } } @@ -264,7 +264,7 @@ bool StdStepCalculator::BoundCheck( { x_bound_violations_idx.push_back(i + z_U_ItVec_idx); x_bound_violations_du.push_back(-z_U_trial_val[i]); - //printf("Upper Bound Mult. no. i=%d invalid: delta_u=%f\n", i+z_U_ItVec_idx, z_U_val[i]); + //printf("Upper Bound Mult. no. i=%" IPOPT_INDEX_FORMAT " invalid: delta_u=%f\n", i+z_U_ItVec_idx, z_U_val[i]); } } diff --git a/contrib/sIPOPT/src/SensUtils.cpp b/contrib/sIPOPT/src/SensUtils.cpp index 93fa97d72..e70d69ca7 100644 --- a/contrib/sIPOPT/src/SensUtils.cpp +++ b/contrib/sIPOPT/src/SensUtils.cpp @@ -96,6 +96,9 @@ SolverReturn AppReturn2SolverReturn( case Maximum_CpuTime_Exceeded: retval = CPUTIME_EXCEEDED; break; + case Maximum_WallTime_Exceeded: + retval = WALLTIME_EXCEEDED; + break; case Not_Enough_Degrees_Of_Freedom: retval = TOO_FEW_DEGREES_OF_FREEDOM; break; diff --git a/contrib/sIPOPT/src/SensUtils.hpp b/contrib/sIPOPT/src/SensUtils.hpp index 8bf73b5c0..7ef87edc7 100644 --- a/contrib/sIPOPT/src/SensUtils.hpp +++ b/contrib/sIPOPT/src/SensUtils.hpp @@ -51,7 +51,7 @@ SIPOPTLIB_EXPORT SolverReturn AppReturn2SolverReturn( class SIPOPTLIB_EXPORT __except_type : public Ipopt::IpoptException \ { \ public: \ - __except_type(std::string msg, std::string fname, Ipopt::Index line) \ + __except_type(const std::string& msg, const std::string& fname, Ipopt::Index line) \ : Ipopt::IpoptException(msg,fname,line, #__except_type) {} \ __except_type(const __except_type& copy) \ : Ipopt::IpoptException(copy) {} \ diff --git a/contrib/sIPOPT/toDo.txt b/contrib/sIPOPT/toDo.txt index 1917d9e68..76e23dbb9 100644 --- a/contrib/sIPOPT/toDo.txt +++ b/contrib/sIPOPT/toDo.txt @@ -15,7 +15,7 @@ SchurData + write new constructor to make this easier - Remove StdSchurData? - exchange GetMultiplyingVectors by a transmultiply implementation that accepts pointers. - (see StdPCalculator for the only use of this function) + (see StdPCalculator for the only use of this function) AsSensStepCalc + move InitializeImpl to the implementation! @@ -36,7 +36,7 @@ SensApplication SensTNLPAdapter + write inverse of ResortX in TNLPAdapter -MakeFile +MakeFile + Remove AsSenscSetup if decided so General diff --git a/depcomp b/depcomp index 65cbf7093..715e34311 100755 --- a/depcomp +++ b/depcomp @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 0b1574aca..2e629a8a6 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -1,4 +1,4 @@ -# Doxyfile 1.8.13 +# Doxyfile 1.9.8 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -12,16 +12,26 @@ # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 @@ -58,18 +68,30 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = +OUTPUT_DIRECTORY = -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes -# performance problems for the file system. +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. # The default value is: NO. CREATE_SUBDIRS = NO +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode @@ -81,14 +103,14 @@ ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English @@ -179,6 +201,16 @@ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus @@ -199,6 +231,14 @@ QT_AUTOBRIEF = YES MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. @@ -222,20 +262,18 @@ TAB_SIZE = 3 # the documentation. An alias has the form: # name=value # For example adding -# "sideeffect=@par Side Effects:\n" +# "sideeffect=@par Side Effects:^^" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -# the "value=" is to suppress a warning due to javadoc commands in the JIpopt comments -ALIASES = "Ipopt=`%Ipopt`" "value=" - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) -TCL_SUBST = +ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For @@ -265,28 +303,40 @@ OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -298,10 +348,21 @@ MARKDOWN_SUPPORT = YES # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 3 + +# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to +# generate identifiers for the Markdown headings. Note: Every identifier is +# unique. +# Possible values are: DOXYGEN use a fixed 'autotoc_md' string followed by a +# sequence number starting at 0 and GITHUB use the lower case version of title +# with any whitespace replaced by '-' and punctuation characters removed. +# The default value is: DOXYGEN. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. -TOC_INCLUDE_HEADINGS = 0 +MARKDOWN_ID_STYLE = DOXYGEN # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can @@ -328,7 +389,7 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -414,6 +475,27 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +# If the TIMESTAMP tag is set different from NO then each generated page will +# contain the date or date and time when the page was generated. Setting this to +# NO can help when comparing the output of multiple runs. +# Possible values are: YES, NO, DATETIME and DATE. +# The default value is: NO. + +TIMESTAMP = NO + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -434,6 +516,12 @@ EXTRACT_ALL = YES EXTRACT_PRIVATE = YES +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. @@ -471,6 +559,13 @@ EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = YES +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation @@ -482,14 +577,15 @@ HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. +# declarations. If set to NO, these declarations will be included in the +# documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO @@ -508,14 +604,22 @@ HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. + +CASE_SENSE_NAMES = SYSTEM # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the @@ -531,6 +635,12 @@ HIDE_SCOPE_NAMES = NO HIDE_COMPOUND_REFERENCE= NO +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. @@ -688,7 +798,8 @@ FILE_VERSION_FILTER = # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE @@ -699,7 +810,7 @@ LAYOUT_FILE = @abs_top_srcdir@/doc/layout.xml # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -734,23 +845,50 @@ WARNINGS = YES WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC # The default value is: NO. WARN_NO_PARAMDOC = NO +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves +# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not +# write the warning messages in between other messages but write them at the end +# of a run, in case a WARN_LOGFILE is defined the warning messages will be +# besides being in the defined file also be shown at the end of a run, unless +# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case +# the behavior will remain as with the setting FAIL_ON_WARNINGS. +# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT. # The default value is: NO. WARN_AS_ERROR = NO @@ -761,13 +899,27 @@ WARN_AS_ERROR = NO # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard -# error (stderr). +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). #WARN_LOGFILE = @coin_doxy_logname@ @@ -782,19 +934,31 @@ WARN_FORMAT = "$file:$line: $text" # Note: If this tag is empty the current directory is searched. INPUT = @abs_top_srcdir@/doc \ - @abs_top_srcdir@/src \ - @abs_top_srcdir@/contrib/sIPOPT/src \ - @abs_top_srcdir@/contrib/sIPOPT/AmplSolver + @abs_top_srcdir@/src \ + @abs_top_srcdir@/contrib/sIPOPT/src \ + @abs_top_srcdir@/contrib/sIPOPT/AmplSolver \ + @abs_top_srcdir@/ChangeLog.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING # The default value is: UTF-8. INPUT_ENCODING = UTF-8 +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. @@ -803,11 +967,15 @@ INPUT_ENCODING = UTF-8 # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cxxm, +# *.cpp, *.cppm, *.c++, *.c++m, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, +# *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.ixx, *.l, *.cs, *.d, *.php, +# *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be +# provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.hpp \ *.h \ @@ -849,10 +1017,7 @@ EXCLUDE_PATTERNS = @coin_doxy_excludes@ # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* +# ANamespace::AClass, ANamespace::*Test EXCLUDE_SYMBOLS = @@ -861,8 +1026,9 @@ EXCLUDE_SYMBOLS = # command). EXAMPLE_PATH = @abs_top_srcdir@/examples \ - @abs_top_srcdir@/src/Interfaces \ - @abs_top_srcdir@/ChangeLog @abs_top_srcdir@/AUTHORS @abs_top_srcdir@/LICENSE + @abs_top_srcdir@/src/Interfaces \ + @abs_top_srcdir@/AUTHORS \ + @abs_top_srcdir@/LICENSE # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -899,6 +1065,11 @@ IMAGE_PATH = # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. @@ -916,7 +1087,7 @@ INPUT_FILTER = # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. -FILTER_PATTERNS = +FILTER_PATTERNS = "*ChangeLog.md=sed -e 's/\bIpopt\b/%Ipopt/g' -e 's/\/%Ipopt/\/Ipopt/g'" # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will also be used to filter the input files that are used for @@ -940,6 +1111,15 @@ FILTER_SOURCE_PATTERNS = USE_MDFILE_AS_MAINPAGE = +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- @@ -967,7 +1147,7 @@ INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. +# entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO @@ -999,12 +1179,12 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # @@ -1026,25 +1206,6 @@ USE_HTAGS = NO VERBATIM_HEADERS = YES -# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse-libclang=ON option for CMake. -# The default value is: NO. - -CLANG_ASSISTED_PARSING = NO - -# If clang assisted parsing is enabled you can provide the compiler with command -# line options that you would normally use when invoking the compiler. Note that -# the include paths will already be set by doxygen for the files and directories -# specified with INPUT and INCLUDE_PATH. -# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. - -CLANG_OPTIONS = - #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -1056,17 +1217,11 @@ CLANG_OPTIONS = ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 3 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = @@ -1145,7 +1300,12 @@ HTML_STYLESHEET = @abs_top_srcdir@/doc/stylesheet.css # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = @@ -1160,10 +1320,23 @@ HTML_EXTRA_STYLESHEET = HTML_EXTRA_FILES = +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1172,7 +1345,7 @@ HTML_EXTRA_FILES = HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A +# in the HTML output. For a value of 0 the output will use gray-scales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1190,14 +1363,16 @@ HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_GAMMA = 80 -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_TIMESTAMP = YES +HTML_DYNAMIC_MENUS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the @@ -1207,6 +1382,13 @@ HTML_TIMESTAMP = YES HTML_DYNAMIC_SECTIONS = YES +# If the HTML_CODE_FOLDING tag is set to YES then classes and functions can be +# dynamically folded and expanded in the generated HTML source code. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_CODE_FOLDING = YES + # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to @@ -1222,13 +1404,14 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1242,6 +1425,13 @@ GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. @@ -1267,8 +1457,12 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1298,7 +1492,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1325,6 +1519,16 @@ BINARY_TOC = NO TOC_EXPAND = NO +# The SITEMAP_URL tag is used to specify the full URL of the place where the +# generated documentation will be placed on the server by the user during the +# deployment of the documentation. The generated sitemap is called sitemap.xml +# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL +# is specified no sitemap is generated. For information about the sitemap +# protocol see https://www.sitemaps.org +# This tag requires that the tag GENERATE_HTML is set to YES. + +SITEMAP_URL = + # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help @@ -1343,7 +1547,8 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1351,8 +1556,8 @@ QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1360,30 +1565,30 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = @@ -1426,16 +1631,28 @@ DISABLE_INDEX = YES # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = YES +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # @@ -1460,6 +1677,24 @@ TREEVIEW_WIDTH = 200 EXT_LINKS_IN_WINDOW = NO +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML @@ -1469,19 +1704,14 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 11 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. -FORMULA_TRANSPARENT = YES +FORMULA_MACROFILE = # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side JavaScript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1491,11 +1721,29 @@ FORMULA_TRANSPARENT = YES USE_MATHJAX = YES +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + # When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). # Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1508,22 +1756,29 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 # This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5 +MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1551,7 +1806,7 @@ MATHJAX_CODEFILE = SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There +# implemented using a web server instead of a web client using JavaScript. There # are two flavors of web server based searching depending on the EXTERNAL_SEARCH # setting. When disabled, doxygen will generate a PHP script for searching and # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing @@ -1570,7 +1825,8 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: +# https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1583,8 +1839,9 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and -# Searching" for details. +# Xapian (see: +# https://xapian.org/). See the section "External Indexing and Searching" for +# details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = @@ -1635,21 +1892,35 @@ LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. # -# Note that when enabling USE_PDFLATEX this option is only used for generating -# bitmaps for formulas in the HTML output, but not in the Makefile that is -# written to the output directory. -# The default file is: latex. +# Note that when not enabling USE_PDFLATEX the default is latex when enabling +# USE_PDFLATEX the default is pdflatex and when in the later case latex is +# chosen this is overwritten by pdflatex. For specific output languages the +# default can have been set differently, this depends on the implementation of +# the output language. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate # index for LaTeX. +# Note: This tag is used in the Makefile / make.bat. +# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file +# (.tex). # The default file is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. MAKEINDEX_CMD_NAME = makeindex +# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. +# Note: This tag is used in the generated output file (.tex). +# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. +# The default value is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_MAKEINDEX_CMD = makeindex + # If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some # trees in general. @@ -1680,29 +1951,31 @@ PAPER_TYPE = letter EXTRA_PACKAGES = amsmath \ amsfonts -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the -# generated LaTeX document. The header should contain everything until the first -# chapter. If it is left blank doxygen will generate a standard header. See -# section "Doxygen usage" for information on how to let doxygen write the -# default header to a separate file. +# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for +# the generated LaTeX document. The header should contain everything until the +# first chapter. If it is left blank doxygen will generate a standard header. It +# is highly recommended to start with a default header using +# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty +# and then modify the file new_header.tex. See also section "Doxygen usage" for +# information on how to generate the default header that doxygen normally uses. # -# Note: Only use a user-defined header if you know what you are doing! The -# following commands have a special meaning inside the header: $title, -# $datetime, $date, $doxygenversion, $projectname, $projectnumber, -# $projectbrief, $projectlogo. Doxygen will replace $title with the empty -# string, for the replacement values of the other commands the user is referred -# to HTML_HEADER. +# Note: Only use a user-defined header if you know what you are doing! +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. The following +# commands have a special meaning inside the header (and footer): For a +# description of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the -# generated LaTeX document. The footer should contain everything after the last -# chapter. If it is left blank doxygen will generate a standard footer. See +# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for +# the generated LaTeX document. The footer should contain everything after the +# last chapter. If it is left blank doxygen will generate a standard footer. See # LATEX_HEADER for more information on how to generate a default footer and what -# special commands can be used inside the footer. -# -# Note: Only use a user-defined footer if you know what you are doing! +# special commands can be used inside the footer. See also section "Doxygen +# usage" for information on how to generate the default footer that doxygen +# normally uses. Note: Only use a user-defined footer if you know what you are +# doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = @@ -1735,18 +2008,26 @@ LATEX_EXTRA_FILES = PDF_HYPERLINKS = YES -# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES, to get a -# higher quality PDF documentation. +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. USE_PDFLATEX = YES -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode -# command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. This option is also used -# when generating formulas in HTML. +# The LATEX_BATCHMODE tag signals the behavior of LaTeX in case of an error. +# Possible values are: NO same as ERROR_STOP, YES same as BATCH, BATCH In batch +# mode nothing is printed on the terminal, errors are scrolled as if is +# hit at every error; missing files that TeX tries to input or request from +# keyboard input (\read on a not open input stream) cause the job to abort, +# NON_STOP In nonstop mode the diagnostic message will appear on the terminal, +# but there is no possibility of user interaction just like in batch mode, +# SCROLL In scroll mode, TeX will stop only for missing files to input or if +# keyboard input is necessary and ERROR_STOP In errorstop mode, TeX will stop at +# each error, asking for user intervention. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1759,31 +2040,21 @@ LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO -# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source -# code with syntax highlighting in the LaTeX output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_SOURCE_CODE = NO - # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BIB_STYLE = plain -# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: NO. +# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) +# path from which the emoji images will be read. If a relative path is entered, +# it will be relative to the LATEX_OUTPUT directory. If left blank the +# LATEX_OUTPUT directory will be used. # This tag requires that the tag GENERATE_LATEX is set to YES. -LATEX_TIMESTAMP = NO +LATEX_EMOJI_DIRECTORY = #--------------------------------------------------------------------------- # Configuration options related to the RTF output @@ -1824,9 +2095,9 @@ COMPACT_RTF = NO RTF_HYPERLINKS = NO -# Load stylesheet definitions from file. Syntax is similar to doxygen's config -# file, i.e. a series of assignments. You only have to provide replacements, -# missing definitions are set to their default value. +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# configuration file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. # # See also section "Doxygen usage" for information on how to generate the # default style sheet that doxygen normally uses. @@ -1835,22 +2106,12 @@ RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is -# similar to doxygen's config file. A template extensions file can be generated -# using doxygen -e rtf extensionFile. +# similar to doxygen's configuration file. A template extensions file can be +# generated using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_EXTENSIONS_FILE = -# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code -# with syntax highlighting in the RTF output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_SOURCE_CODE = NO - #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- @@ -1922,6 +2183,13 @@ XML_OUTPUT = xml XML_PROGRAMLISTING = YES +# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include +# namespace members in file scope as well, matching the HTML output. +# The default value is: NO. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_NS_MEMB_FILE_SCOPE = NO + #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- @@ -1940,27 +2208,44 @@ GENERATE_DOCBOOK = NO DOCBOOK_OUTPUT = docbook -# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the -# program listings (including syntax highlighting and cross-referencing -# information) to the DOCBOOK output. Note that enabling this will significantly -# increase the size of the DOCBOOK output. -# The default value is: NO. -# This tag requires that the tag GENERATE_DOCBOOK is set to YES. - -DOCBOOK_PROGRAMLISTING = NO - #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to Sqlite3 output +#--------------------------------------------------------------------------- + +# If the GENERATE_SQLITE3 tag is set to YES doxygen will generate a Sqlite3 +# database with symbols found by doxygen stored in tables. +# The default value is: NO. + +GENERATE_SQLITE3 = NO + +# The SQLITE3_OUTPUT tag is used to specify where the Sqlite3 database will be +# put. If a relative path is entered the value of OUTPUT_DIRECTORY will be put +# in front of it. +# The default directory is: sqlite3. +# This tag requires that the tag GENERATE_SQLITE3 is set to YES. + +SQLITE3_OUTPUT = sqlite3 + +# The SQLITE3_OVERWRITE_DB tag is set to YES, the existing doxygen_sqlite3.db +# database file will be recreated with each doxygen run. If set to NO, doxygen +# will warn if an a database file is already found and not modify it. +# The default value is: YES. +# This tag requires that the tag GENERATE_SQLITE3 is set to YES. + +SQLITE3_RECREATE_DB = YES + #--------------------------------------------------------------------------- # Configuration options related to the Perl module output #--------------------------------------------------------------------------- @@ -2035,7 +2320,8 @@ SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the -# preprocessor. +# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of +# RECURSIVE has no effect here. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = @@ -2056,25 +2342,26 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = COIN_HAS_ASL \ - COIN_HAS_HSL \ - COIN_HAS_LAPACK \ - COIN_HAS_MUMPS \ +PREDEFINED = IPOPT_HAS_ASL \ + IPOPT_HAS_HSL \ + IPOPT_HAS_LAPACK \ + IPOPT_HAS_MUMPS \ + IPOPT_HAS_SPRAL \ + IPOPT_HAS_LINEARSOLVERLOADER \ HAVE_CFLOAT \ HAVE_CIEEEFP \ HAVE_DLFCN_H \ HAVE_DRAND48 \ - HAVE_LINEARSOLVERLOADER \ HAVE_PARDISO \ HAVE_SNPRINTF \ HAVE_VA_COPY \ HAVE_VSNPRINTF \ HAVE_WSMP \ - COIN_LAPACK_FUNC(x)=x \ F77_FUNC(x)=x \ - HSL_FUNC(x)=x \ - PARDISO_FUNC(x)=x \ - WSMP_FUNC(x)=x \ + IPOPT_LAPACK_FUNC(x)=x \ + IPOPT_HSL_FUNC(x)=x \ + IPOPT_PARDISO_FUNC(x)=x \ + IPOPT_WSMP_FUNC(x)=x \ IPOPT_EXPORT(x)=x \ __cplusplus @@ -2122,15 +2409,15 @@ TAGFILES = @coin_doxy_tagfiles@ #GENERATE_TAGFILE = @coin_doxy_tagname@ -# If the ALLEXTERNALS tag is set to YES, all external class will be listed in -# the class index. If set to NO, only the inherited external classes will be -# listed. +# If the ALLEXTERNALS tag is set to YES, all external classes and namespaces +# will be listed in the class and namespace index. If set to NO, only the +# inherited external classes will be listed. # The default value is: NO. ALLEXTERNALS = YES # If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will be +# in the topic index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. @@ -2143,41 +2430,10 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to diagram generator tools #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# You can include diagrams made with dia in doxygen documentation. Doxygen will -# then run dia to produce the diagram and insert it in the documentation. The -# DIA_PATH tag allows you to specify the directory where the dia binary resides. -# If left empty dia is assumed to be found in the default search path. - -DIA_PATH = - # If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. @@ -2186,7 +2442,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2203,49 +2459,73 @@ HAVE_DOT = @coin_doxy_usedot@ DOT_NUM_THREADS = 0 -# When you want a differently looking font in the dot files that doxygen -# generates you can specify the font name using DOT_FONTNAME. You need to make -# sure dot is able to find the font, which can be done by putting it in a -# standard location or by setting the DOTFONTPATH environment variable or by -# setting DOT_FONTPATH to the directory containing the font. -# The default value is: Helvetica. +# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of +# subgraphs. When you want a differently looking font in the dot files that +# doxygen generates you can specify fontname, fontcolor and fontsize attributes. +# For details please see Node, +# Edge and Graph Attributes specification You need to make sure dot is able +# to find the font, which can be done by putting it in a standard location or by +# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. Default graphviz fontsize is 14. +# The default value is: fontname=Helvetica,fontsize=10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTNAME = +DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" -# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of -# dot graphs. -# Minimum value: 4, maximum value: 24, default value: 10. +# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can +# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about +# arrows shapes. +# The default value is: labelfontname=Helvetica,labelfontsize=10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTSIZE = 10 +DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" -# By default doxygen will tell dot to use the default font as specified with -# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set -# the path where dot can find it using this tag. +# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes +# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification +# The default value is: shape=box,height=0.2,width=0.4. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" + +# You can set the path where dot can find font specified with fontname in +# DOT_COMMON_ATTR and others dot attributes. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# If the CLASS_GRAPH tag is set to YES or GRAPH or BUILTIN then doxygen will +# generate a graph for each documented class showing the direct and indirect +# inheritance relations. In case the CLASS_GRAPH tag is set to YES or GRAPH and +# HAVE_DOT is enabled as well, then dot will be used to draw the graph. In case +# the CLASS_GRAPH tag is set to YES and HAVE_DOT is disabled or if the +# CLASS_GRAPH tag is set to BUILTIN, then the built-in generator will be used. +# If the CLASS_GRAPH tag is set to TEXT the direct and indirect inheritance +# relations will be shown as texts / links. +# Possible values are: NO, YES, TEXT, GRAPH and BUILTIN. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a # graph for each documented class showing the direct and indirect implementation # dependencies (inheritance, containment, and class references variables) of the -# class with other documented classes. +# class with other documented classes. Explicit enabling a collaboration graph, +# when COLLABORATION_GRAPH is set to NO, can be accomplished by means of the +# command \collaborationgraph. Disabling a collaboration graph can be +# accomplished by means of the command \hidecollaborationgraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. COLLABORATION_GRAPH = NO # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for -# groups, showing the direct groups dependencies. +# groups, showing the direct groups dependencies. Explicit enabling a group +# dependency graph, when GROUP_GRAPHS is set to NO, can be accomplished by means +# of the command \groupgraph. Disabling a directory graph can be accomplished by +# means of the command \hidegroupgraph. See also the chapter Grouping in the +# manual. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2268,10 +2548,32 @@ UML_LOOK = NO # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. +# This tag requires that the tag UML_LOOK is set to YES. UML_LIMIT_NUM_FIELDS = 10 +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will wrapped across multiple lines. Some heuristics are apply +# to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. @@ -2283,7 +2585,9 @@ TEMPLATE_RELATIONS = YES # If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to # YES then doxygen will generate a graph for each documented file showing the # direct and indirect include dependencies of the file with other documented -# files. +# files. Explicit enabling an include graph, when INCLUDE_GRAPH is is set to NO, +# can be accomplished by means of the command \includegraph. Disabling an +# include graph can be accomplished by means of the command \hideincludegraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2292,7 +2596,10 @@ INCLUDE_GRAPH = NO # If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are # set to YES then doxygen will generate a graph for each documented file showing # the direct and indirect include dependencies of the file with other documented -# files. +# files. Explicit enabling an included by graph, when INCLUDED_BY_GRAPH is set +# to NO, can be accomplished by means of the command \includedbygraph. Disabling +# an included by graph can be accomplished by means of the command +# \hideincludedbygraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2332,16 +2639,26 @@ GRAPHICAL_HIERARCHY = NO # If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the # dependencies a directory has on other directories in a graphical way. The # dependency relations are determined by the #include relations between the -# files in the directories. +# files in the directories. Explicit enabling a directory graph, when +# DIRECTORY_GRAPH is set to NO, can be accomplished by means of the command +# \directorygraph. Disabling a directory graph can be accomplished by means of +# the command \hidedirectorygraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. DIRECTORY_GRAPH = YES +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 1 + # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). @@ -2378,11 +2695,12 @@ DOT_PATH = DOTFILE_DIRS = -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the \mscfile -# command). +# You can include diagrams made with dia in doxygen documentation. Doxygen will +# then run dia to produce the diagram and insert it in the documentation. The +# DIA_PATH tag allows you to specify the directory where the dia binary resides. +# If left empty dia is assumed to be found in the default search path. -MSCFILE_DIRS = +DIA_PATH = # The DIAFILE_DIRS tag can be used to specify one or more directories that # contain dia files that are included in the documentation (see the \diafile @@ -2391,10 +2709,10 @@ MSCFILE_DIRS = DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. PLANTUML_JAR_PATH = @@ -2432,18 +2750,6 @@ DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 0 -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not seem -# to support this out of the box. -# -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_TRANSPARENT = NO - # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support @@ -2456,14 +2762,34 @@ DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc temporary +# files. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. If the MSCGEN_TOOL tag is left empty (the default), then doxygen will +# use a built-in version of mscgen tool to produce the charts. Alternatively, +# the MSCGEN_TOOL tag can also specify the name an external tool. For instance, +# specifying prog as the value, doxygen will call the tool as prog -T +# -o . The external tool should support +# output file formats "png", "eps", "svg", and "ismap". + +MSCGEN_TOOL = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the \mscfile +# command). + +MSCFILE_DIRS = diff --git a/doc/faq.dox b/doc/faq.dox index 950024b39..7702bb335 100644 --- a/doc/faq.dox +++ b/doc/faq.dox @@ -1,72 +1,72 @@ /** \page FAQ Frequenty Asked Questions -Contained below is a list of the frequently asked questions for \Ipopt. +Contained below is a list of the frequently asked questions for %Ipopt. -## What is \Ipopt? +## What is Ipopt? -\Ipopt (*I*nterior *P*oint *OPT*imizer, pronounced eye-pea-Opt) is a software package for large-scale nonlinear optimization. -\Ipopt implements an interior-point algorithm for continuous, nonlinear, nonconvex, constrained optimization problems. +%Ipopt (*I*nterior *P*oint *OPT*imizer, pronounced eye-pea-Opt) is a software package for large-scale nonlinear optimization. +%Ipopt implements an interior-point algorithm for continuous, nonlinear, nonconvex, constrained optimization problems. It is meant to be a general purpose nonlinear programming (NLP) solver. However, it is mainly written for large-scale problems with up to million of variables and constraints. (For such large problems, it is assumed that the derivative matrices are sparse.) Please see the [Ipopt project page](https://github.com/coin-or/Ipopt) for a more detailed description. -## How do I use \Ipopt? +## How do I use Ipopt? -You can use \Ipopt directly from your own computer code (C++, C, Fortran, Java, R). -You can also use Ipopt from optimization modeling environments such as [AMPL](http://www.ampl.com/), [GAMS](http://www.gams.com/), [CUTEst](https://github.com/ralna/CUTEst), as well as on the [NEOS Server](http://www-neos.mcs.anl.gov/neos/solvers/nco:Ipopt/AMPL.html). +See \ref HOWTOUSE. -## What license is \Ipopt released under? +## What license is Ipopt released under? -The \Ipopt source code is now released under the [Eclipse Public License (EPL)](http://www.eclipse.org/legal/epl-v10.html). +The %Ipopt source code is now released under the [Eclipse Public License (EPL)](http://www.eclipse.org/legal/epl-v10.html). Originally (before release 3.9.2), IPOPT was released under the Common Public License (CPL). However, the CPL has been "deprecated and superseded" by the Ecplise Public License (EPL). The new license (EPL) is almost the same as the old with 2 "new and improved" features: (i) the license steward is the Eclipse Foundation (not IBM) and (ii) the EPL does not have the "defense termination clause" (aka the patent retaliation bit) which was a point of objection by some. Some additional information regarding the licenses might be found at this [FAQ](http://www.ibm.com/developerworks/library/os-cplfaq.html). -## What do I need to build \Ipopt? +## What do I need to build Ipopt? -While the source code for \Ipopt itself is released as open source under the Eclipse Public License (EPL), compilation requires third party components (such as BLAS, LAPACK, some sparse linear solver library) which you have to obtain separately. -The \Ipopt documentation gives detailed instructions on how to obtain and compile these components. +While the source code for %Ipopt itself is released as open source under the Eclipse Public License (EPL), compilation requires third party components (such as BLAS, LAPACK, some sparse linear solver library) which you have to obtain separately. +The %Ipopt documentation gives detailed instructions on how to obtain and compile these components. (These components may be covered by license agreements different from EPL and may not be free for commercial use.) -## On what operating systems can \Ipopt be used? +## On what operating systems can Ipopt be used? -Convenient configuration scripts and Makefiles are provided and have been tested for several flavors of GNU/Linux, Mac OS X, and MSYS2/MinGW. +Convenient configuration scripts and Makefiles are provided and have been tested for several flavors of GNU/Linux, macOS, and MSYS2/MinGW. Previous versions of IPOPT have also been run on an old iPod, as well as BlueGene. -## Is \Ipopt thread-safe? +## Is Ipopt thread-safe? -\Ipopt itself is thread-safe. Please check the used third-party components, i.e., linear algebra and linear solvers, for thread-safety, too. +%Ipopt itself is thread-safe. Please check the used third-party components, i.e., linear algebra and linear solvers, for thread-safety, too. +For example, MUMPS is not thread-safe. +Since %Ipopt 3.14.0, however, calls into MUMPS are protected by a mutex in the %Ipopt/MUMPS interface, so that it should be possible to use %Ipopt with MUMPS in a multi-threading environment as well. -## What is the method behind \Ipopt? +## What is the method behind Ipopt? -\Ipopt implements a interior point method for nonlinear programming. +%Ipopt implements a interior point method for nonlinear programming. Search directions (coming from a linearization of the optimality conditions) can be computed in a full-space version by solving a large symmetric linear system. -\Ipopt can employ second derivative information, if available, or otherwise approximate it by means of a limited-memory quasi-Newton approach (BFGS and SR1). +%Ipopt can employ second derivative information, if available, or otherwise approximate it by means of a limited-memory quasi-Newton approach (BFGS and SR1). Global convergence of the method is ensured by a line search procedure, based on a filter method. -This paper describes the implementation of \Ipopt: \cite WaecBieg06:mp. +This paper describes the implementation of %Ipopt: \cite WaecBieg06:mp. Additional technical information may be found in other publications [here](https://researcher.ibm.com/researcher/view_page.php?id=1717). -## Who do I contact with questions about \Ipopt? +## Who do I contact with questions about Ipopt? -If you have any questions or comments please send a message to the [Ipopt Mailing List](http://list.coin-or.org/mailman/listinfo/ipopt) -or open an issue on the [Ipopt GitHub issue tracker](https://github.com/coin-or/Ipopt/issues). +If you have any questions or comments please create a discussion at the [Ipopt GitHub Discussions system](https://github.com/coin-or/Ipopt/discussions). Please include detailed information about your configuration (operating system, compilers, version number of Ipopt, etc) if you are writing about a compilation or execution problem. -(Note: You need to subscribe to the mailing list before you can post a message.) +(Note: You need a GitHub account to create or contribute to a discussion.) ## What is the difference between the Fortran version and the C++ version? -The original version of \Ipopt was written in Fortran 77 by Andreas Wächter at Carnegie Mellon University. +The original version of %Ipopt was written in Fortran 77 by Andreas Wächter at Carnegie Mellon University. This version was contributed to the COIN-OR initiative and development has continued. -In an effort to make \Ipopt more flexible for new algorithm development, we set out to design and implement a new version of \Ipopt in C++. +In an effort to make %Ipopt more flexible for new algorithm development, we set out to design and implement a new version of %Ipopt in C++. This version was released on Aug. 26, 2005, and is the primary version for new developments. The previous Fortran version is still available, but will not see any new development other than bug fixes. @@ -75,9 +75,9 @@ Currently, there are some features in the Fortran version that are not implement - Complementarities: Handling of complementarity constraints using Arvind Raghunathan's constraint relaxation is not implemented. The new C++ version also contains features not available in the Fortran version. - - New problem structure: The new problem structure handles general inequalities. This means that slack variables are handled by \Ipopt and you no longer need to add them yourself. This also allows \Ipopt to identify the slack variables and take extra steps. - - Adaptive Mu Update: The new version of \Ipopt includes an adaptive strategy for selecting the value of the barrier parameter. In many cases, this can reduce the number of iterations required by \Ipopt. \cite NocWaeWal:adaptive - - New linear solvers: More linear solvers have been interfaced with \Ipopt with other linear solvers. + - New problem structure: The new problem structure handles general inequalities. This means that slack variables are handled by %Ipopt and you no longer need to add them yourself. This also allows %Ipopt to identify the slack variables and take extra steps. + - Adaptive Mu Update: The new version of %Ipopt includes an adaptive strategy for selecting the value of the barrier parameter. In many cases, this can reduce the number of iterations required by %Ipopt. \cite NocWaeWal:adaptive + - New linear solvers: More linear solvers have been interfaced with %Ipopt with other linear solvers. All in all we think that the new version is easier to use. Furthermore, we think it is now far easier for others to contribute to the open source project. diff --git a/doc/header.html b/doc/header.html index 31a176a39..07365d28e 100644 --- a/doc/header.html +++ b/doc/header.html @@ -1,5 +1,5 @@ - - + + diff --git a/doc/hs071_warmstart.mod b/doc/hs071_warmstart.mod index b4b32135e..49c214f95 100644 --- a/doc/hs071_warmstart.mod +++ b/doc/hs071_warmstart.mod @@ -61,8 +61,8 @@ let x3.ipopt_zL_in := x3.ipopt_zL_out; let x3.ipopt_zU_in := x3.ipopt_zU_out; let x4.ipopt_zL_in := x4.ipopt_zL_out; let x4.ipopt_zU_in := x4.ipopt_zU_out; - -# set options for warm-start + +# set options for warm-start option ipopt_options "warm_start_init_point yes warm_start_bound_push 1e-6 warm_start_mult_bound_push 1e-6 mu_init 1e-6"; # solve the problem again diff --git a/doc/impl.dox b/doc/impl.dox index 29e82faff..01c635582 100644 --- a/doc/impl.dox +++ b/doc/impl.dox @@ -3,7 +3,7 @@ \section TRIPLET Triplet Format for Sparse Matrices -\Ipopt was designed for optimizing large sparse nonlinear +%Ipopt was designed for optimizing large sparse nonlinear programs. Because of problem sparsity, the required matrices (like the constraints Jacobian or Lagrangian Hessian) are not stored as dense matrices, but rather in a sparse matrix format. For the tutorials in @@ -35,7 +35,7 @@ very dramatic. (For an \f$n \times n\f$ matrix, the dense representation grows with the the square of \f$n\f$, while the sparse representation grows linearly in the number of nonzeros.) -The parameter `index_style` in Ipopt::TNLP::get_nlp_info tells \Ipopt +The parameter `index_style` in Ipopt::TNLP::get_nlp_info tells %Ipopt if you prefer to use C style indexing (0-based, i.e., starting the counting at 0) for the row and column indices or Fortran style (1-based). The following table shows the triplet format for the @@ -104,7 +104,7 @@ and C index styles, respectively: | row | col | value | |:------------|:------------|:--------------- | | iRow[0] = 1 | jCol[0] = 1 | values[0] = 1.0 | - | iRow[1] = 2 | jCol[1] = 1 | values[1] = 1.1 | + | iRow[1] = 2 | jCol[1] = 2 | values[1] = 1.1 | | iRow[2] = 3 | jCol[2] = 1 | values[2] = 3.0 | | iRow[3] = 3 | jCol[3] = 3 | values[3] = 1.2 | | iRow[4] = 4 | jCol[4] = 3 | values[4] = 6.0 | @@ -117,7 +117,7 @@ and C index styles, respectively: | row | col | value | |:------------|:------------|:----------------| | iRow[0] = 0 | jCol[0] = 0 | values[0] = 1.0 | - | iRow[1] = 1 | jCol[1] = 0 | values[1] = 1.1 | + | iRow[1] = 1 | jCol[1] = 1 | values[1] = 1.1 | | iRow[2] = 2 | jCol[2] = 0 | values[2] = 3.0 | | iRow[3] = 2 | jCol[3] = 2 | values[3] = 1.2 | | iRow[4] = 3 | jCol[4] = 2 | values[4] = 6.0 | @@ -142,18 +142,18 @@ of the object goes to zero, the object is automatically deleted. pointer. It is very important to use `SmartPtr`'s instead of raw pointers when -passing objects to \Ipopt. Internally, \Ipopt +passing objects to %Ipopt. Internally, %Ipopt uses smart pointers for referencing objects. If you use a raw pointer in your executable, the object's counter will NOT get incremented. Then, -when \Ipopt uses smart pointers inside its own code, the -counter will get incremented. However, before \Ipopt +when %Ipopt uses smart pointers inside its own code, the +counter will get incremented. However, before %Ipopt returns control to your code, it will decrement as many times as it incremented earlier, and the counter will return to zero. Therefore, -\Ipopt will delete the object. When control returns to you, +%Ipopt will delete the object. When control returns to you, you now have a raw pointer that points to a deleted object. This might sound difficult to anyone not familiar with the use of smart pointers, but just follow one simple rule; always use a Ipopt::SmartPtr when -creating or passing an \Ipopt object. +creating or passing an %Ipopt object. */ diff --git a/doc/install.dox b/doc/install.dox index 73f65de01..6fad14051 100644 --- a/doc/install.dox +++ b/doc/install.dox @@ -4,9 +4,9 @@ \tableofcontents The following sections describe the installation procedures on -UNIX/Linux, Mac OS X, and Windows systems. +UNIX/Linux, macOS, and Windows systems. -The configuration script and Makefiles in the \Ipopt +The configuration script and Makefiles in the %Ipopt distribution have been created using GNU's autoconf and automake. In general, you can see the list of options and variables that can be set for the configure script by typing `configure --help`. @@ -15,26 +15,6 @@ set for the configure script by typing `configure --help`. are a valuable resource of information. --> -\section COINBREW Quick Start: Using CoinBrew - -On sufficiently prepared systems, a quick way to build and install \Ipopt -is to get the coinbrew script from https://coin-or.github.io/coinbrew/ -and running - - /path/to/coinbrew fetch Ipopt - /path/to/coinbrew build Ipopt --prefix=/dir/to/install --test - /path/to/coinbrew install Ipopt - -The coinbrew script will take care of building and installing the -dependencies ASL, Metis, and Mumps before building \Ipopt. - -More details on using coinbrew can be found at the instructions on -[Getting Started with the COIN-OR Optimization Suite](https://coin-or.github.io/user_introduction). - -If these commands fail or this build is not sufficient, e.g., because -other linear solvers should be used by \Ipopt, the following sections -and the help of coinbrew should be studied. - \section SYSTEMPACKAGES Getting System Packages (Compilers, ...) \subsection SYSTEMPACKAGES_LINUX Linux distributions @@ -44,14 +24,17 @@ should need to do is check the compiler versions. On a Debian-based distribution, you can obtain all necessary tools with the following command: - sudo apt-get install gcc g++ gfortran git patch wget pkg-config + sudo apt-get install gcc g++ gfortran git patch wget pkg-config liblapack-dev libmetis-dev Replace apt-get with your relevant package manager, e.g. `dnf` for RedHat-based distributions, `pacman` for Arch, etc. The g++ and gfortran compilers may need to be specified respectively as `gcc-c++` and `gcc-gfortran` with some package managers. -\subsection SYSTEMPACKAGES_MAC Mac OS X +If \ref INT64_BUILD, a variant of Lapack that uses 64-bit integers is required. +On some Linux distributions (e.g., Ubuntu), this is available by installing package `liblapack64-dev`. + +\subsection SYSTEMPACKAGES_MAC macOS You need either the [Xcode Command Line Tools](https://developer.apple.com/downloads) or a community alternative such as Homebrew to install the GNU compilers: @@ -68,13 +51,19 @@ If you have Xcode installed, the Command Line Tools are available under Preferences, Downloads. These items unfortunately do not come with a Fortran compiler, but you can get gfortran from http://gcc.gnu.org/wiki/GFortranBinaries#MacOS. -In the past, we have been able to compile \Ipopt using default Xcode +In the past, we have been able to compile %Ipopt using default Xcode versions of gcc and g++ and a newer version of gfortran from this link, but consistent version numbers may be an issue in future cases. +If you intend to use \ref DOWNLOAD_MUMPS "MUMPS" or one of the \ref DOWNLOAD_HSL "HSL linear solvers", +then they may profit from an installation of METIS. +This can be accomplished via + + brew install metis + \subsection SYSTEMPACKAGES_MSYS Windows with MSYS2/MinGW -For Windows, one can compile \Ipopt under MSYS/MinGW, which is a +For Windows, one can compile %Ipopt under MSYS2/MinGW, which is a light-weight UNIX-like environment for Windows. MSYS2/MinGW can be obtained from . @@ -85,13 +74,13 @@ After installation, a number of additional packages need to be installed: (I might have forgotten something.) If you also want to use GNU compilers, then install them, too: - pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gfortran + pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-fortran -When using MinGW, it is convenient to install MinGW's Lapack as well: +When using MinGW, it is convenient to install MinGW's Lapack and METIS as well: - pacman -S mingw-w64-x86_64-lapack + pacman -S mingw-w64-x86_64-lapack mingw-w64-x86_64-metis -To use MSYS2/MinGW to compile \Ipopt with native MSVC/Intel compilers, +To use MSYS2/MinGW to compile %Ipopt with native MSVC/Intel compilers, the basic version MSYS2 version without MinGW is sufficient. To use the GNU compilers, MinGW is required. @@ -115,44 +104,42 @@ You might have to search around a bit. The important thing is that, after your change, you can type `cl` and it finds the Microsoft C++ compiler and, if installed, you can type `ifort` and it finds the Intel Fortran compiler. -\note The build systems of \Ipopt by default first looks for GCC and Clang +\note The build systems of %Ipopt by default first looks for GCC and Clang before the Intel and MS compilers. To disable this, specify the flag `--enable-msvc` as argument to configure below. \section EXTERNALCODE Download, build, and install dependencies -\Ipopt uses a few external packages that are not included -in the \Ipopt source code distribution, for example ASL (the -AMPL Solver Library if you want to compile the \Ipopt AMPL +%Ipopt uses a few external packages that are not included +in the %Ipopt source code distribution, for example ASL (the +AMPL Solver Library if you want to compile the %Ipopt AMPL solver executable), Blas, Lapack. -\Ipopt also requires at least one linear solver for sparse +%Ipopt also requires at least one linear solver for sparse symmetric indefinite matrices. There are different possibilities, see below. **It is important to keep in mind that usually the largest fraction of computation time in the optimizer is spent for solving the linear system, and that your choice of the linear solver -impacts \Ipopt's speed and robustness. It might be +impacts %Ipopt's speed and robustness. It might be worthwhile to try different linear solver to experiment with what is best for your application.** Since this third party software is released under different licenses -than \Ipopt, we cannot distribute their code together with -the \Ipopt packages and have to ask you to go through the +than %Ipopt, we cannot distribute their code together with +the %Ipopt packages and have to ask you to go through the hassle of obtaining it yourself. Keep in mind that it is still your responsibility to ensure that your downloading and usage of the third party components conforms with their licenses. -For a number of dependencies, COIN-OR provides specialized build systems -that produce libraries which are easy to use with the build system of \Ipopt. +For ASL, HSL, and MUMPS, COIN-OR provides specialized build systems +that produce libraries which are easy to use with the build system of %Ipopt. Some of the specialized build systems also come with a script that makes it -easy to download the code using `wget` (or `curl` on Mac OS X). If these -tools are not available on your system, please read the appropriate -`INSTALL.*` file for alternative instructions. +easy to download the code using `wget` or `curl`. \subsection EXTERNALCODE_ASL ASL (Ampl Solver Library) Note that you only need to obtain the ASL if you intend to use -\Ipopt from AMPL. It is not required if you want to specify +%Ipopt from AMPL. It is not required if you want to specify your optimization problem in a programming language (e.g., C++, C, or Fortran). @@ -170,12 +157,12 @@ To do so, execute \subsection EXTERNALCODE_LINALG BLAS and LAPACK -\Ipopt's build system tries to find an installation of BLAS and LAPACK +%Ipopt's build system tries to find an installation of BLAS and LAPACK in your system. On Ubuntu, such libraries can be made available by installing liblapack-dev. Other Linux distributions typically also offer a way to install Blas and Lapack via its package manager. -On Mac OS X, \Ipopt's build system should pick up the Blas and Lapack +On macOS, %Ipopt's build system should pick up the Blas and Lapack from the Accelerate framework. \note It is **highly recommended that you obtain an efficient @@ -183,38 +170,44 @@ implementation of the BLAS and LAPACK library**, tailored to your hardware; Section \ref PREREQUISITES lists a few options. For instance, to have configure pick up a local installation of [ATLAS](http://math-atlas.sourceforge.net) in $HOME/lib, one would use -the `--with-lapack` flag when running `configure` (see \ref COMPILEINSTALL): +the `--with-lapack-lflags` flag when running `configure` (see \ref COMPILEINSTALL): \verbatim -./configure --with-lapack="-L$HOME/lib -lf77blas -lcblas -latlas" +./configure --with-lapack-lflags="-L$HOME/lib -lf77blas -lcblas -latlas" \endverbatim The configure script already tries to find Intel MKL libraries on some systems. If that fails, e.g., because the libraries are not available -in a standard search path, then also use the `--with-lapack` flag to +in a standard search path, then also use the `--with-lapack-lflags` flag to explictly state what flags are necessary to use MKL, e.g., \verbatim -./configure --with-lapack="-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm" +./configure --with-lapack-lflags="-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm" +\endverbatim +Linking against static MKL libraries can be [difficult](https://github.com/coin-or/Ipopt/discussions/694#discussioncomment-6965380) +due to circular dependencies between libraries and libtool reordering the linker flags. +A possible workaround is to set all linker flags via a single compiler flag, e.g., +\verbatim +./configure --with-lapack-lflags="-Wl,--no-as-needed -Wl,--start-group,${MKLROOT}/lib/intel64/libmkl_intel_lp64.a,${MKLROOT}/lib/intel64/libmkl_gnu_thread.a,${MKLROOT}/lib/intel64/libmkl_core.a,--end-group -lgomp -lpthread -lm -ldl" \endverbatim \subsection DOWNLOAD_HSL HSL (Harwell Subroutines Library) -There are two versions of HSL available: +There are two versions of HSL source code for use in %Ipopt available: -- HSL Archive: contains outdated codes that are freely available for personal +- Coin-HSL Archive: contains outdated codes that are freely available for personal commercial or non-commercial usage. Note that you may not redistribute these codes in either source or binary form without purchasing a licence from the authors. This version includes MA27, MA28, and MC19. -- HSL Full: contains more modern codes that are freely available for academic - use only. This version includes the codes from the HSL Archive and +- Coin-HSL Full: contains more modern codes that are freely available for academic + use only. This version includes the codes from the Coin-HSL Archive and additionally MA57, HSL_MA77, HSL_MA86, and HSL_MA97. - \Ipopt supports the HSL Full codes from 2013 and later. + %Ipopt supports the HSL Full codes from 2013 and later. To obtain the HSL code, you can follow the following steps: 1. Go to . -2. Choose whether to download either the Archive code or the HSL Full +2. Choose whether to download either the Coin-HSL Archive code or the Coin-HSL Full code. To download, select the relevant "source" link. 3. Follow the instructions on the website, read the license, and submit @@ -226,32 +219,34 @@ To obtain the HSL code, you can follow the following steps: You may either: - Compile the HSL code via the COIN-OR Tools project - [ThirdParty-HSL](https://github.com/coin-or-tools/ThirdParty-HSL) - See the instructions below. + [ThirdParty-HSL](https://github.com/coin-or-tools/ThirdParty-HSL). + See the instructions [there](https://github.com/coin-or-tools/ThirdParty-HSL#installation-steps). - Compile the HSL code separately either before or after the - \Ipopt code and use the shared library loading + %Ipopt code and use the shared library loading mechanism. See the documentation distributed with the HSL package for information on how to do so. -To compile the HSL code via the COIN-OR Tools project -[ThirdParty-HSL](https://github.com/coin-or-tools/ThirdParty-HSL), run - - git clone https://github.com/coin-or-tools/ThirdParty-HSL.git - cd ThirdParty-HSL - -Now unpack the HSL sources archive, move and rename the resulting directory -so that it becomes `ThirdParty-HSL/coinhsl`. -Then configure, build, and install the HSL sources: - - ./configure - make - sudo make install +\attention The build system of %Ipopt currently requires that MA27 is part +of a HSL library, if a HSL library is provided. + +Next to the HSL source packages, also **prebuild libraries** of HSL are +available in the HSL_Jll.jl package (directory `override`) from +https://licences.stfc.ac.uk/product/julia-hsl. +While these libraries are intended for use with Julia, they can also be +used by %Ipopt without Julia when using the shared library loading mechanism +described \ref LINEARSOLVERLOADER "below". +The HSL libs from HSL_Jll.jl have additional dependencies. If installing +the package via Julia, the latter will automatically determine and install +the dependencies. Without Julia, one can install the dependencies manually: +[OpenBLAS32](https://github.com/JuliaBinaryWrappers/OpenBLAS32_jll.jl/releases), +[METIS](https://github.com/JuliaBinaryWrappers/METIS_jll.jl/releases), +[CompilerSupportLibraries](https://github.com/JuliaBinaryWrappers/CompilerSupportLibraries_jll.jl/releases). \note Whereas it is essential to have at least one linear solver, the package MC19 could be omitted (with the consequence that you cannot use this method for scaling the linear systems arising inside the -\Ipopt algorithm). By default, MC19 is only used to scale +%Ipopt algorithm). By default, MC19 is only used to scale the linear system when using one of the HSL solvers, but it can also be switched on for other linear solvers (which usually have internal scaling mechanisms). Further, also the package MA28 can be omitted, @@ -266,7 +261,31 @@ solvers. MA57 can be considerably faster than MA27 on some problems. codes, you can specify the directory containing the `CoinHslConfig.h` header file and the linker flags for this library with the flags `--with-hsl-cflags` and `--with-hsl-lflags` flags, respectively, -when running `configure` of \Ipopt (see \ref COMPILEINSTALL). +when running `configure` of %Ipopt (see \ref COMPILEINSTALL). +The JuliaHSL libs can not be used with `--with-hsl-lflags`, as they do +not contain the necessary header files. + +\note The linear solvers MA57, HSL_MA77, HSL_MA86, HSL_MA97 can +make use of the matrix ordering algorithms implemented in +[METIS](http://glaros.dtc.umn.edu/gkhome/metis/metis/overview). +ThirdParty-HSL will look automatically for a METIS installation in your +system and should work with both METIS 4 and METIS 5. + +\subsubsection LINEARSOLVERLOADER Providing a HSL library at runtime + +Alternatively to linking against HSL routines when %Ipopt is build, +%Ipopt can also load a shared library with MA27, MA57, HSL_MA77, HSL_MA86, +HSL_MA97, or MC19 at runtime. +This means, if you obtain one of those solvers +after you compiled %Ipopt, you don't need to recompile Ipopt to +use it. Instead, you can just place a shared library onto your system and +ensure that %Ipopt can find it at runtime. +Option \ref OPT_hsllib "hsllib" can be set to the name of the library from +which to load HSL routines if a HSL solver is selected. The name can contain +a path; otherwise, the shared library search path (e.g., `LD_LIBRARY_PATH`) +will be used. + +Prebuild HSL libraries are available from https://licences.stfc.ac.uk/product/julia-hsl (see also above). \subsection DOWNLOAD_MUMPS MUMPS Linear Solver @@ -277,8 +296,8 @@ source code. You need to have a Fortran 90 compiler (e.g., the GNU compiler gfortran) to be able to use it. The COIN-OR Tools project [ThirdParty-Mumps](https://github.com/coin-or-tools/ThirdParty-Mumps) -can be used to download the MUMPS 4.10.0 code and build a MUMPS library -that is recognized by Ipopt. +can be used to download the MUMPS code and build a MUMPS library +that is recognized by %Ipopt. To do so, execute git clone https://github.com/coin-or-tools/ThirdParty-Mumps.git @@ -288,21 +307,29 @@ To do so, execute make sudo make install -\note MUMPS will perform better with METIS, see \ref DOWNLOAD_METIS. - -\note MUMPS uses internally a fake implementation of MPI. If you are -using \Ipopt within an MPI program together with MUMPS, the -code will not run. You will have to modify the MUMPS sources so that the -MPI symbols inside the MUMPS code are renamed. - -\note Branch mumps5 of project ThirdParty-Mumps can be used to build a -a library of MUMPS 5.2.x that is usable with \Ipopt. However, initial -experiments on the CUTEst testset have shown that performance with MUMPS -5.2.x is worse than with Mumps 4.10.0 on average. - -To compile \Ipopt with a precompiled MUMPS library, you need to specify +\note MUMPS will perform better if the matrix ordering algorithms implemented +in [METIS](http://glaros.dtc.umn.edu/gkhome/metis/metis/overview) are +available on the system. + +\note The non-MPI version of MUMPS uses internally a fake implementation +of MPI, which can prevent using %Ipopt together with MUMPS within an MPI program. +You will have to either modify the MUMPS sources so that the MPI symbols +inside the MUMPS code are renamed or use a MPI-parallel version of MUMPS. +In the latter case and if a GCC compatible compiler is used, the %Ipopt +library will call `MPI_Init()` and `MPI_Finalize()` when loaded and unloaded, +respectively. To prevent this, use the configure flag `--disable-mpiinit`. +Note that the %Ipopt executable, tests, and examples will not work in this +case (if using MUMPS as linear solver). + +\note Branch `stable/2.1` of project ThirdParty-Mumps can be used to build +a library of MUMPS 4 that is usable with %Ipopt. Initial experiments on +the CUTEst testset have shown that performance with MUMPS 5.2.x is worse +than with MUMPS 4.10.0 on average, but note that MUMPS 4 is not longer +maintained. + +To compile %Ipopt with a precompiled MUMPS library, you need to specify the `-I` flag to have the compiler find the directory containing the -MUMPS header files with the `--with-mumps-cflags` flag of \Ipopt's configure, +MUMPS header files with the `--with-mumps-cflags` flag of %Ipopt's configure, e.g., \verbatim --with-mumps-cflags="-I$HOME/MUMPS/include" @@ -310,10 +337,14 @@ e.g., and you also need to provide the linker flags for MUMPS with the `--with-mumps-lflags` flag. -\subsection DOWNLOAD_PARDISO Pardiso (Parallel Sparse Direct Linear Solver) +A precompiled MUMPS library is sometimes also provided by a distributions package manager. +For example, on a Debian system, one may install package [libmumps-seq-dev](https://packages.debian.org/bullseye/libmumps-seq-dev) +and use the configure flags `--with-mumps-cflags=-I/usr/include/mumps_seq --with-mumps-lflags=-ldmumps_seq`. -If you would like to compile \Ipopt with Pardiso, you need to obtain either -Intel's MKL library or the Pardiso library from +\subsection DOWNLOAD_PARDISO Pardiso (Parallel Sparse Direct Linear Solver) from Pardiso Project + +If you would like to use %Ipopt with Pardiso from Pardiso Project, +you need to obtain the Pardiso library from for your operating system. From , you can obtain a limited time @@ -321,32 +352,93 @@ license of Pardiso for academic or evaluation purposes or buy a non-profit or commercial license. Make sure you read the license agreement before filling out the download form. -To compile \Ipopt with the linear solver Pardiso from the Pardiso project -website, you need to specify the link flags for the library with the -`--with-pardiso` flag, including required additional libraries (except -for Lapack) and flags. -For example, if you want to compile \Ipopt with the parallel version of -Pardiso (located in `$HOME/lib`) on a GNU/Linux system, you should add -the flag +To avoid conflicts with \ref DOWNLOAD_PARDISOMKL, %Ipopt only offers the +option to load Pardiso from Pardiso Project at runtime. +Therefore, the %Ipopt interface to Pardiso from Pardiso Project is always +build and the value of option \ref OPT_pardisolib "pardisolib" is used as +name (possibly including a path) for the library to be loaded. +The configure option `--with-pardiso` can be used to specify the default +value for option `pardisolib`. Further, if `--with-pardiso` is specified +and HSL codes are not available at compile time, then the default of option +\ref OPT_linear_solver "linear_solver" is set to `pardiso`. +For example, if you want that %Ipopt loads the GCC version of Pardiso +on a GNU/Linux system and this library is located in `$HOME/lib`, you +should add the flag \verbatim ---with-pardiso="$HOME/lib/libpardiso600-GNU800-X86-64.so -fopenmp -lgfortran" +--with-pardiso="$HOME/lib/libpardiso720-GNU831-X86-64.so" \endverbatim -For best performance on Linux, use Pardiso from the Pardiso project website -together with linear algebra routines from Intel MKL (see \ref EXTERNALCODE_LINALG). + +\attention With %Ipopt <= 3.13, Pardiso from Pardiso Project was linked +when %Ipopt was build and option `--with-pardiso` used to specify the +corresponding linker flags. This has been changed with %Ipopt 3.14! If you are using the parallel version of Pardiso, you need to specify the number of processors it should run on with the environment variable `OMP_NUM_THREADS`, as described in the Pardiso manual. -If you want to compile \Ipopt with the Pardiso library +\subsection DOWNLOAD_PARDISOMKL Pardiso from Intel MKL + +If you want to compile %Ipopt with the Pardiso library that is included in Intel MKL, it is sufficient to ensure that MKL is used for the linear algebra routines (Blas/Lapack), see \ref EXTERNALCODE_LINALG. +If configure finds that Pardiso is available with Lapack, option +\ref OPT_linear_solver "linear_solver" can be set to `pardisomkl` to use +Pardiso from Intel MKL. +Specifying `--disable-pardisomkl` as option for configure disables the +check for Pardiso from Intel MKL. + +\attention With %Ipopt <= 3.13, Pardiso from Intel MKL could be selected +by setting \ref OPT_linear_solver "linear_solver" to `pardiso`. With +%Ipopt 3.14, value `pardiso` is reserved for Pardiso from Pardiso Project +and value `pardisomkl` has to be used to select Pardiso from Intel MKL. + +\subsection DOWNLOAD_SPRAL SPRAL (Sparse Parallel Robust Algorithms Library) + +To compile %Ipopt with the linear solver SPRAL, +[SPRAL](https://github.com/ralna/spral) should first +be downloaded and compiled according to the associated +[SPRAL compilation guide](https://github.com/ralna/spral/blob/master/COMPILE.md). + +After compilation of SPRAL, while configuring %Ipopt, +you need to specify the link and include directories for the library with the +`--with-spral-lflags` and `--with-spral-cflags` flags, including required +additional libraries and flags. For example, if you want to compile %Ipopt with +a purely CPU-parallel version of SPRAL (libs in `/path/to/spral/lib` and headers +in `/path/to/spral/include`) on a GNU/Linux system, you should add the +following flags to the `configure` command: +\verbatim +--with-spral-lflags="-L/path/to/spral/lib -lspral -lgfortran -lhwloc -lm -lcoinmetis -lopenblas -lstdc++ -fopenmp" +--with-spral-cflags="-I/path/to/spral/include" +\endverbatim +For a CPU and graphics processing unit- (GPU-) parallel version of SPRAL, +the following flags should be used, instead: +\verbatim +--with-spral-lflags="-L/path/to/spral/lib -lspral -lgfortran -lhwloc -lm -lcoinmetis -lopenblas -lstdc++ -fopenmp -lcudadevrt -lcudart -lcuda -lcublas" +--with-spral-cflags="-I/path/to/spral/include" +\endverbatim +The above assumes a SPRAL compilation using OpenBLAS libraries. For best +performance, use SPRAL together with linear algebra routines from the Intel MKL +(see \ref EXTERNALCODE_LINALG). + +\attention +Finally, ensure the following environment variables are employed when using SPRAL: +\verbatim +export OMP_CANCELLATION=TRUE +export OMP_PROC_BIND=TRUE +export OMP_NESTED=TRUE # not necessary with Spral >= 2023.08.02 +\endverbatim + +A guide for building %Ipopt with Spral on Ubuntu Linux is also avaiable +[here](https://gist.github.com/tasseff/ee61ef6c15d3c54e0a6b3e488f2a65be) +(some GitHub URLs need to be adjusted to use coin-or/Ipopt instead of lanl-ansi/Ipopt). +More information on the Spral interface of %Ipopt can be found in \cite Tasseff2019. + \subsection DOWNLOAD_WSMP WSMP (Watson Sparse Matrix Package) -If you would like to compile \Ipopt with WSMP, you need to obtain the +If you would like to compile %Ipopt with WSMP, you need to obtain the WSMP library for your operating system. Information about WSMP can be found at . @@ -358,6 +450,10 @@ organizations; make sure you read the license agreement before using the library. Once you obtained the library and license, please check if the version number of the library matches the one on the WSMP website. +\note The license included in package of the libraries may not work and a + working one may need to be downloaded separately. Look out for messages + about an invalid WSMP license when testing the Ipopt build. + If a newer version is announced on that website, you can (and probably should) request the current version by sending a message to `wsmp@us.ibm.com`. Please include the operating system and other @@ -366,65 +462,20 @@ details to describe which particular version of WSMP you need. \note Only the interface to the shared-memory version of WSMP is currently supported. -To compile \Ipopt with the linear solver WSMP, you need to specify the +To compile %Ipopt with the linear solver WSMP, you need to specify the linker flags for the library with the `--with-wsmp` flag, including required additional libraries and flags. For example, if you want to compile -\Ipopt with WSMP (located in `$HOME/lib`) on an Intel IA32 Linux system, -you should use the `configure` flag +%Ipopt with WSMP (located in `$HOME/lib`) on an Intel IA32 Linux system, +you may use the `configure` flag \verbatim ---with-wsmp="$HOME/lib/wsmp/wsmp-Linux/lib/IA32/libwsmp.a -lpthread" +--with-wsmp="$HOME/lib/wsmp/wsmp-Linux/lib/IA32/libwsmp.a -lpthread -lblas -llapack -lpthread -lm -lgfortran" \endverbatim - -\subsection LINEARSOLVERLOADER Using the Linear Solver Loader - -By default, \Ipopt will be compiled with a mechanism, the -Linear Solver Loader, which can dynamically load shared libraries with -MA27, MA57, HSL_MA77, HSL_MA86, HSL_MA97, or the Pardiso linear -solver at runtime. - -This means, if you obtain one of those solvers -after you compiled \Ipopt, you don't need to recompile to -use it. Instead, you can just put a shared library called `libhsl.so` or -`libpardiso.so` into the shared library search path, `LD_LIBRARY_PATH`. -These are the names on most UNIX platforms, including Linux. On Mac OS X, -the names are `libhsl.dylib`, `libpardiso.dylib`, and -`DYLD_LIBRARY_PATH`. On Windows, the names are `libhsl.dll`, -`libpardiso.dll`, and `PATH`. - -The Pardiso shared library can be downloaded from the Pardiso website. -To create a shared library containing the HSL linear solvers, follow -the instructions from \ref DOWNLOAD_HSL, but rename the resulting library -to `libhsl.so`. - -If you have problems compiling this feature, you can disable this -by specifying `--disable-linear-solver-loader` for the `configure` script. - -\subsection DOWNLOAD_METIS METIS (matrix ordering) - -The linear solvers MA57, HSL_MA77, HSL_MA86, HSL_MA97, and MUMPS can -make use of the matrix ordering algorithms implemented in -[METIS](http://glaros.dtc.umn.edu/gkhome/metis/metis/overview). -If you are using one of these linear solvers, you can use the COIN-OR Tools project -[ThirdParty-Metis](https://github.com/coin-or-tools/ThirdParty-Metis) -to download the METIS code and build a METIS library that is recognized -by Ipopt. -To do so, execute - - git clone https://github.com/coin-or-tools/ThirdParty-Metis.git - cd ThirdParty-Metis - ./get.Metis - ./configure - make - sudo make install - -\attention Only the older [METIS 4.x version](http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/OLD/metis-4.0.3.tar.gz) -is supported by MA57, HSL_MA77, HSL_MA86, HSL_MA97, MUMPS 4, and the build system. -The `./get.Metis` script takes care of downloading the right METIS version. +But the actual flags depend on WSMP library and your preference for the Blas/Lapack libraries. \section GETIPOPT Getting the Ipopt Code -\Ipopt is available from the COIN-OR group at GitHub. You can either +%Ipopt is available from the COIN-OR group at GitHub. You can either download the code using `git` or simply retrieve a tarball (compressed archive file). While the tarball is an easy method to retrieve the code, using the *git* @@ -438,16 +489,16 @@ to obtain the code this way (the executable is called `git`). Information about *git* and how to download it can be found at . -To obtain the \Ipopt source code via git, change into the -directory in which you want to create a subdirectory `\Ipopt` with the -\Ipopt source code. Then follow the steps below: +To obtain the %Ipopt source code via git, change into the +directory in which you want to create a subdirectory `%Ipopt` with the +%Ipopt source code. Then follow the steps below: 1. Download the code from the repository: \verbatim git clone https://github.com/coin-or/Ipopt.git \endverbatim -2. Change into the root directory of the \Ipopt distribution: \verbatim +2. Change into the root directory of the %Ipopt distribution: \verbatim cd Ipopt \endverbatim @@ -459,7 +510,7 @@ are right now (output of `pwd`). To use the tarball, follow the steps below: 1. Download the desired tarball from - , it has the form + , it has the form `Ipopt-x.y.z.tgz`, where `x.y.z` is the version number, such as 3.12.0. @@ -473,7 +524,7 @@ tar xvf Ipopt-x.y.z.tar mv Ipopt-x.y.z Ipopt \endverbatim -4. Change into the root directory of the \Ipopt distribution: \verbatim +4. Change into the root directory of the %Ipopt distribution: \verbatim cd Ipopt \endverbatim @@ -482,21 +533,21 @@ are right now (output of `pwd`). \section COMPILEINSTALL Compiling and Installing Ipopt -\Ipopt can be easily compiled and installed with the usual +%Ipopt can be easily compiled and installed with the usual configure, make, make install commands. We follow the procedure that is used for most of the COIN-OR projects, based on the GNU autotools. -Below are the basic steps for the \Ipopt compilation that +Below are the basic steps for the %Ipopt compilation that should work on most systems. For special compilations and for some troubleshooting see \ref CONFIGURE_FLAGS before creating an issue or sending a message to the mailing list. -1. Create a directory where you want to compile \Ipopt, for example +1. Create a directory where you want to compile %Ipopt, for example \verbatim mkdir $IPOPTDIR/build \endverbatim @@ -510,7 +561,7 @@ cd $IPOPTDIR/build to keep the source and compiled files separate as this comes in handy when you want to compile the code with different compilers, compiler options, or different operating system that share a common file system. - For this to work, the directories with the \Ipopt source must not have + For this to work, the directories with the %Ipopt source must not have any configuration and compiled code. 2. Run the configure script: @@ -520,10 +571,10 @@ $IPOPTDIR/configure One might have to give options to the configure script, e.g., in order to choose a non-default compiler, or to tell it where to install - Ipopt eventually, see \ref CONFIGURE_FLAGS. + %Ipopt eventually, see \ref CONFIGURE_FLAGS. If the last output line reads - `configure: Main configuration of Ipopt successful` then + `configure: Main configuration of %Ipopt successful` then everything worked fine. Otherwise, look at the screen output, have a look at the `config.log` output file and/or consult \ref CONFIGURE_FLAGS. @@ -559,16 +610,16 @@ make test compilers we enabled default values for this, but those might not exist or be wrong for your compiler. In that case, the C and Fortran example in the test will most probably fail to compile. If you don't - want to hook up the compiled \Ipopt library to some + want to hook up the compiled %Ipopt library to some Fortran or C code that you wrote you don't need to worry about this. - If you do want to link the \Ipopt library with a C or + If you do want to link the %Ipopt library with a C or Fortran compiler, you need to find out the C++ runtime libraries (e.g., by running the C++ compiler in verbose mode for a simple example program) and run `configure` again, and this time specify all C++ runtime libraries with the `CXXLIBS` variable (see also \ref CONFIGURE_FLAGS). -5. Install \Ipopt: +5. Install %Ipopt: \verbatim sudo make install \endverbatim @@ -576,16 +627,18 @@ sudo make install `/usr/local`, where only system administrators have write permissions. This installs - - the \Ipopt and `sIpopt` AMPL solver executables (if ASL source + - the %Ipopt and `sIpopt` AMPL solver executables (if ASL source was downloaded) in `/usr/local/bin`, - - the \Ipopt and `sIpopt` libraries (`libipopt.so`, `libipopt.a` or + - the %Ipopt and `sIpopt` libraries (`libipopt.so`, `libipopt.a` or similar) in `/usr/local/lib`, - - pkg-config files for use of the \Ipopt and `sIpopt` libraries + - pkg-config files for use of the %Ipopt and `sIpopt` libraries (`ipopt.pc`, `sipopt.pc`) in `/usr/local/lib/pkgconfig`. - - \Ipopt and `sIpopt` header files `/usr/local/include/coin-or`. + - %Ipopt and `sIpopt` header files `/usr/local/include/coin-or`, + + - the \ref INTERFACE_JAVA "Java Interface" jar file in `/usr/local/share/java`. You can change the default installation directory (here `/usr/local`) by using the `--prefix` switch for `configure`. If this is a directory @@ -610,7 +663,7 @@ Below a few particular options are discussed: \endverbatim In order to set the compiler flags, you should use the variables - `CXXFLAGS`, `CFLAGS`, `FFLAGS`. Note, that the \Ipopt code + `CXXFLAGS`, `CFLAGS`, `FFLAGS`. Note, that the %Ipopt code uses `dynamic_cast`. Therefore it is necessary that the C++ code is compiled including RTTI (Run-Time Type Information). Some compilers need to be given special flags to do that (e.g., `-qrtti=dyna` for @@ -619,34 +672,40 @@ Below a few particular options are discussed: -- By default, the \Ipopt library is compiled as a shared +- By default, the %Ipopt library is compiled as a shared library, on systems where this is supported. If you want to generate a static library, you need to specify the `--disable-shared` flag. If you want to compile both shared and static libraries, you should specify the `--enable-static` flag. This is no possible on Windows. -- It is possible to compile the \Ipopt library in a debug +- It is possible to compile the %Ipopt library in a debug configuration, by specifying `--enable-debug`. This switches the default compiler flags (CFLAGS, CXXFLAGS, FFLAGS) to instruct the compiler to include debug information into object files and disables compiler optimization. - Also, you can tell \Ipopt to do some additional runtime - sanity checks, by specifying the flag `--with-ipopt-checklevel=1`. + Also, you can tell %Ipopt to do some additional runtime + sanity checks, by specifying the flag `--with-ipopt-checklevel`. This usually leads to a significant slowdown of the code, but might be helpful when debugging something. -- If you want to link the \Ipopt library with a main + The checklevel value has the following effect: + - ≥ 1 : enables asserts (DBG_ASSERT) and debug statements (DBG_DO) + - ≥ 2 : floating-point exceptions divbyzero, overflow, and invalid are signaled (SIGFPE) while %Ipopt is solving (requires GLIBC) + - ≥ 3 : checks in Ipopts caching and observer mechanisms are enabled + - ≥ 4 : checks in Ipopts SmartPtr implementation are enabled + +- If you want to link the %Ipopt library with a main program written in C or Fortran, the C and Fortran compiler doing the linking of the executable needs to be told about the C++ runtime - libraries. Unfortunately, the current version of autoconf does not - provide the automatic detection of those libraries. We have + libraries. Unfortunately, the build system does not provide a + functionality for automatic detection of those libraries. We have hard-coded some default values for some systems and compilers, but this might not work all the time. If you have problems linking your Fortran or C code with the - \Ipopt library libipopt.a and the linker complains + %Ipopt library `libipopt.a` and the linker complains about missing symbols from C++ (e.g., the standard template library), you should specify the C++ libraries with the `CXXLIBS` variable. To find out what those libraries are, it is probably @@ -666,7 +725,7 @@ Below a few particular options are discussed: (Alternatively, a simpler solution for AIX is to set the environment variable `OBJECT_MODE` to 64.) -- Ipopt's Java interface `JIpopt` uses the Java Native Interface (JNI), +- %Ipopt's Java interface `JIpopt` uses the Java Native Interface (JNI), which is a programming framework that allows Java code running in the Java Virtual Machine (JVM) to call and be called by native applications and libraries written in languages such as C and C++. @@ -685,17 +744,65 @@ Below a few particular options are discussed: by specifying the configure flag `--disable-java`. This is also the default if `JAVA_HOME` contains a space or the build of shared libraries has been disabled as `JIpopt` needs to be able to - load the \Ipopt library dynamically at runtime. + load the %Ipopt library dynamically at runtime. -- \ref SIPOPT "sIpopt" is build and installed together with Ipopt. If +- %Ipopt can load HSL or Pardiso libraries at runtime. To disable this + feature, specify `--disable-linear-solver-loader`. + +- \ref SIPOPT "sIpopt" is build and installed together with %Ipopt. If you do not need sIpopt, you can disable it via `--disable-sipopt`. -Configure flags specific to the use of \Ipopt's dependencies were discussed +Configure flags specific to the use of %Ipopt's dependencies were discussed in the corresponding sections of \ref EXTERNALCODE. +\subsection CPP_FLAGS Additional Flags for Compiler Preprocessor + +A few flags that influence which %Ipopt code is compiled are not controlled by parameters for configure. +We list some of these flags in the following. + +\note These are flags for expert users. + Usually, there should be no need to define these. + Further, we may change or remove these flags without advanced warning. + +- `IPOPT_THREAD_LOCAL`: Keyword to be used to declare a thread-local variable. + +- `IPOPT_DEPRECATED`: Keyword to be used to mark a function as deprecated. + +- `FUNNY_MA57_FINT`: If defined, then assume that `ptrdiff_t` corresponds to the integer type used by HSL MA57, e.g., 64-bit integers on 64-bit systems. + This flag was useful when using MA57 from libraries that come with Matlab. + +- `MA97_DUMP_MATRIX`: If defined, then option `ma97_dump_matrix` is available. + This requires linking against a HSL library (not loading at runtime) that includes function `dump_mat_csc`. + +- `MUMPS_DUMP_MATRIX`: If defined, then matrices are written to stdout in the MUMPS interface. + +- `IPOPT_MUMPS_NOMUTEX`: If defined, concurrent calls of %Ipopt into MUMPS from different threads are not prevented by a mutex. + +\section COINBREW Using CoinBrew + +On sufficiently prepared systems, an alternative way to download, build, +and install %Ipopt with dependencies ASL, HSL, and MUMPS is to use the +coinbrew script from https://coin-or.github.io/coinbrew/ + +After obtaining the script, run + + /path/to/coinbrew fetch Ipopt --no-prompt + /path/to/coinbrew build Ipopt --prefix=/dir/to/install --test --no-prompt --verbosity=3 + /path/to/coinbrew install Ipopt --no-prompt + +The coinbrew script will take care of building and installing the +dependencies ASL and MUMPS before building %Ipopt. +To use HSL sources, change to the `ThirdParty/HSL` directory created by +`coinbrew fetch` and follow the download instructions (i.e., skip the build step) +from \ref DOWNLOAD_HSL. Then proceed with the `coinbrew build` step. + +More details on using coinbrew can be found at the instructions on +[Getting Started with the COIN-OR Optimization Suite](https://coin-or.github.io/user_introduction). + + \section INSTALL_R Compiling and Installing the R Interface ipoptr -The `ipoptr` interface can be build after \Ipopt has been +The `ipoptr` interface can be build after %Ipopt has been build and installed. In the best case, it is sufficient to execute the following command in R: \verbatim @@ -709,4 +816,86 @@ library('ipoptr') ?ipoptr \endverbatim + +\section SINGLEPRECISION_BUILD Building for single-precision floating-point arithmetic + +%Ipopt by default uses double-precision floating point arithmetic. +Using the configure flag `--with-precision=float`, it is possible to build +a variant of %Ipopt that uses single-precision floating point arithmetic. +It is not possible to build for both single- and double-precision simultaneously. +In the single-precision configuration, the types Ipopt::Number and \ref ipnumber +are defined to be `float` and the C preprocessor variable `IPOPT_SINGLE` is defined in `IpoptConfig.h`. + +If the %Ipopt code is compiled for single-precision, then also third-party +codes that interface with or are interfaced by %Ipopt need to support this +floating point format. +Regarding included code that interfaces to %Ipopt, the situation is as follows: +- \ref INTERFACE_CPP supports single-precision arithmetic by having Ipopt::Number defined as `float`. +- \ref INTERFACE_C supports single-precision arithmetic by having \ref ipnumber defined as `float`. +- \ref INTERFACE_FORTRAN supports single-precision arithmetic by using `real` instead of `double precision`. + A single-precision variant of the HS071 example is available in `examples/hs071_f/hs071_fs.f`. +- \ref INTERFACE_JAVA supports single-precision arithmetic by using `float` instead of `double` for real numbers. + A single-precision variant of the HS071 example is available in `examples/hs071_java/HS071s.java`. + Note, that for the single-precision version of class `org.coinor.Ipopt`, all mention of `double` are replaced by `float` before compilation. +- \ref INTERFACE_AMPL "The AMPL interface" is not available when building for single-precision. +- \ref INTERFACE_R seems to work. +- Fortran and Java examples (other than HS071) and tutorials are not available for single-precision. +- \ref SIPOPT "sIpopt" is build in single-precision if %Ipopt is build in single-precision. + +Regarding dependencies of %Ipopt, the situation is as follows: +- A single-precision variant of Blas and Lapack is required. + Many implementations of Blas and Lapack include a single-precision variant. + \attention macOS vecLib single-precision routines do not work as expected by gfortran. + However, configure would still select the Accelerate framework by default and %Ipopt will try to run with faulty numbers. + You may want to try switch to Lapack from HomeBrew instead (`--with-lapack-lflags="-L/usr/local/opt/lapack/lib -llapack -lblas"`) or try out [this vecLib wrapper](https://github.com/mcg1969/vecLibFort). +- The interface to MUMPS can use a single-precision version of MUMPS. + See the [ThirdParty-Mumps docu](https://github.com/coin-or-tools/ThirdParty-Mumps/#single-precision-codes) for details. +- The interfaces to the HSL routines can use single-precision versions of these routines. + A current [ThirdParty-HSL](https://github.com/coin-or-tools/ThirdParty-HSL) can compile these when using a [Coin-HSL](http://hsl.rl.ac.uk/ipopt) 2021.05.05 package. +- The interface for Pardiso (both MKL and from pardiso-project.org) is available. + The Pardiso library contains a single-precision version of its solver. +- The interface to WSMP is not available. +- The interface to SPRAL is not available. + +When building %Ipopt for single-precision arithmetic, the default for option \ref OPT_tol "tol" is changed to 1e-5. + + +\section INT64_BUILD Building for 64-bit integers + +%Ipopt by default defines its types Ipopt::Index (C++) and \ref ipindex (C) to be `int`, which on many systems has a size of 32-bit. +This limits the size of problems to be solved to 2^31 variables, constraints, nonzero elements in matrices, etc. +Using the configure flag `--with-intsize=64`, it is possible to build a variant of %Ipopt that defines `Ipopt::Index`/\ref ipindex to be `int64_t`, i.e., an integer of size 64 bit. +Further, the C preprocessor variable `IPOPT_INT64` is defined in `IpoptConfig.h`. + +Note that using 64-bit integers increases the memory usage of %Ipopt significantly since type Ipopt::Index is used for almost all integers in %Ipopt. +It is not possible to build for both 32- and 64-bit integers simultaneously. + +If the %Ipopt code is compiled for 64-bit integers, then also third-party +codes that interface with or are interfaced by %Ipopt may need to support this +integer size. +Regarding included code that interfaces to %Ipopt, the situation is as follows: +- \ref INTERFACE_CPP supports 64-bit integers by having Ipopt::Index defined as `int64_t`. +- \ref INTERFACE_C supports 64-bit integers by having \ref ipindex defined as `int64_t`. +- \ref INTERFACE_FORTRAN supports 64-bit integers by using an 8-byte kind for `INTEGER`. +- \ref INTERFACE_JAVA does not support 64-bit integers because Java arrays can only be indexed by 32-bit integers. + However, the Java interface can be used with 32-bit integers and an %Ipopt library that is build for 64-bit integers. +- \ref INTERFACE_AMPL "The AMPL interface" allows for problem instances with more than 2^31 nonzeros in Jacobian or Hessian. + This requires that ASL has been build with `ASL_big_goff` defined (this define also need to be present in the ASL header files that the %Ipopt build includes). + If using `ThirdParty-ASL`, then this achieved by selecting configure option `--with-intsize=64`, see also the [ThirdParty-ASL docu](https://github.com/coin-or-tools/ThirdParty-ASL#jacobians-with-for-more-than-231-nonzeros). + Note that problems instances are still limited to at most 2^31 variables and constraints - this is a limitation of AMPL or ASL. +- \ref INTERFACE_R does not support 64-bit integers because R only supports 32-bit integers. + However, the R interface can still be used with an %Ipopt library that is build for 64-bit integers. +- \ref SIPOPT "sIpopt" supports 64-bit integers. + +Regarding dependencies of %Ipopt, the situation is as follows: +- A variant of Blas and Lapack that uses 64-bit integers is required. + If `--with-intsize=64` is seletected, then the check in configure by default only looks for Intel MKL and tries `-llapack64 -lblas64`, see also the [BuildTools docu](https://coin-or-tools.github.io/BuildTools/configure#check-for-lapack-with-64-bit-integers). +- The interface to MUMPS can use a version of MUMPS that has been compiled for 64-bit integers. + See the [ThirdParty-Mumps docu](https://github.com/coin-or-tools/ThirdParty-Mumps/#64-bit-integers) for details. +- The interfaces to the HSL routines are not available. +- The interface for Pardiso from pardiso-project.org is not available. +- The interface for Pardiso from Intel MKL is available if the ILP64 variant of Intel MKL is used for Blas/Lapack. +- The interface to WSMP is not available. +- The interface to SPRAL is not available. + */ diff --git a/doc/interfaces.dox b/doc/interfaces.dox index 71e684cad..17b361300 100644 --- a/doc/interfaces.dox +++ b/doc/interfaces.dox @@ -3,20 +3,20 @@ \tableofcontents -\Ipopt has been designed to be flexible for a wide variety +%Ipopt has been designed to be flexible for a wide variety of applications, and there are a number of ways to interface with -\Ipopt that allow specific data structures and linear +%Ipopt that allow specific data structures and linear solver techniques. Nevertheless, the authors have included a standard representation that should meet the needs of most users. -This tutorial will discuss six interfaces to \Ipopt, namely +This tutorial will discuss six interfaces to %Ipopt, namely the AMPL modeling language \cite FouGayKer:AMPLbook interface, and the C++, C, Fortran, Java, and R code interfaces. AMPL is a modeling language tool that allows users to write their optimization problem in a syntax that resembles the way the problem would be written mathematically. Once the problem has been formulated in AMPL, the problem can be easily solved using the (already compiled) -\Ipopt AMPL solver executable, ipopt. Interfacing your +%Ipopt AMPL solver executable, ipopt. Interfacing your problem by directly linking code requires more effort to write, but can be far more efficient for large problems. @@ -26,19 +26,19 @@ example problem, number 71 from the Hock-Schittkowsky test suite \cite HS, \min_{x \in \Re^4} &&x_1 x_4 (x_1 + x_2 + x_3) + x_3 \\ \mbox{s.t.} &&x_1 x_2 x_3 x_4 \ge 25 \\ &&x_1^2 + x_2^2 + x_3^2 + x_4^2 = 40 \\ - &&1 \leq x_1, x_2, x_3, x_4 \leq 5, + &&1 \leq x_1, x_2, x_3, x_4 \leq 5, \end{aligned} \tag{HS071} \f} with the starting point \f[ x_0 = (1, 5, 5, 1) \f] and the optimal solution \f[ x_* = (1.00000000, 4.74299963, 3.82114998, 1.37940829). \f] You can find further, less documented examples for using -\Ipopt from your own source code in the Ipopt/examples +%Ipopt from your own source code in the Ipopt/examples subdirectory. \section INTERFACE_AMPL Using Ipopt through AMPL Using the AMPL solver executable is by far the easiest way to solve a -problem with \Ipopt. The user must simply formulate the +problem with %Ipopt. The user must simply formulate the problem in AMPL syntax, and solve the problem through the AMPL environment. There are drawbacks, however. AMPL is a 3rd party package and, as such, must be appropriately licensed (a free student version for @@ -53,33 +53,33 @@ This tutorial is not intended as a guide to formulating models in AMPL. If you are not already familiar with AMPL, please consult \cite FouGayKer:AMPLbook. -The problem presented in (HS071) can be solved with \Ipopt with +The problem presented in (HS071) can be solved with %Ipopt with the following AMPL model. # tell ampl to use the ipopt executable as a solver # make sure ipopt is in the path! option solver ipopt; - # declare the variables and their bounds, + # declare the variables and their bounds, # set notation could be used, but this is straightforward - var x1 >= 1, <= 5; - var x2 >= 1, <= 5; - var x3 >= 1, <= 5; + var x1 >= 1, <= 5; + var x2 >= 1, <= 5; + var x3 >= 1, <= 5; var x4 >= 1, <= 5; # specify the objective function minimize obj: x1 * x4 * (x1 + x2 + x3) + x3; - + # specify the constraints s.t. inequality: x1 * x2 * x3 * x4 >= 25; - + equality: x1^2 + x2^2 + x3^2 +x4^2 = 40; - # specify the starting point + # specify the starting point let x1 := 1; let x2 := 5; let x3 := 5; @@ -94,8 +94,8 @@ the following AMPL model. display x3; display x4; -The line, `option solver ipopt;` tells AMPL to use \Ipopt -as the solver. The \Ipopt executable (installed in +The line, `option solver ipopt;` tells AMPL to use %Ipopt +as the solver. The %Ipopt executable (installed in \ref COMPILEINSTALL) must be in the `PATH` for AMPL to find it. The remaining lines specify the problem in AMPL format. The problem can now be solved by starting AMPL and loading the mod file: @@ -106,7 +106,7 @@ now be solved by starting AMPL and loading the mod file: . . -The problem will be solved using \Ipopt and the solution +The problem will be solved using %Ipopt and the solution will be displayed. At this point, AMPL users may wish to skip the sections about @@ -114,7 +114,7 @@ interfacing with code, but should read \ref OPTIONS and \ref OUTPUT. \subsection INTERFACE_AMPL_CL Using Ipopt from the command line -It is possible to solve AMPL problems with \Ipopt directly +It is possible to solve AMPL problems with %Ipopt directly from the command line. However, this requires a file in format `.nl` produced by ampl. If you have a model and data loaded in Ampl, you can create the corresponding `.nl` file with name, say, `myprob.nl` by using the @@ -122,12 +122,12 @@ Ampl command: write gmyprob -There is a small `.nl` file available in the \Ipopt +There is a small `.nl` file available in the %Ipopt distribution. It is located at `Ipopt/test/mytoy.nl`. We use this file in the remainder of this section. We assume that the file `mytoy.nl` is in the current directory and that the command `ipopt` is a shortcut for -running the \Ipopt binary available in the `bin` directory of the -installation of \Ipopt. +running the %Ipopt binary available in the `bin` directory of the +installation of %Ipopt. We list below commands to perform basic tasks from the Linux prompt. @@ -135,11 +135,11 @@ We list below commands to perform basic tasks from the Linux prompt. ipopt mytoy -- To see all command line options for \Ipopt, use: +- To see all command line options for %Ipopt, use: ipopt -= -- To see more detailed information on all options for \Ipopt: +- To see more detailed information on all options for %Ipopt: ipopt mytoy 'print_options_documentation yes' @@ -149,18 +149,18 @@ We list below commands to perform basic tasks from the Linux prompt. ipopt mytoy 'max_iter 2 print_level 4' If many options are to be set, they can be collected in a file `ipopt.opt` -that is automatically read by \Ipopt, if present, in the +that is automatically read by %Ipopt, if present, in the current directory, see also \ref OPTIONS. \section INTERFACE_CODE Interfacing with Ipopt through code -In order to solve a problem, \Ipopt needs more information +In order to solve a problem, %Ipopt needs more information than just the problem definition (for example, the derivative information). If you are using a modeling language like AMPL, the extra -information is provided by the modeling tool and the \Ipopt -interface. When interfacing with \Ipopt through your own +information is provided by the modeling tool and the %Ipopt +interface. When interfacing with %Ipopt through your own code, however, you must provide this additional information. The -following information is required by \Ipopt: +following information is required by %Ipopt: 1. Problem dimensions @@ -191,7 +191,7 @@ following information is required by \Ipopt: - sparsity structure of the Hessian of the Lagrangian function 5. Evaluation of Problem Functions
- Information evaluated using a given point (\f$x\f$, \f$\lambda\f$, \f$\sigma_f\f$ coming from \Ipopt) + Information evaluated using a given point (\f$x\f$, \f$\lambda\f$, \f$\sigma_f\f$ coming from %Ipopt) - Objective function, \f$f(x)\f$ @@ -209,19 +209,19 @@ following information is required by \Ipopt: The problem dimensions and bounds are straightforward and come solely from the problem definition. The initial starting point is used by the algorithm when it begins iterating to solve the problem. If -\Ipopt has difficulty converging, or if it converges to a +%Ipopt has difficulty converging, or if it converges to a locally infeasible point, adjusting the starting point may help. -Depending on the starting point, \Ipopt may also converge +Depending on the starting point, %Ipopt may also converge to different local solutions. Providing the sparsity structure of derivative matrices is a bit more -involved. \Ipopt is a nonlinear programming solver that is +involved. %Ipopt is a nonlinear programming solver that is designed for solving large-scale, sparse problems. While -\Ipopt can be customized for a variety of matrix formats, +%Ipopt can be customized for a variety of matrix formats, the triplet format is used for the standard interfaces in this tutorial. For an overview of the triplet format for sparse matrices, see \ref TRIPLET. Before solving the problem, -\Ipopt needs to know the number of nonzero elements and the +%Ipopt needs to know the number of nonzero elements and the sparsity structure (row and column indices of each of the nonzero entries) of the constraint Jacobian and the Lagrangian function Hessian. Once defined, this nonzero structure MUST remain constant for the entire @@ -229,7 +229,7 @@ optimization procedure. This means that the structure needs to include entries for any element that could ever be nonzero, not only those that are nonzero at the starting point. -As \Ipopt iterates, it will need the values for problem functions +As %Ipopt iterates, it will need the values for problem functions evaluated at particular points. Before we can begin coding the interface, however, we need to work out the details of these equations symbolically for example problem (HS071). @@ -255,7 +255,7 @@ x_2 x_3 x_4 & x_1 x_3 x_4 & x_1 x_2 x_4 & x_1 x_2 x_3 \\ We also need to determine the Hessian of the Lagrangian. (If a quasi-Newton option is chosen to approximate the second derivatives, this is not required. However, if second derivatives -can be computed, it is often worthwhile to let \Ipopt +can be computed, it is often worthwhile to let %Ipopt use them, since the algorithm is then usually more robust and converges faster. More on the quasi-Newton approximation in \ref QUASI_NEWTON.) @@ -263,8 +263,8 @@ The Lagrangian function for the NLP (HS071) is defined as \f$f(x) + g(x)^T \lambda\f$ and the Hessian of the Lagrangian function is, technically, \f$\nabla^2 f(x_k) + \sum_{i=1}^m\lambda_i\nabla^2 g_i(x_k)\f$. However, we introduce a factor (\f$\sigma_f\f$) in front of the objective -term so that \Ipopt can ask for the Hessian of the objective or the -constraints independently, if required. Thus, for \Ipopt +term so that %Ipopt can ask for the Hessian of the objective or the +constraints independently, if required. Thus, for %Ipopt the symbolic form of the Hessian of the Lagrangian is \f[ \sigma_f \nabla^2 f(x_k) + \sum_{i=1}^m\lambda_i\nabla^2 g_i(x_k) \f] and for the example problem this becomes @@ -283,7 +283,7 @@ x_4 & 0 & 0 & x_1 \\ 0 & x_3 x_4 & x_2 x_4 & x_2 x_3 \\ x_3 x_4 & 0 & x_1 x_4 & x_1 x_3 \\ x_2 x_4 & x_1 x_4 & 0 & x_1 x_2 \\ -x_2 x_3 & x_1 x_3 & x_1 x_2 & 0 +x_2 x_3 & x_1 x_3 & x_1 x_2 & 0 \end{array} \right] + @@ -306,11 +306,11 @@ Fortran. Completed versions of these examples can be found in `$IPOPTDIR/Ipopt/examples` under `hs071_cpp`, `hs071_c`, and `hs071_f`. As a user, you are responsible for coding two sections of the program -that solves a problem using \Ipopt: the main executable +that solves a problem using %Ipopt: the main executable (e.g., main) and the problem representation. Typically, you will write an executable that prepares the problem, and then passes control over to -\Ipopt through an Optimize or Solve call. In this call, you -will give \Ipopt everything that it requires to call back +%Ipopt through an Optimize or Solve call. In this call, you +will give %Ipopt everything that it requires to call back to your code whenever it needs functions evaluated (like the objective function, the Jacobian of the constraints, etc.). In each of the three sections that follow (C++, C, and Fortran), we will first discuss how to @@ -323,7 +323,7 @@ language, however, we will lead you through each step of the implementation. For the problem representation, we will create a class that inherits off of the pure virtual base class, Ipopt::TNLP. For the executable (the main function) we will make the call to -\Ipopt through the Ipopt::IpoptApplication class. +%Ipopt through the Ipopt::IpoptApplication class. In addition, we will also be using the Ipopt::SmartPtr class which implements a reference counting pointer that takes care of memory management (object deletion) for you @@ -337,7 +337,7 @@ define these classes are installed in `$PREFIX/include/coin-or`. We provide the required information by coding the HS071_NLP class, a specific implementation of the TNLP base class. In the executable, we will create an instance of the HS071_NLP class and give this class to -\Ipopt so it can evaluate the problem functions through the +%Ipopt so it can evaluate the problem functions through the Ipopt::TNLP interface. If you have any difficulty as the implementation proceeds, have a look at the completed example in the `Ipopt/examples/hs071_cpp` directory. @@ -357,7 +357,7 @@ full version of these files can be found in the It is very easy to make mistakes in the implementation of the function evaluation methods, in particular regarding the derivatives. -\Ipopt has a feature that can help you to debug the +%Ipopt has a feature that can help you to debug the derivative code, using finite differences, see \ref DERIVCHECK. Note that the return value of any bool-valued function should be true, @@ -396,7 +396,7 @@ In our example, the first constraint has a lower bound of 25 and no upper bound, so we set the lower bound of constraint to 25 and the upper bound to some number greater than 1019. The second constraint is an equality constraint and we set both bounds to 40. -\Ipopt recognizes this as an equality constraint and does +%Ipopt recognizes this as an equality constraint and does not treat it as two inequalities. \snippet hs071_nlp.cpp TNLP_get_bounds_info @@ -509,16 +509,16 @@ the problem representation. \subsubsection INTERFACE_CPP_MAIN Coding the Executable Now that we have a problem representation, the HS071_NLP class, we need -to code the main function that will call \Ipopt and ask -\Ipopt to find a solution. +to code the main function that will call %Ipopt and ask +%Ipopt to find a solution. Here, we must create an instance of our problem (HS071_NLP), create an -instance of the \Ipopt solver (Ipopt::IpoptApplication), +instance of the %Ipopt solver (Ipopt::IpoptApplication), initialize it, and ask the solver to find a solution. We always use the Ipopt::SmartPtr template class instead of raw C++ pointers when creating and -passing \Ipopt objects. To find out more information about +passing %Ipopt objects. To find out more information about smart pointers and the SmartPtr implementation used in -\Ipopt, see \ref SMARTPTR. +%Ipopt, see \ref SMARTPTR. Create the file `MyExample.cpp` in the `MyExample` directory. Include the header files `HS071_NLP.hpp` and `IpIpoptApplication.hpp`, tell the @@ -527,14 +527,14 @@ compiler to use the Ipopt namespace, and implement the main function. \snippet hs071_main.cpp MAIN The first line of code in `main()` creates an instance of HS071_NLP. We -then create an instance of the \Ipopt solver, Ipopt::IpoptApplication. +then create an instance of the %Ipopt solver, Ipopt::IpoptApplication. You could use `new` to create a new application object, but if you want to make sure that your code would also work with a Windows DLL, you need to use the factory, as done in the example above. The call to `app->Initialize(...)` will initialize that object and process the options (particularly the output related options). The -call to `app->OptimizeTNLP(...)` will run \Ipopt and try to -solve the problem. By default, \Ipopt will write its +call to `app->OptimizeTNLP(...)` will run %Ipopt and try to +solve the problem. By default, %Ipopt will write its progress to the console, and return the SolverReturn status. \subsubsection INTERFACE_CPP_COMPILE Compiling and Testing the Example @@ -568,7 +568,7 @@ and you should see output resembling the following: ****************************************************************************** This program contains Ipopt, a library for large-scale nonlinear optimization. Ipopt is released as open source code under the Eclipse Public License (EPL). - For more information visit http://projects.coin-or.org/Ipopt + For more information visit https://github.com/coin-or/Ipopt ****************************************************************************** Number of nonzeros in equality constraint Jacobian...: 4 @@ -637,9 +637,9 @@ f(x*) = 1.701402e+01 \endverbatim This completes the basic C++ tutorial, but see \ref OUTPUT for -explanation on the standard console output of \Ipopt and +explanation on the standard console output of %Ipopt and \ref OPTIONS for information about the use of options to customize the -behavior of \Ipopt. +behavior of %Ipopt. The `Ipopt/examples/ScalableProblems` directory contains other NLP problems coded in C++. @@ -660,6 +660,11 @@ callback is already available in the C and Fortran interfaces. \copydoc Ipopt::TNLP::intermediate_callback +In our example, we optionally print the current iterate and its violation +of optimality conditions to the screen. + +\snippet hs071_nlp.cpp TNLP_intermediate_callback + \ref Ipopt::TNLP::get_scaling_parameters @@ -739,7 +744,7 @@ This method is called only if the \ref QUASI_NEWTON "quasi-Newton approximation" \subsection INTERFACE_C The C Interface -The C interface for \Ipopt is declared in the header file +The C interface for %Ipopt is declared in the header file IpStdCInterface.h, which is found in `$PREFIX/include/coin-or`; while reading this section, it will be helpful to have a look at this file. @@ -772,18 +777,18 @@ Note the additional argument of type \ref UserDataPtr in the callback functions. This pointer argument is available for you to communicate information between the main program that calls \ref IpoptSolve and any of the callback functions. This pointer is simply passed unmodified by -\Ipopt among those functions. For example, you can use this +%Ipopt among those functions. For example, you can use this to pass constants that define the optimization problem and are computed before the optimization in the main C program to the callback functions. After an \ref IpoptProblem has been created, you can set algorithmic options -for \Ipopt (see \ref OPTIONS) using the functions +for %Ipopt (see \ref OPTIONS) using the functions \ref AddIpoptStrOption, \ref AddIpoptNumOption, and \ref AddIpoptIntOption. -Finally, the \Ipopt algorithm is called with \ref IpoptSolve, giving \Ipopt +Finally, the %Ipopt algorithm is called with \ref IpoptSolve, giving %Ipopt the \ref IpoptProblem, the starting point, and arrays to store the solution values (primal and dual variables), if desired. Finally, after everything is done, \ref FreeIpoptProblem should be called to release -internal memory that is still allocated inside \Ipopt. +internal memory that is still allocated inside %Ipopt. In the remainder of this section we discuss how the example problem (HS071) can be solved using the C interface. A completed version of this example @@ -818,11 +823,11 @@ the variable bounds. The problem has 2 constraints, so we set m and allocate space for the constraint bounds. The first constraint has a lower bound of 25 and no -upper bound. Here we set the upper bound to `2e19`. \Ipopt interprets any +upper bound. Here we set the upper bound to `2e19`. %Ipopt interprets any number greater than or equal to the value of option \ref OPT_nlp_upper_bound_inf "nlp_upper_bound_inf" as infinity. The default value of \ref OPT_nlp_lower_bound_inf "nlp_lower_bound_inf" and \ref OPT_nlp_upper_bound_inf "nlp_upper_bound_inf" is `-1e19` and `1e19`, -respectively, and can be changed through \Ipopt options. +respectively, and can be changed through %Ipopt options. The second constraint is an equality with right hand side 40, so we set both the upper and the lower bound to 40. @@ -837,12 +842,12 @@ to 0 to indicate C-Style, that is, start indexing at 0. We next create an instance of the \ref IpoptProblem by calling \ref CreateIpoptProblem, giving it the problem dimensions and the variable and constraint bounds. We also include the references to each of our -callback functions. \Ipopt uses these function pointers to +callback functions. %Ipopt uses these function pointers to ask for evaluation of the NLP when required. After freeing the bound arrays that are no longer required, the next three lines illustrate how to change the value of options through the -interface. \Ipopt options can also be changed by creating an +interface. %Ipopt options can also be changed by creating an `ipopt.opt` file (see \ref OPTIONS). We next allocate space for the initial point and set the values as given in the problem definition. @@ -857,10 +862,10 @@ function evaluation callbacks. We can now make the call to \ref IpoptSolve and find the solution of the problem. We pass in the \ref IpoptProblem, the starting point `x` -(\Ipopt will use this array to return the solution or final -point as well). The next 5 arguments are pointers so \Ipopt +(%Ipopt will use this array to return the solution or final +point as well). The next 5 arguments are pointers so %Ipopt can fill in values at the solution. If these pointers are set to `NULL`, -\Ipopt will ignore that entry. For example, here we do not want the +%Ipopt will ignore that entry. For example, here we do not want the constraint function values at the solution, so we set this entry to `NULL`. We do want the value of the objective, and the multipliers for the constraints and variable bounds. The last argument is a pointer @@ -869,14 +874,14 @@ will be passed on to the callback functions. The return code is an \ref ApplicationReturnStatus enumeration, see the header file ReturnCodes_inc.h which is installed along -IpStdCInterface.h in the \Ipopt include directory. +IpStdCInterface.h in the %Ipopt include directory. After the optimizer terminates, we check the status and print the solution if successful. If the solve succeeded, we resolve a slightly modified version of the problem. We use both the primal solution point and the dual multipliers -to warm-start \Ipopt for this second solve. Additionally, to improve -the warmstart, we reduce the amount by which \Ipopt pushes the starting +to warm-start %Ipopt for this second solve. Additionally, to improve +the warmstart, we reduce the amount by which %Ipopt pushes the starting point into the interior of the variable bounds by setting the options `bound_push` and `bound_frac`. If the solve was successful, we print the solution again. @@ -887,7 +892,7 @@ remaining memory and return from `main`. \subsection INTERFACE_FORTRAN The Fortran Interface The Fortran interface is essentially a wrapper of the \ref INTERFACE_C "C Interface". -The way to hook up \Ipopt in a Fortran program is very similar to how it +The way to hook up %Ipopt in a Fortran program is very similar to how it is done for the C interface, and the functions of the Fortran interface correspond one-to-one to the those of the C and C++ interface, including their arguments. You can find an implementation of the example problem @@ -902,11 +907,11 @@ The only special things to consider are: mode. All other `INTEGER`-type variables must be of the regular type. - For the call of `IPSOLVE` (which is the function that is to be called - to run \Ipopt), all arrays, including those for the + to run %Ipopt), all arrays, including those for the dual variables, must be given (in contrast to the C interface). The return value `IERR` of this function indicates the outcome of the optimization (see the include file `IpReturnCodes.inc` in the - \Ipopt include directory). + %Ipopt include directory). - The return value `IERR` of the remaining functions has to be set to zero, unless there was a problem during execution of the function @@ -933,17 +938,17 @@ This section is based on documentation by Rafael de Pelegrini Soares The Java Interface was written and contributed by Rafael de Pelegrini Soares and later updated by Tong Kewei (Beihang University). It offers an abstract base class \ref org.coinor.Ipopt "Ipopt" -with basic methods to specify an NLP, set a number of \Ipopt options, -to request \Ipopt to solve the NLP, and to retrieve a found +with basic methods to specify an NLP, set a number of %Ipopt options, +to request %Ipopt to solve the NLP, and to retrieve a found solution, if any. A HTML documentation of all available interface methods of the \ref org.coinor.Ipopt "Ipopt" class can also be generated -via javadoc by executing `make javadoc` in the \Ipopt build directory +via javadoc by executing `make javadoc` in the %Ipopt build directory (`$IPOPTDIR`). -If the \Ipopt build includes the Java interface, then a JAR file +If the %Ipopt build includes the Java interface, then a JAR file `org.coinor.ipopt.jar` containing class org.coinor.Ipopt will have been -installed in `$PREFIX/lib`. To use the Java interface, make sure that this -jar file is part of your Java classpath. +installed in `$PREFIX/share/java`. To use the Java interface, make sure +that this jar file is part of your Java classpath. A sample makefile that compiles and runs example HS071 can be found in `$IPOPTDIR/examples/hs071_java`. @@ -971,6 +976,15 @@ very similar to the C++ interface: \snippet HS071.java eval +For this example, we override the callback that is called by %Ipopt in +every iteration and can be used to indicate to %Ipopt whether to stop +prematurely. We use this callback to print the current iterate and its +violations of primal and dual feasibility (obtained via +\ref org.coinor.Ipopt::get_curr_iterate "get_curr_iterate()" and +\ref org.coinor.Ipopt::get_curr_violations "get_curr_violations()", resp.): + +\snippet HS071.java intermediate_callback + Finally, we add a main routine to run this example. The main routines creates an instance of our class, calls the solve method \ref org.coinor.Ipopt::OptimizeNLP "OptimizeNLP", and prints the solution. @@ -978,7 +992,7 @@ creates an instance of our class, calls the solve method \snippet HS071.java main The \ref org.coinor.Ipopt::OptimizeNLP "OptimizeNLP" method returns the -\Ipopt solve status as integer, which indicates whether the problem was +%Ipopt solve status as integer, which indicates whether the problem was solved successfully. Further, the methods \ref org.coinor.Ipopt::getObjectiveValue() "getObjectiveValue()", \ref org.coinor.Ipopt::getVariableValues() "getVariableValues()", @@ -994,24 +1008,24 @@ This section is based on documentation by Jelmer Ypma (University College London). The `ipoptr` package (see also \ref INSTALL_R) offers a R function -`ipoptr` which takes an NLP specification, a starting point, and \Ipopt -options as input and returns information about an \Ipopt run +`ipoptr` which takes an NLP specification, a starting point, and %Ipopt +options as input and returns information about an %Ipopt run (status, message, ...) and a solution point. In the following, we discuss necessary steps to implement example (HS071) with `ipoptr`. A more detailed documentation of `ipoptr` is -available in [contrib/RInterface/inst/doc/ipoptr.pdf](https://github.com/coin-or/Ipopt/raw/master/contrib/RInterface/inst/doc/ipoptr.pdf). +available in [contrib/RInterface/inst/doc/ipoptr.pdf](https://github.com/coin-or/Ipopt/raw/stable/3.14/contrib/RInterface/inst/doc/ipoptr.pdf). First, we define the objective function and its gradient \code{.unparsed} -> eval_f <- function( x ) { - return( x[1]*x[4]*(x[1] + x[2] + x[3]) + x[3] ) +> eval_f <- function( x ) { + return( x[1]*x[4]*(x[1] + x[2] + x[3]) + x[3] ) } > eval_grad_f <- function( x ) { return( c( x[1] * x[4] + x[4] * (x[1] + x[2] + x[3]), x[1] * x[4], x[1] * x[4] + 1.0, - x[1] * (x[1] + x[2] + x[3]) ) ) + x[1] * (x[1] + x[2] + x[3]) ) ) } \endcode @@ -1048,7 +1062,7 @@ function and of the constraints at the same time, although you could write a function to calculate them both separately and then return the combined result in `eval_h`. \code{.unparsed} -> # The Hessian for this problem is actually dense, +> # The Hessian for this problem is actually dense, > # This is a symmetric matrix, fill the lower left triangle only. > eval_h_structure <- list( c(1), c(1,2), c(1,2,3), c(1,2,3,4) ) > eval_h <- function( x, obj_factor, hessian_lambda ) { @@ -1057,32 +1071,32 @@ combined result in `eval_h`. values[2] = obj_factor * (x[4]) # 2,1 values[3] = 0 # 2,2 - + values[4] = obj_factor * (x[4]) # 3,1 values[5] = 0 # 4,2 values[6] = 0 # 3,3 - + values[7] = obj_factor * (2*x[1] + x[2] + x[3]) # 4,1 values[8] = obj_factor * (x[1]) # 4,2 values[9] = obj_factor * (x[1]) # 4,3 values[10] = 0 # 4,4 - + # add the portion for the first constraint values[2] = values[2] + hessian_lambda[1] * (x[3] * x[4]) # 2,1 - + values[4] = values[4] + hessian_lambda[1] * (x[2] * x[4]) # 3,1 values[5] = values[5] + hessian_lambda[1] * (x[1] * x[4]) # 3,2 - + values[7] = values[7] + hessian_lambda[1] * (x[2] * x[3]) # 4,1 values[8] = values[8] + hessian_lambda[1] * (x[1] * x[3]) # 4,2 values[9] = values[9] + hessian_lambda[1] * (x[1] * x[2]) # 4,3 - + # add the portion for the second constraint values[1] = values[1] + hessian_lambda[2] * 2 # 1,1 values[3] = values[3] + hessian_lambda[2] * 2 # 2,2 values[6] = values[6] + hessian_lambda[2] * 2 # 3,3 values[10] = values[10] + hessian_lambda[2] * 2 # 4,4 - + return ( values ) } \endcode @@ -1091,7 +1105,7 @@ After the hard part is done, we only have to define the initial values, the lower and upper bounds of the control variables, and the lower and upper bounds of the constraints. If a variable or a constraint does not have lower or upper bounds, the values `-Inf` or `Inf` can be used. If -the upper and lower bounds of a constraint are equal, \Ipopt recognizes +the upper and lower bounds of a constraint are equal, %Ipopt recognizes this as an equality constraint and acts accordingly. \code{.unparsed} > # initial values @@ -1104,22 +1118,22 @@ this as an equality constraint and acts accordingly. > constraint_ub <- c( Inf, 40 ) \endcode -Finally, we can call \Ipopt with the `ipoptr` function. In -order to redirect the \Ipopt output into a file, we use -\Ipopt's and options. +Finally, we can call %Ipopt with the `ipoptr` function. In +order to redirect the %Ipopt output into a file, we use +%Ipopt's and options. \code{.unparsed} > opts <- list("print_level" = 0, "file_print_level" = 12, "output_file" = "hs071_nlp.out") -> print( ipoptr( x0 = x0, - eval_f = eval_f, - eval_grad_f = eval_grad_f, - lb = lb, - ub = ub, - eval_g = eval_g, - eval_jac_g = eval_jac_g, - constraint_lb = constraint_lb, - constraint_ub = constraint_ub, +> print( ipoptr( x0 = x0, + eval_f = eval_f, + eval_grad_f = eval_grad_f, + lb = lb, + ub = ub, + eval_g = eval_g, + eval_jac_g = eval_jac_g, + constraint_lb = constraint_lb, + constraint_ub = constraint_ub, eval_jac_g_structure = eval_jac_g_structure, eval_h = eval_h, eval_h_structure = eval_h_structure, @@ -1127,18 +1141,18 @@ order to redirect the \Ipopt output into a file, we use Call: -ipoptr(x0 = x0, eval_f = eval_f, eval_grad_f = eval_grad_f, lb = lb, +ipoptr(x0 = x0, eval_f = eval_f, eval_grad_f = eval_grad_f, lb = lb, ub = ub, eval_g = eval_g, eval_jac_g = eval_jac_g, eval_jac_g_structure = eval_jac_g_structure, constraint_lb = constraint_lb, constraint_ub = constraint_ub, eval_h = eval_h, eval_h_structure = eval_h_structure, opts = opts) -Ipopt solver status: 0 ( SUCCESS: Algorithm terminated -successfully at a locally optimal point, satisfying the +Ipopt solver status: 0 ( SUCCESS: Algorithm terminated +successfully at a locally optimal point, satisfying the convergence tolerances (can be specified by options). ) -Number of Iterations....: 8 -Optimal value of objective function: 17.0140171451792 +Number of Iterations....: 8 +Optimal value of objective function: 17.0140171451792 Optimal value of controls: 1 4.743 3.82115 1.379408 \endcode @@ -1156,11 +1170,11 @@ First, we define the objective function and its gradient using, assuming that there is some variable `params` that contains the values of the parameters. \code{.unparsed} -> eval_f_ex1 <- function(x, params) { - return( params[1]*x^2 + params[2]*x + params[3] ) +> eval_f_ex1 <- function(x, params) { + return( params[1]*x^2 + params[2]*x + params[3] ) } -> eval_grad_f_ex1 <- function(x, params) { - return( 2*params[1]*x + params[2] ) +> eval_grad_f_ex1 <- function(x, params) { + return( 2*params[1]*x + params[2] ) } \endcode Note, that the first parameter should always be the control variable. @@ -1173,35 +1187,35 @@ case \f$a_1=1\f$, \f$a_2=2\f$, and \f$a_3=3\f$, from initial value \f$x_0=0\f$, with the following command \code{.unparsed} > # solve using ipoptr with additional parameters -> ipoptr(x0 = 0, - eval_f = eval_f_ex1, +> ipoptr(x0 = 0, + eval_f = eval_f_ex1, eval_grad_f = eval_grad_f_ex1, opts = list("print_level"=0), params = c(1,2,3) ) - + Call: -ipoptr(x0 = 0, eval_f = eval_f_ex1, eval_grad_f = eval_grad_f_ex1, +ipoptr(x0 = 0, eval_f = eval_f_ex1, eval_grad_f = eval_grad_f_ex1, opts = list(print_level = 0), params = c(1, 2, 3)) -Ipopt solver status: 0 ( SUCCESS: Algorithm terminated -successfully at a locally optimal point, satisfying the +Ipopt solver status: 0 ( SUCCESS: Algorithm terminated +successfully at a locally optimal point, satisfying the convergence tolerances (can be specified by options). ) -Number of Iterations....: 1 -Optimal value of objective function: 2 +Number of Iterations....: 1 +Optimal value of objective function: 2 Optimal value of controls: -1 \endcode For the second method, we don't have to supply the parameters as additional arguments to the function. \code{.unparsed} -> eval_f_ex2 <- function(x) { - return( params[1]*x^2 + params[2]*x + params[3] ) +> eval_f_ex2 <- function(x) { + return( params[1]*x^2 + params[2]*x + params[3] ) } -> eval_grad_f_ex2 <- function(x) { - return( 2*params[1]*x + params[2] ) +> eval_grad_f_ex2 <- function(x) { + return( 2*params[1]*x + params[2] ) } \endcode @@ -1217,24 +1231,24 @@ take care of evaluating the functions in the correct environment, so that the auxiliary data is available. \code{.unparsed} > # pass the environment that should be used to evaluate functions to ipoptr -> ipoptr(x0 = 0, - eval_f = eval_f_ex2, - eval_grad_f = eval_grad_f_ex2, +> ipoptr(x0 = 0, + eval_f = eval_f_ex2, + eval_grad_f = eval_grad_f_ex2, ipoptr_environment = auxdata, opts = list("print_level"=0) ) - + Call: -ipoptr(x0 = 0, eval_f = eval_f_ex2, eval_grad_f = eval_grad_f_ex2, +ipoptr(x0 = 0, eval_f = eval_f_ex2, eval_grad_f = eval_grad_f_ex2, opts = list(print_level = 0), ipoptr_environment = auxdata) -Ipopt solver status: 0 ( SUCCESS: Algorithm terminated -successfully at a locally optimal point, satisfying the +Ipopt solver status: 0 ( SUCCESS: Algorithm terminated +successfully at a locally optimal point, satisfying the convergence tolerances (can be specified by options). ) -Number of Iterations....: 1 -Optimal value of objective function: 2 +Number of Iterations....: 1 +Optimal value of objective function: 2 Optimal value of controls: -1 \endcode diff --git a/doc/ipopt.bib b/doc/ipopt.bib index 31aeb83aa..3f44de62f 100644 --- a/doc/ipopt.bib +++ b/doc/ipopt.bib @@ -75,7 +75,7 @@ @PhdThesis{WaechterPhD school = {Carnegie Mellon University, Pittsburgh, PA, USA}, year = {2002}, month = {January}, -url = {http://researcher.watson.ibm.com/researcher/files/us-andreasw/thesis.pdf} +url = {https://users.iems.northwestern.edu/~andreasw/pubs/waechter_thesis.pdf} } @InCollection{Waechter90Minutes, @@ -144,11 +144,20 @@ @Article{ChiangZavala2014 } @Book{Fiacco1983, -editor = "Anthony V. Fiacco", +editor = "A.V. Fiacco", title = "Introduction to Sensitivity and Stability Analysis in Nonlinear Programming", volume = 165, series = "Mathematics in Science and Engineering", year = 1983 } +@TechReport{Tasseff2019, + title={Exploring Benefits of Linear Solver Parallelism on Modern Nonlinear Optimization Applications}, + author={B. Tasseff and C. Coffrin and A. Wächter and C. Laird}, + year={2019}, + url={https://arxiv.org/abs/1909.08104}, + number={1909.08104}, + type={arXiv} +} + \end{thebibliography} diff --git a/doc/layout.xml b/doc/layout.xml index 0283d590e..28bb70a6a 100644 --- a/doc/layout.xml +++ b/doc/layout.xml @@ -1,5 +1,5 @@ - + @@ -8,17 +8,31 @@ + + + + + - + + + + + + + + + + - + @@ -87,8 +101,13 @@ + + + + + @@ -98,6 +117,8 @@ + + @@ -113,11 +134,16 @@ + + + + + @@ -128,6 +154,8 @@ + + @@ -147,6 +175,8 @@ + + @@ -166,6 +196,8 @@ + + diff --git a/doc/main.dox b/doc/main.dox index b95bafc95..923f7957d 100644 --- a/doc/main.dox +++ b/doc/main.dox @@ -1,10 +1,10 @@ /** \mainpage Documentation -This document is a guide to using \Ipopt. It includes -instructions on how to obtain and compile \Ipopt, a description of +This document is a guide to using %Ipopt. It includes +instructions on how to obtain and compile %Ipopt, a description of the interface, user options, etc., as well as a tutorial on how to -solve a nonlinear optimization problem with \Ipopt. +solve a nonlinear optimization problem with %Ipopt. The documentation consists of the following pages: - \ref Overview @@ -15,17 +15,17 @@ The documentation consists of the following pages: - \subpage OUTPUT - \subpage IMPL - \subpage FAQ -- \subpage CHANGELOG +- \subpage md_ChangeLog - \subpage AUTHORS - \subpage LICENSE -The \Ipopt project website is . +The %Ipopt project website is . \tableofcontents \section Overview -\Ipopt (Interior Point Optimizer, pronounced "Eye-Pea-Opt") is +%Ipopt (Interior Point Optimizer, pronounced "Eye-Pea-Opt") is an open source software package for large-scale nonlinear optimization. It can be used to solve general nonlinear programming problems of the form \anchor NLP @@ -36,20 +36,21 @@ form \anchor NLP \f} where \f$x \in \mathbb{R}^n\f$ are the optimization variables (possibly with lower and upper bounds, \f$x^L\in(\mathbb{R}\cup\{-\infty\})^n\f$ and -\f$x^U\in(\mathbb{R}\cup\{+\infty\})^n\f$), +\f$x^U\in(\mathbb{R}\cup\{+\infty\})^n\f$) with \f$x^L \leq x^U\f$, \f$f:\mathbb{R}^n \to \mathbb{R}\f$ is the objective function, and \f$g:\mathbb{R}^n \to \mathbb{R}^m\f$ are the general nonlinear constraints. The functions \f$f(x)\f$ and \f$g(x)\f$ can be linear or nonlinear and convex or non-convex (but should be twice continuously -differentiable). The constraints, \f$g(x)\f$, have lower and upper bounds, +differentiable). The constraint functions, \f$g(x)\f$, have lower and upper bounds, \f$g^L\in(\mathbb{R}\cup\{-\infty\})^m\f$ and -\f$g^U\in(\mathbb{R}\cup\{+\infty\})^m\f$. Note that equality constraints of +\f$g^U\in(\mathbb{R}\cup\{+\infty\})^m\f$ with \f$g^L \leq g^U\f$. +Note that equality constraints of the form \f$g_i(x)=\bar g_i\f$ can be specified by setting \f$g^L_{i}=g^U_{i}=\bar g_i\f$. \subsection MATHBACKGROUND Mathematical Background -\Ipopt implements an interior point line search filter +%Ipopt implements an interior point line search filter method that aims to find a local solution of \ref NLP "(NLP)". The mathematical details of the algorithm can be found in several publications \cite NocWaeWal:adaptive, @@ -60,32 +61,32 @@ be found in several publications \subsection AVAILABILITY Availability -The \Ipopt package is available from [COIN-OR](http://www.coin-or.org) +The %Ipopt package is available from [COIN-OR](http://www.coin-or.org) under the EPL (Eclipse Public License) open-source license and includes the source code for -\Ipopt. This means, it is available free of charge, also +%Ipopt. This means, it is available free of charge, also for commercial purposes. However, if you give away software including -\Ipopt code (in source code or binary form) and you made -changes to the \Ipopt source code, you are required to make +%Ipopt code (in source code or binary form) and you made +changes to the %Ipopt source code, you are required to make those changes public and to clearly indicate which modifications you made. After all, the goal of open source software is the continuous development and improvement of software. For details, please refer to -the [Eclipse Public License](https://opensource.org/licenses/EPL-1.0). +the [Eclipse Public License](https://opensource.org/licenses/EPL-2.0). -Also, if you are using \Ipopt to obtain results for a +Also, if you are using %Ipopt to obtain results for a publication, we politely ask you to point out in your paper that you -used \Ipopt, and to cite the publication \cite WaecBieg06:mp. +used %Ipopt, and to cite the publication \cite WaecBieg06:mp. Writing high-quality numerical software takes a lot of time and effort, and does usually not translate into a large number of publications, therefore we believe this request is only fair :). -We also have space in the [\Ipopt wiki](https://github.com/coin-or/Ipopt/wiki) -where we list publications, -projects, etc., in which \Ipopt has been used. We would be +We also have space in the [%Ipopt usage stories and papers](https://github.com/coin-or/Ipopt/discussions/497) +discussion where we list publications, +projects, etc., in which %Ipopt has been used. We would be very happy to hear about your experiences. \subsection PREREQUISITES Prerequisites -In order to build \Ipopt, some third party components are +In order to build %Ipopt, some third party components are required: - BLAS (Basic Linear Algebra Subroutines) and LAPACK (Linear Algebra PACKage). @@ -98,28 +99,30 @@ required: Examples for efficient BLAS implementations are: - - From hardware vendors: + - Generic: - - ACML (AMD Core Math Library) by AMD + - [OpenBLAS](https://github.com/xianyi/OpenBLAS), BSD license - - ESSL (Engineering Scientific Subroutine Library) by IBM + - [BLIS](https://github.com/flame/blis) (BLAS-like Library Instantiation Software Framework), BSD license - - MKL (Math Kernel Library) by Intel + - [ATLAS](http://math-atlas.sourceforge.net/) (Automatically Tuned Linear Algebra Software), BSD license - - Sun Performance Library by Sun + - From hardware vendors: - - Generic: + - [Accelerate](https://developer.apple.com/documentation/accelerate) Framework by Apple - - Atlas (Automatically Tuned Linear Algebra Software) + - [BLIS fork](https://github.com/amd/blis) (BLAS-like Library Instantiation Software Framework) by AMD - - GotoBLAS + - [ESSL](https://www.ibm.com/docs/en/essl) (Engineering Scientific Subroutine Library) by IBM - You find more information on the web. + - [MKL](https://software.intel.com/content/www/us/en/develop/tools/math-kernel-library.html) (Math Kernel Library) by Intel - Note: BLAS libraries distributed with Linux are often not - optimized. + - [Sun Performance Library](https://docs.oracle.com/cd/E18659_01/html/821-2763/gjgis.html) by Sun -- A sparse symmetric indefinite linear solver. \Ipopt + Note: BLAS libraries distributed with Linux were often not optimized in the past. + Nowadays, OpenBLAS is often found in Linux distributions, but you should check. + +- A sparse symmetric indefinite linear solver. %Ipopt needs to obtain the solution of sparse, symmetric, indefinite linear systems, and for this it relies on third-party code. @@ -141,56 +144,57 @@ required: or Intel MKL. Note that current versions from Pardiso Project typically offer much better performance than the one from Intel MKL. + - [SPRAL](https://github.com/ralna/spral) (Sparse Parallel Robust Algorithms Library) + - [WSMP](http://researcher.ibm.com/view_project.php?id=1426) (Watson Sparse Matrix Package) You must include at least one of the linear solvers above in order - to run \Ipopt, and if you want to be able to switch - easily between different alternatives, you can compile - \Ipopt with all of them. - - The \Ipopt library also has mechanisms to load the - linear solvers MA27, MA57, HSL_MA77, HSL_MA86, HSL_MA97, and - Pardiso from a shared library at runtime, if the library has not - been compiled with them, see \ref LINEARSOLVERLOADER. + to run %Ipopt, and if you want to be able to switch easily between + different alternatives, you can compile %Ipopt with interfaces to all of them. + The linear solvers from HSL and Pardiso Project can also be loaded + from a shared library at runtime, see \ref LINEARSOLVERLOADER and + \ref DOWNLOAD_PARDISO "Pardiso from Pardiso Project". + For the latter, this is also the only option. \note The solution of the linear systems is a central ingredient - in \Ipopt and the optimizer's performance and + in %Ipopt and the optimizer's performance and robustness depends on your choice. The best choice depends on your - application, and it makes sense to try different options. Most of + application, and it makes sense to try different options, but solvers + from HSL or Pardiso Project are often a good choice. Most of the solvers also rely on efficient BLAS code (see above), so you should use a good BLAS library tailored to your system. Please keep this in mind, particularly when you are comparing - \Ipopt with other optimization codes. + %Ipopt with other optimization codes. + See also \cite Tasseff2019 for a comparison of Ipopt with various linear solvers. - If you are compiling MA57, HSL_MA77, HSL_MA86, HSL_MA97, or MUMPS - within the \Ipopt build system, you should also include + If you are compiling MA57, HSL_MA77, HSL_MA86, HSL_MA97, MUMPS, + or SPRAL within the %Ipopt build system, you should also include the METIS linear system ordering package. Interfaces to other linear solvers might be added in the future; if you are interested in contributing such an interface please contact - us! Note that \Ipopt requires that the linear solver is + us! Note that %Ipopt requires that the linear solver is able to provide the inertia (number of positive and negative eigenvalues) of the symmetric matrix that is factorized. -- Furthermore, \Ipopt can also use the HSL package MC19 +- Furthermore, %Ipopt can also use the HSL package MC19 for scaling of the linear systems before they are passed to the linear solver. This may be particularly useful if - \Ipopt is used with MA27 or MA57. However, it is not - required to have MC19 to compile \Ipopt; if this - routine is missing, the scaling is never performed. + %Ipopt is used with MA27 or MA57. However, it is not + required to have MC19; if this routine is missing, scaling is not performed. - ASL (AMPL Solver Library). The source code is available at http://www.netlib.org, and COIN-OR's [ThirdParty-ASL project](https://github.com/coin-or-tools/ThirdParty-ASL) - can be used to build a library that is recognized by \Ipopt's build system. + can be used to build a library that is recognized by %Ipopt's build system. NOTE: This is only required if you want to use - \Ipopt from AMPL and want to compile the \Ipopt AMPL solver executable. + %Ipopt from AMPL and want to compile the %Ipopt AMPL solver executable. For more information on third-party components and how to obtain them, see \ref EXTERNALCODE. -Since the \Ipopt code is written in C++, you will need a -C++ compiler to build the \Ipopt library. We tried very +Since the %Ipopt code is written in C++, you will need a +C++ compiler to build the %Ipopt library. We tried very hard to write the code as platform and compiler independent as possible. In addition, the configuration script also searches for a Fortran @@ -205,69 +209,80 @@ should be avoided. \subsection HOWTOUSE How to use Ipopt -If desired, the \Ipopt distribution generates an executable +If desired, the %Ipopt distribution generates an executable for the modeling environment AMPL. As well, you can link your problem -statement with \Ipopt using interfaces for C++, C, Java, or -Fortran. \Ipopt can be used with most Linux/Unix +statement with %Ipopt using interfaces for C++, C, Java, or +Fortran. %Ipopt can be used with most Linux/Unix environments, and on Windows using Msys2/MinGW. In \ref INTERFACES this document demonstrates how to -solve problems using \Ipopt. This includes installation and -compilation of \Ipopt for use with AMPL as well as linking +solve problems using %Ipopt. This includes installation and +compilation of %Ipopt for use with AMPL as well as linking with your own code. +An installation of the AMPL link to %Ipopt is also available on +[NEOS](https://neos-server.org/neos/solvers/nco:Ipopt/AMPL.html). -Additionally, the \Ipopt distribution includes an interface +Additionally, the %Ipopt distribution includes an interface for the R project for statistical computing, see \ref INTERFACE_R. -There is also software that facilitates use of \Ipopt +There is also software that facilitates use of %Ipopt maintained by other people, among them are: -- [ADOL-C](https://projects.coin-or.org/ADOL-C) (automatic differentiation) +- [ADOL-C](https://github.com/coin-or/ADOL-C) (automatic differentiation) ADOL-C facilitates the evaluation of first and higher derivatives of vector functions that are defined by computer programs written in C - or C++. It comes with [examples](https://projects.coin-or.org/ADOL-C/browser/stable/2.4/ADOL-C/examples/additional_examples/ipopt) - that show how to use it in connection with \Ipopt. + or C++. It comes with [examples](https://github.com/coin-or/ADOL-C/tree/master/ADOL-C/examples/additional_examples/ipopt) + that show how to use it in connection with %Ipopt. - AIMMS (modeling environment) - The [AIMMSlinks project](https://projects.coin-or.org/AIMMSlinks) on + The [AIMMSlinks project](https://github.com/coin-or/AIMMSlinks) on COIN-OR, maintained by Marcel Hunting, provides an interface for - \Ipopt within the AIMMS modeling tool. + %Ipopt within the AIMMS modeling tool. - [APMonitor](http://apmonitor.com) - MATLAB, Python, and Web Interface to \Ipopt for Android, Linux, Mac OS X, + MATLAB, Python, and Web Interface to %Ipopt for Android, Linux, macOS, and Windows. - [CasADi](http://casadi.org) CasADi is a symbolic framework for automatic differentiation and - numeric optimization and comes with \Ipopt. + numeric optimization and comes with %Ipopt. -- [CppAD](https://projects.coin-or.org/CppAD) (automatic differentiation) +- [CppAD](https://github.com/coin-or/CppAD) (automatic differentiation) Given a C++ algorithm that computes function values, CppAD generates an algorithm that computes corresponding derivative values (of arbitrary order using either forward or reverse mode). It comes with - an [example](http://www.coin-or.org/CppAD/Doc/ipopt_solve.htm) that - shows how to use it in connection with \Ipopt. + an [example](https://coin-or.github.io/CppAD/doc/ipopt_solve.htm) that + shows how to use it in connection with %Ipopt. + + It is also possible to use Ipopt via [CppADs Python interface](https://bradbell.github.io/cppad_py/doc/xsrst/cppad_py.html). + An example is available [here](https://bradbell.github.io/cppad_py/doc/xsrst/mixed_optimize_fixed_2_py.html). - [csipopt](https://github.com/cureos/csipopt) Interfacing Ipopt from .NET languages such as **C#**, **F#** and **Visual Basic.NET**. +- [cyipopt](https://github.com/mechmotum/cyipopt) + + A **Python** wrapper around %Ipopt with a SciPy-style interface. + - GAMS (modeling environment) - The [GAMSlinks project](https://projects.coin-or.org/GAMSlinks) on - COIN-OR includes a GAMS interface for \Ipopt. + The [GAMSlinks project](https://github.com/coin-or/GAMSlinks) on + COIN-OR includes a GAMS interface for %Ipopt. + + An installation of GAMS with %Ipopt is also available on [NEOS](https://neos-server.org/neos/solvers/nco:Ipopt/GAMS.html). - [ifopt](https://github.com/ethz-adrl/ifopt) - Modern, light-weight (~1k loc), **Eigen**-based C++ interface to \Ipopt and Snopt. + Modern, light-weight (~1k loc), **Eigen**-based C++ interface to %Ipopt and Snopt. -- [IPyOpt](https://github.com/g-braeunlich/IPyOpt) +- [IPyOpt](https://gitlab.com/g-braeunlich/ipyopt) - Interfacing \Ipopt from **Python**. + Interfacing %Ipopt from **Python**. - [JuliaOpt](http://juliaopt.org) @@ -275,7 +290,7 @@ maintained by other people, among them are: for technical computing. JuliaOpt, is an umbrella group for Julia-based optimization-related projects. It includes the algebraic modeling language [JuMP](https://github.com/JuliaOpt/JuMP.jl) - and an [interface to \Ipopt](https://github.com/JuliaOpt/Ipopt.jl). + and an [interface to %Ipopt](https://github.com/JuliaOpt/Ipopt.jl). - [MADOPT](https://github.com/stanle/madopt) (Modelling and Automatic Differentiation for Optimisation) @@ -285,99 +300,86 @@ maintained by other people, among them are: - [mexIPOPT](https://github.com/ebertolazzi/mexIPOPT) - Matlab (mex) interface to you use \Ipopt from Matlab. + Matlab (mex) interface to you use %Ipopt from Matlab. - [OPTimization Interface (OPTI) Toolbox](http://www.i2c2.aut.ac.nz/Wiki/OPTI/) OPTI is a free **Matlab** toolbox for constructing and solving linear, nonlinear, continuous and discrete optimization problem and comes - with \Ipopt, including binaries. + with %Ipopt, including binaries. -- [Optimization Services](https://projects.coin-or.org/OS) +- [Optimization Services](https://github.com/coin-or/OS) The Optimization Services (OS) project provides a set of standards for representing optimization instances, results, solver options, - and communication between clients and solvers, including \Ipopt, in a + and communication between clients and solvers, including %Ipopt, in a distributed environment using Web Services. -- [PyIpopt](https://github.com/g-braeunlich/IPyOpt) - - An interface to the **Python** language. +- [Scilab](https://www.scilab.org/) (free Matlab-like environment): -- Scilab (free Matlab-like environment): - - A Scilab interface is available at http://forge.scilab.org/index.php/p/sci-ipopt. + A Scilab interface is available at https://atoms.scilab.org/toolboxes/sci_ipopt. \subsection MOREINFO More Information and Contributions -An issue tracking system and a wiki can be found at the \Ipopt -homepage, +An issue tracking and discussion system can be found at the %Ipopt homepage, https://github.com/coin-or/Ipopt. -\Ipopt is an open source project, and we encourage people +%Ipopt is an open source project, and we encourage people to contribute code (such as interfaces to appropriate linear solvers, modeling environments, or even algorithmic features). If you are interested in contributing code, please have a look at the [COIN-OR contributions webpage](http://www.coin-or.org/contributions.html) -and contact the \Ipopt project leader. +and contact the %Ipopt project leader. -There is also a mailing list for \Ipopt, available from the -webpage +There also has been a mailing list for %Ipopt. Its archive (2002-2020) is +available from the webpage -, +. -where you can subscribe to get notified of updates, to ask general -questions regarding installation and usage, or to share your experience -with \Ipopt. You might want to look at the archives before -posting a question. An easy way to search the archive with Google is to +An easy way to search the archive with Google is to specify `site:http://list.coin-or.org/pipermail/ipopt` in addition to your keywords in the search string. -We try to answer questions posted to the mailing list in a reasonable -manner. Please understand that we cannot answer all questions in detail, -and because of time constraints, we are not able to help you model and -debug your particular optimization problem. - -A short tutorial on getting started with \Ipopt is also +A short tutorial on getting started with %Ipopt is also available \cite Waechter90Minutes. \subsection HISTORY_IPOPT History of Ipopt -The original \Ipopt(Fortran version) was a product of the +The original %Ipopt(Fortran version) was a product of the dissertation research of Andreas Wächter \cite WaechterPhD, under the supervision of Lorenz T. Biegler at the Chemical Engineering Department at Carnegie Mellon University. The code was made open source and distributed by the COIN-OR initiative, which is now a non-profit -corporation. \Ipopt has been actively developed under +corporation. %Ipopt has been actively developed under COIN-OR since 2002. To continue natural extension of the code and allow easy addition of new features, IBM Research decided to invest in an open source re-write of -\Ipopt in C++. With the help of Carl Laird, who came to the +%Ipopt in C++. With the help of Carl Laird, who came to the Mathematical Sciences Department at IBM Research as a summer intern in 2004 and 2005 during his PhD studies, the code was re-implemented from scratch. -The new C++ version of the \Ipopt optimization code -(\Ipopt 3.0.0 and beyond) was maintained at IBM Research and +The new C++ version of the %Ipopt optimization code +(%Ipopt 3.0.0 and beyond) was maintained at IBM Research and remains part of the COIN-OR initiative. The development on the Fortran version has ceased, but the source code can still be downloaded from . @@ -395,13 +397,10 @@ maintained by Stefan Vigerske (GAMS Software GmbH) and Andreas Wächter (Department of Industrial Engineering and Management Sciences, Northwestern University). The following names used in this document are trademarks or registered -trademarks: AMPL, IBM, Intel, Matlab, Microsoft, MKL, Visual Studio C++, +trademarks: Apple, AMPL, IBM, Intel, Matlab, Microsoft, MKL, Visual Studio C++, Visual Studio C++ .NET -\page CHANGELOG Release notes - -\verbinclude ChangeLog \page AUTHORS Authors and Contributors @@ -409,7 +408,7 @@ Visual Studio C++ .NET \page LICENSE License -\Ipopt is available under the Eclipse Public License 1.0: +%Ipopt is available under the Eclipse Public License: \verbinclude LICENSE diff --git a/doc/options.dox b/doc/options.dox index e4aae8fc5..2eec42b05 100644 --- a/doc/options.dox +++ b/doc/options.dox @@ -3,15 +3,15 @@ \tableofcontents -\Ipopt has many (maybe too many) options that can be adjusted for the +%Ipopt has many (maybe too many) options that can be adjusted for the algorithm. %Options are all identified by a string name, and their values can be of one of three types: Number (real), Integer, or String. Number options are used for things like tolerances, integer options are used for things like maximum number of iterations, and string options are used for setting algorithm details, like the NLP -scaling method. %Options can be set through code, through the AMPL -interface if you are using AMPL, or by creating a `ipopt.opt` file in the -directory you are executing \Ipopt. +scaling method. %Options can be set through the code that interfaces %Ipopt +(have a look at the examples to see how this is done) +or by creating a `ipopt.opt` file in the directory you are executing %Ipopt. The `ipopt.opt` file is read line by line and each line should contain the option name, followed by whitespace, and then the value. Comments can be @@ -30,1550 +30,2457 @@ included with the `#` symbol. For example, is a valid `ipopt.opt` file. -%Options can also be set in code. Have a look at the examples to see how -this is done. +\section OPTIONS_AMPL Options in the AMPL Interface -A subset of \Ipopt options are available through AMPL. To -set options through AMPL, use the internal AMPL command options. For -example, +To set options through AMPL, use the internal AMPL command options. +For example, \verbatim options ipopt_options "nlp_scaling_method=none mu_init=1e-2 max_iter=500" \endverbatim -is a valid options command in AMPL. The most important options are -referenced in \ref OPTIONS_REF. To see which options are available through -AMPL, see \ref OPTIONS_AMPL, or run the AMPL solver executable with the "-=" flag from the -command prompt. To specify other options when using AMPL, you can always -create `ipopt.opt`. Note, the `ipopt.opt` file is given preference when -setting options. This way, you can easily override any options set in a -particular executable or AMPL model by specifying new values in -`ipopt.opt`. - -For a list of the most important valid options, see \ref OPTIONS_REF. -You can print the documentation for all \Ipopt options by -using the option -\verbatim -print_options_documentation yes -\endverbatim -and running \Ipopt (like the AMPL solver executable, for -instance). This will output the documentation of almost all options to -the console. +is a valid options command in AMPL. Further, you can always create `ipopt.opt`. +Note, the `ipopt.opt` file is given preference when setting options. +This way, you can easily override any options set in a particular executable +or AMPL model by specifying new values in `ipopt.opt`. + +All %Ipopt options are also available through AMPL. +In addition, these options are available: + +| Option | Description | +|:-------|:------------| +| halt_on_ampl_error | Exit with message on evaluation error | +| wantsol | 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 | +| maxit | Synonym for \ref OPT_max_iter "max_iter" | +| outlev | Synonym for \ref OPT_print_level "print_level" | + +Running the AMPL solver executable with the "-=" flag from the command prompt +prints a list of all options available in AMPL. \section OPTIONS_REF Options Reference -\subsection OPT_Output Output +A list of documented options is given next. +Options that should be modified by expert users only are marked as advanced. +You can print the documentation for all %Ipopt options to the console by +using the option \ref OPT_print_options_documentation "print_options_documentation" +and running %Ipopt. +If you have the AMPL solver executable, you can generate this list also +by calling the executable with flag `--print-options`. -\anchor OPT_print_level - print_level: Output verbosity level. -

- Sets the default verbosity level for console output. The larger this value the more detailed is the output. The valid range for this integer option is 0 ≤ print_level ≤ 12 and its default value is 5. +\note Availability or default values of some options concerning the linear solver depends on the configuration used to build %Ipopt. +Use the print options documentation feature to see which options are available in a particular build of %Ipopt. -
+The implementation paper mentioned for some options is \cite WaecBieg06:mp. -\anchor OPT_print_user_options - print_user_options: Print all options set by the user. -
- If selected, the algorithm will print the list of all options set by the user including their values and whether they have been used. In some cases this information might be incorrect, due to the internal program flow. The default value for this string option is "no". -Possible values: - - no: don't print options - - yes: print options -
+\subsection OPT_Termination Termination -\anchor OPT_print_options_documentation - print_options_documentation: Switch to print all algorithmic options. +\anchor OPT_tol +tol: Desired convergence tolerance (relative).
- If selected, the algorithm will print the list of all available algorithmic options with some documentation before solving the optimization problem. The default value for this string option is "no". - -Possible values: - - no: don't print list - - yes: print list + Determines the convergence tolerance for the algorithm. The algorithm terminates successfully, if the (scaled) NLP error becomes smaller than this value, and if the (absolute) criteria according to "dual_inf_tol", "constr_viol_tol", and "compl_inf_tol" are met. This is epsilon_tol in Eqn. (6) in implementation paper. See also "acceptable_tol" as a second termination criterion. Note, some other algorithmic features also use this quantity to determine thresholds etc. The valid range for this real option is 0 < tol and its default value is 10-08.
-\anchor OPT_print_frequency_iter - print_frequency_iter: Determines at which iteration frequency the summarizing iteration output line should be printed. +\anchor OPT_s_max +s_max (advanced): Scaling threshold for the NLP error.
- Summarizing iteration output is printed every print_frequency_iter iterations, if at least print_frequency_time seconds have passed since last output. The valid range for this integer option is 1 ≤ print_frequency_iter and its default value is 1. - + See paragraph after Eqn. (6) in the implementation paper. The valid range for this real option is 0 < s_max and its default value is 100.
-\anchor OPT_print_frequency_time - print_frequency_time: Determines at which time frequency the summarizing iteration output line should be printed. +\anchor OPT_max_iter +max_iter: Maximum number of iterations.
- Summarizing iteration output is printed if at least print_frequency_time seconds have passed since last output and the iteration number is a multiple of print_frequency_iter. The valid range for this real option is 0 ≤ print_frequency_time and its default value is 0. + The algorithm terminates with a message if the number of iterations exceeded this number. The valid range for this integer option is 0 ≤ max_iter and its default value is 3000. +
+\anchor OPT_max_wall_time +max_wall_time: Maximum number of walltime clock seconds. +
+ A limit on walltime clock seconds that Ipopt can use to solve one problem. If during the convergence check this limit is exceeded, Ipopt will terminate with a corresponding message. The valid range for this real option is 0 < max_wall_time and its default value is 10+20.
-\anchor OPT_output_file - output_file: File name of desired output file (leave unset for no file output). +\anchor OPT_max_cpu_time +max_cpu_time: Maximum number of CPU seconds.
- NOTE: This option only works when read from the ipopt.opt options file! An output file with this name will be written (leave unset for no file output). The verbosity level is by default set to "print_level", but can be overridden with "file_print_level". The file name is changed to use only small letters. The default value for this string option is "". + A limit on CPU seconds that Ipopt can use to solve one problem. If during the convergence check this limit is exceeded, Ipopt will terminate with a corresponding message. The valid range for this real option is 0 < max_cpu_time and its default value is 10+20. +
-Possible values: - - *: Any acceptable standard file name +\anchor OPT_dual_inf_tol +dual_inf_tol: Desired threshold for the dual infeasibility. +
+ Absolute tolerance on the dual infeasibility. Successful termination requires that the max-norm of the (unscaled) dual infeasibility is less than this threshold. The valid range for this real option is 0 < dual_inf_tol and its default value is 1.
-\anchor OPT_file_print_level - file_print_level: Verbosity level for output file. +\anchor OPT_constr_viol_tol +constr_viol_tol: Desired threshold for the constraint and variable bound violation.
- NOTE: This option only works when read from the ipopt.opt options file! Determines the verbosity level for the file specified by "output_file". By default it is the same as "print_level". The valid range for this integer option is 0 ≤ file_print_level ≤ 12 and its default value is 5. + Absolute tolerance on the constraint and variable bound violation. Successful termination requires that the max-norm of the (unscaled) constraint violation is less than this threshold. If option bound_relax_factor is not zero 0, then Ipopt relaxes given variable bounds. The value of constr_viol_tol is used to restrict the absolute amount of this bound relaxation. The valid range for this real option is 0 < constr_viol_tol and its default value is 0.0001. +
+\anchor OPT_compl_inf_tol +compl_inf_tol: Desired threshold for the complementarity conditions. +
+ Absolute tolerance on the complementarity. Successful termination requires that the max-norm of the (unscaled) complementarity is less than this threshold. The valid range for this real option is 0 < compl_inf_tol and its default value is 0.0001.
-\anchor OPT_option_file_name - option_file_name: File name of options file. +\anchor OPT_acceptable_tol +acceptable_tol: "Acceptable" convergence tolerance (relative).
- By default, the name of the Ipopt options file is "ipopt.opt" - or something else if specified in the IpoptApplication::Initialize call. If this option is set by SetStringValue BEFORE the options file is read, it specifies the name of the options file. It does not make any sense to specify this option within the options file. Setting this option to an empty string disables reading of an options file. The default value for this string option is "ipopt.opt". + Determines which (scaled) overall optimality error is considered to be "acceptable". There are two levels of termination criteria. If the usual "desired" tolerances (see tol, dual_inf_tol etc) are satisfied at an iteration, the algorithm immediately terminates with a success message. On the other hand, if the algorithm encounters "acceptable_iter" many iterations in a row that are considered "acceptable", it will terminate before the desired convergence tolerance is met. This is useful in cases where the algorithm might not be able to achieve the "desired" level of accuracy. The valid range for this real option is 0 < acceptable_tol and its default value is 10-06. +
-Possible values: - - *: Any acceptable standard file name +\anchor OPT_acceptable_iter +acceptable_iter: Number of "acceptable" iterates before triggering termination. +
+ If the algorithm encounters this many successive "acceptable" iterates (see "acceptable_tol"), it terminates, assuming that the problem has been solved to best possible accuracy given round-off. If it is set to zero, this heuristic is disabled. The valid range for this integer option is 0 ≤ acceptable_iter and its default value is 15.
-\anchor OPT_print_info_string - print_info_string: Enables printing of additional info string at end of iteration output. +\anchor OPT_acceptable_dual_inf_tol +acceptable_dual_inf_tol: "Acceptance" threshold for the dual infeasibility.
- This string contains some insider information about the current iteration. For details, look for "Diagnostic Tags" in the Ipopt documentation. The default value for this string option is "no". + Absolute tolerance on the dual infeasibility. "Acceptable" termination requires that the (max-norm of the unscaled) dual infeasibility is less than this threshold; see also acceptable_tol. The valid range for this real option is 0 < acceptable_dual_inf_tol and its default value is 10+10. +
-Possible values: - - no: don't print string - - yes: print string at end of each iteration output +\anchor OPT_acceptable_constr_viol_tol +acceptable_constr_viol_tol: "Acceptance" threshold for the constraint violation. +
+ Absolute tolerance on the constraint violation. "Acceptable" termination requires that the max-norm of the (unscaled) constraint violation is less than this threshold; see also acceptable_tol. The valid range for this real option is 0 < acceptable_constr_viol_tol and its default value is 0.01.
-\anchor OPT_inf_pr_output - inf_pr_output: Determines what value is printed in the "inf_pr" output column. +\anchor OPT_acceptable_compl_inf_tol +acceptable_compl_inf_tol: "Acceptance" threshold for the complementarity conditions.
- Ipopt works with a reformulation of the original problem, where slacks are introduced and the problem might have been scaled. The choice "internal" prints out the constraint violation of this formulation. With "original" the true constraint violation in the original NLP is printed. The default value for this string option is "original". + Absolute tolerance on the complementarity. "Acceptable" termination requires that the max-norm of the (unscaled) complementarity is less than this threshold; see also acceptable_tol. The valid range for this real option is 0 < acceptable_compl_inf_tol and its default value is 0.01. +
-Possible values: - - internal: max-norm of violation of internal equality constraints - - original: maximal constraint violation in original NLP +\anchor OPT_acceptable_obj_change_tol +acceptable_obj_change_tol: "Acceptance" stopping criterion based on objective function change. +
+ If the relative change of the objective function (scaled by Max(1,|f(x)|)) is less than this value, this part of the acceptable tolerance termination is satisfied; see also acceptable_tol. This is useful for the quasi-Newton option, which has trouble to bring down the dual infeasibility. The valid range for this real option is 0 ≤ acceptable_obj_change_tol and its default value is 10+20.
-\anchor OPT_print_timing_statistics - print_timing_statistics: Switch to print timing statistics. +\anchor OPT_diverging_iterates_tol +diverging_iterates_tol: Threshold for maximal value of primal iterates.
- If selected, the program will print the CPU usage (user time) for selected tasks. The default value for this string option is "no". + If any component of the primal iterates exceeded this value (in absolute terms), the optimization is aborted with the exit message that the iterates seem to be diverging. The valid range for this real option is 0 < diverging_iterates_tol and its default value is 10+20. +
-Possible values: - - no: don't print statistics - - yes: print all timing statistics +\anchor OPT_mu_target +mu_target: Desired value of complementarity. +
+ Usually, the barrier parameter is driven to zero and the termination test for complementarity is measured with respect to zero complementarity. However, in some cases it might be desired to have Ipopt solve barrier problem for strictly positive value of the barrier parameter. In this case, the value of "mu_target" specifies the final value of the barrier parameter, and the termination tests are then defined with respect to the barrier problem for this value of the barrier parameter. The valid range for this real option is 0 ≤ mu_target and its default value is 0.
-\subsection OPT_Termination Termination -\anchor OPT_tol - tol: Desired convergence tolerance (relative). -
- Determines the convergence tolerance for the algorithm. The algorithm terminates successfully, if the (scaled) NLP error becomes smaller than this value, and if the (absolute) criteria according to "dual_inf_tol", "constr_viol_tol", and "compl_inf_tol" are met. (This is epsilon_tol in Eqn. (6) in implementation paper). See also "acceptable_tol" as a second termination criterion. Note, some other algorithmic features also use this quantity to determine thresholds etc. The valid range for this real option is 0 < tol and its default value is 10-08. +\subsection OPT_Output Output +\anchor OPT_print_level +print_level: Output verbosity level. +
+ Sets the default verbosity level for console output. The larger this value the more detailed is the output. The valid range for this integer option is 0 ≤ print_level ≤ 12 and its default value is 5.
-\anchor OPT_max_iter - max_iter: Maximum number of iterations. +\anchor OPT_output_file +output_file: File name of desired output file (leave unset for no file output).
- The algorithm terminates with an error message if the number of iterations exceeded this number. The valid range for this integer option is 0 ≤ max_iter and its default value is 3000. + NOTE: This option only works when read from the ipopt.opt options file! An output file with this name will be written (leave unset for no file output). The verbosity level is by default set to "print_level", but can be overridden with "file_print_level". The file name is changed to use only small letters. The default value for this string option is "". +Possible values: + - *: Any acceptable standard file name
-\anchor OPT_max_cpu_time - max_cpu_time: Maximum number of CPU seconds. +\anchor OPT_file_print_level +file_print_level: Verbosity level for output file.
- A limit on CPU seconds that Ipopt can use to solve one problem. If during the convergence check this limit is exceeded, Ipopt will terminate with a corresponding error message. The valid range for this real option is 0 < max_cpu_time and its default value is 10+06. - + NOTE: This option only works when read from the ipopt.opt options file! Determines the verbosity level for the file specified by "output_file". By default it is the same as "print_level". The valid range for this integer option is 0 ≤ file_print_level ≤ 12 and its default value is 5.
-\anchor OPT_dual_inf_tol - dual_inf_tol: Desired threshold for the dual infeasibility. +\anchor OPT_file_append +file_append: Whether to append to output file, if set, instead of truncating.
- Absolute tolerance on the dual infeasibility. Successful termination requires that the max-norm of the (unscaled) dual infeasibility is less than this threshold. The valid range for this real option is 0 < dual_inf_tol and its default value is 1. + NOTE: This option only works when read from the ipopt.opt options file! The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_constr_viol_tol - constr_viol_tol: Desired threshold for the constraint violation. +\anchor OPT_print_user_options +print_user_options: Print all options set by the user.
- Absolute tolerance on the constraint violation. Successful termination requires that the max-norm of the (unscaled) constraint violation is less than this threshold. The valid range for this real option is 0 < constr_viol_tol and its default value is 0.0001. + If selected, the algorithm will print the list of all options set by the user including their values and whether they have been used. In some cases this information might be incorrect, due to the internal program flow. The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_compl_inf_tol - compl_inf_tol: Desired threshold for the complementarity conditions. +\anchor OPT_print_options_documentation +print_options_documentation: Switch to print all algorithmic options with some documentation before solving the optimization problem.
- Absolute tolerance on the complementarity. Successful termination requires that the max-norm of the (unscaled) complementarity is less than this threshold. The valid range for this real option is 0 < compl_inf_tol and its default value is 0.0001. + The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_acceptable_tol - acceptable_tol: "Acceptable" convergence tolerance (relative). +\anchor OPT_print_timing_statistics +print_timing_statistics: Switch to print timing statistics.
- Determines which (scaled) overall optimality error is considered to be "acceptable". There are two levels of termination criteria. If the usual "desired" tolerances (see tol, dual_inf_tol etc) are satisfied at an iteration, the algorithm immediately terminates with a success message. On the other hand, if the algorithm encounters "acceptable_iter" many iterations in a row that are considered "acceptable", it will terminate before the desired convergence tolerance is met. This is useful in cases where the algorithm might not be able to achieve the "desired" level of accuracy. The valid range for this real option is 0 < acceptable_tol and its default value is 10-06. + If selected, the program will print the time spend for selected tasks. This implies timing_statistics=yes. The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_acceptable_iter - acceptable_iter: Number of "acceptable" iterates before triggering termination. +\anchor OPT_print_options_mode +print_options_mode: format in which to print options documentation
- If the algorithm encounters this many successive "acceptable" iterates (see "acceptable_tol"), it terminates, assuming that the problem has been solved to best possible accuracy given round-off. If it is set to zero, this heuristic is disabled. The valid range for this integer option is 0 ≤ acceptable_iter and its default value is 15. + The default value for this string option is "text". +Possible values: + - text: Ordinary text + - latex: LaTeX formatted + - doxygen: Doxygen (markdown) formatted
-\anchor OPT_acceptable_constr_viol_tol - acceptable_constr_viol_tol: "Acceptance" threshold for the constraint violation. +\anchor OPT_print_advanced_options +print_advanced_options (advanced): whether to print also advanced options
- Absolute tolerance on the constraint violation. "Acceptable" termination requires that the max-norm of the (unscaled) constraint violation is less than this threshold; see also acceptable_tol. The valid range for this real option is 0 < acceptable_constr_viol_tol and its default value is 0.01. + The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_acceptable_dual_inf_tol - acceptable_dual_inf_tol: "Acceptance" threshold for the dual infeasibility. +\anchor OPT_print_info_string +print_info_string: Enables printing of additional info string at end of iteration output.
- Absolute tolerance on the dual infeasibility. "Acceptable" termination requires that the (max-norm of the unscaled) dual infeasibility is less than this threshold; see also acceptable_tol. The valid range for this real option is 0 < acceptable_dual_inf_tol and its default value is 10+10. + This string contains some insider information about the current iteration. For details, look for "Diagnostic Tags" in the Ipopt documentation. The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_acceptable_compl_inf_tol - acceptable_compl_inf_tol: "Acceptance" threshold for the complementarity conditions. +\anchor OPT_inf_pr_output +inf_pr_output: Determines what value is printed in the "inf_pr" output column.
- Absolute tolerance on the complementarity. "Acceptable" termination requires that the max-norm of the (unscaled) complementarity is less than this threshold; see also acceptable_tol. The valid range for this real option is 0 < acceptable_compl_inf_tol and its default value is 0.01. + Ipopt works with a reformulation of the original problem, where slacks are introduced and the problem might have been scaled. The choice "internal" prints out the constraint violation of this formulation. With "original" the true constraint violation in the original NLP is printed. The default value for this string option is "original". +Possible values: + - internal: max-norm of violation of internal equality constraints + - original: maximal constraint violation in original NLP
-\anchor OPT_acceptable_obj_change_tol - acceptable_obj_change_tol: "Acceptance" stopping criterion based on objective function change. +\anchor OPT_print_frequency_iter +print_frequency_iter: Determines at which iteration frequency the summarizing iteration output line should be printed.
- If the relative change of the objective function (scaled by Max(1,|f(x)|)) is less than this value, this part of the acceptable tolerance termination is satisfied; see also acceptable_tol. This is useful for the quasi-Newton option, which has trouble to bring down the dual infeasibility. The valid range for this real option is 0 ≤ acceptable_obj_change_tol and its default value is 10+20. - + Summarizing iteration output is printed every print_frequency_iter iterations, if at least print_frequency_time seconds have passed since last output. The valid range for this integer option is 1 ≤ print_frequency_iter and its default value is 1.
-\anchor OPT_diverging_iterates_tol - diverging_iterates_tol: Threshold for maximal value of primal iterates. +\anchor OPT_print_frequency_time +print_frequency_time: Determines at which time frequency the summarizing iteration output line should be printed.
- If any component of the primal iterates exceeded this value (in absolute terms), the optimization is aborted with the exit message that the iterates seem to be diverging. The valid range for this real option is 0 < diverging_iterates_tol and its default value is 10+20. - + Summarizing iteration output is printed if at least print_frequency_time seconds have passed since last output and the iteration number is a multiple of print_frequency_iter. The valid range for this real option is 0 ≤ print_frequency_time and its default value is 0.
-\subsection OPT_NLP_Scaling NLP Scaling -\anchor OPT_obj_scaling_factor - obj_scaling_factor: Scaling factor for the objective function. +\subsection OPT_NLP NLP + +\anchor OPT_nlp_lower_bound_inf +nlp_lower_bound_inf: any bound less or equal this value will be considered -inf (i.e. not lower bounded).
- This option sets a scaling factor for the objective function. The scaling is seen internally by Ipopt but the unscaled objective is reported in the console output. If additional scaling parameters are computed (e.g. user-scaling or gradient-based), both factors are multiplied. If this value is chosen to be negative, Ipopt will maximize the objective function instead of minimizing it. The valid range for this real option is unrestricted and its default value is 1. + The valid range for this real option is unrestricted and its default value is -10+19. +
+\anchor OPT_nlp_upper_bound_inf +nlp_upper_bound_inf: any bound greater or this value will be considered +inf (i.e. not upper bounded). +
+ The valid range for this real option is unrestricted and its default value is 10+19.
-\anchor OPT_nlp_scaling_method - nlp_scaling_method: Select the technique used for scaling the NLP. +\anchor OPT_fixed_variable_treatment +fixed_variable_treatment: Determines how fixed variables should be handled.
- Selects the technique used for scaling the problem internally before it is solved. For user-scaling, the parameters come from the NLP. If you are using AMPL, they can be specified through suffixes ("scaling_factor") The default value for this string option is "gradient-based". + The main difference between those options is that the starting point in the "make_constraint" case still has the fixed variables at their given values, whereas in the case "make_parameter(_nodual)" the functions are always evaluated with the fixed values for those variables. Also, for "relax_bounds", the fixing bound constraints are relaxed (according to" bound_relax_factor"). For all but "make_parameter_nodual", bound multipliers are computed for the fixed variables. The default value for this string option is "make_parameter". Possible values: - - none: no problem scaling will be performed - - user-scaling: scaling parameters will come from the user - - gradient-based: scale the problem so the maximum gradient at the starting point is scaling_max_gradient - - equilibration-based: scale the problem so that first derivatives are of order 1 at random points (only available with MC19) + - make_parameter: Remove fixed variable from optimization variables + - make_parameter_nodual: Remove fixed variable from optimization variables and do not compute bound multipliers for fixed variables + - make_constraint: Add equality constraints fixing variables + - relax_bounds: Relax fixing bound constraints
-\anchor OPT_nlp_scaling_max_gradient - nlp_scaling_max_gradient: Maximum gradient after NLP scaling. +\anchor OPT_dependency_detector +dependency_detector (advanced): Indicates which linear solver should be used to detect linearly dependent equality constraints.
- This is the gradient scaling cut-off. If the maximum gradient is above this value, then gradient based scaling will be performed. Scaling parameters are calculated to scale the maximum gradient back to this value. (This is g_max in Section 3.8 of the implementation paper.) Note: This option is only used if "nlp_scaling_method" is chosen as "gradient-based". The valid range for this real option is 0 < nlp_scaling_max_gradient and its default value is 100. + This is experimental and does not work well. The default value for this string option is "none". +Possible values: + - none: don't check; no extra work at beginning + - mumps: use MUMPS + - wsmp: use WSMP + - ma28: use MA28
-\anchor OPT_nlp_scaling_min_value - nlp_scaling_min_value: Minimum value of gradient-based scaling values. +\anchor OPT_dependency_detection_with_rhs +dependency_detection_with_rhs (advanced): Indicates if the right hand sides of the constraints should be considered in addition to gradients during dependency detection
- This is the lower bound for the scaling factors computed by gradient-based scaling method. If some derivatives of some functions are huge, the scaling factors will otherwise become very small, and the (unscaled) final constraint violation, for example, might then be significant. Note: This option is only used if "nlp_scaling_method" is chosen as "gradient-based". The valid range for this real option is 0 ≤ nlp_scaling_min_value and its default value is 10-08. + The default value for this string option is "no". +Possible values: yes, no
-\subsection OPT_NLP NLP +\anchor OPT_num_linear_variables +num_linear_variables (advanced): Number of linear variables +
+ When the Hessian is approximated, it is assumed that the first num_linear_variables variables are linear. The Hessian is then not approximated in this space. If the get_number_of_nonlinear_variables method in the TNLP is implemented, this option is ignored. The valid range for this integer option is 0 ≤ num_linear_variables and its default value is 0. +
-\anchor OPT_bound_relax_factor - bound_relax_factor: Factor for initial relaxation of the bounds. +\anchor OPT_jacobian_approximation +jacobian_approximation (advanced): Specifies technique to compute constraint Jacobian
- Before start of the optimization, the bounds given by the user are relaxed. This option sets the factor for this relaxation. If it is set to zero, then then bounds relaxation is disabled. (See Eqn.(35) in implementation paper.) Note that the constraint violation reported by Ipopt at the end of the solution process does not include violations of the original (non-relaxed) variable bounds. The valid range for this real option is 0 ≤ bound_relax_factor and its default value is 10-08. + The default value for this string option is "exact". +Possible values: + - exact: user-provided derivatives + - finite-difference-values: user-provided structure, values by finite differences
-\anchor OPT_honor_original_bounds - honor_original_bounds: Indicates whether final points should be projected into original bounds. +\anchor OPT_gradient_approximation +gradient_approximation (advanced): Specifies technique to compute objective Gradient
- Ipopt might relax the bounds during the optimization (see, e.g., option "bound_relax_factor"). This option determines whether the final point should be projected back into the user-provide original bounds after the optimization. The default value for this string option is "yes". + The default value for this string option is "exact". Possible values: - - no: Leave final point unchanged - - yes: Project final point back into original bounds + - exact: user-provided gradient + - finite-difference-values: values by finite differences
-\anchor OPT_check_derivatives_for_naninf - check_derivatives_for_naninf: Indicates whether it is desired to check for Nan/Inf in derivative matrices +\anchor OPT_findiff_perturbation +findiff_perturbation (advanced): Size of the finite difference perturbation for derivative approximation.
- Activating this option will cause an error if an invalid number is detected in the constraint Jacobians or the Lagrangian Hessian. If this is not activated, the test is skipped, and the algorithm might proceed with invalid numbers and fail. If test is activated and an invalid number is detected, the matrix is written to output with print_level corresponding to J_MORE_DETAILED; so beware of large output! The default value for this string option is "no". + This determines the relative perturbation of the variable entries. The valid range for this real option is 0 < findiff_perturbation and its default value is 10-07. +
-Possible values: - - no: Don't check (faster). - - yes: Check Jacobians and Hessian for Nan and Inf. +\anchor OPT_kappa_d +kappa_d (advanced): Weight for linear damping term (to handle one-sided bounds). +
+ See Section 3.7 in implementation paper. The valid range for this real option is 0 ≤ kappa_d and its default value is 10-05.
-\anchor OPT_nlp_lower_bound_inf - nlp_lower_bound_inf: any bound less or equal this value will be considered -inf (i.e. not lower bounded). +\anchor OPT_bound_relax_factor +bound_relax_factor: Factor for initial relaxation of the bounds.
- The valid range for this real option is unrestricted and its default value is -10+19. + Before start of the optimization, the bounds given by the user are relaxed. This option sets the factor for this relaxation. Additional, the constraint violation tolerance constr_viol_tol is used to bound the relaxation by an absolute value. If it is set to zero, then then bounds relaxation is disabled. See Eqn.(35) in implementation paper. Note that the constraint violation reported by Ipopt at the end of the solution process does not include violations of the original (non-relaxed) variable bounds. See also option honor_original_bounds. The valid range for this real option is 0 ≤ bound_relax_factor and its default value is 10-08. +
+ +\anchor OPT_honor_original_bounds +honor_original_bounds: Indicates whether final points should be projected into original bounds. +
+ Ipopt might relax the bounds during the optimization (see, e.g., option "bound_relax_factor"). This option determines whether the final point should be projected back into the user-provide original bounds after the optimization. Note that violations of constraints and complementarity reported by Ipopt at the end of the solution process are for the non-projected point. The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_nlp_upper_bound_inf - nlp_upper_bound_inf: any bound greater or this value will be considered +inf (i.e. not upper bounded). +\anchor OPT_check_derivatives_for_naninf +check_derivatives_for_naninf: Indicates whether it is desired to check for Nan/Inf in derivative matrices
- The valid range for this real option is unrestricted and its default value is 10+19. + Activating this option will cause an error if an invalid number is detected in the constraint Jacobians or the Lagrangian Hessian. If this is not activated, the test is skipped, and the algorithm might proceed with invalid numbers and fail. If test is activated and an invalid number is detected, the matrix is written to output with print_level corresponding to J_MOREDETAILED (7); so beware of large output! The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_fixed_variable_treatment - fixed_variable_treatment: Determines how fixed variables should be handled. +\anchor OPT_grad_f_constant +grad_f_constant: Indicates whether to assume that the objective function is linear
- The main difference between those options is that the starting point in the "make_constraint" case still has the fixed variables at their given values, whereas in the case "make_parameter" the functions are always evaluated with the fixed values for those variables. Also, for "relax_bounds", the fixing bound constraints are relaxed (according to" bound_relax_factor"). For both "make_constraints" and "relax_bounds", bound multipliers are computed for the fixed variables. The default value for this string option is "make_parameter". + Activating this option will cause Ipopt to ask for the Gradient of the objective function only once from the NLP and reuse this information later. The default value for this string option is "no". -Possible values: - - make_parameter: Remove fixed variable from optimization variables - - make_constraint: Add equality constraints fixing variables - - relax_bounds: Relax fixing bound constraints +Possible values: yes, no
\anchor OPT_jac_c_constant - jac_c_constant: Indicates whether all equality constraints are linear +jac_c_constant: Indicates whether to assume that all equality constraints are linear
Activating this option will cause Ipopt to ask for the Jacobian of the equality constraints only once from the NLP and reuse this information later. The default value for this string option is "no". -Possible values: - - no: Don't assume that all equality constraints are linear - - yes: Assume that equality constraints Jacobian are constant +Possible values: yes, no
\anchor OPT_jac_d_constant - jac_d_constant: Indicates whether all inequality constraints are linear +jac_d_constant: Indicates whether to assume that all inequality constraints are linear
Activating this option will cause Ipopt to ask for the Jacobian of the inequality constraints only once from the NLP and reuse this information later. The default value for this string option is "no". -Possible values: - - no: Don't assume that all inequality constraints are linear - - yes: Assume that equality constraints Jacobian are constant +Possible values: yes, no
\anchor OPT_hessian_constant - hessian_constant: Indicates whether the problem is a quadratic problem +hessian_constant: Indicates whether to assume the problem is a QP (quadratic objective, linear constraints)
Activating this option will cause Ipopt to ask for the Hessian of the Lagrangian function only once from the NLP and reuse this information later. The default value for this string option is "no". +Possible values: yes, no +
+ + +\subsection OPT_NLP_Scaling NLP Scaling + +\anchor OPT_nlp_scaling_method +nlp_scaling_method: Select the technique used for scaling the NLP. +
+ Selects the technique used for scaling the problem internally before it is solved. For user-scaling, the parameters come from the NLP. If you are using AMPL, they can be specified through suffixes ("scaling_factor") The default value for this string option is "gradient-based". + Possible values: - - no: Assume that Hessian changes - - yes: Assume that Hessian is constant + - none: no problem scaling will be performed + - user-scaling: scaling parameters will come from the user + - gradient-based: scale the problem so the maximum gradient at the starting point is nlp_scaling_max_gradient + - equilibration-based: scale the problem so that first derivatives are of order 1 at random points (uses Harwell routine MC19)
-\subsection OPT_Initialization Initialization +\anchor OPT_obj_scaling_factor +obj_scaling_factor: Scaling factor for the objective function. +
+ This option sets a scaling factor for the objective function. The scaling is seen internally by Ipopt but the unscaled objective is reported in the console output. If additional scaling parameters are computed (e.g. user-scaling or gradient-based), both factors are multiplied. If this value is chosen to be negative, Ipopt will maximize the objective function instead of minimizing it. The valid range for this real option is unrestricted and its default value is 1. +
-\anchor OPT_bound_frac - bound_frac: Desired minimum relative distance from the initial point to bound. +\anchor OPT_nlp_scaling_max_gradient +nlp_scaling_max_gradient: Maximum gradient after NLP scaling.
- Determines how much the initial point might have to be modified in order to be sufficiently inside the bounds (together with "bound_push"). (This is kappa_2 in Section 3.6 of implementation paper.) The valid range for this real option is 0 < bound_frac ≤ 0.5 and its default value is 0.01. + This is the gradient scaling cut-off. If the maximum gradient is above this value, then gradient based scaling will be performed. Scaling parameters are calculated to scale the maximum gradient back to this value. (This is g_max in Section 3.8 of the implementation paper.) Note: This option is only used if "nlp_scaling_method" is chosen as "gradient-based". The valid range for this real option is 0 < nlp_scaling_max_gradient and its default value is 100. +
+\anchor OPT_nlp_scaling_obj_target_gradient +nlp_scaling_obj_target_gradient (advanced): Target value for objective function gradient size. +
+ If a positive number is chosen, the scaling factor for the objective function is computed so that the gradient has the max norm of the given size at the starting point. This overrides nlp_scaling_max_gradient for the objective function. The valid range for this real option is 0 ≤ nlp_scaling_obj_target_gradient and its default value is 0.
-\anchor OPT_bound_push - bound_push: Desired minimum absolute distance from the initial point to bound. +\anchor OPT_nlp_scaling_constr_target_gradient +nlp_scaling_constr_target_gradient (advanced): Target value for constraint function gradient size.
- Determines how much the initial point might have to be modified in order to be sufficiently inside the bounds (together with "bound_frac"). (This is kappa_1 in Section 3.6 of implementation paper.) The valid range for this real option is 0 < bound_push and its default value is 0.01. + If a positive number is chosen, the scaling factors for the constraint functions are computed so that the gradient has the max norm of the given size at the starting point. This overrides nlp_scaling_max_gradient for the constraint functions. The valid range for this real option is 0 ≤ nlp_scaling_constr_target_gradient and its default value is 0. +
+\anchor OPT_nlp_scaling_min_value +nlp_scaling_min_value: Minimum value of gradient-based scaling values. +
+ This is the lower bound for the scaling factors computed by gradient-based scaling method. If some derivatives of some functions are huge, the scaling factors will otherwise become very small, and the (unscaled) final constraint violation, for example, might then be significant. Note: This option is only used if "nlp_scaling_method" is chosen as "gradient-based". The valid range for this real option is 0 ≤ nlp_scaling_min_value and its default value is 10-08.
-\anchor OPT_slack_bound_frac - slack_bound_frac: Desired minimum relative distance from the initial slack to bound. + +\subsection OPT_Initialization Initialization + +\anchor OPT_bound_push +bound_push: Desired minimum absolute distance from the initial point to bound.
- Determines how much the initial slack variables might have to be modified in order to be sufficiently inside the inequality bounds (together with "slack_bound_push"). (This is kappa_2 in Section 3.6 of implementation paper.) The valid range for this real option is 0 < slack_bound_frac ≤ 0.5 and its default value is 0.01. + Determines how much the initial point might have to be modified in order to be sufficiently inside the bounds (together with "bound_frac"). (This is kappa_1 in Section 3.6 of implementation paper.) The valid range for this real option is 0 < bound_push and its default value is 0.01. +
+\anchor OPT_bound_frac +bound_frac: Desired minimum relative distance from the initial point to bound. +
+ Determines how much the initial point might have to be modified in order to be sufficiently inside the bounds (together with "bound_push"). (This is kappa_2 in Section 3.6 of implementation paper.) The valid range for this real option is 0 < bound_frac ≤ 0.5 and its default value is 0.01.
\anchor OPT_slack_bound_push - slack_bound_push: Desired minimum absolute distance from the initial slack to bound. +slack_bound_push: Desired minimum absolute distance from the initial slack to bound.
Determines how much the initial slack variables might have to be modified in order to be sufficiently inside the inequality bounds (together with "slack_bound_frac"). (This is kappa_1 in Section 3.6 of implementation paper.) The valid range for this real option is 0 < slack_bound_push and its default value is 0.01. -
-\anchor OPT_bound_mult_init_val - bound_mult_init_val: Initial value for the bound multipliers. +\anchor OPT_slack_bound_frac +slack_bound_frac: Desired minimum relative distance from the initial slack to bound.
- All dual variables corresponding to bound constraints are initialized to this value. The valid range for this real option is 0 < bound_mult_init_val and its default value is 1. - + Determines how much the initial slack variables might have to be modified in order to be sufficiently inside the inequality bounds (together with "slack_bound_push"). (This is kappa_2 in Section 3.6 of implementation paper.) The valid range for this real option is 0 < slack_bound_frac ≤ 0.5 and its default value is 0.01.
\anchor OPT_constr_mult_init_max - constr_mult_init_max: Maximum allowed least-square guess of constraint multipliers. +constr_mult_init_max: Maximum allowed least-square guess of constraint multipliers.
Determines how large the initial least-square guesses of the constraint multipliers are allowed to be (in max-norm). If the guess is larger than this value, it is discarded and all constraint multipliers are set to zero. This options is also used when initializing the restoration phase. By default, "resto.constr_mult_init_max" (the one used in RestoIterateInitializer) is set to zero. The valid range for this real option is 0 ≤ constr_mult_init_max and its default value is 1000. +
+\anchor OPT_bound_mult_init_val +bound_mult_init_val: Initial value for the bound multipliers. +
+ All dual variables corresponding to bound constraints are initialized to this value. The valid range for this real option is 0 < bound_mult_init_val and its default value is 1.
\anchor OPT_bound_mult_init_method - bound_mult_init_method: Initialization method for bound multipliers +bound_mult_init_method: Initialization method for bound multipliers
- This option defines how the iterates for the bound multipliers are initialized. If "constant" is chosen, then all bound multipliers are initialized to the value of "bound_mult_init_val". If "mu-based" is chosen, the each value is initialized to the the value of "mu_init" divided by the corresponding slack variable. This latter option might be useful if the starting point is close to the optimal solution. The default value for this string option is "constant". + This option defines how the iterates for the bound multipliers are initialized. If "constant" is chosen, then all bound multipliers are initialized to the value of "bound_mult_init_val". If "mu-based" is chosen, then each value is initialized to the the value of "mu_init" divided by the corresponding slack variable. This latter option might be useful if the starting point is close to the optimal solution. The default value for this string option is "constant". Possible values: - constant: set all bound multipliers to the value of bound_mult_init_val - mu-based: initialize to mu_init/x_slack
-\subsection OPT_Barrier_Parameter Barrier Parameter - -\anchor OPT_mehrotra_algorithm - mehrotra_algorithm: Indicates if we want to do Mehrotra's algorithm. +\anchor OPT_least_square_init_primal +least_square_init_primal: Least square initialization of the primal variables
- If set to yes, Ipopt runs as Mehrotra's predictor-corrector algorithm. This works usually very well for LPs and convex QPs. This automatically disables the line search, and chooses the (unglobalized) adaptive mu strategy with the "probing" oracle, and uses "corrector_type=affine" without any safeguards; you should not set any of those options explicitly in addition. Also, unless otherwise specified, the values of "bound_push", "bound_frac", and "bound_mult_init_val" are set more aggressive, and sets "alpha_for_y=bound_mult". The default value for this string option is "no". + If set to yes, Ipopt ignores the user provided point and solves a least square problem for the primal variables (x and s) to fit the linearized equality and inequality constraints.This might be useful if the user doesn't know anything about the starting point, or for solving an LP or QP. The default value for this string option is "no". Possible values: - - no: Do the usual Ipopt algorithm. - - yes: Do Mehrotra's predictor-corrector algorithm. + - no: take user-provided point + - yes: overwrite user-provided point with least-square estimates
-\anchor OPT_mu_strategy - mu_strategy: Update strategy for barrier parameter. +\anchor OPT_least_square_init_duals +least_square_init_duals: Least square initialization of all dual variables
- Determines which barrier parameter update strategy is to be used. The default value for this string option is "monotone". + If set to yes, Ipopt tries to compute least-square multipliers (considering ALL dual variables). If successful, the bound multipliers are possibly corrected to be at least bound_mult_init_val. This might be useful if the user doesn't know anything about the starting point, or for solving an LP or QP. This overwrites option "bound_mult_init_method". The default value for this string option is "no". Possible values: - - monotone: use the monotone (Fiacco-McCormick) strategy - - adaptive: use the adaptive update strategy + - no: use bound_mult_init_val and least-square equality constraint multipliers + - yes: overwrite user-provided point with least-square estimates
-\anchor OPT_mu_oracle - mu_oracle: Oracle for a new barrier parameter in the adaptive strategy. + +\subsection OPT_Warm_Start Warm Start + +\anchor OPT_warm_start_init_point +warm_start_init_point: Warm-start for initial point
- Determines how a new barrier parameter is computed in each "free-mode" iteration of the adaptive barrier parameter strategy. (Only considered if "adaptive" is selected for option "mu_strategy"). The default value for this string option is "quality-function". + Indicates whether this optimization should use a warm start initialization, where values of primal and dual variables are given (e.g., from a previous optimization of a related problem.) The default value for this string option is "no". Possible values: - - probing: Mehrotra's probing heuristic - - loqo: LOQO's centrality rule - - quality-function: minimize a quality function + - no: do not use the warm start initialization + - yes: use the warm start initialization
-\anchor OPT_quality_function_max_section_steps - quality_function_max_section_steps: Maximum number of search steps during direct search procedure determining the optimal centering parameter. +\anchor OPT_warm_start_same_structure +warm_start_same_structure (advanced): Indicates whether a problem with a structure identical to the previous one is to be solved.
- The golden section search is performed for the quality function based mu oracle. (Only used if option "mu_oracle" is set to "quality-function".) The valid range for this integer option is 0 ≤ quality_function_max_section_steps and its default value is 8. + If enabled, then the algorithm assumes that an NLP is now to be solved whose structure is identical to one that already was considered (with the same NLP object). The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_fixed_mu_oracle - fixed_mu_oracle: Oracle for the barrier parameter when switching to fixed mode. +\anchor OPT_warm_start_bound_push +warm_start_bound_push: same as bound_push for the regular initializer
- Determines how the first value of the barrier parameter should be computed when switching to the "monotone mode" in the adaptive strategy. (Only considered if "adaptive" is selected for option "mu_strategy".) The default value for this string option is "average_compl". - -Possible values: - - probing: Mehrotra's probing heuristic - - loqo: LOQO's centrality rule - - quality-function: minimize a quality function - - average_compl: base on current average complementarity + The valid range for this real option is 0 < warm_start_bound_push and its default value is 0.001.
-\anchor OPT_adaptive_mu_globalization - adaptive_mu_globalization: Globalization strategy for the adaptive mu selection mode. +\anchor OPT_warm_start_bound_frac +warm_start_bound_frac: same as bound_frac for the regular initializer
- To achieve global convergence of the adaptive version, the algorithm has to switch to the monotone mode (Fiacco-McCormick approach) when convergence does not seem to appear. This option sets the criterion used to decide when to do this switch. (Only used if option "mu_strategy" is chosen as "adaptive".) The default value for this string option is "obj-constr-filter". - -Possible values: - - kkt-error: nonmonotone decrease of kkt-error - - obj-constr-filter: 2-dim filter for objective and constraint violation - - never-monotone-mode: disables globalization + The valid range for this real option is 0 < warm_start_bound_frac ≤ 0.5 and its default value is 0.001.
-\anchor OPT_mu_init - mu_init: Initial value for the barrier parameter. +\anchor OPT_warm_start_slack_bound_push +warm_start_slack_bound_push: same as slack_bound_push for the regular initializer
- This option determines the initial value for the barrier parameter (mu). It is only relevant in the monotone, Fiacco-McCormick version of the algorithm. (i.e., if "mu_strategy" is chosen as "monotone") The valid range for this real option is 0 < mu_init and its default value is 0.1. + The valid range for this real option is 0 < warm_start_slack_bound_push and its default value is 0.001. +
+\anchor OPT_warm_start_slack_bound_frac +warm_start_slack_bound_frac: same as slack_bound_frac for the regular initializer +
+ The valid range for this real option is 0 < warm_start_slack_bound_frac ≤ 0.5 and its default value is 0.001.
-\anchor OPT_mu_max_fact - mu_max_fact: Factor for initialization of maximum value for barrier parameter. +\anchor OPT_warm_start_mult_bound_push +warm_start_mult_bound_push: same as mult_bound_push for the regular initializer
- This option determines the upper bound on the barrier parameter. This upper bound is computed as the average complementarity at the initial point times the value of this option. (Only used if option "mu_strategy" is chosen as "adaptive".) The valid range for this real option is 0 < mu_max_fact and its default value is 1000. + The valid range for this real option is 0 < warm_start_mult_bound_push and its default value is 0.001. +
+\anchor OPT_warm_start_mult_init_max +warm_start_mult_init_max: Maximum initial value for the equality multipliers. +
+ The valid range for this real option is unrestricted and its default value is 10+06.
-\anchor OPT_mu_max - mu_max: Maximum value for barrier parameter. +\anchor OPT_warm_start_entire_iterate +warm_start_entire_iterate (advanced): Tells algorithm whether to use the GetWarmStartIterate method in the NLP.
- This option specifies an upper bound on the barrier parameter in the adaptive mu selection mode. If this option is set, it overwrites the effect of mu_max_fact. (Only used if option "mu_strategy" is chosen as "adaptive".) The valid range for this real option is 0 < mu_max and its default value is 100000. + The default value for this string option is "no". +Possible values: + - no: call GetStartingPoint in the NLP + - yes: call GetWarmStartIterate in the NLP
-\anchor OPT_mu_min - mu_min: Minimum value for barrier parameter. +\anchor OPT_warm_start_target_mu +warm_start_target_mu (advanced)
- This option specifies the lower bound on the barrier parameter in the adaptive mu selection mode. By default, it is set to the minimum of 1e-11 and min("tol","compl_inf_tol")/("barrier_tol_factor"+1), which should be a reasonable value. (Only used if option "mu_strategy" is chosen as "adaptive".) The valid range for this real option is 0 < mu_min and its default value is 10-11. - + Experimental! The valid range for this real option is unrestricted and its default value is 0.
-\anchor OPT_mu_target - mu_target: Desired value of complementarity. + +\subsection OPT_Miscellaneous Miscellaneous + +\anchor OPT_option_file_name +option_file_name: File name of options file.
- Usually, the barrier parameter is driven to zero and the termination test for complementarity is measured with respect to zero complementarity. However, in some cases it might be desired to have Ipopt solve barrier problem for strictly positive value of the barrier parameter. In this case, the value of "mu_target" specifies the final value of the barrier parameter, and the termination tests are then defined with respect to the barrier problem for this value of the barrier parameter. The valid range for this real option is 0 ≤ mu_target and its default value is 0. + By default, the name of the Ipopt options file is "ipopt.opt" - or something else if specified in the IpoptApplication::Initialize call. If this option is set by SetStringValue BEFORE the options file is read, it specifies the name of the options file. It does not make any sense to specify this option within the options file. Setting this option to an empty string disables reading of an options file. The default value for this string option is "ipopt.opt". +Possible values: + - *: Any acceptable standard file name
-\anchor OPT_barrier_tol_factor - barrier_tol_factor: Factor for mu in barrier stop test. +\anchor OPT_replace_bounds +replace_bounds (advanced): Whether all variable bounds should be replaced by inequality constraints
- The convergence tolerance for each barrier problem in the monotone mode is the value of the barrier parameter times "barrier_tol_factor". This option is also used in the adaptive mu strategy during the monotone mode. (This is kappa_epsilon in implementation paper). The valid range for this real option is 0 < barrier_tol_factor and its default value is 10. + This option must be set for the inexact algorithm. The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_mu_linear_decrease_factor - mu_linear_decrease_factor: Determines linear decrease rate of barrier parameter. +\anchor OPT_skip_finalize_solution_call +skip_finalize_solution_call (advanced): Whether a call to NLP::FinalizeSolution after optimization should be suppressed
- For the Fiacco-McCormick update procedure the new barrier parameter mu is obtained by taking the minimum of mu*"mu_linear_decrease_factor" and mu^"superlinear_decrease_power". (This is kappa_mu in implementation paper.) This option is also used in the adaptive mu strategy during the monotone mode. The valid range for this real option is 0 < mu_linear_decrease_factor < 1 and its default value is 0.2. + In some Ipopt applications, the user might want to call the FinalizeSolution method separately. Setting this option to "yes" will cause the IpoptApplication object to suppress the default call to that method. The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_mu_superlinear_decrease_power - mu_superlinear_decrease_power: Determines superlinear decrease rate of barrier parameter. +\anchor OPT_timing_statistics +timing_statistics: Indicates whether to measure time spend in components of Ipopt and NLP evaluation
- For the Fiacco-McCormick update procedure the new barrier parameter mu is obtained by taking the minimum of mu*"mu_linear_decrease_factor" and mu^"superlinear_decrease_power". (This is theta_mu in implementation paper.) This option is also used in the adaptive mu strategy during the monotone mode. The valid range for this real option is 1 < mu_superlinear_decrease_power < 2 and its default value is 1.5. + The overall algorithm time is unaffected by this option. The default value for this string option is "no". +Possible values: yes, no
-\subsection OPT_Multiplier_Updates Multiplier Updates -\anchor OPT_alpha_for_y - alpha_for_y: Method to determine the step size for constraint multipliers. -
- This option determines how the step size (alpha_y) will be calculated when updating the constraint multipliers. The default value for this string option is "primal". +\subsection OPT_Barrier_Parameter_Update Barrier Parameter Update -Possible values: - - primal: use primal step size - - bound-mult: use step size for the bound multipliers (good for LPs) - - min: use the min of primal and bound multipliers - - max: use the max of primal and bound multipliers - - full: take a full step of size one - - min-dual-infeas: choose step size minimizing new dual infeasibility - - safer-min-dual-infeas: like "min_dual_infeas", but safeguarded by "min" and "max" - - primal-and-full: use the primal step size, and full step if delta_x <= alpha_for_y_tol - - dual-and-full: use the dual step size, and full step if delta_x <= alpha_for_y_tol - - acceptor: Call LSAcceptor to get step size for y +\anchor OPT_mu_max_fact +mu_max_fact: Factor for initialization of maximum value for barrier parameter. +
+ This option determines the upper bound on the barrier parameter. This upper bound is computed as the average complementarity at the initial point times the value of this option. (Only used if option "mu_strategy" is chosen as "adaptive".) The valid range for this real option is 0 < mu_max_fact and its default value is 1000.
-\anchor OPT_alpha_for_y_tol - alpha_for_y_tol: Tolerance for switching to full equality multiplier steps. +\anchor OPT_mu_max +mu_max: Maximum value for barrier parameter.
- This is only relevant if "alpha_for_y" is chosen "primal-and-full" or "dual-and-full". The step size for the equality constraint multipliers is taken to be one if the max-norm of the primal step is less than this tolerance. The valid range for this real option is 0 ≤ alpha_for_y_tol and its default value is 10. + This option specifies an upper bound on the barrier parameter in the adaptive mu selection mode. If this option is set, it overwrites the effect of mu_max_fact. (Only used if option "mu_strategy" is chosen as "adaptive".) The valid range for this real option is 0 < mu_max and its default value is 100000. +
+\anchor OPT_mu_min +mu_min: Minimum value for barrier parameter. +
+ This option specifies the lower bound on the barrier parameter in the adaptive mu selection mode. By default, it is set to the minimum of 1e-11 and min("tol","compl_inf_tol")/("barrier_tol_factor"+1), which should be a reasonable value. (Only used if option "mu_strategy" is chosen as "adaptive".) The valid range for this real option is 0 < mu_min and its default value is 10-11.
-\anchor OPT_recalc_y - recalc_y: Tells the algorithm to recalculate the equality and inequality multipliers as least square estimates. +\anchor OPT_adaptive_mu_globalization +adaptive_mu_globalization: Globalization strategy for the adaptive mu selection mode.
- This asks the algorithm to recompute the multipliers, whenever the current infeasibility is less than recalc_y_feas_tol. Choosing yes might be helpful in the quasi-Newton option. However, each recalculation requires an extra factorization of the linear system. If a limited memory quasi-Newton option is chosen, this is used by default. The default value for this string option is "no". + To achieve global convergence of the adaptive version, the algorithm has to switch to the monotone mode (Fiacco-McCormick approach) when convergence does not seem to appear. This option sets the criterion used to decide when to do this switch. (Only used if option "mu_strategy" is chosen as "adaptive".) The default value for this string option is "obj-constr-filter". Possible values: - - no: use the Newton step to update the multipliers - - yes: use least-square multiplier estimates + - kkt-error: nonmonotone decrease of kkt-error + - obj-constr-filter: 2-dim filter for objective and constraint violation + - never-monotone-mode: disables globalization
-\anchor OPT_recalc_y_feas_tol - recalc_y_feas_tol: Feasibility threshold for recomputation of multipliers. +\anchor OPT_adaptive_mu_kkterror_red_iters +adaptive_mu_kkterror_red_iters (advanced): Maximum number of iterations requiring sufficient progress.
- If recalc_y is chosen and the current infeasibility is less than this value, then the multipliers are recomputed. The valid range for this real option is 0 < recalc_y_feas_tol and its default value is 10-06. - + For the "kkt-error" based globalization strategy, sufficient progress must be made for "adaptive_mu_kkterror_red_iters" iterations. If this number of iterations is exceeded, the globalization strategy switches to the monotone mode. The valid range for this integer option is 0 ≤ adaptive_mu_kkterror_red_iters and its default value is 4.
-\subsection OPT_Line_Search Line Search +\anchor OPT_adaptive_mu_kkterror_red_fact +adaptive_mu_kkterror_red_fact (advanced): Sufficient decrease factor for "kkt-error" globalization strategy. +
+ For the "kkt-error" based globalization strategy, the error must decrease by this factor to be deemed sufficient decrease. The valid range for this real option is 0 < adaptive_mu_kkterror_red_fact < 1 and its default value is 0.9999. +
-\anchor OPT_max_soc - max_soc: Maximum number of second order correction trial steps at each iteration. +\anchor OPT_filter_margin_fact +filter_margin_fact (advanced): Factor determining width of margin for obj-constr-filter adaptive globalization strategy.
- Choosing 0 disables the second order corrections. (This is p^{max} of Step A-5.9 of Algorithm A in the implementation paper.) The valid range for this integer option is 0 ≤ max_soc and its default value is 4. + When using the adaptive globalization strategy, "obj-constr-filter", sufficient progress for a filter entry is defined as follows: (new obj) < (filter obj) - filter_margin_fact*(new constr-viol) OR (new constr-viol) < (filter constr-viol) - filter_margin_fact*(new constr-viol). For the description of the "kkt-error-filter" option see "filter_max_margin". The valid range for this real option is 0 < filter_margin_fact < 1 and its default value is 10-05. +
+\anchor OPT_filter_max_margin +filter_max_margin (advanced): Maximum width of margin in obj-constr-filter adaptive globalization strategy. +
+ The valid range for this real option is 0 < filter_max_margin and its default value is 1.
-\anchor OPT_watchdog_shortened_iter_trigger - watchdog_shortened_iter_trigger: Number of shortened iterations that trigger the watchdog. +\anchor OPT_adaptive_mu_restore_previous_iterate +adaptive_mu_restore_previous_iterate (advanced): Indicates if the previous accepted iterate should be restored if the monotone mode is entered.
- If the number of successive iterations in which the backtracking line search did not accept the first trial point exceeds this number, the watchdog procedure is activated. Choosing "0" here disables the watchdog procedure. The valid range for this integer option is 0 ≤ watchdog_shortened_iter_trigger and its default value is 10. + When the globalization strategy for the adaptive barrier algorithm switches to the monotone mode, it can either start from the most recent iterate (no), or from the last iterate that was accepted (yes). The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_watchdog_trial_iter_max - watchdog_trial_iter_max: Maximum number of watchdog iterations. +\anchor OPT_adaptive_mu_monotone_init_factor +adaptive_mu_monotone_init_factor (advanced): Determines the initial value of the barrier parameter when switching to the monotone mode.
- This option determines the number of trial iterations allowed before the watchdog procedure is aborted and the algorithm returns to the stored point. The valid range for this integer option is 1 ≤ watchdog_trial_iter_max and its default value is 3. - + When the globalization strategy for the adaptive barrier algorithm switches to the monotone mode and fixed_mu_oracle is chosen as "average_compl", the barrier parameter is set to the current average complementarity times the value of "adaptive_mu_monotone_init_factor". The valid range for this real option is 0 < adaptive_mu_monotone_init_factor and its default value is 0.8.
-\anchor OPT_accept_every_trial_step - accept_every_trial_step: Always accept the first trial step. +\anchor OPT_adaptive_mu_kkt_norm_type +adaptive_mu_kkt_norm_type (advanced): Norm used for the KKT error in the adaptive mu globalization strategies.
- Setting this option to "yes" essentially disables the line search and makes the algorithm take aggressive steps, without global convergence guarantees. The default value for this string option is "no". + When computing the KKT error for the globalization strategies, the norm to be used is specified with this option. Note, this option is also used in the QualityFunctionMuOracle. The default value for this string option is "2-norm-squared". Possible values: - - no: don't arbitrarily accept the full step - - yes: always accept the full step + - 1-norm: use the 1-norm (abs sum) + - 2-norm-squared: use the 2-norm squared (sum of squares) + - max-norm: use the infinity norm (max) + - 2-norm: use 2-norm
-\anchor OPT_corrector_type - corrector_type: The type of corrector steps that should be taken. +\anchor OPT_mu_strategy +mu_strategy: Update strategy for barrier parameter.
- If "mu_strategy" is "adaptive", this option determines what kind of corrector steps should be tried. Changing this option is experimental. The default value for this string option is "none". + Determines which barrier parameter update strategy is to be used. The default value for this string option is "monotone". Possible values: - - none: no corrector - - affine: corrector step towards mu=0 - - primal-dual: corrector step towards current mu + - monotone: use the monotone (Fiacco-McCormick) strategy + - adaptive: use the adaptive update strategy
-\anchor OPT_soc_method - soc_method: Ways to apply second order correction +\anchor OPT_mu_oracle +mu_oracle: Oracle for a new barrier parameter in the adaptive strategy.
- This option determins the way to apply second order correction, 0 is the method described in the implementation paper. 1 is the modified way which adds alpha on the rhs of x and s rows. The valid range for this integer option is 0 ≤ soc_method ≤ 1 and its default value is 0. + Determines how a new barrier parameter is computed in each "free-mode" iteration of the adaptive barrier parameter strategy. (Only considered if "adaptive" is selected for option "mu_strategy"). The default value for this string option is "quality-function". +Possible values: + - probing: Mehrotra's probing heuristic + - loqo: LOQO's centrality rule + - quality-function: minimize a quality function
-\subsection OPT_Warm_Start Warm Start - -\anchor OPT_warm_start_init_point - warm_start_init_point: Warm-start for initial point +\anchor OPT_fixed_mu_oracle +fixed_mu_oracle: Oracle for the barrier parameter when switching to fixed mode.
- Indicates whether this optimization should use a warm start initialization, where values of primal and dual variables are given (e.g., from a previous optimization of a related problem.) The default value for this string option is "no". + Determines how the first value of the barrier parameter should be computed when switching to the "monotone mode" in the adaptive strategy. (Only considered if "adaptive" is selected for option "mu_strategy".) The default value for this string option is "average_compl". Possible values: - - no: do not use the warm start initialization - - yes: use the warm start initialization + - probing: Mehrotra's probing heuristic + - loqo: LOQO's centrality rule + - quality-function: minimize a quality function + - average_compl: base on current average complementarity
-\anchor OPT_warm_start_bound_push - warm_start_bound_push: same as bound_push for the regular initializer. +\anchor OPT_mu_init +mu_init: Initial value for the barrier parameter.
- The valid range for this real option is 0 < warm_start_bound_push and its default value is 0.001. - + This option determines the initial value for the barrier parameter (mu). It is only relevant in the monotone, Fiacco-McCormick version of the algorithm. (i.e., if "mu_strategy" is chosen as "monotone") The valid range for this real option is 0 < mu_init and its default value is 0.1.
-\anchor OPT_warm_start_bound_frac - warm_start_bound_frac: same as bound_frac for the regular initializer. +\anchor OPT_barrier_tol_factor +barrier_tol_factor: Factor for mu in barrier stop test.
- The valid range for this real option is 0 < warm_start_bound_frac ≤ 0.5 and its default value is 0.001. - + The convergence tolerance for each barrier problem in the monotone mode is the value of the barrier parameter times "barrier_tol_factor". This option is also used in the adaptive mu strategy during the monotone mode. This is kappa_epsilon in implementation paper. The valid range for this real option is 0 < barrier_tol_factor and its default value is 10.
-\anchor OPT_warm_start_slack_bound_frac - warm_start_slack_bound_frac: same as slack_bound_frac for the regular initializer. +\anchor OPT_mu_linear_decrease_factor +mu_linear_decrease_factor: Determines linear decrease rate of barrier parameter.
- The valid range for this real option is 0 < warm_start_slack_bound_frac ≤ 0.5 and its default value is 0.001. - + For the Fiacco-McCormick update procedure the new barrier parameter mu is obtained by taking the minimum of mu*"mu_linear_decrease_factor" and mu^"superlinear_decrease_power". This is kappa_mu in implementation paper. This option is also used in the adaptive mu strategy during the monotone mode. The valid range for this real option is 0 < mu_linear_decrease_factor < 1 and its default value is 0.2.
-\anchor OPT_warm_start_slack_bound_push - warm_start_slack_bound_push: same as slack_bound_push for the regular initializer. +\anchor OPT_mu_superlinear_decrease_power +mu_superlinear_decrease_power: Determines superlinear decrease rate of barrier parameter.
- The valid range for this real option is 0 < warm_start_slack_bound_push and its default value is 0.001. - + For the Fiacco-McCormick update procedure the new barrier parameter mu is obtained by taking the minimum of mu*"mu_linear_decrease_factor" and mu^"superlinear_decrease_power". This is theta_mu in implementation paper. This option is also used in the adaptive mu strategy during the monotone mode. The valid range for this real option is 1 < mu_superlinear_decrease_power < 2 and its default value is 1.5.
-\anchor OPT_warm_start_mult_bound_push - warm_start_mult_bound_push: same as mult_bound_push for the regular initializer. +\anchor OPT_mu_allow_fast_monotone_decrease +mu_allow_fast_monotone_decrease (advanced): Allow skipping of barrier problem if barrier test is already met.
- The valid range for this real option is 0 < warm_start_mult_bound_push and its default value is 0.001. + The default value for this string option is "yes". +Possible values: + - no: Take at least one iteration per barrier problem even if the barrier test is already met for the updated barrier parameter + - yes: Allow fast decrease of mu if barrier test it met
-\anchor OPT_warm_start_mult_init_max - warm_start_mult_init_max: Maximum initial value for the equality multipliers. +\anchor OPT_tau_min +tau_min (advanced): Lower bound on fraction-to-the-boundary parameter tau.
- The valid range for this real option is unrestricted and its default value is 10+06. - + This is tau_min in the implementation paper. This option is also used in the adaptive mu strategy during the monotone mode. The valid range for this real option is 0 < tau_min < 1 and its default value is 0.99.
-\subsection OPT_Restoration_Phase Restoration Phase - -\anchor OPT_expect_infeasible_problem - expect_infeasible_problem: Enable heuristics to quickly detect an infeasible problem. +\anchor OPT_sigma_max +sigma_max (advanced): Maximum value of the centering parameter.
- This options is meant to activate heuristics that may speed up the infeasibility determination if you expect that there is a good chance for the problem to be infeasible. In the filter line search procedure, the restoration phase is called more quickly than usually, and more reduction in the constraint violation is enforced before the restoration phase is left. If the problem is square, this option is enabled automatically. The default value for this string option is "no". - -Possible values: - - no: the problem probably be feasible - - yes: the problem has a good chance to be infeasible + This is the upper bound for the centering parameter chosen by the quality function based barrier parameter update. Only used if option "mu_oracle" is set to "quality-function". The valid range for this real option is 0 < sigma_max and its default value is 100.
-\anchor OPT_expect_infeasible_problem_ctol - expect_infeasible_problem_ctol: Threshold for disabling "expect_infeasible_problem" option. +\anchor OPT_sigma_min +sigma_min (advanced): Minimum value of the centering parameter.
- If the constraint violation becomes smaller than this threshold, the "expect_infeasible_problem" heuristics in the filter line search are disabled. If the problem is square, this options is set to 0. The valid range for this real option is 0 ≤ expect_infeasible_problem_ctol and its default value is 0.001. - + This is the lower bound for the centering parameter chosen by the quality function based barrier parameter update. Only used if option "mu_oracle" is set to "quality-function". The valid range for this real option is 0 ≤ sigma_min and its default value is 10-06.
-\anchor OPT_expect_infeasible_problem_ytol - expect_infeasible_problem_ytol: Multiplier threshold for activating "expect_infeasible_problem" option. +\anchor OPT_quality_function_norm_type +quality_function_norm_type (advanced): Norm used for components of the quality function.
- If the max norm of the constraint multipliers becomes larger than this value and "expect_infeasible_problem" is chosen, then the restoration phase is entered. The valid range for this real option is 0 < expect_infeasible_problem_ytol and its default value is 10+08. + Only used if option "mu_oracle" is set to "quality-function". The default value for this string option is "2-norm-squared". +Possible values: + - 1-norm: use the 1-norm (abs sum) + - 2-norm-squared: use the 2-norm squared (sum of squares) + - max-norm: use the infinity norm (max) + - 2-norm: use 2-norm
-\anchor OPT_start_with_resto - start_with_resto: Tells algorithm to switch to restoration phase in first iteration. +\anchor OPT_quality_function_centrality +quality_function_centrality (advanced): The penalty term for centrality that is included in quality function.
- Setting this option to "yes" forces the algorithm to switch to the feasibility restoration phase in the first iteration. If the initial point is feasible, the algorithm will abort with a failure. The default value for this string option is "no". + This determines whether a term is added to the quality function to penalize deviation from centrality with respect to complementarity. The complementarity measure here is the xi in the Loqo update rule. Only used if option "mu_oracle" is set to "quality-function". The default value for this string option is "none". Possible values: - - no: don't force start in restoration phase - - yes: force start in restoration phase + - none: no penalty term is added + - log: complementarity * the log of the centrality measure + - reciprocal: complementarity * the reciprocal of the centrality measure + - cubed-reciprocal: complementarity * the reciprocal of the centrality measure cubed
-\anchor OPT_soft_resto_pderror_reduction_factor - soft_resto_pderror_reduction_factor: Required reduction in primal-dual error in the soft restoration phase. +\anchor OPT_quality_function_balancing_term +quality_function_balancing_term (advanced): The balancing term included in the quality function for centrality.
- The soft restoration phase attempts to reduce the primal-dual error with regular steps. If the damped primal-dual step (damped only to satisfy the fraction-to-the-boundary rule) is not decreasing the primal-dual error by at least this factor, then the regular restoration phase is called. Choosing "0" here disables the soft restoration phase. The valid range for this real option is 0 ≤ soft_resto_pderror_reduction_factor and its default value is 0.9999. + This determines whether a term is added to the quality function that penalizes situations where the complementarity is much smaller than dual and primal infeasibilities. Only used if option "mu_oracle" is set to "quality-function". The default value for this string option is "none". +Possible values: + - none: no balancing term is added + - cubic: Max(0,Max(dual_inf,primal_inf)-compl)^3
-\anchor OPT_required_infeasibility_reduction - required_infeasibility_reduction: Required reduction of infeasibility before leaving restoration phase. +\anchor OPT_quality_function_max_section_steps +quality_function_max_section_steps: Maximum number of search steps during direct search procedure determining the optimal centering parameter.
- The restoration phase algorithm is performed, until a point is found that is acceptable to the filter and the infeasibility has been reduced by at least the fraction given by this option. The valid range for this real option is 0 ≤ required_infeasibility_reduction < 1 and its default value is 0.9. - + The golden section search is performed for the quality function based mu oracle. Only used if option "mu_oracle" is set to "quality-function". The valid range for this integer option is 0 ≤ quality_function_max_section_steps and its default value is 8.
-\anchor OPT_bound_mult_reset_threshold - bound_mult_reset_threshold: Threshold for resetting bound multipliers after the restoration phase. +\anchor OPT_quality_function_section_sigma_tol +quality_function_section_sigma_tol (advanced): Tolerance for the section search procedure determining the optimal centering parameter (in sigma space).
- After returning from the restoration phase, the bound multipliers are updated with a Newton step for complementarity. Here, the change in the primal variables during the entire restoration phase is taken to be the corresponding primal Newton step. However, if after the update the largest bound multiplier exceeds the threshold specified by this option, the multipliers are all reset to 1. The valid range for this real option is 0 ≤ bound_mult_reset_threshold and its default value is 1000. - + The golden section search is performed for the quality function based mu oracle. Only used if option "mu_oracle" is set to "quality-function". The valid range for this real option is 0 ≤ quality_function_section_sigma_tol < 1 and its default value is 0.01.
-\anchor OPT_constr_mult_reset_threshold - constr_mult_reset_threshold: Threshold for resetting equality and inequality multipliers after restoration phase. +\anchor OPT_quality_function_section_qf_tol +quality_function_section_qf_tol (advanced): Tolerance for the golden section search procedure determining the optimal centering parameter (in the function value space).
- After returning from the restoration phase, the constraint multipliers are recomputed by a least square estimate. This option triggers when those least-square estimates should be ignored. The valid range for this real option is 0 ≤ constr_mult_reset_threshold and its default value is 0. - + The golden section search is performed for the quality function based mu oracle. Only used if option "mu_oracle" is set to "quality-function". The valid range for this real option is 0 ≤ quality_function_section_qf_tol < 1 and its default value is 0.
-\anchor OPT_evaluate_orig_obj_at_resto_trial - evaluate_orig_obj_at_resto_trial: Determines if the original objective function should be evaluated at restoration phase trial points. + +\subsection OPT_Line_Search Line Search + +\anchor OPT_line_search_method +line_search_method (advanced): Globalization method used in backtracking line search
- Setting this option to "yes" makes the restoration phase algorithm evaluate the objective function of the original problem at every trial point encountered during the restoration phase, even if this value is not required. In this way, it is guaranteed that the original objective function can be evaluated without error at all accepted iterates; otherwise the algorithm might fail at a point where the restoration phase accepts an iterate that is good for the restoration phase problem, but not the original problem. On the other hand, if the evaluation of the original objective is expensive, this might be costly. The default value for this string option is "yes". + Only the "filter" choice is officially supported. But sometimes, good results might be obtained with the other choices. The default value for this string option is "filter". Possible values: - - no: skip evaluation - - yes: evaluate at every trial point + - filter: Filter method + - cg-penalty: Chen-Goldfarb penalty function + - penalty: Standard penalty function
-\subsection OPT_Linear_Solver Linear Solver +\anchor OPT_alpha_red_factor +alpha_red_factor (advanced): Fractional reduction of the trial step size in the backtracking line search. +
+ At every step of the backtracking line search, the trial step size is reduced by this factor. The valid range for this real option is 0 < alpha_red_factor < 1 and its default value is 0.5. +
-\anchor OPT_linear_solver - linear_solver: Linear solver used for step computations. +\anchor OPT_accept_every_trial_step +accept_every_trial_step: Always accept the first trial step.
- Determines which linear algebra package is to be used for the solution of the augmented linear system (for obtaining the search directions). Note, the code must have been compiled with the linear solver you want to choose. Depending on your Ipopt installation, not all options are available. The default value for this string option is "ma27". + Setting this option to "yes" essentially disables the line search and makes the algorithm take aggressive steps, without global convergence guarantees. The default value for this string option is "no". -Possible values: - - ma27: use the Harwell routine MA27 - - ma57: use the Harwell routine MA57 - - ma77: use the Harwell routine HSL_MA77 - - ma86: use the Harwell routine HSL_MA86 - - ma97: use the Harwell routine HSL_MA97 - - pardiso: use the Pardiso package - - wsmp: use WSMP package - - mumps: use MUMPS package - - custom: use custom linear solver +Possible values: yes, no
-\anchor OPT_linear_system_scaling - linear_system_scaling: Method for scaling the linear system. +\anchor OPT_accept_after_max_steps +accept_after_max_steps (advanced): Accept a trial point after maximal this number of steps even if it does not satisfy line search conditions.
- Determines the method used to compute symmetric scaling factors for the augmented system (see also the "linear_scaling_on_demand" option). This scaling is independent of the NLP problem scaling. By default, MC19 is only used if MA27 or MA57 are selected as linear solvers. This value is only available if Ipopt has been compiled with MC19. The default value for this string option is "mc19". - -Possible values: - - none: no scaling will be performed - - mc19: use the Harwell routine MC19 - - slack-based: use the slack values + Setting this to -1 disables this option. The valid range for this integer option is -1 ≤ accept_after_max_steps and its default value is -1.
-\anchor OPT_linear_scaling_on_demand - linear_scaling_on_demand: Flag indicating that linear scaling is only done if it seems required. +\anchor OPT_alpha_for_y +alpha_for_y: Method to determine the step size for constraint multipliers (alpha_y) .
- This option is only important if a linear scaling method (e.g., mc19) is used. If you choose "no", then the scaling factors are computed for every linear system from the start. This can be quite expensive. Choosing "yes" means that the algorithm will start the scaling method only when the solutions to the linear system seem not good, and then use it until the end. The default value for this string option is "yes". + The default value for this string option is "primal". Possible values: - - no: Always scale the linear system. - - yes: Start using linear system scaling if solutions seem not good. + - primal: use primal step size + - bound-mult: use step size for the bound multipliers (good for LPs) + - min: use the min of primal and bound multipliers + - max: use the max of primal and bound multipliers + - full: take a full step of size one + - min-dual-infeas: choose step size minimizing new dual infeasibility + - safer-min-dual-infeas: like "min_dual_infeas", but safeguarded by "min" and "max" + - primal-and-full: use the primal step size, and full step if delta_x <= alpha_for_y_tol + - dual-and-full: use the dual step size, and full step if delta_x <= alpha_for_y_tol + - acceptor: Call LSAcceptor to get step size for y
-\anchor OPT_max_refinement_steps - max_refinement_steps: Maximum number of iterative refinement steps per linear system solve. +\anchor OPT_alpha_for_y_tol +alpha_for_y_tol: Tolerance for switching to full equality multiplier steps.
- Iterative refinement (on the full unsymmetric system) is performed for each right hand side. This option determines the maximum number of iterative refinement steps. The valid range for this integer option is 0 ≤ max_refinement_steps and its default value is 10. - + This is only relevant if "alpha_for_y" is chosen "primal-and-full" or "dual-and-full". The step size for the equality constraint multipliers is taken to be one if the max-norm of the primal step is less than this tolerance. The valid range for this real option is 0 ≤ alpha_for_y_tol and its default value is 10.
-\anchor OPT_min_refinement_steps - min_refinement_steps: Minimum number of iterative refinement steps per linear system solve. +\anchor OPT_tiny_step_tol +tiny_step_tol (advanced): Tolerance for detecting numerically insignificant steps.
- Iterative refinement (on the full unsymmetric system) is performed for each right hand side. This option determines the minimum number of iterative refinements (i.e. at least "min_refinement_steps" iterative refinement steps are enforced per right hand side.) The valid range for this integer option is 0 ≤ min_refinement_steps and its default value is 1. - + If the search direction in the primal variables (x and s) is, in relative terms for each component, less than this value, the algorithm accepts the full step without line search. If this happens repeatedly, the algorithm will terminate with a corresponding exit message. The default value is 10 times machine precision. The valid range for this real option is 0 ≤ tiny_step_tol and its default value is 2.22045 · 10-15.
-\anchor OPT_neg_curv_test_reg - neg_curv_test_reg: Whether to do the curvature test with the primal regularization (see Zavala and Chiang, 2014). +\anchor OPT_tiny_step_y_tol +tiny_step_y_tol (advanced): Tolerance for quitting because of numerically insignificant steps.
- The default value for this string option is "yes". - -Possible values: - - yes: use primal regularization with the inertia-free curvature test - - no: use original IPOPT approach, in which the primal regularization is ignored + If the search direction in the primal variables (x and s) is, in relative terms for each component, repeatedly less than tiny_step_tol, and the step in the y variables is smaller than this threshold, the algorithm will terminate. The valid range for this real option is 0 ≤ tiny_step_y_tol and its default value is 0.01.
-\anchor OPT_neg_curv_test_tol - neg_curv_test_tol: Tolerance for heuristic to ignore wrong inertia. +\anchor OPT_watchdog_shortened_iter_trigger +watchdog_shortened_iter_trigger: Number of shortened iterations that trigger the watchdog.
- If nonzero, incorrect inertia in the augmented system is ignored, and Ipopt tests if the direction is a direction of positive curvature. This tolerance is alpha_n in the paper by Zavala and Chiang (2014) and it determines when the direction is considered to be sufficiently positive. A value in the range of [1e-12, 1e-11] is recommended. The valid range for this real option is 0 ≤ neg_curv_test_tol and its default value is 0. - + If the number of successive iterations in which the backtracking line search did not accept the first trial point exceeds this number, the watchdog procedure is activated. Choosing "0" here disables the watchdog procedure. The valid range for this integer option is 0 ≤ watchdog_shortened_iter_trigger and its default value is 10.
-\subsection OPT_Hessian_Perturbation Hessian Perturbation - -\anchor OPT_max_hessian_perturbation - max_hessian_perturbation: Maximum value of regularization parameter for handling negative curvature. +\anchor OPT_watchdog_trial_iter_max +watchdog_trial_iter_max: Maximum number of watchdog iterations.
- In order to guarantee that the search directions are indeed proper descent directions, Ipopt requires that the inertia of the (augmented) linear system for the step computation has the correct number of negative and positive eigenvalues. The idea is that this guides the algorithm away from maximizers and makes Ipopt more likely converge to first order optimal points that are minimizers. If the inertia is not correct, a multiple of the identity matrix is added to the Hessian of the Lagrangian in the augmented system. This parameter gives the maximum value of the regularization parameter. If a regularization of that size is not enough, the algorithm skips this iteration and goes to the restoration phase. (This is delta_w^max in the implementation paper.) The valid range for this real option is 0 < max_hessian_perturbation and its default value is 10+20. - + This option determines the number of trial iterations allowed before the watchdog procedure is aborted and the algorithm returns to the stored point. The valid range for this integer option is 1 ≤ watchdog_trial_iter_max and its default value is 3.
-\anchor OPT_min_hessian_perturbation - min_hessian_perturbation: Smallest perturbation of the Hessian block. +\anchor OPT_theta_max_fact +theta_max_fact (advanced): Determines upper bound for constraint violation in the filter.
- The size of the perturbation of the Hessian block is never selected smaller than this value, unless no perturbation is necessary. (This is delta_w^min in implementation paper.) The valid range for this real option is 0 ≤ min_hessian_perturbation and its default value is 10-20. - + The algorithmic parameter theta_max is determined as theta_max_fact times the maximum of 1 and the constraint violation at initial point. Any point with a constraint violation larger than theta_max is unacceptable to the filter (see Eqn. (21) in the implementation paper). The valid range for this real option is 0 < theta_max_fact and its default value is 10000.
-\anchor OPT_first_hessian_perturbation - first_hessian_perturbation: Size of first x-s perturbation tried. +\anchor OPT_theta_min_fact +theta_min_fact (advanced): Determines constraint violation threshold in the switching rule.
- The first value tried for the x-s perturbation in the inertia correction scheme.(This is delta_0 in the implementation paper.) The valid range for this real option is 0 < first_hessian_perturbation and its default value is 0.0001. - + The algorithmic parameter theta_min is determined as theta_min_fact times the maximum of 1 and the constraint violation at initial point. The switching rule treats an iteration as an h-type iteration whenever the current constraint violation is larger than theta_min (see paragraph before Eqn. (19) in the implementation paper). The valid range for this real option is 0 < theta_min_fact and its default value is 0.0001.
-\anchor OPT_perturb_inc_fact_first - perturb_inc_fact_first: Increase factor for x-s perturbation for very first perturbation. +\anchor OPT_eta_phi +eta_phi (advanced): Relaxation factor in the Armijo condition.
- The factor by which the perturbation is increased when a trial value was not sufficient - this value is used for the computation of the very first perturbation and allows a different value for the first perturbation than that used for the remaining perturbations. (This is bar_kappa_w^+ in the implementation paper.) The valid range for this real option is 1 < perturb_inc_fact_first and its default value is 100. - + See Eqn. (20) in the implementation paper. The valid range for this real option is 0 < eta_phi < 0.5 and its default value is 10-08.
-\anchor OPT_perturb_inc_fact - perturb_inc_fact: Increase factor for x-s perturbation. +\anchor OPT_delta +delta (advanced): Multiplier for constraint violation in the switching rule.
- The factor by which the perturbation is increased when a trial value was not sufficient - this value is used for the computation of all perturbations except for the first. (This is kappa_w^+ in the implementation paper.) The valid range for this real option is 1 < perturb_inc_fact and its default value is 8. - + See Eqn. (19) in the implementation paper. The valid range for this real option is 0 < delta and its default value is 1.
-\anchor OPT_perturb_dec_fact - perturb_dec_fact: Decrease factor for x-s perturbation. +\anchor OPT_s_phi +s_phi (advanced): Exponent for linear barrier function model in the switching rule.
- The factor by which the perturbation is decreased when a trial value is deduced from the size of the most recent successful perturbation. (This is kappa_w^- in the implementation paper.) The valid range for this real option is 0 < perturb_dec_fact < 1 and its default value is 0.333333. - + See Eqn. (19) in the implementation paper. The valid range for this real option is 1 < s_phi and its default value is 2.3.
-\anchor OPT_jacobian_regularization_value - jacobian_regularization_value: Size of the regularization for rank-deficient constraint Jacobians. +\anchor OPT_s_theta +s_theta (advanced): Exponent for current constraint violation in the switching rule.
- (This is bar delta_c in the implementation paper.) The valid range for this real option is 0 ≤ jacobian_regularization_value and its default value is 10-08. - + See Eqn. (19) in the implementation paper. The valid range for this real option is 1 < s_theta and its default value is 1.1.
-\subsection OPT_Quasi-Newton Quasi-Newton +\anchor OPT_gamma_phi +gamma_phi (advanced): Relaxation factor in the filter margin for the barrier function. +
+ See Eqn. (18a) in the implementation paper. The valid range for this real option is 0 < gamma_phi < 1 and its default value is 10-08. +
+ +\anchor OPT_gamma_theta +gamma_theta (advanced): Relaxation factor in the filter margin for the constraint violation. +
+ See Eqn. (18b) in the implementation paper. The valid range for this real option is 0 < gamma_theta < 1 and its default value is 10-05. +
+ +\anchor OPT_alpha_min_frac +alpha_min_frac (advanced): Safety factor for the minimal step size (before switching to restoration phase). +
+ This is gamma_alpha in Eqn. (23) in the implementation paper. The valid range for this real option is 0 < alpha_min_frac < 1 and its default value is 0.05. +
+ +\anchor OPT_max_soc +max_soc: Maximum number of second order correction trial steps at each iteration. +
+ Choosing 0 disables the second order corrections. This is p^{max} of Step A-5.9 of Algorithm A in the implementation paper. The valid range for this integer option is 0 ≤ max_soc and its default value is 4. +
+ +\anchor OPT_kappa_soc +kappa_soc (advanced): Factor in the sufficient reduction rule for second order correction. +
+ This option determines how much a second order correction step must reduce the constraint violation so that further correction steps are attempted. See Step A-5.9 of Algorithm A in the implementation paper. The valid range for this real option is 0 < kappa_soc and its default value is 0.99. +
+ +\anchor OPT_obj_max_inc +obj_max_inc (advanced): Determines the upper bound on the acceptable increase of barrier objective function. +
+ Trial points are rejected if they lead to an increase in the barrier objective function by more than obj_max_inc orders of magnitude. The valid range for this real option is 1 < obj_max_inc and its default value is 5. +
+ +\anchor OPT_max_filter_resets +max_filter_resets (advanced): Maximal allowed number of filter resets +
+ A positive number enables a heuristic that resets the filter, whenever in more than "filter_reset_trigger" successive iterations the last rejected trial steps size was rejected because of the filter. This option determine the maximal number of resets that are allowed to take place. The valid range for this integer option is 0 ≤ max_filter_resets and its default value is 5. +
+ +\anchor OPT_filter_reset_trigger +filter_reset_trigger (advanced): Number of iterations that trigger the filter reset. +
+ If the filter reset heuristic is active and the number of successive iterations in which the last rejected trial step size was rejected because of the filter, the filter is reset. The valid range for this integer option is 1 ≤ filter_reset_trigger and its default value is 5. +
+ +\anchor OPT_corrector_type +corrector_type (advanced): The type of corrector steps that should be taken. +
+ If "mu_strategy" is "adaptive", this option determines what kind of corrector steps should be tried. Changing this option is experimental. The default value for this string option is "none". + +Possible values: + - none: no corrector + - affine: corrector step towards mu=0 + - primal-dual: corrector step towards current mu +
+ +\anchor OPT_skip_corr_if_neg_curv +skip_corr_if_neg_curv (advanced): Whether to skip the corrector step in negative curvature iteration. +
+ The corrector step is not tried if negative curvature has been encountered during the computation of the search direction in the current iteration. This option is only used if "mu_strategy" is "adaptive". Changing this option is experimental. The default value for this string option is "yes". + +Possible values: yes, no +
+ +\anchor OPT_skip_corr_in_monotone_mode +skip_corr_in_monotone_mode (advanced): Whether to skip the corrector step during monotone barrier parameter mode. +
+ The corrector step is not tried if the algorithm is currently in the monotone mode (see also option "barrier_strategy"). This option is only used if "mu_strategy" is "adaptive". Changing this option is experimental. The default value for this string option is "yes". + +Possible values: yes, no +
+ +\anchor OPT_corrector_compl_avrg_red_fact +corrector_compl_avrg_red_fact (advanced): Complementarity tolerance factor for accepting corrector step. +
+ This option determines the factor by which complementarity is allowed to increase for a corrector step to be accepted. Changing this option is experimental. The valid range for this real option is 0 < corrector_compl_avrg_red_fact and its default value is 1. +
+ +\anchor OPT_soc_method +soc_method: Ways to apply second order correction +
+ This option determines the way to apply second order correction, 0 is the method described in the implementation paper. 1 is the modified way which adds alpha on the rhs of x and s rows. The valid range for this integer option is 0 ≤ soc_method ≤ 1 and its default value is 0. +
+ +\anchor OPT_nu_init +nu_init (advanced): Initial value of the penalty parameter. +
+ The valid range for this real option is 0 < nu_init and its default value is 10-06. +
+ +\anchor OPT_nu_inc +nu_inc (advanced): Increment of the penalty parameter. +
+ The valid range for this real option is 0 < nu_inc and its default value is 0.0001. +
+ +\anchor OPT_rho +rho (advanced): Value in penalty parameter update formula. +
+ The valid range for this real option is 0 < rho < 1 and its default value is 0.1. +
+ +\anchor OPT_kappa_sigma +kappa_sigma (advanced): Factor limiting the deviation of dual variables from primal estimates. +
+ If the dual variables deviate from their primal estimates, a correction is performed. See Eqn. (16) in the implementation paper. Setting the value to less than 1 disables the correction. The valid range for this real option is 0 < kappa_sigma and its default value is 10+10. +
+ +\anchor OPT_recalc_y +recalc_y: Tells the algorithm to recalculate the equality and inequality multipliers as least square estimates. +
+ This asks the algorithm to recompute the multipliers, whenever the current infeasibility is less than recalc_y_feas_tol. Choosing yes might be helpful in the quasi-Newton option. However, each recalculation requires an extra factorization of the linear system. If a limited memory quasi-Newton option is chosen, this is used by default. The default value for this string option is "no". + +Possible values: + - no: use the Newton step to update the multipliers + - yes: use least-square multiplier estimates +
+ +\anchor OPT_recalc_y_feas_tol +recalc_y_feas_tol: Feasibility threshold for recomputation of multipliers. +
+ If recalc_y is chosen and the current infeasibility is less than this value, then the multipliers are recomputed. The valid range for this real option is 0 < recalc_y_feas_tol and its default value is 10-06. +
+ +\anchor OPT_slack_move +slack_move (advanced): Correction size for very small slacks. +
+ Due to numerical issues or the lack of an interior, the slack variables might become very small. If a slack becomes very small compared to machine precision, the corresponding bound is moved slightly. This parameter determines how large the move should be. Its default value is mach_eps^{3/4}. See also end of Section 3.5 in implementation paper - but actual implementation might be somewhat different. The valid range for this real option is 0 ≤ slack_move and its default value is 1.81899 · 10-12. +
+ +\anchor OPT_constraint_violation_norm_type +constraint_violation_norm_type (advanced): Norm to be used for the constraint violation in the line search. +
+ Determines which norm should be used when the algorithm computes the constraint violation in the line search. The default value for this string option is "1-norm". + +Possible values: + - 1-norm: use the 1-norm + - 2-norm: use the 2-norm + - max-norm: use the infinity norm +
+ + +\subsection OPT_Linear_Solver Linear Solver + +\anchor OPT_linear_solver +linear_solver: Linear solver used for step computations. +
+ Determines which linear algebra package is to be used for the solution of the augmented linear system (for obtaining the search directions). The default value for this string option is "ma27". + +Possible values: + - ma27: use the Harwell routine MA27 + - ma57: use the Harwell routine MA57 + - ma77: use the Harwell routine HSL_MA77 + - ma86: use the Harwell routine HSL_MA86 + - ma97: use the Harwell routine HSL_MA97 + - pardiso: use the Pardiso package from pardiso-project.org + - pardisomkl: use the Pardiso package from Intel MKL + - spral: use the Spral package + - wsmp: use the Wsmp package + - mumps: use the Mumps package + - custom: use custom linear solver (expert use) +
+ +\anchor OPT_linear_system_scaling +linear_system_scaling: Method for scaling the linear system. +
+ Determines the method used to compute symmetric scaling factors for the augmented system (see also the "linear_scaling_on_demand" option). This scaling is independent of the NLP problem scaling. The default is MC19 only if MA27, MA57, MA77, or MA86 are selected as linear solvers. Otherwise it is 'none'. The default value for this string option is "mc19". + +Possible values: + - none: no scaling will be performed + - mc19: use the Harwell routine MC19 + - slack-based: use the slack values +
+ +\anchor OPT_hsllib +hsllib: Name of library containing HSL routines for load at runtime +
+ The default value for this string option is "libhsl.so" ("libhsl.dylib" on macOS, "libhsl.dll" on Windows). + +Possible values: + - *: Any acceptable filename (may contain path, too) +
+ +\anchor OPT_pardisolib +pardisolib: Name of library containing Pardiso routines (from pardiso-project.org) for load at runtime +
+ The default value for this string option is "/home/stefan/work/coin/libpardiso600-GNU800-X86-64.so". + +Possible values: + - *: Any acceptable filename (may contain path, too) +
+ +\anchor OPT_linear_scaling_on_demand +linear_scaling_on_demand: Flag indicating that linear scaling is only done if it seems required. +
+ This option is only important if a linear scaling method (e.g., mc19) is used. If you choose "no", then the scaling factors are computed for every linear system from the start. This can be quite expensive. Choosing "yes" means that the algorithm will start the scaling method only when the solutions to the linear system seem not good, and then use it until the end. The default value for this string option is "yes". + +Possible values: yes, no +
+ + +\subsection OPT_Step_Calculation Step Calculation + +\anchor OPT_mehrotra_algorithm +mehrotra_algorithm: Indicates whether to do Mehrotra's predictor-corrector algorithm. +
+ If enabled, line search is disabled and the (unglobalized) adaptive mu strategy is chosen with the "probing" oracle, and "corrector_type=affine" is used without any safeguards; you should not set any of those options explicitly in addition. Also, unless otherwise specified, the values of "bound_push", "bound_frac", and "bound_mult_init_val" are set more aggressive, and sets "alpha_for_y=bound_mult". The Mehrotra's predictor-corrector algorithm works usually very well for LPs and convex QPs. The default value for this string option is "no". + +Possible values: yes, no +
+ +\anchor OPT_fast_step_computation +fast_step_computation: Indicates if the linear system should be solved quickly. +
+ If enabled, the algorithm assumes that the linear system that is solved to obtain the search direction is solved sufficiently well. In that case, no residuals are computed to verify the solution and the computation of the search direction is a little faster. The default value for this string option is "no". + +Possible values: yes, no +
+ +\anchor OPT_min_refinement_steps +min_refinement_steps: Minimum number of iterative refinement steps per linear system solve. +
+ Iterative refinement (on the full unsymmetric system) is performed for each right hand side. This option determines the minimum number of iterative refinements (i.e. at least "min_refinement_steps" iterative refinement steps are enforced per right hand side.) The valid range for this integer option is 0 ≤ min_refinement_steps and its default value is 1. +
+ +\anchor OPT_max_refinement_steps +max_refinement_steps: Maximum number of iterative refinement steps per linear system solve. +
+ Iterative refinement (on the full unsymmetric system) is performed for each right hand side. This option determines the maximum number of iterative refinement steps. The valid range for this integer option is 0 ≤ max_refinement_steps and its default value is 10. +
+ +\anchor OPT_residual_ratio_max +residual_ratio_max (advanced): Iterative refinement tolerance +
+ Iterative refinement is performed until the residual test ratio is less than this tolerance (or until "max_refinement_steps" refinement steps are performed). The valid range for this real option is 0 < residual_ratio_max and its default value is 10-10. +
+ +\anchor OPT_residual_ratio_singular +residual_ratio_singular (advanced): Threshold for declaring linear system singular after failed iterative refinement. +
+ If the residual test ratio is larger than this value after failed iterative refinement, the algorithm pretends that the linear system is singular. The valid range for this real option is 0 < residual_ratio_singular and its default value is 10-05. +
+ +\anchor OPT_residual_improvement_factor +residual_improvement_factor (advanced): Minimal required reduction of residual test ratio in iterative refinement. +
+ If the improvement of the residual test ratio made by one iterative refinement step is not better than this factor, iterative refinement is aborted. The valid range for this real option is 0 < residual_improvement_factor and its default value is 1. +
+ +\anchor OPT_neg_curv_test_tol +neg_curv_test_tol: Tolerance for heuristic to ignore wrong inertia. +
+ If nonzero, incorrect inertia in the augmented system is ignored, and Ipopt tests if the direction is a direction of positive curvature. This tolerance is alpha_n in the paper by Zavala and Chiang (2014) and it determines when the direction is considered to be sufficiently positive. A value in the range of [1e-12, 1e-11] is recommended. The valid range for this real option is 0 ≤ neg_curv_test_tol and its default value is 0. +
+ +\anchor OPT_neg_curv_test_reg +neg_curv_test_reg: Whether to do the curvature test with the primal regularization (see Zavala and Chiang, 2014). +
+ The default value for this string option is "yes". + +Possible values: + - yes: use primal regularization with the inertia-free curvature test + - no: use original IPOPT approach, in which the primal regularization is ignored +
+ +\anchor OPT_max_hessian_perturbation +max_hessian_perturbation: Maximum value of regularization parameter for handling negative curvature. +
+ In order to guarantee that the search directions are indeed proper descent directions, Ipopt requires that the inertia of the (augmented) linear system for the step computation has the correct number of negative and positive eigenvalues. The idea is that this guides the algorithm away from maximizers and makes Ipopt more likely converge to first order optimal points that are minimizers. If the inertia is not correct, a multiple of the identity matrix is added to the Hessian of the Lagrangian in the augmented system. This parameter gives the maximum value of the regularization parameter. If a regularization of that size is not enough, the algorithm skips this iteration and goes to the restoration phase. This is delta_w^max in the implementation paper. The valid range for this real option is 0 < max_hessian_perturbation and its default value is 10+20. +
+ +\anchor OPT_min_hessian_perturbation +min_hessian_perturbation: Smallest perturbation of the Hessian block. +
+ The size of the perturbation of the Hessian block is never selected smaller than this value, unless no perturbation is necessary. This is delta_w^min in implementation paper. The valid range for this real option is 0 ≤ min_hessian_perturbation and its default value is 10-20. +
+ +\anchor OPT_perturb_inc_fact_first +perturb_inc_fact_first: Increase factor for x-s perturbation for very first perturbation. +
+ The factor by which the perturbation is increased when a trial value was not sufficient - this value is used for the computation of the very first perturbation and allows a different value for the first perturbation than that used for the remaining perturbations. This is bar_kappa_w^+ in the implementation paper. The valid range for this real option is 1 < perturb_inc_fact_first and its default value is 100. +
+ +\anchor OPT_perturb_inc_fact +perturb_inc_fact: Increase factor for x-s perturbation. +
+ The factor by which the perturbation is increased when a trial value was not sufficient - this value is used for the computation of all perturbations except for the first. This is kappa_w^+ in the implementation paper. The valid range for this real option is 1 < perturb_inc_fact and its default value is 8. +
+ +\anchor OPT_perturb_dec_fact +perturb_dec_fact: Decrease factor for x-s perturbation. +
+ The factor by which the perturbation is decreased when a trial value is deduced from the size of the most recent successful perturbation. This is kappa_w^- in the implementation paper. The valid range for this real option is 0 < perturb_dec_fact < 1 and its default value is 0.333333. +
+ +\anchor OPT_first_hessian_perturbation +first_hessian_perturbation: Size of first x-s perturbation tried. +
+ The first value tried for the x-s perturbation in the inertia correction scheme. This is delta_0 in the implementation paper. The valid range for this real option is 0 < first_hessian_perturbation and its default value is 0.0001. +
+ +\anchor OPT_jacobian_regularization_value +jacobian_regularization_value: Size of the regularization for rank-deficient constraint Jacobians. +
+ This is bar delta_c in the implementation paper. The valid range for this real option is 0 ≤ jacobian_regularization_value and its default value is 10-08. +
+ +\anchor OPT_jacobian_regularization_exponent +jacobian_regularization_exponent (advanced): Exponent for mu in the regularization for rank-deficient constraint Jacobians. +
+ This is kappa_c in the implementation paper. The valid range for this real option is 0 ≤ jacobian_regularization_exponent and its default value is 0.25. +
+ +\anchor OPT_perturb_always_cd +perturb_always_cd (advanced): Active permanent perturbation of constraint linearization. +
+ Enabling this option leads to using the delta_c and delta_d perturbation for the computation of every search direction. Usually, it is only used when the iteration matrix is singular. The default value for this string option is "no". + +Possible values: yes, no +
+ + +\subsection OPT_Restoration_Phase Restoration Phase + +\anchor OPT_expect_infeasible_problem +expect_infeasible_problem: Enable heuristics to quickly detect an infeasible problem. +
+ This options is meant to activate heuristics that may speed up the infeasibility determination if you expect that there is a good chance for the problem to be infeasible. In the filter line search procedure, the restoration phase is called more quickly than usually, and more reduction in the constraint violation is enforced before the restoration phase is left. If the problem is square, this option is enabled automatically. The default value for this string option is "no". + +Possible values: yes, no +
+ +\anchor OPT_expect_infeasible_problem_ctol +expect_infeasible_problem_ctol: Threshold for disabling "expect_infeasible_problem" option. +
+ If the constraint violation becomes smaller than this threshold, the "expect_infeasible_problem" heuristics in the filter line search are disabled. If the problem is square, this options is set to 0. The valid range for this real option is 0 ≤ expect_infeasible_problem_ctol and its default value is 0.001. +
+ +\anchor OPT_expect_infeasible_problem_ytol +expect_infeasible_problem_ytol: Multiplier threshold for activating "expect_infeasible_problem" option. +
+ If the max norm of the constraint multipliers becomes larger than this value and "expect_infeasible_problem" is chosen, then the restoration phase is entered. The valid range for this real option is 0 < expect_infeasible_problem_ytol and its default value is 10+08. +
+ +\anchor OPT_start_with_resto +start_with_resto: Whether to switch to restoration phase in first iteration. +
+ Setting this option to "yes" forces the algorithm to switch to the feasibility restoration phase in the first iteration. If the initial point is feasible, the algorithm will abort with a failure. The default value for this string option is "no". + +Possible values: yes, no +
+ +\anchor OPT_soft_resto_pderror_reduction_factor +soft_resto_pderror_reduction_factor: Required reduction in primal-dual error in the soft restoration phase. +
+ The soft restoration phase attempts to reduce the primal-dual error with regular steps. If the damped primal-dual step (damped only to satisfy the fraction-to-the-boundary rule) is not decreasing the primal-dual error by at least this factor, then the regular restoration phase is called. Choosing "0" here disables the soft restoration phase. The valid range for this real option is 0 ≤ soft_resto_pderror_reduction_factor and its default value is 0.9999. +
+ +\anchor OPT_max_soft_resto_iters +max_soft_resto_iters (advanced): Maximum number of iterations performed successively in soft restoration phase. +
+ If the soft restoration phase is performed for more than so many iterations in a row, the regular restoration phase is called. The valid range for this integer option is 0 ≤ max_soft_resto_iters and its default value is 10. +
+ +\anchor OPT_required_infeasibility_reduction +required_infeasibility_reduction: Required reduction of infeasibility before leaving restoration phase. +
+ The restoration phase algorithm is performed, until a point is found that is acceptable to the filter and the infeasibility has been reduced by at least the fraction given by this option. The valid range for this real option is 0 ≤ required_infeasibility_reduction < 1 and its default value is 0.9. +
+ +\anchor OPT_max_resto_iter +max_resto_iter (advanced): Maximum number of successive iterations in restoration phase. +
+ The algorithm terminates with an error message if the number of iterations successively taken in the restoration phase exceeds this number. The valid range for this integer option is 0 ≤ max_resto_iter and its default value is 3000000. +
+ +\anchor OPT_evaluate_orig_obj_at_resto_trial +evaluate_orig_obj_at_resto_trial: Determines if the original objective function should be evaluated at restoration phase trial points. +
+ Enabling this option makes the restoration phase algorithm evaluate the objective function of the original problem at every trial point encountered during the restoration phase, even if this value is not required. In this way, it is guaranteed that the original objective function can be evaluated without error at all accepted iterates; otherwise the algorithm might fail at a point where the restoration phase accepts an iterate that is good for the restoration phase problem, but not the original problem. On the other hand, if the evaluation of the original objective is expensive, this might be costly. The default value for this string option is "yes". + +Possible values: yes, no +
+ +\anchor OPT_resto_penalty_parameter +resto_penalty_parameter (advanced): Penalty parameter in the restoration phase objective function. +
+ This is the parameter rho in equation (31a) in the Ipopt implementation paper. The valid range for this real option is 0 < resto_penalty_parameter and its default value is 1000. +
+ +\anchor OPT_resto_proximity_weight +resto_proximity_weight (advanced): Weighting factor for the proximity term in restoration phase objective. +
+ This determines how the parameter zeta in equation (29a) in the implementation paper is computed. zeta here is resto_proximity_weight*sqrt(mu), where mu is the current barrier parameter. The valid range for this real option is 0 ≤ resto_proximity_weight and its default value is 1. +
+ +\anchor OPT_bound_mult_reset_threshold +bound_mult_reset_threshold: Threshold for resetting bound multipliers after the restoration phase. +
+ After returning from the restoration phase, the bound multipliers are updated with a Newton step for complementarity. Here, the change in the primal variables during the entire restoration phase is taken to be the corresponding primal Newton step. However, if after the update the largest bound multiplier exceeds the threshold specified by this option, the multipliers are all reset to 1. The valid range for this real option is 0 ≤ bound_mult_reset_threshold and its default value is 1000. +
+ +\anchor OPT_constr_mult_reset_threshold +constr_mult_reset_threshold: Threshold for resetting equality and inequality multipliers after restoration phase. +
+ After returning from the restoration phase, the constraint multipliers are recomputed by a least square estimate. This option triggers when those least-square estimates should be ignored. The valid range for this real option is 0 ≤ constr_mult_reset_threshold and its default value is 0. +
+ +\anchor OPT_resto_failure_feasibility_threshold +resto_failure_feasibility_threshold (advanced): Threshold for primal infeasibility to declare failure of restoration phase. +
+ If the restoration phase is terminated because of the "acceptable" termination criteria and the primal infeasibility is smaller than this value, the restoration phase is declared to have failed. The default value is actually 1e2*tol, where tol is the general termination tolerance. The valid range for this real option is 0 ≤ resto_failure_feasibility_threshold and its default value is 0. +
+ + +\subsection OPT_Hessian_Approximation Hessian Approximation + +\anchor OPT_limited_memory_aug_solver +limited_memory_aug_solver (advanced): Strategy for solving the augmented system for low-rank Hessian. +
+ The default value for this string option is "sherman-morrison". + +Possible values: + - sherman-morrison: use Sherman-Morrison formula + - extended: use an extended augmented system +
+ +\anchor OPT_limited_memory_max_history +limited_memory_max_history: Maximum size of the history for the limited quasi-Newton Hessian approximation. +
+ This option determines the number of most recent iterations that are taken into account for the limited-memory quasi-Newton approximation. The valid range for this integer option is 0 ≤ limited_memory_max_history and its default value is 6. +
+ +\anchor OPT_limited_memory_update_type +limited_memory_update_type: Quasi-Newton update formula for the limited memory quasi-Newton approximation. +
+ The default value for this string option is "bfgs". + +Possible values: + - bfgs: BFGS update (with skipping) + - sr1: SR1 (not working well) +
+ +\anchor OPT_limited_memory_initialization +limited_memory_initialization: Initialization strategy for the limited memory quasi-Newton approximation. +
+ Determines how the diagonal Matrix B_0 as the first term in the limited memory approximation should be computed. The default value for this string option is "scalar1". + +Possible values: + - scalar1: sigma = s^Ty/s^Ts + - scalar2: sigma = y^Ty/s^Ty + - scalar3: arithmetic average of scalar1 and scalar2 + - scalar4: geometric average of scalar1 and scalar2 + - constant: sigma = limited_memory_init_val +
+ +\anchor OPT_limited_memory_init_val +limited_memory_init_val: Value for B0 in low-rank update. +
+ The starting matrix in the low rank update, B0, is chosen to be this multiple of the identity in the first iteration (when no updates have been performed yet), and is constantly chosen as this value, if "limited_memory_initialization" is "constant". The valid range for this real option is 0 < limited_memory_init_val and its default value is 1. +
+ +\anchor OPT_limited_memory_init_val_max +limited_memory_init_val_max: Upper bound on value for B0 in low-rank update. +
+ The starting matrix in the low rank update, B0, is chosen to be this multiple of the identity in the first iteration (when no updates have been performed yet), and is constantly chosen as this value, if "limited_memory_initialization" is "constant". The valid range for this real option is 0 < limited_memory_init_val_max and its default value is 10+08. +
+ +\anchor OPT_limited_memory_init_val_min +limited_memory_init_val_min: Lower bound on value for B0 in low-rank update. +
+ The starting matrix in the low rank update, B0, is chosen to be this multiple of the identity in the first iteration (when no updates have been performed yet), and is constantly chosen as this value, if "limited_memory_initialization" is "constant". The valid range for this real option is 0 < limited_memory_init_val_min and its default value is 10-08. +
+ +\anchor OPT_limited_memory_max_skipping +limited_memory_max_skipping: Threshold for successive iterations where update is skipped. +
+ If the update is skipped more than this number of successive iterations, the quasi-Newton approximation is reset. The valid range for this integer option is 1 ≤ limited_memory_max_skipping and its default value is 2. +
+ +\anchor OPT_limited_memory_special_for_resto +limited_memory_special_for_resto: Determines if the quasi-Newton updates should be special during the restoration phase. +
+ Until Nov 2010, Ipopt used a special update during the restoration phase, but it turned out that this does not work well. The new default uses the regular update procedure and it improves results. If for some reason you want to get back to the original update, set this option to "yes". The default value for this string option is "no". + +Possible values: yes, no +
+ +\anchor OPT_hessian_approximation +hessian_approximation: Indicates what Hessian information is to be used. +
+ This determines which kind of information for the Hessian of the Lagrangian function is used by the algorithm. The default value for this string option is "exact". + +Possible values: + - exact: Use second derivatives provided by the NLP. + - limited-memory: Perform a limited-memory quasi-Newton approximation +
+ +\anchor OPT_hessian_approximation_space +hessian_approximation_space (advanced): Indicates in which subspace the Hessian information is to be approximated. +
+ The default value for this string option is "nonlinear-variables". + +Possible values: + - nonlinear-variables: only in space of nonlinear variables. + - all-variables: in space of all variables (without slacks) +
+ + +\subsection OPT_Derivative_Checker Derivative Checker + +\anchor OPT_derivative_test +derivative_test: Enable derivative checker +
+ If this option is enabled, a (slow!) derivative test will be performed before the optimization. The test is performed at the user provided starting point and marks derivative values that seem suspicious The default value for this string option is "none". + +Possible values: + - none: do not perform derivative test + - first-order: perform test of first derivatives at starting point + - second-order: perform test of first and second derivatives at starting point + - only-second-order: perform test of second derivatives at starting point +
+ +\anchor OPT_derivative_test_first_index +derivative_test_first_index: Index of first quantity to be checked by derivative checker +
+ If this is set to -2, then all derivatives are checked. Otherwise, for the first derivative test it specifies the first variable for which the test is done (counting starts at 0). For second derivatives, it specifies the first constraint for which the test is done; counting of constraint indices starts at 0, and -1 refers to the objective function Hessian. The valid range for this integer option is -2 ≤ derivative_test_first_index and its default value is -2. +
+ +\anchor OPT_derivative_test_perturbation +derivative_test_perturbation: Size of the finite difference perturbation in derivative test. +
+ This determines the relative perturbation of the variable entries. The valid range for this real option is 0 < derivative_test_perturbation and its default value is 10-08. +
+ +\anchor OPT_derivative_test_tol +derivative_test_tol: Threshold for indicating wrong derivative. +
+ If the relative deviation of the estimated derivative from the given one is larger than this value, the corresponding derivative is marked as wrong. The valid range for this real option is 0 < derivative_test_tol and its default value is 0.0001. +
+ +\anchor OPT_derivative_test_print_all +derivative_test_print_all: Indicates whether information for all estimated derivatives should be printed. +
+ Determines verbosity of derivative checker. The default value for this string option is "no". + +Possible values: yes, no +
+ +\anchor OPT_point_perturbation_radius +point_perturbation_radius: Maximal perturbation of an evaluation point. +
+ If a random perturbation of a points is required, this number indicates the maximal perturbation. This is for example used when determining the center point at which the finite difference derivative test is executed. The valid range for this real option is 0 ≤ point_perturbation_radius and its default value is 10. +
+ + +\subsection OPT_MA27_Linear_Solver MA27 Linear Solver + +\anchor OPT_ma27_print_level +ma27_print_level: Debug printing level for the linear solver MA27 +
+ 0: no printing; 1: Error messages only; 2: Error and warning messages; 3: Error and warning messages and terse monitoring; 4: All information. The valid range for this integer option is 0 ≤ ma27_print_level ≤ 4 and its default value is 0. +
+ +\anchor OPT_ma27_pivtol +ma27_pivtol: Pivot tolerance for the linear solver MA27. +
+ A smaller number pivots for sparsity, a larger number pivots for stability. The valid range for this real option is 0 < ma27_pivtol < 1 and its default value is 10-08. +
+ +\anchor OPT_ma27_pivtolmax +ma27_pivtolmax: Maximum pivot tolerance for the linear solver MA27. +
+ Ipopt may increase pivtol as high as ma27_pivtolmax to get a more accurate solution to the linear system. The valid range for this real option is 0 < ma27_pivtolmax < 1 and its default value is 0.0001. +
+ +\anchor OPT_ma27_liw_init_factor +ma27_liw_init_factor: Integer workspace memory for MA27. +
+ The initial integer workspace memory = liw_init_factor * memory required by unfactored system. Ipopt will increase the workspace size by ma27_meminc_factor if required. The valid range for this real option is 1 ≤ ma27_liw_init_factor and its default value is 5. +
+ +\anchor OPT_ma27_la_init_factor +ma27_la_init_factor: Real workspace memory for MA27. +
+ The initial real workspace memory = la_init_factor * memory required by unfactored system. Ipopt will increase the workspace size by ma27_meminc_factor if required. The valid range for this real option is 1 ≤ ma27_la_init_factor and its default value is 5. +
+ +\anchor OPT_ma27_meminc_factor +ma27_meminc_factor: Increment factor for workspace size for MA27. +
+ If the integer or real workspace is not large enough, Ipopt will increase its size by this factor. The valid range for this real option is 1 ≤ ma27_meminc_factor and its default value is 2. +
+ +\anchor OPT_ma27_skip_inertia_check +ma27_skip_inertia_check (advanced): Whether to always pretend that inertia is correct. +
+ Setting this option to "yes" essentially disables inertia check. This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control. The default value for this string option is "no". + +Possible values: yes, no +
+ +\anchor OPT_ma27_ignore_singularity +ma27_ignore_singularity (advanced): Whether to use MA27's ability to solve a linear system even if the matrix is singular. +
+ Setting this option to "yes" means that Ipopt will call MA27 to compute solutions for right hand sides, even if MA27 has detected that the matrix is singular (but is still able to solve the linear system). In some cases this might be better than using Ipopt's heuristic of small perturbation of the lower diagonal of the KKT matrix. The default value for this string option is "no". + +Possible values: yes, no +
+ + +\subsection OPT_MA57_Linear_Solver MA57 Linear Solver + +\anchor OPT_ma57_print_level +ma57_print_level: Debug printing level for the linear solver MA57 +
+ 0: no printing; 1: Error messages only; 2: Error and warning messages; 3: Error and warning messages and terse monitoring; >=4: All information. The valid range for this integer option is 0 ≤ ma57_print_level and its default value is 0. +
+ +\anchor OPT_ma57_pivtol +ma57_pivtol: Pivot tolerance for the linear solver MA57. +
+ A smaller number pivots for sparsity, a larger number pivots for stability. The valid range for this real option is 0 < ma57_pivtol < 1 and its default value is 10-08. +
+ +\anchor OPT_ma57_pivtolmax +ma57_pivtolmax: Maximum pivot tolerance for the linear solver MA57. +
+ Ipopt may increase pivtol as high as ma57_pivtolmax to get a more accurate solution to the linear system. The valid range for this real option is 0 < ma57_pivtolmax < 1 and its default value is 0.0001. +
+ +\anchor OPT_ma57_pre_alloc +ma57_pre_alloc: Safety factor for work space memory allocation for the linear solver MA57. +
+ If 1 is chosen, the suggested amount of work space is used. However, choosing a larger number might avoid reallocation if the suggest values do not suffice. The valid range for this real option is 1 ≤ ma57_pre_alloc and its default value is 1.05. +
+ +\anchor OPT_ma57_pivot_order +ma57_pivot_order: Controls pivot order in MA57 +
+ This is ICNTL(6) in MA57. The valid range for this integer option is 0 ≤ ma57_pivot_order ≤ 5 and its default value is 5. +
+ +\anchor OPT_ma57_automatic_scaling +ma57_automatic_scaling: Controls whether to enable automatic scaling in MA57 +
+ For higher reliability of the MA57 solver, you may want to set this option to yes. This is ICNTL(15) in MA57. The default value for this string option is "no". + +Possible values: yes, no +
+ +\anchor OPT_ma57_block_size +ma57_block_size: Controls block size used by Level 3 BLAS in MA57BD +
+ This is ICNTL(11) in MA57. The valid range for this integer option is 1 ≤ ma57_block_size and its default value is 16. +
+ +\anchor OPT_ma57_node_amalgamation +ma57_node_amalgamation: Node amalgamation parameter +
+ This is ICNTL(12) in MA57. The valid range for this integer option is 1 ≤ ma57_node_amalgamation and its default value is 16. +
+ +\anchor OPT_ma57_small_pivot_flag +ma57_small_pivot_flag: Handling of small pivots +
+ If set to 1, then when small entries defined by CNTL(2) are detected they are removed and the corresponding pivots placed at the end of the factorization. This can be particularly efficient if the matrix is highly rank deficient. This is ICNTL(16) in MA57. The valid range for this integer option is 0 ≤ ma57_small_pivot_flag ≤ 1 and its default value is 0. +
+ + +\subsection OPT_MA77_Linear_Solver MA77 Linear Solver + +\anchor OPT_ma77_print_level +ma77_print_level: Debug printing level for the linear solver MA77 +
+ <0: no printing; 0: Error and warning messages only; 1: Limited diagnostic printing; >1 Additional diagnostic printing. The valid range for this integer option is unrestricted and its default value is -1. +
+ +\anchor OPT_ma77_buffer_lpage +ma77_buffer_lpage: Number of scalars per MA77 in-core buffer page in the out-of-core solver MA77 +
+ Must be at most ma77_file_size. The valid range for this integer option is 1 ≤ ma77_buffer_lpage and its default value is 4096. +
+ +\anchor OPT_ma77_buffer_npage +ma77_buffer_npage: Number of pages that make up MA77 buffer +
+ Number of pages of size buffer_lpage that exist in-core for the out-of-core solver MA77. The valid range for this integer option is 1 ≤ ma77_buffer_npage and its default value is 1600. +
+ +\anchor OPT_ma77_file_size +ma77_file_size: Target size of each temporary file for MA77, scalars per type +
+ MA77 uses many temporary files, this option controls the size of each one. It is measured in the number of entries (int or double), NOT bytes. The valid range for this integer option is 1 ≤ ma77_file_size and its default value is 2097152. +
+ +\anchor OPT_ma77_maxstore +ma77_maxstore: Maximum storage size for MA77 in-core mode +
+ If greater than zero, the maximum size of factors stored in core before out-of-core mode is invoked. The valid range for this integer option is 0 ≤ ma77_maxstore and its default value is 0. +
-\anchor OPT_hessian_approximation - hessian_approximation: Indicates what Hessian information is to be used. +\anchor OPT_ma77_nemin +ma77_nemin: Node Amalgamation parameter
- This determines which kind of information for the Hessian of the Lagrangian function is used by the algorithm. The default value for this string option is "exact". + Two nodes in elimination tree are merged if result has fewer than ma77_nemin variables. The valid range for this integer option is 1 ≤ ma77_nemin and its default value is 8. +
+ +\anchor OPT_ma77_small +ma77_small: Zero Pivot Threshold +
+ Any pivot less than ma77_small is treated as zero. The valid range for this real option is 0 ≤ ma77_small and its default value is 10-20. +
+ +\anchor OPT_ma77_static +ma77_static: Static Pivoting Threshold +
+ See MA77 documentation. Either ma77_static=0.0 or ma77_static>ma77_small. ma77_static=0.0 disables static pivoting. The valid range for this real option is 0 ≤ ma77_static and its default value is 0. +
+ +\anchor OPT_ma77_u +ma77_u: Pivoting Threshold +
+ See MA77 documentation. The valid range for this real option is 0 ≤ ma77_u ≤ 0.5 and its default value is 10-08. +
+ +\anchor OPT_ma77_umax +ma77_umax: Maximum Pivoting Threshold +
+ Maximum value to which u will be increased to improve quality. The valid range for this real option is 0 ≤ ma77_umax ≤ 0.5 and its default value is 0.0001. +
+ +\anchor OPT_ma77_order +ma77_order: Controls type of ordering used by MA77 +
+ The default value for this string option is "metis". Possible values: - - exact: Use second derivatives provided by the NLP. - - limited-memory: Perform a limited-memory quasi-Newton approximation + - amd: Use the HSL_MC68 approximate minimum degree algorithm + - metis: Use the MeTiS nested dissection algorithm (if available)
-\anchor OPT_limited_memory_update_type - limited_memory_update_type: Quasi-Newton update formula for the limited memory approximation. + +\subsection OPT_MA86_Linear_Solver MA86 Linear Solver + +\anchor OPT_ma86_print_level +ma86_print_level: Debug printing level +
+ <0: no printing; 0: Error and warning messages only; 1: Limited diagnostic printing; >1 Additional diagnostic printing. The valid range for this integer option is unrestricted and its default value is -1. +
+ +\anchor OPT_ma86_nemin +ma86_nemin: Node Amalgamation parameter +
+ Two nodes in elimination tree are merged if result has fewer than ma86_nemin variables. The valid range for this integer option is 1 ≤ ma86_nemin and its default value is 32. +
+ +\anchor OPT_ma86_small +ma86_small: Zero Pivot Threshold +
+ Any pivot less than ma86_small is treated as zero. The valid range for this real option is 0 ≤ ma86_small and its default value is 10-20. +
+ +\anchor OPT_ma86_static +ma86_static: Static Pivoting Threshold +
+ See MA86 documentation. Either ma86_static=0.0 or ma86_static>ma86_small. ma86_static=0.0 disables static pivoting. The valid range for this real option is 0 ≤ ma86_static and its default value is 0. +
+ +\anchor OPT_ma86_u +ma86_u: Pivoting Threshold +
+ See MA86 documentation. The valid range for this real option is 0 ≤ ma86_u ≤ 0.5 and its default value is 10-08. +
+ +\anchor OPT_ma86_umax +ma86_umax: Maximum Pivoting Threshold +
+ Maximum value to which u will be increased to improve quality. The valid range for this real option is 0 ≤ ma86_umax ≤ 0.5 and its default value is 0.0001. +
+ +\anchor OPT_ma86_scaling +ma86_scaling: Controls scaling of matrix
- Determines which update formula is to be used for the limited-memory quasi-Newton approximation. The default value for this string option is "bfgs". + The default value for this string option is "mc64". Possible values: - - bfgs: BFGS update (with skipping) - - sr1: SR1 (not working well) + - none: Do not scale the linear system matrix + - mc64: Scale linear system matrix using MC64 + - mc77: Scale linear system matrix using MC77 [1,3,0]
-\anchor OPT_limited_memory_max_history - limited_memory_max_history: Maximum size of the history for the limited quasi-Newton Hessian approximation. +\anchor OPT_ma86_order +ma86_order: Controls type of ordering
- This option determines the number of most recent iterations that are taken into account for the limited-memory quasi-Newton approximation. The valid range for this integer option is 0 ≤ limited_memory_max_history and its default value is 6. + The default value for this string option is "auto". +Possible values: + - auto: Try both AMD and MeTiS, pick best + - amd: Use the HSL_MC68 approximate minimum degree algorithm + - metis: Use the MeTiS nested dissection algorithm (if available)
-\anchor OPT_limited_memory_max_skipping - limited_memory_max_skipping: Threshold for successive iterations where update is skipped. + +\subsection OPT_MA97_Linear_Solver MA97 Linear Solver + +\anchor OPT_ma97_print_level +ma97_print_level: Debug printing level
- If the update is skipped more than this number of successive iterations, the quasi-Newton approximation is reset. The valid range for this integer option is 1 ≤ limited_memory_max_skipping and its default value is 2. + <0: no printing; 0: Error and warning messages only; 1: Limited diagnostic printing; >1 Additional diagnostic printing. The valid range for this integer option is unrestricted and its default value is -1. +
+\anchor OPT_ma97_nemin +ma97_nemin: Node Amalgamation parameter +
+ Two nodes in elimination tree are merged if result has fewer than ma97_nemin variables. The valid range for this integer option is 1 ≤ ma97_nemin and its default value is 8.
-\anchor OPT_limited_memory_initialization - limited_memory_initialization: Initialization strategy for the limited memory quasi-Newton approximation. +\anchor OPT_ma97_small +ma97_small: Zero Pivot Threshold
- Determines how the diagonal Matrix B_0 as the first term in the limited memory approximation should be computed. The default value for this string option is "scalar1". + Any pivot less than ma97_small is treated as zero. The valid range for this real option is 0 ≤ ma97_small and its default value is 10-20. +
+ +\anchor OPT_ma97_u +ma97_u: Pivoting Threshold +
+ See MA97 documentation. The valid range for this real option is 0 ≤ ma97_u ≤ 0.5 and its default value is 10-08. +
+ +\anchor OPT_ma97_umax +ma97_umax: Maximum Pivoting Threshold +
+ See MA97 documentation. The valid range for this real option is 0 ≤ ma97_umax ≤ 0.5 and its default value is 0.0001. +
+ +\anchor OPT_ma97_scaling +ma97_scaling: Specifies strategy for scaling +
+ The default value for this string option is "dynamic". Possible values: - - scalar1: sigma = s^Ty/s^Ts - - scalar2: sigma = y^Ty/s^Ty - - scalar3: arithmetic average of scalar1 and scalar2 - - scalar4: geometric average of scalar1 and scalar2 - - constant: sigma = limited_memory_init_val + - none: Do not scale the linear system matrix + - mc30: Scale all linear system matrices using MC30 + - mc64: Scale all linear system matrices using MC64 + - mc77: Scale all linear system matrices using MC77 [1,3,0] + - dynamic: Dynamically select scaling according to rules specified by ma97_scalingX and ma97_switchX options.
-\anchor OPT_limited_memory_init_val - limited_memory_init_val: Value for B0 in low-rank update. +\anchor OPT_ma97_scaling1 +ma97_scaling1 (advanced): First scaling.
- The starting matrix in the low rank update, B0, is chosen to be this multiple of the identity in the first iteration (when no updates have been performed yet), and is constantly chosen as this value, if "limited_memory_initialization" is "constant". The valid range for this real option is 0 < limited_memory_init_val and its default value is 1. + If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch1. If ma97_switch2 is triggered it is disabled. The default value for this string option is "mc64". + +Possible values: + - none: No scaling + - mc30: Scale linear system matrix using MC30 + - mc64: Scale linear system matrix using MC64 + - mc77: Scale linear system matrix using MC77 [1,3,0] +
+ +\anchor OPT_ma97_switch1 +ma97_switch1 (advanced): First switch, determine when ma97_scaling1 is enabled. +
+ If ma97_scaling=dynamic, ma97_scaling1 is enabled according to this condition. If ma97_switch2 occurs this option is henceforth ignored. The default value for this string option is "od_hd_reuse". +Possible values: + - never: Scaling is never enabled. + - at_start: Scaling to be used from the very start. + - at_start_reuse: Scaling to be used on first iteration, then reused thereafter. + - on_demand: Scaling to be used after Ipopt request improved solution (i.e. iterative refinement has failed). + - on_demand_reuse: As on_demand, but reuse scaling from previous itr + - high_delay: Scaling to be used after more than 0.05*n delays are present + - high_delay_reuse: Scaling to be used only when previous itr created more that 0.05*n additional delays, otherwise reuse scaling from previous itr + - od_hd: Combination of on_demand and high_delay + - od_hd_reuse: Combination of on_demand_reuse and high_delay_reuse
-\anchor OPT_limited_memory_init_val_max - limited_memory_init_val_max: Upper bound on value for B0 in low-rank update. +\anchor OPT_ma97_scaling2 +ma97_scaling2 (advanced): Second scaling.
- The starting matrix in the low rank update, B0, is chosen to be this multiple of the identity in the first iteration (when no updates have been performed yet), and is constantly chosen as this value, if "limited_memory_initialization" is "constant". The valid range for this real option is 0 < limited_memory_init_val_max and its default value is 10+08. + If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch2. If ma97_switch3 is triggered it is disabled. The default value for this string option is "mc64". +Possible values: + - none: No scaling + - mc30: Scale linear system matrix using MC30 + - mc64: Scale linear system matrix using MC64 + - mc77: Scale linear system matrix using MC77 [1,3,0]
-\anchor OPT_limited_memory_init_val_min - limited_memory_init_val_min: Lower bound on value for B0 in low-rank update. +\anchor OPT_ma97_switch2 +ma97_switch2 (advanced): Second switch, determine when ma97_scaling2 is enabled.
- The starting matrix in the low rank update, B0, is chosen to be this multiple of the identity in the first iteration (when no updates have been performed yet), and is constantly chosen as this value, if "limited_memory_initialization" is "constant". The valid range for this real option is 0 < limited_memory_init_val_min and its default value is 10-08. + If ma97_scaling=dynamic, ma97_scaling2 is enabled according to this condition. If ma97_switch3 occurs this option is henceforth ignored. The default value for this string option is "never". +Possible values: + - never: Scaling is never enabled. + - at_start: Scaling to be used from the very start. + - at_start_reuse: Scaling to be used on first iteration, then reused thereafter. + - on_demand: Scaling to be used after Ipopt request improved solution (i.e. iterative refinement has failed). + - on_demand_reuse: As on_demand, but reuse scaling from previous itr + - high_delay: Scaling to be used after more than 0.05*n delays are present + - high_delay_reuse: Scaling to be used only when previous itr created more that 0.05*n additional delays, otherwise reuse scaling from previous itr + - od_hd: Combination of on_demand and high_delay + - od_hd_reuse: Combination of on_demand_reuse and high_delay_reuse
-\anchor OPT_limited_memory_special_for_resto - limited_memory_special_for_resto: Determines if the quasi-Newton updates should be special during the restoration phase. +\anchor OPT_ma97_scaling3 +ma97_scaling3 (advanced): Third scaling.
- Until Nov 2010, Ipopt used a special update during the restoration phase, but it turned out that this does not work well. The new default uses the regular update procedure and it improves results. If for some reason you want to get back to the original update, set this option to "yes". The default value for this string option is "no". + If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch3. The default value for this string option is "mc64". Possible values: - - no: use the same update as in regular iterations - - yes: use the a special update during restoration phase + - none: No scaling + - mc30: Scale linear system matrix using MC30 + - mc64: Scale linear system matrix using MC64 + - mc77: Scale linear system matrix using MC77 [1,3,0]
-\subsection OPT_Derivative_Test Derivative Test +\anchor OPT_ma97_switch3 +ma97_switch3 (advanced): Third switch, determine when ma97_scaling3 is enabled. +
+ If ma97_scaling=dynamic, ma97_scaling3 is enabled according to this condition. The default value for this string option is "never". -\anchor OPT_derivative_test - derivative_test: Enable derivative checker +Possible values: + - never: Scaling is never enabled. + - at_start: Scaling to be used from the very start. + - at_start_reuse: Scaling to be used on first iteration, then reused thereafter. + - on_demand: Scaling to be used after Ipopt request improved solution (i.e. iterative refinement has failed). + - on_demand_reuse: As on_demand, but reuse scaling from previous itr + - high_delay: Scaling to be used after more than 0.05*n delays are present + - high_delay_reuse: Scaling to be used only when previous itr created more that 0.05*n additional delays, otherwise reuse scaling from previous itr + - od_hd: Combination of on_demand and high_delay + - od_hd_reuse: Combination of on_demand_reuse and high_delay_reuse +
+ +\anchor OPT_ma97_order +ma97_order: Controls type of ordering
- If this option is enabled, a (slow!) derivative test will be performed before the optimization. The test is performed at the user provided starting point and marks derivative values that seem suspicious The default value for this string option is "none". + The default value for this string option is "auto". Possible values: - - none: do not perform derivative test - - first-order: perform test of first derivatives at starting point - - second-order: perform test of first and second derivatives at starting point - - only-second-order: perform test of second derivatives at starting point + - auto: Use HSL_MA97 heuristic to guess best of AMD and METIS + - best: Try both AMD and MeTiS, pick best + - amd: Use the HSL_MC68 approximate minimum degree algorithm + - metis: Use the MeTiS nested dissection algorithm + - matched-auto: Use the HSL_MC80 matching with heuristic choice of AMD or METIS + - matched-metis: Use the HSL_MC80 matching based ordering with METIS + - matched-amd: Use the HSL_MC80 matching based ordering with AMD
-\anchor OPT_derivative_test_perturbation - derivative_test_perturbation: Size of the finite difference perturbation in derivative test. +\anchor OPT_ma97_solve_blas3 +ma97_solve_blas3 (advanced): Controls if blas2 or blas3 routines are used for solve
- This determines the relative perturbation of the variable entries. The valid range for this real option is 0 < derivative_test_perturbation and its default value is 10-08. + The default value for this string option is "no". +Possible values: + - no: Use BLAS2 (faster, some implementations bit incompatible) + - yes: Use BLAS3 (slower)
-\anchor OPT_derivative_test_tol - derivative_test_tol: Threshold for indicating wrong derivative. + +\subsection OPT_Pardiso__pardiso_project_org__Linear_Solver Pardiso (pardiso-project.org) Linear Solver + +\anchor OPT_pardiso_matching_strategy +pardiso_matching_strategy: Matching strategy to be used by Pardiso
- If the relative deviation of the estimated derivative from the given one is larger than this value, the corresponding derivative is marked as wrong. The valid range for this real option is 0 < derivative_test_tol and its default value is 0.0001. + This is IPAR(13) in Pardiso manual. The default value for this string option is "complete+2x2". +Possible values: + - complete: Match complete (IPAR(13)=1) + - complete+2x2: Match complete+2x2 (IPAR(13)=2) + - constraints: Match constraints (IPAR(13)=3)
-\anchor OPT_derivative_test_print_all - derivative_test_print_all: Indicates whether information for all estimated derivatives should be printed. +\anchor OPT_pardiso_redo_symbolic_fact_only_if_inertia_wrong +pardiso_redo_symbolic_fact_only_if_inertia_wrong (advanced): Toggle for handling case when elements were perturbed by Pardiso.
- Determines verbosity of derivative checker. The default value for this string option is "no". + The default value for this string option is "no". Possible values: - - no: Print only suspect derivatives - - yes: Print all derivatives + - no: Always redo symbolic factorization when elements were perturbed + - yes: Only redo symbolic factorization when elements were perturbed if also the inertia was wrong
-\anchor OPT_derivative_test_first_index - derivative_test_first_index: Index of first quantity to be checked by derivative checker +\anchor OPT_pardiso_repeated_perturbation_means_singular +pardiso_repeated_perturbation_means_singular (advanced): Whether to assume that matrix is singular if elements were perturbed after recent symbolic factorization.
- If this is set to -2, then all derivatives are checked. Otherwise, for the first derivative test it specifies the first variable for which the test is done (counting starts at 0). For second derivatives, it specifies the first constraint for which the test is done; counting of constraint indices starts at 0, and -1 refers to the objective function Hessian. The valid range for this integer option is -2 ≤ derivative_test_first_index and its default value is -2. + The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_point_perturbation_radius - point_perturbation_radius: Maximal perturbation of an evaluation point. +\anchor OPT_pardiso_msglvl +pardiso_msglvl: Pardiso message level
- If a random perturbation of a points is required, this number indicates the maximal perturbation. This is for example used when determining the center point at which the finite difference derivative test is executed. The valid range for this real option is 0 ≤ point_perturbation_radius and its default value is 10. + This is MSGLVL in the Pardiso manual. The valid range for this integer option is 0 ≤ pardiso_msglvl and its default value is 0. +
+ +\anchor OPT_pardiso_skip_inertia_check +pardiso_skip_inertia_check (advanced): Whether to pretend that inertia is correct. +
+ Setting this option to "yes" essentially disables inertia check. This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control. The default value for this string option is "no". +Possible values: yes, no
-\subsection OPT_MA27_Linear_Solver MA27 Linear Solver +\anchor OPT_pardiso_max_iterative_refinement_steps +pardiso_max_iterative_refinement_steps: Limit on number of iterative refinement steps. +
+ The solver does not perform more than the absolute value of this value steps of iterative refinement and stops the process if a satisfactory level of accuracy of the solution in terms of backward error is achieved. If negative, the accumulation of the residue uses extended precision real and complex data types. Perturbed pivots result in iterative refinement. The solver automatically performs two steps of iterative refinements when perturbed pivots are obtained during the numerical factorization and this option is set to 0. The valid range for this integer option is unrestricted and its default value is 0. +
-\anchor OPT_ma27_pivtol - ma27_pivtol: Pivot tolerance for the linear solver MA27. +\anchor OPT_pardiso_order +pardiso_order: Controls the fill-in reduction ordering algorithm for the input matrix. +
+ The default value for this string option is "metis". + +Possible values: + - amd: minimum degree algorithm + - one + - metis: MeTiS nested dissection algorithm + - pmetis: parallel (OpenMP) version of MeTiS nested dissection algorithm + - four + - five +
+ +\anchor OPT_pardiso_max_iter +pardiso_max_iter (advanced): Maximum number of Krylov-Subspace Iteration +
+ DPARM(1) The valid range for this integer option is 1 ≤ pardiso_max_iter and its default value is 500. +
+ +\anchor OPT_pardiso_iter_relative_tol +pardiso_iter_relative_tol (advanced): Relative Residual Convergence
- A smaller number pivots for sparsity, a larger number pivots for stability. This option is only available if Ipopt has been compiled with MA27. The valid range for this real option is 0 < ma27_pivtol < 1 and its default value is 10-08. + DPARM(2) The valid range for this real option is 0 < pardiso_iter_relative_tol < 1 and its default value is 10-06. +
+\anchor OPT_pardiso_iter_coarse_size +pardiso_iter_coarse_size (advanced): Maximum Size of Coarse Grid Matrix +
+ DPARM(3) The valid range for this integer option is 1 ≤ pardiso_iter_coarse_size and its default value is 5000.
-\anchor OPT_ma27_pivtolmax - ma27_pivtolmax: Maximum pivot tolerance for the linear solver MA27. +\anchor OPT_pardiso_iter_max_levels +pardiso_iter_max_levels (advanced): Maximum Size of Grid Levels
- Ipopt may increase pivtol as high as pivtolmax to get a more accurate solution to the linear system. This option is only available if Ipopt has been compiled with MA27. The valid range for this real option is 0 < ma27_pivtolmax < 1 and its default value is 0.0001. - + DPARM(4) The valid range for this integer option is 1 ≤ pardiso_iter_max_levels and its default value is 10.
-\anchor OPT_ma27_liw_init_factor - ma27_liw_init_factor: Integer workspace memory for MA27. +\anchor OPT_pardiso_iter_dropping_factor +pardiso_iter_dropping_factor (advanced): dropping value for incomplete factor
- The initial integer workspace memory = liw_init_factor * memory required by unfactored system. Ipopt will increase the workspace size by meminc_factor if required. This option is only available if Ipopt has been compiled with MA27. The valid range for this real option is 1 ≤ ma27_liw_init_factor and its default value is 5. - + DPARM(5) The valid range for this real option is 0 < pardiso_iter_dropping_factor < 1 and its default value is 0.5.
-\anchor OPT_ma27_la_init_factor - ma27_la_init_factor: Real workspace memory for MA27. +\anchor OPT_pardiso_iter_dropping_schur +pardiso_iter_dropping_schur (advanced): dropping value for sparsify schur complement factor
- The initial real workspace memory = la_init_factor * memory required by unfactored system. Ipopt will increase the workspace size by meminc_factor if required. This option is only available if Ipopt has been compiled with MA27. The valid range for this real option is 1 ≤ ma27_la_init_factor and its default value is 5. - + DPARM(6) The valid range for this real option is 0 < pardiso_iter_dropping_schur < 1 and its default value is 0.1.
-\anchor OPT_ma27_meminc_factor - ma27_meminc_factor: Increment factor for workspace size for MA27. +\anchor OPT_pardiso_iter_max_row_fill +pardiso_iter_max_row_fill (advanced): max fill for each row
- If the integer or real workspace is not large enough, Ipopt will increase its size by this factor. This option is only available if Ipopt has been compiled with MA27. The valid range for this real option is 1 ≤ ma27_meminc_factor and its default value is 2. - + DPARM(7) The valid range for this integer option is 1 ≤ pardiso_iter_max_row_fill and its default value is 10000000.
-\subsection OPT_MA57_Linear_Solver MA57 Linear Solver - -\anchor OPT_ma57_pivtol - ma57_pivtol: Pivot tolerance for the linear solver MA57. +\anchor OPT_pardiso_iter_inverse_norm_factor +pardiso_iter_inverse_norm_factor (advanced)
- A smaller number pivots for sparsity, a larger number pivots for stability. This option is only available if Ipopt has been compiled with MA57. The valid range for this real option is 0 < ma57_pivtol < 1 and its default value is 10-08. - + DPARM(8) The valid range for this real option is 1 < pardiso_iter_inverse_norm_factor and its default value is 5 · 10+06.
-\anchor OPT_ma57_pivtolmax - ma57_pivtolmax: Maximum pivot tolerance for the linear solver MA57. +\anchor OPT_pardiso_iterative +pardiso_iterative (advanced): Switch for iterative solver in Pardiso library
- Ipopt may increase pivtol as high as ma57_pivtolmax to get a more accurate solution to the linear system. This option is only available if Ipopt has been compiled with MA57. The valid range for this real option is 0 < ma57_pivtolmax < 1 and its default value is 0.0001. + The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_ma57_pre_alloc - ma57_pre_alloc: Safety factor for work space memory allocation for the linear solver MA57. +\anchor OPT_pardiso_max_droptol_corrections +pardiso_max_droptol_corrections (advanced): Maximal number of decreases of drop tolerance during one solve.
- If 1 is chosen, the suggested amount of work space is used. However, choosing a larger number might avoid reallocation if the suggest values do not suffice. This option is only available if Ipopt has been compiled with MA57. The valid range for this real option is 1 ≤ ma57_pre_alloc and its default value is 1.05. - + This is relevant only for iterative Pardiso options. The valid range for this integer option is 1 ≤ pardiso_max_droptol_corrections and its default value is 4.
-\anchor OPT_ma57_pivot_order - ma57_pivot_order: Controls pivot order in MA57 + +\subsection OPT_Pardiso__MKL__Linear_Solver Pardiso (MKL) Linear Solver + +\anchor OPT_pardisomkl_matching_strategy +pardisomkl_matching_strategy: Matching strategy to be used by Pardiso
- This is ICNTL(6) in MA57. The valid range for this integer option is 0 ≤ ma57_pivot_order ≤ 5 and its default value is 5. + This is IPAR(13) in Pardiso manual. The default value for this string option is "complete+2x2". +Possible values: + - complete: Match complete (IPAR(13)=1) + - complete+2x2: Match complete+2x2 (IPAR(13)=2) + - constraints: Match constraints (IPAR(13)=3)
-\anchor OPT_ma57_automatic_scaling - ma57_automatic_scaling: Controls MA57 automatic scaling +\anchor OPT_pardisomkl_redo_symbolic_fact_only_if_inertia_wrong +pardisomkl_redo_symbolic_fact_only_if_inertia_wrong (advanced): Toggle for handling case when elements were perturbed by Pardiso.
- This option controls the internal scaling option of MA57. For higher reliability of the MA57 solver, you may want to set this option to yes. This is ICNTL(15) in MA57. The default value for this string option is "no". + The default value for this string option is "no". Possible values: - - no: Do not scale the linear system matrix - - yes: Scale the linear system matrix + - no: Always redo symbolic factorization when elements were perturbed + - yes: Only redo symbolic factorization when elements were perturbed if also the inertia was wrong
-\anchor OPT_ma57_block_size - ma57_block_size: Controls block size used by Level 3 BLAS in MA57BD +\anchor OPT_pardisomkl_repeated_perturbation_means_singular +pardisomkl_repeated_perturbation_means_singular (advanced): Whether to assume that matrix is singular if elements were perturbed after recent symbolic factorization.
- This is ICNTL(11) in MA57. The valid range for this integer option is 1 ≤ ma57_block_size and its default value is 16. + The default value for this string option is "no". +Possible values: yes, no
-\anchor OPT_ma57_node_amalgamation - ma57_node_amalgamation: Node amalgamation parameter +\anchor OPT_pardisomkl_msglvl +pardisomkl_msglvl: Pardiso message level
- This is ICNTL(12) in MA57. The valid range for this integer option is 1 ≤ ma57_node_amalgamation and its default value is 16. - + This is MSGLVL in the Pardiso manual. The valid range for this integer option is 0 ≤ pardisomkl_msglvl and its default value is 0.
-\anchor OPT_ma57_small_pivot_flag - ma57_small_pivot_flag: Handling of small pivots +\anchor OPT_pardisomkl_skip_inertia_check +pardisomkl_skip_inertia_check (advanced): Whether to pretend that inertia is correct.
- If set to 1, then when small entries defined by CNTL(2) are detected they are removed and the corresponding pivots placed at the end of the factorization. This can be particularly efficient if the matrix is highly rank deficient. This is ICNTL(16) in MA57. The valid range for this integer option is 0 ≤ ma57_small_pivot_flag ≤ 1 and its default value is 0. + Setting this option to "yes" essentially disables inertia check. This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control. The default value for this string option is "no". +Possible values: yes, no
-\subsection OPT_MA77_Linear_Solver MA77 Linear Solver - -\anchor OPT_ma77_print_level - ma77_print_level: Debug printing level for the linear solver MA77 +\anchor OPT_pardisomkl_max_iterative_refinement_steps +pardisomkl_max_iterative_refinement_steps: Limit on number of iterative refinement steps.
- The valid range for this integer option is unrestricted and its default value is -1. - + The solver does not perform more than the absolute value of this value steps of iterative refinement and stops the process if a satisfactory level of accuracy of the solution in terms of backward error is achieved. If negative, the accumulation of the residue uses extended precision real and complex data types. Perturbed pivots result in iterative refinement. The solver automatically performs two steps of iterative refinements when perturbed pivots are obtained during the numerical factorization and this option is set to 0. The valid range for this integer option is unrestricted and its default value is 1.
-\anchor OPT_ma77_buffer_lpage - ma77_buffer_lpage: Number of scalars per MA77 buffer page +\anchor OPT_pardisomkl_order +pardisomkl_order: Controls the fill-in reduction ordering algorithm for the input matrix.
- Number of scalars per an in-core buffer in the out-of-core solver MA77. Must be at most ma77_file_size. The valid range for this integer option is 1 ≤ ma77_buffer_lpage and its default value is 4096. + The default value for this string option is "metis". +Possible values: + - amd: minimum degree algorithm + - one: undocumented + - metis: MeTiS nested dissection algorithm + - pmetis: parallel (OpenMP) version of MeTiS nested dissection algorithm
-\anchor OPT_ma77_buffer_npage - ma77_buffer_npage: Number of pages that make up MA77 buffer + +\subsection OPT_SPRAL_Linear_Solver SPRAL Linear Solver + +\anchor OPT_spral_cpu_block_size +spral_cpu_block_size: CPU Parallelization Block Size
- Number of pages of size buffer_lpage that exist in-core for the out-of-core solver MA77. The valid range for this integer option is 1 ≤ ma77_buffer_npage and its default value is 1600. + Block size to use for parallelization of large nodes on CPU resources. The valid range for this integer option is 1 ≤ spral_cpu_block_size and its default value is 256. +
+\anchor OPT_spral_gpu_perf_coeff +spral_gpu_perf_coeff: GPU Performance Coefficient +
+ How many times faster a GPU is than a CPU at factoring a subtree. The valid range for this real option is 0 < spral_gpu_perf_coeff and its default value is 1.
-\anchor OPT_ma77_file_size - ma77_file_size: Target size of each temporary file for MA77, scalars per type +\anchor OPT_spral_ignore_numa +spral_ignore_numa: Non-uniform memory access (NUMA) region setting.
- MA77 uses many temporary files, this option controls the size of each one. It is measured in the number of entries (int or double), NOT bytes. The valid range for this integer option is 1 ≤ ma77_file_size and its default value is 2097152. + The default value for this string option is "yes". +Possible values: + - no: Do not treat CPUs and GPUs as belonging to a single NUMA region. + - yes: Treat CPUs and GPUs as belonging to a single NUMA region.
-\anchor OPT_ma77_maxstore - ma77_maxstore: Maximum storage size for MA77 in-core mode +\anchor OPT_spral_max_load_inbalance +spral_max_load_inbalance: Maximum Permissible Load
- If greater than zero, the maximum size of factors stored in core before out-of-core mode is invoked. The valid range for this integer option is 0 ≤ ma77_maxstore and its default value is 0. - + Maximum permissible load inbalance for leaf subtree allocations. The valid range for this real option is 1 < spral_max_load_inbalance and its default value is 1.2.
-\anchor OPT_ma77_nemin - ma77_nemin: Node Amalgamation parameter +\anchor OPT_spral_min_gpu_work +spral_min_gpu_work: Minimum GPU Work
- Two nodes in elimination tree are merged if result has fewer than ma77_nemin variables. The valid range for this integer option is 1 ≤ ma77_nemin and its default value is 8. + Minimum number of FLOPS in subtree before scheduling on GPU. The valid range for this real option is 0 ≤ spral_min_gpu_work and its default value is 5 · 10+09. +
+\anchor OPT_spral_nemin +spral_nemin: Node Amalgamation Parameter +
+ Two nodes in the elimination tree are merged if the result has fewer than spral_nemin variables. The valid range for this integer option is 1 ≤ spral_nemin and its default value is 32.
-\anchor OPT_ma77_order - ma77_order: Controls type of ordering used by HSL_MA77 +\anchor OPT_spral_order +spral_order: Controls type of ordering used by SPRAL
- This option controls ordering for the solver HSL_MA77. The default value for this string option is "metis". + The default value for this string option is "matching". Possible values: - - amd: Use the HSL_MC68 approximate minimum degree algorithm - - metis: Use the MeTiS nested dissection algorithm (if available) + - metis: Use METIS with default settings. + - matching: Use matching-based elimination ordering.
-\anchor OPT_ma77_small - ma77_small: Zero Pivot Threshold +\anchor OPT_spral_pivot_method +spral_pivot_method: Specifies strategy for scaling in SPRAL linear solver.
- Any pivot less than ma77_small is treated as zero. The valid range for this real option is 0 ≤ ma77_small and its default value is 10-20. + The default value for this string option is "block". +Possible values: + - aggressive: Aggressive a posteori pivoting. + - block: Block a posteori pivoting. + - threshold: Threshold partial pivoting (not parallel).
-\anchor OPT_ma77_static - ma77_static: Static Pivoting Threshold +\anchor OPT_spral_print_level +spral_print_level: Print level for the linear solver SPRAL
- See MA77 documentation. Either ma77_static=0.0 or ma77_static>ma77_small. ma77_static=0.0 disables static pivoting. The valid range for this real option is 0 ≤ ma77_static and its default value is 0. - + <0: no printing, 0: errors and warning messages, 1: limited diagnostics, >1: additional diagnostics The valid range for this integer option is unrestricted and its default value is -1.
-\anchor OPT_ma77_u - ma77_u: Pivoting Threshold +\anchor OPT_spral_scaling +spral_scaling: Specifies strategy for scaling in SPRAL linear solver.
- See MA77 documentation. The valid range for this real option is 0 ≤ ma77_u ≤ 0.5 and its default value is 10-08. + The default value for this string option is "matching". +Possible values: + - none: Do not scale the linear system matrix. + - mc64: Scale using weighted bipartite matching (MC64). + - auction: Scale using the auction algorithm. + - matching: Scale using the matching-based ordering. + - ruiz: Scale using the norm-equilibration algorithm of Ruiz (MC77). + - dynamic: Dynamically select scaling according to switch options.
-\anchor OPT_ma77_umax - ma77_umax: Maximum Pivoting Threshold +\anchor OPT_spral_scaling_1 +spral_scaling_1 (advanced): First scaling strategy.
- Maximum value to which u will be increased to improve quality. The valid range for this real option is 0 ≤ ma77_umax ≤ 0.5 and its default value is 0.0001. + If spral_scaling = dynamic, this scaling is used according to the trigger spral_switch_1. If spral_switch_2 is triggered, it is disabled. The default value for this string option is "matching". +Possible values: + - none: Do not scale the linear system matrix. + - mc64: Scale using weighted bipartite matching (MC64). + - auction: Scale using the auction algorithm. + - matching: Scale using the matching-based ordering. + - ruiz: Scale using the norm-equilibration algorithm of Ruiz (MC77).
-\subsection OPT_MA86_Linear_Solver MA86 Linear Solver - -\anchor OPT_ma86_print_level - ma86_print_level: Debug printing level +\anchor OPT_spral_scaling_2 +spral_scaling_2 (advanced): Second scaling strategy.
- The valid range for this integer option is unrestricted and its default value is -1. + If spral_scaling = dynamic, this scaling is used according to the trigger spral_switch_2. If spral_switch_3 is triggered, it is disabled. The default value for this string option is "mc64". +Possible values: + - none: Do not scale the linear system matrix. + - mc64: Scale using weighted bipartite matching (MC64). + - auction: Scale using the auction algorithm. + - matching: Scale using the matching-based ordering. + - ruiz: Scale using the norm-equilibration algorithm of Ruiz (MC77).
-\anchor OPT_ma86_nemin - ma86_nemin: Node Amalgamation parameter +\anchor OPT_spral_scaling_3 +spral_scaling_3 (advanced): Third scaling strategy.
- Two nodes in elimination tree are merged if result has fewer than ma86_nemin variables. The valid range for this integer option is 1 ≤ ma86_nemin and its default value is 32. + If spral_scaling = dynamic, this scaling is used according to the trigger spral_switch_3. The default value for this string option is "none". +Possible values: + - none: Do not scale the linear system matrix. + - mc64: Scale using weighted bipartite matching (MC64). + - auction: Scale using the auction algorithm. + - matching: Scale using the matching-based ordering. + - ruiz: Scale using the norm-equilibration algorithm of Ruiz (MC77).
-\anchor OPT_ma86_order - ma86_order: Controls type of ordering +\anchor OPT_spral_switch_1 +spral_switch_1 (advanced): First switch, determining when spral_scaling_1 is enabled.
- The default value for this string option is "auto". + If spral_scaling = dynamic, spral_scaling_1 is enabled according to this condition. If spral_switch_2 occurs, this option is henceforth ignored. The default value for this string option is "at_start". Possible values: - - auto: Try both AMD and MeTiS, pick best - - amd: Use the HSL_MC68 approximate minimum degree algorithm - - metis: Use the MeTiS nested dissection algorithm (if available) + - never: Scaling is never enabled. + - at_start: Scaling is used from the very start. + - at_start_reuse: Scaling is used on the first iteration, then reused thereafter. + - on_demand: Scaling is used when iterative refinement has failed. + - on_demand_reuse: As on_demand, but scaling from previous iteration is reused. + - high_delay: Scaling is used after more than 0.05*n delays are present. + - high_delay_reuse: Scaling is used only when previous iteration created more that 0.05*n additional delays; otherwise, reuse scaling from the previous iteration. + - od_hd: Combination of on_demand and high_delay. + - od_hd_reuse: Combination of on_demand_reuse and high_delay_reuse
-\anchor OPT_ma86_scaling - ma86_scaling: Controls scaling of matrix +\anchor OPT_spral_switch_2 +spral_switch_2 (advanced): Second switch, determining when spral_scaling_2 is enabled.
- The default value for this string option is "mc64". + If spral_scaling = dynamic, spral_scaling_2 is enabled according to this condition. If spral_switch_3 occurs, this option is henceforth ignored. The default value for this string option is "on_demand". Possible values: - - none: Do not scale the linear system matrix - - mc64: Scale linear system matrix using MC64 - - mc77: Scale linear system matrix using MC77 [1,3,0] + - never: Scaling is never enabled. + - at_start: Scaling is used from the very start. + - at_start_reuse: Scaling is used on the first iteration, then reused thereafter. + - on_demand: Scaling is used when iterative refinement has failed. + - on_demand_reuse: As on_demand, but scaling from previous iteration is reused. + - high_delay: Scaling is used after more than 0.05*n delays are present. + - high_delay_reuse: Scaling is used only when previous iteration created more that 0.05*n additional delays; otherwise, reuse scaling from the previous iteration. + - od_hd: Combination of on_demand and high_delay. + - od_hd_reuse: Combination of on_demand_reuse and high_delay_reuse
-\anchor OPT_ma86_small - ma86_small: Zero Pivot Threshold +\anchor OPT_spral_switch_3 +spral_switch_3 (advanced): Third switch, determining when spral_scaling_3 is enabled.
- Any pivot less than ma86_small is treated as zero. The valid range for this real option is 0 ≤ ma86_small and its default value is 10-20. + If spral_scaling = dynamic, spral_scaling_3 is enabled according to this condition. The default value for this string option is "never". +Possible values: + - never: Scaling is never enabled. + - at_start: Scaling is used from the very start. + - at_start_reuse: Scaling is used on the first iteration, then reused thereafter. + - on_demand: Scaling is used when iterative refinement has failed. + - on_demand_reuse: As on_demand, but scaling from previous iteration is reused. + - high_delay: Scaling is used after more than 0.05*n delays are present. + - high_delay_reuse: Scaling is used only when previous iteration created more that 0.05*n additional delays; otherwise, reuse scaling from the previous iteration. + - od_hd: Combination of on_demand and high_delay. + - od_hd_reuse: Combination of on_demand_reuse and high_delay_reuse
-\anchor OPT_ma86_static - ma86_static: Static Pivoting Threshold +\anchor OPT_spral_small +spral_small: Zero Pivot Threshold
- See MA86 documentation. Either ma86_static=0.0 or ma86_static>ma86_small. ma86_static=0.0 disables static pivoting. The valid range for this real option is 0 ≤ ma86_static and its default value is 0. + Any pivot less than spral_small is treated as zero. The valid range for this real option is 0 < spral_small and its default value is 10-20. +
+\anchor OPT_spral_small_subtree_threshold +spral_small_subtree_threshold: Small Subtree Threshold +
+ Maximum number of FLOPS in a subtree treated as a single task. The valid range for this real option is 0 < spral_small_subtree_threshold and its default value is 4 · 10+06.
-\anchor OPT_ma86_u - ma86_u: Pivoting Threshold +\anchor OPT_spral_u +spral_u: Pivoting Threshold
- See MA86 documentation. The valid range for this real option is 0 ≤ ma86_u ≤ 0.5 and its default value is 10-08. + Relative pivot threshold used in symmetric indefinite case. The valid range for this real option is 0 < spral_u ≤ 0.5 and its default value is 10-08. +
+\anchor OPT_spral_umax +spral_umax: Maximum Pivoting Threshold +
+ See SPRAL documentation. The valid range for this real option is 0 < spral_umax ≤ 0.5 and its default value is 0.0001.
-\anchor OPT_ma86_umax - ma86_umax: Maximum Pivoting Threshold +\anchor OPT_spral_use_gpu +spral_use_gpu: Specifies whether or not graphics processing units (GPUs) are used by the SPRAL linear solver if present.
- Maximum value to which u will be increased to improve quality. The valid range for this real option is 0 ≤ ma86_umax ≤ 0.5 and its default value is 0.0001. + The default value for this string option is "yes". +Possible values: yes, no
-\subsection OPT_MA97_Linear_Solver MA97 Linear Solver -\anchor OPT_ma97_print_level - ma97_print_level: Debug printing level -
- The valid range for this integer option is unrestricted and its default value is -1. +\subsection OPT_WSMP_Linear_Solver WSMP Linear Solver +\anchor OPT_wsmp_num_threads +wsmp_num_threads: Number of threads to be used in WSMP +
+ The valid range for this integer option is unrestricted and its default value is 1.
-\anchor OPT_ma97_nemin - ma97_nemin: Node Amalgamation parameter +\anchor OPT_wsmp_ordering_option +wsmp_ordering_option: Determines how ordering is done in WSMP
- Two nodes in elimination tree are merged if result has fewer than ma97_nemin variables. The valid range for this integer option is 1 ≤ ma97_nemin and its default value is 8. - + This corresponds to the value of WSSMP's IPARM(16). The valid range for this integer option is -2 ≤ wsmp_ordering_option ≤ 3 and its default value is 1.
-\anchor OPT_ma97_order - ma97_order: Controls type of ordering +\anchor OPT_wsmp_ordering_option2 +wsmp_ordering_option2 (advanced): Determines how ordering is done in WSMP
- The default value for this string option is "auto". - -Possible values: - - auto: Use HSL_MA97 heuristic to guess best of AMD and METIS - - best: Try both AMD and MeTiS, pick best - - amd: Use the HSL_MC68 approximate minimum degree algorithm - - metis: Use the MeTiS nested dissection algorithm - - matched-auto: Use the HSL_MC80 matching with heuristic choice of AMD or METIS - - matched-metis: Use the HSL_MC80 matching based ordering with METIS - - matched-amd: Use the HSL_MC80 matching based ordering with AMD + This corresponds to the value of WSSMP's IPARM(20). The valid range for this integer option is 0 ≤ wsmp_ordering_option2 ≤ 3 and its default value is 1.
-\anchor OPT_ma97_scaling - ma97_scaling: Specifies strategy for scaling +\anchor OPT_wsmp_pivtol +wsmp_pivtol: Pivot tolerance for the linear solver WSMP.
- The default value for this string option is "dynamic". - -Possible values: - - none: Do not scale the linear system matrix - - mc30: Scale all linear system matrices using MC30 - - mc64: Scale all linear system matrices using MC64 - - mc77: Scale all linear system matrices using MC77 [1,3,0] - - dynamic: Dynamically select scaling according to rules specified by ma97_scalingX and ma97_switchX options. + A smaller number pivots for sparsity, a larger number pivots for stability. The valid range for this real option is 0 < wsmp_pivtol < 1 and its default value is 0.0001.
-\anchor OPT_ma97_scaling1 - ma97_scaling1: First scaling. +\anchor OPT_wsmp_pivtolmax +wsmp_pivtolmax: Maximum pivot tolerance for the linear solver WSMP.
- If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch1. If ma97_switch2 is triggered it is disabled. The default value for this string option is "mc64". - -Possible values: - - none: No scaling - - mc30: Scale linear system matrix using MC30 - - mc64: Scale linear system matrix using MC64 - - mc77: Scale linear system matrix using MC77 [1,3,0] + Ipopt may increase pivtol as high as pivtolmax to get a more accurate solution to the linear system. The valid range for this real option is 0 < wsmp_pivtolmax < 1 and its default value is 0.1.
-\anchor OPT_ma97_scaling2 - ma97_scaling2: Second scaling. +\anchor OPT_wsmp_scaling +wsmp_scaling: Determines how the matrix is scaled by WSMP.
- If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch2. If ma97_switch3 is triggered it is disabled. The default value for this string option is "mc64". - -Possible values: - - none: No scaling - - mc30: Scale linear system matrix using MC30 - - mc64: Scale linear system matrix using MC64 - - mc77: Scale linear system matrix using MC77 [1,3,0] + This corresponds to the value of WSSMP's IPARM(10). The valid range for this integer option is 0 ≤ wsmp_scaling ≤ 3 and its default value is 0.
-\anchor OPT_ma97_scaling3 - ma97_scaling3: Third scaling. +\anchor OPT_wsmp_singularity_threshold +wsmp_singularity_threshold: WSMP's singularity threshold.
- If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch3. The default value for this string option is "mc64". - -Possible values: - - none: No scaling - - mc30: Scale linear system matrix using MC30 - - mc64: Scale linear system matrix using MC64 - - mc77: Scale linear system matrix using MC77 [1,3,0] + WSMP's DPARM(10) parameter. The smaller this value the less likely a matrix is declared singular. The valid range for this real option is 0 < wsmp_singularity_threshold < 1 and its default value is 10-18.
-\anchor OPT_ma97_small - ma97_small: Zero Pivot Threshold +\anchor OPT_wsmp_write_matrix_iteration +wsmp_write_matrix_iteration (advanced): Iteration in which the matrices are written to files.
- Any pivot less than ma97_small is treated as zero. The valid range for this real option is 0 ≤ ma97_small and its default value is 10-20. - + If non-negative, this option determines the iteration in which all matrices given to WSMP are written to files. The valid range for this integer option is -1 ≤ wsmp_write_matrix_iteration and its default value is -1.
-\anchor OPT_ma97_solve_blas3 - ma97_solve_blas3: Controls if blas2 or blas3 routines are used for solve +\anchor OPT_wsmp_skip_inertia_check +wsmp_skip_inertia_check (advanced): Whether to always pretend that inertia is correct.
- The default value for this string option is "no". + Setting this option to "yes" essentially disables inertia check. This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control. The default value for this string option is "no". -Possible values: - - no: Use BLAS2 (faster, some implementations bit incompatible) - - yes: Use BLAS3 (slower) +Possible values: yes, no
-\anchor OPT_ma97_switch1 - ma97_switch1: First switch, determine when ma97_scaling1 is enabled. +\anchor OPT_wsmp_no_pivoting +wsmp_no_pivoting (advanced): Whether to use the static pivoting option of WSMP.
- If ma97_scaling=dynamic, ma97_scaling1 is enabled according to this condition. If ma97_switch2 occurs this option is henceforth ignored. The default value for this string option is "od_hd_reuse". + Setting this option to "yes" means that WSMP is instructed not to do pivoting. This works only in certain situations (when the Hessian block is known to be positive definite or when we are using L-BFGS). It can also lead to a lot of fill-in. The default value for this string option is "no". Possible values: - - never: Scaling is never enabled. - - at_start: Scaling to be used from the very start. - - at_start_reuse: Scaling to be used on first iteration, then reused thereafter. - - on_demand: Scaling to be used after Ipopt request improved solution (i.e. iterative refinement has failed). - - on_demand_reuse: As on_demand, but reuse scaling from previous itr - - high_delay: Scaling to be used after more than 0.05*n delays are present - - high_delay_reuse: Scaling to be used only when previous itr created more that 0.05*n additional delays, otherwise reuse scaling from previous itr - - od_hd: Combination of on_demand and high_delay - - od_hd_reuse: Combination of on_demand_reuse and high_delay_reuse + - no: use the regular version + - yes: use static pivoting
-\anchor OPT_ma97_switch2 - ma97_switch2: Second switch, determine when ma97_scaling2 is enabled. +\anchor OPT_wsmp_max_iter +wsmp_max_iter (advanced): Maximal number of iterations in iterative WISMP
- If ma97_scaling=dynamic, ma97_scaling2 is enabled according to this condition. If ma97_switch3 occurs this option is henceforth ignored. The default value for this string option is "never". - -Possible values: - - never: Scaling is never enabled. - - at_start: Scaling to be used from the very start. - - at_start_reuse: Scaling to be used on first iteration, then reused thereafter. - - on_demand: Scaling to be used after Ipopt request improved solution (i.e. iterative refinement has failed). - - on_demand_reuse: As on_demand, but reuse scaling from previous itr - - high_delay: Scaling to be used after more than 0.05*n delays are present - - high_delay_reuse: Scaling to be used only when previous itr created more that 0.05*n additional delays, otherwise reuse scaling from previous itr - - od_hd: Combination of on_demand and high_delay - - od_hd_reuse: Combination of on_demand_reuse and high_delay_reuse + The valid range for this integer option is 1 ≤ wsmp_max_iter and its default value is 1000.
-\anchor OPT_ma97_switch3 - ma97_switch3: Third switch, determine when ma97_scaling3 is enabled. +\anchor OPT_wsmp_inexact_droptol +wsmp_inexact_droptol (advanced): Drop tolerance for inexact factorization preconditioner in WISMP.
- If ma97_scaling=dynamic, ma97_scaling3 is enabled according to this condition. The default value for this string option is "never". - -Possible values: - - never: Scaling is never enabled. - - at_start: Scaling to be used from the very start. - - at_start_reuse: Scaling to be used on first iteration, then reused thereafter. - - on_demand: Scaling to be used after Ipopt request improved solution (i.e. iterative refinement has failed). - - on_demand_reuse: As on_demand, but reuse scaling from previous itr - - high_delay: Scaling to be used after more than 0.05*n delays are present - - high_delay_reuse: Scaling to be used only when previous itr created more that 0.05*n additional delays, otherwise reuse scaling from previous itr - - od_hd: Combination of on_demand and high_delay - - od_hd_reuse: Combination of on_demand_reuse and high_delay_reuse + DPARM(14) in WISMP The valid range for this real option is 0 ≤ wsmp_inexact_droptol and its default value is 0.
-\anchor OPT_ma97_u - ma97_u: Pivoting Threshold +\anchor OPT_wsmp_inexact_fillin_limit +wsmp_inexact_fillin_limit (advanced): Fill-in limit for inexact factorization preconditioner in WISMP.
- See MA97 documentation. The valid range for this real option is 0 ≤ ma97_u ≤ 0.5 and its default value is 10-08. - + DPARM(15) in WISMP The valid range for this real option is 0 ≤ wsmp_inexact_fillin_limit and its default value is 0.
-\anchor OPT_ma97_umax - ma97_umax: Maximum Pivoting Threshold -
- See MA97 documentation. The valid range for this real option is 0 ≤ ma97_umax ≤ 0.5 and its default value is 0.0001. -
+\subsection OPT_Mumps_Linear_Solver Mumps Linear Solver -\subsection OPT_MUMPS_Linear_Solver MUMPS Linear Solver +\anchor OPT_mumps_print_level +mumps_print_level: Debug printing level for the linear solver MUMPS +
+ 0: no printing; 1: Error messages only; 2: Error, warning, and main statistic messages; 3: Error and warning messages and terse diagnostics; >=4: All information. The valid range for this integer option is 0 ≤ mumps_print_level and its default value is 0. +
\anchor OPT_mumps_pivtol - mumps_pivtol: Pivot tolerance for the linear solver MUMPS. +mumps_pivtol: Pivot tolerance for the linear solver MUMPS.
- A smaller number pivots for sparsity, a larger number pivots for stability. This option is only available if Ipopt has been compiled with MUMPS. The valid range for this real option is 0 ≤ mumps_pivtol ≤ 1 and its default value is 10-06. - + A smaller number pivots for sparsity, a larger number pivots for stability. The valid range for this real option is 0 ≤ mumps_pivtol ≤ 1 and its default value is 10-06.
\anchor OPT_mumps_pivtolmax - mumps_pivtolmax: Maximum pivot tolerance for the linear solver MUMPS. +mumps_pivtolmax: Maximum pivot tolerance for the linear solver MUMPS.
- Ipopt may increase pivtol as high as pivtolmax to get a more accurate solution to the linear system. This option is only available if Ipopt has been compiled with MUMPS. The valid range for this real option is 0 ≤ mumps_pivtolmax ≤ 1 and its default value is 0.1. - + Ipopt may increase pivtol as high as pivtolmax to get a more accurate solution to the linear system. The valid range for this real option is 0 ≤ mumps_pivtolmax ≤ 1 and its default value is 0.1.
\anchor OPT_mumps_mem_percent - mumps_mem_percent: Percentage increase in the estimated working space for MUMPS. +mumps_mem_percent: Percentage increase in the estimated working space for MUMPS.
- In MUMPS when significant extra fill-in is caused by numerical pivoting, larger values of mumps_mem_percent may help use the workspace more efficiently. On the other hand, if memory requirement are too large at the very beginning of the optimization, choosing a much smaller value for this option, such as 5, might reduce memory requirements. The valid range for this integer option is 0 ≤ mumps_mem_percent and its default value is 1000. - + When significant extra fill-in is caused by numerical pivoting, larger values of mumps_mem_percent may help use the workspace more efficiently. On the other hand, if memory requirement are too large at the very beginning of the optimization, choosing a much smaller value for this option, such as 5, might reduce memory requirements. The valid range for this integer option is 0 ≤ mumps_mem_percent and its default value is 1000.
\anchor OPT_mumps_permuting_scaling - mumps_permuting_scaling: Controls permuting and scaling in MUMPS +mumps_permuting_scaling: Controls permuting and scaling in MUMPS
This is ICNTL(6) in MUMPS. The valid range for this integer option is 0 ≤ mumps_permuting_scaling ≤ 7 and its default value is 7. -
\anchor OPT_mumps_pivot_order - mumps_pivot_order: Controls pivot order in MUMPS +mumps_pivot_order: Controls pivot order in MUMPS
This is ICNTL(7) in MUMPS. The valid range for this integer option is 0 ≤ mumps_pivot_order ≤ 7 and its default value is 7. -
\anchor OPT_mumps_scaling - mumps_scaling: Controls scaling in MUMPS +mumps_scaling: Controls scaling in MUMPS
This is ICNTL(8) in MUMPS. The valid range for this integer option is -2 ≤ mumps_scaling ≤ 77 and its default value is 77. - -
- -\subsection OPT_Pardiso_Linear_Solver Pardiso Linear Solver - -\anchor OPT_pardiso_matching_strategy - pardiso_matching_strategy: Matching strategy to be used by Pardiso -
- This is IPAR(13) in Pardiso manual. The default value for this string option is "complete+2x2". - -Possible values: - - complete: Match complete (IPAR(13)=1) - - complete+2x2: Match complete+2x2 (IPAR(13)=2) - - constraints: Match constraints (IPAR(13)=3)
-\anchor OPT_pardiso_max_iterative_refinement_steps - pardiso_max_iterative_refinement_steps: Limit on number of iterative refinement steps. +\anchor OPT_mumps_dep_tol +mumps_dep_tol (advanced): Threshold to consider a pivot at zero in detection of linearly dependent constraints with MUMPS.
- The solver does not perform more than the absolute value of this value steps of iterative refinement and stops the process if a satisfactory level of accuracy of the solution in terms of backward error is achieved. If negative, the accumulation of the residue uses extended precision real and complex data types. Perturbed pivots result in iterative refinement. The solver automatically performs two steps of iterative refinements when perturbed pivots are obtained during the numerical factorization and this option is set to 0. The valid range for this integer option is unrestricted and its default value is 0. - + This is CNTL(3) in MUMPS. The valid range for this real option is unrestricted and its default value is 0.
-\anchor OPT_pardiso_msglvl - pardiso_msglvl: Pardiso message level -
- This determines the amount of analysis output from the Pardiso solver. This is MSGLVL in the Pardiso manual. The valid range for this integer option is 0 ≤ pardiso_msglvl and its default value is 0. -
+\subsection OPT_MA28_Linear_Solver MA28 Linear Solver -\anchor OPT_pardiso_order - pardiso_order: Controls the fill-in reduction ordering algorithm for the input matrix. +\anchor OPT_ma28_pivtol +ma28_pivtol: Pivot tolerance for linear solver MA28.
- The default value for this string option is "metis". - -Possible values: - - amd: minimum degree algorithm - - one: undocumented - - metis: MeTiS nested dissection algorithm - - pmetis: parallel (OpenMP) version of MeTiS nested dissection algorithm - - four: undocumented - - five: undocumented + The valid range for this real option is 0 < ma28_pivtol ≤ 1 and its default value is 0.01.
-\section OPTIONS_AMPL Options available via the AMPL Interface - -The following is a list of options that is available via AMPL: - -| Option | Description | -|:-------|:------------| -| \ref OPT_acceptable_compl_inf_tol "acceptable_compl_inf_tol" | Acceptance threshold for the complementarity conditions | -| \ref OPT_acceptable_constr_viol_tol "acceptable_constr_viol_tol" | Acceptance threshold for the constraint violation | -| \ref OPT_acceptable_dual_inf_tol "acceptable_dual_inf_tol" | Acceptance threshold for the dual infeasibility | -| \ref OPT_acceptable_tol "acceptable_tol" | Acceptable convergence tolerance (relative) | -| \ref OPT_alpha_for_y "alpha_for_y" | Step size for constraint multipliers | -| \ref OPT_bound_frac "bound_frac" | Desired minimal relative distance of initial point to bound | -| \ref OPT_bound_mult_init_val "bound_mult_init_val" | Initial value for the bound multipliers | -| \ref OPT_bound_push "bound_push" | Desired minimal absolute distance of initial point to bound | -| \ref OPT_bound_relax_factor "bound_relax_factor" | Factor for initial relaxation of the bounds | -| \ref OPT_compl_inf_tol "compl_inf_tol" | Acceptance threshold for the complementarity conditions | -| \ref OPT_constr_mult_init_max "constr_mult_init_max" | Maximal allowed least-square guess of constraint multipliers | -| \ref OPT_constr_viol_tol "constr_viol_tol" | Desired threshold for the constraint violation | -| \ref OPT_diverging_iterates_tol "diverging_iterates_tol" | Threshold for maximal value of primal iterates | -| \ref OPT_dual_inf_tol "dual_inf_tol" | Desired threshold for the dual infeasibility | -| \ref OPT_expect_infeasible_problem "expect_infeasible_problem" | Enable heuristics to quickly detect an infeasible problem | -| \ref OPT_file_print_level "file_print_level" | Verbosity level for output file | -| halt_on_ampl_error | Exit with message on evaluation error | -| \ref OPT_hessian_approximation "hessian_approximation" | Can enable Quasi-Newton approximation of hessian | -| \ref OPT_honor_original_bounds "honor_original_bounds" | If no, solution might slightly violate bounds | -| \ref OPT_linear_scaling_on_demand "linear_scaling_on_demand" | Enables heuristic for scaling only when seems required | -| \ref OPT_linear_solver "linear_solver" | Linear solver to be used for step calculation | -| \ref OPT_linear_system_scaling "linear_system_scaling" | Method for scaling the linear systems | -| \ref OPT_ma27_pivtol "ma27_pivtol" | Pivot tolerance for the linear solver MA27 | -| \ref OPT_ma27_pivtolmax "ma27_pivtolmax" | Maximal pivot tolerance for the linear solver MA27 | -| \ref OPT_ma57_pivot_order "ma57_pivot_order" | Controls pivot order in MA57 | -| \ref OPT_ma57_pivtol "ma57_pivtol" | Pivot tolerance for the linear solver MA57 | -| \ref OPT_ma57_pivtolmax "ma57_pivtolmax" | Maximal pivot tolerance for the linear solver MA57 | -| \ref OPT_max_cpu_time "max_cpu_time" | CPU time limit | -| \ref OPT_max_iter "max_iter" | Maximum number of iterations | -| \ref OPT_max_refinement_steps "max_refinement_steps" | Maximal number of iterative refinement steps per linear system solve | -| \ref OPT_max_soc "max_soc" | Maximal number of second order correction trial steps | -| \ref OPT_max_iter "maxit" (Ipopt name: max_iter) | Maximum number of iterations | -| \ref OPT_min_refinement_steps "min_refinement_steps" | Minimum number of iterative refinement steps per linear system solve | -| \ref OPT_mu_init "mu_init" | Initial value for the barrier parameter | -| \ref OPT_mu_max "mu_max" | Maximal value for barrier parameter for adaptive strategy | -| \ref OPT_mu_oracle "mu_oracle" | Oracle for a new barrier parameter in the adaptive strategy | -| \ref OPT_mu_strategy "mu_strategy" | Update strategy for barrier parameter | -| \ref OPT_nlp_scaling_max_gradient "nlp_scaling_max_gradient" | Maximum gradient after scaling | -| \ref OPT_nlp_scaling_method "nlp_scaling_method" | Select the technique used for scaling the NLP | -| \ref OPT_obj_scaling_factor "obj_scaling_factor" | Scaling factor for the objective function | -| \ref OPT_option_file_name "option_file_name" | File name of options file (default: ipopt.opt) | -| \ref OPT_print_level "outlev" (Ipopt name: print_level) | Verbosity level | -| \ref OPT_output_file "output_file" | File name of an output file (leave unset for no file output) | -| \ref OPT_pardiso_matching_strategy "pardiso_matching_strategy" | Matching strategy for linear solver Pardiso | -| \ref OPT_print_level "print_level" | Verbosity level | -| \ref OPT_print_options_documentation "print_options_documentation" | Print all available options (for ipopt.opt) | -| \ref OPT_print_user_options "print_user_options" | Toggle printing of user options | -| \ref OPT_required_infeasibility_reduction "required_infeasibility_reduction" | Required infeasibility reduction in restoration phase | -| \ref OPT_slack_bound_frac "slack_bound_frac" | Desired minimal relative distance of initial slack to bound | -| \ref OPT_slack_bound_push "slack_bound_push" | Desired minimal absolute distance of initial slack to bound | -| \ref OPT_tol "tol" | Desired convergence tolerance (relative) | -| wantsol | 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 | -| \ref OPT_warm_start_bound_push "warm_start_bound_push" | Enables to specify how much should variables should be pushed inside the feasible region | -| \ref OPT_warm_start_init_point "warm_start_init_point" | Enables to specify bound multiplier values | -| \ref OPT_warm_start_mult_bound_push "warm_start_mult_bound_push" | Enables to specify how much should bound multipliers should be pushed inside the feasible region | -| \ref OPT_watchdog_shortened_iter_trigger "watchdog_shortened_iter_trigger" | Trigger counter for watchdog procedure | */ diff --git a/doc/output.dox b/doc/output.dox index e64a38b99..56a562991 100644 --- a/doc/output.dox +++ b/doc/output.dox @@ -1,18 +1,18 @@ /** \page OUTPUT %Ipopt Output -This pages describes the standard \Ipopt console output +This pages describes the standard %Ipopt console output with the default setting for option \ref OPT_print_level "print_level". -The output is designed to provide a quick summary of each iteration as \Ipopt solves the problem. +The output is designed to provide a quick summary of each iteration as %Ipopt solves the problem. -Before \Ipopt starts to solve the problem, it displays the +Before %Ipopt starts to solve the problem, it displays the problem statistics (number of nonzero-elements in the matrices, number of variables, etc.). Note that if you have fixed variables (both upper -and lower bounds are equal), \Ipopt may remove these +and lower bounds are equal), %Ipopt may remove these variables from the problem internally and not include them in the problem statistics. -Following the problem statistics, \Ipopt will begin to +Following the problem statistics, %Ipopt will begin to solve the problem and you will see output resembling the following, iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls @@ -83,7 +83,7 @@ and the columns of output are defined as, - ls: The number of backtracking line search steps (does not include second-order correction steps). -Note that the step acceptance mechanisms in \Ipopt consider +Note that the step acceptance mechanisms in %Ipopt consider the barrier objective function (Eq (3a) in \cite WaecBieg06:mp) which is usually different from the value reported in the `objective` column. Similarly, for the purposes of the step acceptance, the constraint @@ -95,7 +95,7 @@ iterate might have worse values both for the objective function and the constraint violation as reported in the iteration output, seemingly contradicting globalization procedure. -When the algorithm terminates, \Ipopt will output a message +When the algorithm terminates, %Ipopt will output a message to the screen based on the return status of the call to Optimize. The following is a list of the possible return codes, their corresponding output message to the console, and a brief description. @@ -104,13 +104,13 @@ output message to the console, and a brief description. Console Message: `EXIT: Optimal Solution Found.` - This message indicates that \Ipopt found a (locally) + This message indicates that %Ipopt found a (locally) optimal point within the desired tolerances. - `Solved_To_Acceptable_Level`: Console Message: `EXIT: Solved To Acceptable Level.` - + This indicates that the algorithm did not converge to the "desired" tolerances, but that it was able to obtain a point satisfying the "acceptable" tolerance level as specified by the \ref OPT_acceptable_tol "acceptable_tol" @@ -122,14 +122,15 @@ output message to the console, and a brief description. Console Message: `EXIT: Feasible point for square problem found.` This message is printed if the problem is "square" (i.e., it has as - many equality constraints as free variables) and \Ipopt - found a feasible point. + many equality constraints as free variables) and %Ipopt + found a point that is feasible w.r.t. constr_viol_tol. It may, however, + not be feasible w.r.t. tol. - `Infeasible_Problem_Detected`: Console Message: `EXIT: Converged to a point of local infeasibility. Problem may be infeasible.` - + The restoration phase converged to a point that is a minimizer for the constraint violation (in the \f$\ell_1\f$-norm), but is not feasible for the original problem. This indicates that the problem may be @@ -142,8 +143,8 @@ output message to the console, and a brief description. - `Search_Direction_Becomes_Too_Small`: Console Message: `EXIT: Search Direction is becoming Too Small.` - - This indicates that \Ipopt is calculating very small + + This indicates that %Ipopt is calculating very small step sizes and is making very little progress. This could happen if the problem has been solved to the best numerical accuracy possible given the current scaling. @@ -151,36 +152,43 @@ output message to the console, and a brief description. - `Diverging_Iterates`: Console Message: `EXIT: Iterates divering; problem might be unbounded.` - + This message is printed if the max-norm of the iterates becomes larger than the value of the option \ref OPT_diverging_iterates_tol "diverging_iterates_tol". This can happen if the problem is unbounded below and the iterates are diverging. - + - `User_Requested_Stop`: Console Message: `EXIT: Stopping optimization at current point as requested by user.` - + This message is printed if the user call-back method Ipopt::TNLP::intermediate_callback returned false. - `Maximum_Iterations_Exceeded`: Console Message: `EXIT: Maximum Number of Iterations Exceeded.` - - This indicates that \Ipopt has exceeded the maximum + + This indicates that %Ipopt has exceeded the maximum number of iterations as specified by the option \ref OPT_max_iter "max_iter". +- `Maximum_WallTime_Exceeded`: + + Console Message: `EXIT: Maximum wallclock time exceeded.` + + This indicates that %Ipopt has exceeded the maximum + number of wallclock seconds as specified by the option \ref OPT_max_wall_time "max_wall_time". + - `Maximum_CpuTime_Exceeded`: Console Message: `EXIT: Maximum CPU time exceeded.` - - This indicates that \Ipopt has exceeded the maximum + + This indicates that %Ipopt has exceeded the maximum number of CPU seconds as specified by the option \ref OPT_max_cpu_time "max_cpu_time". - `Restoration_Failed`: Console Message: `EXIT: Restoration Failed!` - + This indicates that the restoration phase failed to find a feasible point that was acceptable to the filter line search for the original problem. This could happen if the problem is highly degenerate, does @@ -189,76 +197,97 @@ output message to the console, and a brief description. - `Error_In_Step_Computation`: - Console Output: `EXIT: Error in step computation (regularization becomes too large?)!` - - This messages is printed if \Ipopt is unable to compute - a search direction, despite several attempts to modify the iteration - matrix. Usually, the value of the regularization parameter then - becomes too large. One situation where this can happen is when - values in the Hessian are invalid (NaN or Inf). You can check - whether this is true by using the option \ref OPT_check_derivatives_for_naninf "check_derivatives_for_naninf". + Console Output: `EXIT: Error in step computation!` + + This message is printed if %Ipopt is unable to compute a step towards + a new iterate and the current iterate is not acceptable for the specified + tolerances. + + A possible reason is that a search direction could not be computed + despite several attempts to modify the iteration matrix. + Usually, the value of the regularization parameter then becomes too large. + One situation where this can happen is when values in the Hessian + are invalid (NaN or Inf). You can check whether this is true by using + the option \ref OPT_check_derivatives_for_naninf "check_derivatives_for_naninf". + + Another reason is that the feasibility restoration phase could not be + activated because the current iterate is not infeasible. Reasons for + this again include that the problem is highly degenerate, badly scaled, + does not satisfy the constraint qualification, or that your NLP code + provides incorrect derivative information. + Before Ipopt 3.14, this resulted in a Restoration_Failed status code + with message "Restoration phase is called at almost feasible point..." - `Invalid_Option`: Console Message: (details about the particular error will be output to the console) - + This indicates that there was some problem specifying the options. See the specific message for details. + This return code is also used when a linear solver is choosen that was + not linked in and a library that contains this linear solver could not be loaded. - `Not_Enough_Degrees_Of_Freedom`: Console Message: `EXIT: Problem has too few degrees of freedom.` - + This indicates that your problem, as specified, has too few degrees of freedom. This can happen if you have too many equality - constraints, or if you fix too many variables (\Ipopt + constraints, or if you fix too many variables (%Ipopt removes fixed variables by default, see also the option \ref OPT_fixed_variable_treatment "fixed_variable_treatment"). - `Invalid_Problem_Definition`: - Console Message: (no console message, this is a return code for the C and Fortran interfaces only.) - - This indicates that there was an exception of some sort when - building the \ref IpoptProblem structure in the C or Fortran interface. + Console Message: `EXIT: Problem has inconsistent variable bounds or constraint sides.` + + This indicates that either there was an exception of some sort when + building the \ref IpoptProblem structure in the C or Fortran interface + or bounds specified for variables or constraints were inconsistent + (lower bound larger than upper bound, left-hand-side larger than right-hand-side). Likely there is an error in your model or the main routine. - `Unrecoverable_Exception`: Console Message: (details about the particular error will be output to the console) - - This indicates that \Ipopt has thrown an exception that + + This indicates that %Ipopt has thrown an exception that does not have an internal return code. See the specific message for details. - `NonIpopt_Exception_Thrown`: Console Message: `Unknown Exception caught in %Ipopt` - - An unknown exception was caught in \Ipopt. This exception could have + + An unknown exception was caught in %Ipopt. This exception could have originated from your model or any linked in third party code. See also Ipopt::IpoptApplication::RethrowNonIpoptException. - `Insufficient_Memory`: Console Message: `EXIT: Not enough memory`. - + An error occurred while trying to allocate memory. The problem may be too large for your current memory and swap configuration. + Console Message: `EXIT: Integer type too small for required memory`. + + A linear solver requires more working space than what can be communicated + to it via the used integer type. + - `Internal_Error`: Console: `EXIT: INTERNAL ERROR: Unknown SolverReturn value - Notify IPOPT Authors.` - + An unknown internal error has occurred. Please notify the authors of - \Ipopt via the mailing list. + %Ipopt via the mailing list. To print additional diagnostic tags for each iteration of -\Ipopt, set the option \ref OPT_print_info_string "print_info_string" to `yes`. With this, a tag will +%Ipopt, set the option \ref OPT_print_info_string "print_info_string" to `yes`. With this, a tag will appear at the end of an iteration line with the following diagnostic meaning that are useful to flag difficulties for a particular -\Ipopt run. +%Ipopt run. |Tag |Description |Reference | |:-----|:------------------------------------------------------------|:---------------------------------------------| diff --git a/doc/special.dox b/doc/special.dox index 2970ca6cb..e00a629b4 100644 --- a/doc/special.dox +++ b/doc/special.dox @@ -7,7 +7,7 @@ When writing code for the evaluation of derivatives it is very easy to make mistakes (much easier than writing it correctly the first time :)). -As a convenient feature, \Ipopt provides the option to run +As a convenient feature, %Ipopt provides the option to run a simple derivative checker, based on finite differences, before the optimization is started. @@ -24,7 +24,7 @@ the option \ref OPT_derivative_test_perturbation "derivative_test_perturbation". (10-8, about the square root of the machine precision) is probably fine in most cases, but if you believe that you see wrong warnings, you might want to play with this parameter. -When the test is performed, \Ipopt prints out a line for +When the test is performed, %Ipopt prints out a line for every partial derivative, for which the user-provided derivative value deviates too much from the finite difference approximation. The relative tolerance for deciding when a warning should be issued, is determined by @@ -53,7 +53,8 @@ numbering is used, i.e., when counting of indices starts with 0 instead of 1). The first floating point number is the value given by the user code, and the second number (after "~") is the finite differences estimation. Finally, the number in square brackets is the relative -difference between these two numbers. +difference between these two numbers +\f$\left(\frac{|\mathrm{approx}-\mathrm{exact}|}{\max(|\mathrm{approx}|,\mathrm{derivative\_test\_tol})}\right)\f$. For constraints, the first index after `jac_g` is the index of the constraint, and the second one corresponds to the variable index (again, @@ -94,7 +95,7 @@ code through some memory checker, such as valgrind on Linux. \section QUASI_NEWTON Quasi-Newton Approximation of Second Derivatives -\Ipopt has an option to approximate the Hessian of the +%Ipopt has an option to approximate the Hessian of the Lagrangian by a limited-memory quasi-Newton method (L-BFGS). You can use this feature by setting the option \ref OPT_hessian_approximation "hessian_approximation" to the value `limited-memory`. @@ -105,21 +106,21 @@ need to implement these functions, but they should return `false` or In general, when second derivatives can be computed with reasonable computational effort, it is usually a good idea to use them, since then -\Ipopt normally converges in fewer iterations and is more +%Ipopt normally converges in fewer iterations and is more robust. An exception might be in cases, where your optimization problem has a dense Hessian, i.e., a large percentage of non-zero entries in the Hessian. In such a case, using the quasi-Newton approximation might be better, even if it increases the number of iterations, since with exact second derivatives the computation time per iteration might be significantly higher due to the very large number of non-zero elements -in the linear systems that \Ipopt solve in order to compute +in the linear systems that %Ipopt solve in order to compute the search direction. Since the Hessian of the Lagrangian is zero for all variables that appear only linearly in the objective and constraint functions, the Hessian approximation should only take place in the space of all nonlinear variables. By default, it is assumed that all variables are -nonlinear, but you can tell \Ipopt explicitly which +nonlinear, but you can tell %Ipopt explicitly which variables are nonlinear, using the Ipopt::TNLP::get_number_of_nonlinear_variables and Ipopt::TNLP::get_list_of_nonlinear_variables methods, see \ref INTERFACE_CPP_ADDITIONAL. (Those methods have been implemented for the @@ -136,27 +137,27 @@ This section is based on documentation by Victor M. Zavala Warm-starting an interior-point algorithm is an important issue. One of the main difficulties arises from the fact that full-space variable information is required to generate the warm-starting point. While -\Ipopt is currently equipped to retrieve and receive this +%Ipopt is currently equipped to retrieve and receive this type of information through the TNLP interface, there exist some communication barriers in the AMPL interface. When the user solves the -problem \ref NLP "(NLP)", \Ipopt will only return the optimal +problem \ref NLP "(NLP)", %Ipopt will only return the optimal values of the primal variables \f$x\f$ and of the constraint multipliers corresponding to the active sides of \f$g^L \leq g(x) \leq g^U\f$. The constraint multiplier values can be accessed through the `.dual` suffix or through the `.sol` file. If this information is used to solve the same problem again, you will notice -that \Ipopt will take some iterations in finding the same +that %Ipopt will take some iterations in finding the same solution. The reason for this is that we are missing the input information of the multipliers \f$z^L\f$ and \f$z^U\f$ corresponding to the variable bounds \f$x^L \leq x \leq x^U\f$. -However, \Ipopt also passes the values of the bound multipliers +However, %Ipopt also passes the values of the bound multipliers \f$z^L\f$ and \f$z^U\f$ to AMPL. This will be communicated to the AMPL user through the suffixes `ipopt_zL_out` and `ipopt_zU_out`, respectively. The user does not need to declare these suffixes, they will be generated automatically in the AMPL interface. The user can use the suffix values to initialize the bound multipliers for subsequent -calls. In order to pass this information to \Ipopt, the +calls. In order to pass this information to %Ipopt, the user will need to declare and assign values to the suffixes `ipopt_zL_in` and `ipopt_zU_in`. For instance, for a given variable `x[i]`, this can be done by setting: @@ -165,7 +166,7 @@ let x[i].ipopt_zL_in := x[i].ipopt_zL_out; let x[i].ipopt_zU_in := x[i].ipopt_zU_out; \endverbatim -If the user does not specify some of these values, \Ipopt +If the user does not specify some of these values, %Ipopt will set these multipliers to 1.0 (as before). In order to make the warm-start effective, the user has control over the following options from AMPL: @@ -218,7 +219,7 @@ for parametric nonlinear programs. Moreover, for NLP algorithms that use exact second derivatives, sensitivity can be implemented very efficiently within NLP solvers and provide valuable information with very little added computation. This implementation provides -\Ipopt with the capabilities to calculate sensitivities, +%Ipopt with the capabilities to calculate sensitivities, and approximate perturbed solutions with them. The basic sensitivity strategy implemented here is based on the @@ -229,8 +230,8 @@ linearization of the KKT conditions. More details can be found in \cite PLNB:sIpopt. If you are using `sIpopt` for your research, please cite \cite PLNB:sIpopt. -The `sIpopt` project is available in the \Ipopt repository under -`$IPOPTDIR/contrib/sIPOPT`. It is build together with the \Ipopt library +The `sIpopt` project is available in the %Ipopt repository under +`$IPOPTDIR/contrib/sIPOPT`. It is build together with the %Ipopt library and the generated library `libsipopt.*` and AMPL executable `ipopt_sens` are installed in `$PREFIX/lib` and `$PREFIX/bin`. @@ -245,10 +246,10 @@ are an example that shows how to use `sIpopt` to solve the NLP \f$p_1\f$ and \f$p_2\f$ from \f$p_a = (p_1, p_2) = (5, 1)\f$ to \f$p_b = (4.5, 1)\f$. Note, that `sIpopt` has been developed under the constraint -that it must work with the regular \Ipopt code. Due to this +that it must work with the regular %Ipopt code. Due to this constraint, some compromises had to be made. However, there is an effort to develop `sIpopt` 2, which is a fork of the -\Ipopt code that allows for the explicit definition of +%Ipopt code that allows for the explicit definition of parametric NLPs. This code can be found at . If you have questions about `sIpopt` 2, please contact ​Hans Pirnay. @@ -266,15 +267,14 @@ descent direction for the objective function when the constraint violation is sufficiently small, which in turn is necessary to guarantee global convergence. -To detect the presence of negative curvature, the default method -implemented in IPOPT requires inertia information of the augmented -system. The inertia of the augmented system is the number of positive, -negative, and zero eigenvalues. Inertia is currently estimated using -symmetric indefinite factorization routines implemented in powerful -packages such as MA27, MA57, or Pardiso. When more general linear -algebra strategies/packages are used (e.g., iterative, parallel -decomposition), however, inertia information is difficult (if not -impossible) to obtain. +To detect the presence of negative curvature, the default method implemented in +IPOPT requires inertia information of the augmented system. The inertia of the +augmented system is the number of positive, negative, and zero eigenvalues. +Inertia is currently estimated using symmetric indefinite factorization +routines implemented in powerful packages such as MA27, MA57, Pardiso, or +SPRAL. When more general linear algebra strategies/packages are used (e.g., +iterative, parallel decomposition), however, inertia information is difficult +(if not impossible) to obtain. In \cite ChiangZavala2014, we present acceptance tests for the search step that do not require inertia information of the linear system and prove @@ -289,7 +289,7 @@ it provides more flexibility to accept steps. This flexibility is particularly beneficial in problems that are inherently ill-conditioned and require significant amounts of regularization. -The inertia-free capability implemented in \Ipopt is +The inertia-free capability implemented in %Ipopt is controlled by the options \ref OPT_neg_curv_test_tol "neg_curv_test_tol" and \ref OPT_neg_curv_test_reg "neg_curv_test_reg". diff --git a/doc/stylesheet.css b/doc/stylesheet.css index 3794e03c3..eae87e8d4 100644 --- a/doc/stylesheet.css +++ b/doc/stylesheet.css @@ -1,4 +1,4 @@ -/* The standard CSS for doxygen 1.8.13 */ +/* The standard CSS for doxygen 1.8.18 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; @@ -53,17 +53,24 @@ dt { font-weight: bold; } -div.multicol { +ul.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; + column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; + column-count: 3; } p.startli, p.startdd { margin-top: 2px; } +th p.starttd, p.intertd, p.endtd { + font-size: 100%; + font-weight: 700; +} + p.starttd { margin-top: 0px; } @@ -80,6 +87,15 @@ p.endtd { margin-bottom: 2px; } +p.interli { +} + +p.interdd { +} + +p.intertd { +} + /* @end */ caption { @@ -134,12 +150,12 @@ a.qindex { a.qindexHL { font-weight: bold; background-color: #9CAFD4; - color: #ffffff; + color: #FFFFFF; border: 1px double #869DCA; } .contents a.qindexHL:visited { - color: #ffffff; + color: #FFFFFF; } a.el { @@ -163,6 +179,25 @@ dl.el { margin-left: -1cm; } +ul { + overflow: hidden; /*Fixed: list item bullets overlap floating elements*/ +} + +#side-nav ul { + overflow: visible; /* reset ul rule for scroll bar in GENERATE_TREEVIEW window */ +} + +#main-nav ul { + overflow: visible; /* reset ul rule for the navigation bar drop down lists */ +} + +.fragment { + text-align: left; + direction: ltr; + overflow-x: auto; /*Fixed: fragment lines overlap floating elements*/ + overflow-y: hidden; +} + pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; @@ -177,8 +212,8 @@ pre.fragment { } div.fragment { - padding: 0px; - margin: 4px 8px 4px 2px; + padding: 0 0 1px 0; /*Fixed: last line underline overlap border*/ + margin: 4px 8px 4px 2px; background-color: #FBFCFD; border: 1px solid #C4CFE5; } @@ -248,7 +283,7 @@ span.lineno a:hover { div.ah, span.ah { background-color: black; font-weight: bold; - color: #ffffff; + color: #FFFFFF; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; @@ -324,7 +359,7 @@ img.formulaDsp { } -img.formulaInl { +img.formulaInl, img.inline { vertical-align: middle; } @@ -402,6 +437,13 @@ blockquote { padding: 0 12px 0 16px; } +blockquote.DocNodeRTL { + border-left: 0; + border-right: 2px solid #9CAFD4; + margin: 0 4px 0 24px; + padding: 0 16px 0 12px; +} + /* @end */ /* @@ -498,7 +540,7 @@ table.memberdecls { white-space: nowrap; } -.memItemRight { +.memItemRight, .memTemplItemRight { width: 100%; } @@ -666,17 +708,17 @@ dl.reflist dd { padding-left: 0px; } -.params .paramname, .retval .paramname { +.params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { font-weight: bold; vertical-align: top; } -.params .paramtype { +.params .paramtype, .tparams .paramtype { font-style: italic; vertical-align: top; } -.params .paramdir { +.params .paramdir, .tparams .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } @@ -1081,72 +1123,143 @@ div.headertitle padding: 5px 5px 5px 10px; } -dl -{ - padding: 0 0 0 10px; +.PageDocRTL-title div.headertitle { + text-align: right; + direction: rtl; } -/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ -dl.section -{ +dl { + padding: 0 0 0 0; +} + +/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug, dl.examples */ +dl.section { margin-left: 0px; padding-left: 0px; } -dl.note -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #D0C000; +dl.section.DocNodeRTL { + margin-right: 0px; + padding-right: 0px; } -dl.warning, dl.attention -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #FF0000; +dl.note { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #D0C000; } -dl.pre, dl.post, dl.invariant -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #00D000; +dl.note.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #D0C000; +} + +dl.warning, dl.attention { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #FF0000; } -dl.deprecated -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #505050; +dl.warning.DocNodeRTL, dl.attention.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #FF0000; } -dl.todo -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #00C0E0; +dl.pre, dl.post, dl.invariant { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00D000; } -dl.test -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #3030E0; +dl.pre.DocNodeRTL, dl.post.DocNodeRTL, dl.invariant.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #00D000; } -dl.bug -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #C08050; +dl.deprecated { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #505050; +} + +dl.deprecated.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #505050; +} + +dl.todo { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00C0E0; +} + +dl.todo.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #00C0E0; +} + +dl.test { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #3030E0; +} + +dl.test.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #3030E0; +} + +dl.bug { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #C08050; +} + +dl.bug.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #C08050; } dl.section dd { @@ -1263,6 +1376,11 @@ div.toc { width: 200px; } +.PageDocRTL-title div.toc { + float: left !important; + text-align: right; +} + div.toc li { background: url("bdwn.png") no-repeat scroll 0 5px transparent; font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; @@ -1271,6 +1389,12 @@ div.toc li { padding-top: 2px; } +.PageDocRTL-title div.toc li { + background-position-x: right !important; + padding-left: 0 !important; + padding-right: 10px; +} + div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; @@ -1300,6 +1424,26 @@ div.toc li.level4 { margin-left: 45px; } +.PageDocRTL-title div.toc li.level1 { + margin-left: 0 !important; + margin-right: 0; +} + +.PageDocRTL-title div.toc li.level2 { + margin-left: 0 !important; + margin-right: 15px; +} + +.PageDocRTL-title div.toc li.level3 { + margin-left: 0 !important; + margin-right: 30px; +} + +.PageDocRTL-title div.toc li.level4 { + margin-left: 0 !important; + margin-right: 45px; +} + .inherit_header { font-weight: bold; color: gray; @@ -1413,7 +1557,7 @@ tr.heading h2 { } #powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { - border-top-color: #ffffff; + border-top-color: #FFFFFF; border-width: 10px; margin: 0px -10px; } @@ -1441,7 +1585,7 @@ tr.heading h2 { } #powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { - border-bottom-color: #ffffff; + border-bottom-color: #FFFFFF; border-width: 10px; margin: 0px -10px; } @@ -1468,7 +1612,7 @@ tr.heading h2 { left: 100%; } #powerTip.e:after { - border-left-color: #ffffff; + border-left-color: #FFFFFF; border-width: 10px; top: 50%; margin-top: -10px; @@ -1484,7 +1628,7 @@ tr.heading h2 { right: 100%; } #powerTip.w:after { - border-right-color: #ffffff; + border-right-color: #FFFFFF; border-width: 10px; top: 50%; margin-top: -10px; @@ -1517,7 +1661,6 @@ tr.heading h2 { /* @group Markdown */ -/* table.markdownTable { border-collapse:collapse; margin-top: 4px; @@ -1529,15 +1672,10 @@ table.markdownTable td, table.markdownTable th { padding: 3px 7px 2px; } -table.markdownTableHead tr { -} - -table.markdownTableBodyLeft td, table.markdownTable th { - border: 1px solid #2D4068; - padding: 3px 7px 2px; +table.markdownTable tr { } -th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th.markdownTableHeadNone { +th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { background-color: #374F7F; color: #FFFFFF; font-size: 110%; @@ -1545,52 +1683,48 @@ th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th padding-top: 5px; } -th.markdownTableHeadLeft { +th.markdownTableHeadLeft, td.markdownTableBodyLeft { text-align: left } -th.markdownTableHeadRight { +th.markdownTableHeadRight, td.markdownTableBodyRight { text-align: right } -th.markdownTableHeadCenter { +th.markdownTableHeadCenter, td.markdownTableBodyCenter { text-align: center } -*/ -table.markdownTable { - border-collapse:collapse; - margin-top: 4px; - margin-bottom: 4px; +.DocNodeRTL { + text-align: right; + direction: rtl; } -table.markdownTable td, table.markdownTable th { - border: 1px solid #2D4068; - padding: 3px 7px 2px; +.DocNodeLTR { + text-align: left; + direction: ltr; } -table.markdownTable tr { +table.DocNodeRTL { + width: auto; + margin-right: 0; + margin-left: auto; } -th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { - background-color: #374F7F; - color: #FFFFFF; - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; +table.DocNodeLTR { + width: auto; + margin-right: auto; + margin-left: 0; } -th.markdownTableHeadLeft, td.markdownTableBodyLeft { - text-align: left -} - -th.markdownTableHeadRight, td.markdownTableBodyRight { - text-align: right +tt, code, kbd, samp +{ + display: inline-block; + direction:ltr; } +/* @end */ -th.markdownTableHeadCenter, td.markdownTableBodyCenter { - text-align: center +u { + text-decoration: underline; } - -/* @end */ diff --git a/examples/ScalableProblems/LuksanVlcek1.cpp b/examples/ScalableProblems/LuksanVlcek1.cpp index 80e65c979..a8963941b 100644 --- a/examples/ScalableProblems/LuksanVlcek1.cpp +++ b/examples/ScalableProblems/LuksanVlcek1.cpp @@ -15,10 +15,9 @@ LuksanVlcek1::LuksanVlcek1( Number g_l, Number g_u ) -{ - g_l_ = g_l; - g_u_ = g_u; -} + : g_l_(g_l), + g_u_(g_u) +{ } bool LuksanVlcek1::InitializeProblem( Index N @@ -164,8 +163,8 @@ bool LuksanVlcek1::eval_g( { for( Index i = 0; i < N_ - 2; i++ ) { - g[i] = 3. * pow(x[i + 1], 3.) + 2. * x[i + 2] - 5. + sin(x[i + 1] - x[i + 2]) * sin(x[i + 1] + x[i + 2]) - + 4. * x[i + 1] - x[i] * exp(x[i] - x[i + 1]) - 3.; + g[i] = 3. * std::pow(x[i + 1], 3.) + 2. * x[i + 2] - 5. + std::sin(x[i + 1] - x[i + 2]) * std::sin(x[i + 1] + x[i + 2]) + + 4. * x[i + 1] - x[i] * std::exp(x[i] - x[i + 1]) - 3.; } return true; @@ -209,15 +208,15 @@ bool LuksanVlcek1::eval_jac_g( for( Index i = 0; i < N_ - 2; i++ ) { // x[i] - values[ijac] = -(1. + x[i]) * exp(x[i] - x[i + 1]); + values[ijac] = -(1. + x[i]) * std::exp(x[i] - x[i + 1]); ijac++; // x[i+1] - values[ijac] = 9. * x[i + 1] * x[i + 1] + cos(x[i + 1] - x[i + 2]) * sin(x[i + 1] + x[i + 2]) - + sin(x[i + 1] - x[i + 2]) * cos(x[i + 1] + x[i + 2]) + 4. + x[i] * exp(x[i] - x[i + 1]); + values[ijac] = 9. * x[i + 1] * x[i + 1] + std::cos(x[i + 1] - x[i + 2]) * std::sin(x[i + 1] + x[i + 2]) + + std::sin(x[i + 1] - x[i + 2]) * std::cos(x[i + 1] + x[i + 2]) + 4. + x[i] * std::exp(x[i] - x[i + 1]); ijac++; // x[i+2] - values[ijac] = 2. - cos(x[i + 1] - x[i + 2]) * sin(x[i + 1] + x[i + 2]) - + sin(x[i + 1] - x[i + 2]) * cos(x[i + 1] + x[i + 2]); + values[ijac] = 2. - std::cos(x[i + 1] - x[i + 2]) * std::sin(x[i + 1] + x[i + 2]) + + std::sin(x[i + 1] - x[i + 2]) * std::cos(x[i + 1] + x[i + 2]); ijac++; } } @@ -269,7 +268,7 @@ bool LuksanVlcek1::eval_h( values[ihes] = obj_factor * (2. + 400. * (3. * x[i] * x[i] - x[i + 1])); if( i < N_ - 2 ) { - values[ihes] -= lambda[i] * (2. + x[i]) * exp(x[i] - x[i + 1]); + values[ihes] -= lambda[i] * (2. + x[i]) * std::exp(x[i] - x[i + 1]); } } else @@ -283,15 +282,15 @@ bool LuksanVlcek1::eval_h( if( i < N_ - 1 ) { values[ihes] += lambda[i - 1] - * (18. * x[i] - 2. * sin(x[i] - x[i + 1]) * sin(x[i] + x[i + 1]) - + 2. * cos(x[i] - x[i + 1]) * cos(x[i] + x[i + 1]) - x[i - 1] * exp(x[i - 1] - x[i])); + * (18. * x[i] - 2. * std::sin(x[i] - x[i + 1]) * std::sin(x[i] + x[i + 1]) + + 2. * std::cos(x[i] - x[i + 1]) * std::cos(x[i] + x[i + 1]) - x[i - 1] * std::exp(x[i - 1] - x[i])); } } if( i > 1 ) { // x[i+2]x[i+2] values[ihes] += lambda[i - 2] - * (-2. * sin(x[i - 1] - x[i]) * sin(x[i - 1] + x[i]) - 2. * cos(x[i - 1] - x[i]) * cos(x[i - 1] + x[i])); + * (-2. * std::sin(x[i - 1] - x[i]) * std::sin(x[i - 1] + x[i]) - 2. * std::cos(x[i - 1] - x[i]) * std::cos(x[i - 1] + x[i])); } ihes++; @@ -301,16 +300,16 @@ bool LuksanVlcek1::eval_h( values[ihes] = obj_factor * (-400. * x[i]); if( i < N_ - 2 ) { - values[ihes] += lambda[i] * (1. + x[i]) * exp(x[i] - x[i + 1]); + values[ihes] += lambda[i] * (1. + x[i]) * std::exp(x[i] - x[i + 1]); } /* if (i>0) { // x[i+1],x[i+2] values[ihes] += - lambda[i-1]*( sin(x[i]-x[i+1])*sin(x[i]+x[i+1]) - + cos(x[i]-x[i+1])*cos(x[i]+x[i+1]) - - cos(x[i]-x[i+1])*cos(x[i]+x[i+1]) - - sin(x[i]-x[i+1])*sin(x[i]+x[i+1]) + lambda[i-1]*( std::sin(x[i]-x[i+1])*std::sin(x[i]+x[i+1]) + + std::cos(x[i]-x[i+1])*std::cos(x[i]+x[i+1]) + - std::cos(x[i]-x[i+1])*std::cos(x[i]+x[i+1]) + - std::sin(x[i]-x[i+1])*std::sin(x[i]+x[i+1]) ); } */ diff --git a/examples/ScalableProblems/LuksanVlcek2.cpp b/examples/ScalableProblems/LuksanVlcek2.cpp index e2e207699..cf0c87010 100644 --- a/examples/ScalableProblems/LuksanVlcek2.cpp +++ b/examples/ScalableProblems/LuksanVlcek2.cpp @@ -15,10 +15,9 @@ LuksanVlcek2::LuksanVlcek2( Number g_l, Number g_u ) -{ - g_l_ = g_l; - g_u_ = g_u; -} + : g_l_(g_l), + g_u_(g_u) +{ } bool LuksanVlcek2::InitializeProblem( Index N @@ -171,7 +170,7 @@ bool LuksanVlcek2::eval_g( for( Index i = 0; i < N_ - 7; i++ ) { g[i] = (2. + 5. * x[i + 5] * x[i + 5]) * x[i + 5] + 1.; - for( Index k = Max(0, i - 5); k <= i + 1; k++ ) + for( Index k = Max(Index(0), i - 5); k <= i + 1; k++ ) { g[i] += x[k] * (x[k] + 1.); } @@ -199,7 +198,7 @@ bool LuksanVlcek2::eval_jac_g( Index ijac = 0; for( Index i = 0; i < N_ - 7; i++ ) { - for( Index k = Max(0, i - 5); k <= i + 1; k++ ) + for( Index k = Max(Index(0), i - 5); k <= i + 1; k++ ) { iRow[ijac] = i; jCol[ijac] = k; @@ -219,7 +218,7 @@ bool LuksanVlcek2::eval_jac_g( Index ijac = 0; for( Index i = 0; i < N_ - 7; i++ ) { - for( Index k = Max(0, i - 5); k <= i + 1; k++ ) + for( Index k = Max(Index(0), i - 5); k <= i + 1; k++ ) { values[ijac] = 2. * x[k] + 1.; ijac++; @@ -269,7 +268,7 @@ bool LuksanVlcek2::eval_h( } iRow[ihes] = n - 2; jCol[ihes] = n - 1; - ihes++; + DBG_DO(ihes++); DBG_ASSERT(ihes == nele_hess); (void) nele_hess; } @@ -302,7 +301,7 @@ bool LuksanVlcek2::eval_h( // Ok, now the diagonal elements from the constraints for( Index i = 0; i < N_ - 7; i++ ) { - for( Index k = Max(0, i - 5); k <= i + 1; k++ ) + for( Index k = Max(Index(0), i - 5); k <= i + 1; k++ ) { values[k] += lambda[i] * 2.; } diff --git a/examples/ScalableProblems/LuksanVlcek3.cpp b/examples/ScalableProblems/LuksanVlcek3.cpp index 497d72af0..9e6c1c571 100644 --- a/examples/ScalableProblems/LuksanVlcek3.cpp +++ b/examples/ScalableProblems/LuksanVlcek3.cpp @@ -15,10 +15,9 @@ LuksanVlcek3::LuksanVlcek3( Number g_l, Number g_u ) -{ - g_l_ = g_l; - g_u_ = g_u; -} + : g_l_(g_l), + g_u_(g_u) +{ } bool LuksanVlcek3::InitializeProblem( Index N @@ -129,7 +128,7 @@ bool LuksanVlcek3::eval_f( Number a2 = x[2 * i + 2] - x[2 * i + 3]; Number a3 = x[2 * i + 1] - 2. * x[2 * i + 2]; Number a4 = x[2 * i] - x[2 * i + 3]; - obj_value += a1 * a1 + 5. * a2 * a2 + pow(a3, 4) + 10. * pow(a4, 4); + obj_value += a1 * a1 + 5. * a2 * a2 + std::pow(a3, 4) + 10. * std::pow(a4, 4); } return true; @@ -151,10 +150,10 @@ bool LuksanVlcek3::eval_grad_f( Number a2 = x[2 * i + 2] - x[2 * i + 3]; Number a3 = x[2 * i + 1] - 2. * x[2 * i + 2]; Number a4 = x[2 * i] - x[2 * i + 3]; - grad_f[2 * i] += 2. * a1 + 40. * pow(a4, 3); - grad_f[2 * i + 1] += 20. * a1 + 4. * pow(a3, 3); - grad_f[2 * i + 2] = 10. * a2 - 8. * pow(a3, 3); - grad_f[2 * i + 3] = -10. * a2 - 40. * pow(a4, 3); + grad_f[2 * i] += 2. * a1 + 40. * std::pow(a4, 3); + grad_f[2 * i + 1] += 20. * a1 + 4. * std::pow(a3, 3); + grad_f[2 * i + 2] = 10. * a2 - 8. * std::pow(a3, 3); + grad_f[2 * i + 3] = -10. * a2 - 40. * std::pow(a4, 3); } return true; @@ -169,8 +168,8 @@ bool LuksanVlcek3::eval_g( Number* g ) { - g[0] = 3. * pow(x[0], 3) + 2. * x[1] - 5. + sin(x[0] - x[1]) * sin(x[0] + x[1]); - g[1] = 4. * x[n - 3] - x[n - 4] * exp(x[n - 4] - x[n - 3]) - 3; + g[0] = 3. * std::pow(x[0], 3) + 2. * x[1] - 5. + std::sin(x[0] - x[1]) * std::sin(x[0] + x[1]); + g[1] = 4. * x[n - 3] - x[n - 4] * std::exp(x[n - 4] - x[n - 3]) - 3; return true; } @@ -203,7 +202,7 @@ bool LuksanVlcek3::eval_jac_g( ijac++; iRow[ijac] = 1; jCol[ijac] = n - 3; - ijac++; + DBG_DO(ijac++); DBG_ASSERT(ijac == nele_jac); (void) nele_jac; @@ -213,14 +212,14 @@ bool LuksanVlcek3::eval_jac_g( // return the values of the jacobian of the constraints Index ijac = 0; - values[ijac] = 9. * x[0] * x[0] + cos(x[0] - x[1]) * sin(x[0] + x[1]) + sin(x[0] - x[1]) * cos(x[0] + x[1]); - ijac++; - values[ijac] = 2. - cos(x[0] - x[1]) * sin(x[0] + x[1]) + sin(x[0] - x[1]) * cos(x[0] + x[1]); + values[ijac] = 9. * x[0] * x[0] + std::cos(x[0] - x[1]) * std::sin(x[0] + x[1]) + std::sin(x[0] - x[1]) * std::cos(x[0] + x[1]); ijac++; - values[ijac] = -(1. + x[n - 4]) * exp(x[n - 4] - x[n - 3]); + values[ijac] = 2. - std::cos(x[0] - x[1]) * std::sin(x[0] + x[1]) + std::sin(x[0] - x[1]) * std::cos(x[0] + x[1]); ijac++; - values[ijac] = 4. + x[n - 4] * exp(x[n - 4] - x[n - 3]); + values[ijac] = -(1. + x[n - 4]) * std::exp(x[n - 4] - x[n - 3]); ijac++; + values[ijac] = 4. + x[n - 4] * std::exp(x[n - 4] - x[n - 3]); + // ijac++; } return true; @@ -270,7 +269,7 @@ bool LuksanVlcek3::eval_h( ihes++; iRow[ihes] = N_ + 1; jCol[ihes] = N_ + 1; - ihes++; + DBG_DO(ihes++); DBG_ASSERT(ihes == nele_hess); (void) nele_hess; } @@ -337,23 +336,23 @@ bool LuksanVlcek3::eval_h( ihes = 0; Number d1 = x[0] - x[1]; Number d2 = x[0] + x[1]; - values[ihes] += lambda[0] * (18. * x[0] - 2. * sin(d1) * sin(d2) + 2. * cos(d1) * cos(d2)); + values[ihes] += lambda[0] * (18. * x[0] - 2. * std::sin(d1) * std::sin(d2) + 2. * std::cos(d1) * std::cos(d2)); ihes += 3; - values[ihes] += lambda[0] * (-2. * sin(d1) * sin(d2) - 2. * cos(d1) * cos(d2)); + values[ihes] += lambda[0] * (-2. * std::sin(d1) * std::sin(d2) - 2. * std::cos(d1) * std::cos(d2)); d1 = x[n - 4] - x[n - 3]; // x[n-4] x[n-4] ihes = nele_hess - 8; - values[ihes] += -lambda[1] * (2. + x[n - 4]) * exp(d1); + values[ihes] += -lambda[1] * (2. + x[n - 4]) * std::exp(d1); // x[n-4] x[n-3] ihes++; - values[ihes] += lambda[1] * (1. + x[n - 4]) * exp(d1); + values[ihes] += lambda[1] * (1. + x[n - 4]) * std::exp(d1); // x[n-3] x[n-3] ihes += 2; - values[ihes] += -lambda[1] * x[n - 4] * exp(d1); + values[ihes] += -lambda[1] * x[n - 4] * std::exp(d1); } return true; } diff --git a/examples/ScalableProblems/LuksanVlcek4.cpp b/examples/ScalableProblems/LuksanVlcek4.cpp index 89c51a8f2..11e31fb4b 100644 --- a/examples/ScalableProblems/LuksanVlcek4.cpp +++ b/examples/ScalableProblems/LuksanVlcek4.cpp @@ -15,10 +15,9 @@ LuksanVlcek4::LuksanVlcek4( Number g_l, Number g_u ) -{ - g_l_ = g_l; - g_u_ = g_u; -} + : g_l_(g_l), + g_u_(g_u) +{ } bool LuksanVlcek4::InitializeProblem( Index N @@ -125,13 +124,13 @@ bool LuksanVlcek4::eval_f( obj_value = 0.; for( Index i = 0; i < N_ / 2; i++ ) { - Number e0 = exp(x[2 * i]); + Number e0 = std::exp(x[2 * i]); Number e0mx1 = e0 - x[2 * i + 1]; Number x1mx2 = x[2 * i + 1] - x[2 * i + 2]; Number x2mx3 = x[2 * i + 2] - x[2 * i + 3]; - Number t = tan(x2mx3); + Number t = std::tan(x2mx3); Number x3m1 = x[2 * i + 3] - 1.; - obj_value += pow(e0mx1, 4) + 100. * pow(x1mx2, 6) + pow(t, 4) + pow(x[2 * i], 8) + x3m1 * x3m1; + obj_value += std::pow(e0mx1, 4) + 100. * std::pow(x1mx2, 6) + std::pow(t, 4) + std::pow(x[2 * i], 8) + x3m1 * x3m1; } return true; @@ -149,16 +148,16 @@ bool LuksanVlcek4::eval_grad_f( grad_f[1] = 0.; for( Index i = 0; i < N_ / 2; i++ ) { - Number e0 = exp(x[2 * i]); + Number e0 = std::exp(x[2 * i]); Number e0mx1 = e0 - x[2 * i + 1]; Number x1mx2 = x[2 * i + 1] - x[2 * i + 2]; Number x2mx3 = x[2 * i + 2] - x[2 * i + 3]; Number x3m1 = x[2 * i + 3] - 1.; - Number dt = 4. * pow(tan(x2mx3), 3) / pow(cos(x2mx3), 2); + Number dt = 4. * std::pow(std::tan(x2mx3), 3) / std::pow(std::cos(x2mx3), 2); - grad_f[2 * i] += 4. * e0 * pow(e0mx1, 3) + 8. * pow(x[2 * i], 7); - grad_f[2 * i + 1] += -4. * pow(e0mx1, 3) + 600. * pow(x1mx2, 5); - grad_f[2 * i + 2] = -600. * pow(x1mx2, 5) + dt; + grad_f[2 * i] += 4. * e0 * std::pow(e0mx1, 3) + 8. * std::pow(x[2 * i], 7); + grad_f[2 * i + 1] += -4. * std::pow(e0mx1, 3) + 600. * std::pow(x1mx2, 5); + grad_f[2 * i + 2] = -600. * std::pow(x1mx2, 5) + dt; grad_f[2 * i + 3] = -dt + 2. * x3m1; } @@ -261,7 +260,7 @@ bool LuksanVlcek4::eval_h( } iRow[ihes] = n - 1; jCol[ihes] = n - 1; - ihes++; + DBG_DO(ihes++); DBG_ASSERT(ihes == nele_hess); (void) nele_hess; } @@ -274,29 +273,29 @@ bool LuksanVlcek4::eval_h( values[2] = 0.; for( Index i = 0; i < N_ / 2; i++ ) { - Number e0 = exp(x[2 * i]); + Number e0 = std::exp(x[2 * i]); Number e0mx1 = e0 - x[2 * i + 1]; Number x1mx2 = x[2 * i + 1] - x[2 * i + 2]; Number x2mx3 = x[2 * i + 2] - x[2 * i + 3]; - Number s = sin(x2mx3); + Number s = std::sin(x2mx3); Number ss = s * s; - Number c = cos(x2mx3); - Number ddt = 4. * (3. * ss * c * c + 5. * ss * ss) / pow(c, 6); + Number c = std::cos(x2mx3); + Number ddt = 4. * (3. * ss * c * c + 5. * ss * ss) / std::pow(c, 6); // x[2*i] x[2*i] - values[ihes] += obj_factor * (4. * e0 * pow(e0mx1, 3) + 12 * e0 * e0 * e0mx1 * e0mx1 + 56. * pow(x[2 * i], 6)); + values[ihes] += obj_factor * (4. * e0 * std::pow(e0mx1, 3) + 12 * e0 * e0 * e0mx1 * e0mx1 + 56. * std::pow(x[2 * i], 6)); ihes++; // x[2*i] x[2*i+1] values[ihes] += obj_factor * (-12 * e0 * e0mx1 * e0mx1); ihes++; // x[2*i+1] x[2*i+1] - values[ihes] += obj_factor * (3000. * pow(x1mx2, 4) + 12. * e0mx1 * e0mx1); + values[ihes] += obj_factor * (3000. * std::pow(x1mx2, 4) + 12. * e0mx1 * e0mx1); ihes++; // x[2*i+1] x[2*i+2] - values[ihes] = -obj_factor * (3000. * pow(x1mx2, 4)); + values[ihes] = -obj_factor * (3000. * std::pow(x1mx2, 4)); ihes++; // x[2*i+2] x[2*i+2] - values[ihes] = obj_factor * (3000. * pow(x1mx2, 4) + ddt); + values[ihes] = obj_factor * (3000. * std::pow(x1mx2, 4) + ddt); // x[2*i+2] x[2*i+3] values[ihes + 1] = -obj_factor * ddt; // x[2*i+3] x[2*i+3] @@ -304,7 +303,6 @@ bool LuksanVlcek4::eval_h( } // Now the constraints - ihes = 0; for( Index i = 0; i < N_ - 2; i++ ) { // x[i] x[i+1] diff --git a/examples/ScalableProblems/LuksanVlcek5.cpp b/examples/ScalableProblems/LuksanVlcek5.cpp index 580a98455..3df2a02ba 100644 --- a/examples/ScalableProblems/LuksanVlcek5.cpp +++ b/examples/ScalableProblems/LuksanVlcek5.cpp @@ -29,10 +29,9 @@ LuksanVlcek5::LuksanVlcek5( Number g_l, Number g_u ) -{ - g_l_ = g_l; - g_u_ = g_u; -} + : g_l_(g_l), + g_u_(g_u) +{ } bool LuksanVlcek5::InitializeProblem( Index N @@ -141,7 +140,7 @@ bool LuksanVlcek5::eval_f( for( Index i = 1; i <= N_; i++ ) { Number b = (3. - 2. * x[i]) * x[i] - x[i - 1] - x[i + 1] + 1.; - obj_value += pow(fabs(b), p); + obj_value += std::pow(std::abs(b), p); } return true; @@ -161,7 +160,7 @@ bool LuksanVlcek5::eval_grad_f( for( Index i = 1; i <= N_; i++ ) { Number b = (3. - 2. * x[i]) * x[i] - x[i - 1] - x[i + 1] + 1.; - Number pb = pow(fabs(b), p - 1.); + Number pb = std::pow(std::abs(b), p - 1.); grad_f[i + 1] = -p * Sgn(b) * pb; grad_f[i - 1] += grad_f[i + 1]; @@ -301,8 +300,8 @@ bool LuksanVlcek5::eval_h( for( Index i = 1; i <= N_; i++ ) { Number b = (3. - 2. * x[i]) * x[i] - x[i - 1] - x[i + 1] + 1.; - Number pb1 = pow(fabs(b), p - 1.); - Number pb2 = pow(fabs(b), p - 2.); + Number pb1 = std::pow(std::abs(b), p - 1.); + Number pb2 = std::pow(std::abs(b), p - 2.); Number a1 = 3. - 4. * x[i]; Number a2 = p * (p - 1.) * pb2; Number a3 = a1 * a2; diff --git a/examples/ScalableProblems/LuksanVlcek6.cpp b/examples/ScalableProblems/LuksanVlcek6.cpp index 93b83497b..3454e9026 100644 --- a/examples/ScalableProblems/LuksanVlcek6.cpp +++ b/examples/ScalableProblems/LuksanVlcek6.cpp @@ -29,10 +29,9 @@ LuksanVlcek6::LuksanVlcek6( Number g_l, Number g_u ) -{ - g_l_ = g_l; - g_u_ = g_u; -} + : g_l_(g_l), + g_u_(g_u) +{ } bool LuksanVlcek6::InitializeProblem( Index N @@ -138,11 +137,11 @@ bool LuksanVlcek6::eval_f( for( Index i = 0; i < N_; i++ ) { Number b = (2. + 5. * x[i] * x[i]) * x[i] + 1.; - for( Index j = Max(0, i - 5); j <= Min(N_ - 1, i + 1); j++ ) + for( Index j = Max(Index(0), i - 5); j <= Min(N_ - 1, i + 1); j++ ) { b += x[j] * (1. + x[j]); } - obj_value += pow(fabs(b), p); + obj_value += std::pow(std::abs(b), p); } return true; @@ -161,13 +160,13 @@ bool LuksanVlcek6::eval_grad_f( for( Index i = 0; i < N_; i++ ) { Number b = (2. + 5. * x[i] * x[i]) * x[i] + 1.; - for( Index j = Max(0, i - 5); j <= Min(N_ - 1, i + 1); j++ ) + for( Index j = Max(Index(0), i - 5); j <= Min(N_ - 1, i + 1); j++ ) { b += x[j] * (1. + x[j]); } - Number pb1 = pow(fabs(b), p - 1.); + Number pb1 = std::pow(std::abs(b), p - 1.); Number apb1 = p * Sgn(b) * pb1; - for( Index j = Max(0, i - 5); j < i; j++ ) + for( Index j = Max(Index(0), i - 5); j < i; j++ ) { grad_f[j] += (1. + 2. * x[j]) * apb1; } @@ -193,7 +192,7 @@ bool LuksanVlcek6::eval_g( { for( Index i = 0; i < N_ / 2; i++ ) { - Number e = exp(x[2 * i] - x[2 * i + 1] - x[2 * i + 2]); + Number e = std::exp(x[2 * i] - x[2 * i + 1] - x[2 * i + 2]); g[i] = 4. * x[2 * i + 1] - (x[2 * i] - x[2 * i + 2]) * e - 3; } return true; @@ -238,7 +237,7 @@ bool LuksanVlcek6::eval_jac_g( Index ijac = 0; for( Index i = 0; i < N_ / 2; i++ ) { - Number e = exp(x[2 * i] - x[2 * i + 1] - x[2 * i + 2]); + Number e = std::exp(x[2 * i] - x[2 * i + 1] - x[2 * i + 2]); Number a1 = (1. + x[2 * i] - x[2 * i + 2]) * e; values[ijac] = -a1; ijac++; @@ -330,12 +329,12 @@ bool LuksanVlcek6::eval_h( for( Index i = 0; i < N_; i++ ) { Number b = (2. + 5. * x[i] * x[i]) * x[i] + 1.; - for( Index j = Max(0, i - 5); j <= Min(N_ - 1, i + 1); j++ ) + for( Index j = Max(Index(0), i - 5); j <= Min(N_ - 1, i + 1); j++ ) { b += x[j] * (1. + x[j]); } - Number pb1 = pow(fabs(b), p - 1.); - Number pb2 = pow(fabs(b), p - 2.); + Number pb1 = std::pow(std::abs(b), p - 1.); + Number pb2 = std::pow(std::abs(b), p - 2.); Number apb1 = p * Sgn(b) * pb1; Number apb2 = p * (p - 1.) * pb2; Number a1 = 3. + 2. * x[i] + 15. * x[i] * x[i]; @@ -346,13 +345,13 @@ bool LuksanVlcek6::eval_h( // x[i] x[j] j= Max(0, i - 5); j-- ) + for( Index j = i - 1; j >= Max(Index(0), i - 5); j-- ) { values[ih + j] += obj_factor * a1apb2 * (1. + 2. * x[j]); ih += ip; ip--; } - for( Index j = Max(0, i - 5); j < i; j++ ) + for( Index j = Max(Index(0), i - 5); j < i; j++ ) { Number axj = (1. + 2. * x[j]); // x[j] x[j] j= Max(0, i - 5); k-- ) + for( Index k = j - 1; k >= Max(Index(0), i - 5); k-- ) { values[ih + k] += obj_factor * apb2 * (1. + 2. * x[k]) * axj; ih += ip; @@ -375,7 +374,7 @@ bool LuksanVlcek6::eval_h( // x[j=i+1] x[k] k= Max(0, i - 5); k-- ) + for( Index k = i - 1; k >= Max(Index(0), i - 5); k-- ) { values[ih + k] = obj_factor * apb2 * (1. + 2. * x[k]) * axj; ih += ip; @@ -391,7 +390,7 @@ bool LuksanVlcek6::eval_h( values[n + i] = 0.; ih = n + n - 1; ip = n - 2; - for( Index k = i - 1; k >= Max(0, i - 5); k-- ) + for( Index k = i - 1; k >= Max(Index(0), i - 5); k-- ) { values[ih + k] = 0.; ih += ip; @@ -405,7 +404,7 @@ bool LuksanVlcek6::eval_h( // Now the constraints for( Index i = 0; i < N_ / 2; i++ ) { - Number e = exp(x[2 * i] - x[2 * i + 1] - x[2 * i + 2]); + Number e = std::exp(x[2 * i] - x[2 * i + 1] - x[2 * i + 2]); Number a1 = 1. + x[2 * i] - x[2 * i + 2]; Number a2 = 1. + a1; // x[2*i] x[2*i] diff --git a/examples/ScalableProblems/LuksanVlcek7.cpp b/examples/ScalableProblems/LuksanVlcek7.cpp index 85ae77f63..c05f2b0fe 100644 --- a/examples/ScalableProblems/LuksanVlcek7.cpp +++ b/examples/ScalableProblems/LuksanVlcek7.cpp @@ -15,10 +15,9 @@ LuksanVlcek7::LuksanVlcek7( Number g_l, Number g_u ) -{ - g_l_ = g_l; - g_u_ = g_u; -} + : g_l_(g_l), + g_u_(g_u) +{ } bool LuksanVlcek7::InitializeProblem( Index N @@ -122,7 +121,7 @@ bool LuksanVlcek7::eval_f( obj_value = 0.; for( Index i = 1; i <= N_; i++ ) { - obj_value += i * ((1. - cos(x[i])) + sin(x[i - 1]) - sin(x[i + 1])); + obj_value += i * ((1. - std::cos(x[i])) + std::sin(x[i - 1]) - std::sin(x[i + 1])); } return true; @@ -140,9 +139,9 @@ bool LuksanVlcek7::eval_grad_f( grad_f[1] = 0.; for( Index i = 1; i <= N_; i++ ) { - grad_f[i - 1] += i * cos(x[i - 1]); - grad_f[i] += i * sin(x[i]); - grad_f[i + 1] = -i * cos(x[i + 1]); + grad_f[i - 1] += i * std::cos(x[i - 1]); + grad_f[i] += i * std::sin(x[i]); + grad_f[i + 1] = -i * std::cos(x[i + 1]); } return true; @@ -230,7 +229,7 @@ bool LuksanVlcek7::eval_jac_g( ijac++; iRow[ijac] = 3; jCol[ijac] = N_; - ijac++; + DBG_DO(ijac++); DBG_ASSERT(ijac == nele_jac); (void) nele_jac; @@ -271,7 +270,7 @@ bool LuksanVlcek7::eval_jac_g( values[ijac] = -8. * x[N_] + 2. * x[N_ - 1]; ijac++; values[ijac] = 24. * x[N_] * x[N_] - 8. * x[N_ - 1] + 2.; - ijac++; + // ijac++; } return true; @@ -318,9 +317,9 @@ bool LuksanVlcek7::eval_h( values[1] = 0.; for( Index i = 1; i <= N_; i++ ) { - values[i - 1] -= obj_factor * (i * sin(x[i - 1])); - values[i] += obj_factor * i * cos(x[i]); - values[i + 1] = obj_factor * i * sin(x[i + 1]); + values[i - 1] -= obj_factor * (i * std::sin(x[i - 1])); + values[i] += obj_factor * i * std::cos(x[i]); + values[i + 1] = obj_factor * i * std::sin(x[i + 1]); } // g[0] diff --git a/examples/ScalableProblems/MittelmannBndryCntrlDiri3D.cpp b/examples/ScalableProblems/MittelmannBndryCntrlDiri3D.cpp index 76b97ce02..9ccf7b226 100644 --- a/examples/ScalableProblems/MittelmannBndryCntrlDiri3D.cpp +++ b/examples/ScalableProblems/MittelmannBndryCntrlDiri3D.cpp @@ -48,8 +48,8 @@ void MittelmannBndryCntrlDiriBase3D::SetBaseParameters( C_ = C; PenA_ = 1.5 - 1.125 * C_ / B_; - PenB_ = 1.75 * C_ / pow(B_, 3) - 1.5 / (B_ * B_); - PenC_ = 0.5 / pow(B_, 4) - 0.625 * C_ / pow(B_, 5); + PenB_ = 1.75 * C_ / std::pow(B_, 3) - 1.5 / (B_ * B_); + PenC_ = 0.5 / std::pow(B_, 4) - 0.625 * C_ / std::pow(B_, 5); // Initialize the target profile variables delete[] y_d_; @@ -906,7 +906,9 @@ void MittelmannBndryCntrlDiriBase3D::finalize_solution( for (Index i=0; i<=N_+1; i++) { for (Index j=0; j<=N_+1; j++) { - fprintf(fp, "y[%6d,%6d] = %15.8e\n", i, j, x[y_index(i,j)]); + for (Index k=0; k<=N_+1; k++) { + fprintf(fp, "y[%6d,%6d,%6d] = %15.8e\n", i, j, k, x[y_index(i,j,k)]); + } } } diff --git a/examples/ScalableProblems/MittelmannBndryCntrlDiri3D_27.cpp b/examples/ScalableProblems/MittelmannBndryCntrlDiri3D_27.cpp index e64377469..e7fa774eb 100644 --- a/examples/ScalableProblems/MittelmannBndryCntrlDiri3D_27.cpp +++ b/examples/ScalableProblems/MittelmannBndryCntrlDiri3D_27.cpp @@ -48,8 +48,8 @@ void MittelmannBndryCntrlDiriBase3D_27::SetBaseParameters( C_ = C; PenA_ = 1.5 - 1.125 * C_ / B_; - PenB_ = 1.75 * C_ / pow(B_, 3) - 1.5 / (B_ * B_); - PenC_ = 0.5 / pow(B_, 4) - 0.625 * C_ / pow(B_, 5); + PenB_ = 1.75 * C_ / std::pow(B_, 3) - 1.5 / (B_ * B_); + PenC_ = 0.5 / std::pow(B_, 4) - 0.625 * C_ / std::pow(B_, 5); // Initialize the target profile variables delete[] y_d_; @@ -1074,7 +1074,9 @@ void MittelmannBndryCntrlDiriBase3D_27::finalize_solution( for (Index i=0; i<=N_+1; i++) { for (Index j=0; j<=N_+1; j++) { - fprintf(fp, "y[%6d,%6d] = %15.8e\n", i, j, x[y_index(i,j)]); + for (Index k=0; k<=N_+1; k++) { + fprintf(fp, "y[%6d,%6d,%6d] = %15.8e\n", i, j, k, x[y_index(i,j,k)]); + } } } diff --git a/examples/ScalableProblems/MittelmannBndryCntrlDiri3Dsin.cpp b/examples/ScalableProblems/MittelmannBndryCntrlDiri3Dsin.cpp index 03f746a0a..201a6e913 100644 --- a/examples/ScalableProblems/MittelmannBndryCntrlDiri3Dsin.cpp +++ b/examples/ScalableProblems/MittelmannBndryCntrlDiri3Dsin.cpp @@ -348,7 +348,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_f( { const Number D = (4 * x[y_index(i, j, 0)] - x[y_index(i - 1, j, 0)] - x[y_index(i + 1, j, 0)] - x[y_index(i, j - 1, 0)] - x[y_index(i, j + 1, 0)]) / hh_; - const Number sinD = sin(D) - 0.5; + const Number sinD = std::sin(D) - 0.5; usum += sinD * sinD; } } @@ -358,7 +358,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_f( { const Number D = (4 * x[y_index(i, j, N_ + 1)] - x[y_index(i - 1, j, N_ + 1)] - x[y_index(i + 1, j, N_ + 1)] - x[y_index(i, j - 1, N_ + 1)] - x[y_index(i, j + 1, N_ + 1)]) / hh_; - const Number sinD = sin(D) - 0.5; + const Number sinD = std::sin(D) - 0.5; usum += sinD * sinD; } } @@ -369,7 +369,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_f( { const Number D = (4 * x[y_index(0, i, j)] - x[y_index(0, i - 1, j)] - x[y_index(0, i + 1, j)] - x[y_index(0, i, j - 1)] - x[y_index(0, i, j + 1)]) / hh_; - const Number sinD = sin(D) - 0.5; + const Number sinD = std::sin(D) - 0.5; usum += sinD * sinD; } } @@ -379,7 +379,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_f( { const Number D = (4 * x[y_index(N_ + 1, i, j)] - x[y_index(N_ + 1, i - 1, j)] - x[y_index(N_ + 1, i + 1, j)] - x[y_index(N_ + 1, i, j - 1)] - x[y_index(N_ + 1, i, j + 1)]) / hh_; - const Number sinD = sin(D) - 0.5; + const Number sinD = std::sin(D) - 0.5; usum += sinD * sinD; } } @@ -390,7 +390,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_f( { const Number D = (4 * x[y_index(i, 0, j)] - x[y_index(i - 1, 0, j)] - x[y_index(i + 1, 0, j)] - x[y_index(i, 0, j - 1)] - x[y_index(i, 0, j + 1)]) / hh_; - const Number sinD = sin(D) - 0.5; + const Number sinD = std::sin(D) - 0.5; usum += sinD * sinD; } } @@ -400,7 +400,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_f( { const Number D = (4 * x[y_index(i, N_ + 1, j)] - x[y_index(i - 1, N_ + 1, j)] - x[y_index(i + 1, N_ + 1, j)] - x[y_index(i, N_ + 1, j - 1)] - x[y_index(i, N_ + 1, j + 1)]) / hh_; - const Number sinD = sin(D) - 0.5; + const Number sinD = std::sin(D) - 0.5; usum += sinD * sinD; } } @@ -488,7 +488,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_grad_f( { const Number D = (4 * x[y_index(i, j, 0)] - x[y_index(i - 1, j, 0)] - x[y_index(i + 1, j, 0)] - x[y_index(i, j - 1, 0)] - x[y_index(i, j + 1, 0)]) / hh_; - const Number FD = alpha_ * h_ * (cos(D) * (sin(D) - 0.5) / hh_); + const Number FD = alpha_ * h_ * (std::cos(D) * (std::sin(D) - 0.5) / hh_); grad_f[y_index(i, j, 0)] += 4. * FD; grad_f[y_index(i - 1, j, 0)] += -1. * FD; grad_f[y_index(i + 1, j, 0)] += -1. * FD; @@ -503,7 +503,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_grad_f( { const Number D = (4 * x[y_index(i, j, N_ + 1)] - x[y_index(i - 1, j, N_ + 1)] - x[y_index(i + 1, j, N_ + 1)] - x[y_index(i, j - 1, N_ + 1)] - x[y_index(i, j + 1, N_ + 1)]) / hh_; - const Number FD = alpha_ * h_ * (cos(D) * (sin(D) - 0.5) / hh_); + const Number FD = alpha_ * h_ * (std::cos(D) * (std::sin(D) - 0.5) / hh_); grad_f[y_index(i, j, N_ + 1)] += 4. * FD; grad_f[y_index(i - 1, j, N_ + 1)] += -1. * FD; grad_f[y_index(i + 1, j, N_ + 1)] += -1. * FD; @@ -518,7 +518,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_grad_f( { const Number D = (4 * x[y_index(0, i, j)] - x[y_index(0, i - 1, j)] - x[y_index(0, i + 1, j)] - x[y_index(0, i, j - 1)] - x[y_index(0, i, j + 1)]) / hh_; - const Number FD = alpha_ * h_ * (cos(D) * (sin(D) - 0.5) / hh_); + const Number FD = alpha_ * h_ * (std::cos(D) * (std::sin(D) - 0.5) / hh_); grad_f[y_index(0, i, j)] += 4. * FD; grad_f[y_index(0, i - 1, j)] += -1. * FD; grad_f[y_index(0, i + 1, j)] += -1. * FD; @@ -532,7 +532,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_grad_f( { const Number D = (4 * x[y_index(N_ + 1, i, j)] - x[y_index(N_ + 1, i - 1, j)] - x[y_index(N_ + 1, i + 1, j)] - x[y_index(N_ + 1, i, j - 1)] - x[y_index(N_ + 1, i, j + 1)]) / hh_; - const Number FD = alpha_ * h_ * (cos(D) * (sin(D) - 0.5) / hh_); + const Number FD = alpha_ * h_ * (std::cos(D) * (std::sin(D) - 0.5) / hh_); grad_f[y_index(N_ + 1, i, j)] += 4. * FD; grad_f[y_index(N_ + 1, i - 1, j)] += -1. * FD; grad_f[y_index(N_ + 1, i + 1, j)] += -1. * FD; @@ -547,7 +547,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_grad_f( { const Number D = (4 * x[y_index(i, 0, j)] - x[y_index(i - 1, 0, j)] - x[y_index(i + 1, 0, j)] - x[y_index(i, 0, j - 1)] - x[y_index(i, 0, j + 1)]) / hh_; - const Number FD = alpha_ * h_ * (cos(D) * (sin(D) - 0.5) / hh_); + const Number FD = alpha_ * h_ * (std::cos(D) * (std::sin(D) - 0.5) / hh_); grad_f[y_index(i, 0, j)] += 4. * FD; grad_f[y_index(i - 1, 0, j)] += -1. * FD; grad_f[y_index(i + 1, 0, j)] += -1. * FD; @@ -561,7 +561,7 @@ bool MittelmannBndryCntrlDiriBase3Dsin::eval_grad_f( { const Number D = (4 * x[y_index(i, N_ + 1, j)] - x[y_index(i - 1, N_ + 1, j)] - x[y_index(i + 1, N_ + 1, j)] - x[y_index(i, N_ + 1, j - 1)] - x[y_index(i, N_ + 1, j + 1)]) / hh_; - const Number FD = alpha_ * h_ * (cos(D) * (sin(D) - 0.5) / hh_); + const Number FD = alpha_ * h_ * (std::cos(D) * (std::sin(D) - 0.5) / hh_); grad_f[y_index(i, N_ + 1, j)] += 4. * FD; grad_f[y_index(i - 1, N_ + 1, j)] += -1. * FD; grad_f[y_index(i + 1, N_ + 1, j)] += -1. * FD; @@ -838,9 +838,8 @@ inline static void hessvals( Number fact ) { - //printf("ihes = %d\n",ihes); const Number D = (4 * x[ij] - x[imj] - x[ipj] - x[ijm] - x[ijp]) / hh_; - const Number val = fact * (1. + 0.5 * sin(D) - 2. * sin(D) * sin(D)); + const Number val = fact * (1. + 0.5 * std::sin(D) - 2. * std::sin(D) * std::sin(D)); values[ihes] = 16. * val; ihes++; @@ -1002,7 +1001,9 @@ void MittelmannBndryCntrlDiriBase3Dsin::finalize_solution( for (Index i=0; i<=N_+1; i++) { for (Index j=0; j<=N_+1; j++) { - fprintf(fp, "y[%6d,%6d] = %15.8e\n", i, j, x[y_index(i,j)]); + for (Index k=0; k<=N_+1; k++) { + fprintf(fp, "y[%6d,%6d,%6d] = %15.8e\n", i, j, k, x[y_index(i,j,k)]); + } } } diff --git a/examples/ScalableProblems/MittelmannBndryCntrlDiri3Dsin.hpp b/examples/ScalableProblems/MittelmannBndryCntrlDiri3Dsin.hpp index 39e424de9..c66b92d8c 100644 --- a/examples/ScalableProblems/MittelmannBndryCntrlDiri3Dsin.hpp +++ b/examples/ScalableProblems/MittelmannBndryCntrlDiri3Dsin.hpp @@ -294,7 +294,6 @@ class MittelmannBndryCntrlDiri3Dsin: public MittelmannBndryCntrlDiriBase3Dsin printf("N has to be at least 1."); return false; } - printf("olaf N %d has to be at least 1.", N); Number alpha = 0.1; Number lb_y = -1e20; Number ub_y = 3.5; diff --git a/examples/ScalableProblems/MittelmannDistCntrlDiri.hpp b/examples/ScalableProblems/MittelmannDistCntrlDiri.hpp index 08e3b08b2..e95cb45bd 100644 --- a/examples/ScalableProblems/MittelmannDistCntrlDiri.hpp +++ b/examples/ScalableProblems/MittelmannDistCntrlDiri.hpp @@ -351,7 +351,7 @@ class MittelmannDistCntrlDiri1: public MittelmannDistCntrlDiriBase Number u ) const { - return pow(y, 3) - y - u; + return std::pow(y, 3) - y - u; } /** First partial derivative of forcing function w.r.t. y */ @@ -448,7 +448,7 @@ class MittelmannDistCntrlDiri2: public MittelmannDistCntrlDiriBase Number u ) const { - return pow(y, 3) - y - u; + return std::pow(y, 3) - y - u; } /** First partial derivative of forcing function w.r.t. y */ @@ -535,7 +535,7 @@ class MittelmannDistCntrlDiri3: public MittelmannDistCntrlDiriBase Number x2 ) const { - return sin(2. * pi_ * x1) * sin(2. * pi_ * x2); + return std::sin(2. * pi_ * x1) * std::sin(2. * pi_ * x2); } /** Forcing function for the elliptic equation */ @@ -546,7 +546,7 @@ class MittelmannDistCntrlDiri3: public MittelmannDistCntrlDiriBase Number u ) const { - return -exp(y) - u; + return -std::exp(y) - u; } /** First partial derivative of forcing function w.r.t. y */ @@ -557,7 +557,7 @@ class MittelmannDistCntrlDiri3: public MittelmannDistCntrlDiriBase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** First partial derivative of forcing function w.r.t. u */ @@ -579,7 +579,7 @@ class MittelmannDistCntrlDiri3: public MittelmannDistCntrlDiriBase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } private: @@ -635,7 +635,7 @@ class MittelmannDistCntrlDiri3a: public MittelmannDistCntrlDiriBase Number x2 ) const { - return sin(2. * pi_ * x1) * sin(2. * pi_ * x2); + return std::sin(2. * pi_ * x1) * std::sin(2. * pi_ * x2); } /** Forcing function for the elliptic equation */ @@ -646,7 +646,7 @@ class MittelmannDistCntrlDiri3a: public MittelmannDistCntrlDiriBase Number u ) const { - return -exp(y) - u; + return -std::exp(y) - u; } /** First partial derivative of forcing function w.r.t. y */ @@ -657,7 +657,7 @@ class MittelmannDistCntrlDiri3a: public MittelmannDistCntrlDiriBase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** First partial derivative of forcing function w.r.t. u */ @@ -679,7 +679,7 @@ class MittelmannDistCntrlDiri3a: public MittelmannDistCntrlDiriBase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } private: diff --git a/examples/ScalableProblems/MittelmannDistCntrlNeumA.hpp b/examples/ScalableProblems/MittelmannDistCntrlNeumA.hpp index 5ac5e49db..2fdca67ce 100644 --- a/examples/ScalableProblems/MittelmannDistCntrlNeumA.hpp +++ b/examples/ScalableProblems/MittelmannDistCntrlNeumA.hpp @@ -446,7 +446,7 @@ class MittelmannDistCntrlNeumA1: public MittelmannDistCntrlNeumABase Number x2 ) const { - return sin(2. * pi_ * x1) * sin(2. * pi_ * x2); + return std::sin(2. * pi_ * x1) * std::sin(2. * pi_ * x2); } /** Integrant in objective function */ @@ -548,7 +548,7 @@ class MittelmannDistCntrlNeumA1: public MittelmannDistCntrlNeumABase Number u ) const { - return -exp(y) - u; + return -std::exp(y) - u; } /** First partial derivative of forcing function w.r.t. y */ @@ -559,7 +559,7 @@ class MittelmannDistCntrlNeumA1: public MittelmannDistCntrlNeumABase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** First partial derivative of forcing function w.r.t. u */ @@ -581,7 +581,7 @@ class MittelmannDistCntrlNeumA1: public MittelmannDistCntrlNeumABase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** returns true if second partial derivative of d_cont @@ -689,7 +689,7 @@ class MittelmannDistCntrlNeumA2: public MittelmannDistCntrlNeumABase Number x2 ) const { - return sin(2. * pi_ * x1) * sin(2. * pi_ * x2); + return std::sin(2. * pi_ * x1) * std::sin(2. * pi_ * x2); } /** Integrant in objective function */ @@ -791,7 +791,7 @@ class MittelmannDistCntrlNeumA2: public MittelmannDistCntrlNeumABase Number u ) const { - return -exp(y) - u; + return -std::exp(y) - u; } /** First partial derivative of forcing function w.r.t. y */ @@ -802,7 +802,7 @@ class MittelmannDistCntrlNeumA2: public MittelmannDistCntrlNeumABase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** First partial derivative of forcing function w.r.t. u */ @@ -824,7 +824,7 @@ class MittelmannDistCntrlNeumA2: public MittelmannDistCntrlNeumABase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** returns true if second partial derivative of d_cont @@ -1144,7 +1144,7 @@ class MittelmannDistCntrlNeumA3: public MittelmannDistCntrlNeumABase Number x2 ) const { - return 7. + 4. * sin(2. * pi_ * x1 * x2); + return 7. + 4. * std::sin(2. * pi_ * x1 * x2); } }; diff --git a/examples/ScalableProblems/MittelmannDistCntrlNeumB.hpp b/examples/ScalableProblems/MittelmannDistCntrlNeumB.hpp index deb0b3b31..d73162037 100644 --- a/examples/ScalableProblems/MittelmannDistCntrlNeumB.hpp +++ b/examples/ScalableProblems/MittelmannDistCntrlNeumB.hpp @@ -447,7 +447,7 @@ class MittelmannDistCntrlNeumB1: public MittelmannDistCntrlNeumBBase Number x2 ) const { - return sin(2. * pi_ * x1) * sin(2. * pi_ * x2); + return std::sin(2. * pi_ * x1) * std::sin(2. * pi_ * x2); } /** Integrant in objective function */ @@ -549,7 +549,7 @@ class MittelmannDistCntrlNeumB1: public MittelmannDistCntrlNeumBBase Number u ) const { - return -exp(y) - u; + return -std::exp(y) - u; } /** First partial derivative of forcing function w.r.t. y */ @@ -560,7 +560,7 @@ class MittelmannDistCntrlNeumB1: public MittelmannDistCntrlNeumBBase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** First partial derivative of forcing function w.r.t. u */ @@ -582,7 +582,7 @@ class MittelmannDistCntrlNeumB1: public MittelmannDistCntrlNeumBBase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** returns true if second partial derivative of d_cont @@ -690,7 +690,7 @@ class MittelmannDistCntrlNeumB2: public MittelmannDistCntrlNeumBBase Number x2 ) const { - return sin(2. * pi_ * x1) * sin(2. * pi_ * x2); + return std::sin(2. * pi_ * x1) * std::sin(2. * pi_ * x2); } /** Integrant in objective function */ @@ -792,7 +792,7 @@ class MittelmannDistCntrlNeumB2: public MittelmannDistCntrlNeumBBase Number u ) const { - return -exp(y) - u; + return -std::exp(y) - u; } /** First partial derivative of forcing function w.r.t. y */ @@ -803,7 +803,7 @@ class MittelmannDistCntrlNeumB2: public MittelmannDistCntrlNeumBBase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** First partial derivative of forcing function w.r.t. u */ @@ -825,7 +825,7 @@ class MittelmannDistCntrlNeumB2: public MittelmannDistCntrlNeumBBase Number /*u*/ ) const { - return -exp(y); + return -std::exp(y); } /** returns true if second partial derivative of d_cont @@ -1145,7 +1145,7 @@ class MittelmannDistCntrlNeumB3: public MittelmannDistCntrlNeumBBase Number x2 ) const { - return 7. + 4. * sin(2. * pi_ * x1 * x2); + return 7. + 4. * std::sin(2. * pi_ * x1 * x2); } }; diff --git a/examples/ScalableProblems/MittelmannParaCntrl.hpp b/examples/ScalableProblems/MittelmannParaCntrl.hpp index 82e253e09..0b951be73 100644 --- a/examples/ScalableProblems/MittelmannParaCntrl.hpp +++ b/examples/ScalableProblems/MittelmannParaCntrl.hpp @@ -798,11 +798,11 @@ class MittelmannParaCntrl5_1 public: ProblemSpecs() : pi_(4. * atan(1.)), - exp13_(exp(1. / 3.)), - exp23_(exp(2. / 3.)), - exp1_(exp(1.)), - expm1_(exp(-1.)), - sqrt2_(sqrt(2.)) + exp13_(std::exp(1. / 3.)), + exp23_(std::exp(2. / 3.)), + exp1_(std::exp(1.)), + expm1_(std::exp(-1.)), + sqrt2_(std::sqrt(2.)) { } Number T() @@ -849,21 +849,21 @@ class MittelmannParaCntrl5_1 Number x ) { - return (exp1_ + expm1_) * cos(x); + return (exp1_ + expm1_) * std::cos(x); } inline Number a( Number x ) { - return cos(x); + return std::cos(x); } inline Number a_y( Number t ) { - return -exp(-2. * t); + return -std::exp(-2. * t); } inline Number a_u( @@ -877,21 +877,21 @@ class MittelmannParaCntrl5_1 Number t ) { - return exp(-4. * t) / 4. - Min(1., Max(0., (exp(t) - exp13_) / (exp23_ - exp13_))); + return std::exp(Number(-4.) * t) / Number(4.) - Min(Number(1.), Max(Number(0.), (std::exp(t) - exp13_) / (exp23_ - exp13_))); } inline Number phi( Number y ) { - return y * pow(fabs(y), 3); + return y * std::pow(std::abs(y), 3); } inline Number phi_dy( Number y ) { - return 4. * pow(fabs(y), 3); + return 4. * std::pow(std::abs(y), 3); } inline Number phi_dydy( @@ -1261,11 +1261,11 @@ class MittelmannParaCntrl5_try public: ProblemSpecs() : pi_(4. * atan(1.)), - exp13_(exp(1. / 3.)), - exp23_(exp(2. / 3.)), - exp1_(exp(1.)), - expm1_(exp(-1.)), - sqrt2_(sqrt(2.)) + exp13_(std::exp(1. / 3.)), + exp23_(std::exp(2. / 3.)), + exp1_(std::exp(1.)), + expm1_(std::exp(-1.)), + sqrt2_(std::sqrt(2.)) { } Number T() @@ -1312,21 +1312,21 @@ class MittelmannParaCntrl5_try Number x ) { - return (exp1_ + expm1_) * cos(x); + return (exp1_ + expm1_) * std::cos(x); } inline Number a( Number x ) { - return cos(x); + return std::cos(x); } inline Number a_y( Number t ) { - return -exp(-2. * t); + return -std::exp(-2. * t); } inline Number a_u( @@ -1340,28 +1340,28 @@ class MittelmannParaCntrl5_try Number t ) { - return exp(-4. * t) / 4. - Min(1., Max(0., (exp(t) - exp13_) / (exp23_ - exp13_))); + return std::exp(Number(-4.) * t) / 4. - Min(Number(1.), Max(Number(0.), (std::exp(t) - exp13_) / (exp23_ - exp13_))); } inline Number phi( Number y ) { - return -y * sin(y / 10.); + return -y * std::sin(y / 10.); } inline Number phi_dy( Number y ) { - return -y * cos(y / 10.) / 10. - sin(y / 10.); + return -y * std::cos(y / 10.) / 10. - std::sin(y / 10.); } inline Number phi_dydy( Number y ) { - return y * sin(y / 10.) / 100.; + return y * std::sin(y / 10.) / 100.; } inline bool phi_dydy_always_zero() diff --git a/examples/ScalableProblems/RegisteredTNLP.cpp b/examples/ScalableProblems/RegisteredTNLP.cpp index 8a5cb9dd4..b7aebc0f8 100644 --- a/examples/ScalableProblems/RegisteredTNLP.cpp +++ b/examples/ScalableProblems/RegisteredTNLP.cpp @@ -10,20 +10,21 @@ std::map >& RegisteredTNLPListMap() { + // cppcheck-suppress threadsafety-threadsafety static std::map > tnlp_map_; return tnlp_map_; } void RegisteredTNLPs::RegisterTNLP( const SmartPtr& tnlp, - const std::string name + const std::string& name ) { RegisteredTNLPListMap()[name] = GetRawPtr(tnlp); } SmartPtr RegisteredTNLPs::GetTNLP( - const std::string name + const std::string& name ) { SmartPtr retval = NULL; @@ -39,7 +40,7 @@ SmartPtr RegisteredTNLPs::GetTNLP( void RegisteredTNLPs::PrintRegisteredProblems() { for( std::map >::iterator it = RegisteredTNLPListMap().begin(); - it != RegisteredTNLPListMap().end(); it++ ) + it != RegisteredTNLPListMap().end(); ++it ) { printf("%s\n", it->first.c_str()); } diff --git a/examples/ScalableProblems/RegisteredTNLP.hpp b/examples/ScalableProblems/RegisteredTNLP.hpp index 04f3c553b..be1efb910 100644 --- a/examples/ScalableProblems/RegisteredTNLP.hpp +++ b/examples/ScalableProblems/RegisteredTNLP.hpp @@ -29,7 +29,7 @@ class RegisteredTNLPs public: RegisteredTNLPs( const SmartPtr& tnlp, - const std::string name + const std::string& name ) { RegisterTNLP(tnlp, name); @@ -37,8 +37,9 @@ class RegisteredTNLPs virtual ~RegisteredTNLPs() { } + static SmartPtr GetTNLP( - const std::string name + const std::string& name ); static void PrintRegisteredProblems(); @@ -46,7 +47,7 @@ class RegisteredTNLPs private: void RegisterTNLP( const SmartPtr& tnlp, - const std::string name + const std::string& name ); SmartPtr tnlp_; diff --git a/examples/ScalableProblems/solve_problem.cpp b/examples/ScalableProblems/solve_problem.cpp index 479179a12..dfc616324 100644 --- a/examples/ScalableProblems/solve_problem.cpp +++ b/examples/ScalableProblems/solve_problem.cpp @@ -14,29 +14,8 @@ //********************************************************************** // Stuff for benchmarking +// Enable this define to allow passing timelimit as 3rd program parameter // #define TIME_LIMIT -#ifdef TIME_LIMIT - -#include -#include - -extern "C" void* killer_thread( - void* arg -) -{ - int runtime = *reinterpret_cast(arg); - if (runtime <= 0) - { - printf("Invalid argument for run time (%d)\n", runtime); - exit(-100); - } - printf("Limiting wall clock time to %d seconds.\n", runtime); - sleep(runtime); - printf("EXIT: Exceeding wall clock time limit of %d seconds.\n", runtime); - exit(-999); - return NULL; -} -#endif //********************************************************************** using namespace Ipopt; @@ -129,11 +108,10 @@ int main( } #ifdef TIME_LIMIT - if (argv == 4) + int runtime; + if( argv == 4 ) { - int runtime = atoi(argc[3]); - pthread_t thread; - pthread_create(&thread, NULL, killer_thread, &runtime); + runtime = atoi(argc[3]); } else #endif @@ -177,7 +155,7 @@ int main( } else { - tnlp = RegisteredTNLPs::GetTNLP(inputword.c_str()); + tnlp = RegisteredTNLPs::GetTNLP(inputword); if( !IsValid(tnlp) ) { printf("Problem with name \"%s\" not known.\n", inputword.c_str()); @@ -220,6 +198,10 @@ int main( // DOES NOT WORK FOR VLUKL* PROBLEMS: // app->Options()->SetStringValueIfUnset("nlp_scaling_method", "user-scaling"); +#ifdef TIME_LIMIT + app->Options()->SetNumericValue("max_wall_time", runtime); +#endif + status = app->OptimizeTNLP(GetRawPtr(tnlp)); return (int) status; diff --git a/examples/hs071_c/hs071_c.c b/examples/hs071_c/hs071_c.c index 525390600..340446a7f 100644 --- a/examples/hs071_c/hs071_c.c +++ b/examples/hs071_c/hs071_c.c @@ -10,272 +10,20 @@ #include #include -/* Function Declarations */ -Bool eval_f( - Index n, - Number* x, - Bool new_x, - Number* obj_value, - UserDataPtr user_data -); - -Bool eval_grad_f( - Index n, - Number* x, - Bool new_x, - Number* grad_f, - UserDataPtr user_data -); - -Bool eval_g( - Index n, - Number* x, - Bool new_x, - Index m, - Number* g, - UserDataPtr user_data -); - -Bool eval_jac_g( - Index n, - Number* x, - Bool new_x, - Index m, - Index nele_jac, - Index* iRow, - Index* jCol, - Number* values, - UserDataPtr user_data -); - -Bool eval_h( - Index n, - Number* x, - Bool new_x, - Number obj_factor, - Index m, - Number* lambda, - Bool new_lambda, - Index nele_hess, - Index* iRow, - Index* jCol, - Number* values, - UserDataPtr user_data -); - -Bool intermediate_cb( - Index alg_mod, - Index iter_count, - Number obj_value, - Number inf_pr, - Number inf_du, - Number mu, - Number d_norm, - Number regularization_size, - Number alpha_du, - Number alpha_pr, - Index ls_trials, - UserDataPtr user_data -); - /** This is an example how user_data can be used. */ struct MyUserData { - Number g_offset[2]; /**< This is an offset for the constraints. */ + ipnumber g_offset[2]; /**< This is an offset for the constraints. */ + IpoptProblem nlp; /**< The problem to be solved. Required in intermediate_cb. */ }; -/** Main Program */ -/* [MAIN] */ -int main() -{ - Index n = -1; /* number of variables */ - Index m = -1; /* number of constraints */ - Index nele_jac; /* number of nonzeros in the Jacobian of the constraints */ - Index nele_hess; /* number of nonzeros in the Hessian of the Lagrangian (lower or upper triangular part only) */ - Index index_style; /* indexing style for matrices */ - Number* x_L = NULL; /* lower bounds on x */ - Number* x_U = NULL; /* upper bounds on x */ - Number* g_L = NULL; /* lower bounds on g */ - Number* g_U = NULL; /* upper bounds on g */ - IpoptProblem nlp = NULL; /* IpoptProblem */ - enum ApplicationReturnStatus status; /* Solve return code */ - Number* x = NULL; /* starting point and solution vector */ - Number* mult_g = NULL; /* constraint multipliers at the solution */ - Number* mult_x_L = NULL; /* lower bound multipliers at the solution */ - Number* mult_x_U = NULL; /* upper bound multipliers at the solution */ - Number obj; /* objective value */ - struct MyUserData user_data; /* our user data for the function evaluations */ - Index i; /* generic counter */ - - /* set the number of variables and allocate space for the bounds */ - n = 4; - x_L = (Number*) malloc(sizeof(Number) * n); - x_U = (Number*) malloc(sizeof(Number) * n); - /* set the values for the variable bounds */ - for( i = 0; i < n; i++ ) - { - x_L[i] = 1.0; - x_U[i] = 5.0; - } - - /* set the number of constraints and allocate space for the bounds */ - m = 2; - g_L = (Number*) malloc(sizeof(Number) * m); - g_U = (Number*) malloc(sizeof(Number) * m); - /* set the values of the constraint bounds */ - g_L[0] = 25; - g_U[0] = 2e19; - g_L[1] = 40; - g_U[1] = 40; - - /* set the number of nonzeros in the Jacobian and Hessian */ - nele_jac = 8; - nele_hess = 10; - - /* set the indexing style to C-style (start counting of rows and column indices at 0) */ - index_style = 0; - - /* create the IpoptProblem */ - nlp = CreateIpoptProblem(n, x_L, x_U, m, g_L, g_U, nele_jac, nele_hess, index_style, - &eval_f, &eval_g, &eval_grad_f, - &eval_jac_g, &eval_h); - - /* We can free the memory now - the values for the bounds have been - * copied internally in CreateIpoptProblem - */ - free(x_L); - free(x_U); - free(g_L); - free(g_U); - - /* Set some options. Note the following ones are only examples, - * they might not be suitable for your problem. - */ - AddIpoptNumOption(nlp, "tol", 1e-7); - AddIpoptStrOption(nlp, "mu_strategy", "adaptive"); - AddIpoptStrOption(nlp, "output_file", "ipopt.out"); - - /* allocate space for the initial point and set the values */ - x = (Number*) malloc(sizeof(Number) * n); - x[0] = 1.0; - x[1] = 5.0; - x[2] = 5.0; - x[3] = 1.0; - - /* allocate space to store the bound multipliers at the solution */ - mult_g = (Number*) malloc(sizeof(Number) * m); - mult_x_L = (Number*) malloc(sizeof(Number) * n); - mult_x_U = (Number*) malloc(sizeof(Number) * n); - - /* Initialize the user data */ - user_data.g_offset[0] = 0.; - user_data.g_offset[1] = 0.; - - /* Set the callback method for intermediate user-control. - * This is not required, just gives you some intermediate control in - * case you need it. - */ - /* SetIntermediateCallback(nlp, intermediate_cb); */ - - /* solve the problem */ - status = IpoptSolve(nlp, x, NULL, &obj, mult_g, mult_x_L, mult_x_U, &user_data); - - if( status == Solve_Succeeded ) - { - printf("\n\nSolution of the primal variables, x\n"); - for( i = 0; i < n; i++ ) - { - printf("x[%d] = %e\n", i, x[i]); - } - - printf("\n\nSolution of the constraint multipliers, lambda\n"); - for( i = 0; i < m; i++ ) - { - printf("lambda[%d] = %e\n", i, mult_g[i]); - } - printf("\n\nSolution of the bound multipliers, z_L and z_U\n"); - for( i = 0; i < n; i++ ) - { - printf("z_L[%d] = %e\n", i, mult_x_L[i]); - } - for( i = 0; i < n; i++ ) - { - printf("z_U[%d] = %e\n", i, mult_x_U[i]); - } - - printf("\n\nObjective value\nf(x*) = %e\n", obj); - } - else - { - printf("\n\nERROR OCCURRED DURING IPOPT OPTIMIZATION.\n"); - } - - /* Now we are going to solve this problem again, but with slightly - * modified constraints. We change the constraint offset of the - * first constraint a bit, and resolve the problem using the warm - * start option. - */ - user_data.g_offset[0] = 0.2; - - if( status == Solve_Succeeded ) - { - /* Now resolve with a warmstart. */ - AddIpoptStrOption(nlp, "warm_start_init_point", "yes"); - /* The following option reduce the automatic modification of the - * starting point done my Ipopt. - */ - AddIpoptNumOption(nlp, "bound_push", 1e-5); - AddIpoptNumOption(nlp, "bound_frac", 1e-5); - status = IpoptSolve(nlp, x, NULL, &obj, mult_g, mult_x_L, mult_x_U, &user_data); - - if( status == Solve_Succeeded ) - { - printf("\n\nSolution of the primal variables, x\n"); - for( i = 0; i < n; i++ ) - { - printf("x[%d] = %e\n", i, x[i]); - } - - printf("\n\nSolution of the constraint multipliers, lambda\n"); - for( i = 0; i < m; i++ ) - { - printf("lambda[%d] = %e\n", i, mult_g[i]); - } - printf("\n\nSolution of the bound multipliers, z_L and z_U\n"); - for( i = 0; i < n; i++ ) - { - printf("z_L[%d] = %e\n", i, mult_x_L[i]); - } - for( i = 0; i < n; i++ ) - { - printf("z_U[%d] = %e\n", i, mult_x_U[i]); - } - - printf("\n\nObjective value\nf(x*) = %e\n", obj); - } - else - { - printf("\n\nERROR OCCURRED DURING IPOPT OPTIMIZATION WITH WARM START.\n"); - } - } - - /* free allocated memory */ - FreeIpoptProblem(nlp); - free(x); - free(mult_g); - free(mult_x_L); - free(mult_x_U); - - return (status == Solve_Succeeded) ? EXIT_SUCCESS : EXIT_FAILURE; -} -/* [MAIN] */ - -/* Function Implementations */ -Bool eval_f( - Index n, - Number* x, - Bool new_x, - Number* obj_value, +/* Callback Implementations */ +static +bool eval_f( + ipindex n, + ipnumber* x, + bool new_x, + ipnumber* obj_value, UserDataPtr user_data ) { @@ -287,14 +35,15 @@ Bool eval_f( *obj_value = x[0] * x[3] * (x[0] + x[1] + x[2]) + x[2]; - return TRUE; + return true; } -Bool eval_grad_f( - Index n, - Number* x, - Bool new_x, - Number* grad_f, +static +bool eval_grad_f( + ipindex n, + ipnumber* x, + bool new_x, + ipnumber* grad_f, UserDataPtr user_data ) { @@ -309,15 +58,16 @@ Bool eval_grad_f( grad_f[2] = x[0] * x[3] + 1; grad_f[3] = x[0] * (x[0] + x[1] + x[2]); - return TRUE; + return true; } -Bool eval_g( - Index n, - Number* x, - Bool new_x, - Index m, - Number* g, +static +bool eval_g( + ipindex n, + ipnumber* x, + bool new_x, + ipindex m, + ipnumber* g, UserDataPtr user_data ) { @@ -333,18 +83,19 @@ Bool eval_g( g[0] = x[0] * x[1] * x[2] * x[3] + my_data->g_offset[0]; g[1] = x[0] * x[0] + x[1] * x[1] + x[2] * x[2] + x[3] * x[3] + my_data->g_offset[1]; - return TRUE; + return true; } -Bool eval_jac_g( - Index n, - Number* x, - Bool new_x, - Index m, - Index nele_jac, - Index* iRow, - Index* jCol, - Number* values, +static +bool eval_jac_g( + ipindex n, + ipnumber* x, + bool new_x, + ipindex m, + ipindex nele_jac, + ipindex* iRow, + ipindex* jCol, + ipnumber* values, UserDataPtr user_data ) { @@ -391,28 +142,25 @@ Bool eval_jac_g( values[7] = 2 * x[3]; /* 1,3 */ } - return TRUE; + return true; } -Bool eval_h( - Index n, - Number* x, - Bool new_x, - Number obj_factor, - Index m, - Number* lambda, - Bool new_lambda, - Index nele_hess, - Index* iRow, - Index* jCol, - Number* values, +static +bool eval_h( + ipindex n, + ipnumber* x, + bool new_x, + ipnumber obj_factor, + ipindex m, + ipnumber* lambda, + bool new_lambda, + ipindex nele_hess, + ipindex* iRow, + ipindex* jCol, + ipnumber* values, UserDataPtr user_data ) { - Index idx = 0; /* nonzero element counter */ - Index row = 0; /* row counter for loop */ - Index col = 0; /* col counter for loop */ - (void) n; (void) new_x; (void) m; @@ -421,6 +169,10 @@ Bool eval_h( if( values == NULL ) { + ipindex idx; /* nonzero element counter */ + ipindex row; /* row counter for loop */ + ipindex col; /* col counter for loop */ + /* return the structure. This is a symmetric matrix, fill the lower left * triangle only. */ @@ -479,28 +231,93 @@ Bool eval_h( values[9] += lambda[1] * 2; /* 3,3 */ } - return TRUE; + return true; } -Bool intermediate_cb( - Index alg_mod, - Index iter_count, - Number obj_value, - Number inf_pr, - Number inf_du, - Number mu, - Number d_norm, - Number regularization_size, - Number alpha_du, - Number alpha_pr, - Index ls_trials, +static IPOPT_UNUSED +bool intermediate_cb( + ipindex alg_mod, + ipindex iter_count, + ipnumber obj_value, + ipnumber inf_pr, + ipnumber inf_du, + ipnumber mu, + ipnumber d_norm, + ipnumber regularization_size, + ipnumber alpha_du, + ipnumber alpha_pr, + ipindex ls_trials, UserDataPtr user_data ) { - printf("Testing intermediate callback in iteration %d\n", iter_count); + bool have_iter; + bool have_viol; + + ipnumber x[4]; + ipnumber x_L_viol[4]; + ipnumber x_U_viol[4]; + ipnumber z_L[4]; + ipnumber z_U[4]; + ipnumber compl_x_L[4]; + ipnumber compl_x_U[4]; + ipnumber grad_lag_x[4]; + + ipnumber g[2]; + ipnumber lambda[2]; + ipnumber constraint_violation[2]; + ipnumber compl_g[2]; + + IpoptProblem nlp = ((struct MyUserData*)user_data)->nlp; + + have_iter = GetIpoptCurrentIterate(nlp, false, 4, x, z_L, z_U, 2, g, lambda); + have_viol = GetIpoptCurrentViolations(nlp, false, 4, x_L_viol, x_U_viol, compl_x_L, compl_x_U, grad_lag_x, 2, constraint_violation, compl_g); + + printf("Current iterate at iteration %d:\n", (int)iter_count); + printf(" %-12s %-12s %-12s %-12s %-12s %-12s %-12s\n", "x", "z_L", "z_U", "bound_viol", "compl_x_L", "compl_x_U", "grad_lag_x"); + for( int i = 0; i < 4; ++i ) + { + if( have_iter ) + { + printf(" %-12g %-12g %-12g", x[i], z_L[i], z_U[i]); + } + else + { + printf(" %-12s %-12s %-12s", "n/a", "n/a", "n/a"); + } + if( have_viol ) + { + printf(" %-12g %-12g %-12g %-12g\n", x_L_viol[i] > x_U_viol[i] ? x_L_viol[i] : x_U_viol[i], compl_x_L[i], compl_x_U[i], grad_lag_x[i]); + } + else + { + printf(" %-12s %-12s %-12s %-12s\n", "n/a", "n/a", "n/a", "n/a"); + } + } + + printf(" %-12s %-12s %-12s %-12s\n", "g(x)", "lambda", "constr_viol", "compl_g"); + for( int i = 0; i < 2; ++i ) + { + if( have_iter ) + { + printf(" %-12g %-12g", g[i], lambda[i]); + } + else + { + printf(" %-12s %-12s", "n/a", "n/a"); + } + if( have_viol ) + { + printf(" %-12g %-12g\n", constraint_violation[i], compl_g[i]); + } + else + { + printf(" %-12s %-12s\n", "n/a", "n/a"); + } + } + if( inf_pr < 1e-4 ) { - return FALSE; + return false; } (void) alg_mod; @@ -512,7 +329,193 @@ Bool intermediate_cb( (void) alpha_du; (void) alpha_pr; (void) ls_trials; - (void) user_data; - return TRUE; + return true; +} + +/** Main Program */ +/* [MAIN] */ +int main() +{ + ipindex n = -1; /* number of variables */ + ipindex m = -1; /* number of constraints */ + ipindex nele_jac; /* number of nonzeros in the Jacobian of the constraints */ + ipindex nele_hess; /* number of nonzeros in the Hessian of the Lagrangian (lower or upper triangular part only) */ + ipindex index_style; /* indexing style for matrices */ + ipnumber* x_L = NULL; /* lower bounds on x */ + ipnumber* x_U = NULL; /* upper bounds on x */ + ipnumber* g_L = NULL; /* lower bounds on g */ + ipnumber* g_U = NULL; /* upper bounds on g */ + IpoptProblem nlp = NULL; /* IpoptProblem */ + enum ApplicationReturnStatus status; /* Solve return code */ + ipnumber* x = NULL; /* starting point and solution vector */ + ipnumber* mult_g = NULL; /* constraint multipliers at the solution */ + ipnumber* mult_x_L = NULL; /* lower bound multipliers at the solution */ + ipnumber* mult_x_U = NULL; /* upper bound multipliers at the solution */ + ipnumber obj; /* objective value */ + struct MyUserData user_data; /* our user data for the function evaluations */ + ipindex i; /* generic counter */ + + /* set the number of variables and allocate space for the bounds */ + n = 4; + x_L = (ipnumber*) malloc(sizeof(ipnumber) * n); + x_U = (ipnumber*) malloc(sizeof(ipnumber) * n); + /* set the values for the variable bounds */ + for( i = 0; i < n; i++ ) + { + x_L[i] = 1.0; + x_U[i] = 5.0; + } + + /* set the number of constraints and allocate space for the bounds */ + m = 2; + g_L = (ipnumber*) malloc(sizeof(ipnumber) * m); + g_U = (ipnumber*) malloc(sizeof(ipnumber) * m); + /* set the values of the constraint bounds */ + g_L[0] = 25; + g_U[0] = 2e19; + g_L[1] = 40; + g_U[1] = 40; + + /* set the number of nonzeros in the Jacobian and Hessian */ + nele_jac = 8; + nele_hess = 10; + + /* set the indexing style to C-style (start counting of rows and column indices at 0) */ + index_style = 0; + + /* create the IpoptProblem */ + nlp = CreateIpoptProblem(n, x_L, x_U, m, g_L, g_U, nele_jac, nele_hess, index_style, + &eval_f, &eval_g, &eval_grad_f, + &eval_jac_g, &eval_h); + + /* We can free the memory now - the values for the bounds have been + * copied internally in CreateIpoptProblem + */ + free(x_L); + free(x_U); + free(g_L); + free(g_U); + + /* Set some options. Note the following ones are only examples, + * they might not be suitable for your problem. + */ + AddIpoptNumOption(nlp, "tol", 3.82e-6); + AddIpoptStrOption(nlp, "mu_strategy", "adaptive"); + AddIpoptStrOption(nlp, "output_file", "ipopt.out"); + + /* allocate space for the initial point and set the values */ + x = (ipnumber*) malloc(sizeof(ipnumber) * n); + x[0] = 1.0; + x[1] = 5.0; + x[2] = 5.0; + x[3] = 1.0; + + /* allocate space to store the bound multipliers at the solution */ + mult_g = (ipnumber*) malloc(sizeof(ipnumber) * m); + mult_x_L = (ipnumber*) malloc(sizeof(ipnumber) * n); + mult_x_U = (ipnumber*) malloc(sizeof(ipnumber) * n); + + /* Initialize the user data */ + user_data.g_offset[0] = 0.; + user_data.g_offset[1] = 0.; + user_data.nlp = nlp; + + /* Set the callback method for intermediate user-control. + * This is not required, just gives you some intermediate control in + * case you need it. + */ + /* SetIntermediateCallback(nlp, intermediate_cb); */ + + /* solve the problem */ + status = IpoptSolve(nlp, x, NULL, &obj, mult_g, mult_x_L, mult_x_U, &user_data); + + if( status == Solve_Succeeded ) + { + printf("\n\nSolution of the primal variables, x\n"); + for( i = 0; i < n; i++ ) + { + printf("x[%d] = %e\n", (int)i, x[i]); + } + + printf("\n\nSolution of the constraint multipliers, lambda\n"); + for( i = 0; i < m; i++ ) + { + printf("lambda[%d] = %e\n", (int)i, mult_g[i]); + } + printf("\n\nSolution of the bound multipliers, z_L and z_U\n"); + for( i = 0; i < n; i++ ) + { + printf("z_L[%d] = %e\n", (int)i, mult_x_L[i]); + } + for( i = 0; i < n; i++ ) + { + printf("z_U[%d] = %e\n", (int)i, mult_x_U[i]); + } + + printf("\n\nObjective value\nf(x*) = %e\n", obj); + } + else + { + printf("\n\nERROR OCCURRED DURING IPOPT OPTIMIZATION.\n"); + } + + /* Now we are going to solve this problem again, but with slightly + * modified constraints. We change the constraint offset of the + * first constraint a bit, and resolve the problem using the warm + * start option. + */ + user_data.g_offset[0] = 0.2; + + if( status == Solve_Succeeded ) + { + /* Now resolve with a warmstart. */ + AddIpoptStrOption(nlp, "warm_start_init_point", "yes"); + /* The following option reduce the automatic modification of the + * starting point done my Ipopt. + */ + AddIpoptNumOption(nlp, "bound_push", 1e-5); + AddIpoptNumOption(nlp, "bound_frac", 1e-5); + status = IpoptSolve(nlp, x, NULL, &obj, mult_g, mult_x_L, mult_x_U, &user_data); + + if( status == Solve_Succeeded ) + { + printf("\n\nSolution of the primal variables, x\n"); + for( i = 0; i < n; i++ ) + { + printf("x[%d] = %e\n", (int)i, x[i]); + } + + printf("\n\nSolution of the constraint multipliers, lambda\n"); + for( i = 0; i < m; i++ ) + { + printf("lambda[%d] = %e\n", (int)i, mult_g[i]); + } + printf("\n\nSolution of the bound multipliers, z_L and z_U\n"); + for( i = 0; i < n; i++ ) + { + printf("z_L[%d] = %e\n", (int)i, mult_x_L[i]); + } + for( i = 0; i < n; i++ ) + { + printf("z_U[%d] = %e\n", (int)i, mult_x_U[i]); + } + + printf("\n\nObjective value\nf(x*) = %e\n", obj); + } + else + { + printf("\n\nERROR OCCURRED DURING IPOPT OPTIMIZATION WITH WARM START.\n"); + } + } + + /* free allocated memory */ + FreeIpoptProblem(nlp); + free(x); + free(mult_g); + free(mult_x_L); + free(mult_x_U); + + return (status == Solve_Succeeded) ? EXIT_SUCCESS : EXIT_FAILURE; } +/* [MAIN] */ diff --git a/examples/hs071_cpp/hs071_main.cpp b/examples/hs071_cpp/hs071_main.cpp index 4681f968d..35db2a1a7 100644 --- a/examples/hs071_cpp/hs071_main.cpp +++ b/examples/hs071_cpp/hs071_main.cpp @@ -30,7 +30,7 @@ int main( // Change some options // Note: The following choices are only examples, they might not be // suitable for your optimization problem. - app->Options()->SetNumericValue("tol", 1e-7); + app->Options()->SetNumericValue("tol", 3.82e-6); app->Options()->SetStringValue("mu_strategy", "adaptive"); app->Options()->SetStringValue("output_file", "ipopt.out"); // The following overwrites the default name (ipopt.opt) of the options file diff --git a/examples/hs071_cpp/hs071_nlp.cpp b/examples/hs071_cpp/hs071_nlp.cpp index 8210475d8..582d52ac9 100644 --- a/examples/hs071_cpp/hs071_nlp.cpp +++ b/examples/hs071_cpp/hs071_nlp.cpp @@ -16,7 +16,9 @@ using namespace Ipopt; #endif // constructor -HS071_NLP::HS071_NLP() +HS071_NLP::HS071_NLP( + bool printiterate +) : printiterate_(printiterate) { } // destructor @@ -369,3 +371,89 @@ void HS071_NLP::finalize_solution( } } // [TNLP_finalize_solution] + +// [TNLP_intermediate_callback] +bool HS071_NLP::intermediate_callback( + AlgorithmMode mode, + Index iter, + Number obj_value, + Number inf_pr, + Number inf_du, + Number mu, + Number d_norm, + Number regularization_size, + Number alpha_du, + Number alpha_pr, + Index ls_trials, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq +) +{ + if( !printiterate_ ) + { + return true; + } + + Number x[4]; + Number x_L_viol[4]; + Number x_U_viol[4]; + Number z_L[4]; + Number z_U[4]; + Number compl_x_L[4]; + Number compl_x_U[4]; + Number grad_lag_x[4]; + + Number g[2]; + Number lambda[2]; + Number constraint_violation[2]; + Number compl_g[2]; + + bool have_iter = get_curr_iterate(ip_data, ip_cq, false, 4, x, z_L, z_U, 2, g, lambda); + bool have_viol = get_curr_violations(ip_data, ip_cq, false, 4, x_L_viol, x_U_viol, compl_x_L, compl_x_U, grad_lag_x, 2, constraint_violation, compl_g); + + printf("Current iterate:\n"); + printf(" %-12s %-12s %-12s %-12s %-12s %-12s %-12s\n", "x", "z_L", "z_U", "bound_viol", "compl_x_L", "compl_x_U", "grad_lag_x"); + for( int i = 0; i < 4; ++i ) + { + if( have_iter ) + { + printf(" %-12g %-12g %-12g", x[i], z_L[i], z_U[i]); + } + else + { + printf(" %-12s %-12s %-12s", "n/a", "n/a", "n/a"); + } + if( have_viol ) + { + printf(" %-12g %-12g %-12g %-12g\n", x_L_viol[i] > x_U_viol[i] ? x_L_viol[i] : x_U_viol[i], compl_x_L[i], compl_x_U[i], grad_lag_x[i]); + } + else + { + printf(" %-12s %-12s %-12s %-12s\n", "n/a", "n/a", "n/a", "n/a"); + } + } + + printf(" %-12s %-12s %-12s %-12s\n", "g(x)", "lambda", "constr_viol", "compl_g"); + for( int i = 0; i < 2; ++i ) + { + if( have_iter ) + { + printf(" %-12g %-12g", g[i], lambda[i]); + } + else + { + printf(" %-12s %-12s", "n/a", "n/a"); + } + if( have_viol ) + { + printf(" %-12g %-12g\n", constraint_violation[i], compl_g[i]); + } + else + { + printf(" %-12s %-12s\n", "n/a", "n/a"); + } + } + + return true; +} +// [TNLP_intermediate_callback] diff --git a/examples/hs071_cpp/hs071_nlp.hpp b/examples/hs071_cpp/hs071_nlp.hpp index e929cec7f..ca5b87d0b 100644 --- a/examples/hs071_cpp/hs071_nlp.hpp +++ b/examples/hs071_cpp/hs071_nlp.hpp @@ -34,10 +34,12 @@ using namespace Ipopt; class HS071_NLP: public TNLP { public: - /** Default constructor */ - HS071_NLP(); + /** Constructor */ + HS071_NLP( + bool printiterate = false /**< whether to print the iterate at each iteration */ + ); - /** Default destructor */ + /** Destructor */ virtual ~HS071_NLP(); /**@name Overloaded from TNLP */ @@ -148,7 +150,26 @@ class HS071_NLP: public TNLP ); //@} + bool intermediate_callback( + AlgorithmMode mode, + Index iter, + Number obj_value, + Number inf_pr, + Number inf_du, + Number mu, + Number d_norm, + Number regularization_size, + Number alpha_du, + Number alpha_pr, + Index ls_trials, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq + ); + private: + /** whether to print iterate to stdout in intermediate_callback() */ + bool printiterate_; + /**@name Methods to block default compiler methods. * * The compiler automatically generates the following three methods. diff --git a/examples/hs071_f/Makefile.in b/examples/hs071_f/Makefile.in index db876c439..9ab42484e 100644 --- a/examples/hs071_f/Makefile.in +++ b/examples/hs071_f/Makefile.in @@ -12,7 +12,8 @@ EXE = hs071_f@EXEEXT@ # CHANGEME: Here is the name of all object files corresponding to the source # code that you wrote in order to define the problem statement -OBJS = hs071_f.@OBJEXT@ +@IPOPT_SINGLE_FALSE@OBJS = hs071_f.@OBJEXT@ +@IPOPT_SINGLE_TRUE@OBJS = hs071_fs.@OBJEXT@ # CHANGEME: Additional libraries ADDLIBS = diff --git a/examples/hs071_f/hs071_f.f.in b/examples/hs071_f/hs071_f.f.in index 5fb430e86..0304189b2 100644 --- a/examples/hs071_f/hs071_f.f.in +++ b/examples/hs071_f/hs071_f.f.in @@ -2,11 +2,9 @@ C Copyright (C) 2002, 2010 Carnegie Mellon University and others. C All Rights Reserved. C This code is published under the Eclipse Public License. C -C $Id$ -C C ============================================================================= C -C This is an example for the usage of IPOPT. +C This is an example for the usage of IPOPT in double precision. C It implements problem 71 from the Hock-Schittkowski test suite: C C min x1*x4*(x1 + x2 + x3) + x3 @@ -52,10 +50,19 @@ C Vector of variables C double precision X(N) C -C Vector of lower and upper bounds +C Vector of lower and upper bounds, left and right hand sides, and scaling +C + double precision X_L(N), X_U(N), X_SCALING(N), Z_L(N), Z_U(N) + double precision G_L(M), G_U(M), G_SCALING(M) + +C To indicate to IPSETPROBLEMSCALING below that scaling for constraints +C should be omitted, a NULL pointer can be passed for G_SCALING. With +C Fortran > 77, this is done by removing the declaration of G_SCALING +C from the line above and the data G_SCALING line below and enabling +C the following line instead: +C +C double precision, allocatable, dimension(:) :: G_SCALING C - double precision X_L(N), X_U(N), Z_L(N), Z_U(N) - double precision G_L(M), G_U(M) C C Private data for evaluation routines C This could be used to pass double precision and integer arrays untouched @@ -74,8 +81,8 @@ C @BIT64FCOMMENT@ integer*8 IPCREATE C integer IERR - integer IPSOLVE, IPADDSTROPTION - integer IPADDNUMOPTION, IPADDINTOPTION + integer IPSOLVE, IPSETPROBLEMSCALING + integer IPADDSTROPTION, IPADDNUMOPTION, IPADDINTOPTION integer IPOPENOUTPUTFILE C double precision F @@ -90,18 +97,20 @@ CC CC The next is an optional callback method. It is called once per CC iteration. CC -C external ITER_CB + external ITER_CB C -C Set initial point and bounds: +C Set initial point, bounds, and scaling: C - data X / 1d0, 5d0, 5d0, 1d0/ + data X / 1d0, 5d0, 5d0, 1d0 / data X_L / 1d0, 1d0, 1d0, 1d0 / data X_U / 5d0, 5d0, 5d0, 5d0 / + data X_SCALING / 1d0, 1d0, 1d0, 1d0 / C -C Set bounds for the constraints +C Set bounds and scaling for the constraints C data G_L / 25d0, 40d0 / data G_U / 1d40, 40d0 / + data G_SCALING / 1d0, 1d0 / C C First create a handle for the Ipopt problem (and read the options C file) @@ -139,10 +148,18 @@ C IERR = IPADDNUMOPTION(IPROBLEM, 'tol', 1.d-7) if (IERR.ne.0 ) goto 9990 +C +C Set scaling +C + IERR = IPSETPROBLEMSCALING(IPROBLEM, 1d0, X_SCALING, G_SCALING) + if (IERR.ne.0 ) goto 9990 + CC CC Set a callback function to give you control once per iteration. CC You can use it if you want to generate some output, or to stop CC the optimization early. +CC Uncomment this line to print iterate in every iteration and +CC demonstrate how to stop Ipopt early. CC C call IPSETCALLBACK(IPROBLEM, ITER_CB) @@ -154,8 +171,11 @@ C DAT(2) = 0.d0 C C Call optimization routine +C Passing IPROBLEM instead of IDAT is a hack to make IPROBLEM +C accessible within ITER_CB. A proficient Fortran programmer would +C find a way to store IPROBLEM inside IDAT. C - IERR = IPSOLVE(IPROBLEM, X, G, F, LAM, Z_L, Z_U, IDAT, DAT) + IERR = IPSOLVE(IPROBLEM, X, G, F, LAM, Z_L, Z_U, IPROBLEM, DAT) C C Output: C @@ -385,15 +405,58 @@ C double precision DAT(*) integer IDAT(*) integer ISTOP + integer IPGETCURRITERATE + integer IPGETCURRVIOLATIONS + integer i, IERR + double precision X(4) + double precision Z_L(4) + double precision Z_U(4) + double precision G(2) + double precision LAMBDA(2) + double precision COMPL_X_L(4) + double precision COMPL_X_U(4) + double precision GRAD_LAG_X(4) + double precision CONS_VIOL(2) + double precision COMPL_G(2) +C +C Get iterate and print +C + IERR = IPGETCURRITERATE(IDAT, 0, 1, 1, 1, 1, 4, X, Z_L, Z_U, 2, G, + 1 LAMBDA) + if ( IERR.eq.0 ) then + do i = 1, 4 + write(*,*) 'X, Z_L, Z_U (',i,') = ', X(i), Z_L(i), Z_U(i) + enddo + do i = 1, 2 + write(*,*) 'G, LAMBDA (',i,') = ', G(i), LAMBDA(i) + enddo + endif + C -C You can put some output here +C Get violations and print C - write(*,*) 'Testing callback function in iteration ', ITER_COUNT + IERR = IPGETCURRVIOLATIONS(IDAT, 0, 0, 1, 1, 1, 4, + 1 0, 0, COMPL_X_L, COMPL_X_U, GRAD_LAG_X, 2, CONS_VIOL, COMPL_G) + if ( IERR.eq.0 ) then + do i = 1, 4 + write(*,*) 'COMPL_X_L, COMPL_X_U, GRAD_LAG_X (',i,') = ', + 1 COMPL_X_L(i), COMPL_X_U(i), GRAD_LAG_X(i) + enddo + do i = 1, 2 + write(*,*) 'CONS_VIOL, COMPL_G (',i,') = ', + 1 CONS_VIOL(i), COMPL_G(i) + enddo + endif + C C And set ISTOP to 1 if you want Ipopt to stop now. Below is just a C simple example. C - if (INF_PR.le.1D-04) ISTOP = 1 + if (INF_PR.le.1D-04) then + write(*,*) 'Requesting stop due to small inf_pr in iteration ', + 1 ITER_COUNT + ISTOP = 1 + endif return end diff --git a/examples/hs071_f/hs071_fs.f.in b/examples/hs071_f/hs071_fs.f.in new file mode 100644 index 000000000..87a8a61a0 --- /dev/null +++ b/examples/hs071_f/hs071_fs.f.in @@ -0,0 +1,445 @@ +C Copyright (C) 2002, 2010 Carnegie Mellon University and others. +C All Rights Reserved. +C This code is published under the Eclipse Public License. +C +C ============================================================================= +C +C This is an example for the usage of IPOPT in single precision. +C It implements problem 71 from the Hock-Schittkowski test suite: +C +C min x1*x4*(x1 + x2 + x3) + x3 +C s.t. x1*x2*x3*x4 >= 25 +C x1**2 + x2**2 + x3**2 + x4**2 = 40 +C 1 <= x1,x2,x3,x4 <= 5 +C +C Starting point: +C x = (1, 5, 5, 1) +C +C Optimal solution: +C x = (1.00000000, 4.74299963, 3.82114998, 1.37940829) +C +C ============================================================================= +C +C +C ============================================================================= +C +C Main driver program +C +C ============================================================================= +C + program example +C + implicit none +C +C include the Ipopt return codes +C + include 'IpReturnCodes.inc' +C +C Size of the problem (number of variables and equality constraints) +C + integer N, M, NELE_JAC, NELE_HESS, IDX_STY + parameter (N = 4, M = 2, NELE_JAC = 8, NELE_HESS = 10) + parameter (IDX_STY = 1 ) +C +C Space for multipliers and constraints +C + real LAM(M) + real G(M) +C +C Vector of variables +C + real X(N) +C +C Vector of lower and upper bounds +C + real X_L(N), X_U(N), Z_L(N), Z_U(N) + real G_L(M), G_U(M) +C +C Private data for evaluation routines +C This could be used to pass real and integer arrays untouched +C to the evaluation subroutines EVAL_* +C + real DAT(2) + integer IDAT(1) +C +C Place for storing the Ipopt Problem Handle +C +@BIT32FCOMMENT@C for 32 bit platforms +@BIT32FCOMMENT@ integer IPROBLEM +@BIT32FCOMMENT@ integer IPCREATE +@BIT64FCOMMENT@C for 64 bit platforms: +@BIT64FCOMMENT@ integer*8 IPROBLEM +@BIT64FCOMMENT@ integer*8 IPCREATE +C + integer IERR + integer IPSOLVE, IPADDSTROPTION + integer IPADDNUMOPTION, IPADDINTOPTION + integer IPOPENOUTPUTFILE +C + real F + integer i +C +C The following are the Fortran routines for computing the model +C functions and their derivatives - their code can be found further +C down in this file. +C + external EV_F, EV_G, EV_GRAD_F, EV_JAC_G, EV_HESS +CC +CC The next is an optional callback method. It is called once per +CC iteration. +CC + external ITER_CB +C +C Set initial point and bounds: +C + data X / 1e0, 5e0, 5e0, 1e0/ + data X_L / 1e0, 1e0, 1e0, 1e0 / + data X_U / 5e0, 5e0, 5e0, 5e0 / +C +C Set bounds for the constraints +C + data G_L / 25e0, 40e0 / + data G_U / 1e20, 40e0 / +C +C First create a handle for the Ipopt problem (and read the options +C file) +C + IPROBLEM = IPCREATE(N, X_L, X_U, M, G_L, G_U, NELE_JAC, NELE_HESS, + 1 IDX_STY, EV_F, EV_G, EV_GRAD_F, EV_JAC_G, EV_HESS) + if (IPROBLEM.eq.0) then + write(*,*) 'Error creating an Ipopt Problem handle.' + stop + endif +C +C Open an output file +C + IERR = IPOPENOUTPUTFILE(IPROBLEM, 'IPOPT.OUT', 5) + if (IERR.ne.0 ) then + write(*,*) 'Error opening the Ipopt output file.' + goto 9000 + endif +C +C Note: The following options are only examples, they might not be +C suitable for your optimization problem. +C +C Set a string option +C + IERR = IPADDSTROPTION(IPROBLEM, 'mu_strategy', 'adaptive') + if (IERR.ne.0 ) goto 9990 +C +C Set an integer option +C + IERR = IPADDINTOPTION(IPROBLEM, 'max_iter', 3000) + if (IERR.ne.0 ) goto 9990 +C +C Set a real option +C + IERR = IPADDNUMOPTION(IPROBLEM, 'tol', 3.82e-6) + if (IERR.ne.0 ) goto 9990 + +CC +CC Set a callback function to give you control once per iteration. +CC You can use it if you want to generate some output, or to stop +CC the optimization early. +CC Uncomment this line to print iterate in every iteration and +CC demonstrate how to stop Ipopt early. +CC +C call IPSETCALLBACK(IPROBLEM, ITER_CB) + +C +C As a simple example, we pass the constants in the constraints to +C the EVAL_C routine via the "private" DAT array. +C + DAT(1) = 0.e0 + DAT(2) = 0.e0 +C +C Call optimization routine +C Passing IPROBLEM instead of IDAT is a hack to make IPROBLEM +C accessible within ITER_CB. A proficient Fortran programmer would +C find a way to store IPROBLEM inside IDAT. +C + IERR = IPSOLVE(IPROBLEM, X, G, F, LAM, Z_L, Z_U, IPROBLEM, DAT) +C +C Output: +C + if( IERR.eq.IP_SOLVE_SUCCEEDED ) then + write(*,*) + write(*,*) 'The solution was found.' + write(*,*) + write(*,*) 'The final value of the objective function is ',F + write(*,*) + write(*,*) 'The optimal values of X are:' + write(*,*) + do i = 1, N + write(*,*) 'X (',i,') = ',X(i) + enddo + write(*,*) + write(*,*) 'The multipliers for the lower bounds are:' + write(*,*) + do i = 1, N + write(*,*) 'Z_L(',i,') = ',Z_L(i) + enddo + write(*,*) + write(*,*) 'The multipliers for the upper bounds are:' + write(*,*) + do i = 1, N + write(*,*) 'Z_U(',i,') = ',Z_U(i) + enddo + write(*,*) + write(*,*) 'The multipliers for the equality constraints are:' + write(*,*) + do i = 1, M + write(*,*) 'LAM(',i,') = ',LAM(i) + enddo + write(*,*) + else + write(*,*) + write(*,*) 'An error occoured.' + write(*,*) 'The error code is ',IERR + write(*,*) + endif +C + 9000 continue +C +C Clean up +C + call IPFREE(IPROBLEM) + stop +C + 9990 continue + write(*,*) 'Error setting an option' + goto 9000 + end +C +C ============================================================================= +C +C Computation of objective function +C +C ============================================================================= +C + subroutine EV_F(N, X, NEW_X, F, IDAT, DAT, IERR) + implicit none + integer N, NEW_X + real F, X(N) + real DAT(*) + integer IDAT(*) + integer IERR + F = X(1)*X(4)*(X(1)+X(2)+X(3)) + X(3) + IERR = 0 + return + end +C +C ============================================================================= +C +C Computation of gradient of objective function +C +C ============================================================================= +C + subroutine EV_GRAD_F(N, X, NEW_X, GRAD, IDAT, DAT, IERR) + implicit none + integer N, NEW_X + real GRAD(N), X(N) + real DAT(*) + integer IDAT(*) + integer IERR + GRAD(1) = X(4)*(2e0*X(1)+X(2)+X(3)) + GRAD(2) = X(1)*X(4) + GRAD(3) = X(1)*X(4) + 1e0 + GRAD(4) = X(1)*(X(1)+X(2)+X(3)) + IERR = 0 + return + end +C +C ============================================================================= +C +C Computation of equality constraints +C +C ============================================================================= +C + subroutine EV_G(N, X, NEW_X, M, G, IDAT, DAT, IERR) + implicit none + integer N, NEW_X, M + real G(M), X(N) + real DAT(*) + integer IDAT(*) + integer IERR + G(1) = X(1)*X(2)*X(3)*X(4) - DAT(1) + G(2) = X(1)**2 + X(2)**2 + X(3)**2 + X(4)**2 - DAT(2) + IERR = 0 + return + end +C +C ============================================================================= +C +C Computation of Jacobian of equality constraints +C +C ============================================================================= +C + subroutine EV_JAC_G(TASK, N, X, NEW_X, M, NZ, ACON, AVAR, A, + 1 IDAT, DAT, IERR) + integer TASK, N, NEW_X, M, NZ + real X(N), A(NZ) + integer ACON(NZ), AVAR(NZ), I + real DAT(*) + integer IDAT(*) + integer IERR +C +C structure of Jacobian: +C + integer AVAR1(8), ACON1(8) + data AVAR1 /1, 2, 3, 4, 1, 2, 3, 4/ + data ACON1 /1, 1, 1, 1, 2, 2, 2, 2/ + save AVAR1, ACON1 +C + if( TASK.eq.0 ) then + do I = 1, 8 + AVAR(I) = AVAR1(I) + ACON(I) = ACON1(I) + enddo + else + A(1) = X(2)*X(3)*X(4) + A(2) = X(1)*X(3)*X(4) + A(3) = X(1)*X(2)*X(4) + A(4) = X(1)*X(2)*X(3) + A(5) = 2e0*X(1) + A(6) = 2e0*X(2) + A(7) = 2e0*X(3) + A(8) = 2e0*X(4) + endif + IERR = 0 + return + end +C +C ============================================================================= +C +C Computation of Hessian of Lagrangian +C +C ============================================================================= +C + subroutine EV_HESS(TASK, N, X, NEW_X, OBJFACT, M, LAM, NEW_LAM, + 1 NNZH, IRNH, ICNH, HESS, IDAT, DAT, IERR) + implicit none + integer TASK, N, NEW_X, M, NEW_LAM, NNZH, i + real X(N), OBJFACT, LAM(M), HESS(NNZH) + integer IRNH(NNZH), ICNH(NNZH) + real DAT(*) + integer IDAT(*) + integer IERR +C +C structure of Hessian: +C + integer IRNH1(10), ICNH1(10) + data IRNH1 /1, 2, 2, 3, 3, 3, 4, 4, 4, 4/ + data ICNH1 /1, 1, 2, 1, 2, 3, 1, 2, 3, 4/ + save IRNH1, ICNH1 + + if( TASK.eq.0 ) then + do i = 1, 10 + IRNH(i) = IRNH1(i) + ICNH(i) = ICNH1(i) + enddo + else + do i = 1, 10 + HESS(i) = 0d0 + enddo +C +C objective function +C + HESS(1) = OBJFACT * 2e0*X(4) + HESS(2) = OBJFACT * X(4) + HESS(4) = OBJFACT * X(4) + HESS(7) = OBJFACT * (2e0*X(1) + X(2) + X(3)) + HESS(8) = OBJFACT * X(1) + HESS(9) = OBJFACT * X(1) +C +C first constraint +C + HESS(2) = HESS(2) + LAM(1) * X(3)*X(4) + HESS(4) = HESS(4) + LAM(1) * X(2)*X(4) + HESS(5) = HESS(5) + LAM(1) * X(1)*X(4) + HESS(7) = HESS(7) + LAM(1) * X(2)*X(3) + HESS(8) = HESS(8) + LAM(1) * X(1)*X(3) + HESS(9) = HESS(9) + LAM(1) * X(1)*X(2) +C +C second constraint +C + HESS(1) = HESS(1) + LAM(2) * 2e0 + HESS(3) = HESS(3) + LAM(2) * 2e0 + HESS(6) = HESS(6) + LAM(2) * 2e0 + HESS(10)= HESS(10)+ LAM(2) * 2e0 + endif + IERR = 0 + return + end +C +C ============================================================================= +C +C Callback method called once per iteration +C +C ============================================================================= +C + subroutine ITER_CB(ALG_MODE, ITER_COUNT,OBJVAL, INF_PR, INF_DU, + 1 MU, DNORM, REGU_SIZE, ALPHA_DU, ALPHA_PR, LS_TRIAL, IDAT, + 2 DAT, ISTOP) + implicit none + integer ALG_MODE, ITER_COUNT, LS_TRIAL + real OBJVAL, INF_PR, INF_DU, MU, DNORM, REGU_SIZE + real ALPHA_DU, ALPHA_PR + real DAT(*) + integer IDAT(*) + integer ISTOP + integer IPGETCURRITERATE + integer IPGETCURRVIOLATIONS + integer i, IERR + real X(4) + real Z_L(4) + real Z_U(4) + real G(2) + real LAMBDA(2) + real COMPL_X_L(4) + real COMPL_X_U(4) + real GRAD_LAG_X(4) + real CONS_VIOL(2) + real COMPL_G(2) +C +C Get iterate and print +C + IERR = IPGETCURRITERATE(IDAT, 0, 1, 1, 1, 1, 4, X, Z_L, Z_U, 2, G, + 1 LAMBDA) + if ( IERR.eq.0 ) then + do i = 1, 4 + write(*,*) 'X, Z_L, Z_U (',i,') = ', X(i), Z_L(i), Z_U(i) + enddo + do i = 1, 2 + write(*,*) 'G, LAMBDA (',i,') = ', G(i), LAMBDA(i) + enddo + endif + +C +C Get violations and print +C + IERR = IPGETCURRVIOLATIONS(IDAT, 0, 0, 1, 1, 1, 4, + 1 0, 0, COMPL_X_L, COMPL_X_U, GRAD_LAG_X, 2, CONS_VIOL, COMPL_G) + if ( IERR.eq.0 ) then + do i = 1, 4 + write(*,*) 'COMPL_X_L, COMPL_X_U, GRAD_LAG_X (',i,') = ', + 1 COMPL_X_L(i), COMPL_X_U(i), GRAD_LAG_X(i) + enddo + do i = 1, 2 + write(*,*) 'CONS_VIOL, COMPL_G (',i,') = ', + 1 CONS_VIOL(i), COMPL_G(i) + enddo + endif + +C +C And set ISTOP to 1 if you want Ipopt to stop now. Below is just a +C simple example. +C + if (INF_PR.le.1e-04) then + write(*,*) 'Requesting stop due to small inf_pr in iteration ', + 1 ITER_COUNT + ISTOP = 1 + endif + + return + end diff --git a/examples/hs071_java/HS071.java b/examples/hs071_java/HS071.java index 29f8a69c4..a895f9980 100644 --- a/examples/hs071_java/HS071.java +++ b/examples/hs071_java/HS071.java @@ -6,7 +6,7 @@ import org.coinor.Ipopt; -/** Java example for interfacing with IPOPT. +/** Java example for interfacing with IPOPT (double precision). * * HS071 implements a Java example of problem 71 of the * Hock-Schittkowsky test suite. @@ -29,6 +29,8 @@ public class HS071 extends Ipopt int count_bounds = 0; int dcount_start = 0; + boolean printiterate; + /** Creates a new instance of HS071 */ // [HS071] public HS071() @@ -50,6 +52,9 @@ public HS071() /* Index style for the irow/jcol elements */ int index_style = Ipopt.C_STYLE; + /* Whether to print iterate in intermediate_callback */ + printiterate = false; + /* create the IpoptProblem */ create(n, m, nele_jac, nele_hess, index_style); } @@ -203,10 +208,10 @@ protected boolean eval_jac_g( values[2] = x[0] * x[1] * x[3]; /* 0,2 */ values[3] = x[0] * x[1] * x[2]; /* 0,3 */ - values[4] = 2 * x[0]; /* 1,0 */ - values[5] = 2 * x[1]; /* 1,1 */ - values[6] = 2 * x[2]; /* 1,2 */ - values[7] = 2 * x[3]; /* 1,3 */ + values[4] = 2.0 * x[0]; /* 1,0 */ + values[5] = 2.0 * x[1]; /* 1,1 */ + values[6] = 2.0 * x[2]; /* 1,2 */ + values[7] = 2.0 * x[3]; /* 1,3 */ } return true; @@ -258,16 +263,16 @@ protected boolean eval_h( */ /* fill the objective portion */ - values[0] = obj_factor * (2 * x[3]); /* 0,0 */ - values[1] = obj_factor * (x[3]); /* 1,0 */ - values[2] = 0.0; /* 1,1 */ - values[3] = obj_factor * (x[3]); /* 2,0 */ - values[4] = 0.0; /* 2,1 */ - values[5] = 0.0; /* 2,2 */ - values[6] = obj_factor * (2 * x[0] + x[1] + x[2]); /* 3,0 */ - values[7] = obj_factor * (x[0]); /* 3,1 */ - values[8] = obj_factor * (x[0]); /* 3,2 */ - values[9] = 0.0; /* 3,3 */ + values[0] = obj_factor * (2.0 * x[3]); /* 0,0 */ + values[1] = obj_factor * (x[3]); /* 1,0 */ + values[2] = 0.0; /* 1,1 */ + values[3] = obj_factor * (x[3]); /* 2,0 */ + values[4] = 0.0; /* 2,1 */ + values[5] = 0.0; /* 2,2 */ + values[6] = obj_factor * (2.0 * x[0] + x[1] + x[2]); /* 3,0 */ + values[7] = obj_factor * (x[0]); /* 3,1 */ + values[8] = obj_factor * (x[0]); /* 3,2 */ + values[9] = 0.0; /* 3,3 */ /* add the portion for the first constraint */ values[1] += lambda[0] * (x[2] * x[3]); /* 1,0 */ @@ -288,6 +293,89 @@ protected boolean eval_h( } // [eval] + // [intermediate_callback] + public boolean intermediate_callback( + int algorithmmode, + int iter, + double obj_value, + double inf_pr, + double inf_du, + double mu, + double d_norm, + double regularization_size, + double alpha_du, + double alpha_pr, + int ls_trials, + long ip_data, + long ip_cq) + { + if( !printiterate ) + { + return true; + } + + double x[] = new double[n]; + double z_L[] = new double[n]; + double z_U[] = new double[n]; + double x_L_viol[] = new double[n]; + double x_U_viol[] = new double[n]; + double compl_x_L[] = new double[n]; + double compl_x_U[] = new double[n]; + double grad_lag_x[] = new double[n]; + double g[] = new double[m]; + double lambda[] = new double[m]; + double constr_viol[] = new double[m]; + double compl_g[] = new double[m]; + + boolean have_iter = get_curr_iterate(ip_data, ip_cq, false, n, x, z_L, z_U, m, g, lambda); + boolean have_viol = get_curr_violations(ip_data, ip_cq, false, n, x_L_viol, x_U_viol, compl_x_L, compl_x_U, grad_lag_x, m, constr_viol, compl_g); + + System.out.println("Current iterate at iteration " + iter + ":"); + System.out.println(" x z_L z_U bound_viol compl_x_L compl_x_U grad_lag_x"); + for( int i = 0; i < n; ++i ) + { + if( have_iter ) + { + System.out.print(" " + x[i] + " " + z_L[i] + " " + z_U[i]); + } + else + { + System.out.print(" n/a n/a n/a"); + } + if( have_viol ) + { + System.out.println(" " + Math.max(x_L_viol[i], x_U_viol[i]) + " " + compl_x_L[i] + " " + compl_x_U[i] + " " + grad_lag_x[i]); + } + else + { + System.out.println(" n/a/ n/a n/a n/a"); + } + } + System.out.println(" g(x) lambda constr_viol compl_g"); + for( int i = 0; i < m; ++i ) + { + if( have_iter ) + { + System.out.print(" " + g[i] + " " + lambda[i]); + } + else + { + System.out.print(" n/a n/a"); + } + if( have_viol ) + { + System.out.println(" " + constr_viol[i] + " " + compl_g[i]); + } + else + { + System.out.println(" n/a + n/a"); + } + } + + return true; + } + // [intermediate_callback] + private void print( double[] x, String str) @@ -318,6 +406,9 @@ public static void main(String[] args) // hs071.setNumericOption("warm_start_slack_bound_push",1e-9); // hs071.setNumericOption("warm_start_mult_bound_push",1e-9); + // enable printing of current iterate in intermediate_callback + // hs071.printiterate = true; + // Solve the problem int status = hs071.OptimizeNLP(); diff --git a/examples/hs071_java/HS071s.java b/examples/hs071_java/HS071s.java new file mode 100644 index 000000000..8ce9a91ed --- /dev/null +++ b/examples/hs071_java/HS071s.java @@ -0,0 +1,353 @@ +/* Copyright (C) 2007 VRTech Industrial Technologies - www.vrtech.com.br. + * Copyright (C) 2007 Tong Kewei, Beihang University, - www.buaa.edu.cn. + * All Rights Reserved. + * This code is published under the Eclipse Public License. + */ + +import org.coinor.Ipopt; + +/** Java example for interfacing with IPOPT (single precision). + * + * HS071 implements a Java example of problem 71 of the + * Hock-Schittkowsky test suite. + * + * The optimal solution is + * x = (1.00000000, 4.74299963, 3.82114998, 1.37940829). + * + * This code was based on same problem of the Ipopt distribution. + * + * @author Rafael de Pelegrini Soares, Tong Kewei + */ +public class HS071s extends Ipopt +{ + // Problem sizes + int n; + int m; + int nele_jac; + int nele_hess; + + int count_bounds = 0; + int dcount_start = 0; + + /** Creates a new instance of HS071s */ + // [HS071s] + public HS071s() + { + /* Number of nonzeros in the Jacobian of the constraints */ + nele_jac = 8; + + /* Number of nonzeros in the Hessian of the Lagrangian (lower or + * upper triangual part only) + */ + nele_hess = 10; + + /* Number of variables */ + n = 4; + + /* Number of constraints */ + m = 2; + + /* Index style for the irow/jcol elements */ + int index_style = Ipopt.C_STYLE; + + /* create the IpoptProblem */ + create(n, m, nele_jac, nele_hess, index_style); + } + // [HS071] + + /** Callback function for variable bounds and constraint sides. */ + // [get_bounds_info] + protected boolean get_bounds_info( + int n, + float[] x_L, + float[] x_U, + int m, + float[] g_L, + float[] g_U) + { + assert n == this.n; + assert m == this.m; + + /* set the values of the variable bounds */ + for( int i = 0; i < n; ++i ) + { + x_L[i] = 1.0f; + x_U[i] = 5.0f; + } + + /* set the values of the constraint bounds */ + g_L[0] = 25.0f; + g_U[0] = 2e19f; + g_L[1] = 40.0f; + g_U[1] = 40.0f; + + return true; + } + // [get_bounds_info] + + /** Callback function for the starting point. */ + // [get_starting_point] + protected boolean get_starting_point( + int n, + boolean init_x, + float[] x, + boolean init_z, + float[] z_L, + float[] z_U, + int m, + boolean init_lambda, + float[] lambda) + { + assert init_z == false; + assert init_lambda = false; + + if( init_x ) + { + x[0] = 1.0f; + x[1] = 5.0f; + x[2] = 5.0f; + x[3] = 1.0f; + } + + return true; + } + // [get_starting_point] + + // [eval] + protected boolean eval_f( + int n, + float[] x, + boolean new_x, + float[] obj_value) + { + assert n == this.n; + + obj_value[0] = x[0] * x[3] * (x[0] + x[1] + x[2]) + x[2]; + + return true; + } + + protected boolean eval_grad_f( + int n, + float[] x, + boolean new_x, + float[] grad_f) + { + assert n == this.n; + + grad_f[0] = x[0] * x[3] + x[3] * (x[0] + x[1] + x[2]); + grad_f[1] = x[0] * x[3]; + grad_f[2] = x[0] * x[3] + 1; + grad_f[3] = x[0] * (x[0] + x[1] + x[2]); + + return true; + } + + protected boolean eval_g( + int n, + float[] x, + boolean new_x, + int m, + float[] g) + { + assert n == this.n; + assert m == this.m; + + g[0] = x[0] * x[1] * x[2] * x[3]; + g[1] = x[0] * x[0] + x[1] * x[1] + x[2] * x[2] + x[3] * x[3]; + + return true; + } + + protected boolean eval_jac_g( + int n, + float[] x, + boolean new_x, + int m, + int nele_jac, + int[] iRow, + int[] jCol, + float[] values) + { + assert n == this.n; + assert m == this.m; + + if( values == null ) + { + /* return the structure of the jacobian */ + + /* this particular jacobian is dense */ + iRow[0] = 0; + jCol[0] = 0; + iRow[1] = 0; + jCol[1] = 1; + iRow[2] = 0; + jCol[2] = 2; + iRow[3] = 0; + jCol[3] = 3; + iRow[4] = 1; + jCol[4] = 0; + iRow[5] = 1; + jCol[5] = 1; + iRow[6] = 1; + jCol[6] = 2; + iRow[7] = 1; + jCol[7] = 3; + } + else + { + /* return the values of the jacobian of the constraints */ + + values[0] = x[1] * x[2] * x[3]; /* 0,0 */ + values[1] = x[0] * x[2] * x[3]; /* 0,1 */ + values[2] = x[0] * x[1] * x[3]; /* 0,2 */ + values[3] = x[0] * x[1] * x[2]; /* 0,3 */ + + values[4] = 2.0f * x[0]; /* 1,0 */ + values[5] = 2.0f * x[1]; /* 1,1 */ + values[6] = 2.0f * x[2]; /* 1,2 */ + values[7] = 2.0f * x[3]; /* 1,3 */ + } + + return true; + } + + protected boolean eval_h( + int n, + float[] x, + boolean new_x, + float obj_factor, + int m, + float[] lambda, + boolean new_lambda, + int nele_hess, + int[] iRow, + int[] jCol, + float[] values) + { + assert n == this.n; + assert m == this.m; + + int idx = 0; /* nonzero element counter */ + int row = 0; /* row counter for loop */ + int col = 0; /* col counter for loop */ + + if (values == null) + { + /* return the structure + * This is a symmetric matrix, fill the lower left triangle only. + */ + + /* the hessian for this problem is actually dense */ + idx = 0; + for( row = 0; row < n; ++row ) + for (col = 0; col <= row; ++col) + { + iRow[idx] = row; + jCol[idx] = col; + ++idx; + } + + assert idx == nele_hess; + assert nele_hess == this.nele_hess; + } + else + { + /* return the values. + * This is a symmetric matrix, fill the lower left triangle only. + */ + + /* fill the objective portion */ + values[0] = obj_factor * (2.0f * x[3]); /* 0,0 */ + values[1] = obj_factor * (x[3]); /* 1,0 */ + values[2] = 0.0f; /* 1,1 */ + values[3] = obj_factor * (x[3]); /* 2,0 */ + values[4] = 0.0f; /* 2,1 */ + values[5] = 0.0f; /* 2,2 */ + values[6] = obj_factor * (2.0f * x[0] + x[1] + x[2]); /* 3,0 */ + values[7] = obj_factor * (x[0]); /* 3,1 */ + values[8] = obj_factor * (x[0]); /* 3,2 */ + values[9] = 0.0f; /* 3,3 */ + + /* add the portion for the first constraint */ + values[1] += lambda[0] * (x[2] * x[3]); /* 1,0 */ + values[3] += lambda[0] * (x[1] * x[3]); /* 2,0 */ + values[4] += lambda[0] * (x[0] * x[3]); /* 2,1 */ + values[6] += lambda[0] * (x[1] * x[2]); /* 3,0 */ + values[7] += lambda[0] * (x[0] * x[2]); /* 3,1 */ + values[8] += lambda[0] * (x[0] * x[1]); /* 3,2 */ + + /* add the portion for the second constraint */ + values[0] += lambda[1] * 2.0f; /* 0,0 */ + values[2] += lambda[1] * 2.0f; /* 1,1 */ + values[5] += lambda[1] * 2.0f; /* 2,2 */ + values[9] += lambda[1] * 2.0f; /* 3,3 */ + } + + return true; + } + // [eval] + + private void print( + float[] x, + String str) + { + System.out.println(str); + for( int i = 0; i < x.length; ++i ) + { + System.out.println(x[i]); + } + System.out.println(); + } + + /** Main function for running this example. */ + // [main] + public static void main(String[] args) + { + // Create the problem + HS071s hs071 = new HS071s(); + + // Set some options + // hs071.setNumericOption("tol",6.28E-6f); + // hs071.setStringOption("nlp_scaling_method","user-scaling"); + // hs071.setStringOption("print_options_documentation","yes"); + // hs071.setStringOption("warm_start_init_point","yes"); + // hs071.setNumericOption("warm_start_bound_push",1e-9f); + // hs071.setNumericOption("warm_start_bound_frac",1e-9f); + // hs071.setNumericOption("warm_start_slack_bound_frac",1e-9f); + // hs071.setNumericOption("warm_start_slack_bound_push",1e-9f); + // hs071.setNumericOption("warm_start_mult_bound_push",1e-9f); + + // Solve the problem + int status = hs071.OptimizeNLP(); + + // Print the solution + if( status == SOLVE_SUCCEEDED ) + { + System.out.println("\n\n*** The problem solved!"); + } + else + { + System.out.println("\n\n*** The problem was not solved successfully!"); + } + + float obj = hs071.getObjectiveValue(); + System.out.println("\nObjective Value = " + obj + "\n"); + + float x[] = hs071.getVariableValues(); + hs071.print(x, "Primal Variable Values:"); + + float constraints[] = hs071.getConstraintValues(); + hs071.print(constraints, "Constraint Values:"); + + float MLB[] = hs071.getLowerBoundMultipliers(); + hs071.print(MLB, "Dual Multipliers for Variable Lower Bounds:"); + + float MUB[] = hs071.getUpperBoundMultipliers(); + hs071.print(MUB, "Dual Multipliers for Variable Upper Bounds:"); + + float lam[] = hs071.getConstraintMultipliers(); + hs071.print(lam, "Dual Multipliers for Constraints:"); + } + // [main] +} diff --git a/examples/hs071_java/Makefile.in b/examples/hs071_java/Makefile.in index 32824dd63..051657b2a 100644 --- a/examples/hs071_java/Makefile.in +++ b/examples/hs071_java/Makefile.in @@ -17,7 +17,11 @@ JAVA = @JAVA@ # Ipopt JAR prefix = @prefix@ exec_prefix = @exec_prefix@ -IPOPTJAR = @libdir@/org.coinor.ipopt.jar +datarootdir = @datarootdir@ +IPOPTJAR = @datadir@/java/org.coinor.ipopt.jar + +@IPOPT_SINGLE_FALSE@CLASS = HS071 +@IPOPT_SINGLE_TRUE@CLASS = HS071s ########################################################################## @@ -26,10 +30,10 @@ IPOPTJAR = @libdir@/org.coinor.ipopt.jar .java.class: $(JAVAC) -cp $(IPOPTJAR) $< -all : HS071.class +all : $(CLASS).class -test : HS071.class - $(JAVA) -cp $(IPOPTJAR):. -Djava.library.path=@libdir@ HS071 +test : $(CLASS).class + $(JAVA) -cp $(IPOPTJAR):. -Djava.library.path=@libdir@ $(CLASS) clean : - rm -rf HS071.class + rm -rf $(CLASS).class diff --git a/examples/recursive_nlp/Makefile.in b/examples/recursive_nlp/Makefile.in new file mode 100644 index 000000000..1b9b36fa2 --- /dev/null +++ b/examples/recursive_nlp/Makefile.in @@ -0,0 +1,53 @@ +# Copyright (C) 2003, 2010 International Business Machines and others. +# All Rights Reserved. +# This file is distributed under the Eclipse Public License. + +########################################################################## +# You can modify this example makefile to fit for your own program. # +# Usually, you only need to change the four CHANGEME entries below. # +########################################################################## + +# CHANGEME: This should be the name of your executable +EXE = recursive_nlp@EXEEXT@ + +# CHANGEME: Here is the name of all source files +SRC = @srcdir@/recursive_nlp.cpp + +# CHANGEME: Additional libraries +ADDLIBS = + +# CHANGEME: Additional flags for compilation (e.g., include flags) +ADDINCFLAGS = + +########################################################################## +# Usually, you don't have to change anything below. Note that if you # +# change certain compiler options, you might have to recompile Ipopt. # +########################################################################## + +# C++ Compiler command +CXX = @CXX@ + +# C++ Compiler options +CXXFLAGS = @CXXFLAGS@ + +# additional C++ Compiler options for linking +CXXLINKFLAGS = @RPATH_FLAGS@ + +prefix=@prefix@ +exec_prefix=@exec_prefix@ + +# Include directories +@COIN_HAS_PKGCONFIG_TRUE@INCL = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --cflags ipopt` $(ADDINCFLAGS) +@COIN_HAS_PKGCONFIG_FALSE@INCL = -I@includedir@/coin-or @IPOPTLIB_CFLAGS@ $(ADDINCFLAGS) + +# Linker flags +@COIN_HAS_PKGCONFIG_TRUE@LIBS = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --libs ipopt` +@COIN_HAS_PKGCONFIG_FALSE@LIBS = -L@libdir@ -lipopt @IPOPTLIB_LFLAGS@ + +all: $(EXE) + +$(EXE): $(SRC) + $(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) $(INCL) -o $@ $(SRC) $(LIBS) $(ADDLIBS) + +clean: + rm -rf $(EXE) diff --git a/examples/recursive_nlp/recursive_nlp.cpp b/examples/recursive_nlp/recursive_nlp.cpp new file mode 100644 index 000000000..e3cab4f44 --- /dev/null +++ b/examples/recursive_nlp/recursive_nlp.cpp @@ -0,0 +1,286 @@ +// Copyright (C) 2020 COIN-OR Foundation +// All Rights Reserved. +// This code is published under the Eclipse Public License 2.0. +// +// Author: Brad Bell + +/** @file recursive_nlp.cpp + * + * This solve a NLP where the objective function is defined as a solution point of a NLP. + * Both the outer and the inner problem are solved by Ipopt. + * (For simplicity, the inner problem is very similar to the outer problem.) + * + * Inner problem: minimize exp [ 0.5 * (x - a)^2 + 0.5 * x^2 ] w.r.t x + * Define y(a): arg_min exp [ 0.5 * (x - a)^2 + 0.5 * x^2 ] w.r.t x + * Outer problem: minimize exp [ 0.5 * (y(a) - a)^2 + 0.5 * y(a)^2 ] w.r.t a + */ + +#include "IpIpoptApplication.hpp" +#include "IpTNLP.hpp" + +#include +#include +#include + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +using namespace Ipopt; + +class recursive_nlp: public TNLP +{ +private: + const bool inner_; + const Number a_; + Number arg_min_; + Number y_; + +public: + // arg_min + Number arg_min(void) const + { + return arg_min_; + } + + // constructor for the inner problem + recursive_nlp(const Number& a) + : inner_(true), + a_(a), + arg_min_(0.0), + y_(0.0) + { } + + // constructor for the outer problem + recursive_nlp(void) + : inner_(false), + a_(0.0), + arg_min_(0.0), + y_(0.0) + { } + + // default destructor + virtual ~recursive_nlp() { } + + // get_nlp_info + bool get_nlp_info( + Index& n, + Index& m, + Index& nnz_jac_g, + Index& nnz_h_lag, + IndexStyleEnum& index_style) + { + n = 1; + m = 0; + nnz_jac_g = 0; + nnz_h_lag = 1; + index_style = C_STYLE; + + return true; + } + + // get_bounds_info + bool get_bounds_info( + Index n, + Number* x_l, + Number* x_u, + Index m, + Number* g_l, + Number* g_u) + { + assert(n == 1 && m == 0); + + /* default Ipopt value for "infinity" is 1e20 */ + x_l[0] = -1e20; + x_u[0] = +1e20; + + return true; + } + + // get_starting_point + 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) + { + assert(n == 1 && m == 0 && init_x); + + // x[0] == 0 is solution for outer problem + x[0] = 2.0; + + return true; + } + + // eval_f + bool eval_f( + Index n, + const Number* x, + bool new_x, + Number& obj_value) + { + assert(n == 1); + + if( inner_ ) + { + Number arg = 0.5 * (x[0] - a_) * (x[0] - a_) + 0.5 * x[0] * x[0]; + // avoid a floating-point overflow when arg is too large, return false instead + if( arg >= std::log(std::numeric_limits::max()) ) + { + return false; + } + obj_value = std::exp(arg); + return true; + } + + if( new_x ) + { + // solve the inner problem with corresponding to x[0] + SmartPtr app = IpoptApplicationFactory(); + app->Options()->SetIntegerValue("print_level", J_STRONGWARNING); + app->Options()->SetStringValue("hessian_approximation", "limited-memory"); + ApplicationReturnStatus status = app->Initialize(); + if( status != Solve_Succeeded ) + { + return false; + } + + SmartPtr nlp = new recursive_nlp(x[0]); + status = app->OptimizeTNLP(nlp); + if( status != Solve_Succeeded ) + { + return false; + } + + // set y_ equal to the arg_min for the inner problem + y_ = nlp->arg_min(); + } + + // evaluate object for the outer problem + Number arg = 0.5 * (y_ - x[0]) * (y_ - x[0]) + 0.5 * y_ * y_; + // avoid a floating-point overflow when arg is too large, return false instead + if( arg >= std::log(std::numeric_limits::max()) ) + { + return false; + } + obj_value = std::exp(arg); + + return true; + } + + // eval_grad_f + bool eval_grad_f( + Index n, + const Number* x, + bool new_x, + Number* grad_f) + { + assert(n == 1); + + // evaluate objective, if new_x and outer problem also update y_ + Number obj_value; + eval_f(n, x, new_x, obj_value); + + if( inner_ ) + { + grad_f[0] = obj_value * ((x[0] - a_) + x[0]); + return true; + } + + // use fact that gradient of outer objective w.r.t y_ is zero + grad_f[0] = obj_value * (x[0] - y_); + + return true; + } + + // eval_g + bool eval_g( + Index n, + const Number* x, + bool new_x, + Index m, + Number* g) + { + assert(n == 1 && m == 0); + + return true; + } + + // eval_jac_g + bool eval_jac_g( + Index n, + const Number* x, + bool new_x, + Index m, + Index nele_jac, + Index* iRow, + Index* jCol, + Number* values) + { + assert(n == 1 && m == 0 && nele_jac == 0); + + return true; + } + + // eval_h + 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) + { + // using an approximate Hessian + return false; + } + + // finalize_solution + 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) + { + assert(n == 1 && m == 0); + + arg_min_ = x[0]; + } +}; + +int main(int argc, char** argv) +{ + SmartPtr app = IpoptApplicationFactory(); + ApplicationReturnStatus status = app->Initialize(); + assert(status == Solve_Succeeded); + + app->Options()->SetStringValue("derivative_test", "first-order"); + app->Options()->SetStringValue("hessian_approximation", "limited-memory"); + + SmartPtr nlp = new recursive_nlp(); + status = app->OptimizeTNLP(nlp); + + if( status == Solve_Succeeded ) + { + std::cout << "nlp->arg_min() = " << nlp->arg_min() << "\n"; + } + + return EXIT_SUCCESS; +} diff --git a/install-sh b/install-sh index 8175c640f..ec298b537 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2018-03-11.20; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ while test $# -ne 0; do -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -301,22 +325,6 @@ do if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -326,52 +334,49 @@ do fi posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # Note that $RANDOM variable is not portable (e.g. dash); Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p' feature. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -382,7 +387,7 @@ do then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -411,7 +416,7 @@ do prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -451,7 +456,18 @@ do trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -477,6 +493,13 @@ do then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -491,9 +514,9 @@ do # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 diff --git a/ipopt.pc.in b/ipopt.pc.in deleted file mode 100644 index 22ea944ce..000000000 --- a/ipopt.pc.in +++ /dev/null @@ -1,15 +0,0 @@ -@COIN_RELOCATABLE_FALSE@prefix=@prefix@ -@COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@/coin-or - -Name: IPOPT -Description: Interior Point Optimizer -URL: https://github.com/coin-or/Ipopt -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lipopt -Libs.private: @IPOPTLIB_LFLAGS_NOPC@ -Cflags: -I${includedir} -Requires: -Requires.private: @IPOPTLIB_PCFILES@ diff --git a/ltmain.sh b/ltmain.sh index 0f0a2da3f..2a50d7f6f 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,12 +1,12 @@ -#! /bin/sh +#! /usr/bin/env sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in -## by inline-source v2014-01-03.01 +## by inline-source v2019-02-19.15 -# libtool (GNU libtool) 2.4.6 +# libtool (GNU libtool) 2.4.7 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996-2015 Free Software Foundation, Inc. +# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -31,8 +31,8 @@ PROGRAM=libtool PACKAGE=libtool -VERSION=2.4.6 -package_revision=2.4.6 +VERSION=2.4.7 +package_revision=2.4.7 ## ------ ## @@ -64,34 +64,25 @@ package_revision=2.4.6 # libraries, which are installed to $pkgauxdir. # Set a version string for this script. -scriptversion=2015-01-20.17; # UTC +scriptversion=2019-02-19.15; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 -# Copyright (C) 2004-2015 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# As a special exception to the GNU General Public License, if you distribute -# this file as part of a program or library that is built using GNU Libtool, -# you may include this file under the same distribution terms that you use -# for the rest of that program. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2004-2019, 2021 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 2 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. -# Please report bugs or propose patches to gary@gnu.org. +# Please report bugs or propose patches to: +# ## ------ ## @@ -139,9 +130,12 @@ do _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# These NLS vars are set unconditionally (bootstrap issue #24). Unset those +# in case the environment reset is needed later and the $save_* variant is not +# defined (see the code above). +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL # Make sure IFS has a sensible default sp=' ' @@ -159,6 +153,26 @@ if test "${PATH_SEPARATOR+set}" != set; then fi +# func_unset VAR +# -------------- +# Portably unset VAR. +# In some shells, an 'unset VAR' statement leaves a non-zero return +# status if VAR is already unset, which might be problematic if the +# statement is used at the end of a function (thus poisoning its return +# value) or when 'set -e' is active (causing even a spurious abort of +# the script in this case). +func_unset () +{ + { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } +} + + +# Make sure CDPATH doesn't cause `cd` commands to output the target dir. +func_unset CDPATH + +# Make sure ${,E,F}GREP behave sanely. +func_unset GREP_OPTIONS + ## ------------------------- ## ## Locate command utilities. ## @@ -259,7 +273,7 @@ test -z "$SED" && { rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" rm -f conftest.sed SED=$func_path_progs_result } @@ -295,7 +309,7 @@ test -z "$GREP" && { rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" GREP=$func_path_progs_result } @@ -360,6 +374,35 @@ sed_double_backslash="\ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" +# require_check_ifs_backslash +# --------------------------- +# Check if we can use backslash as IFS='\' separator, and set +# $check_ifs_backshlash_broken to ':' or 'false'. +require_check_ifs_backslash=func_require_check_ifs_backslash +func_require_check_ifs_backslash () +{ + _G_save_IFS=$IFS + IFS='\' + _G_check_ifs_backshlash='a\\b' + for _G_i in $_G_check_ifs_backshlash + do + case $_G_i in + a) + check_ifs_backshlash_broken=false + ;; + '') + break + ;; + *) + check_ifs_backshlash_broken=: + break + ;; + esac + done + IFS=$_G_save_IFS + require_check_ifs_backslash=: +} + ## ----------------- ## ## Global variables. ## @@ -580,16 +623,16 @@ if test yes = "$_G_HAVE_PLUSEQ_OP"; then { $debug_cmd - func_quote_for_eval "$2" - eval "$1+=\\ \$func_quote_for_eval_result" + func_quote_arg pretty "$2" + eval "$1+=\\ \$func_quote_arg_result" }' else func_append_quoted () { $debug_cmd - func_quote_for_eval "$2" - eval "$1=\$$1\\ \$func_quote_for_eval_result" + func_quote_arg pretty "$2" + eval "$1=\$$1\\ \$func_quote_arg_result" } fi @@ -1091,85 +1134,203 @@ func_relative_path () } -# func_quote_for_eval ARG... -# -------------------------- -# Aesthetically quote ARGs to be evaled later. -# This function returns two values: -# i) func_quote_for_eval_result -# double-quoted, suitable for a subsequent eval -# ii) func_quote_for_eval_unquoted_result -# has all characters that are still active within double -# quotes backslashified. -func_quote_for_eval () +# func_quote_portable EVAL ARG +# ---------------------------- +# Internal function to portably implement func_quote_arg. Note that we still +# keep attention to performance here so we as much as possible try to avoid +# calling sed binary (so far O(N) complexity as long as func_append is O(1)). +func_quote_portable () { $debug_cmd - func_quote_for_eval_unquoted_result= - func_quote_for_eval_result= - while test 0 -lt $#; do - case $1 in - *[\\\`\"\$]*) - _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; - *) - _G_unquoted_arg=$1 ;; - esac - if test -n "$func_quote_for_eval_unquoted_result"; then - func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" - else - func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" + $require_check_ifs_backslash + + func_quote_portable_result=$2 + + # one-time-loop (easy break) + while true + do + if $1; then + func_quote_portable_result=`$ECHO "$2" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` + break fi - case $_G_unquoted_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and variable expansion - # for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - _G_quoted_arg=\"$_G_unquoted_arg\" + # Quote for eval. + case $func_quote_portable_result in + *[\\\`\"\$]*) + # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string + # contains the shell wildcard characters. + case $check_ifs_backshlash_broken$func_quote_portable_result in + :*|*[\[\*\?]*) + func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ + | $SED "$sed_quote_subst"` + break + ;; + esac + + func_quote_portable_old_IFS=$IFS + for _G_char in '\' '`' '"' '$' + do + # STATE($1) PREV($2) SEPARATOR($3) + set start "" "" + func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy + IFS=$_G_char + for _G_part in $func_quote_portable_result + do + case $1 in + quote) + func_append func_quote_portable_result "$3$2" + set quote "$_G_part" "\\$_G_char" + ;; + start) + set first "" "" + func_quote_portable_result= + ;; + first) + set quote "$_G_part" "" + ;; + esac + done + done + IFS=$func_quote_portable_old_IFS ;; - *) - _G_quoted_arg=$_G_unquoted_arg - ;; + *) ;; esac - - if test -n "$func_quote_for_eval_result"; then - func_append func_quote_for_eval_result " $_G_quoted_arg" - else - func_append func_quote_for_eval_result "$_G_quoted_arg" - fi - shift + break done + + func_quote_portable_unquoted_result=$func_quote_portable_result + case $func_quote_portable_result in + # double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # many bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_portable_result=\"$func_quote_portable_result\" + ;; + esac } -# func_quote_for_expand ARG -# ------------------------- -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - $debug_cmd +# func_quotefast_eval ARG +# ----------------------- +# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', +# but optimized for speed. Result is stored in $func_quotefast_eval. +if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then + printf -v _GL_test_printf_tilde %q '~' + if test '\~' = "$_GL_test_printf_tilde"; then + func_quotefast_eval () + { + printf -v func_quotefast_eval_result %q "$1" + } + else + # Broken older Bash implementations. Make those faster too if possible. + func_quotefast_eval () + { + case $1 in + '~'*) + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + ;; + *) + printf -v func_quotefast_eval_result %q "$1" + ;; + esac + } + fi +else + func_quotefast_eval () + { + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + } +fi - case $1 in - *[\\\`\"]*) - _G_arg=`$ECHO "$1" | $SED \ - -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; - *) - _G_arg=$1 ;; + +# func_quote_arg MODEs ARG +# ------------------------ +# Quote one ARG to be evaled later. MODEs argument may contain zero or more +# specifiers listed below separated by ',' character. This function returns two +# values: +# i) func_quote_arg_result +# double-quoted (when needed), suitable for a subsequent eval +# ii) func_quote_arg_unquoted_result +# has all characters that are still active within double +# quotes backslashified. Available only if 'unquoted' is specified. +# +# Available modes: +# ---------------- +# 'eval' (default) +# - escape shell special characters +# 'expand' +# - the same as 'eval'; but do not quote variable references +# 'pretty' +# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might +# be used later in func_quote to get output like: 'echo "a b"' instead +# of 'echo a\ b'. This is slower than default on some shells. +# 'unquoted' +# - produce also $func_quote_arg_unquoted_result which does not contain +# wrapping double-quotes. +# +# Examples for 'func_quote_arg pretty,unquoted string': +# +# string | *_result | *_unquoted_result +# ------------+-----------------------+------------------- +# " | \" | \" +# a b | "a b" | a b +# "a b" | "\"a b\"" | \"a b\" +# * | "*" | * +# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" +# +# Examples for 'func_quote_arg pretty,unquoted,expand string': +# +# string | *_result | *_unquoted_result +# --------------+---------------------+-------------------- +# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" +func_quote_arg () +{ + _G_quote_expand=false + case ,$1, in + *,expand,*) + _G_quote_expand=: + ;; esac - case $_G_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - _G_arg=\"$_G_arg\" + case ,$1, in + *,pretty,*|*,expand,*|*,unquoted,*) + func_quote_portable $_G_quote_expand "$2" + func_quote_arg_result=$func_quote_portable_result + func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result + ;; + *) + # Faster quote-for-eval for some shells. + func_quotefast_eval "$2" + func_quote_arg_result=$func_quotefast_eval_result ;; esac +} + - func_quote_for_expand_result=$_G_arg +# func_quote MODEs ARGs... +# ------------------------ +# Quote all ARGs to be evaled later and join them into single command. See +# func_quote_arg's description for more info. +func_quote () +{ + $debug_cmd + _G_func_quote_mode=$1 ; shift + func_quote_result= + while test 0 -lt $#; do + func_quote_arg "$_G_func_quote_mode" "$1" + if test -n "$func_quote_result"; then + func_append func_quote_result " $func_quote_arg_result" + else + func_append func_quote_result "$func_quote_arg_result" + fi + shift + done } @@ -1215,8 +1376,8 @@ func_show_eval () _G_cmd=$1 _G_fail_exp=${2-':'} - func_quote_for_expand "$_G_cmd" - eval "func_notquiet $func_quote_for_expand_result" + func_quote_arg pretty,expand "$_G_cmd" + eval "func_notquiet $func_quote_arg_result" $opt_dry_run || { eval "$_G_cmd" @@ -1241,8 +1402,8 @@ func_show_eval_locale () _G_fail_exp=${2-':'} $opt_quiet || { - func_quote_for_expand "$_G_cmd" - eval "func_echo $func_quote_for_expand_result" + func_quote_arg expand,pretty "$_G_cmd" + eval "func_echo $func_quote_arg_result" } $opt_dry_run || { @@ -1369,30 +1530,26 @@ func_lt_ver () # End: #! /bin/sh -# Set a version string for this script. -scriptversion=2014-01-07.03; # UTC - # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 -# Copyright (C) 2010-2015 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2010-2019, 2021 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 2 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# Please report bugs or propose patches to: +# -# Please report bugs or propose patches to gary@gnu.org. +# Set a version string for this script. +scriptversion=2019-02-19.15; # UTC ## ------ ## @@ -1415,7 +1572,7 @@ scriptversion=2014-01-07.03; # UTC # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file -# starting with '# Written by ' and ending with '# warranty; '. +# starting with '# Written by ' and ending with '# Copyright'. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the @@ -1427,7 +1584,7 @@ scriptversion=2014-01-07.03; # UTC # to display verbose messages only when your user has specified # '--verbose'. # -# After sourcing this file, you can plug processing for additional +# After sourcing this file, you can plug in processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. @@ -1476,8 +1633,8 @@ fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## # This section contains functions for adding, removing, and running hooks -# to the main code. A hook is just a named list of of function, that can -# be run in order later on. +# in the main code. A hook is just a list of function names that can be +# run in order later on. # func_hookable FUNC_NAME # ----------------------- @@ -1510,7 +1667,8 @@ func_add_hook () # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ -# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. +# Remove HOOK_FUNC from the list of hook functions to be called by +# FUNC_NAME. func_remove_hook () { $debug_cmd @@ -1519,10 +1677,28 @@ func_remove_hook () } +# func_propagate_result FUNC_NAME_A FUNC_NAME_B +# --------------------------------------------- +# If the *_result variable of FUNC_NAME_A _is set_, assign its value to +# *_result variable of FUNC_NAME_B. +func_propagate_result () +{ + $debug_cmd + + func_propagate_result_result=: + if eval "test \"\${${1}_result+set}\" = set" + then + eval "${2}_result=\$${1}_result" + else + func_propagate_result_result=false + fi +} + + # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. -# It is assumed that the list of hook functions contains nothing more +# It's assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. @@ -1532,22 +1708,19 @@ func_run_hooks () case " $hookable_fns " in *" $1 "*) ;; - *) func_fatal_error "'$1' does not support hook funcions.n" ;; + *) func_fatal_error "'$1' does not support hook functions." ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do - eval $_G_hook '"$@"' - - # store returned options list back into positional - # parameters for next 'cmd' execution. - eval _G_hook_result=\$${_G_hook}_result - eval set dummy "$_G_hook_result"; shift + func_unset "${_G_hook}_result" + eval $_G_hook '${1+"$@"}' + func_propagate_result $_G_hook func_run_hooks + if $func_propagate_result_result; then + eval set dummy "$func_run_hooks_result"; shift + fi done - - func_quote_for_eval ${1+"$@"} - func_run_hooks_result=$func_quote_for_eval_result } @@ -1557,10 +1730,18 @@ func_run_hooks () ## --------------- ## # In order to add your own option parsing hooks, you must accept the -# full positional parameter list in your hook function, remove any -# options that you action, and then pass back the remaining unprocessed -# options in '_result', escaped suitably for -# 'eval'. Like this: +# full positional parameter list from your hook function. You may remove +# or edit any options that you action, and then pass back the remaining +# unprocessed options in '_result', escaped +# suitably for 'eval'. +# +# The '_result' variable is automatically unset +# before your hook gets called; for best performance, only set the +# *_result variable when necessary (i.e. don't call the 'func_quote' +# function unnecessarily because it can be an expensive operation on some +# machines). +# +# Like this: # # my_options_prep () # { @@ -1570,9 +1751,8 @@ func_run_hooks () # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' -# -# func_quote_for_eval ${1+"$@"} -# my_options_prep_result=$func_quote_for_eval_result +# # No change in '$@' (ignored completely by this hook). Leave +# # my_options_prep_result variable intact. # } # func_add_hook func_options_prep my_options_prep # @@ -1581,25 +1761,36 @@ func_run_hooks () # { # $debug_cmd # -# # Note that for efficiency, we parse as many options as we can +# args_changed=false +# +# # Note that, for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in -# --silent|-s) opt_silent=: ;; +# --silent|-s) opt_silent=: +# args_changed=: +# ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift +# args_changed=: # ;; -# *) set dummy "$_G_opt" "$*"; shift; break ;; +# *) # Make sure the first unrecognised option "$_G_opt" +# # is added back to "$@" in case we need it later, +# # if $args_changed was set to 'true'. +# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # -# func_quote_for_eval ${1+"$@"} -# my_silent_option_result=$func_quote_for_eval_result +# # Only call 'func_quote' here if we processed at least one argument. +# if $args_changed; then +# func_quote eval ${1+"$@"} +# my_silent_option_result=$func_quote_result +# fi # } # func_add_hook func_parse_options my_silent_option # @@ -1610,17 +1801,26 @@ func_run_hooks () # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." -# -# func_quote_for_eval ${1+"$@"} -# my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # -# You'll alse need to manually amend $usage_message to reflect the extra +# You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. +# func_options_finish [ARG]... +# ---------------------------- +# Finishing the option parse loop (call 'func_options' hooks ATM). +func_options_finish () +{ + $debug_cmd + + func_run_hooks func_options ${1+"$@"} + func_propagate_result func_run_hooks func_options_finish +} + + # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the @@ -1630,17 +1830,27 @@ func_options () { $debug_cmd - func_options_prep ${1+"$@"} - eval func_parse_options \ - ${func_options_prep_result+"$func_options_prep_result"} - eval func_validate_options \ - ${func_parse_options_result+"$func_parse_options_result"} + _G_options_quoted=false - eval func_run_hooks func_options \ - ${func_validate_options_result+"$func_validate_options_result"} + for my_func in options_prep parse_options validate_options options_finish + do + func_unset func_${my_func}_result + func_unset func_run_hooks_result + eval func_$my_func '${1+"$@"}' + func_propagate_result func_$my_func func_options + if $func_propagate_result_result; then + eval set dummy "$func_options_result"; shift + _G_options_quoted=: + fi + done - # save modified positional parameters for caller - func_options_result=$func_run_hooks_result + $_G_options_quoted || { + # As we (func_options) are top-level options-parser function and + # nobody quoted "$@" for us yet, we need to do it explicitly for + # caller. + func_quote eval ${1+"$@"} + func_options_result=$func_quote_result + } } @@ -1649,9 +1859,8 @@ func_options () # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and -# needs to propogate that back to rest of this script, then the complete -# modified list must be put in 'func_run_hooks_result' before -# returning. +# needs to propagate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before returning. func_hookable func_options_prep func_options_prep () { @@ -1662,9 +1871,7 @@ func_options_prep () opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} - - # save modified positional parameters for caller - func_options_prep_result=$func_run_hooks_result + func_propagate_result func_run_hooks func_options_prep } @@ -1676,25 +1883,32 @@ func_parse_options () { $debug_cmd - func_parse_options_result= - + _G_parse_options_requote=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} - - # Adjust func_parse_options positional parameters to match - eval set dummy "$func_run_hooks_result"; shift + func_propagate_result func_run_hooks func_parse_options + if $func_propagate_result_result; then + eval set dummy "$func_parse_options_result"; shift + # Even though we may have changed "$@", we passed the "$@" array + # down into the hook and it quoted it for us (because we are in + # this if-branch). No need to quote it again. + _G_parse_options_requote=false + fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break + # We expect that one of the options parsed in this function matches + # and thus we remove _G_opt from "$@" and need to re-quote. + _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' - func_echo "enabling shell trace mode" + func_echo "enabling shell trace mode" >&2 $debug_cmd ;; @@ -1704,7 +1918,10 @@ func_parse_options () ;; --warnings|--warning|-W) - test $# = 0 && func_missing_arg $_G_opt && break + if test $# = 0 && func_missing_arg $_G_opt; then + _G_parse_options_requote=: + break + fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above @@ -1757,15 +1974,24 @@ func_parse_options () shift ;; - --) break ;; + --) _G_parse_options_requote=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; - *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift + _G_match_parse_options=false + break + ;; esac + + if $_G_match_parse_options; then + _G_parse_options_requote=: + fi done - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - func_parse_options_result=$func_quote_for_eval_result + if $_G_parse_options_requote; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + func_parse_options_result=$func_quote_result + fi } @@ -1782,12 +2008,10 @@ func_validate_options () test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} + func_propagate_result func_run_hooks func_validate_options # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE - - # save modified positional parameters for caller - func_validate_options_result=$func_run_hooks_result } @@ -1843,8 +2067,8 @@ func_missing_arg () # func_split_equals STRING # ------------------------ -# Set func_split_equals_lhs and func_split_equals_rhs shell variables after -# splitting STRING at the '=' sign. +# Set func_split_equals_lhs and func_split_equals_rhs shell variables +# after splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ @@ -1859,8 +2083,9 @@ then func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} - test "x$func_split_equals_lhs" = "x$1" \ - && func_split_equals_rhs= + if test "x$func_split_equals_lhs" = "x$1"; then + func_split_equals_rhs= + fi }' else # ...otherwise fall back to using expr, which is often a shell builtin. @@ -1870,7 +2095,7 @@ else func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= - test "x$func_split_equals_lhs" = "x$1" \ + test "x$func_split_equals_lhs=" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals @@ -1896,7 +2121,7 @@ else { $debug_cmd - func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` + func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt @@ -1938,31 +2163,44 @@ func_usage_message () # func_version # ------------ # Echo version message to standard output and exit. +# The version message is extracted from the calling file's header +# comments, with leading '# ' stripped: +# 1. First display the progname and version +# 2. Followed by the header comment line matching /^# Written by / +# 3. Then a blank line followed by the first following line matching +# /^# Copyright / +# 4. Immediately followed by any lines between the previous matches, +# except lines preceding the intervening completely blank line. +# For example, see the header comments of this file. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' - /(C)/!b go - :more - /\./!{ - N - s|\n# | | - b more - } - :go - /^# Written by /,/# warranty; / { - s|^# || - s|^# *$|| - s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| - p + /^# Written by /!b + s|^# ||; p; n + + :fwd2blnk + /./ { + n + b fwd2blnk } - /^# Written by / { - s|^# || - p + p; n + + :holdwrnt + s|^# || + s|^# *$|| + /^Copyright /!{ + /./H + n + b holdwrnt } - /^warranty; /q' < "$progpath" + + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + G + s|\(\n\)\n*|\1|g + p; q' < "$progpath" exit $? } @@ -1972,12 +2210,12 @@ func_version () # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. -scriptversion='(GNU libtool) 2.4.6' +scriptversion='(GNU libtool) 2.4.7' # func_echo ARG... @@ -2068,7 +2306,7 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname (GNU libtool) 2.4.6 + version: $progname (GNU libtool) 2.4.7 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` @@ -2124,7 +2362,7 @@ fi # a configuration failure hint, and exit. func_fatal_configuration () { - func__fatal_error ${1+"$@"} \ + func_fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } @@ -2270,6 +2508,8 @@ libtool_options_prep () nonopt= preserve_args= + _G_rc_lt_options_prep=: + # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) @@ -2293,11 +2533,16 @@ libtool_options_prep () uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; + *) + _G_rc_lt_options_prep=false + ;; esac - # Pass back the list of options. - func_quote_for_eval ${1+"$@"} - libtool_options_prep_result=$func_quote_for_eval_result + if $_G_rc_lt_options_prep; then + # Pass back the list of options. + func_quote eval ${1+"$@"} + libtool_options_prep_result=$func_quote_result + fi } func_add_hook func_options_prep libtool_options_prep @@ -2309,9 +2554,12 @@ libtool_parse_options () { $debug_cmd + _G_rc_lt_parse_options=false + # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do + _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in @@ -2386,15 +2634,20 @@ libtool_parse_options () func_append preserve_args " $_G_opt" ;; - # An option not handled by this hook function: - *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"} ; shift + _G_match_lt_parse_options=false + break + ;; esac + $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done - - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - libtool_parse_options_result=$func_quote_for_eval_result + if $_G_rc_lt_parse_options; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + libtool_parse_options_result=$func_quote_result + fi } func_add_hook func_parse_options libtool_parse_options @@ -2451,8 +2704,8 @@ libtool_validate_options () } # Pass back the unparsed argument list - func_quote_for_eval ${1+"$@"} - libtool_validate_options_result=$func_quote_for_eval_result + func_quote eval ${1+"$@"} + libtool_validate_options_result=$func_quote_result } func_add_hook func_validate_options libtool_validate_options @@ -3418,8 +3671,8 @@ func_mode_compile () esac done - func_quote_for_eval "$libobj" - test "X$libobj" != "X$func_quote_for_eval_result" \ + func_quote_arg pretty "$libobj" + test "X$libobj" != "X$func_quote_arg_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" @@ -3492,8 +3745,8 @@ compiler." func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result + func_quote_arg pretty "$srcfile" + qsrcfile=$func_quote_arg_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then @@ -3648,7 +3901,8 @@ This mode accepts the following additional options: -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler + -Wc,FLAG + -Xcompiler FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. @@ -3754,6 +4008,8 @@ The following components of LINK-COMMAND are treated specially: -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wa,FLAG + -Xassembler FLAG pass linker-specific FLAG directly to the assembler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) @@ -4096,8 +4352,8 @@ func_mode_install () case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " + func_quote_arg pretty "$nonopt" + install_prog="$func_quote_arg_result " arg=$1 shift else @@ -4107,8 +4363,8 @@ func_mode_install () # The real first argument should be the name of the installation program. # Aesthetically quote it. - func_quote_for_eval "$arg" - func_append install_prog "$func_quote_for_eval_result" + func_quote_arg pretty "$arg" + func_append install_prog "$func_quote_arg_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; @@ -4165,12 +4421,12 @@ func_mode_install () esac # Aesthetically quote the argument. - func_quote_for_eval "$arg" - func_append install_prog " $func_quote_for_eval_result" + func_quote_arg pretty "$arg" + func_append install_prog " $func_quote_arg_result" if test -n "$arg2"; then - func_quote_for_eval "$arg2" + func_quote_arg pretty "$arg2" fi - func_append install_shared_prog " $func_quote_for_eval_result" + func_append install_shared_prog " $func_quote_arg_result" done test -z "$install_prog" && \ @@ -4181,8 +4437,8 @@ func_mode_install () if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - func_append install_shared_prog " -m $func_quote_for_eval_result" + func_quote_arg pretty "$install_override_mode" + func_append install_shared_prog " -m $func_quote_arg_result" fi fi @@ -4478,8 +4734,8 @@ func_mode_install () relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" + func_quote_arg expand,pretty "$relink_command" + eval "func_echo $func_quote_arg_result" } if eval "$relink_command"; then : else @@ -5258,7 +5514,8 @@ else if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + func_quote_arg pretty "$ECHO" + qECHO=$func_quote_arg_result $ECHO "\ # A function that is used when there is no print builtin or printf. @@ -5268,7 +5525,7 @@ func_fallback_echo () \$1 _LTECHO_EOF' } - ECHO=\"$qECHO\" + ECHO=$qECHO fi # Very basic option parsing. These options are (a) specific to @@ -6611,9 +6868,9 @@ func_mode_link () while test "$#" -gt 0; do arg=$1 shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" + func_quote_arg pretty,unquoted "$arg" + qarg=$func_quote_arg_unquoted_result + func_append libtool_args " $func_quote_arg_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then @@ -6849,6 +7106,13 @@ func_mode_link () prev= continue ;; + xassembler) + func_append compiler_flags " -Xassembler $qarg" + prev= + func_append compile_command " -Xassembler $qarg" + func_append finalize_command " -Xassembler $qarg" + continue + ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" @@ -7019,7 +7283,7 @@ func_mode_link () # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; @@ -7039,7 +7303,7 @@ func_mode_link () esac elif test X-lc_r = "X$arg"; then case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -7069,8 +7333,20 @@ func_mode_link () prev=xcompiler continue ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. + -pthread) + case $host in + *solaris2*) ;; + *) + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + ;; + esac + continue + ;; + -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" @@ -7211,9 +7487,9 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_for_eval "$flag" - func_append arg " $func_quote_for_eval_result" - func_append compiler_flags " $func_quote_for_eval_result" + func_quote_arg pretty "$flag" + func_append arg " $func_quote_arg_result" + func_append compiler_flags " $func_quote_arg_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" @@ -7227,16 +7503,21 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_for_eval "$flag" - func_append arg " $wl$func_quote_for_eval_result" - func_append compiler_flags " $wl$func_quote_for_eval_result" - func_append linker_flags " $func_quote_for_eval_result" + func_quote_arg pretty "$flag" + func_append arg " $wl$func_quote_arg_result" + func_append compiler_flags " $wl$func_quote_arg_result" + func_append linker_flags " $func_quote_arg_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; + -Xassembler) + prev=xassembler + continue + ;; + -Xcompiler) prev=xcompiler continue @@ -7254,8 +7535,8 @@ func_mode_link () # -msg_* for osf cc -msg_*) - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result ;; # Flags to be passed through unchanged, with rationale: @@ -7272,12 +7553,17 @@ func_mode_link () # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer + # -fuse-ld=* Linker select flags for GCC + # -Wa,* Pass flags directly to the assembler -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ + -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" @@ -7298,15 +7584,15 @@ func_mode_link () continue else # Otherwise treat like 'Some other compiler flag' below - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result fi ;; # Some other compiler flag. -* | +*) - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result ;; *.$objext) @@ -7426,8 +7712,8 @@ func_mode_link () *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result ;; esac # arg @@ -8632,7 +8918,7 @@ func_mode_link () test CXX = "$tagname" && { case $host_os in linux*) - case `$CC -V 2>&1 | sed 5q` in + case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi @@ -8805,7 +9091,7 @@ func_mode_link () # case $version_type in # correct linux to gnu/linux during the next big refactor - darwin|freebsd-elf|linux|osf|windows|none) + darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor @@ -8896,7 +9182,7 @@ func_mode_link () versuffix=.$current.$revision ;; - freebsd-elf) + freebsd-elf | midnightbsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision @@ -9122,7 +9408,7 @@ func_mode_link () *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) @@ -9933,8 +10219,8 @@ EOF for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10027,8 +10313,8 @@ EOF eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10502,12 +10788,13 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + func_quote_arg pretty "$var_value" + relink_command="$var=$func_quote_arg_result; export $var; $relink_command" fi done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + func_quote eval cd "`pwd`" + func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" + relink_command=$func_quote_arg_unquoted_result fi # Only actually do things if not in dry run mode. @@ -10747,13 +11034,15 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + func_quote_arg pretty,unquoted "$var_value" + relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + func_quote eval cd "`pwd`" + relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + func_quote_arg pretty,unquoted "$relink_command" + relink_command=$func_quote_arg_unquoted_result if test yes = "$hardcode_automatic"; then relink_command= fi diff --git a/missing b/missing index 625aeb118..1fe1611f1 100755 --- a/missing +++ b/missing @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff --git a/src/Algorithm/Inexact/IpInexactAlgBuilder.cpp b/src/Algorithm/Inexact/IpInexactAlgBuilder.cpp index 9f9d21e4a..2d8d175bb 100644 --- a/src/Algorithm/Inexact/IpInexactAlgBuilder.cpp +++ b/src/Algorithm/Inexact/IpInexactAlgBuilder.cpp @@ -43,22 +43,15 @@ #include "IpInexactNormalTerminationTester.hpp" #include "IpInexactPDTerminationTester.hpp" -#ifdef IPOPT_HAS_HSL -# include "CoinHslConfig.h" -#endif +#include "IpLinearSolvers.h" -#ifdef HAVE_WSMP +#ifdef IPOPT_HAS_WSMP # include "IpWsmpSolverInterface.hpp" #endif #ifdef IPOPT_HAS_MUMPS # include "IpMumpsSolverInterface.hpp" #endif -#ifdef IPOPT_HAS_LINEARSOLVERLOADER -# include "HSLLoader.h" -# include "PardisoLoader.h" -#endif - namespace Ipopt { #if IPOPT_VERBOSITY > 0 @@ -106,16 +99,16 @@ void InexactAlgorithmBuilder::RegisterOptions( SmartPtr roptions ) { - roptions->SetRegisteringCategory("Linear Solver"); roptions->AddStringOption2( "inexact_linear_system_scaling", - "Method for scaling the linear system for the inexact approach", "slack-based", + "Method for scaling the linear system for the inexact approach", + "slack-based", "none", "no scaling will be performed", "slack-based", "scale the linear system as in paper"); } SmartPtr InexactAlgorithmBuilder::BuildBasicAlgorithm( - const Journalist& jnlst, + const Journalist& /*jnlst*/, const OptionsList& options, const std::string& prefix ) @@ -130,100 +123,39 @@ SmartPtr InexactAlgorithmBuilder::BuildBasicAlgorithm( SmartPtr SolverInterface; std::string linear_solver; options.GetStringValue("linear_solver", linear_solver, prefix); + if( linear_solver == "ma27" ) { -#ifndef COINHSL_HAS_MA27 -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - SolverInterface = new Ma27TSolverInterface(); - char buf[256]; - int rc = LSL_loadHSL(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear solver MA27 not available.\nTried to obtain MA27 from shared library \""; - errmsg += LSL_HSLLibraryName(); - errmsg += "\", but the following error occured:\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for MA27 has not been compiled into Ipopt."); -# endif -#else - SolverInterface = new Ma27TSolverInterface(); -#endif - + SolverInterface = new Ma27TSolverInterface(GetHSLLoader(options, prefix)); } + else if( linear_solver == "ma57" ) { -#ifndef COINHSL_HAS_MA57 -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - SolverInterface = new Ma57TSolverInterface(); - char buf[256]; - int rc = LSL_loadHSL(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear solver MA57 not available.\nTried to obtain MA57 from shared library \""; - errmsg += LSL_HSLLibraryName(); - errmsg += "\", but the following error occured:\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for MA57 has not been compiled into Ipopt."); -# endif -#else - SolverInterface = new Ma57TSolverInterface(); -#endif - + SolverInterface = new Ma57TSolverInterface(GetHSLLoader(options, prefix)); } + else if( linear_solver == "pardiso" ) { NormalTester = new InexactNormalTerminationTester(); SmartPtr pd_tester = new InexactPDTerminationTester(); -#ifndef IPOPT_HAS_PARDISO -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - SolverInterface = new IterativePardisoSolverInterface(*NormalTester, *pd_tester); - char buf[256]; - int rc = LSL_loadPardisoLib(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear solver Pardiso not available.\nTried to obtain Pardiso from shared library \""; - errmsg += LSL_PardisoLibraryName(); - errmsg += "\", but the following error occured:\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for Pardiso has not been compiled into Ipopt."); -# endif -#else - SolverInterface = new IterativePardisoSolverInterface(*NormalTester, *pd_tester); -#endif - + SolverInterface = new IterativePardisoSolverInterface(*NormalTester, *pd_tester, GetPardisoLoader(options, prefix)); } + +#ifdef IPOPT_HAS_WSMP else if( linear_solver == "wsmp" ) { -#ifdef HAVE_WSMP SolverInterface = new WsmpSolverInterface(); -#else - - THROW_EXCEPTION(OPTION_INVALID, "Selected linear solver WSMP not available."); + } #endif - } +#ifdef IPOPT_HAS_MUMPS else if( linear_solver == "mumps" ) { -#ifdef IPOPT_HAS_MUMPS SolverInterface = new MumpsSolverInterface(); -#else - - THROW_EXCEPTION(OPTION_INVALID, "Selected linear solver MUMPS not available."); + linear_solver = MumpsSolverInterface::GetName(); + } #endif - } else { THROW_EXCEPTION(OPTION_INVALID, "Inexact version not available for this selection of linear solver."); @@ -290,7 +222,7 @@ SmartPtr InexactAlgorithmBuilder::BuildBasicAlgorithm( // Create the main algorithm SmartPtr alg = new IpoptAlgorithm(SearchDirCalc, GetRawPtr(lineSearch), MuUpdate, convCheck, - IterInitializer, IterOutput, HessUpdater); + IterInitializer, IterOutput, HessUpdater, NULL, linear_solver); return alg; } diff --git a/src/Algorithm/Inexact/IpInexactAlgBuilder.hpp b/src/Algorithm/Inexact/IpInexactAlgBuilder.hpp index 8c5f49b81..0d914ecca 100644 --- a/src/Algorithm/Inexact/IpInexactAlgBuilder.hpp +++ b/src/Algorithm/Inexact/IpInexactAlgBuilder.hpp @@ -26,17 +26,17 @@ class InexactAlgorithmBuilder: public AlgorithmBuilder { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ InexactAlgorithmBuilder(); /** Destructor */ virtual ~InexactAlgorithmBuilder() { } - //@} + ///@} /** @name Methods to build parts of the algorithm */ - //@{ + ///@{ virtual void BuildIpoptObjects( const Journalist& jnlst, const OptionsList& options, @@ -52,7 +52,7 @@ class InexactAlgorithmBuilder: public AlgorithmBuilder const OptionsList& options, const std::string& prefix ); - //@} + ///@} /** register the options used by the algorithm builder */ static void RegisterOptions( @@ -69,7 +69,7 @@ class InexactAlgorithmBuilder: public AlgorithmBuilder * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ InexactAlgorithmBuilder( const InexactAlgorithmBuilder& @@ -79,7 +79,7 @@ class InexactAlgorithmBuilder: public AlgorithmBuilder void operator=( const InexactAlgorithmBuilder& ); - //@} + ///@} /** Optional pointer to AugSystemSolver. * diff --git a/src/Algorithm/Inexact/IpInexactCq.cpp b/src/Algorithm/Inexact/IpInexactCq.cpp index d5d9ea36b..fc6c5c042 100644 --- a/src/Algorithm/Inexact/IpInexactCq.cpp +++ b/src/Algorithm/Inexact/IpInexactCq.cpp @@ -55,7 +55,7 @@ void InexactCq::RegisterOptions( } bool InexactCq::Initialize( - const Journalist& jnlst, + const Journalist& /*jnlst*/, const OptionsList& options, const std::string& prefix ) diff --git a/src/Algorithm/Inexact/IpInexactCq.hpp b/src/Algorithm/Inexact/IpInexactCq.hpp index da1c97d16..42ef2d6c7 100644 --- a/src/Algorithm/Inexact/IpInexactCq.hpp +++ b/src/Algorithm/Inexact/IpInexactCq.hpp @@ -22,7 +22,7 @@ class InexactCq: public IpoptAdditionalCq public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ InexactCq( IpoptNLP* ip_nlp, @@ -32,7 +32,7 @@ class InexactCq: public IpoptAdditionalCq /** Destructor */ virtual ~InexactCq(); - //@} + ///@} /** This method must be called to initialize the global * algorithmic parameters. @@ -130,7 +130,7 @@ class InexactCq: public IpoptAdditionalCq * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ InexactCq(); @@ -141,29 +141,30 @@ class InexactCq: public IpoptAdditionalCq /** Overloaded Assignment Operator */ void operator=( const InexactCq&); - //@} + ///@} /** @name Pointers for easy access to data and NLP information. * * To avoid circular references of Smart Pointers, we use a regular * pointer here. */ - //@{ + ///@{ IpoptNLP* ip_nlp_; IpoptData* ip_data_; IpoptCalculatedQuantities* ip_cq_; - //@} + ///@} /** Method to easily access Inexact data */ InexactData& InexData() { InexactData& inexact_data = static_cast(ip_data_->AdditionalData()); + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(dynamic_cast(&ip_data_->AdditionalData())); return inexact_data; } /** @name Caches */ - //@{ + ///@{ CachedResults > curr_jac_cdT_times_curr_cdminuss_cache_; CachedResults > curr_scaling_slacks_cache_; CachedResults > curr_slack_scaled_d_minus_s_cache_; @@ -176,7 +177,7 @@ class InexactCq: public IpoptAdditionalCq CachedResults curr_uWu_cache_; CachedResults > curr_jac_times_normal_c_cache_; CachedResults > curr_jac_times_normal_d_cache_; - //@} + ///@} /** Upper bound on slack-based scaling factors */ Number slack_scale_max_; diff --git a/src/Algorithm/Inexact/IpInexactData.cpp b/src/Algorithm/Inexact/IpInexactData.cpp index 93fdb74f4..2f7894a4a 100644 --- a/src/Algorithm/Inexact/IpInexactData.cpp +++ b/src/Algorithm/Inexact/IpInexactData.cpp @@ -16,9 +16,9 @@ InexactData::~InexactData() { } bool InexactData::Initialize( - const Journalist& jnlst, - const OptionsList& options, - const std::string& prefix + const Journalist& /*jnlst*/, + const OptionsList& /*options*/, + const std::string& /*prefix*/ ) { full_step_accepted_ = false; diff --git a/src/Algorithm/Inexact/IpInexactData.hpp b/src/Algorithm/Inexact/IpInexactData.hpp index 94ac24299..d5101a2de 100644 --- a/src/Algorithm/Inexact/IpInexactData.hpp +++ b/src/Algorithm/Inexact/IpInexactData.hpp @@ -19,16 +19,16 @@ class InexactData: public IpoptAdditionalData { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ InexactData(); /** Destructor */ ~InexactData(); - //@} + ///@} /** @name Methods overloaded from IpoptAdditionalData */ - //@{ + ///@{ /** This method must be called to initialize the global * algorithmic parameters. * @@ -50,10 +50,10 @@ class InexactData: public IpoptAdditionalData * release memory, and to reset any flags for a new iteration. */ void AcceptTrialPoint(); - //@} + ///@} /** @name Normal step set and accessor methods */ - //@{ + ///@{ void set_normal_x( SmartPtr& normal_x ) @@ -79,10 +79,10 @@ class InexactData: public IpoptAdditionalData { return normal_s_; } - //@} + ///@} /** @name Tangential step set and accessor methods */ - //@{ + ///@{ void set_tangential_x( SmartPtr& tangential_x ) @@ -108,14 +108,14 @@ class InexactData: public IpoptAdditionalData { return tangential_s_; } - //@} + ///@} /** @name Flag indicating if most recent step has been fully accepted. * * This is used to determine if the trust region * radius should be increased. */ - //@{ + ///@{ void set_full_step_accepted( bool full_step_accepted ) @@ -127,10 +127,10 @@ class InexactData: public IpoptAdditionalData { return full_step_accepted_; } - //@} + ///@} /** @name Current value of penalty parameter */ - //@{ + ///@{ void set_curr_nu( Number nu ) @@ -142,10 +142,10 @@ class InexactData: public IpoptAdditionalData { return curr_nu_; } - //@} + ///@} /** @name Current normal step computation flag */ - //@{ + ///@{ void set_compute_normal( bool compute_normal ) @@ -157,10 +157,10 @@ class InexactData: public IpoptAdditionalData { return compute_normal_; } - //@} + ///@} /** @name Next iteration normal step computation flag */ - //@{ + ///@{ void set_next_compute_normal( bool next_compute_normal ) @@ -172,7 +172,7 @@ class InexactData: public IpoptAdditionalData { return next_compute_normal_; } - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -184,7 +184,7 @@ class InexactData: public IpoptAdditionalData * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ InexactData( const InexactData& @@ -194,19 +194,19 @@ class InexactData: public IpoptAdditionalData void operator=( const InexactData& ); - //@} + ///@} /** @name Normal step */ - //@{ + ///@{ SmartPtr normal_x_; SmartPtr normal_s_; - //@} + ///@} /** @name Tangential step */ - //@{ + ///@{ SmartPtr tangential_x_; SmartPtr tangential_s_; - //@} + ///@} /** Flag indicating if most recent step has been fully accepted */ bool full_step_accepted_; diff --git a/src/Algorithm/Inexact/IpInexactDoglegNormal.cpp b/src/Algorithm/Inexact/IpInexactDoglegNormal.cpp index 14f7f3b82..ab3a17a73 100644 --- a/src/Algorithm/Inexact/IpInexactDoglegNormal.cpp +++ b/src/Algorithm/Inexact/IpInexactDoglegNormal.cpp @@ -233,7 +233,7 @@ bool InexactDoglegNormalStep::ComputeNormalStep( Number a = v_newton_norm * v_newton_norm - 2 * v_cs_dot_n + v_cauchy_norm * v_cauchy_norm; Number b = 2 * (v_cs_dot_n - v_newton_norm * v_newton_norm); Number c = v_newton_norm * v_newton_norm - tr_radius * tr_radius; - Number lambda = (-b - sqrt(b * b - 4. * a * c)) / (2. * a); + Number lambda = (-b - std::sqrt(b * b - 4. * a * c)) / (2. * a); DBG_PRINT((1, "v_cauchy_norm = %e v_cs_dot_n = %e v_newton_norm = %e\n", v_cauchy_norm, v_cs_dot_n, v_newton_norm)); diff --git a/src/Algorithm/Inexact/IpInexactDoglegNormal.hpp b/src/Algorithm/Inexact/IpInexactDoglegNormal.hpp index 996917dd1..32d4127f5 100644 --- a/src/Algorithm/Inexact/IpInexactDoglegNormal.hpp +++ b/src/Algorithm/Inexact/IpInexactDoglegNormal.hpp @@ -19,7 +19,7 @@ class InexactDoglegNormalStep: public InexactNormalStepCalculator { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ InexactDoglegNormalStep( SmartPtr newton_step, @@ -28,7 +28,7 @@ class InexactDoglegNormalStep: public InexactNormalStepCalculator /** Destructor */ virtual ~InexactDoglegNormalStep(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -61,7 +61,7 @@ class InexactDoglegNormalStep: public InexactNormalStepCalculator * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ InexactDoglegNormalStep(); @@ -74,7 +74,7 @@ class InexactDoglegNormalStep: public InexactNormalStepCalculator void operator=( const InexactDoglegNormalStep& ); - //@} + ///@} /** Pointer to object for computing the "Newton" step in the dogleg * method @@ -91,9 +91,9 @@ class InexactDoglegNormalStep: public InexactNormalStepCalculator SmartPtr normal_tester_; /** @name Algorithmic options */ - //@{ + ///@{ Number omega_max_; - //@} + ///@} /** Current value of the trust region factor */ Number curr_omega_; diff --git a/src/Algorithm/Inexact/IpInexactLSAcceptor.cpp b/src/Algorithm/Inexact/IpInexactLSAcceptor.cpp index 842a56647..336ebf469 100644 --- a/src/Algorithm/Inexact/IpInexactLSAcceptor.cpp +++ b/src/Algorithm/Inexact/IpInexactLSAcceptor.cpp @@ -37,12 +37,10 @@ void InexactLSAcceptor::RegisterOptions( "nu_update_inf_skip_tol", "Lower bound on infeasibility to perform penalty parameter update.", 0.0, true, 1e-9, "If the current infeasibility is less than this value, the penalty parameter update is skipped"); - roptions->AddStringOption2( + roptions->AddBoolOption( "flexible_penalty_function", "Switch to use Curtis/Nocedal flexible penalty function", - "yes", - "no", "do not use the flexible penalty function procedure", - "yes", "use the flexible penalty function procedure", + true, "This determines if the flexible penalty function procedure by Curtis/Nocedal should be used in the line search. " "For now, this only is implemented for the inexact algorithm."); roptions->AddLowerBoundedNumberOption( @@ -144,16 +142,16 @@ void InexactLSAcceptor::InitThisLineSearch( bool compute_normal = InexData().compute_normal(); Number Upsilon = -1.; - Number Nu = -1.; if( !compute_normal ) { + Number Nu; #if 0 // Compute Nu = ||A*u||^2/||A||^2 SmartPtr curr_Au_c = IpCq().curr_jac_c_times_vec(*tangential_x); SmartPtr curr_Au_d = delta_s->MakeNew(); curr_Au_d->AddTwoVectors(1., *IpCq().curr_jac_d_times_vec(*tangential_x), -1., *tangential_s, 0.); Number Nu = IpCq().CalcNormOfType(NORM_2, *curr_Au_c, *curr_Au_d); - Nu = pow(Nu, 2); + Nu = std::pow(Nu, 2); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "nu update: ||A*u||^2 = %23.16e\n", Nu); Number A_norm2 = InexCq().curr_scaled_A_norm2(); @@ -201,7 +199,7 @@ void InexactLSAcceptor::InitThisLineSearch( else { DBG_PRINT((1, "uWu=%e scaled_tangential_norm=%e\n", uWu, scaled_tangential_norm )); - numerator = (gradBarrTDelta + Max(0.5 * uWu, tcc_theta_ * pow(scaled_tangential_norm, 2))); + numerator = (gradBarrTDelta + Max(0.5 * uWu, tcc_theta_ * std::pow(scaled_tangential_norm, 2))); denominator = (1 - rho_) * (reference_theta_ - norm_cplusAd); } const Number nu_trial = numerator / denominator; @@ -216,8 +214,8 @@ void InexactLSAcceptor::InitThisLineSearch( else { Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, - "In penalty parameter update formula:\n gradBarrTDelta = %e 0.5*uWu = %e tcc_theta_*pow(scaled_tangential_norm,2) = %e numerator = %e\n reference_theta_ = %e norm_cplusAd + %e denominator = %e nu_trial = %e\n", - gradBarrTDelta, 0.5 * uWu, tcc_theta_ * pow(scaled_tangential_norm, 2), numerator, reference_theta_, + "In penalty parameter update formula:\n gradBarrTDelta = %e 0.5*uWu = %e tcc_theta_*std::pow(scaled_tangential_norm,2) = %e numerator = %e\n reference_theta_ = %e norm_cplusAd + %e denominator = %e nu_trial = %e\n", + gradBarrTDelta, 0.5 * uWu, tcc_theta_ * std::pow(scaled_tangential_norm, 2), numerator, reference_theta_, norm_cplusAd, denominator, nu_trial); } @@ -429,9 +427,9 @@ void InexactLSAcceptor::Reset() } bool InexactLSAcceptor::TrySecondOrderCorrection( - Number alpha_primal_test, - Number& alpha_primal, - SmartPtr& actual_delta + Number /*alpha_primal_test*/, + Number& /*alpha_primal*/, + SmartPtr& /*actual_delta*/ ) { DBG_START_METH("InexactLSAcceptor::TrySecondOrderCorrection", @@ -440,9 +438,9 @@ bool InexactLSAcceptor::TrySecondOrderCorrection( } bool InexactLSAcceptor::TryCorrector( - Number alpha_primal_test, - Number& alpha_primal, - SmartPtr& actual_delta + Number /*alpha_primal_test*/, + Number& /*alpha_primal*/, + SmartPtr& /*actual_delta*/ ) { return false; @@ -515,14 +513,15 @@ void InexactLSAcceptor::PrepareRestoPhaseStart() } bool InexactLSAcceptor::IsAcceptableToCurrentIterate( - Number trial_barr, - Number trial_theta, - bool called_from_restoration /*=false*/ + Number /*trial_barr*/, + Number /*trial_theta*/, + bool /*called_from_restoration*/ /*=false*/ ) const { DBG_START_METH("InexactLSAcceptor::IsAcceptableToCurrentIterate", dbg_verbosity); THROW_EXCEPTION(INTERNAL_ABORT, "InexactLSAcceptor::IsAcceptableToCurrentIterate called"); +#if 0 ASSERT_EXCEPTION(resto_pred_ <= 0., INTERNAL_ABORT, "resto_pred_ not set for check from restoration phase."); Number ared = reference_barr_ + nu_ * (reference_theta_) - (trial_barr + nu_ * trial_theta); @@ -543,11 +542,12 @@ bool InexactLSAcceptor::IsAcceptableToCurrentIterate( accept = false; } return accept; +#endif } Number InexactLSAcceptor::ComputeAlphaForY( Number alpha_primal, - Number alpha_dual, + Number /*alpha_dual*/, SmartPtr& delta ) { @@ -577,9 +577,9 @@ Number InexactLSAcceptor::ComputeAlphaForY( Sdy->ElementWiseMultiply(*curr_scaling_slacks); // using the magic formula in my notebook - Number a = pow(Jxy->Nrm2(), 2) + pow(Sdy->Nrm2(), 2); + Number a = std::pow(Jxy->Nrm2(), 2) + std::pow(Sdy->Nrm2(), 2); Number b = 2 * (gx->Dot(*Jxy) - gs->Dot(*Sdy)); - Number c = pow(gx->Nrm2(), 2) + pow(gs->Nrm2(), 2); + Number c = std::pow(gx->Nrm2(), 2) + std::pow(gs->Nrm2(), 2); // First we check if the primal step size is good enough: Number val_ap = alpha_primal * alpha_primal * a + alpha_primal * b + c; diff --git a/src/Algorithm/Inexact/IpInexactLSAcceptor.hpp b/src/Algorithm/Inexact/IpInexactLSAcceptor.hpp index 34a3a4cd0..5879ff0c4 100644 --- a/src/Algorithm/Inexact/IpInexactLSAcceptor.hpp +++ b/src/Algorithm/Inexact/IpInexactLSAcceptor.hpp @@ -21,7 +21,7 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * The PDSystemSolver object only needs to be @@ -32,7 +32,7 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor /** Destructor */ virtual ~InexactLSAcceptor(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -128,14 +128,14 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor * acceptability criteria and used externally (by the restoration phase * convergence check object, for instance) */ - //@{ + ///@{ /** Checks if a trial point is acceptable to the current iterate */ bool IsAcceptableToCurrentIterate( Number trial_barr, Number trial_theta, bool called_from_restoration = false ) const; - //@} + ///@} /** Method for updating the equality constraint multipliers */ virtual Number ComputeAlphaForY( @@ -153,11 +153,11 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor } /** Methods for OptionsList */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} protected: /** Method to easily access Inexact data */ @@ -186,7 +186,7 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ InexactLSAcceptor( const InexactLSAcceptor& @@ -196,7 +196,7 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor void operator=( const InexactLSAcceptor& ); - //@} + ///@} /** Compute predicted reduction for given step size */ Number CalcPred( @@ -210,7 +210,7 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor void ResetSlacks(); /** @name Parameters for the penalty function algorithm. */ - //@{ + ///@{ /** Initial value of penalty parameter */ Number nu_init_; /** Initial value of lower penalty parameter */ @@ -230,10 +230,10 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor /** Flag indicating whether the Curtis/Nocedal flexible penalty * function should be used */ bool flexible_penalty_function_; - //@} + ///@} /** @name Information related to watchdog procedure */ - //@{ + ///@{ /** Constraint violation at the point with respect to which * progress is to be made */ Number reference_theta_; @@ -249,10 +249,10 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor Number watchdog_barr_; /** Predicted reduction to be compared with in watch dog. */ Number watchdog_pred_; - //@} + ///@} /** @name Penalty parameter */ - //@{ + ///@{ /** Current value of the penalty parameter */ Number nu_; /** Value of penalty parameter at beginning of the iteration. */ @@ -265,7 +265,7 @@ class InexactLSAcceptor: public BacktrackingLSAcceptor Number inexact_decomposition_activate_tol_; /** Step size threshold for inactivating step decomposition */ Number inexact_decomposition_inactivate_tol_; - //@} + ///@} /** Flag indicating if this is a termination test 2 iteration in * which we just update the multipliers and skip the line diff --git a/src/Algorithm/Inexact/IpInexactNewtonNormal.cpp b/src/Algorithm/Inexact/IpInexactNewtonNormal.cpp index 83622fd3b..b656751aa 100644 --- a/src/Algorithm/Inexact/IpInexactNewtonNormal.cpp +++ b/src/Algorithm/Inexact/IpInexactNewtonNormal.cpp @@ -24,7 +24,7 @@ InexactNewtonNormalStep::~InexactNewtonNormalStep() { } void InexactNewtonNormalStep::RegisterOptions( - SmartPtr reg_options + SmartPtr /*reg_options*/ ) { } diff --git a/src/Algorithm/Inexact/IpInexactNewtonNormal.hpp b/src/Algorithm/Inexact/IpInexactNewtonNormal.hpp index 9c61cd8c3..b3635367d 100644 --- a/src/Algorithm/Inexact/IpInexactNewtonNormal.hpp +++ b/src/Algorithm/Inexact/IpInexactNewtonNormal.hpp @@ -20,7 +20,7 @@ class InexactNewtonNormalStep: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ InexactNewtonNormalStep( SmartPtr aug_solver @@ -28,7 +28,7 @@ class InexactNewtonNormalStep: public AlgorithmStrategyObject /** Destructor */ virtual ~InexactNewtonNormalStep(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -79,7 +79,7 @@ class InexactNewtonNormalStep: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ InexactNewtonNormalStep(); @@ -91,7 +91,7 @@ class InexactNewtonNormalStep: public AlgorithmStrategyObject void operator=( const InexactNewtonNormalStep& ); - //@} + ///@} /** Object to be used to solve the augmented system */ SmartPtr aug_solver_; diff --git a/src/Algorithm/Inexact/IpInexactNormalStepCalc.hpp b/src/Algorithm/Inexact/IpInexactNormalStepCalc.hpp index bc87966e3..38ceaf2dd 100644 --- a/src/Algorithm/Inexact/IpInexactNormalStepCalc.hpp +++ b/src/Algorithm/Inexact/IpInexactNormalStepCalc.hpp @@ -19,7 +19,7 @@ class InexactNormalStepCalculator: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ InexactNormalStepCalculator() { } @@ -27,7 +27,7 @@ class InexactNormalStepCalculator: public AlgorithmStrategyObject /** Destructor */ virtual ~InexactNormalStepCalculator() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -73,7 +73,7 @@ class InexactNormalStepCalculator: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ InexactNormalStepCalculator( const InexactNormalStepCalculator& @@ -83,7 +83,7 @@ class InexactNormalStepCalculator: public AlgorithmStrategyObject void operator=( const InexactNormalStepCalculator& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/Inexact/IpInexactNormalTerminationTester.cpp b/src/Algorithm/Inexact/IpInexactNormalTerminationTester.cpp index f43e27510..c3d4283a8 100644 --- a/src/Algorithm/Inexact/IpInexactNormalTerminationTester.cpp +++ b/src/Algorithm/Inexact/IpInexactNormalTerminationTester.cpp @@ -89,9 +89,9 @@ InexactNormalTerminationTester::ETerminationTest InexactNormalTerminationTester: ETerminationTest retval = CONTINUE; - double norm2_resid = IpBlasDnrm2(ndim, resid, 1); + Number norm2_resid = IpBlasNrm2(ndim, resid, 1); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "TTNormal: iter = %d ||resid|| = %23.16e ||rhs|| = %23.16e\n", iter, norm2_resid, norm2_rhs); + "TTNormal: iter = %" IPOPT_INDEX_FORMAT " ||resid|| = %23.16e ||rhs|| = %23.16e\n", iter, norm2_resid, norm2_rhs); if( iter > inexact_normal_max_iter_ ) { diff --git a/src/Algorithm/Inexact/IpInexactNormalTerminationTester.hpp b/src/Algorithm/Inexact/IpInexactNormalTerminationTester.hpp index 42694c829..2c5781fbd 100644 --- a/src/Algorithm/Inexact/IpInexactNormalTerminationTester.hpp +++ b/src/Algorithm/Inexact/IpInexactNormalTerminationTester.hpp @@ -19,13 +19,13 @@ class InexactNormalTerminationTester: public IterativeSolverTerminationTester { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Default Constructor */ InexactNormalTerminationTester(); /** Destructor */ virtual ~InexactNormalTerminationTester(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -94,22 +94,22 @@ class InexactNormalTerminationTester: public IterativeSolverTerminationTester * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Overloaded Assignment Operator */ InexactNormalTerminationTester& operator=( const InexactNormalTerminationTester& ); - //@} + ///@} /** @name Algorithmic options */ - //@{ + ///@{ /** Desired reduction of residual */ Number inexact_normal_tol_; /** Maximal number of iterative solve iterations */ Index inexact_normal_max_iter_; /** Is set to true if the linear system is scaled via slacks. */ bool requires_scaling_; - //@} + ///@} /** Value of normal problem objective function achived by the * Cauchy step. diff --git a/src/Algorithm/Inexact/IpInexactPDSolver.cpp b/src/Algorithm/Inexact/IpInexactPDSolver.cpp index e496854ad..f7fd2f682 100644 --- a/src/Algorithm/Inexact/IpInexactPDSolver.cpp +++ b/src/Algorithm/Inexact/IpInexactPDSolver.cpp @@ -101,8 +101,8 @@ bool InexactPDSolver::Solve( DBG_PRINT_VECTOR(2, "sol_vU in", *sol.v_U()); // Receive data about matrix - SmartPtr x = IpData().curr()->x(); - SmartPtr s = IpData().curr()->s(); +// SmartPtr x = IpData().curr()->x(); +// SmartPtr s = IpData().curr()->s(); SmartPtr W = IpData().W(); SmartPtr J_c = IpCq().curr_jac_c(); SmartPtr J_d = IpCq().curr_jac_d(); @@ -262,7 +262,7 @@ bool InexactPDSolver::Solve( else { char buf[32]; - Snprintf(buf, 31, " TT=%d ", test_result_); + Snprintf(buf, 31, " TT=%d", test_result_); IpData().Append_info_string(buf); if( test_result_ == IterativeSolverTerminationTester::CONTINUE ) { @@ -303,7 +303,7 @@ bool InexactPDSolver::Solve( // Some output Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of trial factorizations performed: %d\n", count); + "Number of trial factorizations performed: %" IPOPT_INDEX_FORMAT "\n", count); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Final perturbation parameters: delta_x=%e delta_s=%e\n delta_c=%e delta_d=%e\n", delta_x, delta_s, delta_c, delta_d); @@ -342,7 +342,7 @@ void InexactPDSolver::ComputeResiduals( const Vector& v_U, const Vector& slack_s_L, const Vector& slack_s_U, - const Vector& sigma_s, + const Vector& /*sigma_s*/, const IteratesVector& rhs, const IteratesVector& res, IteratesVector& resid @@ -444,7 +444,7 @@ bool InexactPDSolver::HessianRequiresChange() Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TT: u_norm_scaled = %23.16e\n", u_norm_scaled); - Number Upsilon; + Number Upsilon = 0.; Number Nu; Number v_norm_scaled = -1.; if( compute_normal ) @@ -471,7 +471,7 @@ bool InexactPDSolver::HessianRequiresChange() if( !compute_normal ) { lhs = Upsilon; - rhs = pow(tcc_psi_, 2) * Nu; + rhs = std::pow(tcc_psi_, 2) * Nu; Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TCC1 testing Upsilon(=%23.16e) <= (tcc_psi_^2)*Nu(=%23.16e) --> ", lhs, rhs); } @@ -506,14 +506,14 @@ bool InexactPDSolver::HessianRequiresChange() rhs = 0.5 * uWu; if( !compute_normal ) { - lhs = tcc_theta_ * pow(mu, tcc_theta_mu_exponent_) * Upsilon; + lhs = tcc_theta_ * std::pow(mu, tcc_theta_mu_exponent_) * Upsilon; Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TCC2a testing 0.5*uWu(=%23.16e) >= tcc_theta_*pow(mu,tcc_theta_mu_exponent_)*Upsilon(=%23.16e) -->", rhs, lhs); } else { - lhs = tcc_theta_ * pow(mu, tcc_theta_mu_exponent_) * pow(u_norm_scaled, 2); + lhs = tcc_theta_ * std::pow(mu, tcc_theta_mu_exponent_) * std::pow(u_norm_scaled, 2); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TCC2a testing 0.5*uWu(=%23.16e) >= tcc_theta_*pow(mu,tcc_theta_mu_exponent_)*u_norm^2(=%23.16e) -->", rhs, lhs); diff --git a/src/Algorithm/Inexact/IpInexactPDSolver.hpp b/src/Algorithm/Inexact/IpInexactPDSolver.hpp index a0cc2e2d3..b287bcac5 100644 --- a/src/Algorithm/Inexact/IpInexactPDSolver.hpp +++ b/src/Algorithm/Inexact/IpInexactPDSolver.hpp @@ -24,7 +24,7 @@ class InexactPDSolver: public AlgorithmStrategyObject { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor that takes in the Augmented System solver that * is to be used inside */ @@ -35,7 +35,7 @@ class InexactPDSolver: public AlgorithmStrategyObject /** Destructor */ virtual ~InexactPDSolver(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -63,14 +63,14 @@ class InexactPDSolver: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ InexactPDSolver(); /** Overloaded Assignment Operator */ InexactPDSolver& operator=( const InexactPDSolver& ); - //@} + ///@} /** Method to easily access Inexact data */ InexactData& InexData() @@ -89,12 +89,12 @@ class InexactPDSolver: public AlgorithmStrategyObject } /** @name Strategy objects to hold on to. */ - //@{ + ///@{ /** Pointer to the Solver for the augmented system */ SmartPtr augSysSolver_; /** Pointer to the Perturbation Handler. */ SmartPtr perturbHandler_; - //@} + ///@} /** Internal function for computing the residual (resid) given the * right hand side (rhs) and the solution of the system (res). @@ -123,7 +123,7 @@ class InexactPDSolver: public AlgorithmStrategyObject bool HessianRequiresChange(); /** @name Algorithmic options */ - //@{ + ///@{ /** Psi factor in the tangential component condition */ Number tcc_psi_; /** theta factor in the tangential component condition */ @@ -139,7 +139,7 @@ class InexactPDSolver: public AlgorithmStrategyObject * modification. */ Index inexact_regularization_ls_count_trigger_; - //@} + ///@} /** flag indicating if we are dealing with the Pardiso solver * (temporary) diff --git a/src/Algorithm/Inexact/IpInexactPDTerminationTester.cpp b/src/Algorithm/Inexact/IpInexactPDTerminationTester.cpp index 2dd996072..209d5efdf 100644 --- a/src/Algorithm/Inexact/IpInexactPDTerminationTester.cpp +++ b/src/Algorithm/Inexact/IpInexactPDTerminationTester.cpp @@ -193,14 +193,14 @@ bool InexactPDTerminationTester::InitializeSolve() curr_Av_norm_ = IpCq().CalcNormOfType(NORM_2, *curr_Av_c_, *curr_Av_d_); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TT: curr_Av_norm_ = %23.16e\n", curr_Av_norm_); - curr_tt1_norm_ = sqrt(pow(curr_tt2_norm_, 2) + pow(curr_Av_norm_, 2)); + curr_tt1_norm_ = std::sqrt(std::pow(curr_tt2_norm_, 2) + std::pow(curr_Av_norm_, 2)); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TT: curr_tt1_norm_ = %23.16e\n", curr_tt1_norm_); } else { curr_Av_norm_ = -1.; - curr_tt1_norm_ = sqrt(pow(curr_tt2_norm_, 2) + pow(c_norm_, 2)); + curr_tt1_norm_ = std::sqrt(std::pow(curr_tt2_norm_, 2) + std::pow(c_norm_, 2)); } if( compute_normal && IsValid(last_grad_barrier_obj_x) ) @@ -213,7 +213,7 @@ bool InexactPDTerminationTester::InitializeSolve() last_nabla_phi_plus_ATy_s->AddTwoVectors(1., *last_grad_barrier_obj_s, -1., *IpData().curr()->y_d(), 0.); last_nabla_phi_plus_ATy_s->ElementWiseMultiply(*last_scaling_slacks); last_tt1_norm_ = IpCq().CalcNormOfType(NORM_2, *last_nabla_phi_plus_ATy_x, *last_nabla_phi_plus_ATy_s); - last_tt1_norm_ = sqrt(pow(last_tt1_norm_, 2) + pow(last_Av_norm_, 2)); + last_tt1_norm_ = std::sqrt(std::pow(last_tt1_norm_, 2) + std::pow(last_Av_norm_, 2)); } else { @@ -251,15 +251,15 @@ InexactPDTerminationTester::ETerminationTest InexactPDTerminationTester::TestTer ETerminationTest retval = CONTINUE; Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Starting PD Termination Tester for iteration %d.\n", iter); + "Starting PD Termination Tester for iteration %" IPOPT_INDEX_FORMAT ".\n", iter); /* if (iter%5 != 4) { Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "TT: immediately leaving tester for iteration %d.\n", iter); + "TT: immediately leaving tester for iteration %" IPOPT_INDEX_FORMAT ".\n", iter); return retval; } */ - Number norm2_resid = IpBlasDnrm2(ndim, resid, 1); + Number norm2_resid = IpBlasNrm2(ndim, resid, 1); Number test_ratio = norm2_resid / norm2_rhs; // Min(norm2_resid/norm2_rhs, norm2_resid); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TT: test ratio %e (norm2_rhs = %e norm2_resid = %e).\n", @@ -376,7 +376,7 @@ InexactPDTerminationTester::ETerminationTest InexactPDTerminationTester::TestTer SmartPtr curr_Au_d = sol_s->MakeNew(); curr_Au_d->AddTwoVectors(1., *IpCq().curr_jac_d_times_vec(*tangential_x), -1., *tangential_s, 0.); Number Nu = IpCq().CalcNormOfType(NORM_2, *curr_Au_c, *curr_Au_d); - Nu = pow(Nu, 2); + Nu = std::pow(Nu, 2); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TT: ||A*u||^2 = %23.16e\n", Nu); Number A_norm2 = InexCq().curr_scaled_A_norm2(); @@ -402,7 +402,7 @@ InexactPDTerminationTester::ETerminationTest InexactPDTerminationTester::TestTer if( !compute_normal ) { lhs = Upsilon; - rhs = pow(tcc_psi_, 2) * Nu; + rhs = std::pow(tcc_psi_, 2) * Nu; Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TCC1 testing Upsilon(=%23.16e) <= (tcc_psi_^2)*Nu(=%23.16e) --> ", lhs, rhs); } @@ -430,14 +430,14 @@ InexactPDTerminationTester::ETerminationTest InexactPDTerminationTester::TestTer rhs = 0.5 * uWu; if( !compute_normal ) { - lhs = tcc_theta_ * pow(mu, tcc_theta_mu_exponent_) * Upsilon; + lhs = tcc_theta_ * std::pow(mu, tcc_theta_mu_exponent_) * Upsilon; Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TCC2a testing 0.5*uWu(=%23.16e) >= tcc_theta_*pow(mu,tcc_theta_mu_exponent_)*Upsilon(=%23.16e) -->", rhs, lhs); } else { - lhs = tcc_theta_ * pow(mu, tcc_theta_mu_exponent_) * pow(u_norm_scaled, 2); + lhs = tcc_theta_ * std::pow(mu, tcc_theta_mu_exponent_) * std::pow(u_norm_scaled, 2); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "TCC2a testing 0.5*uWu(=%23.16e) >= tcc_theta_*pow(mu,tcc_theta_mu_exponent_)*u_norm^2(=%23.16e) -->", rhs, lhs); @@ -504,7 +504,7 @@ InexactPDTerminationTester::ETerminationTest InexactPDTerminationTester::TestTer // decomposition. In that case, c_plus_Ad_norm should indeed be // the same as what resid_c and resid_d woulod give (TODO: // check?!?) - Number resid_norm = sqrt(pow(rho_norm, 2) + pow(c_plus_Ad_norm, 2)); + Number resid_norm = std::sqrt(std::pow(rho_norm, 2) + std::pow(c_plus_Ad_norm, 2)); lhs = resid_norm; rhs = tt_kappa1_ * curr_tt1_norm_; Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, @@ -532,6 +532,8 @@ InexactPDTerminationTester::ETerminationTest InexactPDTerminationTester::TestTer } // Check termination test 1, model reduction condition + // cppcheck-suppress variableScope + // cppcheck-suppress unreadVariable bool model_reduction = false; if( !compute_normal || tt1 ) { @@ -570,7 +572,7 @@ InexactPDTerminationTester::ETerminationTest InexactPDTerminationTester::TestTer } else { - lhs = Max(0.5 * uWu, tcc_theta_ * pow(u_norm_scaled, 2)) + sigma * curr_nu * (c_norm_ - c_plus_Av_norm_); + lhs = Max(0.5 * uWu, tcc_theta_ * std::pow(u_norm_scaled, 2)) + sigma * curr_nu * (c_norm_ - c_plus_Av_norm_); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "MRC testing delta_m(=%23.16e) >= max(0.5*uWu,tcc_theta_*u_norm^2) + sigma*nu*(c_norm_ - c_plus_Av_norm_)(=%23.16e) -->", rhs, lhs); diff --git a/src/Algorithm/Inexact/IpInexactPDTerminationTester.hpp b/src/Algorithm/Inexact/IpInexactPDTerminationTester.hpp index adf45dae9..59d4986ff 100644 --- a/src/Algorithm/Inexact/IpInexactPDTerminationTester.hpp +++ b/src/Algorithm/Inexact/IpInexactPDTerminationTester.hpp @@ -19,14 +19,14 @@ class InexactPDTerminationTester: public IterativeSolverTerminationTester { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Default constructor */ InexactPDTerminationTester(); /** Destructor */ virtual ~InexactPDTerminationTester(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -83,15 +83,15 @@ class InexactPDTerminationTester: public IterativeSolverTerminationTester * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Overloaded Assignment Operator */ InexactPDTerminationTester& operator=( const InexactPDTerminationTester& ); - //@} + ///@} /** @name Algorithmic options */ - //@{ + ///@{ /** Psi factor in the tangential component condition */ Number tcc_psi_; /** theta factor in the tangential component condition */ @@ -121,12 +121,12 @@ class InexactPDTerminationTester: public IterativeSolverTerminationTester Index inexact_desired_pd_residual_iter_; /** Is set to true if the linear system is scaled via slacks. */ bool requires_scaling_; - //@} + ///@} /** @name Quantities that are identical for all tests and can be * precomputed. */ - //@{ + ///@{ SmartPtr curr_Av_c_; SmartPtr curr_Av_d_; Number c_norm_; @@ -145,13 +145,13 @@ class InexactPDTerminationTester: public IterativeSolverTerminationTester SmartPtr curr_Wv_x_; SmartPtr curr_Wv_s_; // in original space bool try_tt2_; - //@} + ///@} /** @name Quantities from previous iteration required in the tests */ - //@{ + ///@{ Number last_Av_norm_; Number last_tt1_norm_; - //@} + ///@} /** Last iterative solver iteration counter */ Index last_iter_; diff --git a/src/Algorithm/Inexact/IpInexactSearchDirCalc.hpp b/src/Algorithm/Inexact/IpInexactSearchDirCalc.hpp index bae6f21cb..a622d4044 100644 --- a/src/Algorithm/Inexact/IpInexactSearchDirCalc.hpp +++ b/src/Algorithm/Inexact/IpInexactSearchDirCalc.hpp @@ -24,7 +24,7 @@ class InexactSearchDirCalculator: public SearchDirectionCalculator { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ InexactSearchDirCalculator( SmartPtr normal_step_calculator, @@ -33,7 +33,7 @@ class InexactSearchDirCalculator: public SearchDirectionCalculator /** Destructor */ virtual ~InexactSearchDirCalculator(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -63,7 +63,7 @@ class InexactSearchDirCalculator: public SearchDirectionCalculator * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ InexactSearchDirCalculator(); @@ -76,7 +76,7 @@ class InexactSearchDirCalculator: public SearchDirectionCalculator void operator=( const InexactSearchDirCalculator& ); - //@} + ///@} /** Method to easily access Inexact data */ InexactData& InexData() @@ -95,16 +95,16 @@ class InexactSearchDirCalculator: public SearchDirectionCalculator } /** @name Algorithmic options */ - //@{ + ///@{ /** termination tolerance for local infeasibility */ Number local_inf_Ac_tol_; - //@} + ///@} /** @name Strategy objects */ - //@{ + ///@{ SmartPtr normal_step_calculator_; SmartPtr inexact_pd_solver_; - //@} + ///@} /** enumeration for decomposition options */ enum DecompositionTypeEnum diff --git a/src/Algorithm/Inexact/IpInexactTSymScalingMethod.cpp b/src/Algorithm/Inexact/IpInexactTSymScalingMethod.cpp index 1e0b36958..127f5b4ef 100644 --- a/src/Algorithm/Inexact/IpInexactTSymScalingMethod.cpp +++ b/src/Algorithm/Inexact/IpInexactTSymScalingMethod.cpp @@ -16,20 +16,20 @@ static const Index dbg_verbosity = 0; #endif bool InexactTSymScalingMethod::InitializeImpl( - const OptionsList& options, - const std::string& prefix + const OptionsList& /*options*/, + const std::string& /*prefix*/ ) { return true; } bool InexactTSymScalingMethod::ComputeSymTScalingFactors( - Index n, - Index nnz, - const ipfint* airn, - const ipfint* ajcn, - const double* a, - double* scaling_factors + Index /*n*/, + Index /*nnz*/, + const Index* /*airn*/, + const Index* /*ajcn*/, + const Number* /*a*/, + Number* scaling_factors ) { DBG_START_METH("InexactTSymScalingMethod::ComputeTSymScalingFactors", diff --git a/src/Algorithm/Inexact/IpInexactTSymScalingMethod.hpp b/src/Algorithm/Inexact/IpInexactTSymScalingMethod.hpp index 8703e621c..f55b7242e 100644 --- a/src/Algorithm/Inexact/IpInexactTSymScalingMethod.hpp +++ b/src/Algorithm/Inexact/IpInexactTSymScalingMethod.hpp @@ -23,13 +23,13 @@ class InexactTSymScalingMethod: public TSymScalingMethod { public: /** @name Constructor/Destructor */ - //@{ + ///@{ InexactTSymScalingMethod() { } virtual ~InexactTSymScalingMethod() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -42,10 +42,10 @@ class InexactTSymScalingMethod: public TSymScalingMethod virtual bool ComputeSymTScalingFactors( Index n, Index nnz, - const ipfint* airn, - const ipfint* ajcn, - const double* a, - double* scaling_factors + const Index* airn, + const Index* ajcn, + const Number* a, + Number* scaling_factors ); private: @@ -57,7 +57,7 @@ class InexactTSymScalingMethod: public TSymScalingMethod * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ InexactTSymScalingMethod( const InexactTSymScalingMethod& diff --git a/src/Algorithm/Inexact/IpIterativePardisoSolverInterface.cpp b/src/Algorithm/Inexact/IpIterativePardisoSolverInterface.cpp index 85521aa21..c2198704a 100644 --- a/src/Algorithm/Inexact/IpIterativePardisoSolverInterface.cpp +++ b/src/Algorithm/Inexact/IpIterativePardisoSolverInterface.cpp @@ -9,17 +9,13 @@ #include "IpoptConfig.h" #include "IpIterativePardisoSolverInterface.hpp" #include "IpBlas.hpp" -# include -#include +#include #include #include - -// determine the correct name of the Pardiso function -#ifndef IPOPT_HAS_PARDISO -// if we build for the Linear Solver loader, then use normal C-naming style -# define IPOPT_PARDISO_FUNC(name,NAME) name -#endif +#include +#include +#include Ipopt::IterativeSolverTerminationTester* global_tester_ptr_; Ipopt::IterativeSolverTerminationTester::ETerminationTest test_result_; @@ -27,11 +23,11 @@ Ipopt::IterativeSolverTerminationTester::ETerminationTest test_result_; extern "C" { int IpoptTerminationTest( - int n, - double* sol, - double* resid, - int iter, - double norm2_rhs + int n, + ipnumber* sol, + ipnumber* resid, + int iter, + ipnumber norm2_rhs ) { fflush(stdout); @@ -50,49 +46,6 @@ extern "C" break; } } - -// The following global function pointer is defined in the Pardiso library - void SetIpoptCallbackFunction( - int (*IpoptFunction)( - int n, - double* x, - double* r, - int k, - double b) - ); -} - -/** Prototypes for Pardiso's subroutines */ -extern "C" -{ - void IPOPT_PARDISO_FUNC(pardisoinit, PARDISOINIT) ( - void* PT, - const ipfint* MTYPE, - const ipfint* SOLVER, - ipfint* IPARM, - double* DPARM, - ipfint* ERROR - ); - - void IPOPT_PARDISO_FUNC(pardiso, PARDISO)( - void** PT, - const ipfint* MAXFCT, - const ipfint* MNUM, - const ipfint* MTYPE, - const ipfint* PHASE, - const ipfint* N, - const double* A, - const ipfint* IA, - const ipfint* JA, - const ipfint* PERM, - const ipfint* NRHS, - ipfint* IPARM, - const ipfint* MSGLVL, - double* B, - double* X, - ipfint* ERROR, - double* DPARM - ); } namespace Ipopt @@ -103,7 +56,8 @@ static const Index dbg_verbosity = 0; IterativePardisoSolverInterface::IterativePardisoSolverInterface( IterativeSolverTerminationTester& normal_tester, - IterativeSolverTerminationTester& pd_tester + IterativeSolverTerminationTester& pd_tester, + SmartPtr pardisoloader_ ) : a_(NULL), negevals_(-1), @@ -114,14 +68,19 @@ IterativePardisoSolverInterface::IterativePardisoSolverInterface( MTYPE_(-2), MSGLVL_(0), debug_last_iter_(-1), + pardisoloader(pardisoloader_), + pardisoinit(NULL), + pardiso(NULL), + SetIpoptCallbackFunction(NULL), + pardiso_exist_parallel(false), normal_tester_(&normal_tester), pd_tester_(&pd_tester) { DBG_START_METH("IterativePardisoSolverInterface::IterativePardisoSolverInterface()", dbg_verbosity); PT_ = new void* [64]; - IPARM_ = new ipfint[64]; - DPARM_ = new double[64]; + IPARM_ = new Index[64]; + DPARM_ = new Number[64]; } IterativePardisoSolverInterface::~IterativePardisoSolverInterface() @@ -132,14 +91,14 @@ IterativePardisoSolverInterface::~IterativePardisoSolverInterface() // Tell Pardiso to release all memory if( initialized_ ) { - ipfint PHASE = -1; - ipfint N = dim_; - ipfint NRHS = 0; - ipfint ERROR; - ipfint idmy; - double ddmy; - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, - &MSGLVL_, &ddmy, &ddmy, &ERROR, DPARM_); + Index PHASE = -1; + Index N = dim_; + Index NRHS = 0; + Index ERROR; + Index idmy; + Number ddmy; + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, + &MSGLVL_, &ddmy, &ddmy, &ERROR, DPARM_); DBG_ASSERT(ERROR == 0); } @@ -150,7 +109,7 @@ IterativePardisoSolverInterface::~IterativePardisoSolverInterface() } void IterativePardisoSolverInterface::RegisterOptions( - SmartPtr roptions + SmartPtr /* roptions */ ) { } @@ -159,9 +118,28 @@ bool IterativePardisoSolverInterface::InitializeImpl( const std::string& prefix ) { -#ifdef IPOPT_HAS_PARDISO_MKL - THROW_EXCEPTION(OPTION_INVALID, "The inexact version works only with Pardiso from pardiso-project.org"); -#endif + DBG_ASSERT(IsValid(pardisoloader)); + + pardisoinit = (IPOPT_DECL_PARDISOINIT(*))pardisoloader->loadSymbol("pardisoinit"); + pardiso = (IPOPT_DECL_PARDISO(*))pardisoloader->loadSymbol("pardiso"); + SetIpoptCallbackFunction = (IPOPT_DECL_SETIPOPTCALLBACKFUNCTION(*))pardisoloader->loadSymbol("SetIpoptCallbackFunction"); + // load pardiso_ipopt_newinterface only as check that we get Pardiso >= 4.0.0 from pardiso-project + pardisoloader->loadSymbol("pardiso_ipopt_newinterface"); + // set pardiso_exist_parallel to true if symbol pardiso_exist_parallel exists in pardiso library + // ignore if symbol doesn't exist (pardiso_exist_parallel == false) + try + { + pardisoloader->loadSymbol("pardiso_exist_parallel"); + pardiso_exist_parallel = true; + } + catch( const DYNAMIC_LIBRARY_FAILURE& ) + { + DBG_ASSERT(!pardiso_exist_parallel); + } + + DBG_ASSERT(pardisoinit != NULL); + DBG_ASSERT(pardiso != NULL); + DBG_ASSERT(SetIpoptCallbackFunction != NULL); Index enum_int; options.GetEnumValue("pardiso_matching_strategy", enum_int, prefix); @@ -174,7 +152,7 @@ bool IterativePardisoSolverInterface::InitializeImpl( //options.GetIntegerValue("pardiso_out_of_core_power", // pardiso_out_of_core_power, prefix); options.GetBoolValue("pardiso_skip_inertia_check", skip_inertia_check_, prefix); - int max_iterref_steps; + Index max_iterref_steps; options.GetIntegerValue("pardiso_max_iterative_refinement_steps", max_iterref_steps, prefix); // PD system @@ -197,9 +175,9 @@ bool IterativePardisoSolverInterface::InitializeImpl( options.GetNumericValue("pardiso_iter_inverse_norm_factor", normal_pardiso_iter_inverse_norm_factor_, prefix + "normal."); - int pardiso_msglvl; + Index pardiso_msglvl; options.GetIntegerValue("pardiso_msglvl", pardiso_msglvl, prefix); - int order; + Index order; options.GetEnumValue("pardiso_order", order, prefix); options.GetIntegerValue("pardiso_max_droptol_corrections", pardiso_max_droptol_corrections_, prefix); @@ -208,14 +186,14 @@ bool IterativePardisoSolverInterface::InitializeImpl( // Tell Pardiso to release all memory if it had been used before if( initialized_ ) { - ipfint PHASE = -1; - ipfint N = dim_; - ipfint NRHS = 0; - ipfint ERROR; - ipfint idmy; - double ddmy; - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, - &MSGLVL_, &ddmy, &ddmy, &ERROR, DPARM_); + Index PHASE = -1; + Index N = dim_; + Index NRHS = 0; + Index ERROR; + Index idmy; + Number ddmy; + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, + &MSGLVL_, &ddmy, &ddmy, &ERROR, DPARM_); DBG_ASSERT(ERROR == 0); } @@ -229,44 +207,42 @@ bool IterativePardisoSolverInterface::InitializeImpl( // Call Pardiso's initialization routine IPARM_[0] = 0; // Tell it to fill IPARM with default values(?) - ipfint ERROR = 0; - ipfint SOLVER = 1; // initialze only direct solver - IPOPT_PARDISO_FUNC(pardisoinit, PARDISOINIT)(PT_, &MTYPE_, &SOLVER, IPARM_, DPARM_, &ERROR); + Index ERROR = 0; + Index SOLVER = 1; // initialze only direct solver + pardisoinit(PT_, &MTYPE_, &SOLVER, IPARM_, DPARM_, &ERROR); // Set some parameters for Pardiso IPARM_[0] = 1; // Don't use the default values -#if defined(IPOPT_HAS_PARDISO_PARALLEL) || ! defined(IPOPT_HAS_PARDISO) - // Obtain the numbers of processors from the value of OMP_NUM_THREADS - char* var = getenv("OMP_NUM_THREADS"); - int num_procs = 1; - if( var != NULL ) + if( pardiso_exist_parallel ) { - sscanf(var, "%d", &num_procs); - if( num_procs < 1 ) + // Obtain the numbers of processors from the value of OMP_NUM_THREADS + char* var = getenv("OMP_NUM_THREADS"); + int num_procs = 1; + if( var != NULL ) + { + sscanf(var, "%d", &num_procs); + if( num_procs < 1 ) + { + Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, + "Invalid value for OMP_NUM_THREADS (\"%s\").\n", var); + return false; + } + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Using environment OMP_NUM_THREADS = %" IPOPT_INDEX_FORMAT " as the number of processors.\n", num_procs); + } + else { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Invalid value for OMP_NUM_THREADS (\"%s\").\n", var); + "You need to set environment variable OMP_NUM_THREADS to the number of processors used in Pardiso (e.g., 1).\n\n"); return false; } - Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Using environment OMP_NUM_THREADS = %d as the number of processors.\n", num_procs); + IPARM_[2] = num_procs; // Set the number of processors } -#ifdef IPOPT_HAS_PARDISO - // If we run Pardiso through the linear solver loader, - // we do not know whether it is the parallel version, so we do not report an error if OMP_NUM_THREADS is not set. else { - Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "You need to set environment variable OMP_NUM_THREADS to the number of processors used in Pardiso (e.g., 1).\n\n"); - return false; + IPARM_[2] = 1; } -#endif - IPARM_[2] = num_procs; // Set the number of processors -#else - - IPARM_[2] = 1; -#endif IPARM_[1] = order; IPARM_[5] = 1; // Overwrite right-hand side @@ -280,12 +256,16 @@ bool IterativePardisoSolverInterface::InitializeImpl( // Matching information: IPARM_[12] = 2 robust, but more expensive method IPARM_[12] = (int) match_strat_; Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Pardiso matching strategy (IPARM(13)): %d\n", IPARM_[12]); + "Pardiso matching strategy (IPARM(13)): %" IPOPT_INDEX_FORMAT "\n", IPARM_[12]); IPARM_[20] = 3; // Results in better accuracy IPARM_[23] = 1; // parallel fac IPARM_[24] = 1; // parallel solve - IPARM_[28] = 0; // 32-bit factorization +#ifdef IPOPT_SINGLE + IPARM_[28] = 1; // 32-bit factorization (single precision) +#else + IPARM_[28] = 0; // 64-bit factorization (double precision) +#endif IPARM_[29] = 1; // we need this for IPOPT interface IPARM_[31] = 1; // iterative solver @@ -318,7 +298,7 @@ ESymSolverStatus IterativePardisoSolverInterface::MultiSolve( const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ) @@ -344,7 +324,7 @@ ESymSolverStatus IterativePardisoSolverInterface::MultiSolve( return Solve(ia, ja, nrhs, rhs_vals); } -double* IterativePardisoSolverInterface::GetValuesArrayPtr() +Number* IterativePardisoSolverInterface::GetValuesArrayPtr() { DBG_ASSERT(initialized_); DBG_ASSERT(a_); @@ -367,7 +347,7 @@ ESymSolverStatus IterativePardisoSolverInterface::InitializeStructure( // Make space for storing the matrix elements delete[] a_; a_ = NULL; - a_ = new double[nonzeros_]; + a_ = new Number[nonzeros_]; // Do the symbolic facotrization ESymSolverStatus retval = SymbolicFactorization(ia, ja); @@ -382,8 +362,8 @@ ESymSolverStatus IterativePardisoSolverInterface::InitializeStructure( } ESymSolverStatus IterativePardisoSolverInterface::SymbolicFactorization( - const Index* ia, - const Index* ja + const Index* /* ia */, + const Index* /* ja */ ) { DBG_START_METH("IterativePardisoSolverInterface::SymbolicFactorization", @@ -400,12 +380,13 @@ ESymSolverStatus IterativePardisoSolverInterface::SymbolicFactorization( return SYMSOLVER_SUCCESS; } -static void write_iajaa_matrix( - int N, +static +void write_iajaa_matrix( + Index N, const Index* ia, const Index* ja, - double* a_, - double* rhs_vals, + Number* a_, + Number* rhs_vals, int iter_cnt, int sol_cnt ) @@ -413,12 +394,11 @@ static void write_iajaa_matrix( if( getenv("IPOPT_WRITE_MAT") ) { /* Write header */ - FILE* mat_file; char mat_name[128]; char mat_pref[32]; - ipfint NNZ = ia[N] - 1; - ipfint i; + Index NNZ = ia[N] - 1; + Index i; if( getenv("IPOPT_WRITE_PREFIX") ) { @@ -432,33 +412,63 @@ static void write_iajaa_matrix( Snprintf(mat_name, 127, "%s_%03d-%02d.iajaa", mat_pref, iter_cnt, sol_cnt); // Open and write matrix file. - mat_file = fopen(mat_name, "w"); + std::ofstream mat_file(mat_name); + mat_file << std::setprecision(std::numeric_limits::digits10 + 1); - fprintf(mat_file, "%d\n", N); - fprintf(mat_file, "%d\n", NNZ); + mat_file << N << std::endl; + mat_file << NNZ << std::endl; for( i = 0; i < N + 1; i++ ) { - fprintf(mat_file, "%d\n", ia[i]); + mat_file << ia[i] << std::endl; } for( i = 0; i < NNZ; i++ ) { - fprintf(mat_file, "%d\n", ja[i]); + mat_file << ja[i] << std::endl; } for( i = 0; i < NNZ; i++ ) { - fprintf(mat_file, "%32.24e\n", a_[i]); + mat_file << a_[i] << std::endl; } /* Right hand side. */ if( rhs_vals ) for( i = 0; i < N; i++ ) - //FIXME: PUT BACK ORIGINAL: fprintf (mat_file, "%32.24e\n", rhs_vals[i]); { - fprintf(mat_file, "%32.24e\n", -rhs_vals[i]); + mat_file << rhs_vals[i] << std::endl; } + } + + /* additional matrix format */ + if( getenv("IPOPT_WRITE_MAT_MTX") ) + { + /* Write header */ + char mat_name[128]; + char mat_pref[32]; + + Index i; + Index j; + + if( getenv("IPOPT_WRITE_PREFIX") ) + { + strcpy(mat_pref, getenv("IPOPT_WRITE_PREFIX")); + } + else + { + strcpy(mat_pref, "mat-ipopt"); + } + + Snprintf(mat_name, 127, "%s_%03d-%02d.mtx", mat_pref, iter_cnt, sol_cnt); + + // Open and write matrix file. + std::ofstream mat_file(mat_name); + mat_file << std::setprecision(std::numeric_limits::digits10 + 1); - fclose(mat_file); + for( i = 0; i < N; i++ ) + for( j = ia[i]; j < ia[i + 1] - 1; j++ ) + { + mat_file << ' ' << i + 1 << ' ' << ja[j - 1] << ' ' << a_[j - 1] << std::endl; + } } } @@ -472,18 +482,18 @@ ESymSolverStatus IterativePardisoSolverInterface::Factorization( DBG_START_METH("IterativePardisoSolverInterface::Factorization", dbg_verbosity); // Call Pardiso to do the factorization - ipfint PHASE; - ipfint N = dim_; - ipfint PERM; // This should not be accessed by Pardiso - ipfint NRHS = 0; - double B; // This should not be accessed by Pardiso in factorization + Index PHASE; + Index N = dim_; + Index PERM; // This should not be accessed by Pardiso + Index NRHS = 0; + Number B; // This should not be accessed by Pardiso in factorization // phase - double X; // This should not be accessed by Pardiso in factorization + Number X; // This should not be accessed by Pardiso in factorization // phase - ipfint ERROR; + Index ERROR; bool done = false; - bool just_performed_symbolic_factorization = false; + // bool just_performed_symbolic_factorization = false; while( !done ) { @@ -526,8 +536,8 @@ ESymSolverStatus IterativePardisoSolverInterface::Factorization( } DPARM_[8] = 25; // maximum number of non-improvement steps - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, a_, ia, ja, &PERM, &NRHS, IPARM_, &MSGLVL_, - &B, &X, &ERROR, DPARM_); + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, a_, ia, ja, &PERM, &NRHS, IPARM_, &MSGLVL_, + &B, &X, &ERROR, DPARM_); if( HaveIpData() ) { IpData().TimingStats().LinearSystemSymbolicFactorization().End(); @@ -535,24 +545,24 @@ ESymSolverStatus IterativePardisoSolverInterface::Factorization( if( ERROR == -7 ) { Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Pardiso symbolic factorization returns ERROR = %d. Matrix is singular.\n", ERROR); + "Pardiso symbolic factorization returns ERROR = %" IPOPT_INDEX_FORMAT ". Matrix is singular.\n", ERROR); return SYMSOLVER_SINGULAR; } else if( ERROR != 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in Pardiso during symbolic factorization phase. ERROR = %d.\n", ERROR); + "Error in Pardiso during symbolic factorization phase. ERROR = %" IPOPT_INDEX_FORMAT ".\n", ERROR); return SYMSOLVER_FATAL_ERROR; } have_symbolic_factorization_ = true; - just_performed_symbolic_factorization = true; + // just_performed_symbolic_factorization = true; Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Memory in KB required for the symbolic factorization = %d.\n", IPARM_[14]); + "Memory in KB required for the symbolic factorization = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[14]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Integer memory in KB required for the numerical factorization = %d.\n", IPARM_[15]); + "Integer memory in KB required for the numerical factorization = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[15]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Double memory in KB required for the numerical factorization = %d.\n", IPARM_[16]); + "Double memory in KB required for the numerical factorization = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[16]); } PHASE = 22; @@ -603,8 +613,8 @@ ESymSolverStatus IterativePardisoSolverInterface::Factorization( } DPARM_[8] = 25; // maximum number of non-improvement steps - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, a_, ia, ja, &PERM, &NRHS, IPARM_, &MSGLVL_, - &B, &X, &ERROR, DPARM_); + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, a_, ia, ja, &PERM, &NRHS, IPARM_, &MSGLVL_, + &B, &X, &ERROR, DPARM_); if( HaveIpData() ) { IpData().TimingStats().LinearSystemFactorization().End(); @@ -613,7 +623,7 @@ ESymSolverStatus IterativePardisoSolverInterface::Factorization( if( ERROR == -7 ) { Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Pardiso factorization returns ERROR = %d. Matrix is singular.\n", ERROR); + "Pardiso factorization returns ERROR = %" IPOPT_INDEX_FORMAT ". Matrix is singular.\n", ERROR); return SYMSOLVER_SINGULAR; } else if( ERROR == -4 ) @@ -625,7 +635,7 @@ ESymSolverStatus IterativePardisoSolverInterface::Factorization( else if( ERROR != 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in Pardiso during factorization phase. ERROR = %d.\n", ERROR); + "Error in Pardiso during factorization phase. ERROR = %" IPOPT_INDEX_FORMAT ".\n", ERROR); return SYMSOLVER_FATAL_ERROR; } @@ -633,7 +643,7 @@ ESymSolverStatus IterativePardisoSolverInterface::Factorization( if( IPARM_[13] != 0 ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of perturbed pivots in factorization phase = %d.\n", IPARM_[13]); + "Number of perturbed pivots in factorization phase = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[13]); if( HaveIpData() ) { IpData().Append_info_string("Pp"); @@ -658,7 +668,7 @@ ESymSolverStatus IterativePardisoSolverInterface::Factorization( if( check_NegEVals && (numberOfNegEVals != negevals_) ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Wrong inertia: required are %d, but we got %d.\n", numberOfNegEVals, negevals_); + "Wrong inertia: required are %" IPOPT_INDEX_FORMAT ", but we got %" IPOPT_INDEX_FORMAT ".\n", numberOfNegEVals, negevals_); return SYMSOLVER_WRONG_INERTIA; } @@ -669,7 +679,7 @@ ESymSolverStatus IterativePardisoSolverInterface::Solve( const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals + Number* rhs_vals ) { DBG_START_METH("IterativePardisoSolverInterface::Solve", dbg_verbosity); @@ -681,16 +691,16 @@ ESymSolverStatus IterativePardisoSolverInterface::Solve( IpData().TimingStats().LinearSystemBackSolve().Start(); } // Call Pardiso to do the solve for the given right-hand sides - ipfint PHASE = 33; - ipfint N = dim_; - ipfint PERM; // This should not be accessed by Pardiso - ipfint NRHS = nrhs; - double* X = new double[nrhs * dim_]; - double* ORIG_RHS = new double[nrhs * dim_]; - ipfint ERROR; + Index PHASE = 33; + Index N = dim_; + Index PERM; // This should not be accessed by Pardiso + Index NRHS = nrhs; + Number* X = new Number[nrhs * dim_]; + Number* ORIG_RHS = new Number[nrhs * dim_]; + Index ERROR; // Initialize solution with zero and save right hand side - for( int i = 0; i < N; i++ ) + for( Index i = 0; i < N; i++ ) { X[i] = 0; ORIG_RHS[i] = rhs_vals[i]; @@ -708,6 +718,7 @@ ESymSolverStatus IterativePardisoSolverInterface::Solve( int attempts = 0; const int max_attempts = pardiso_max_droptol_corrections_ + 1; + DBG_ASSERT(max_attempts > 0); bool is_normal = false; if( IsNull(InexData().normal_x()) && InexData().compute_normal() ) @@ -726,19 +737,19 @@ ESymSolverStatus IterativePardisoSolverInterface::Solve( bool retval = tester->InitializeSolve(); ASSERT_EXCEPTION(retval, INTERNAL_ABORT, "tester->InitializeSolve(); returned false"); - for( int i = 0; i < N; i++ ) + for( Index i = 0; i < N; i++ ) { rhs_vals[i] = ORIG_RHS[i]; } DPARM_[8] = 25; // non_improvement in SQMR iteration - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, a_, ia, ja, &PERM, &NRHS, IPARM_, &MSGLVL_, - rhs_vals, X, &ERROR, DPARM_); + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, a_, ia, ja, &PERM, &NRHS, IPARM_, &MSGLVL_, + rhs_vals, X, &ERROR, DPARM_); if( ERROR <= -100 && ERROR >= -110 ) { Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "Iterative solver in Pardiso did not converge (ERROR = %d)\n", ERROR); + "Iterative solver in Pardiso did not converge (ERROR = %" IPOPT_INDEX_FORMAT ")\n", ERROR); Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, " Decreasing drop tolerances from DPARM_[ 4] = %e and DPARM_[ 5] = %e ", DPARM_[4], DPARM_[5]); if( is_normal ) @@ -767,12 +778,12 @@ ESymSolverStatus IterativePardisoSolverInterface::Solve( if( is_normal ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of iterations in Pardiso iterative solver for normal step = %d.\n", iterations_used); + "Number of iterations in Pardiso iterative solver for normal step = %" IPOPT_INDEX_FORMAT ".\n", iterations_used); } else { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of iterations in Pardiso iterative solver for PD step = %d.\n", iterations_used); + "Number of iterations in Pardiso iterative solver for PD step = %" IPOPT_INDEX_FORMAT ".\n", iterations_used); } } tester->Clear(); @@ -817,7 +828,7 @@ ESymSolverStatus IterativePardisoSolverInterface::Solve( if( IPARM_[6] != 0 ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of iterative refinement steps = %d.\n", IPARM_[6]); + "Number of iterative refinement steps = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[6]); if( HaveIpData() ) { IpData().Append_info_string("Pi"); @@ -831,7 +842,7 @@ ESymSolverStatus IterativePardisoSolverInterface::Solve( if( ERROR != 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in Pardiso during solve phase. ERROR = %d.\n", ERROR); + "Error in Pardiso during solve phase. ERROR = %" IPOPT_INDEX_FORMAT ".\n", ERROR); return SYMSOLVER_FATAL_ERROR; } if( test_result_ == IterativeSolverTerminationTester::MODIFY_HESSIAN ) @@ -858,7 +869,7 @@ ESymSolverStatus IterativePardisoSolverInterface::Solve( // iterates to zero Index nvars = IpData().curr()->x()->Dim() + IpData().curr()->s()->Dim(); const Number zero = 0.; - IpBlasDcopy(nvars, &zero, 0, rhs_vals, 1); + IpBlasCopy(nvars, &zero, 0, rhs_vals, 1); } return SYMSOLVER_SUCCESS; } diff --git a/src/Algorithm/Inexact/IpIterativePardisoSolverInterface.hpp b/src/Algorithm/Inexact/IpIterativePardisoSolverInterface.hpp index afedd32ab..e87e54ec0 100644 --- a/src/Algorithm/Inexact/IpIterativePardisoSolverInterface.hpp +++ b/src/Algorithm/Inexact/IpIterativePardisoSolverInterface.hpp @@ -11,6 +11,18 @@ #include "IpSparseSymLinearSolverInterface.hpp" #include "IpInexactCq.hpp" #include "IpIterativeSolverTerminationTester.hpp" +#include "IpPardisoSolverInterface.hpp" // for IPOPT_DECL_... macros +#include "IpTypes.h" + +#define IPOPT_DECL_SETIPOPTCALLBACKFUNCTION(x) void (x)( \ + int (*IpoptFunction)( \ + int n, \ + ipnumber* xx, \ + ipnumber* r, \ + int k, \ + ipnumber b \ + ) \ +) namespace Ipopt { @@ -22,16 +34,17 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor */ IterativePardisoSolverInterface( IterativeSolverTerminationTester& normal_tester, - IterativeSolverTerminationTester& pd_tester + IterativeSolverTerminationTester& pd_tester, + SmartPtr pardisoloader_ ); /** Destructor */ virtual ~IterativePardisoSolverInterface(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -39,7 +52,7 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ /** Method for initializing internal structures. */ virtual ESymSolverStatus InitializeStructure( Index dim, @@ -51,7 +64,7 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface /** Method returning an internal array into which the nonzero * elements are to be stored. */ - virtual double* GetValuesArrayPtr(); + virtual Number* GetValuesArrayPtr(); /** Solve operation for multiple right hand sides. */ virtual ESymSolverStatus MultiSolve( @@ -59,7 +72,7 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ); @@ -68,10 +81,10 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface * factorization. */ virtual Index NumberOfNegEVals() const; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ /** Request to increase quality of solution for next solve. */ virtual bool IncreaseQuality(); @@ -92,7 +105,7 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface { return CSR_Format_1_Offset; } - //@} + ///@} static void RegisterOptions( SmartPtr roptions @@ -108,7 +121,7 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ IterativePardisoSolverInterface(); @@ -121,10 +134,10 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface void operator=( const IterativePardisoSolverInterface& ); - //@} + ///@} /** @name Information about the matrix */ - //@{ + ///@{ /** Number of rows and columns of the matrix */ Index dim_; @@ -132,17 +145,17 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface Index nonzeros_; /** Array for storing the values of the matrix. */ - double* a_; - //@} + Number* a_; + ///@} /** @name Information about most recent factorization/solve */ - //@{ + ///@{ /** Number of negative eigenvalues */ Index negevals_; - //@} + ///@} /** @name Solver specific options */ - //@{ + ///@{ /** Type for matching strategies */ enum PardisoMatchingStrategy { @@ -169,10 +182,10 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface bool skip_inertia_check_; /** Maximal number of decreases of drop tolerance during one solve. */ Index pardiso_max_droptol_corrections_; - //@} + ///@} /** Options for the preconditioner */ - //@{ + ///@{ Index pardiso_max_iter_; Number pardiso_iter_relative_tol_; Index pardiso_iter_coarse_size_; @@ -190,57 +203,69 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface Number normal_pardiso_iter_dropping_schur_; Index normal_pardiso_iter_max_row_fill_; Number normal_pardiso_iter_inverse_norm_factor_; - //@} + ///@} /** Decrease factor for dropping tolerances */ Number decr_factor_; /** Actually used dropping tolerances */ - //@{ + ///@{ Number pardiso_iter_dropping_factor_used_; Number pardiso_iter_dropping_schur_used_; Number normal_pardiso_iter_dropping_factor_used_; Number normal_pardiso_iter_dropping_schur_used_; - //@} + ///@} /** @name Initialization flags */ - //@{ + ///@{ /** Flag indicating if internal data is initialized. * * For initialization, this object needs to have seen a matrix. */ bool initialized_; - //@} + ///@} /** @name Solver specific information */ - //@{ + ///@{ /** Internal data address pointers. */ void** PT_; /** Maximal number of factors with identical nonzero structure. * * Here, we only store one factorization. Is always 1. */ - ipfint MAXFCT_; + Index MAXFCT_; /** Actual matrix for the solution phase. Is always 1. */ - ipfint MNUM_; + Index MNUM_; /** Matrix type; real and symmetric indefinite. Is always -2. */ - ipfint MTYPE_; + Index MTYPE_; /** Parameter and info array for Pardiso. */ - ipfint* IPARM_; + Index* IPARM_; /** Parameter and info array for Pardiso. */ - double* DPARM_; + Number* DPARM_; /** Message level. */ - ipfint MSGLVL_; - //@} + Index MSGLVL_; + ///@} /**@name Some counters for debugging */ - //@{ + ///@{ Index debug_last_iter_; Index debug_cnt_; - //@} + ///@} + + /**@name PARDISO function pointers + * @{ + */ + SmartPtr pardisoloader; + + IPOPT_DECL_PARDISOINIT(*pardisoinit); + IPOPT_DECL_PARDISO(*pardiso); + IPOPT_DECL_SETIPOPTCALLBACKFUNCTION(*SetIpoptCallbackFunction); + + bool pardiso_exist_parallel; + /**@} */ /** @name Internal functions */ - //@{ + ///@{ /** Call Pardiso to do the analysis phase. */ ESymSolverStatus SymbolicFactorization( const Index* ia, @@ -261,9 +286,9 @@ class IterativePardisoSolverInterface: public SparseSymLinearSolverInterface const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals + Number* rhs_vals ); - //@} + ///@} /** Method to easily access Inexact data */ InexactData& InexData() diff --git a/src/Algorithm/Inexact/IpIterativeSolverTerminationTester.cpp b/src/Algorithm/Inexact/IpIterativeSolverTerminationTester.cpp index 9c15bafa3..ac047a13d 100644 --- a/src/Algorithm/Inexact/IpIterativeSolverTerminationTester.cpp +++ b/src/Algorithm/Inexact/IpIterativeSolverTerminationTester.cpp @@ -25,6 +25,7 @@ void IterativeSolverTerminationTester::GetVectors( { DBG_ASSERT(ndim == IpData().curr()->x()->Dim() + IpData().curr()->s()->Dim() + IpData().curr()->y_c()->Dim() + IpData().curr()->y_d()->Dim()); + (void)ndim; // x SmartPtr sol_x = IpData().curr()->x()->MakeNew(); @@ -51,7 +52,7 @@ void IterativeSolverTerminationTester::GetVectors( SmartPtr sol_d = IpData().curr()->y_d()->MakeNew(); dim = sol_d->Dim(); TripletHelper::PutValuesInVector(dim, array, *sol_d); - array += dim; + // array += dim; comp_d = ConstPtr(sol_d); } diff --git a/src/Algorithm/Inexact/IpIterativeSolverTerminationTester.hpp b/src/Algorithm/Inexact/IpIterativeSolverTerminationTester.hpp index 3edf0140b..48e29a528 100644 --- a/src/Algorithm/Inexact/IpIterativeSolverTerminationTester.hpp +++ b/src/Algorithm/Inexact/IpIterativeSolverTerminationTester.hpp @@ -37,7 +37,7 @@ class IterativeSolverTerminationTester: public AlgorithmStrategyObject }; /** @name Constructor/Destructor */ - //@{ + ///@{ /** Default constructor */ IterativeSolverTerminationTester() { } @@ -45,7 +45,7 @@ class IterativeSolverTerminationTester: public AlgorithmStrategyObject /** Destructor */ virtual ~IterativeSolverTerminationTester() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -130,12 +130,12 @@ class IterativeSolverTerminationTester: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Overloaded Assignment Operator */ IterativeSolverTerminationTester& operator=( const IterativeSolverTerminationTester& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/Inexact/Makefile.am b/src/Algorithm/Inexact/Makefile.am deleted file mode 100644 index 9bb215ecf..000000000 --- a/src/Algorithm/Inexact/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2008 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Andreas Waechter IBM 2008-08-31 - -if BUILD_INEXACT - noinst_LTLIBRARIES = libinexact.la -endif - -libinexact_la_SOURCES = \ - IpInexactAlgBuilder.cpp \ - IpInexactCq.cpp \ - IpInexactData.cpp \ - IpInexactDoglegNormal.cpp \ - IpInexactLSAcceptor.cpp \ - IpInexactNewtonNormal.cpp \ - IpInexactNormalTerminationTester.cpp \ - IpInexactPDSolver.cpp \ - IpInexactPDTerminationTester.cpp \ - IpInexactRegOp.cpp \ - IpInexactSearchDirCalc.cpp \ - IpInexactTSymScalingMethod.cpp \ - IpIterativePardisoSolverInterface.cpp \ - IpIterativeSolverTerminationTester.cpp - -#libinexact_la_LDFLAGS = $(LT_LDFLAGS) - -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../LinAlg \ - -I$(srcdir)/../../LinAlg/TMatrices \ - -I$(srcdir)/../../Interfaces \ - -I$(srcdir)/.. \ - -I$(srcdir)/../LinearSolvers \ - -I$(srcdir)/../../contrib/LinearSolverLoader \ - $(IPOPTLIB_CFLAGS) - diff --git a/src/Algorithm/Inexact/Makefile.in b/src/Algorithm/Inexact/Makefile.in deleted file mode 100644 index 6ac28ec0f..000000000 --- a/src/Algorithm/Inexact/Makefile.in +++ /dev/null @@ -1,703 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2008 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Andreas Waechter IBM 2008-08-31 - -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/Algorithm/Inexact -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/src/Common/config.h \ - $(top_builddir)/src/Common/config_ipopt.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libinexact_la_LIBADD = -am_libinexact_la_OBJECTS = IpInexactAlgBuilder.lo IpInexactCq.lo \ - IpInexactData.lo IpInexactDoglegNormal.lo \ - IpInexactLSAcceptor.lo IpInexactNewtonNormal.lo \ - IpInexactNormalTerminationTester.lo IpInexactPDSolver.lo \ - IpInexactPDTerminationTester.lo IpInexactRegOp.lo \ - IpInexactSearchDirCalc.lo IpInexactTSymScalingMethod.lo \ - IpIterativePardisoSolverInterface.lo \ - IpIterativeSolverTerminationTester.lo -libinexact_la_OBJECTS = $(am_libinexact_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 = -@BUILD_INEXACT_TRUE@am_libinexact_la_rpath = -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)/IpInexactAlgBuilder.Plo \ - ./$(DEPDIR)/IpInexactCq.Plo ./$(DEPDIR)/IpInexactData.Plo \ - ./$(DEPDIR)/IpInexactDoglegNormal.Plo \ - ./$(DEPDIR)/IpInexactLSAcceptor.Plo \ - ./$(DEPDIR)/IpInexactNewtonNormal.Plo \ - ./$(DEPDIR)/IpInexactNormalTerminationTester.Plo \ - ./$(DEPDIR)/IpInexactPDSolver.Plo \ - ./$(DEPDIR)/IpInexactPDTerminationTester.Plo \ - ./$(DEPDIR)/IpInexactRegOp.Plo \ - ./$(DEPDIR)/IpInexactSearchDirCalc.Plo \ - ./$(DEPDIR)/IpInexactTSymScalingMethod.Plo \ - ./$(DEPDIR)/IpIterativePardisoSolverInterface.Plo \ - ./$(DEPDIR)/IpIterativeSolverTerminationTester.Plo -am__mv = mv -f -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) \ - $(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) \ - $(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 = -SOURCES = $(libinexact_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -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 -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -@BUILD_INEXACT_TRUE@noinst_LTLIBRARIES = libinexact.la -libinexact_la_SOURCES = \ - IpInexactAlgBuilder.cpp \ - IpInexactCq.cpp \ - IpInexactData.cpp \ - IpInexactDoglegNormal.cpp \ - IpInexactLSAcceptor.cpp \ - IpInexactNewtonNormal.cpp \ - IpInexactNormalTerminationTester.cpp \ - IpInexactPDSolver.cpp \ - IpInexactPDTerminationTester.cpp \ - IpInexactRegOp.cpp \ - IpInexactSearchDirCalc.cpp \ - IpInexactTSymScalingMethod.cpp \ - IpIterativePardisoSolverInterface.cpp \ - IpIterativeSolverTerminationTester.cpp - - -#libinexact_la_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../LinAlg \ - -I$(srcdir)/../../LinAlg/TMatrices \ - -I$(srcdir)/../../Interfaces \ - -I$(srcdir)/.. \ - -I$(srcdir)/../LinearSolvers \ - -I$(srcdir)/../../contrib/LinearSolverLoader \ - $(IPOPTLIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.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 ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Algorithm/Inexact/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Algorithm/Inexact/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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}; \ - } - -libinexact.la: $(libinexact_la_OBJECTS) $(libinexact_la_DEPENDENCIES) $(EXTRA_libinexact_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(am_libinexact_la_rpath) $(libinexact_la_OBJECTS) $(libinexact_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactAlgBuilder.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactCq.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactData.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactDoglegNormal.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactLSAcceptor.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactNewtonNormal.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactNormalTerminationTester.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactPDSolver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactPDTerminationTester.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactRegOp.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactSearchDirCalc.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInexactTSymScalingMethod.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpIterativePardisoSolverInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpIterativeSolverTerminationTester.Plo@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@ $(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@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -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) \ - $$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 - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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 -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/IpInexactAlgBuilder.Plo - -rm -f ./$(DEPDIR)/IpInexactCq.Plo - -rm -f ./$(DEPDIR)/IpInexactData.Plo - -rm -f ./$(DEPDIR)/IpInexactDoglegNormal.Plo - -rm -f ./$(DEPDIR)/IpInexactLSAcceptor.Plo - -rm -f ./$(DEPDIR)/IpInexactNewtonNormal.Plo - -rm -f ./$(DEPDIR)/IpInexactNormalTerminationTester.Plo - -rm -f ./$(DEPDIR)/IpInexactPDSolver.Plo - -rm -f ./$(DEPDIR)/IpInexactPDTerminationTester.Plo - -rm -f ./$(DEPDIR)/IpInexactRegOp.Plo - -rm -f ./$(DEPDIR)/IpInexactSearchDirCalc.Plo - -rm -f ./$(DEPDIR)/IpInexactTSymScalingMethod.Plo - -rm -f ./$(DEPDIR)/IpIterativePardisoSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpIterativeSolverTerminationTester.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -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 -f ./$(DEPDIR)/IpInexactAlgBuilder.Plo - -rm -f ./$(DEPDIR)/IpInexactCq.Plo - -rm -f ./$(DEPDIR)/IpInexactData.Plo - -rm -f ./$(DEPDIR)/IpInexactDoglegNormal.Plo - -rm -f ./$(DEPDIR)/IpInexactLSAcceptor.Plo - -rm -f ./$(DEPDIR)/IpInexactNewtonNormal.Plo - -rm -f ./$(DEPDIR)/IpInexactNormalTerminationTester.Plo - -rm -f ./$(DEPDIR)/IpInexactPDSolver.Plo - -rm -f ./$(DEPDIR)/IpInexactPDTerminationTester.Plo - -rm -f ./$(DEPDIR)/IpInexactRegOp.Plo - -rm -f ./$(DEPDIR)/IpInexactSearchDirCalc.Plo - -rm -f ./$(DEPDIR)/IpInexactTSymScalingMethod.Plo - -rm -f ./$(DEPDIR)/IpIterativePardisoSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpIterativeSolverTerminationTester.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES \ - 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-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - 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 - -.PRECIOUS: Makefile - - -# 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/Algorithm/IpAdaptiveMuUpdate.cpp b/src/Algorithm/IpAdaptiveMuUpdate.cpp index 1a2aaa97b..fda6939c1 100644 --- a/src/Algorithm/IpAdaptiveMuUpdate.cpp +++ b/src/Algorithm/IpAdaptiveMuUpdate.cpp @@ -63,13 +63,15 @@ void AdaptiveMuUpdate::RegisterOptions( "By default, it is set to the minimum of 1e-11 and min(\"tol\",\"compl_inf_tol\")/(\"barrier_tol_factor\"+1), " "which should be a reasonable value. " "(Only used if option \"mu_strategy\" is chosen as \"adaptive\".)"); - std::string prev_cat = roptions->RegisteringCategory(); + SmartPtr prev_cat = roptions->RegisteringCategory(); roptions->SetRegisteringCategory("Undocumented"); roptions->AddLowerBoundedNumberOption( "adaptive_mu_safeguard_factor", "", 0.0, false, - 0.0); + 0.0, + "", + true); roptions->SetRegisteringCategory(prev_cat); roptions->AddStringOption3( @@ -90,7 +92,8 @@ void AdaptiveMuUpdate::RegisterOptions( 0, 4, "For the \"kkt-error\" based globalization strategy, sufficient progress must be made for \"adaptive_mu_kkterror_red_iters\" iterations. " - "If this number of iterations is exceeded, the globalization strategy switches to the monotone mode."); + "If this number of iterations is exceeded, the globalization strategy switches to the monotone mode.", + true); roptions->AddBoundedNumberOption( "adaptive_mu_kkterror_red_fact", @@ -98,7 +101,8 @@ void AdaptiveMuUpdate::RegisterOptions( 0.0, true, 1.0, true, 0.9999, - "For the \"kkt-error\" based globalization strategy, the error must decrease by this factor to be deemed sufficient decrease."); + "For the \"kkt-error\" based globalization strategy, the error must decrease by this factor to be deemed sufficient decrease.", + true); roptions->AddBoundedNumberOption( "filter_margin_fact", @@ -110,27 +114,30 @@ void AdaptiveMuUpdate::RegisterOptions( "sufficient progress for a filter entry is defined as follows: " "(new obj) < (filter obj) - filter_margin_fact*(new constr-viol) OR " "(new constr-viol) < (filter constr-viol) - filter_margin_fact*(new constr-viol). " - "For the description of the \"kkt-error-filter\" option see \"filter_max_margin\"."); + "For the description of the \"kkt-error-filter\" option see \"filter_max_margin\".", + true); roptions->AddLowerBoundedNumberOption( "filter_max_margin", "Maximum width of margin in obj-constr-filter adaptive globalization strategy.", 0.0, true, - 1.0); // ToDo Detailed description later - roptions->AddStringOption2( + 1.0, + "", // ToDo Detailed description + true); + roptions->AddBoolOption( "adaptive_mu_restore_previous_iterate", - "Indicates if the previous iterate should be restored if the monotone mode is entered.", - "no", - "no", "don't restore accepted iterate", - "yes", "restore accepted iterate", + "Indicates if the previous accepted iterate should be restored if the monotone mode is entered.", + false, "When the globalization strategy for the adaptive barrier algorithm switches to the monotone mode, " - "it can either start from the most recent iterate (no), or from the last iterate that was accepted (yes)."); + "it can either start from the most recent iterate (no), or from the last iterate that was accepted (yes).", + true); roptions->AddLowerBoundedNumberOption( "adaptive_mu_monotone_init_factor", "Determines the initial value of the barrier parameter when switching to the monotone mode.", 0.0, true, 0.8, "When the globalization strategy for the adaptive barrier algorithm switches to the monotone mode and fixed_mu_oracle is chosen as \"average_compl\", " - "the barrier parameter is set to the current average complementarity times the value of \"adaptive_mu_monotone_init_factor\"."); + "the barrier parameter is set to the current average complementarity times the value of \"adaptive_mu_monotone_init_factor\".", + true); roptions->AddStringOption4( "adaptive_mu_kkt_norm_type", "Norm used for the KKT error in the adaptive mu globalization strategies.", @@ -140,7 +147,8 @@ void AdaptiveMuUpdate::RegisterOptions( "max-norm", "use the infinity norm (max)", "2-norm", "use 2-norm", "When computing the KKT error for the globalization strategies, the norm to be used is specified with this option. " - "Note, this option is also used in the QualityFunctionMuOracle."); + "Note, this option is also used in the QualityFunctionMuOracle.", + true); } bool AdaptiveMuUpdate::InitializeImpl( @@ -253,7 +261,7 @@ bool AdaptiveMuUpdate::UpdateBarrierParameter() // (e.g. in the restoration phase) if( mu_min_default_ ) { - mu_min_ = Min(mu_min_, 0.5 * Min(IpData().tol(), IpNLP().NLP_scaling()->apply_obj_scaling(compl_inf_tol_))); + mu_min_ = Min(mu_min_, Number(0.5) * Min(IpData().tol(), std::abs(IpNLP().NLP_scaling()->apply_obj_scaling(compl_inf_tol_)))); } // if mu_max has not yet been computed, do so now, based on the @@ -265,7 +273,7 @@ bool AdaptiveMuUpdate::UpdateBarrierParameter() "Setting mu_max to %e.\n", mu_max_); } - // if there are not bounds, we always return the minimum MU value + // if there are no bounds, we always return the minimum MU value if( !check_if_no_bounds_ ) { Index n_bounds = IpData().curr()->z_L()->Dim() + IpData().curr()->z_U()->Dim() + IpData().curr()->v_L()->Dim() @@ -315,11 +323,10 @@ bool AdaptiveMuUpdate::UpdateBarrierParameter() // well, decrease mu // ToDo combine this code with MonotoneMuUpdate Number tol = IpData().tol(); - Number compl_inf_tol = IpNLP().NLP_scaling()->apply_obj_scaling(compl_inf_tol_); - - Number new_mu = Min(mu_linear_decrease_factor_ * mu, pow(mu, mu_superlinear_decrease_power_)); + Number compl_inf_tol = std::abs(IpNLP().NLP_scaling()->apply_obj_scaling(compl_inf_tol_)); + Number new_mu = Min(mu_linear_decrease_factor_ * mu, std::pow(mu, mu_superlinear_decrease_power_)); DBG_PRINT((1, "new_mu = %e, compl_inf_tol = %e tol = %e\n", new_mu, compl_inf_tol, tol)); - new_mu = Max(new_mu, Min(compl_inf_tol, tol) / (barrier_tol_factor_ + 1.)); + new_mu = Max(new_mu, Min(compl_inf_tol, tol) / (barrier_tol_factor_ + Number(1.))); if( tiny_step_flag && new_mu == mu ) { THROW_EXCEPTION(TINY_STEP_DETECTED, "Problem solved to best possible numerical accuracy"); @@ -387,7 +394,7 @@ bool AdaptiveMuUpdate::UpdateBarrierParameter() // Choose the fraction-to-the-boundary parameter for the current // iteration // ToDo: Is curr_nlp_error really what we should use here? - Number tau = Max(tau_min_, 1. - IpCq().curr_nlp_error()); + Number tau = Max(tau_min_, Number(1.) - IpCq().curr_nlp_error()); IpData().Set_tau(tau); // Compute the new barrier parameter via the oracle @@ -450,7 +457,7 @@ bool AdaptiveMuUpdate::CheckSufficientProgress() retval = false; Number curr_error = quality_function_pd_system(); std::list::iterator iter; - for( iter = refs_vals_.begin(); iter != refs_vals_.end(); iter++ ) + for( iter = refs_vals_.begin(); iter != refs_vals_.end(); ++iter ) { if( curr_error <= refs_red_fact_ * (*iter) ) { @@ -498,13 +505,13 @@ void AdaptiveMuUpdate::RememberCurrentPointAsAccepted() if( Jnlst().ProduceOutput(J_MOREDETAILED, J_BARRIER_UPDATE) ) { - Index num_refs = 0; + Index refidx = 0; std::list::iterator iter; - for( iter = refs_vals_.begin(); iter != refs_vals_.end(); iter++ ) + for( iter = refs_vals_.begin(); iter != refs_vals_.end(); ++iter ) { - num_refs++; + refidx++; Jnlst().Printf(J_MOREDETAILED, J_BARRIER_UPDATE, - "pd system reference[%2d] = %.6e\n", num_refs, *iter); + "pd system reference[%2" IPOPT_INDEX_FORMAT "] = %.6e\n", refidx, *iter); } } } @@ -542,21 +549,19 @@ Number AdaptiveMuUpdate::Compute_tau_monotone( Number mu ) { - return Max(tau_min_, 1. - mu); + return Max(tau_min_, Number(1.) - mu); } Number AdaptiveMuUpdate::min_ref_val() { DBG_ASSERT(adaptive_mu_globalization_ == KKT_ERROR); Number min_ref; - DBG_ASSERT(refs_vals_.size() > 0); + DBG_ASSERT(!refs_vals_.empty()); std::list::iterator iter = refs_vals_.begin(); min_ref = *iter; - iter++; - while( iter != refs_vals_.end() ) + for( ++iter; iter != refs_vals_.end(); ++iter ) { min_ref = Min(min_ref, *iter); - iter++; } return min_ref; } @@ -565,14 +570,12 @@ Number AdaptiveMuUpdate::max_ref_val() { DBG_ASSERT(adaptive_mu_globalization_ == KKT_ERROR); Number max_ref; - DBG_ASSERT(refs_vals_.size() > 0); + DBG_ASSERT(!refs_vals_.empty()); std::list::iterator iter = refs_vals_.begin(); max_ref = *iter; - iter++; - while( iter != refs_vals_.end() ) + for( ++iter; iter != refs_vals_.end(); ++iter ) { max_ref = Max(max_ref, *iter); - iter++; } return max_ref; } @@ -615,7 +618,7 @@ Number AdaptiveMuUpdate::NewFixedMu() new_mu = adaptive_mu_monotone_init_factor_ * IpCq().curr_avrg_compl(); } new_mu = Max(new_mu, lower_mu_safeguard()); - new_mu = Min(new_mu, 0.1 * max_ref); + new_mu = Min(new_mu, Number(0.1) * max_ref); new_mu = Max(new_mu, mu_min_); new_mu = Min(new_mu, mu_max_); @@ -679,16 +682,16 @@ Number AdaptiveMuUpdate::quality_function_pd_system() dual_inf = IpCq().curr_dual_infeasibility(NORM_2); primal_inf = IpCq().curr_primal_infeasibility(NORM_2); complty = IpCq().curr_complementarity(0., NORM_2); - dual_inf /= sqrt((Number) n_dual); + dual_inf /= std::sqrt((Number) n_dual); DBG_ASSERT(n_pri > 0 || primal_inf == 0.); if( n_pri > 0 ) { - primal_inf /= sqrt((Number) n_pri); + primal_inf /= std::sqrt((Number) n_pri); } DBG_ASSERT(n_comp > 0 || complty == 0.); if( n_comp > 0 ) { - complty /= sqrt((Number) n_comp); + complty /= std::sqrt((Number) n_comp); } break; } @@ -700,13 +703,13 @@ Number AdaptiveMuUpdate::quality_function_pd_system() switch( adaptive_mu_kkt_centrality_ ) { case 1: - centrality = -complty * log(xi); + centrality = -complty * std::log(xi); break; case 2: centrality = complty / xi; break; case 3: - centrality = complty / pow(xi, 3); + centrality = complty / std::pow(xi, 3); break; default: DBG_ASSERT(false && "Unknown value for adaptive_mu_kkt_centrality_"); @@ -720,7 +723,7 @@ Number AdaptiveMuUpdate::quality_function_pd_system() //Nothing break; case 1: - balancing_term = pow(Max(0., Max(dual_inf, primal_inf) - complty), 3); + balancing_term = std::pow(Max(Number(0.), Max(dual_inf, primal_inf) - complty), 3); break; default: DBG_ASSERT(false && "Unknown value for adaptive_mu_kkt_balancing_term"); @@ -763,11 +766,11 @@ Number AdaptiveMuUpdate::lower_mu_safeguard() if( init_dual_inf_ < 0. ) { - init_dual_inf_ = Max(1., dual_inf); + init_dual_inf_ = Max(Number(1.), dual_inf); } if( init_primal_inf_ < 0. ) { - init_primal_inf_ = Max(1., primal_inf); + init_primal_inf_ = Max(Number(1.), primal_inf); } Number lower_mu_safeguard = Max(adaptive_mu_safeguard_factor_ * (dual_inf / init_dual_inf_), diff --git a/src/Algorithm/IpAdaptiveMuUpdate.hpp b/src/Algorithm/IpAdaptiveMuUpdate.hpp index d87ddab87..bceada9f2 100644 --- a/src/Algorithm/IpAdaptiveMuUpdate.hpp +++ b/src/Algorithm/IpAdaptiveMuUpdate.hpp @@ -21,7 +21,7 @@ class AdaptiveMuUpdate: public MuUpdate { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ AdaptiveMuUpdate( const SmartPtr& linesearch, @@ -31,7 +31,7 @@ class AdaptiveMuUpdate: public MuUpdate /** Destructor */ virtual ~AdaptiveMuUpdate(); - //@} + ///@} /** Initialize method - overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -47,11 +47,11 @@ class AdaptiveMuUpdate: public MuUpdate virtual bool UpdateBarrierParameter(); /** Methods for IpoptType */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -63,7 +63,7 @@ class AdaptiveMuUpdate: public MuUpdate * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ AdaptiveMuUpdate(); @@ -76,10 +76,10 @@ class AdaptiveMuUpdate: public MuUpdate void operator=( const AdaptiveMuUpdate& ); - //@} + ///@} /** @name Algorithmic parameters */ - //@{ + ///@{ Number mu_max_fact_; Number mu_max_; Number mu_min_; @@ -109,10 +109,10 @@ class AdaptiveMuUpdate: public MuUpdate Number filter_margin_fact_; /** Unscaled tolerance for complementarity */ Number compl_inf_tol_; - //@} + ///@} /** @name Strategy objects */ - //@{ + ///@{ /** Line search object of the Ipopt algorithm. */ SmartPtr linesearch_; /** Pointer to strategy object that is to be used for computing a @@ -125,7 +125,7 @@ class AdaptiveMuUpdate: public MuUpdate * If NULL, the current average complementarity is used. */ SmartPtr fix_mu_oracle_; - //@} + ///@} /** Dual infeasibility at initial point. * @@ -143,7 +143,7 @@ class AdaptiveMuUpdate: public MuUpdate /** @name Methods and data defining the outer globalization * strategy (might be a strategy object later). */ - //@{ + ///@{ void InitializeFixedMuGlobalization(); /** Check whether the point in the "current" fields offers * sufficient reduction in order to remain in or switch to the @@ -201,7 +201,7 @@ class AdaptiveMuUpdate: public MuUpdate * be restored, when switching to the fixed mode. */ bool restore_accepted_iterate_; - //@} + ///@} /** Flag indicating whether the problem has any inequality constraints */ bool no_bounds_; @@ -211,9 +211,9 @@ class AdaptiveMuUpdate: public MuUpdate /** @name Most recent accepted point in free mode, from which * fixed mode should be started. */ - //@{ + ///@{ SmartPtr accepted_point_; - //@} + ///@} }; diff --git a/src/Algorithm/IpAlgBuilder.cpp b/src/Algorithm/IpAlgBuilder.cpp index c6727f441..1073da607 100644 --- a/src/Algorithm/IpAlgBuilder.cpp +++ b/src/Algorithm/IpAlgBuilder.cpp @@ -49,10 +49,9 @@ #include "IpGradientScaling.hpp" #include "IpEquilibrationScaling.hpp" #include "IpExactHessianUpdater.hpp" +#include "IpSlackBasedTSymScalingMethod.hpp" -#ifdef IPOPT_HAS_HSL -#include "CoinHslConfig.h" -#endif +#include "IpLinearSolvers.h" #include "IpMa27TSolverInterface.hpp" #include "IpMa57TSolverInterface.hpp" #include "IpMa77SolverInterface.hpp" @@ -60,9 +59,13 @@ #include "IpMa97SolverInterface.hpp" #include "IpMc19TSymScalingMethod.hpp" #include "IpPardisoSolverInterface.hpp" -#include "IpSlackBasedTSymScalingMethod.hpp" - -#ifdef HAVE_WSMP +#ifdef IPOPT_HAS_PARDISO_MKL +# include "IpPardisoMKLSolverInterface.hpp" +#endif +#ifdef IPOPT_HAS_SPRAL +# include "IpSpralSolverInterface.hpp" +#endif +#ifdef IPOPT_HAS_WSMP # include "IpWsmpSolverInterface.hpp" # include "IpIterativeWsmpSolverInterface.hpp" #endif @@ -70,11 +73,6 @@ # include "IpMumpsSolverInterface.hpp" #endif -#ifdef IPOPT_HAS_LINEARSOLVERLOADER -# include "HSLLoader.h" -# include "PardisoLoader.h" -#endif - namespace Ipopt { #if IPOPT_VERBOSITY > 0 @@ -82,93 +80,277 @@ static const Index dbg_verbosity = 0; #endif AlgorithmBuilder::AlgorithmBuilder( - SmartPtr custom_solver /*=NULL*/ + SmartPtr custom_solver, /*=NULL*/ + const std::string& custom_solver_name /*=std::string()*/ ) - : custom_solver_(custom_solver) + : custom_solver_(custom_solver), + custom_solver_name_(custom_solver_name) { } void AlgorithmBuilder::RegisterOptions( SmartPtr roptions ) { + IpoptLinearSolver availablesolvers = IpoptGetAvailableLinearSolvers(false); + IpoptLinearSolver availablesolverslinked = IpoptGetAvailableLinearSolvers(true); + + std::vector options; + std::vector descrs; + options.reserve(10); + descrs.reserve(10); + + if( availablesolvers & IPOPTLINEARSOLVER_MA27 ) + { + options.push_back("ma27"); + if( availablesolverslinked & IPOPTLINEARSOLVER_MA27 ) + { + descrs.push_back("use the Harwell routine MA27"); + } + else + { + descrs.push_back("load the Harwell routine MA27 from library at runtime"); + } + } + + if( availablesolvers & IPOPTLINEARSOLVER_MA57 ) + { + options.push_back("ma57"); + if( availablesolverslinked & IPOPTLINEARSOLVER_MA57 ) + { + descrs.push_back("use the Harwell routine MA57"); + } + else + { + descrs.push_back("load the Harwell routine MA57 from library at runtime"); + } + } + + if( availablesolvers & IPOPTLINEARSOLVER_MA77 ) + { + options.push_back("ma77"); + if( availablesolverslinked & IPOPTLINEARSOLVER_MA77 ) + { + descrs.push_back("use the Harwell routine HSL_MA77"); + } + else + { + descrs.push_back("load the Harwell routine HSL_MA77 from library at runtime"); + } + } + + if( availablesolvers & IPOPTLINEARSOLVER_MA86 ) + { + options.push_back("ma86"); + if( availablesolverslinked & IPOPTLINEARSOLVER_MA86 ) + { + descrs.push_back("use the Harwell routine HSL_MA86"); + } + else + { + descrs.push_back("load the Harwell routine MA86 from library at runtime"); + } + } + + if( availablesolvers & IPOPTLINEARSOLVER_MA97 ) + { + options.push_back("ma97"); + if( availablesolverslinked & IPOPTLINEARSOLVER_MA97 ) + { + descrs.push_back("use the Harwell routine HSL_MA97"); + } + else + { + descrs.push_back("load the Harwell routine MA97 from library at runtime"); + } + } + + if( availablesolvers & IPOPTLINEARSOLVER_PARDISO ) + { + options.push_back("pardiso"); + if( availablesolverslinked & IPOPTLINEARSOLVER_PARDISO ) + { + descrs.push_back("use the Pardiso package from pardiso-project.org"); + } + else + { + descrs.push_back("load the Pardiso package from pardiso-project.org from user-provided library at runtime"); + } + } + + if( availablesolvers & IPOPTLINEARSOLVER_PARDISOMKL ) + { + options.push_back("pardisomkl"); + descrs.push_back("use the Pardiso package from Intel MKL"); + } + + if( availablesolvers & IPOPTLINEARSOLVER_SPRAL ) + { + options.push_back("spral"); + descrs.push_back("use the Spral package"); + } + + if( availablesolvers & IPOPTLINEARSOLVER_WSMP ) + { + options.push_back("wsmp"); + descrs.push_back("use the Wsmp package"); + } + + if( availablesolvers & IPOPTLINEARSOLVER_MUMPS ) + { + options.push_back("mumps"); + descrs.push_back("use the Mumps package"); + } + + options.push_back("custom"); + descrs.push_back("use custom linear solver (expert use)"); + + std::string defaultsolver; + if( availablesolverslinked & IPOPTLINEARSOLVER_MA27 ) + { + defaultsolver = "ma27"; + } + else if( availablesolverslinked & IPOPTLINEARSOLVER_MA57 ) + { + defaultsolver = "ma57"; + } + else if( availablesolverslinked & IPOPTLINEARSOLVER_MA97 ) + { + defaultsolver = "ma97"; + } + else if( availablesolverslinked & IPOPTLINEARSOLVER_MA86 ) + { + defaultsolver = "ma86"; + } + else if( availablesolverslinked & IPOPTLINEARSOLVER_PARDISO ) + { + defaultsolver = "pardiso"; + } + else if( availablesolverslinked & IPOPTLINEARSOLVER_WSMP ) + { + defaultsolver = "wsmp"; + } + else if( availablesolverslinked & IPOPTLINEARSOLVER_MUMPS ) + { + defaultsolver = "mumps"; + } + else if( availablesolverslinked & IPOPTLINEARSOLVER_PARDISOMKL ) + { + defaultsolver = "pardisomkl"; + } + else if( availablesolverslinked & IPOPTLINEARSOLVER_SPRAL ) + { + defaultsolver = "spral"; + } + else if( availablesolverslinked & IPOPTLINEARSOLVER_MA77 ) + { + defaultsolver = "ma77"; + } + else if( availablesolvers & IPOPTLINEARSOLVER_MA27 ) + { + defaultsolver = "ma27"; + } + else + { + defaultsolver = "custom"; + } + roptions->SetRegisteringCategory("Linear Solver"); - roptions->AddStringOption9( + roptions->AddStringOption( "linear_solver", "Linear solver used for step computations.", -#ifdef COINHSL_HAS_MA27 - "ma27", -#else -# ifdef COINHSL_HAS_MA57 - "ma57", -# else -# ifdef COINHSL_HAS_MA97 - "ma97", -#else -# ifdef COINHSL_HAS_MA86 - "ma86", -# else -# ifdef IPOPT_HAS_PARDISO - "pardiso", -# else -# ifdef HAVE_WSMP - "wsmp", -# else -# ifdef IPOPT_HAS_MUMPS - "mumps", -# else -# ifdef COINHSL_HAS_MA77 - "ma77", -# else - "ma27", -# endif -# endif -# endif -# endif -# endif -# endif -# endif -#endif - "ma27", "use the Harwell routine MA27", - "ma57", "use the Harwell routine MA57", - "ma77", "use the Harwell routine HSL_MA77", - "ma86", "use the Harwell routine HSL_MA86", - "ma97", "use the Harwell routine HSL_MA97", - "pardiso", "use the Pardiso package", - "wsmp", "use WSMP package", - "mumps", "use MUMPS package", - "custom", "use custom linear solver", - "Determines which linear algebra package is to be used for the solution of the augmented linear system (for obtaining the search directions). " - "Note, the code must have been compiled with the linear solver you want to choose. " - "Depending on your Ipopt installation, not all options are available."); - roptions->SetRegisteringCategory("Linear Solver"); - roptions->AddStringOption3( + defaultsolver, + options, + descrs, + "Determines which linear algebra package is to be used for the solution of the augmented linear system (for obtaining the search directions)."); + + options.clear(); + descrs.clear(); + + std::string longdescr = + "Determines the method used to compute symmetric scaling factors for the augmented system " + "(see also the \"linear_scaling_on_demand\" option). " + "This scaling is independent of the NLP problem scaling."; + + options.push_back("none"); + descrs.push_back("no scaling will be performed"); + defaultsolver = "none"; + + if( availablesolvers & IPOPTLINEARSOLVER_MC19 ) + { + options.push_back("mc19"); + + if( availablesolverslinked & IPOPTLINEARSOLVER_MC19 ) + { + descrs.push_back("use the Harwell routine MC19"); + defaultsolver = "mc19"; + longdescr += " The default is MC19 only if MA27, MA57, MA77, or MA86 are selected as linear solvers. Otherwise it is 'none'."; + } + else + { + descrs.push_back("load the Harwell routine MC19 from library at runtime"); + } + } + + options.push_back("slack-based"); + descrs.push_back("use the slack values"); + + roptions->AddStringOption( "linear_system_scaling", "Method for scaling the linear system.", -#ifdef COINHSL_HAS_MC19 - "mc19", + defaultsolver, + options, descrs, + longdescr); + + // have hsllib option if some HSL solvers are not linked but can be loaded + if( (availablesolverslinked ^ availablesolvers) & IPOPTLINEARSOLVER_ALLHSL ) + roptions->AddStringOption1( + "hsllib", "Name of library containing HSL routines for load at runtime", + "libhsl." IPOPT_SHAREDLIBEXT, + "*", "Any acceptable filename (may contain path, too)"); + + roptions->AddStringOption1( + "pardisolib", "Name of library containing Pardiso routines (from pardiso-project.org) for load at runtime", +#ifdef PARDISO_LIB + PARDISO_LIB, #else - "none", + "libpardiso." IPOPT_SHAREDLIBEXT, #endif - "none", "no scaling will be performed", - "mc19", "use the Harwell routine MC19", - "slack-based", "use the slack values", - "Determines the method used to compute symmetric scaling factors for the augmented system " - "(see also the \"linear_scaling_on_demand\" option). " - "This scaling is independent of the NLP problem scaling. " - "By default, MC19 is only used if MA27 or MA57 are selected as linear solvers. " - "This value is only available if Ipopt has been compiled with MC19."); + "*", "Any acceptable filename (may contain path, too)"); roptions->SetRegisteringCategory("NLP Scaling"); - roptions->AddStringOption4( - "nlp_scaling_method", - "Select the technique used for scaling the NLP.", + + options.clear(); + descrs.clear(); + options.push_back("none"); + descrs.push_back("no problem scaling will be performed"); + options.push_back("user-scaling"); + descrs.push_back("scaling parameters will come from the user"); + options.push_back("gradient-based"); + descrs.push_back("scale the problem so the maximum gradient at the starting point is nlp_scaling_max_gradient"); + + if( availablesolvers & IPOPTLINEARSOLVER_MC19 ) + { + options.push_back("equilibration-based"); + descrs.push_back("scale the problem so that first derivatives are of order 1 at random points"); + if( availablesolverslinked & IPOPTLINEARSOLVER_MC19 ) + { + descrs.back() += " (uses Harwell routine MC19)"; + } + else + { + descrs.back() += " (load the Harwell routine MC19 from library at runtime)"; + } + } + roptions->AddStringOption( + "nlp_scaling_method", "Select the technique used for scaling the NLP.", "gradient-based", - "none", "no problem scaling will be performed", - "user-scaling", "scaling parameters will come from the user", - "gradient-based", "scale the problem so the maximum gradient at the starting point is scaling_max_gradient", - "equilibration-based", "scale the problem so that first derivatives are of order 1 at random points (only available with MC19)", + options, + descrs, "Selects the technique used for scaling the problem internally before it is solved. " - "For user-scaling, the parameters come from the NLP. " - "If you are using AMPL, they can be specified through suffixes (\"scaling_factor\")"); + "For user-scaling, the parameters come from the NLP." +#ifdef IPOPT_HAS_ASL + " If you are using AMPL, they can be specified through suffixes (\"scaling_factor\")" +#endif + ); roptions->SetRegisteringCategory("Barrier Parameter Update"); roptions->AddStringOption2( @@ -204,7 +386,9 @@ void AlgorithmBuilder::RegisterOptions( "Strategy for solving the augmented system for low-rank Hessian.", "sherman-morrison", "sherman-morrison", "use Sherman-Morrison formula", - "extended", "use an extended augmented system"); + "extended", "use an extended augmented system", + "", + true); roptions->SetRegisteringCategory("Line Search"); roptions->AddStringOption3( @@ -215,15 +399,15 @@ void AlgorithmBuilder::RegisterOptions( "cg-penalty", "Chen-Goldfarb penalty function", "penalty", "Standard penalty function", "Only the \"filter\" choice is officially supported. " - "But sometimes, good results might be obtained with the other choices."); + "But sometimes, good results might be obtained with the other choices.", + true); roptions->SetRegisteringCategory("Undocumented"); - roptions->AddStringOption2( + roptions->AddBoolOption( "wsmp_iterative", - "Switches to iterative solver in WSMP.", - "no", - "no", "use direct solver", - "yes", "use iterative solver", - "EXPERIMENTAL!"); + "Switches to use iterative instead of direct solver in WSMP.", + false, + "EXPERIMENTAL!", + true); } SmartPtr AlgorithmBuilder::GetSymLinearSolver( @@ -247,201 +431,100 @@ SmartPtr AlgorithmBuilder::SymLinearSolverFactory( ) { SmartPtr SolverInterface; - std::string linear_solver; options.GetStringValue("linear_solver", linear_solver, prefix); - if( linear_solver == "ma27" ) - { -#ifndef COINHSL_HAS_MA27 -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - SolverInterface = new Ma27TSolverInterface(); - if (!LSL_isMA27available()) - { - char buf[256]; - int rc = LSL_loadHSL(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear solver MA27 not available.\nTried to obtain MA27 from shared library \""; - errmsg += LSL_HSLLibraryName(); - errmsg += "\", but the following error occured:\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for MA27 has not been compiled into Ipopt."); -# endif -#else - SolverInterface = new Ma27TSolverInterface(); -#endif + if( false ) ; + +#ifndef IPOPT_INT64 + else if( linear_solver == "ma27" ) + { + SolverInterface = new Ma27TSolverInterface(GetHSLLoader(options, prefix)); } + else if( linear_solver == "ma57" ) { -#ifndef COINHSL_HAS_MA57 -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - SolverInterface = new Ma57TSolverInterface(); - if (!LSL_isMA57available()) - { - char buf[256]; - int rc = LSL_loadHSL(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear solver MA57 not available.\nTried to obtain MA57 from shared library \""; - errmsg += LSL_HSLLibraryName(); - errmsg += "\", but the following error occured:\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for MA57 has not been compiled into Ipopt."); -# endif -#else - SolverInterface = new Ma57TSolverInterface(); -#endif - + SolverInterface = new Ma57TSolverInterface(GetHSLLoader(options, prefix)); } + else if( linear_solver == "ma77" ) { -#ifndef COINHSL_HAS_MA77 -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - SolverInterface = new Ma77SolverInterface(); - if (!LSL_isMA77available()) - { - char buf[256]; - int rc = LSL_loadHSL(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear solver HSL_MA77 not available.\nTried to obtain HSL_MA77 from shared library \""; - errmsg += LSL_HSLLibraryName(); - errmsg += "\", but the following error occured:\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for HSL_MA77 has not been compiled into Ipopt."); -# endif -#else - SolverInterface = new Ma77SolverInterface(); -#endif - + SolverInterface = new Ma77SolverInterface(GetHSLLoader(options, prefix)); } + else if( linear_solver == "ma86" ) { -#ifndef COINHSL_HAS_MA86 -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - SolverInterface = new Ma86SolverInterface(); - if (!LSL_isMA86available()) - { - char buf[256]; - int rc = LSL_loadHSL(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear solver HSL_MA86 not available.\nTried to obtain HSL_MA86 from shared library \""; - errmsg += LSL_HSLLibraryName(); - errmsg += "\", but the following error occured:\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for HSL_MA86 has not been compiled into Ipopt."); -# endif -#else - SolverInterface = new Ma86SolverInterface(); -#endif + SolverInterface = new Ma86SolverInterface(GetHSLLoader(options, prefix)); + } + else if( linear_solver == "ma97" ) + { + SolverInterface = new Ma97SolverInterface(GetHSLLoader(options, prefix)); } + else if( linear_solver == "pardiso" ) { -#ifndef IPOPT_HAS_PARDISO -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - SolverInterface = new PardisoSolverInterface(); - char buf[256]; - int rc = LSL_loadPardisoLib(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear solver Pardiso not available.\nTried to obtain Pardiso from shared library \""; - errmsg += LSL_PardisoLibraryName(); - errmsg += "\", but the following error occured:\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for Pardiso has not been compiled into Ipopt."); -# endif -#else - SolverInterface = new PardisoSolverInterface(); + SolverInterface = new PardisoSolverInterface(GetPardisoLoader(options, prefix)); + } #endif - } - else if( linear_solver == "ma97" ) +#ifdef IPOPT_HAS_PARDISO_MKL + else if( linear_solver == "pardisomkl" ) { -#ifndef COINHSL_HAS_MA97 -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - SolverInterface = new Ma97SolverInterface(); - if (!LSL_isMA97available()) - { - char buf[256]; - int rc = LSL_loadHSL(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear solver HSL_MA97 not available.\nTried to obtain HSL_MA97 from shared library \""; - errmsg += LSL_HSLLibraryName(); - errmsg += "\", but the following error occured:\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for HSL_MA97 has not been compiled into Ipopt."); -# endif -#else - SolverInterface = new Ma97SolverInterface(); + SolverInterface = new PardisoMKLSolverInterface(); + } #endif +#ifdef IPOPT_HAS_SPRAL + else if( linear_solver == "spral" ) + { + SolverInterface = new SpralSolverInterface(); } +#endif + +#ifdef IPOPT_HAS_WSMP else if( linear_solver == "wsmp" ) { -#ifdef HAVE_WSMP bool wsmp_iterative; options.GetBoolValue("wsmp_iterative", wsmp_iterative, prefix); - if (wsmp_iterative) + if( wsmp_iterative ) { SolverInterface = new IterativeWsmpSolverInterface(); } else { +#ifdef PARDISO_MATCHING_PREPROCESS + SolverInterface = new WsmpSolverInterface(GetPardisoLoader(options, prefix)); +#else SolverInterface = new WsmpSolverInterface(); +#endif } -#else - - THROW_EXCEPTION(OPTION_INVALID, "Selected linear solver WSMP not available."); + int V, R, M; + WsmpSolverInterface::GetVersion(V, R, M); + char buffer[100]; + Snprintf(buffer, 100, "WSMP %d.%d.%d\n", V, R, M); + linear_solver = buffer; + } #endif - } +#ifdef IPOPT_HAS_MUMPS else if( linear_solver == "mumps" ) { -#ifdef IPOPT_HAS_MUMPS SolverInterface = new MumpsSolverInterface(); -#else - - THROW_EXCEPTION(OPTION_INVALID, "Selected linear solver MUMPS not available."); + linear_solver = MumpsSolverInterface::GetName(); + } #endif - } else if( linear_solver == "custom" ) { SolverInterface = NULL; } + else + { + // this should have been checked earlier + THROW_EXCEPTION(OPTION_INVALID, "Invalid value selected for option linear_solver"); + } + SmartPtr ScalingMethod; std::string linear_system_scaling; if( !options.GetStringValue("linear_system_scaling", linear_system_scaling, prefix) ) @@ -452,35 +535,17 @@ SmartPtr AlgorithmBuilder::SymLinearSolverFactory( linear_system_scaling = "none"; } } - if( linear_system_scaling == "mc19" ) - { -#ifndef COINHSL_HAS_MC19 -# ifdef IPOPT_HAS_LINEARSOLVERLOADER - ScalingMethod = new Mc19TSymScalingMethod(); - if (!LSL_isMC19available()) - { - char buf[256]; - int rc = LSL_loadHSL(NULL, buf, 255); - if (rc) - { - std::string errmsg; - errmsg = "Selected linear system scaling method MC19 not available.\n"; - errmsg += buf; - THROW_EXCEPTION(OPTION_INVALID, errmsg.c_str()); - } - } -# else - THROW_EXCEPTION(OPTION_INVALID, "Support for MC19 has not been compiled into Ipopt."); -# endif -#else - ScalingMethod = new Mc19TSymScalingMethod(); -#endif - } - else if( linear_system_scaling == "slack-based" ) + if( linear_system_scaling == "slack-based" ) { ScalingMethod = new SlackBasedTSymScalingMethod(); } +#ifndef IPOPT_INT64 + else if( linear_system_scaling == "mc19" ) + { + ScalingMethod = new Mc19TSymScalingMethod(GetHSLLoader(options, prefix)); + } +#endif SmartPtr ScaledSolver = new TSymLinearSolver(SolverInterface, ScalingMethod); return ScaledSolver; @@ -507,12 +572,15 @@ SmartPtr AlgorithmBuilder::AugSystemSolverFactory( ) { SmartPtr AugSolver; - std::string linear_solver; options.GetStringValue("linear_solver", linear_solver, prefix); if( linear_solver == "custom" ) { ASSERT_EXCEPTION(IsValid(custom_solver_), OPTION_INVALID, "Selected linear solver CUSTOM not available."); AugSolver = custom_solver_; + if( !custom_solver_name_.empty() ) + { + linear_solver = custom_solver_name_; + } } else { @@ -620,15 +688,13 @@ void AlgorithmBuilder::BuildIpoptObjects( } else if( nlp_scaling_method == "equilibration-based" ) { - nlp_scaling = new EquilibrationScaling(nlp); + nlp_scaling = new EquilibrationScaling(nlp, GetHSLLoader(options, prefix)); } else { nlp_scaling = new NoNLPScalingObject(); } - ip_nlp = new OrigIpoptNLP(&jnlst, GetRawPtr(nlp), nlp_scaling); - // Create the IpoptData. Check if there is additional data that // is needed std::string lsmethod; @@ -640,6 +706,8 @@ void AlgorithmBuilder::BuildIpoptObjects( } ip_data = new IpoptData(add_data); + ip_nlp = new OrigIpoptNLP(&jnlst, GetRawPtr(nlp), nlp_scaling, ip_data->TimingStats()); + // Create the IpoptCalculators. Check if there are additional // calculated quantities that are needed ip_cq = new IpoptCalculatedQuantities(ip_nlp, ip_data); @@ -687,7 +755,7 @@ SmartPtr AlgorithmBuilder::BuildBasicAlgorithm( MuUpdate_ = BuildMuUpdate(jnlst, options, prefix); SmartPtr alg = new IpoptAlgorithm(SearchDirCalc_, LineSearch_, MuUpdate_, ConvCheck_, - IterInitializer_, IterOutput_, HessUpdater_, EqMultCalculator_); + IterInitializer_, IterOutput_, HessUpdater_, EqMultCalculator_, linear_solver); return alg; } @@ -940,7 +1008,7 @@ SmartPtr AlgorithmBuilder::BuildLineSearch( SmartPtr resto_alg = new IpoptAlgorithm(resto_SearchDirCalc, GetRawPtr(resto_LineSearch), GetRawPtr(resto_MuUpdate), GetRawPtr(resto_convCheck), resto_IterInitializer, resto_IterOutput, - resto_HessUpdater, resto_EqMultCalculator); + resto_HessUpdater, resto_EqMultCalculator, linear_solver); // Set the restoration phase resto_phase = new MinC_1NrmRestorationPhase(*resto_alg, EqMultCalculator_); @@ -1064,4 +1132,42 @@ SmartPtr AlgorithmBuilder::BuildMuUpdate( return MuUpdate; } +SmartPtr AlgorithmBuilder::GetHSLLoader( + const OptionsList& options, + const std::string& prefix +) +{ + if( !IsValid(hslloader) ) + { + IpoptLinearSolver availablesolvers = IpoptGetAvailableLinearSolvers(false); + IpoptLinearSolver availablesolverslinked = IpoptGetAvailableLinearSolvers(true); + + // we don't have the hsllib option if linked against all hsl routines + // but then we also don't use the hslloader, so can return NULL + if( (availablesolverslinked ^ availablesolvers) & IPOPTLINEARSOLVER_ALLHSL ) + { + std::string libname; + options.GetStringValue("hsllib", libname, prefix); + hslloader = new LibraryLoader(libname); + } + } + + return hslloader; +} + +SmartPtr AlgorithmBuilder::GetPardisoLoader( + const OptionsList& options, + const std::string& prefix +) +{ + if( !IsValid(pardisoloader) ) + { + std::string libname; + options.GetStringValue("pardisolib", libname, prefix); + pardisoloader = new LibraryLoader(libname); + } + + return pardisoloader; +} + } // namespace diff --git a/src/Algorithm/IpAlgBuilder.hpp b/src/Algorithm/IpAlgBuilder.hpp index 055748d7e..9965bd604 100644 --- a/src/Algorithm/IpAlgBuilder.hpp +++ b/src/Algorithm/IpAlgBuilder.hpp @@ -11,6 +11,7 @@ #include "IpReferenced.hpp" #include "IpAugSystemSolver.hpp" #include "IpPDSystemSolver.hpp" +#include "IpLibraryLoader.hpp" namespace Ipopt { @@ -49,25 +50,26 @@ class IPOPTLIB_EXPORT AlgorithmBuilder: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ AlgorithmBuilder( - SmartPtr custom_solver = NULL + SmartPtr custom_solver = NULL, /**< custom linear solver interface object */ + const std::string& custom_solver_name = std::string() /**< name of custom linear solver (since 3.14.12) */ ); /** Destructor */ virtual ~AlgorithmBuilder() { } - //@} + ///@} /** Methods for IpoptTypeInfo */ - //@{ + ///@{ /** register the options used by the algorithm builder */ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} /** @name Convenience methods for building solvers without having * to duplicate the significant amount of preprocessor flag and @@ -78,7 +80,7 @@ class IPOPTLIB_EXPORT AlgorithmBuilder: public ReferencedObject * vary. Therefore, each of the Factory methods below is paired * with a Getter method, which is called by all parts of this * algorithm builder to ensure the Factory is only called once. */ - //@{ + ///@{ /** Create a solver that can be used to solve a symmetric linear * system. * Dependencies: None @@ -149,10 +151,10 @@ class IPOPTLIB_EXPORT AlgorithmBuilder: public ReferencedObject const OptionsList& options, const std::string& prefix ); - //@} + ///@} /** @name Methods to build parts of the algorithm */ - //@{ + ///@{ /** Allocates memory for the IpoptNLP, IpoptData, and * IpoptCalculatedQuanties arguments. * Dependencies: None @@ -326,7 +328,26 @@ class IPOPTLIB_EXPORT AlgorithmBuilder: public ReferencedObject const OptionsList& options, const std::string& prefix ); - //@} + ///@} + +protected: + /// Gives Library Loader for HSL library if not all HSL routines are linked in + /// + /// Creates new loader if not existing yet. + /// @since 3.14.0 + SmartPtr GetHSLLoader( + const OptionsList& options, + const std::string& prefix + ); + + /// Gives Library Loader for Pardiso library from pardiso-project.org. + /// + /// Creates new loader if not existing yet. + /// @since 3.14.0 + SmartPtr GetPardisoLoader( + const OptionsList& options, + const std::string& prefix + ); private: /**@name Default Compiler Generated Methods @@ -336,7 +357,7 @@ class IPOPTLIB_EXPORT AlgorithmBuilder: public ReferencedObject * 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 */ //AlgorithmBuilder(); @@ -349,7 +370,7 @@ class IPOPTLIB_EXPORT AlgorithmBuilder: public ReferencedObject void operator=( const AlgorithmBuilder& ); - //@} + ///@} /** @name IpoptAlgorithm constructor arguments. * These components are built in separate Build @@ -358,7 +379,7 @@ class IPOPTLIB_EXPORT AlgorithmBuilder: public ReferencedObject * other core components in its constructor, so the * this class holds pointers to each component for use * between the separate Build methods. */ - //@{ + ///@{ SmartPtr IterOutput_; SmartPtr HessUpdater_; SmartPtr ConvCheck_; @@ -367,21 +388,30 @@ class IPOPTLIB_EXPORT AlgorithmBuilder: public ReferencedObject SmartPtr IterInitializer_; SmartPtr LineSearch_; SmartPtr MuUpdate_; - //@} + ///@} /** @name Commonly used solver components * for building core algorithm components. Each * of these members is paired with a Factory/Getter * method. */ - //@{ + ///@{ SmartPtr SymSolver_; SmartPtr AugSolver_; SmartPtr PDSolver_; - //@} + ///@} /** Optional pointer to AugSystemSolver. If this is set in the - * contructor, we will use this to solve the linear systems. */ + * constructor, we will use this to solve the linear systems. */ SmartPtr custom_solver_; + std::string custom_solver_name_; + + /// name of linear solver constructed in SymLinearSolverFactory + std::string linear_solver; + + /// loader of HSL library (at runtime) + SmartPtr hslloader; + /// loader of Pardiso library (at runtime) + SmartPtr pardisoloader; }; } // namespace Ipopt diff --git a/src/Algorithm/IpAlgStrategy.hpp b/src/Algorithm/IpAlgStrategy.hpp index 2208b0d23..c2668b43f 100644 --- a/src/Algorithm/IpAlgStrategy.hpp +++ b/src/Algorithm/IpAlgStrategy.hpp @@ -35,7 +35,7 @@ class IPOPTLIB_EXPORT AlgorithmStrategyObject: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ AlgorithmStrategyObject() : initialize_called_(false) @@ -44,7 +44,7 @@ class IPOPTLIB_EXPORT AlgorithmStrategyObject: public ReferencedObject /** Destructor */ virtual ~AlgorithmStrategyObject() { } - //@} + ///@} /** This method is called every time the algorithm starts again - * it is used to reset any internal state. @@ -129,7 +129,7 @@ class IPOPTLIB_EXPORT AlgorithmStrategyObject: public ReferencedObject * * Those should be used by the derived classes. */ - //@{ + ///@{ const Journalist& Jnlst() const { DBG_ASSERT(initialize_called_); @@ -157,7 +157,7 @@ class IPOPTLIB_EXPORT AlgorithmStrategyObject: public ReferencedObject { return IsValid(ip_data_); } - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -169,7 +169,7 @@ class IPOPTLIB_EXPORT AlgorithmStrategyObject: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ //AlgorithmStrategyObject(); @@ -182,15 +182,15 @@ class IPOPTLIB_EXPORT AlgorithmStrategyObject: public ReferencedObject void operator=( const AlgorithmStrategyObject& ); - //@} + ///@} /** @name Pointers to objects defining a particular optimization problem */ - //@{ + ///@{ SmartPtr jnlst_; SmartPtr ip_nlp_; SmartPtr ip_data_; SmartPtr ip_cq_; - //@} + ///@} /** flag indicating if Initialize method has been called (for debugging) */ bool initialize_called_; diff --git a/src/Algorithm/IpAlgorithmRegOp.cpp b/src/Algorithm/IpAlgorithmRegOp.cpp index abb4442ec..b37b74889 100644 --- a/src/Algorithm/IpAlgorithmRegOp.cpp +++ b/src/Algorithm/IpAlgorithmRegOp.cpp @@ -47,7 +47,7 @@ void RegisterOptions_Algorithm( AdaptiveMuUpdate::RegisterOptions(roptions); roptions->SetRegisteringCategory("Initialization"); DefaultIterateInitializer::RegisterOptions(roptions); - roptions->SetRegisteringCategory("Main Algorithm"); + roptions->SetRegisteringCategory(""); AlgorithmBuilder::RegisterOptions(roptions); roptions->SetRegisteringCategory("Line Search"); BacktrackingLineSearch::RegisterOptions(roptions); @@ -61,17 +61,17 @@ void RegisterOptions_Algorithm( GradientScaling::RegisterOptions(roptions); roptions->SetRegisteringCategory("NLP Scaling"); EquilibrationScaling::RegisterOptions(roptions); - roptions->SetRegisteringCategory("Uncategorized"); + roptions->SetRegisteringCategory(""); IpoptAlgorithm::RegisterOptions(roptions); - roptions->SetRegisteringCategory("Uncategorized"); + roptions->SetRegisteringCategory(""); IpoptData::RegisterOptions(roptions); - roptions->SetRegisteringCategory("Uncategorized"); + roptions->SetRegisteringCategory(""); IpoptCalculatedQuantities::RegisterOptions(roptions); roptions->SetRegisteringCategory("Hessian Approximation"); LimMemQuasiNewtonUpdater::RegisterOptions(roptions); roptions->SetRegisteringCategory("Barrier Parameter Update"); MonotoneMuUpdate::RegisterOptions(roptions); - roptions->SetRegisteringCategory("Convergence"); + roptions->SetRegisteringCategory("Termination"); OptimalityErrorConvergenceCheck::RegisterOptions(roptions); roptions->SetRegisteringCategory("NLP"); OrigIpoptNLP::RegisterOptions(roptions); diff --git a/src/Algorithm/IpAugRestoSystemSolver.cpp b/src/Algorithm/IpAugRestoSystemSolver.cpp index d0a930ff3..96b329e66 100644 --- a/src/Algorithm/IpAugRestoSystemSolver.cpp +++ b/src/Algorithm/IpAugRestoSystemSolver.cpp @@ -59,17 +59,17 @@ bool AugRestoSystemSolver::InitializeImpl( ESymSolverStatus AugRestoSystemSolver::Solve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& rhs_x, const Vector& rhs_s, const Vector& rhs_c, @@ -200,12 +200,12 @@ ESymSolverStatus AugRestoSystemSolver::Solve( { // We seem to be in the regular situation with exact second // derivatives - double temp_factor; + Number temp_factor; WR_sum->GetTerm(0, temp_factor, h_orig); DBG_ASSERT(temp_factor == 1. || temp_factor == 0.); orig_W_factor = temp_factor * W_factor; SmartPtr eta_DR; - double factor; + Number factor; WR_sum->GetTerm(1, factor, eta_DR); SmartPtr wr_d = static_cast(GetRawPtr(eta_DR))->GetDiag(); diff --git a/src/Algorithm/IpAugRestoSystemSolver.hpp b/src/Algorithm/IpAugRestoSystemSolver.hpp index 579ffa5b6..a41c32695 100644 --- a/src/Algorithm/IpAugRestoSystemSolver.hpp +++ b/src/Algorithm/IpAugRestoSystemSolver.hpp @@ -24,7 +24,7 @@ class AugRestoSystemSolver: public AugSystemSolver { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * Here, orig_aug_solver is the object for solving @@ -41,7 +41,7 @@ class AugRestoSystemSolver: public AugSystemSolver /** Destructor */ virtual ~AugRestoSystemSolver(); - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ bool InitializeImpl( @@ -55,17 +55,17 @@ class AugRestoSystemSolver: public AugSystemSolver */ virtual ESymSolverStatus Solve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& rhs_x, const Vector& rhs_s, const Vector& rhs_c, @@ -117,7 +117,7 @@ class AugRestoSystemSolver: public AugSystemSolver * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ AugRestoSystemSolver(); @@ -130,10 +130,10 @@ class AugRestoSystemSolver: public AugSystemSolver void operator=( const AugRestoSystemSolver& ); - //@} + ///@} /**@name Caches for some of the necessary calculated quantities */ - //@{ + ///@{ CachedResults > neg_omega_c_plus_D_c_cache_; CachedResults > neg_omega_d_plus_D_d_cache_; CachedResults > sigma_tilde_n_c_inv_cache_; @@ -143,10 +143,10 @@ class AugRestoSystemSolver: public AugSystemSolver CachedResults > d_x_plus_wr_d_cache_; CachedResults > rhs_cR_cache_; CachedResults > rhs_dR_cache_; - //@} + ///@} /**@name Methods to calculate the cached quantities */ - //@{ + ///@{ SmartPtr Neg_Omega_c_plus_D_c( const SmartPtr& sigma_tilde_n_c_inv, const SmartPtr& sigma_tilde_p_c_inv, @@ -211,7 +211,7 @@ class AugRestoSystemSolver: public AugSystemSolver const Vector& rhs_p_d, const Matrix& pd_U ); - //@} + ///@} SmartPtr orig_aug_solver_; bool skip_orig_aug_solver_init_; diff --git a/src/Algorithm/IpAugSystemSolver.hpp b/src/Algorithm/IpAugSystemSolver.hpp index 2ca654e03..38d44f246 100644 --- a/src/Algorithm/IpAugSystemSolver.hpp +++ b/src/Algorithm/IpAugSystemSolver.hpp @@ -37,14 +37,14 @@ class IPOPTLIB_EXPORT AugSystemSolver: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default constructor. */ AugSystemSolver() { } /** Destructor */ virtual ~AugSystemSolver() { } - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -62,17 +62,17 @@ class IPOPTLIB_EXPORT AugSystemSolver: public AlgorithmStrategyObject */ virtual ESymSolverStatus Solve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& rhs_x, const Vector& rhs_s, const Vector& rhs_c, @@ -112,17 +112,17 @@ class IPOPTLIB_EXPORT AugSystemSolver: public AlgorithmStrategyObject */ virtual ESymSolverStatus MultiSolve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, std::vector >& rhs_xV, std::vector >& rhs_sV, std::vector >& rhs_cV, @@ -193,7 +193,7 @@ class IPOPTLIB_EXPORT AugSystemSolver: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ AugSystemSolver( const AugSystemSolver& @@ -203,7 +203,7 @@ class IPOPTLIB_EXPORT AugSystemSolver: public AlgorithmStrategyObject void operator=( const AugSystemSolver& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpBacktrackingLSAcceptor.hpp b/src/Algorithm/IpBacktrackingLSAcceptor.hpp index e498f3854..54b70d2e2 100644 --- a/src/Algorithm/IpBacktrackingLSAcceptor.hpp +++ b/src/Algorithm/IpBacktrackingLSAcceptor.hpp @@ -19,7 +19,7 @@ class BacktrackingLSAcceptor: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. */ BacktrackingLSAcceptor() { } @@ -27,7 +27,7 @@ class BacktrackingLSAcceptor: public AlgorithmStrategyObject /** Destructor */ virtual ~BacktrackingLSAcceptor() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -183,11 +183,11 @@ class BacktrackingLSAcceptor: public AlgorithmStrategyObject } /** Methods for OptionsList */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -199,7 +199,7 @@ class BacktrackingLSAcceptor: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ BacktrackingLSAcceptor( const BacktrackingLSAcceptor& @@ -209,7 +209,7 @@ class BacktrackingLSAcceptor: public AlgorithmStrategyObject void operator=( const BacktrackingLSAcceptor& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpBacktrackingLineSearch.cpp b/src/Algorithm/IpBacktrackingLineSearch.cpp index 112aa374c..6782ac590 100644 --- a/src/Algorithm/IpBacktrackingLineSearch.cpp +++ b/src/Algorithm/IpBacktrackingLineSearch.cpp @@ -10,6 +10,7 @@ #include "IpJournalist.hpp" #include "IpRestoPhase.hpp" #include "IpAlgTypes.hpp" +#include "IpOrigIpoptNLP.hpp" #include #include @@ -27,6 +28,7 @@ BacktrackingLineSearch::BacktrackingLineSearch( const SmartPtr& conv_check ) : LineSearch(), + in_watchdog_(false), acceptor_(acceptor), resto_phase_(resto_phase), conv_check_(conv_check) @@ -52,37 +54,36 @@ void BacktrackingLineSearch::RegisterOptions( 0.0, true, 1.0, true, 0.5, - "At every step of the backtracking line search, the trial step size is reduced by this factor."); + "At every step of the backtracking line search, the trial step size is reduced by this factor.", + true); - std::string prev_category = roptions->RegisteringCategory(); + SmartPtr prev_category = roptions->RegisteringCategory(); roptions->SetRegisteringCategory("Undocumented"); - roptions->AddStringOption2( + roptions->AddBoolOption( "magic_steps", "Enables magic steps.", - "no", - "no", "don't take magic steps", - "yes", "take magic steps", - "DOESN'T REALLY WORK YET!"); + false, + "DOESN'T REALLY WORK YET!", + true); roptions->SetRegisteringCategory(prev_category); - roptions->AddStringOption2( + roptions->AddBoolOption( "accept_every_trial_step", "Always accept the first trial step.", - "no", - "no", "don't arbitrarily accept the full step", - "yes", "always accept the full step", + false, "Setting this option to \"yes\" essentially disables the line search and " "makes the algorithm take aggressive steps, without global convergence guarantees."); roptions->AddLowerBoundedIntegerOption( "accept_after_max_steps", - "Accept a trial point after maximal this number of steps.", + "Accept a trial point after maximal this number of steps even if it does not satisfy line search conditions.", -1, -1, - "Even if it does not satisfy line search conditions."); + "Setting this to -1 disables this option.", + true); roptions->AddStringOption10( "alpha_for_y", - "Method to determine the step size for constraint multipliers.", + "Method to determine the step size for constraint multipliers (alpha_y) .", "primal", "primal", "use primal step size", "bound-mult", "use step size for the bound multipliers (good for LPs)", @@ -93,8 +94,7 @@ void BacktrackingLineSearch::RegisterOptions( "safer-min-dual-infeas", "like \"min_dual_infeas\", but safeguarded by \"min\" and \"max\"", "primal-and-full", "use the primal step size, and full step if delta_x <= alpha_for_y_tol", "dual-and-full", "use the dual step size, and full step if delta_x <= alpha_for_y_tol", - "acceptor", "Call LSAcceptor to get step size for y", - "This option determines how the step size (alpha_y) will be calculated when updating the constraint multipliers."); + "acceptor", "Call LSAcceptor to get step size for y"); roptions->AddLowerBoundedNumberOption( "alpha_for_y_tol", "Tolerance for switching to full equality multiplier steps.", @@ -107,11 +107,12 @@ void BacktrackingLineSearch::RegisterOptions( "tiny_step_tol", "Tolerance for detecting numerically insignificant steps.", 0.0, false, - 10.0 * std::numeric_limits::epsilon(), + 10.0 * std::numeric_limits::epsilon(), "If the search direction in the primal variables (x and s) is, in relative terms for each component, " "less than this value, the algorithm accepts the full step without line search. " "If this happens repeatedly, the algorithm will terminate with a corresponding exit message. " - "The default value is 10 times machine precision."); + "The default value is 10 times machine precision.", + true); roptions->AddLowerBoundedNumberOption( "tiny_step_y_tol", "Tolerance for quitting because of numerically insignificant steps.", @@ -119,7 +120,8 @@ void BacktrackingLineSearch::RegisterOptions( 1e-2, "If the search direction in the primal variables (x and s) is, " "in relative terms for each component, repeatedly less than tiny_step_tol, and " - "the step in the y variables is smaller than this threshold, the algorithm will terminate."); + "the step in the y variables is smaller than this threshold, the algorithm will terminate.", + true); roptions->AddLowerBoundedIntegerOption( "watchdog_shortened_iter_trigger", "Number of shortened iterations that trigger the watchdog.", @@ -137,12 +139,10 @@ void BacktrackingLineSearch::RegisterOptions( "procedure is aborted and the algorithm returns to the stored point."); roptions->SetRegisteringCategory("Restoration Phase"); - roptions->AddStringOption2( + roptions->AddBoolOption( "expect_infeasible_problem", "Enable heuristics to quickly detect an infeasible problem.", - "no", - "no", "the problem probably be feasible", - "yes", "the problem has a good chance to be infeasible", + false, "This options is meant to activate heuristics that may speed up the infeasibility determination " "if you expect that there is a good chance for the problem to be infeasible. " "In the filter line search procedure, the restoration phase is called more quickly than usually, " @@ -163,12 +163,10 @@ void BacktrackingLineSearch::RegisterOptions( 1e8, "If the max norm of the constraint multipliers becomes larger than this value and " "\"expect_infeasible_problem\" is chosen, then the restoration phase is entered."); - roptions->AddStringOption2( + roptions->AddBoolOption( "start_with_resto", - "Tells algorithm to switch to restoration phase in first iteration.", - "no", - "no", "don't force start in restoration phase", - "yes", "force start in restoration phase", + "Whether to switch to restoration phase in first iteration.", + false, "Setting this option to \"yes\" forces the algorithm to switch to the feasibility restoration phase in the first iteration. " "If the initial point is feasible, the algorithm will abort with a failure."); roptions->AddLowerBoundedNumberOption( @@ -186,7 +184,8 @@ void BacktrackingLineSearch::RegisterOptions( 0, 10, "If the soft restoration phase is performed for more than so many iterations in a row, " - "the regular restoration phase is called."); + "the regular restoration phase is called.", + true); } bool BacktrackingLineSearch::InitializeImpl( @@ -211,6 +210,7 @@ bool BacktrackingLineSearch::InitializeImpl( options.GetBoolValue("expect_infeasible_problem", expect_infeasible_problem_, prefix); options.GetBoolValue("start_with_resto", start_with_resto_, prefix); + options.GetNumericValue("constr_viol_tol", constr_viol_tol_, prefix); options.GetNumericValue("tiny_step_tol", tiny_step_tol_, prefix); options.GetNumericValue("tiny_step_y_tol", tiny_step_y_tol_, prefix); @@ -254,7 +254,7 @@ void BacktrackingLineSearch::FindAcceptableTrialPoint() DBG_START_METH("BacktrackingLineSearch::FindAcceptableTrialPoint", dbg_verbosity); Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "--> Starting line search in iteration %d <--\n", IpData().iter_count()); + "--> Starting line search in iteration %" IPOPT_INDEX_FORMAT " <--\n", IpData().iter_count()); Number curr_mu = IpData().curr_mu(); if( last_mu_ != curr_mu ) @@ -280,7 +280,7 @@ void BacktrackingLineSearch::FindAcceptableTrialPoint() } // Store current iterate if the optimality error is on acceptable - // level to restored if things fail later + // level to be restored if things fail later if( CurrentIsAcceptable() ) { Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, @@ -304,24 +304,21 @@ void BacktrackingLineSearch::FindAcceptableTrialPoint() { goto_resto = true; } + else if( acceptor_->DoFallback() ) + { + in_watchdog_ = false; + watchdog_iterate_ = NULL; + watchdog_delta_ = NULL; + count_successive_shortened_steps_ = 0; + watchdog_shortened_iter_ = 0; + IpData().Set_info_alpha_primal_char('X'); + fallback_activated_ = false; + return; + } else { - if( acceptor_->DoFallback() ) - { - in_watchdog_ = false; - watchdog_iterate_ = NULL; - watchdog_delta_ = NULL; - count_successive_shortened_steps_ = 0; - watchdog_shortened_iter_ = 0; - IpData().Set_info_alpha_primal_char('X'); - fallback_activated_ = false; - return; - } - else - { - THROW_EXCEPTION(RESTORATION_FAILED, - "We are in an emergency mode, but not restoration phase or other fall back is available."); - } + THROW_EXCEPTION(STEP_COMPUTATION_FAILED, + "We are in an emergency mode, but no restoration phase or other fall back is available."); } fallback_activated_ = false; // reset the flag } @@ -342,14 +339,13 @@ void BacktrackingLineSearch::FindAcceptableTrialPoint() } if( expect_infeasible_problem_ - && Max(IpData().curr()->y_c()->Amax(), IpData().curr()->y_d()->Amax()) > expect_infeasible_problem_ytol_ ) + && IsValid(resto_phase_) + && Max(IpData().curr()->y_c()->Amax(), IpData().curr()->y_d()->Amax()) > expect_infeasible_problem_ytol_) { goto_resto = true; } bool accept = false; - bool corr_taken = false; - bool soc_taken = false; Index n_steps = 0; Number alpha_primal = 0.; @@ -466,6 +462,8 @@ void BacktrackingLineSearch::FindAcceptableTrialPoint() bool evaluation_error; while( !done ) { + bool corr_taken = false; + bool soc_taken = false; accept = DoBacktrackingLineSearch(skip_first_trial_point, alpha_primal, corr_taken, soc_taken, n_steps, evaluation_error, actual_delta); DBG_PRINT((1, "evaluation_error = %d\n", evaluation_error)); @@ -566,25 +564,28 @@ void BacktrackingLineSearch::FindAcceptableTrialPoint() { THROW_EXCEPTION(IpoptException, "No Restoration Phase given to this Backtracking Line Search Object!"); } + // ToDo make the 1e-2 below a parameter? - if( IpCq().curr_constraint_violation() <= 1e-2 * IpData().tol() ) + // added second criteria to cover cases where tol has been set to a large value + if( IpCq().curr_constraint_violation() <= 1e-2 * IpData().tol() && + IpCq().unscaled_curr_nlp_constraint_violation(NORM_MAX) <= 1e-1 * constr_viol_tol_ ) { bool found_acceptable = RestoreAcceptablePoint(); if( found_acceptable ) { Jnlst().Printf(J_WARNING, J_LINE_SEARCH, - "Restoration phase is called at almost feasible point,\n but acceptable point from iteration %d could be restored.\n", + "Cannot call restoration phase at almost feasible point,\nbut acceptable point from iteration %" IPOPT_INDEX_FORMAT " could be restored.\n", acceptable_iteration_number_); THROW_EXCEPTION(ACCEPTABLE_POINT_REACHED, "Restoration phase called at almost feasible point, but acceptable point could be restored.\n"); } else { - // ToDo does that happen too often? Jnlst().Printf(J_STRONGWARNING, J_LINE_SEARCH, - "Restoration phase is called at point that is almost feasible,\n with constraint violation %e. Abort.\n", - IpCq().curr_constraint_violation()); - THROW_EXCEPTION(RESTORATION_FAILED, "Restoration phase called, but point is almost feasible."); + "Cannot call restoration phase at point that is almost feasible %s(violation %e).\nAbort in line search due to no other fall back.\n", + dynamic_cast(GetRawPtr(IpCq().GetIpoptNLP())) == NULL ? "for the restoration NLP " : "", + IpCq().unscaled_curr_nlp_constraint_violation(NORM_MAX)); + THROW_EXCEPTION(STEP_COMPUTATION_FAILED, "Linesearch failed, but no restoration phase or other fall back is available."); } } @@ -723,7 +724,7 @@ bool BacktrackingLineSearch::DoBacktrackingLineSearch( if( !accept ) { - // Loop over decreaseing step sizes until acceptable point is + // Loop over decreasing step sizes until acceptable point is // found or until step size becomes too small while( alpha_primal > alpha_min || n_steps == 0 ) @@ -886,6 +887,16 @@ void BacktrackingLineSearch::StopWatchDog( acceptor_->StopWatchDog(); } +void BacktrackingLineSearch::StopWatchDog() +{ + if( !in_watchdog_ ) + { + return; + } + SmartPtr actual_delta; + StopWatchDog(actual_delta); +} + void BacktrackingLineSearch::Reset() { DBG_START_FUN("BacktrackingLineSearch::Reset", dbg_verbosity); @@ -961,8 +972,7 @@ void BacktrackingLineSearch::PerformDualStep( SmartPtr new_jac_times_delta_y = IpData().curr()->x()->MakeNew(); new_jac_times_delta_y->AddTwoVectors(1., *IpCq().trial_jac_cT_times_vec(*delta->y_c()), 1., *IpCq().trial_jac_dT_times_vec(*delta->y_d()), 0.); - - Number a = pow(new_jac_times_delta_y->Nrm2(), 2.) + pow(delta->y_d()->Nrm2(), 2.); + Number a = std::pow(new_jac_times_delta_y->Nrm2(), 2.) + std::pow(delta->y_d()->Nrm2(), 2.); Number b = dual_inf_x->Dot(*new_jac_times_delta_y) - dual_inf_s->Dot(*delta->y_d()); Number alpha = -b / a; @@ -973,7 +983,7 @@ void BacktrackingLineSearch::PerformDualStep( } else { - alpha_y = Min(1., Max(0., alpha)); + alpha_y = Min(Number(1.), Max(Number(0.), alpha)); } break; } //switch (alpha_for_y) diff --git a/src/Algorithm/IpBacktrackingLineSearch.hpp b/src/Algorithm/IpBacktrackingLineSearch.hpp index 050c476bc..0c4afa465 100644 --- a/src/Algorithm/IpBacktrackingLineSearch.hpp +++ b/src/Algorithm/IpBacktrackingLineSearch.hpp @@ -36,7 +36,7 @@ class BacktrackingLineSearch: public LineSearch { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * The acceptor implements the acceptance test for @@ -55,7 +55,7 @@ class BacktrackingLineSearch: public LineSearch /** Destructor */ virtual ~BacktrackingLineSearch(); - //@} + ///@} /** InitializeImpl - overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -112,12 +112,19 @@ class BacktrackingLineSearch: public LineSearch */ virtual bool ActivateFallbackMechanism(); + /** Stop watch dog if started and restore iterate from before watchdog started. + * + * This method is intended to be called if Ipopt is interrupted during the watchdog pahase. + * @since 3.14.0 + */ + void StopWatchDog(); + /** Methods for OptionsList */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -129,7 +136,7 @@ class BacktrackingLineSearch: public LineSearch * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ BacktrackingLineSearch( const BacktrackingLineSearch& @@ -139,7 +146,7 @@ class BacktrackingLineSearch: public LineSearch void operator=( const BacktrackingLineSearch& ); - //@} + ///@} /** Method performing the backtracking line search. * @@ -283,7 +290,7 @@ class BacktrackingLineSearch: public LineSearch * * Names as in the paper. */ - //@{ + ///@{ /** factor by which search direction is to be shortened if trial * point is rejected. */ Number alpha_red_factor_; @@ -384,10 +391,13 @@ class BacktrackingLineSearch: public LineSearch * restoration phase. */ bool start_with_resto_; - //@} + + /** unscaled constraint violation tolerance */ + Number constr_viol_tol_; + ///@} /** @name Information related to watchdog procedure */ - //@{ + ///@{ /** Flag indicating if the watchdog is active */ bool in_watchdog_; /** Counter for shortened iterations. */ @@ -402,14 +412,14 @@ class BacktrackingLineSearch: public LineSearch SmartPtr watchdog_delta_; /** Barrier parameter value during last line search */ Number last_mu_; - //@} + ///@} /** @name Storage for last iterate that satisfies the acceptable * level of optimality error. */ - //@{ + ///@{ SmartPtr acceptable_iterate_; Index acceptable_iteration_number_; - //@} + ///@} /** Flag indicating whether the algorithm has asked to immediately * switch to the fallback mechanism (restoration phase) @@ -446,11 +456,11 @@ class BacktrackingLineSearch: public LineSearch bool tiny_step_last_iteration_; /** @name Strategy objective that are used */ - //@{ + ///@{ SmartPtr acceptor_; SmartPtr resto_phase_; SmartPtr conv_check_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpConvCheck.hpp b/src/Algorithm/IpConvCheck.hpp index d5c2b1e7f..42f109679 100644 --- a/src/Algorithm/IpConvCheck.hpp +++ b/src/Algorithm/IpConvCheck.hpp @@ -17,7 +17,7 @@ class IPOPTLIB_EXPORT ConvergenceCheck: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ ConvergenceCheck() { } @@ -25,7 +25,7 @@ class IPOPTLIB_EXPORT ConvergenceCheck: public AlgorithmStrategyObject /** Destructor */ virtual ~ConvergenceCheck() { } - //@} + ///@} /** Convergence return enum */ enum ConvergenceStatus @@ -35,6 +35,7 @@ class IPOPTLIB_EXPORT ConvergenceCheck: public AlgorithmStrategyObject CONVERGED_TO_ACCEPTABLE_POINT, MAXITER_EXCEEDED, CPUTIME_EXCEEDED, + WALLTIME_EXCEEDED, ///< @since 3.14.0 DIVERGING, USER_STOP, FAILED @@ -75,7 +76,7 @@ class IPOPTLIB_EXPORT ConvergenceCheck: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ // ConvergenceCheck(); /** Copy Constructor */ @@ -87,7 +88,7 @@ class IPOPTLIB_EXPORT ConvergenceCheck: public AlgorithmStrategyObject void operator=( const ConvergenceCheck& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpDefaultIterateInitializer.cpp b/src/Algorithm/IpDefaultIterateInitializer.cpp index 80b269c72..226e2cf10 100644 --- a/src/Algorithm/IpDefaultIterateInitializer.cpp +++ b/src/Algorithm/IpDefaultIterateInitializer.cpp @@ -87,7 +87,7 @@ void DefaultIterateInitializer::RegisterOptions( "mu-based", "initialize to mu_init/x_slack", "This option defines how the iterates for the bound multipliers are initialized. " "If \"constant\" is chosen, then all bound multipliers are initialized to the value of \"bound_mult_init_val\". " - "If \"mu-based\" is chosen, the each value is initialized to the the value of \"mu_init\" " + "If \"mu-based\" is chosen, then each value is initialized to the the value of \"mu_init\" " "divided by the corresponding slack variable. " "This latter option might be useful if the starting point is close to the optimal solution."); reg_options->AddStringOption2( @@ -109,7 +109,7 @@ void DefaultIterateInitializer::RegisterOptions( "If successful, the bound multipliers are possibly corrected to be at least bound_mult_init_val. " "This might be useful if the user doesn't know anything about the starting point, or for solving an LP or QP. " "This overwrites option \"bound_mult_init_method\"."); - reg_options->SetRegisteringCategory("Warm Start"); + reg_options->SetRegisteringCategory("Warm Start", 370000); reg_options->AddStringOption2( "warm_start_init_point", "Warm-start for initial point", @@ -145,7 +145,7 @@ bool DefaultIterateInitializer::InitializeImpl( options.GetBoolValue("least_square_init_duals", least_square_init_duals_, prefix); ASSERT_EXCEPTION(!least_square_init_duals_ || IsValid(aug_system_solver_), OPTION_INVALID, "The least_square_init_duals can only be chosen if the DefaultInitializer object has an AugSystemSolver.\n"); - int enum_int; + Index enum_int; options.GetEnumValue("bound_mult_init_method", enum_int, prefix); bound_mult_init_method_ = BoundMultInitMethod(enum_int); if( bound_mult_init_method_ == B_MU_BASED ) @@ -505,14 +505,15 @@ void DefaultIterateInitializer::push_variables( SmartPtr tmp_l = x_L.MakeNew(); SmartPtr tmp_u = x_U.MakeNew(); - const double dbl_min = std::numeric_limits::min(); - const double tiny_double = 100.0 * dbl_min; + const Number dbl_min = std::numeric_limits::min(); + const Number tiny_double = 100.0 * dbl_min; // Calculate any required shift in x0 and s0 SmartPtr tmp = my_orig_x->MakeNew(); SmartPtr tiny_l = x_L.MakeNew(); tiny_l->Set(tiny_double); + // cppcheck-suppress duplicateAssignExpression SmartPtr q_l = x_L.MakeNew(); SmartPtr p_l = x_L.MakeNew(); SmartPtr delta_x = my_orig_x->MakeNew(); @@ -561,7 +562,9 @@ void DefaultIterateInitializer::push_variables( DBG_PRINT_VECTOR(1, "p_l", *p_l); // Calculate p_u + // cppcheck-suppress duplicateAssignExpression SmartPtr q_u = x_U.MakeNew(); + // cppcheck-suppress duplicateAssignExpression SmartPtr p_u = x_U.MakeNew(); SmartPtr tiny_u = x_U.MakeNew(); tiny_u->Set(tiny_double); diff --git a/src/Algorithm/IpDefaultIterateInitializer.hpp b/src/Algorithm/IpDefaultIterateInitializer.hpp index b144f0843..304bd2709 100644 --- a/src/Algorithm/IpDefaultIterateInitializer.hpp +++ b/src/Algorithm/IpDefaultIterateInitializer.hpp @@ -24,7 +24,7 @@ class DefaultIterateInitializer: public IterateInitializer { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * If eq_mult_calculator is not NULL, it will be @@ -42,7 +42,7 @@ class DefaultIterateInitializer: public IterateInitializer /** Destructor */ virtual ~DefaultIterateInitializer() { } - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -91,20 +91,20 @@ class DefaultIterateInitializer: public IterateInitializer Number constr_mult_init_max ); - //@{ + ///@{ static void RegisterOptions( SmartPtr reg_options ); - //@} + ///@} /** @name Enums of option values */ - //@{ + ///@{ enum BoundMultInitMethod { B_CONSTANT = 0, B_MU_BASED }; - //@} + ///@} private: /**@name Default Compiler Generated Methods * (Hidden to avoid implicit creation/calling). @@ -115,7 +115,7 @@ class DefaultIterateInitializer: public IterateInitializer * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ DefaultIterateInitializer(); @@ -128,10 +128,10 @@ class DefaultIterateInitializer: public IterateInitializer void operator=( const DefaultIterateInitializer& ); - //@} + ///@} /**@name Algorithmic Parameters */ - //@{ + ///@{ /** Absolute parameter for bumping x0 */ Number bound_push_; /** Relative parameter for bumping x0 */ @@ -162,7 +162,7 @@ class DefaultIterateInitializer: public IterateInitializer BoundMultInitMethod bound_mult_init_method_; /** Initial value of barrier parameter */ Number mu_init_; - //@} + ///@} /** object to be used for the initialization of the equality * constraint multipliers. diff --git a/src/Algorithm/IpEqMultCalculator.hpp b/src/Algorithm/IpEqMultCalculator.hpp index f9c538394..827faa1aa 100644 --- a/src/Algorithm/IpEqMultCalculator.hpp +++ b/src/Algorithm/IpEqMultCalculator.hpp @@ -22,14 +22,14 @@ class EqMultiplierCalculator: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor. */ EqMultiplierCalculator() { } /** Destructor */ virtual ~EqMultiplierCalculator() { } - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -58,7 +58,7 @@ class EqMultiplierCalculator: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ EqMultiplierCalculator( const EqMultiplierCalculator& @@ -68,7 +68,7 @@ class EqMultiplierCalculator: public AlgorithmStrategyObject void operator=( const EqMultiplierCalculator& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpEquilibrationScaling.cpp b/src/Algorithm/IpEquilibrationScaling.cpp index d56455792..29ac85b2f 100644 --- a/src/Algorithm/IpEquilibrationScaling.cpp +++ b/src/Algorithm/IpEquilibrationScaling.cpp @@ -7,32 +7,34 @@ #include "IpoptConfig.h" #include "IpEquilibrationScaling.hpp" #include "IpTripletHelper.hpp" +#include "IpTypes.h" + +#include #ifdef IPOPT_HAS_HSL #include "CoinHslConfig.h" #else -/* if we build for the Linear Solver loader, then use normal C-naming style */ -#define IPOPT_HSL_FUNC(name,NAME) name #endif -#include +#if (defined(COINHSL_HAS_MC19) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MC19S) && defined(IPOPT_SINGLE)) +#ifdef IPOPT_SINGLE +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name,NAME) +#else +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name ## d,NAME ## D) +#endif -/** Prototypes for MA27's Fortran subroutines */ +/** Prototypes for MC19's Fortran subroutines */ extern "C" { -// here we assume that float corresponds to Fortran's single -// precision - void IPOPT_HSL_FUNC(mc19ad, MC19AD)( - const ipfint* N, - const ipfint* NZ, - const double* A, - const ipfint* IRN, - const ipfint* ICN, - float* R, - float* C, - float* W - ); + IPOPT_DECL_MC19A(IPOPT_HSL_FUNCP(mc19a, MC19A)); } +#else +#ifdef IPOPT_SINGLE +#define HSLFUNCNAMESUFFIX "" +#else +#define HSLFUNCNAMESUFFIX "d" +#endif +#endif namespace Ipopt { @@ -50,6 +52,25 @@ bool EquilibrationScaling::InitializeImpl( const std::string& prefix ) { + // check if user stored a MC19A in Mc19TSymScalingMethod +#ifndef IPOPT_INT64 + mc19a = Mc19TSymScalingMethod::GetMC19A(); +#endif + if( mc19a == NULL ) + { +#if (defined(COINHSL_HAS_MC19) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MC19S) && defined(IPOPT_SINGLE)) + // use HSL function that should be available in linked HSL library + mc19a = &::IPOPT_HSL_FUNCP(mc19a, MC19A); +#else + // try to load HSL function from a shared library at runtime + DBG_ASSERT(IsValid(hslloader)); + + mc19a = (IPOPT_DECL_MC19A(*))hslloader->loadSymbol("mc19a" HSLFUNCNAMESUFFIX); +#endif + } + + DBG_ASSERT(mc19a != NULL); + options.GetNumericValue("point_perturbation_radius", point_perturbation_radius_, prefix); return StandardScalingBase::InitializeImpl(options, prefix); } @@ -131,14 +152,14 @@ void EquilibrationScaling::DetermineScalingParametersImpl( { for( Index i = 0; i < nnz_jac_c; i++ ) { - avrg_values[i] = fabs(val_buffer[i]); + avrg_values[i] = std::abs(val_buffer[i]); } } else { for( Index i = 0; i < nnz_jac_c; i++ ) { - avrg_values[i] += fabs(val_buffer[i]); + avrg_values[i] += std::abs(val_buffer[i]); } } TripletHelper::FillValues(nnz_jac_d, *jac_d, val_buffer); @@ -146,14 +167,14 @@ void EquilibrationScaling::DetermineScalingParametersImpl( { for( Index i = 0; i < nnz_jac_d; i++ ) { - avrg_values[nnz_jac_c + i] = fabs(val_buffer[i]); + avrg_values[nnz_jac_c + i] = std::abs(val_buffer[i]); } } else { for( Index i = 0; i < nnz_jac_d; i++ ) { - avrg_values[nnz_jac_c + i] += fabs(val_buffer[i]); + avrg_values[nnz_jac_c + i] += std::abs(val_buffer[i]); } } TripletHelper::FillValuesFromVector(nx, *grad_f, val_buffer); @@ -161,14 +182,14 @@ void EquilibrationScaling::DetermineScalingParametersImpl( { for( Index i = 0; i < nx; i++ ) { - avrg_values[nnz_jac_c + nnz_jac_d + i] = fabs(val_buffer[i]); + avrg_values[nnz_jac_c + nnz_jac_d + i] = std::abs(val_buffer[i]); } } else { for( Index i = 0; i < nx; i++ ) { - avrg_values[nnz_jac_c + nnz_jac_d + i] += fabs(val_buffer[i]); + avrg_values[nnz_jac_c + nnz_jac_d + i] += std::abs(val_buffer[i]); } } } @@ -179,17 +200,11 @@ void EquilibrationScaling::DetermineScalingParametersImpl( } // Get the sparsity structure - ipfint* AIRN = new ipfint[nnz_jac_c + nnz_jac_d + nx]; - ipfint* AJCN = new ipfint[nnz_jac_c + nnz_jac_d + nx]; - if( sizeof(ipfint) == sizeof(Index) ) - { - TripletHelper::FillRowCol(nnz_jac_c, *jac_c, &AIRN[0], &AJCN[0]); - TripletHelper::FillRowCol(nnz_jac_d, *jac_d, &AIRN[nnz_jac_c], &AJCN[nnz_jac_c], nc); - } - else - { - THROW_EXCEPTION(INTERNAL_ABORT, "Need to implement missing code in EquilibriationScaling."); - } + Index* AIRN = new Index[nnz_jac_c + nnz_jac_d + nx]; + Index* AJCN = new Index[nnz_jac_c + nnz_jac_d + nx]; + TripletHelper::FillRowCol(nnz_jac_c, *jac_c, &AIRN[0], &AJCN[0]); + TripletHelper::FillRowCol(nnz_jac_d, *jac_d, &AIRN[nnz_jac_c], &AJCN[nnz_jac_c], nc); + // sort out the zero entries in objective function gradient Index nnz_grad_f = 0; const Index idx = nnz_jac_c + nnz_jac_d; @@ -205,18 +220,12 @@ void EquilibrationScaling::DetermineScalingParametersImpl( } // Now call MC19 to compute the scaling factors - const ipfint N = Max(nc + nd + 1, nx); + const Index N = Max(nc + nd + 1, nx); float* R = new float[N]; float* C = new float[N]; float* W = new float[5 * N]; -#if defined(COINHSL_HAS_MC19) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - const ipfint NZ = nnz_jac_c + nnz_jac_d + nnz_grad_f; - //IPOPT_HSL_FUNC(mc19ad,MC19AD)(&N, &NZ, avrg_values, AIRN, AJCN, R, C, W); - IPOPT_HSL_FUNC(mc19ad, MC19AD)(&N, &NZ, avrg_values, AJCN, AIRN, C, R, W); -#else - - THROW_EXCEPTION(OPTION_INVALID, "Currently cannot do equilibration-based NLP scaling if MC19 is not available."); -#endif + const Index NZ = nnz_jac_c + nnz_jac_d + nnz_grad_f; + mc19a(&N, &NZ, avrg_values, AJCN, AIRN, C, R, W); delete[] W; @@ -229,11 +238,11 @@ void EquilibrationScaling::DetermineScalingParametersImpl( Number* col_scale = new Number[nx]; for( Index i = 0; i < nc + nd + 1; i++ ) { - row_scale[i] = exp((Number) R[i]); + row_scale[i] = std::exp(Number(R[i])); } for( Index i = 0; i < nx; i++ ) { - col_scale[i] = exp((Number) C[i]); + col_scale[i] = std::exp(Number(C[i])); } delete[] R; delete[] C; diff --git a/src/Algorithm/IpEquilibrationScaling.hpp b/src/Algorithm/IpEquilibrationScaling.hpp index 84392099d..125bafb5c 100644 --- a/src/Algorithm/IpEquilibrationScaling.hpp +++ b/src/Algorithm/IpEquilibrationScaling.hpp @@ -9,6 +9,7 @@ #include "IpNLPScaling.hpp" #include "IpNLP.hpp" +#include "IpMc19TSymScalingMethod.hpp" // to get IPOPT_DECL_MC19A namespace Ipopt { @@ -20,25 +21,28 @@ class EquilibrationScaling: public StandardScalingBase { public: /**@name Constructors/Destructors */ - //@{ + ///@{ EquilibrationScaling( - const SmartPtr& nlp) - : StandardScalingBase(), - nlp_(nlp) + const SmartPtr& nlp, + SmartPtr hslloader_ + ) : StandardScalingBase(), + nlp_(nlp), + hslloader(hslloader_), + mc19a(NULL) { } /** Destructor */ virtual ~EquilibrationScaling() { } - //@} + ///@} /** Methods for IpoptType */ - //@{ + ///@{ /** Register the options for this class */ static void RegisterOptions( const SmartPtr& roptions ); - //@} + ///@} protected: /** Initialize the object from the options */ @@ -75,7 +79,7 @@ class EquilibrationScaling: public StandardScalingBase * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ EquilibrationScaling( const EquilibrationScaling& @@ -85,13 +89,21 @@ class EquilibrationScaling: public StandardScalingBase void operator=( const EquilibrationScaling& ); - //@} + ///@} /** pointer to the NLP to get scaling parameters */ SmartPtr nlp_; /** maximal radius for the random perturbation of the initial point */ Number point_perturbation_radius_; + + /**@name MC19 function pointer + * @{ + */ + SmartPtr hslloader; + + IPOPT_DECL_MC19A(*mc19a); + /**@} */ }; /** This class is a simple object for generating randomly perturbed @@ -104,7 +116,7 @@ class PointPerturber: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ PointPerturber( const Vector& reference_point, Number random_pert_radius, @@ -117,7 +129,7 @@ class PointPerturber: public ReferencedObject /** Destructor */ virtual ~PointPerturber() { } - //@} + ///@} /** Return a new perturbed point */ SmartPtr MakeNewPerturbedPoint() const; @@ -133,7 +145,7 @@ class PointPerturber: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ PointPerturber( const PointPerturber& @@ -143,7 +155,7 @@ class PointPerturber: public ReferencedObject void operator=( const PointPerturber& ); - //@} + ///@} /** pointer to the midpoint of the perturbation */ SmartPtr ref_point_; diff --git a/src/Algorithm/IpExactHessianUpdater.hpp b/src/Algorithm/IpExactHessianUpdater.hpp index cb5db25c0..9e2daee6d 100644 --- a/src/Algorithm/IpExactHessianUpdater.hpp +++ b/src/Algorithm/IpExactHessianUpdater.hpp @@ -19,7 +19,7 @@ class ExactHessianUpdater: public HessianUpdater { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ ExactHessianUpdater() { } @@ -27,7 +27,7 @@ class ExactHessianUpdater: public HessianUpdater /** Destructor */ virtual ~ExactHessianUpdater() { } - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -48,7 +48,7 @@ class ExactHessianUpdater: public HessianUpdater * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ ExactHessianUpdater( const ExactHessianUpdater& @@ -58,7 +58,7 @@ class ExactHessianUpdater: public HessianUpdater void operator=( const ExactHessianUpdater& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpFilter.cpp b/src/Algorithm/IpFilter.cpp index 7511bb902..12794688a 100644 --- a/src/Algorithm/IpFilter.cpp +++ b/src/Algorithm/IpFilter.cpp @@ -19,8 +19,8 @@ static const Index dbg_verbosity = 0; /////////////////////////////////////////////////////////////////////////// FilterEntry::FilterEntry( - std::vector vals, - Index iter + const std::vector& vals, + Index iter ) : vals_(vals), iter_(iter) @@ -47,7 +47,7 @@ bool Filter::Acceptable( DBG_ASSERT((Index)vals.size() == dim_); bool acceptable = true; std::list::iterator iter; - for( iter = filter_list_.begin(); iter != filter_list_.end(); iter++ ) + for( iter = filter_list_.begin(); iter != filter_list_.end(); ++iter ) { if( !(*iter)->Acceptable(vals) ) { @@ -71,15 +71,14 @@ void Filter::AddEntry( { if( (*iter)->Dominated(vals) ) { - std::list::iterator iter_to_remove = iter; - iter++; + std::list::iterator iter_to_remove = iter++; FilterEntry* entry_to_remove = *iter_to_remove; filter_list_.erase(iter_to_remove); delete entry_to_remove; } else { - iter++; + ++iter; } } FilterEntry* new_entry = new FilterEntry(vals, iteration); @@ -103,14 +102,14 @@ void Filter::Print( { DBG_START_METH("FilterLineSearch::Filter::Print", dbg_verbosity); jnlst.Printf(J_DETAILED, J_LINE_SEARCH, - "The current filter has %d entries.\n", filter_list_.size()); + "The current filter has %zd entries.\n", filter_list_.size()); if( !jnlst.ProduceOutput(J_VECTOR, J_LINE_SEARCH) ) { return; } std::list::iterator iter; Index count = 0; - for( iter = filter_list_.begin(); iter != filter_list_.end(); iter++ ) + for( iter = filter_list_.begin(); iter != filter_list_.end(); ++iter ) { if( count % 10 == 0 ) { @@ -119,14 +118,14 @@ void Filter::Print( } count++; jnlst.Printf(J_VECTOR, J_LINE_SEARCH, - "%5d ", count); + "%5" IPOPT_INDEX_FORMAT " ", count); for( Index i = 0; i < dim_; i++ ) { jnlst.Printf(J_VECTOR, J_LINE_SEARCH, "%23.16e ", (*iter)->val(i)); } jnlst.Printf(J_VECTOR, J_LINE_SEARCH, - "%5d\n", (*iter)->iter()); + "%5" IPOPT_INDEX_FORMAT "\n", (*iter)->iter()); } } diff --git a/src/Algorithm/IpFilter.hpp b/src/Algorithm/IpFilter.hpp index 3162b9a6a..5d788a20c 100644 --- a/src/Algorithm/IpFilter.hpp +++ b/src/Algorithm/IpFilter.hpp @@ -20,16 +20,16 @@ class FilterEntry { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor with the two components and the current iteration count */ FilterEntry( - std::vector vals, - Index iter + const std::vector& vals, + Index iter ); /** Destructor */ ~FilterEntry(); - //@} + ///@} /** Check acceptability of pair (phi,theta) with respect * to this filter entry. @@ -82,7 +82,7 @@ class FilterEntry } /** @name Accessor functions */ - //@{ + ///@{ Number val( Index i ) const @@ -93,7 +93,7 @@ class FilterEntry { return iter_; } - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -105,7 +105,7 @@ class FilterEntry * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ FilterEntry(); /** Copy Constructor */ @@ -117,7 +117,7 @@ class FilterEntry void operator=( const FilterEntry& ); - //@} + ///@} /** values defining the coordinates of the entry */ std::vector vals_; @@ -135,7 +135,7 @@ class Filter { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ Filter( Index dim @@ -146,7 +146,7 @@ class Filter //ToDo figure out if that here is necessary Clear(); } - //@} + ///@} /** Check acceptability of given coordinates with respect * to the filter. @@ -168,7 +168,7 @@ class Filter ); /** @name Wrappers for 2-dimensional filter. */ - //@{ + ///@{ bool Acceptable( Number val1, Number val2 @@ -193,7 +193,7 @@ class Filter AddEntry(vals, iteration); } - //@} + ///@} /** Delete all filter entries */ void Clear(); @@ -213,7 +213,7 @@ class Filter * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ Filter(); /** Copy Constructor */ @@ -225,7 +225,7 @@ class Filter void operator=( const Filter& ); - //@} + ///@} /** Dimension of the filter (number of coordinates per entry) */ Index dim_; diff --git a/src/Algorithm/IpFilterLSAcceptor.cpp b/src/Algorithm/IpFilterLSAcceptor.cpp index 43051b5f7..bd381a241 100644 --- a/src/Algorithm/IpFilterLSAcceptor.cpp +++ b/src/Algorithm/IpFilterLSAcceptor.cpp @@ -46,7 +46,8 @@ void FilterLSAcceptor::RegisterOptions(SmartPtr roptions) "The algorithmic parameter theta_max is determined as theta_max_fact " "times the maximum of 1 and the constraint violation at initial point. " "Any point with a constraint violation larger than theta_max is " - "unacceptable to the filter (see Eqn. (21) in the implementation paper)."); + "unacceptable to the filter (see Eqn. (21) in the implementation paper).", + true); roptions->AddLowerBoundedNumberOption( "theta_min_fact", "Determines constraint violation threshold in the switching rule.", @@ -54,62 +55,70 @@ void FilterLSAcceptor::RegisterOptions(SmartPtr roptions) 1e-4, "The algorithmic parameter theta_min is determined as theta_min_fact " "times the maximum of 1 and the constraint violation at initial point. " - "The switching rules treats an iteration as an h-type iteration whenever " + "The switching rule treats an iteration as an h-type iteration whenever " "the current constraint violation is larger than theta_min (see " - "paragraph before Eqn. (19) in the implementation paper)."); + "paragraph before Eqn. (19) in the implementation paper).", + true); roptions->AddBoundedNumberOption( "eta_phi", "Relaxation factor in the Armijo condition.", 0.0, true, 0.5, true, 1e-8, - "(See Eqn. (20) in the implementation paper)"); + "See Eqn. (20) in the implementation paper.", + true); roptions->AddLowerBoundedNumberOption( "delta", "Multiplier for constraint violation in the switching rule.", 0.0, true, 1.0, - "(See Eqn. (19) in the implementation paper.)"); + "See Eqn. (19) in the implementation paper.", + true); roptions->AddLowerBoundedNumberOption( "s_phi", "Exponent for linear barrier function model in the switching rule.", 1.0, true, 2.3, - "(See Eqn. (19) in the implementation paper.)"); + "See Eqn. (19) in the implementation paper.", + true); roptions->AddLowerBoundedNumberOption( "s_theta", "Exponent for current constraint violation in the switching rule.", 1.0, true, 1.1, - "(See Eqn. (19) in the implementation paper.)"); + "See Eqn. (19) in the implementation paper.", + true); roptions->AddBoundedNumberOption( "gamma_phi", "Relaxation factor in the filter margin for the barrier function.", 0.0, true, 1.0, true, 1e-8, - "(See Eqn. (18a) in the implementation paper.)"); + "See Eqn. (18a) in the implementation paper.", + true); roptions->AddBoundedNumberOption( "gamma_theta", "Relaxation factor in the filter margin for the constraint violation.", 0.0, true, 1.0, true, 1e-5, - "(See Eqn. (18b) in the implementation paper.)"); + "See Eqn. (18b) in the implementation paper.", + true); roptions->AddBoundedNumberOption( "alpha_min_frac", "Safety factor for the minimal step size (before switching to restoration phase).", 0.0, true, 1.0, true, 0.05, - "(This is gamma_alpha in Eqn. (20) in the implementation paper.)"); + "This is gamma_alpha in Eqn. (23) in the implementation paper.", + true); roptions->AddLowerBoundedIntegerOption( "max_soc", "Maximum number of second order correction trial steps at each iteration.", 0, 4, "Choosing 0 disables the second order corrections. " - "(This is p^{max} of Step A-5.9 of Algorithm A in the implementation paper.)"); + "This is p^{max} of Step A-5.9 of Algorithm A in the implementation paper."); roptions->AddLowerBoundedNumberOption( "kappa_soc", "Factor in the sufficient reduction rule for second order correction.", @@ -117,14 +126,16 @@ void FilterLSAcceptor::RegisterOptions(SmartPtr roptions) 0.99, "This option determines how much a second order correction step must reduce the " "constraint violation so that further correction steps are attempted. " - "(See Step A-5.9 of Algorithm A in the implementation paper.)"); + "See Step A-5.9 of Algorithm A in the implementation paper.", + true); roptions->AddLowerBoundedNumberOption( "obj_max_inc", "Determines the upper bound on the acceptable increase of barrier objective function.", 1.0, true, 5.0, "Trial points are rejected if they lead to an increase in the " - "barrier objective function by more than obj_max_inc orders of magnitude."); + "barrier objective function by more than obj_max_inc orders of magnitude.", + true); roptions->AddLowerBoundedIntegerOption( "max_filter_resets", @@ -134,7 +145,8 @@ void FilterLSAcceptor::RegisterOptions(SmartPtr roptions) "A positive number enables a heuristic that resets the filter, whenever " "in more than \"filter_reset_trigger\" successive iterations the last " "rejected trial steps size was rejected because of the filter. " - "This option determine the maximal number of resets that are allowed to take place."); + "This option determine the maximal number of resets that are allowed to take place.", + true); roptions->AddLowerBoundedIntegerOption( "filter_reset_trigger", "Number of iterations that trigger the filter reset.", @@ -142,7 +154,8 @@ void FilterLSAcceptor::RegisterOptions(SmartPtr roptions) 5, "If the filter reset heuristic is active and the number of successive " "iterations in which the last rejected trial step size was rejected " - "because of the filter, the filter is reset."); + "because of the filter, the filter is reset.", + true); roptions->AddStringOption3( "corrector_type", @@ -152,28 +165,27 @@ void FilterLSAcceptor::RegisterOptions(SmartPtr roptions) "affine", "corrector step towards mu=0", "primal-dual", "corrector step towards current mu", "If \"mu_strategy\" is \"adaptive\", this option determines what kind of corrector steps should be tried. " - "Changing this option is experimental."); + "Changing this option is experimental.", + true); - roptions->AddStringOption2( + roptions->AddBoolOption( "skip_corr_if_neg_curv", - "Skip the corrector step in negative curvature iteration.", - "yes", - "no", "don't skip", - "yes", "skip", + "Whether to skip the corrector step in negative curvature iteration.", + true, "The corrector step is not tried if negative curvature has been " "encountered during the computation of the search direction in the current iteration. " "This option is only used if \"mu_strategy\" is \"adaptive\". " - "Changing this option is experimental."); + "Changing this option is experimental.", + true); - roptions->AddStringOption2( + roptions->AddBoolOption( "skip_corr_in_monotone_mode", - "Skip the corrector step during monotone barrier parameter mode.", - "yes", - "no", "don't skip", - "yes", "skip", + "Whether to skip the corrector step during monotone barrier parameter mode.", + true, "The corrector step is not tried if the algorithm is currently in the monotone mode (see also option \"barrier_strategy\"). " "This option is only used if \"mu_strategy\" is \"adaptive\". " - "Changing this option is experimental."); + "Changing this option is experimental.", + true); roptions->AddLowerBoundedNumberOption( "corrector_compl_avrg_red_fact", @@ -181,14 +193,15 @@ void FilterLSAcceptor::RegisterOptions(SmartPtr roptions) 0.0, true, 1.0, "This option determines the factor by which complementarity is allowed to increase " - "for a corrector step to be accepted. Changing this option is experimental."); + "for a corrector step to be accepted. Changing this option is experimental.", + true); roptions->AddBoundedIntegerOption( "soc_method", "Ways to apply second order correction", 0, 1, 0, - "This option determins the way to apply second order correction, 0 is the method described in the implementation paper. " + "This option determines the way to apply second order correction, 0 is the method described in the implementation paper. " "1 is the modified way which adds alpha on the rhs of x and s rows."); } @@ -264,6 +277,7 @@ bool FilterLSAcceptor::IsFtype(Number alpha_primal_test) reference_theta_, reference_gradBarrTDelta_); Number mach_eps = std::numeric_limits::epsilon(); // ToDo find good value + // because the assert below fails (with MA27) for CUTEst instances HATFLDF, NONMSQRT, PALMER7E, PALMER5A if (reference_theta_ == 0. && reference_gradBarrTDelta_ > 0. && reference_gradBarrTDelta_ < 100.*mach_eps) { @@ -274,8 +288,8 @@ bool FilterLSAcceptor::IsFtype(Number alpha_primal_test) } DBG_ASSERT(reference_theta_ > 0. || reference_gradBarrTDelta_ < 0.0); return (reference_gradBarrTDelta_ < 0.0 && - alpha_primal_test * pow(-reference_gradBarrTDelta_, s_phi_) > - delta_ * pow(reference_theta_, s_theta_)); + alpha_primal_test * std::pow(-reference_gradBarrTDelta_, s_phi_) > + delta_ * std::pow(reference_theta_, s_theta_)); } void FilterLSAcceptor::AugmentFilter() @@ -290,7 +304,9 @@ void FilterLSAcceptor::AugmentFilter() } bool -FilterLSAcceptor::CheckAcceptabilityOfTrialPoint(Number alpha_primal_test) +FilterLSAcceptor::CheckAcceptabilityOfTrialPoint( + Number alpha_primal_test +) { DBG_START_METH("FilterLSAcceptor::CheckAcceptabilityOfTrialPoint", dbg_verbosity); @@ -305,14 +321,14 @@ FilterLSAcceptor::CheckAcceptabilityOfTrialPoint(Number alpha_primal_test) if (theta_max_ < 0.0) { // ToDo should 1.0 be based on dimension? (theta is in 1 norm!!!) - theta_max_ = theta_max_fact_ * Max(1.0, reference_theta_); + theta_max_ = theta_max_fact_ * Max(Number(1.0), reference_theta_); Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, "trial_max is initialized to %e\n", theta_max_); } if (theta_min_ < 0.0) { - theta_min_ = theta_min_fact_ * Max(1.0, reference_theta_); + theta_min_ = theta_min_fact_ * Max(Number(1.0), reference_theta_); Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, "trial_min is initialized to %e\n", theta_min_); @@ -394,7 +410,7 @@ FilterLSAcceptor::CheckAcceptabilityOfTrialPoint(Number alpha_primal_test) if (count_successive_filter_rejections_ >= filter_reset_trigger_) { Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Resetting filter because in %d iterations last rejection was due to filter", count_successive_filter_rejections_); + "Resetting filter because in %" IPOPT_INDEX_FORMAT " iterations last rejection was due to filter", count_successive_filter_rejections_); IpData().Append_info_string("F+"); Reset(); } @@ -440,7 +456,7 @@ Number FilterLSAcceptor::CalculateAlphaMin() if (curr_theta <= theta_min_) { alpha_min = Min( alpha_min, - delta_ * pow(curr_theta, s_theta_) / pow(-gBD, s_phi_) + delta_ * std::pow(curr_theta, s_theta_) / std::pow(-gBD, s_phi_) ); } } @@ -455,16 +471,16 @@ bool FilterLSAcceptor::IsAcceptableToCurrentIterate(Number trial_barr, DBG_START_METH("FilterLSAcceptor::IsAcceptableToCurrentIterate", dbg_verbosity); - // Check if the barrier objective function is increasing to + // Check if the barrier objective function is increasing too // rapidly (according to option obj_max_inc) if (!called_from_restoration && trial_barr > reference_barr_) { Number basval = 1.; - if (fabs(reference_barr_) > 10.) + if (std::abs(reference_barr_) > 10.) { - basval = log10(fabs(reference_barr_)); + basval = std::log10(std::abs(reference_barr_)); } - if (log10(trial_barr - reference_barr_) > obj_max_inc_ + basval) + if (std::log10(trial_barr - reference_barr_) > obj_max_inc_ + basval) { Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, "Rejecting trial point because barrier objective function increasing too rapidly (from %27.15e to %27.15e)\n", reference_barr_, trial_barr); @@ -542,7 +558,7 @@ FilterLSAcceptor::TrySecondOrderCorrection( theta_soc_old = theta_trial; Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Trying second order correction number %d\n", + "Trying second order correction number %" IPOPT_INDEX_FORMAT "\n", count_soc + 1); // Compute SOC constraint violation @@ -553,7 +569,6 @@ FilterLSAcceptor::TrySecondOrderCorrection( SmartPtr delta_soc = actual_delta->MakeNewIteratesVector(true); SmartPtr rhs = actual_delta->MakeNewContainer(); - switch (soc_method_) { case 0: @@ -623,7 +638,7 @@ FilterLSAcceptor::TrySecondOrderCorrection( if (accept) { Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Second order correction step accepted with %d corrections.\n", count_soc + 1); + "Second order correction step accepted with %" IPOPT_INDEX_FORMAT " corrections.\n", count_soc + 1); // Accept all SOC quantities alpha_primal = alpha_primal_soc; actual_delta = delta_soc; @@ -849,7 +864,7 @@ FilterLSAcceptor::TryCorrector( if (Jnlst().ProduceOutput(J_MOREVECTOR, J_MAIN)) { Jnlst().Printf(J_MOREVECTOR, J_MAIN, - "*** Accepted corrector for Iteration: %d\n", + "*** Accepted corrector for Iteration: %" IPOPT_INDEX_FORMAT "\n", IpData().iter_count()); delta_corr->Print(Jnlst(), J_MOREVECTOR, J_MAIN, "delta_corr"); } @@ -881,5 +896,4 @@ void FilterLSAcceptor::PrepareRestoPhaseStart() AugmentFilter(); } - } // namespace Ipopt diff --git a/src/Algorithm/IpFilterLSAcceptor.hpp b/src/Algorithm/IpFilterLSAcceptor.hpp index 921f69148..83e7c0ef9 100644 --- a/src/Algorithm/IpFilterLSAcceptor.hpp +++ b/src/Algorithm/IpFilterLSAcceptor.hpp @@ -20,7 +20,7 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * The PDSystemSolver object only needs to be @@ -32,7 +32,7 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor ); virtual ~FilterLSAcceptor(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -134,7 +134,7 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor * acceptability criteria and used externally (by the restoration phase * convergence check object, for instance) */ - //@{ + ///@{ /** Checks if a trial point is acceptable to the current iterate */ bool IsAcceptableToCurrentIterate( Number trial_barr, @@ -147,14 +147,14 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor Number trial_barr, Number trial_theta ) const; - //@} + ///@} /** Methods for OptionsList */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -166,7 +166,7 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ FilterLSAcceptor( const FilterLSAcceptor& @@ -176,10 +176,10 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor void operator=( const FilterLSAcceptor& ); - //@} + ///@} /** @name Filter information */ - //@{ + ///@{ /** Upper bound on infeasibility */ Number theta_max_; Number theta_max_fact_; @@ -187,7 +187,7 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor /** Infeasibility switching bound */ Number theta_min_; Number theta_min_fact_; - //@} + ///@} /** Method for checking if the current step size satisfies the * f-type switching condition. @@ -214,7 +214,7 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor void AugmentFilter(); /** @name Parameters for the filter algorithm. Names as in the paper */ - //@{ + ///@{ /** \f$ \eta_{\varphi} \f$ */ Number eta_phi_; /** \f$ \delta \f$ */ @@ -236,7 +236,7 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor */ Number kappa_soc_; /** Maximal increase in objective function in orders of magnitude - * (log10). + * (std::log10). * * If the log10(barrier objective function) is * increased more than this compared to the current point, the @@ -274,10 +274,10 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor * then the filter is reset. */ Index filter_reset_trigger_; - //@} + ///@} /** @name Information related to watchdog procedure */ - //@{ + ///@{ /** Constraint violation at the point with respect to which * progress is to be made */ @@ -296,27 +296,27 @@ class FilterLSAcceptor: public BacktrackingLSAcceptor Number watchdog_barr_; /** Barrier gradient transpose search direction at reference point */ Number watchdog_gradBarrTDelta_; - //@} + ///@} /** Filter with entries */ Filter filter_; /** @name Filter reset stuff */ - //@{ + ///@{ /** True, if last rejected was due to the filter. */ - Number last_rejection_due_to_filter_; + bool last_rejection_due_to_filter_; /** Counter of successive iterations in which filter was reason * for last rejection. */ Index count_successive_filter_rejections_; /** Counter for the filter resets done so far. */ Index n_filter_resets_; - //@} + ///@} /** @name Strategy objective that are used */ - //@{ + ///@{ SmartPtr pd_solver_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpGenAugSystemSolver.cpp b/src/Algorithm/IpGenAugSystemSolver.cpp index 2e9508d12..6daba5de4 100644 --- a/src/Algorithm/IpGenAugSystemSolver.cpp +++ b/src/Algorithm/IpGenAugSystemSolver.cpp @@ -69,17 +69,17 @@ bool GenAugSystemSolver::InitializeImpl( ESymSolverStatus GenAugSystemSolver::MultiSolve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, std::vector >& rhs_xV, std::vector >& rhs_sV, std::vector >& rhs_cV, @@ -242,17 +242,17 @@ ESymSolverStatus GenAugSystemSolver::MultiSolve( void GenAugSystemSolver::UpdateTags( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ) { if( W ) @@ -307,17 +307,17 @@ void GenAugSystemSolver::UpdateTags( bool GenAugSystemSolver::AugmentedSystemChanged( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ) { DBG_START_METH("GenAugSystemSolver::AugmentedSystemRequiresChange", dbg_verbosity); diff --git a/src/Algorithm/IpGenAugSystemSolver.hpp b/src/Algorithm/IpGenAugSystemSolver.hpp index f5de5f5aa..2a161e2c9 100644 --- a/src/Algorithm/IpGenAugSystemSolver.hpp +++ b/src/Algorithm/IpGenAugSystemSolver.hpp @@ -22,7 +22,7 @@ class GenAugSystemSolver: public AugSystemSolver { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor using only a linear solver object */ GenAugSystemSolver( GenKKTSolverInterface& SolverInterface @@ -30,7 +30,7 @@ class GenAugSystemSolver: public AugSystemSolver /** Destructor */ virtual ~GenAugSystemSolver(); - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ bool InitializeImpl( @@ -44,17 +44,17 @@ class GenAugSystemSolver: public AugSystemSolver */ virtual ESymSolverStatus MultiSolve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, std::vector >& rhs_xV, std::vector >& rhs_sV, std::vector >& rhs_cV, @@ -102,7 +102,7 @@ class GenAugSystemSolver: public AugSystemSolver * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor. */ GenAugSystemSolver(); /** Copy Constructor */ @@ -114,39 +114,39 @@ class GenAugSystemSolver: public AugSystemSolver void operator=( const GenAugSystemSolver& ); - //@} + ///@} /** Check the internal tags and decide if the passed variables are * different from what is in the augmented_system_ */ bool AugmentedSystemChanged( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ); void UpdateTags( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ); /** The linear solver object that is to be used to solve the @@ -158,28 +158,28 @@ class GenAugSystemSolver: public AugSystemSolver * matrix has to be updated compared to the most recent call of * the Set method. */ - //@{ + ///@{ /** Tag for W matrix. * * If W has been given to Set as NULL, then this tag is set to 0 */ TaggedObject::Tag w_tag_; /** Most recent value of W_factor */ - double w_factor_; + Number w_factor_; /** Tag for D_x vector, representing the diagonal matrix D_x. * * If D_x has been given to Set as NULL, then this tag is set to 0 */ TaggedObject::Tag d_x_tag_; /** Most recent value of delta_x from Set method */ - double delta_x_; + Number delta_x_; /** Tag for D_s vector, representing the diagonal matrix D_s. * * If D_s has been given to Set as NULL, then this tag is set to 0 */ TaggedObject::Tag d_s_tag_; /** Most recent value of delta_s from Set method */ - double delta_s_; + Number delta_s_; /** Tag for J_c matrix. * * If J_c has been given to Set as NULL, then this tag is set to 0 @@ -191,7 +191,7 @@ class GenAugSystemSolver: public AugSystemSolver */ TaggedObject::Tag d_c_tag_; /** Most recent value of delta_c from Set method */ - double delta_c_; + Number delta_c_; /** Tag for J_d matrix. * * If J_d has been given to Set as NULL, then this tag is set to 0 @@ -203,27 +203,27 @@ class GenAugSystemSolver: public AugSystemSolver */ TaggedObject::Tag d_d_tag_; /** Most recent value of delta_d from Set method */ - double delta_d_; - //@} + Number delta_d_; + ///@} /** @name Space for storing the diagonal matrices. * * If the matrix hasn't changed, we can use it from the last call. */ - //@{ + ///@{ Number* dx_vals_copy_; Number* ds_vals_copy_; Number* dc_vals_copy_; Number* dd_vals_copy_; - //@} + ///@} /** @name Algorithmic parameters */ - //@{ + ///@{ /** Flag indicating whether the TNLP with identical structure has * already been solved before. */ bool warm_start_same_structure_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpGradientScaling.cpp b/src/Algorithm/IpGradientScaling.cpp index 6a485ba53..f4e82527c 100644 --- a/src/Algorithm/IpGradientScaling.cpp +++ b/src/Algorithm/IpGradientScaling.cpp @@ -30,17 +30,19 @@ void GradientScaling::RegisterOptions( "Target value for objective function gradient size.", 0., false, 0., - "If a positive number is chosen, the scaling factor the objective function is computed " + "If a positive number is chosen, the scaling factor for the objective function is computed " "so that the gradient has the max norm of the given size at the starting point. " - "This overrides nlp_scaling_max_gradient for the objective function."); + "This overrides nlp_scaling_max_gradient for the objective function.", + true); roptions->AddLowerBoundedNumberOption( "nlp_scaling_constr_target_gradient", "Target value for constraint function gradient size.", 0., false, 0., - "If a positive number is chosen, the scaling factor the constraint functions is computed " + "If a positive number is chosen, the scaling factors for the constraint functions are computed " "so that the gradient has the max norm of the given size at the starting point. " - "This overrides nlp_scaling_max_gradient for the constraint functions."); + "This overrides nlp_scaling_max_gradient for the constraint functions.", + true); roptions->AddLowerBoundedNumberOption( "nlp_scaling_min_value", "Minimum value of gradient-based scaling values.", @@ -99,7 +101,7 @@ void GradientScaling::DetermineScalingParametersImpl( SmartPtr grad_f = x_space->MakeNew(); if( nlp_->Eval_grad_f(*x, *grad_f) ) { - double max_grad_f = grad_f->Amax(); + Number max_grad_f = grad_f->Amax(); df = 1.; if( scaling_obj_target_gradient_ == 0. ) { @@ -145,7 +147,7 @@ void GradientScaling::DetermineScalingParametersImpl( if( nlp_->Eval_jac_c(*x, *jac_c) ) { dc = c_space->MakeNew(); - const double dbl_min = std::numeric_limits::min(); + const Number dbl_min = std::numeric_limits::min(); dc->Set(dbl_min); jac_c->ComputeRowAMax(*dc, false); Number arow_max = dc->Amax(); @@ -192,7 +194,7 @@ void GradientScaling::DetermineScalingParametersImpl( if( nlp_->Eval_jac_d(*x, *jac_d) ) { dd = d_space->MakeNew(); - const double dbl_min = std::numeric_limits::min(); + const Number dbl_min = std::numeric_limits::min(); dd->Set(dbl_min); jac_d->ComputeRowAMax(*dd, false); Number arow_max = dd->Amax(); diff --git a/src/Algorithm/IpGradientScaling.hpp b/src/Algorithm/IpGradientScaling.hpp index 5520b4236..5dcd2875d 100644 --- a/src/Algorithm/IpGradientScaling.hpp +++ b/src/Algorithm/IpGradientScaling.hpp @@ -21,7 +21,7 @@ class GradientScaling: public StandardScalingBase { public: /**@name Constructors/Destructors */ - //@{ + ///@{ GradientScaling( const SmartPtr& nlp ) @@ -33,7 +33,7 @@ class GradientScaling: public StandardScalingBase /** Destructor */ virtual ~GradientScaling() { } - //@} + ///@} /** Register the options for this class */ static void RegisterOptions( @@ -75,7 +75,7 @@ class GradientScaling: public StandardScalingBase * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ GradientScaling( const GradientScaling& @@ -85,7 +85,7 @@ class GradientScaling: public StandardScalingBase void operator=( const GradientScaling& ); - //@} + ///@} /** pointer to the NLP to get scaling parameters */ SmartPtr nlp_; diff --git a/src/Algorithm/IpHessianUpdater.hpp b/src/Algorithm/IpHessianUpdater.hpp index 6bc03e890..f59c80d7b 100644 --- a/src/Algorithm/IpHessianUpdater.hpp +++ b/src/Algorithm/IpHessianUpdater.hpp @@ -23,7 +23,7 @@ class IPOPTLIB_EXPORT HessianUpdater: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ HessianUpdater() { } @@ -31,7 +31,7 @@ class IPOPTLIB_EXPORT HessianUpdater: public AlgorithmStrategyObject /** Destructor */ virtual ~HessianUpdater() { } - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -54,7 +54,7 @@ class IPOPTLIB_EXPORT HessianUpdater: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ HessianUpdater( const HessianUpdater& @@ -64,7 +64,7 @@ class IPOPTLIB_EXPORT HessianUpdater: public AlgorithmStrategyObject void operator=( const HessianUpdater& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpIpoptAlg.cpp b/src/Algorithm/IpIpoptAlg.cpp index e244fdc45..fbff7a85c 100644 --- a/src/Algorithm/IpIpoptAlg.cpp +++ b/src/Algorithm/IpIpoptAlg.cpp @@ -9,11 +9,16 @@ #include "IpJournalist.hpp" #include "IpRestoPhase.hpp" #include "IpOrigIpoptNLP.hpp" +#include "IpBacktrackingLineSearch.hpp" #ifdef IPOPT_HAS_HSL #include "CoinHslConfig.h" #endif +#if IPOPT_CHECKLEVEL > 1 && defined(IPOPT_HAS_FEENABLEEXCEPT) +#include +#endif + namespace Ipopt { #if IPOPT_VERBOSITY > 0 @@ -28,7 +33,8 @@ IpoptAlgorithm::IpoptAlgorithm( const SmartPtr& iterate_initializer, const SmartPtr& iter_output, const SmartPtr& hessian_updater, - const SmartPtr& eq_multiplier_calculator /* = NULL*/ + const SmartPtr& eq_multiplier_calculator, /* = NULL*/ + const std::string& linear_solver_name /* = "" */ ) : search_dir_calculator_(search_dir_calculator), line_search_(line_search), @@ -37,7 +43,8 @@ IpoptAlgorithm::IpoptAlgorithm( iterate_initializer_(iterate_initializer), iter_output_(iter_output), hessian_updater_(hessian_updater), - eq_multiplier_calculator_(eq_multiplier_calculator) + eq_multiplier_calculator_(eq_multiplier_calculator), + linear_solver_name_(linear_solver_name) { DBG_START_METH("IpoptAlgorithm::IpoptAlgorithm", dbg_verbosity); @@ -67,8 +74,9 @@ void IpoptAlgorithm::RegisterOptions( 0., true, 1e10, "If the dual variables deviate from their primal estimates, a correction is performed. " - "(See Eqn. (16) in the implementation paper.) " - "Setting the value to less than 1 disables the correction."); + "See Eqn. (16) in the implementation paper. " + "Setting the value to less than 1 disables the correction.", + true); roptions->AddStringOption2( "recalc_y", "Tells the algorithm to recalculate the equality and inequality multipliers as least square estimates.", @@ -86,21 +94,26 @@ void IpoptAlgorithm::RegisterOptions( 1e-6, "If recalc_y is chosen and the current infeasibility is less than this value, then the multipliers are recomputed."); roptions->SetRegisteringCategory("Step Calculation"); - roptions->AddStringOption2( + roptions->AddBoolOption( "mehrotra_algorithm", - "Indicates if we want to do Mehrotra's algorithm.", - "no", - "no", "Do the usual Ipopt algorithm.", - "yes", "Do Mehrotra's predictor-corrector algorithm.", - "If set to yes, Ipopt runs as Mehrotra's predictor-corrector algorithm. " - "This works usually very well for LPs and convex QPs. " - "This automatically disables the line search, and chooses the (unglobalized) adaptive mu strategy " - "with the \"probing\" oracle, and uses \"corrector_type=affine\" without any safeguards; " + "Indicates whether to do Mehrotra's predictor-corrector algorithm.", + false, + "If enabled, line search is disabled and the (unglobalized) adaptive mu strategy is chosen " + "with the \"probing\" oracle, and \"corrector_type=affine\" is used without any safeguards; " "you should not set any of those options explicitly in addition. " "Also, unless otherwise specified, the values of \"bound_push\", \"bound_frac\", and " - "\"bound_mult_init_val\" are set more aggressive, and sets \"alpha_for_y=bound_mult\"."); - roptions->SetRegisteringCategory(""); - roptions->AddStringOption2("sb", "", "no", "no", "", "yes", ""); + "\"bound_mult_init_val\" are set more aggressive, and sets \"alpha_for_y=bound_mult\". " + "The Mehrotra's predictor-corrector algorithm works usually very well for LPs and convex QPs."); + roptions->SetRegisteringCategory("Undocumented"); + roptions->AddBoolOption("sb", + "whether to skip printing Ipopt copyright banner", + false); + roptions->SetRegisteringCategory("Miscellaneous"); + roptions->AddBoolOption( + "timing_statistics", + "Indicates whether to measure time spend in components of Ipopt and NLP evaluation", + false, + "The overall algorithm time is unaffected by this option."); } static bool copyright_message_printed = false; @@ -113,6 +126,14 @@ bool IpoptAlgorithm::InitializeImpl( DBG_START_METH("IpoptAlgorithm::InitializeImpl", dbg_verbosity); + // disable detailed timing, if not required + bool timing_statistics; + options.GetBoolValue("timing_statistics", timing_statistics, ""); + if( !timing_statistics ) + { + IpData().TimingStats().DisableTimes(); + } + SmartPtr my_options; options.GetBoolValue("mehrotra_algorithm", mehrotra_algorithm_, prefix); if( mehrotra_algorithm_ ) @@ -173,9 +194,6 @@ bool IpoptAlgorithm::InitializeImpl( copyright_message_printed = true; } - // Store which linear solver is chosen for later output - options.GetStringValue("linear_solver", linear_solver_, prefix); - // Read the IpoptAlgorithm options // Initialize the Data object bool retvalue = IpData().Initialize(Jnlst(), *my_options, prefix); @@ -228,6 +246,8 @@ bool IpoptAlgorithm::InitializeImpl( my_options->GetNumericValue("recalc_y_feas_tol", recalc_y_feas_tol_, prefix); } + my_options->GetNumericValue("constr_viol_tol", constr_viol_tol_, prefix); + if( prefix == "resto." ) { skip_print_problem_stats_ = true; @@ -240,6 +260,35 @@ bool IpoptAlgorithm::InitializeImpl( return true; } +// class to execute some tasks when object is destructed +// ends a TimedTask, disables floating-point exceptions +class EndTasks +{ +private: + TimedTask& task_; + int excepts_; +public: + EndTasks( + TimedTask& task, + int excepts + ) + : task_(task), + excepts_(excepts) + { + DBG_ASSERT(task_.IsStarted()); + } + + ~EndTasks() + { + task_.End(); +#if IPOPT_CHECKLEVEL > 1 && defined(IPOPT_HAS_FEENABLEEXCEPT) + fedisableexcept(excepts_); +#else + (void)excepts_; +#endif + } +}; + SolverReturn IpoptAlgorithm::Optimize( bool isResto /*= false */ ) @@ -249,8 +298,19 @@ SolverReturn IpoptAlgorithm::Optimize( // Start measuring CPU time IpData().TimingStats().OverallAlgorithm().Start(); - // Reset Cpu start time (so doesn't carry over from previous Optimize) - IpData().ResetCpuStartTime(); + int disable_excepts = 0; +#if IPOPT_CHECKLEVEL > 1 && defined(IPOPT_HAS_FEENABLEEXCEPT) + int orig_excepts = feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); + if( orig_excepts >= 0 ) + { + // disable exceptions FE_DIVBYZERO, FE_INVALID, FE_OVERFLOW later, if not part of originally set exceptions + disable_excepts = ~orig_excepts & (FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); + } +#endif + + // ensure timed task is ended when Optimize() is left + // ensure additional floating point exceptions are no longer raised when Optimize() is left + EndTasks endtasks(IpData().TimingStats().OverallAlgorithm(), disable_excepts); if( !copyright_message_printed ) { @@ -260,17 +320,7 @@ SolverReturn IpoptAlgorithm::Optimize( if( !isResto ) { Jnlst().Printf(J_ITERSUMMARY, J_MAIN, - "This is Ipopt version " IPOPT_VERSION ", running with linear solver %s.\n", linear_solver_.c_str()); - -#ifndef IPOPT_NOMUMPSNOTE - if( linear_solver_ == "mumps" ) - { - Jnlst().Printf(J_ITERSUMMARY, J_MAIN, - "NOTE: Other linear solvers might be more efficient (see Ipopt documentation).\n"); - } -#endif - Jnlst().Printf(J_ITERSUMMARY, J_MAIN, - "\n"); + "This is Ipopt version " IPOPT_VERSION ", running with linear solver %s.\n\n", linear_solver_name_.c_str()); } SolverReturn retval = UNASSIGNED; @@ -326,13 +376,12 @@ SolverReturn IpoptAlgorithm::Optimize( IpData().TimingStats().ComputeSearchDirection().End(); } - // If we are in the emergency mode, ask to line search object + // If we are in the emergency mode, ask the line search object // to go to the fallback options. If that isn't possible, // issue error message if( emergency_mode ) { - bool retval = line_search_->ActivateFallbackMechanism(); - if( retval ) + if( line_search_->ActivateFallbackMechanism() ) { Jnlst().Printf(J_WARNING, J_MAIN, "WARNING: Problem in step computation; switching to emergency mode.\n"); @@ -357,6 +406,11 @@ SolverReturn IpoptAlgorithm::Optimize( IpData().Set_iter_count(IpData().iter_count() + 1); + if( IpCq().IsSquareProblem() ) + { + ComputeFeasibilityMultipliers(); + } + IpData().TimingStats().CheckConvergence().Start(); conv_status = conv_check_->CheckConvergence(); IpData().TimingStats().CheckConvergence().End(); @@ -366,15 +420,7 @@ SolverReturn IpoptAlgorithm::Optimize( OutputIteration(); IpData().TimingStats().OutputIteration().End(); - if( conv_status == ConvergenceCheck::CONVERGED || conv_status == ConvergenceCheck::CONVERGED_TO_ACCEPTABLE_POINT ) - { - if( IpCq().IsSquareProblem() ) - { - // make the sure multipliers are computed properly - ComputeFeasibilityMultipliers(); - } - } - + bool stop_watchdog = false; switch( conv_status ) { case ConvergenceCheck::CONVERGED: @@ -385,9 +431,15 @@ SolverReturn IpoptAlgorithm::Optimize( break; case ConvergenceCheck::MAXITER_EXCEEDED: retval = MAXITER_EXCEEDED; + stop_watchdog = true; break; case ConvergenceCheck::CPUTIME_EXCEEDED: retval = CPUTIME_EXCEEDED; + stop_watchdog = true; + break; + case ConvergenceCheck::WALLTIME_EXCEEDED: + retval = WALLTIME_EXCEEDED; + stop_watchdog = true; break; case ConvergenceCheck::DIVERGING: retval = DIVERGING_ITERATES; @@ -399,6 +451,12 @@ SolverReturn IpoptAlgorithm::Optimize( retval = INTERNAL_ERROR; break; } + + // stop watchdog if interrupted due to limit to restore iterate from before watchdog (#289) + if( stop_watchdog && dynamic_cast(GetRawPtr(line_search_)) != NULL ) + { + static_cast(GetRawPtr(line_search_))->StopWatchDog(); + } } catch( TINY_STEP_DETECTED& exc ) { @@ -410,11 +468,6 @@ SolverReturn IpoptAlgorithm::Optimize( { exc.ReportException(Jnlst(), J_MOREDETAILED); IpData().TimingStats().ComputeAcceptableTrialPoint().EndIfStarted(); - if( IpCq().IsSquareProblem() ) - { - // make the sure multipliers are computed properly - ComputeFeasibilityMultipliers(); - } retval = STOP_AT_ACCEPTABLE_POINT; } catch( LOCALLY_INFEASIBLE& exc ) @@ -428,7 +481,16 @@ SolverReturn IpoptAlgorithm::Optimize( { exc.ReportException(Jnlst(), J_MOREDETAILED); IpData().TimingStats().ComputeAcceptableTrialPoint().EndIfStarted(); - retval = RESTORATION_FAILURE; + if( IpCq().IsSquareProblem() ) + { + // make sure the multipliers are computed properly + ComputeFeasibilityMultipliersPostprocess(); + retval = FEASIBLE_POINT_FOUND; + } + else + { + retval = RESTORATION_FAILURE; + } } catch( RESTORATION_FAILED& exc ) { @@ -448,6 +510,12 @@ SolverReturn IpoptAlgorithm::Optimize( IpData().TimingStats().ComputeAcceptableTrialPoint().EndIfStarted(); retval = CPUTIME_EXCEEDED; } + catch( RESTORATION_WALLTIME_EXCEEDED& exc ) + { + exc.ReportException(Jnlst(), J_MOREDETAILED); + IpData().TimingStats().ComputeAcceptableTrialPoint().EndIfStarted(); + retval = WALLTIME_EXCEEDED; + } catch( RESTORATION_USER_STOP& exc ) { exc.ReportException(Jnlst(), J_MOREDETAILED); @@ -463,6 +531,7 @@ SolverReturn IpoptAlgorithm::Optimize( catch( IpoptNLP::Eval_Error& exc ) { exc.ReportException(Jnlst(), J_MOREDETAILED); + IpData().TimingStats().InitializeIterates().EndIfStarted(); IpData().TimingStats().ComputeAcceptableTrialPoint().EndIfStarted(); retval = INVALID_NUMBER_DETECTED; } @@ -473,7 +542,7 @@ SolverReturn IpoptAlgorithm::Optimize( if( IpCq().IsSquareProblem() ) { // make the sure multipliers are computed properly - ComputeFeasibilityMultipliers(); + ComputeFeasibilityMultipliersPostprocess(); } retval = FEASIBLE_POINT_FOUND; } @@ -490,7 +559,6 @@ SolverReturn IpoptAlgorithm::Optimize( } DBG_ASSERT(retval != UNASSIGNED && "Unknown return code in the algorithm"); - IpData().TimingStats().OverallAlgorithm().End(); return retval; } @@ -499,7 +567,7 @@ void IpoptAlgorithm::UpdateHessian() Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n"); Jnlst().Printf(J_DETAILED, J_MAIN, - "*** Update HessianMatrix for Iteration %d:", IpData().iter_count()); + "*** Update HessianMatrix for Iteration %" IPOPT_INDEX_FORMAT ":", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n\n"); hessian_updater_->UpdateHessian(); @@ -510,7 +578,7 @@ bool IpoptAlgorithm::UpdateBarrierParameter() Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n"); Jnlst().Printf(J_DETAILED, J_MAIN, - "*** Update Barrier Parameter for Iteration %d:", IpData().iter_count()); + "*** Update Barrier Parameter for Iteration %" IPOPT_INDEX_FORMAT ":", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n\n"); bool retval = mu_update_->UpdateBarrierParameter(); @@ -536,7 +604,7 @@ bool IpoptAlgorithm::ComputeSearchDirection() Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n"); Jnlst().Printf(J_DETAILED, J_MAIN, - "*** Solving the Primal Dual System for Iteration %d:", IpData().iter_count()); + "*** Solving the Primal Dual System for Iteration %" IPOPT_INDEX_FORMAT ":", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n\n"); @@ -545,13 +613,13 @@ bool IpoptAlgorithm::ComputeSearchDirection() if( retval ) { Jnlst().Printf(J_MOREVECTOR, J_MAIN, - "*** Step Calculated for Iteration: %d\n", IpData().iter_count()); + "*** Step Calculated for Iteration: %" IPOPT_INDEX_FORMAT "\n", IpData().iter_count()); IpData().delta()->Print(Jnlst(), J_MOREVECTOR, J_MAIN, "delta"); } else { Jnlst().Printf(J_DETAILED, J_MAIN, - "*** Step could not be computed in iteration %d!\n", IpData().iter_count()); + "*** Step could not be computed in iteration %" IPOPT_INDEX_FORMAT "!\n", IpData().iter_count()); } return retval; @@ -562,7 +630,7 @@ void IpoptAlgorithm::ComputeAcceptableTrialPoint() Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n"); Jnlst().Printf(J_DETAILED, J_MAIN, - "*** Finding Acceptable Trial Point for Iteration %d:", IpData().iter_count()); + "*** Finding Acceptable Trial Point for Iteration %" IPOPT_INDEX_FORMAT ":", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n\n"); line_search_->FindAcceptableTrialPoint(); @@ -595,19 +663,19 @@ void IpoptAlgorithm::AcceptTrialPoint() // Adjust the bounds if necessary Index adjusted_slacks = IpCq().AdjustedTrialSlacks(); - DBG_PRINT((1, "adjusted_slacks = %d\n", adjusted_slacks)); + DBG_PRINT((1, "adjusted_slacks = %" IPOPT_INDEX_FORMAT "\n", adjusted_slacks)); if( adjusted_slacks > 0 ) { IpCq().ResetAdjustedTrialSlacks(); if( adjusted_slacks == 1 ) { Jnlst().Printf(J_WARNING, J_MAIN, - "In iteration %d, %d Slack too small, adjusting variable bound\n", IpData().iter_count(), adjusted_slacks); + "In iteration %" IPOPT_INDEX_FORMAT ", %" IPOPT_INDEX_FORMAT " Slack too small, adjusting variable bound\n", IpData().iter_count(), adjusted_slacks); } else { Jnlst().Printf(J_WARNING, J_MAIN, - "In iteration %d, %d Slacks too small, adjusting variable bounds\n", IpData().iter_count(), adjusted_slacks); + "In iteration %" IPOPT_INDEX_FORMAT ", %" IPOPT_INDEX_FORMAT " Slacks too small, adjusting variable bounds\n", IpData().iter_count(), adjusted_slacks); } if( Jnlst().ProduceOutput(J_VECTOR, J_MAIN) ) { @@ -758,12 +826,6 @@ void IpoptAlgorithm::PrintProblemStatistics() return; } - SmartPtr x = IpData().curr()->x(); - SmartPtr x_L = IpNLP().x_L(); - SmartPtr x_U = IpNLP().x_U(); - SmartPtr Px_L = IpNLP().Px_L(); - SmartPtr Px_U = IpNLP().Px_U(); - Index nx_tot, nx_only_lower, nx_both, nx_only_upper; calc_number_of_bounds(*IpData().curr()->x(), *IpNLP().x_L(), *IpNLP().x_U(), *IpNLP().Px_L(), *IpNLP().Px_U(), nx_tot, nx_only_lower, nx_both, nx_only_upper); @@ -773,23 +835,23 @@ void IpoptAlgorithm::PrintProblemStatistics() ns_tot, ns_only_lower, ns_both, ns_only_upper); Jnlst().Printf(J_SUMMARY, J_STATISTICS, - "Total number of variables............................: %8d\n", nx_tot); + "Total number of variables............................: %8" IPOPT_INDEX_FORMAT "\n", nx_tot); Jnlst().Printf(J_SUMMARY, J_STATISTICS, - " variables with only lower bounds: %8d\n", nx_only_lower); + " variables with only lower bounds: %8" IPOPT_INDEX_FORMAT "\n", nx_only_lower); Jnlst().Printf(J_SUMMARY, J_STATISTICS, - " variables with lower and upper bounds: %8d\n", nx_both); + " variables with lower and upper bounds: %8" IPOPT_INDEX_FORMAT "\n", nx_both); Jnlst().Printf(J_SUMMARY, J_STATISTICS, - " variables with only upper bounds: %8d\n", nx_only_upper); + " variables with only upper bounds: %8" IPOPT_INDEX_FORMAT "\n", nx_only_upper); Jnlst().Printf(J_SUMMARY, J_STATISTICS, - "Total number of equality constraints.................: %8d\n", IpData().curr()->y_c()->Dim()); + "Total number of equality constraints.................: %8" IPOPT_INDEX_FORMAT "\n", IpData().curr()->y_c()->Dim()); Jnlst().Printf(J_SUMMARY, J_STATISTICS, - "Total number of inequality constraints...............: %8d\n", ns_tot); + "Total number of inequality constraints...............: %8" IPOPT_INDEX_FORMAT "\n", ns_tot); Jnlst().Printf(J_SUMMARY, J_STATISTICS, - " inequality constraints with only lower bounds: %8d\n", ns_only_lower); + " inequality constraints with only lower bounds: %8" IPOPT_INDEX_FORMAT "\n", ns_only_lower); Jnlst().Printf(J_SUMMARY, J_STATISTICS, - " inequality constraints with lower and upper bounds: %8d\n", ns_both); + " inequality constraints with lower and upper bounds: %8" IPOPT_INDEX_FORMAT "\n", ns_both); Jnlst().Printf(J_SUMMARY, J_STATISTICS, - " inequality constraints with only upper bounds: %8d\n\n", ns_only_upper); + " inequality constraints with only upper bounds: %8" IPOPT_INDEX_FORMAT "\n\n", ns_only_upper); } void IpoptAlgorithm::ComputeFeasibilityMultipliers() @@ -798,12 +860,104 @@ void IpoptAlgorithm::ComputeFeasibilityMultipliers() dbg_verbosity); DBG_ASSERT(IpCq().IsSquareProblem()); + // if not primal feasible yet, then do not compute multipliers yet + Number constr_viol = IpCq().unscaled_curr_nlp_constraint_violation(NORM_MAX); + if( constr_viol > constr_viol_tol_ ) + { + return; + } + + // if we don't have an object for computing least square + // multipliers we don't compute them + if( IsNull(eq_multiplier_calculator_) ) + { + Jnlst().Printf(J_DETAILED, J_SOLUTION, + "No eq_mult_calculator object available in IpoptAlgorithm to recompute multipliers at solution for square problem.\n"); + return; + } + + IpData().TimingStats().CheckConvergence().Start(); + ConvergenceCheck::ConvergenceStatus conv_status = conv_check_->CheckConvergence(false); + IpData().TimingStats().CheckConvergence().End(); + + // if converged or reached some limit, then do not update multipliers + // status CONTINUE likely means that we are not dual feasible yet, which we try to fix below + if( conv_status != ConvergenceCheck::CONTINUE ) + { + return; + } + + // backup current iterate for case eq_mult_calculator fails + // TODO we could avoid this backup&restore, if eq_multiplier_calculator_ could be told to calculate the multipliers for the trial instead of the current iterate + SmartPtr curr_backup = IpData().curr(); + + SmartPtr iterates = IpData().curr()->MakeNewContainer(); + SmartPtr tmp = iterates->z_L()->MakeNew(); + tmp->Set(0.); + iterates->Set_z_L(*tmp); + tmp = iterates->z_U()->MakeNew(); + tmp->Set(0.); + iterates->Set_z_U(*tmp); + tmp = iterates->v_L()->MakeNew(); + tmp->Set(0.); + iterates->Set_v_L(*tmp); + tmp = iterates->v_U()->MakeNew(); + tmp->Set(0.); + iterates->Set_v_U(*tmp); + SmartPtr y_c = iterates->y_c()->MakeNew(); + SmartPtr y_d = iterates->y_d()->MakeNew(); + IpData().set_trial(iterates); + IpData().AcceptTrialPoint(); + bool retval = eq_multiplier_calculator_->CalculateMultipliers(*y_c, *y_d); + if( retval ) + { + //TODO Check if following line is really necessary + iterates = IpData().curr()->MakeNewContainer(); + iterates->Set_y_c(*y_c); + iterates->Set_y_d(*y_d); + IpData().set_trial(iterates); + IpData().AcceptTrialPoint(); + + // check whether the new iterate satisfies convergence criteria now + // if not, then we better continue with backed up iterate + IpData().TimingStats().CheckConvergence().Start(); + ConvergenceCheck::ConvergenceStatus conv_status = conv_check_->CheckConvergence(false); + IpData().TimingStats().CheckConvergence().End(); + + if( conv_status == ConvergenceCheck::CONVERGED || conv_status == ConvergenceCheck::CONVERGED_TO_ACCEPTABLE_POINT ) + { + return; + } + + Jnlst().Printf(J_DETAILED, J_SOLUTION, + "Multipliers for feasibility problem using eq_mult_calculator does not lead to converged status yet.\n"); + } + else + { + Jnlst().Printf(J_DETAILED, J_SOLUTION, + "Failed to compute multipliers for feasibility problem using eq_mult_calculator.\n"); + } + + // restore original iterate + Jnlst().Printf(J_DETAILED, J_SOLUTION, + "Restoring iterate from before trying eq_mult_calculator.\n"); + SmartPtr orig_iterate = curr_backup->MakeNewContainer(); + IpData().set_trial(orig_iterate); + IpData().AcceptTrialPoint(); +} + +void IpoptAlgorithm::ComputeFeasibilityMultipliersPostprocess() +{ + DBG_START_METH("IpoptAlgorithm::ComputeFeasibilityMultipliersPostprocess", + dbg_verbosity); + DBG_ASSERT(IpCq().IsSquareProblem()); + // if we don't have an object for computing least square // multipliers we don't compute them if( IsNull(eq_multiplier_calculator_) ) { Jnlst().Printf(J_WARNING, J_SOLUTION, - "This is a square problem, but multipliers cannot be recomputed at solution, since no eq_mult_calculator object is available in IpoptAlgorithm\n"); + "No eq_mult_calculator object available in IpoptAlgorithm to recompute multipliers at solution for square problem.\n"); return; } @@ -827,7 +981,7 @@ void IpoptAlgorithm::ComputeFeasibilityMultipliers() bool retval = eq_multiplier_calculator_->CalculateMultipliers(*y_c, *y_d); if( retval ) { - //Check if following line is really necessary + //TODO Check if following line is really necessary iterates = IpData().curr()->MakeNewContainer(); iterates->Set_y_c(*y_c); iterates->Set_y_d(*y_d); @@ -837,7 +991,7 @@ void IpoptAlgorithm::ComputeFeasibilityMultipliers() else { Jnlst().Printf(J_WARNING, J_SOLUTION, - "Cannot recompute multipliers for feasibility problem. Error in eq_mult_calculator\n"); + "Failed to compute multipliers for feasibility problem using eq_mult_calculator.\n"); } } @@ -921,7 +1075,7 @@ Number IpoptAlgorithm::correct_bound_multiplier( if( IpData().FreeMuMode() ) { mu = IpCq().trial_avrg_compl(); - mu = Min(mu, 1e3); + mu = Min(mu, Number(1e3)); } else { @@ -948,7 +1102,7 @@ Number IpoptAlgorithm::correct_bound_multiplier( DBG_PRINT_VECTOR(2, "step_z", *step_z); - Number max_correction_up = Max(0., -step_z->Min()); + Number max_correction_up = Max(Number(0.), -step_z->Min()); if( max_correction_up > 0. ) { SmartPtr tmp = trial_z.MakeNew(); @@ -964,7 +1118,7 @@ Number IpoptAlgorithm::correct_bound_multiplier( step_z->AddTwoVectors(1. / kappa_sigma_ * mu, *one_over_s, -1., *new_trial_z, 0.); - Number max_correction_low = Max(0., step_z->Max()); + Number max_correction_low = Max(Number(0.), step_z->Max()); if( max_correction_low > 0. ) { SmartPtr tmp = trial_z.MakeNew(); @@ -987,7 +1141,7 @@ void IpoptAlgorithm::print_copyright_message( "\n******************************************************************************\n" "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" + " For more information visit https://github.com/coin-or/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" diff --git a/src/Algorithm/IpIpoptAlg.hpp b/src/Algorithm/IpIpoptAlg.hpp index d58cec692..2c559cd3d 100644 --- a/src/Algorithm/IpIpoptAlg.hpp +++ b/src/Algorithm/IpIpoptAlg.hpp @@ -23,11 +23,6 @@ namespace Ipopt { -/** @name Exceptions */ -//@{ -DECLARE_STD_EXCEPTION(STEP_COMPUTATION_FAILED); -//@} - /** The main ipopt algorithm class. * * Main Ipopt algorithm class, contains the main optimize method, @@ -46,27 +41,30 @@ class IPOPTLIB_EXPORT IpoptAlgorithm: public AlgorithmStrategyObject public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * The IpoptAlgorithm uses smart pointers for these * passed-in pieces to make sure that a user of IpoptAlgoroithm * cannot pass in an object created on the stack! + * + * The optional linear_solver_name is used for printing. */ IpoptAlgorithm( - const SmartPtr& search_dir_calculator, - const SmartPtr& line_search, - const SmartPtr& mu_update, - const SmartPtr& conv_check, - const SmartPtr& iterate_initializer, - const SmartPtr& iter_output, - const SmartPtr& hessian_updater, - const SmartPtr& eq_multiplier_calculator = NULL + const SmartPtr& search_dir_calculator, ///< search direction calculator + const SmartPtr& line_search, ///< line search + const SmartPtr& mu_update, ///< mu updater + const SmartPtr& conv_check, ///< convergence check + const SmartPtr& iterate_initializer, ///< iterate initializer + const SmartPtr& iter_output, ///< iteration output + const SmartPtr& hessian_updater, ///< hessian updater + const SmartPtr& eq_multiplier_calculator = NULL, ///< calculator for multipliers + const std::string& linear_solver_name = "" ///< name of linear solver @since 3.14.0 ); /** Destructor */ virtual ~IpoptAlgorithm(); - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -80,19 +78,19 @@ class IPOPTLIB_EXPORT IpoptAlgorithm: public AlgorithmStrategyObject ); /** Methods for IpoptType */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} /**@name Access to internal strategy objects */ - //@{ + ///@{ SmartPtr SearchDirCalc() { return search_dir_calculator_; } - //@} + ///@} static void print_copyright_message( const Journalist& jnlst @@ -108,7 +106,7 @@ class IPOPTLIB_EXPORT IpoptAlgorithm: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ IpoptAlgorithm(); @@ -121,10 +119,10 @@ class IPOPTLIB_EXPORT IpoptAlgorithm: public AlgorithmStrategyObject void operator=( const IpoptAlgorithm& ); - //@} + ///@} /** @name Strategy objects */ - //@{ + ///@{ SmartPtr search_dir_calculator_; SmartPtr line_search_; SmartPtr mu_update_; @@ -133,13 +131,15 @@ class IPOPTLIB_EXPORT IpoptAlgorithm: public AlgorithmStrategyObject SmartPtr iter_output_; SmartPtr hessian_updater_; /** The multiplier calculator (for y_c and y_d) has to be set only - * if option recalc_y is set to true + * if option recalc_y is set to true. + * If set, then it is also used to compute the dual multipliers for + * square problems. */ SmartPtr eq_multiplier_calculator_; - //@} + ///@} /** @name Main steps of the algorithm */ - //@{ + ///@{ /** Method for updating the current Hessian. * * This can either just evaluate the exact Hessian (based on @@ -186,18 +186,28 @@ class IPOPTLIB_EXPORT IpoptAlgorithm: public AlgorithmStrategyObject /** Print the problem size statistics */ void PrintProblemStatistics(); - /** Compute the Lagrangian multipliers for a feasibility problem */ + /** Tries to compute Lagrangian multipliers for a feasibility problem + * + * Only computes multipliers if primal feasible but not converged yet. + * Restores current iterate if multiplier computation fails or new point does not satisfy convergence criteria, too. + */ void ComputeFeasibilityMultipliers(); - //@} + + /** Compute the Lagrangian multipliers for a feasibility problem in post processing + * + * Always tries to compute multipliers and does not restore current iterate if failing. + */ + void ComputeFeasibilityMultipliersPostprocess(); + ///@} /** @name internal flags */ - //@{ + ///@{ /** Flag indicating if the statistic should not be printed */ bool skip_print_problem_stats_; - //@} + ///@} /** @name Algorithmic parameters */ - //@{ + ///@{ /** safeguard factor for bound multipliers. * * If value >= 1, then @@ -219,11 +229,13 @@ class IPOPTLIB_EXPORT IpoptAlgorithm: public AlgorithmStrategyObject */ bool mehrotra_algorithm_; /** String specifying linear solver */ - std::string linear_solver_; - //@} + std::string linear_solver_name_; + /** Constraint violation tolerance on unscaled problem */ + Number constr_viol_tol_; + ///@} /** @name auxiliary functions */ - //@{ + ///@{ void calc_number_of_bounds( const Vector& x, const Vector& x_L, @@ -251,7 +263,7 @@ class IPOPTLIB_EXPORT IpoptAlgorithm: public AlgorithmStrategyObject const Vector& trial_compl, SmartPtr& new_trial_z ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpIpoptCalculatedQuantities.cpp b/src/Algorithm/IpIpoptCalculatedQuantities.cpp index 6de0a5462..df366eaae 100644 --- a/src/Algorithm/IpIpoptCalculatedQuantities.cpp +++ b/src/Algorithm/IpIpoptCalculatedQuantities.cpp @@ -106,6 +106,12 @@ IpoptCalculatedQuantities::IpoptCalculatedQuantities( curr_primal_dual_system_error_cache_(1), trial_primal_dual_system_error_cache_(3), + unscaled_curr_orig_x_LU_viol_cache_(1), + unscaled_curr_orig_bounds_viol_cache_(1), + curr_orig_x_L_viol_cache_(1), + curr_orig_x_U_viol_cache_(1), + curr_orig_bounds_viol_cache_(1), + primal_frac_to_the_bound_cache_(5), dual_frac_to_the_bound_cache_(5), @@ -135,13 +141,14 @@ void IpoptCalculatedQuantities::RegisterOptions( SmartPtr roptions ) { - roptions->SetRegisteringCategory("Convergence"); + roptions->SetRegisteringCategory("Termination"); roptions->AddLowerBoundedNumberOption( "s_max", "Scaling threshold for the NLP error.", 0., true, 100., - "(See paragraph after Eqn. (6) in the implementation paper.)"); + "See paragraph after Eqn. (6) in the implementation paper.", + true); roptions->SetRegisteringCategory("NLP"); roptions->AddLowerBoundedNumberOption( @@ -149,20 +156,21 @@ void IpoptCalculatedQuantities::RegisterOptions( "Weight for linear damping term (to handle one-sided bounds).", 0., false, 1e-5, - "(see Section 3.7 in implementation paper.)"); + "See Section 3.7 in implementation paper.", + true); roptions->SetRegisteringCategory("Line Search"); roptions->AddLowerBoundedNumberOption( "slack_move", "Correction size for very small slacks.", 0.0, false, - pow(std::numeric_limits::epsilon(), 0.75), + std::pow(std::numeric_limits::epsilon(), 0.75), "Due to numerical issues or the lack of an interior, the slack variables might become very small. " "If a slack becomes very small compared to machine precision, the corresponding bound is moved slightly. " "This parameter determines how large the move should be. " "Its default value is mach_eps^{3/4}. " - "(See also end of Section 3.5 in implementation paper - but actual implementation might be somewhat different.)"); - roptions->SetRegisteringCategory("Line Search"); + "See also end of Section 3.5 in implementation paper - but actual implementation might be somewhat different.", + true); roptions->AddStringOption3( "constraint_violation_norm_type", "Norm to be used for the constraint violation in the line search.", @@ -170,7 +178,8 @@ void IpoptCalculatedQuantities::RegisterOptions( "1-norm", "use the 1-norm", "2-norm", "use the 2-norm", "max-norm", "use the infinity norm", - "Determines which norm should be used when the algorithm computes the constraint violation in the line search."); + "Determines which norm should be used when the algorithm computes the constraint violation in the line search.", + true); } bool IpoptCalculatedQuantities::Initialize( @@ -179,7 +188,6 @@ bool IpoptCalculatedQuantities::Initialize( const std::string& prefix ) { - std::string svalue; Index enum_int; options.GetNumericValue("s_max", s_max_, prefix); @@ -340,7 +348,7 @@ SmartPtr IpoptCalculatedQuantities::curr_slack_s_U() DBG_ASSERT(num_adjusted_slack_s_U_ == 0); num_adjusted_slack_s_U_ = CalculateSafeSlack(result, s_bound, s, ip_data_->curr()->v_U()); DBG_PRINT_VECTOR(2, "result", *result); - DBG_PRINT((1, "num_adjusted_slack_s_U = %d\n", num_adjusted_slack_s_U_)); + DBG_PRINT((1, "num_adjusted_slack_s_U = %" IPOPT_INDEX_FORMAT "\n", num_adjusted_slack_s_U_)); } curr_slack_s_U_cache_.AddCachedResult1Dep(result, *s); } @@ -436,7 +444,7 @@ SmartPtr IpoptCalculatedQuantities::trial_slack_s_U() DBG_PRINT_VECTOR(2, "result", *result); DBG_ASSERT(num_adjusted_slack_s_U_ == 0); num_adjusted_slack_s_U_ = CalculateSafeSlack(result, s_bound, s, ip_data_->curr()->v_U()); - DBG_PRINT((1, "num_adjusted_slack_s_U = %d\n", num_adjusted_slack_s_U_)); + DBG_PRINT((1, "num_adjusted_slack_s_U = %" IPOPT_INDEX_FORMAT "\n", num_adjusted_slack_s_U_)); DBG_PRINT_VECTOR(2, "trial_slack_s_U", *result); } trial_slack_s_U_cache_.AddCachedResult1Dep(result, *s); @@ -458,54 +466,66 @@ Index IpoptCalculatedQuantities::CalculateSafeSlack( { Number min_slack = slack->Min(); // TODO we need to make sure that this also works for non-monotone MUs - Number s_min = std::numeric_limits::epsilon() * Min(1., ip_data_->curr_mu()); - DBG_PRINT((1, "s_min = %g, min_slack=%g\n", s_min, min_slack)); + Number s_min = std::numeric_limits::epsilon() * Min(Number(1.), ip_data_->curr_mu()); + // if mu = is very small, then s_min may have dropped to 0 (e.g., #212) + // but we want slack corrections also if (and especially if) slacks are at 0 + // (otherwise the barrier_obj becomes inf and there are asserts that say that this shouldn't happen) + // so we ensure that s_min is at least positive + if( s_min == 0.0 ) + { + s_min = std::numeric_limits::min(); + } + DBG_PRINT((1, "s_min = %g, curr_mu = %g, min_slack=%g\n", s_min, ip_data_->curr_mu(), min_slack)); if( min_slack < s_min ) { // Need to correct the slacks and calculate new bounds... SmartPtr t = slack->MakeNew(); t->Copy(*slack); t->AddScalar(-s_min); - t->ElementWiseSgn(); + t->ElementWiseSgn(); // sign(slack-s_min), so -1 if slack < s_min (and this is a strict "<", so s_min=0 would be a problem here!) SmartPtr zero_vec = t->MakeNew(); zero_vec->Set(0.0); - t->ElementWiseMin(*zero_vec); - t->Scal(-1.0); + t->ElementWiseMin(*zero_vec); // t = -1 if slack < s_min, otherwise 0 + t->Scal(-1.0); // t = 1 if slack < s_min, otherwise 0 retval = (Index) t->Asum(); - DBG_PRINT((1, "Number of slack corrections = %d\n", retval)); + DBG_PRINT((1, "Number of slack corrections = %" IPOPT_INDEX_FORMAT "\n", retval)); DBG_PRINT_VECTOR(2, "t(sgn)", *t); - // ToDo AW: I added the follwing line b/c I found a case where + DBG_PRINT_VECTOR(2, "multiplier", *multiplier); + + // ToDo AW: I added the following line b/c I found a case where // slack was negative and this correction produced 0 slack->ElementWiseMax(*zero_vec); SmartPtr t2 = t->MakeNew(); t2->Set(ip_data_->curr_mu()); - t2->ElementWiseDivide(*multiplier); + t2->ElementWiseDivide(*multiplier); // t2 = mu / multiplier (NOTE: this gives inf where multiplier is 0!) SmartPtr s_min_vec = t2->MakeNew(); s_min_vec->Set(s_min); - t2->ElementWiseMax(*s_min_vec); - t2->Axpy(-1.0, *slack); - DBG_PRINT_VECTOR(2, "tw(smin,mu/mult)", *t2); + t2->ElementWiseMax(*s_min_vec); // t2 = max(mu/multiplier,s_min) + t2->Axpy(-1.0, *slack); // t2 = max(mu/multiplier,s_min) - slack + DBG_PRINT_VECTOR(2, "tw(smin,mu/mult)=max(mu/multiplier,s_min)-slack", *t2); - t->ElementWiseMultiply(*t2); - t->Axpy(1.0, *slack); + // this was t->ElementWiseMultiply(*t2) before, but 0*inf=nan + // since entries in t are either 0 or 1, we introduced ElementWiseSelect and use that here + t->ElementWiseSelect(*t2); // t = max(mu/multiplier,s_min) - slack if slack < s_min, otherwise 0 + t->Axpy(1.0, *slack); // t = max(mu/multiplier,s_min) if slack < s_min, otherwise slack SmartPtr t_max = t2; t_max->Set(1.0); SmartPtr abs_bound = bound->MakeNew(); abs_bound->Copy(*bound); abs_bound->ElementWiseAbs(); - t_max->ElementWiseMax(*abs_bound); + t_max->ElementWiseMax(*abs_bound); // max(1.0,|bound|) DBG_PRINT_VECTOR(2, "t_max1", *t_max); DBG_PRINT_VECTOR(2, "slack", *slack); - t_max->AddOneVector(1.0, *slack, slack_move_); - DBG_PRINT_VECTOR(2, "t_max2", *t_max); + t_max->AddOneVector(1.0, *slack, slack_move_); // t_max = slack_move*max(1.0,|bound|) + slack + DBG_PRINT_VECTOR(2, "t_max2=slack_move*max(1.0,|bound|)+slack", *t_max); - t->ElementWiseMin(*t_max); + t->ElementWiseMin(*t_max); // t = min(max(mu/multiplier,s_min), slack_move*max(1.0,|bound|))+slack, if slack < s_min, otherwise slack DBG_PRINT_VECTOR(2, "new_slack", *t); slack = t; @@ -520,9 +540,8 @@ Index IpoptCalculatedQuantities::AdjustedTrialSlacks() { DBG_START_METH("IpoptCalculatedQuantities::AdjustedTrialSlacks()", dbg_verbosity); - Index result = - (num_adjusted_slack_x_L_ + num_adjusted_slack_x_U_ + num_adjusted_slack_s_L_ + num_adjusted_slack_s_U_); - DBG_PRINT((1, "result = %d\n", result)); + Index result = num_adjusted_slack_x_L_ + num_adjusted_slack_x_U_ + num_adjusted_slack_s_L_ + num_adjusted_slack_s_U_; + DBG_PRINT((1, "result = %" IPOPT_INDEX_FORMAT "\n", result)); return result; } @@ -1568,6 +1587,297 @@ Number IpoptCalculatedQuantities::unscaled_curr_nlp_constraint_violation( return result; } +SmartPtr IpoptCalculatedQuantities::unscaled_orig_x_L_violation( + const Vector& x +) +{ + DBG_START_METH("IpoptCalculatedQuantities::unscaled_orig_x_L_violation()", dbg_verbosity); + + SmartPtr orig_x_L; + SmartPtr viol_L; + + OrigIpoptNLP* orignlp = dynamic_cast(GetRawPtr(ip_nlp_)); + if( orignlp != NULL ) + { + orig_x_L = orignlp->orig_x_L(); + } + + if( !IsValid(orig_x_L) || ip_nlp_->Px_L()->NCols() == 0 ) + { + // not OrigIpoptNLP, bounds not relaxed, or no lower bounds + viol_L = ip_nlp_->x_L()->MakeNew(); + viol_L->Set(0.0); + } + else + { + viol_L = orig_x_L->MakeNew(); + ip_nlp_->Px_L()->TransMultVector(-1., x, 0., *viol_L); // get -x in x_L space + viol_L->Axpy(1.0, *orig_x_L); // tmp = -x + x_L, so positive entries are violations of lower bounds + + // set negative entries to 0 + SmartPtr zero = viol_L->MakeNew(); + zero->Set(0.); + viol_L->ElementWiseMax(*zero); + } + + return viol_L; +} + +SmartPtr IpoptCalculatedQuantities::unscaled_orig_x_U_violation( + const Vector& x +) +{ + DBG_START_METH("IpoptCalculatedQuantities::unscaled_orig_x_U_violation()", dbg_verbosity); + + SmartPtr orig_x_U; + SmartPtr viol_U; + + OrigIpoptNLP* orignlp = dynamic_cast(GetRawPtr(ip_nlp_)); + if( orignlp != NULL ) + { + orig_x_U = orignlp->orig_x_U(); + } + + if( !IsValid(orig_x_U) || ip_nlp_->Px_U()->NCols() == 0 ) + { + // not OrigIpoptNLP, bounds not relaxed, or no lower bounds + viol_U = ip_nlp_->x_U()->MakeNew(); + viol_U->Set(0.0); + } + else + { + viol_U = orig_x_U->MakeNew(); + ip_nlp_->Px_U()->TransMultVector(1., x, 0., *viol_U); // get x in x_U space + viol_U->Axpy(-1.0, *orig_x_U); // tmp = x - x_U, so positive entries are violations of upper bounds + + // set negative entries to 0 + SmartPtr zero = viol_U->MakeNew(); + zero->Set(0.); + viol_U->ElementWiseMax(*zero); + } + + return viol_U; +} + +SmartPtr IpoptCalculatedQuantities::unscaled_curr_orig_x_L_violation() +{ + DBG_START_METH("IpoptCalculatedQuantities::unscaled_curr_orig_x_L_violation()", dbg_verbosity); + + // compute violation w.r.t. both lower and upper bounds so we will have to unscale x only once + // since usually if one wants the violation w.r.t. one bound than one also wants the other + + std::pair, SmartPtr > viol_LU; + SmartPtr x = ip_data_->curr()->x(); + if( !unscaled_curr_orig_x_LU_viol_cache_.GetCachedResult1Dep(viol_LU, *x) ) + { + SmartPtr un_x = ip_nlp_->NLP_scaling()->unapply_vector_scaling_x(x); + + viol_LU.first = unscaled_orig_x_L_violation(*un_x); + viol_LU.second = unscaled_orig_x_U_violation(*un_x); + + unscaled_curr_orig_x_LU_viol_cache_.AddCachedResult1Dep(viol_LU, *x); + } + + return ConstPtr(viol_LU.first); +} + +SmartPtr IpoptCalculatedQuantities::unscaled_curr_orig_x_U_violation() +{ + DBG_START_METH("IpoptCalculatedQuantities::unscaled_curr_orig_x_U_violation()", dbg_verbosity); + + // update violation w.r.t. both x_L and x_U, if necessary + unscaled_curr_orig_x_L_violation(); + + SmartPtr x = ip_data_->curr()->x(); + std::pair, SmartPtr > viol_LU; + unscaled_curr_orig_x_LU_viol_cache_.GetCachedResult1Dep(viol_LU, *x); + + return ConstPtr(viol_LU.second); +} + +Number IpoptCalculatedQuantities::unscaled_curr_orig_bounds_violation( + ENormType NormType +) +{ + DBG_START_METH("IpoptCalculatedQuantities::unscaled_curr_orig_bounds_violation()", dbg_verbosity); + + SmartPtr x = ip_data_->curr()->x(); + + std::vector deps(1); + deps[0] = GetRawPtr(x); + std::vector sdeps(1); + sdeps[0] = (Number) NormType; + + Number result; + if( !unscaled_curr_orig_bounds_viol_cache_.GetCachedResult(result, deps, sdeps) ) + { + // update violation w.r.t. both x_L and x_U, if necessary + unscaled_curr_orig_x_L_violation(); + + std::pair, SmartPtr > viol_LU; + unscaled_curr_orig_x_LU_viol_cache_.GetCachedResult1Dep(viol_LU, *x); + + result = CalcNormOfType(NormType, *viol_LU.first, *viol_LU.second); + + unscaled_curr_orig_bounds_viol_cache_.AddCachedResult(result, deps, sdeps); + } + + return result; +} + +SmartPtr IpoptCalculatedQuantities::orig_x_L_violation( + const Vector& x +) +{ + DBG_START_METH("IpoptCalculatedQuantities::orig_x_L_violation()", dbg_verbosity); + + SmartPtr orig_x_L; + SmartPtr viol_L; + + OrigIpoptNLP* orignlp = dynamic_cast(GetRawPtr(ip_nlp_)); + if( orignlp != NULL ) + { + orig_x_L = orignlp->orig_x_L(); + } + + if( !IsValid(orig_x_L) || ip_nlp_->Px_L()->NCols() == 0 ) + { + // not OrigIpoptNLP, bounds not relaxed, or no lower bounds + viol_L = ip_nlp_->x_L()->MakeNew(); + viol_L->Set(0.0); + } + else + { + // orig_x_L scaled + SmartPtr x_L = ip_nlp_->NLP_scaling()->apply_vector_scaling_x_LU(*ip_nlp_->Px_L(), orig_x_L, *Tmp_x().OwnerSpace()); + + viol_L = x_L->MakeNew(); + ip_nlp_->Px_L()->TransMultVector(-1., x, 0., *viol_L); // get -x in x_L space + + viol_L->Axpy(1.0, *x_L); // tmp = -x + x_L, so positive entries are violations of lower bounds + + // set negative entries to 0 + SmartPtr zero = viol_L->MakeNew(); + zero->Set(0.); + viol_L->ElementWiseMax(*zero); + } + + return viol_L; +} + +SmartPtr IpoptCalculatedQuantities::orig_x_U_violation( + const Vector& x +) +{ + DBG_START_METH("IpoptCalculatedQuantities::orig_x_U_violation()", dbg_verbosity); + + SmartPtr viol_U; + SmartPtr orig_x_U; + + OrigIpoptNLP* orignlp = dynamic_cast(GetRawPtr(ip_nlp_)); + if( orignlp != NULL ) + { + orig_x_U = orignlp->orig_x_U(); + } + + if( !IsValid(orig_x_U) || ip_nlp_->Px_U()->NCols() == 0 ) + { + // not OrigIpoptNLP, bounds not relaxed, or no lower bounds + viol_U = ip_nlp_->x_U()->MakeNew(); + viol_U->Set(0.0); + } + else + { + SmartPtr x_U = ip_nlp_->NLP_scaling()->apply_vector_scaling_x_LU(*ip_nlp_->Px_U(), orig_x_U, *Tmp_x().OwnerSpace()); + + viol_U = x_U->MakeNew(); + ip_nlp_->Px_U()->TransMultVector(1., x, 0., *viol_U); // get x in x_U space + + viol_U->Axpy(-1.0, *x_U); // tmp = x - x_U, so positive entries are violations of upper bounds + + // set negative entries to 0 + SmartPtr zero = viol_U->MakeNew(); + zero->Set(0.); + viol_U->ElementWiseMax(*zero); + } + + return viol_U; +} + +SmartPtr IpoptCalculatedQuantities::curr_orig_x_L_violation() +{ + DBG_START_METH("IpoptCalculatedQuantities::curr_orig_x_L_violation()", dbg_verbosity); + + if( !ip_nlp_->NLP_scaling()->have_x_scaling() ) + { + return unscaled_curr_orig_x_L_violation(); + } + + SmartPtr viol_L; + SmartPtr x = ip_data_->curr()->x(); + if( !curr_orig_x_L_viol_cache_.GetCachedResult1Dep(viol_L, *x) ) + { + viol_L = orig_x_L_violation(*x); + + curr_orig_x_L_viol_cache_.AddCachedResult1Dep(viol_L, *x); + } + + return ConstPtr(viol_L); +} + +SmartPtr IpoptCalculatedQuantities::curr_orig_x_U_violation() +{ + DBG_START_METH("IpoptCalculatedQuantities::curr_orig_x_U_violation()", dbg_verbosity); + + if( !ip_nlp_->NLP_scaling()->have_x_scaling() ) + { + return unscaled_curr_orig_x_U_violation(); + } + + SmartPtr viol_U; + SmartPtr x = ip_data_->curr()->x(); + if( !curr_orig_x_U_viol_cache_.GetCachedResult1Dep(viol_U, *x) ) + { + viol_U = orig_x_U_violation(*x); + + curr_orig_x_U_viol_cache_.AddCachedResult1Dep(viol_U, *x); + } + + return ConstPtr(viol_U); +} + +Number IpoptCalculatedQuantities::curr_orig_bounds_violation( + ENormType NormType +) +{ + DBG_START_METH("IpoptCalculatedQuantities::curr_orig_bounds_violation()", dbg_verbosity); + + if( !ip_nlp_->NLP_scaling()->have_x_scaling() ) + { + return unscaled_curr_orig_bounds_violation(NormType); + } + + SmartPtr x = ip_data_->curr()->x(); + + std::vector deps(1); + deps[0] = GetRawPtr(x); + std::vector sdeps(1); + sdeps[0] = (Number) NormType; + + Number result; + if( !curr_orig_bounds_viol_cache_.GetCachedResult(result, deps, sdeps) ) + { + SmartPtr viol_L = curr_orig_x_L_violation(); + SmartPtr viol_U = curr_orig_x_U_violation(); + + result = CalcNormOfType(NormType, *viol_L, *viol_U); + + curr_orig_bounds_viol_cache_.AddCachedResult(result, deps, sdeps); + } + + return result; +} + Number IpoptCalculatedQuantities::unscaled_trial_nlp_constraint_violation( ENormType NormType ) @@ -2212,7 +2522,7 @@ Number IpoptCalculatedQuantities::CalcNormOfType( case NORM_1: return vec1.Asum() + vec2.Asum(); case NORM_2: - return sqrt(pow(vec1.Nrm2(), 2) + pow(vec2.Nrm2(), 2)); + return std::sqrt(std::pow(vec1.Nrm2(), 2) + std::pow(vec2.Nrm2(), 2)); case NORM_MAX: return Max(vec1.Amax(), vec2.Amax()); default: @@ -2242,7 +2552,7 @@ Number IpoptCalculatedQuantities::CalcNormOfType( Number nrm = vecs[i]->Nrm2(); result += nrm * nrm; } - result = sqrt(result); + result = std::sqrt(result); break; case NORM_MAX: for( Index i = 0; i < (Index) vecs.size(); i++ ) @@ -2639,7 +2949,7 @@ Number IpoptCalculatedQuantities::unscaled_curr_complementarity( ENormType NormType ) { - return ip_nlp_->NLP_scaling()->unapply_obj_scaling(curr_complementarity(mu, NormType)); + return std::abs(ip_nlp_->NLP_scaling()->unapply_obj_scaling(curr_complementarity(mu, NormType))); } Number IpoptCalculatedQuantities::CalcCentralityMeasure( @@ -2653,7 +2963,6 @@ Number IpoptCalculatedQuantities::CalcCentralityMeasure( dbg_verbosity); Number MinCompl = std::numeric_limits::max(); - bool have_bounds = false; Index n_compl_x_L = compl_x_L.Dim(); Index n_compl_x_U = compl_x_U.Dim(); @@ -2663,55 +2972,23 @@ Number IpoptCalculatedQuantities::CalcCentralityMeasure( // Compute the Minimum of all complementarities if( n_compl_x_L > 0 ) { - if( have_bounds ) - { - MinCompl = Min(MinCompl, compl_x_L.Min()); - } - else - { - MinCompl = compl_x_L.Min(); - } - have_bounds = true; + MinCompl = compl_x_L.Min(); } if( n_compl_x_U > 0 ) { - if( have_bounds ) - { - MinCompl = Min(MinCompl, compl_x_U.Min()); - } - else - { - MinCompl = compl_x_U.Min(); - } - have_bounds = true; + MinCompl = Min(MinCompl, compl_x_U.Min()); } if( n_compl_s_L > 0 ) { - if( have_bounds ) - { - MinCompl = Min(MinCompl, compl_s_L.Min()); - } - else - { - MinCompl = compl_s_L.Min(); - } - have_bounds = true; + MinCompl = Min(MinCompl, compl_s_L.Min()); } if( n_compl_s_U > 0 ) { - if( have_bounds ) - { - MinCompl = Min(MinCompl, compl_s_U.Min()); - } - else - { - MinCompl = compl_s_U.Min(); - } - have_bounds = true; + MinCompl = Min(MinCompl, compl_s_U.Min()); } - // If there are no bounds, just return 0.; - if( !have_bounds ) + // If there are no bounds, just return 0 + if( MinCompl == std::numeric_limits::max() ) { return 0.; } @@ -2732,7 +3009,7 @@ Number IpoptCalculatedQuantities::CalcCentralityMeasure( Number xi = MinCompl / avrg_compl; // The folloking line added for the case that avrg_compl is // slighly smaller than MinCompl, due to numerical roundoff - xi = Min(1., xi); + xi = Min(Number(1.), xi); return xi; } @@ -2798,36 +3075,27 @@ Number IpoptCalculatedQuantities::curr_nlp_error() if( !curr_nlp_error_cache_.GetCachedResult(result, tdeps) ) { - if( ip_data_->curr()->x()->Dim() == ip_data_->curr()->y_c()->Dim() ) - { - // This is a square problem, we only need to consider the - // infeasibility - result = curr_nlp_constraint_violation(NORM_MAX); - } - else - { - Number s_d = 0; - Number s_c = 0; - ComputeOptimalityErrorScaling(*ip_data_->curr()->y_c(), *ip_data_->curr()->y_d(), *ip_data_->curr()->z_L(), - *ip_data_->curr()->z_U(), *ip_data_->curr()->v_L(), *ip_data_->curr()->v_U(), s_max_, s_d, s_c); - DBG_PRINT((1, "s_d = %lf, s_c = %lf\n", s_d, s_c)); - - // Dual infeasibility - DBG_PRINT((1, "curr_dual_infeasibility(NORM_MAX) = %8.2e\n", - curr_dual_infeasibility(NORM_MAX))); - result = curr_dual_infeasibility(NORM_MAX) / s_d; - /* - // Primal infeasibility - DBG_PRINT((1, "curr_primal_infeasibility(NORM_MAX) = %8.2e\n", - curr_primal_infeasibility(NORM_MAX))); - result = Max(result, curr_primal_infeasibility(NORM_MAX)); - */ - result = Max(result, curr_nlp_constraint_violation(NORM_MAX)); - // Complementarity - DBG_PRINT((1, "curr_complementarity(mu_target_, NORM_MAX) = %8.2e\n", - curr_complementarity(mu_target_, NORM_MAX))); - result = Max(result, curr_complementarity(mu_target_, NORM_MAX) / s_c); - } + Number s_d = 0; + Number s_c = 0; + ComputeOptimalityErrorScaling(*ip_data_->curr()->y_c(), *ip_data_->curr()->y_d(), *ip_data_->curr()->z_L(), + *ip_data_->curr()->z_U(), *ip_data_->curr()->v_L(), *ip_data_->curr()->v_U(), s_max_, s_d, s_c); + DBG_PRINT((1, "s_d = %lf, s_c = %lf\n", s_d, s_c)); + + // Dual infeasibility + DBG_PRINT((1, "curr_dual_infeasibility(NORM_MAX) = %8.2e\n", + curr_dual_infeasibility(NORM_MAX))); + result = curr_dual_infeasibility(NORM_MAX) / s_d; + /* + // Primal infeasibility + DBG_PRINT((1, "curr_primal_infeasibility(NORM_MAX) = %8.2e\n", + curr_primal_infeasibility(NORM_MAX))); + result = Max(result, curr_primal_infeasibility(NORM_MAX)); + */ + result = Max(result, curr_nlp_constraint_violation(NORM_MAX)); + // Complementarity + DBG_PRINT((1, "curr_complementarity(mu_target_, NORM_MAX) = %8.2e\n", + curr_complementarity(mu_target_, NORM_MAX))); + result = Max(result, curr_complementarity(mu_target_, NORM_MAX) / s_c); curr_nlp_error_cache_.AddCachedResult(result, tdeps); } @@ -2868,9 +3136,7 @@ Number IpoptCalculatedQuantities::unscaled_curr_nlp_error() result = unscaled_curr_dual_infeasibility(NORM_MAX); // Constraint violation result = Max(result, unscaled_curr_nlp_constraint_violation(NORM_MAX)); - // Complementarity (ToDo use unscaled?) - DBG_PRINT((1, "curr_complementarity(mu_target_, NORM_MAX) = %8.2e\n", - curr_complementarity(mu_target_, NORM_MAX))); + // Complementarity result = Max(result, unscaled_curr_complementarity(mu_target_, NORM_MAX)); unscaled_curr_nlp_error_cache_.AddCachedResult(result, tdeps); diff --git a/src/Algorithm/IpIpoptCalculatedQuantities.hpp b/src/Algorithm/IpIpoptCalculatedQuantities.hpp index 1b47a66c5..4e9a8510c 100644 --- a/src/Algorithm/IpIpoptCalculatedQuantities.hpp +++ b/src/Algorithm/IpIpoptCalculatedQuantities.hpp @@ -9,19 +9,17 @@ #include "IpSmartPtr.hpp" #include "IpCachedResults.hpp" +#include "IpIpoptData.hpp" +#include "IpSymMatrix.hpp" +#include "IpRegOptions.hpp" #include namespace Ipopt { class IpoptNLP; -class IpoptData; -class Vector; -class Matrix; -class SymMatrix; class Journalist; class OptionsList; -class RegisteredOptions; /** Norm types */ enum ENormType @@ -42,7 +40,7 @@ class IPOPTLIB_EXPORT IpoptAdditionalCq: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ IpoptAdditionalCq() { } @@ -50,7 +48,7 @@ class IPOPTLIB_EXPORT IpoptAdditionalCq: public ReferencedObject /** Destructor */ virtual ~IpoptAdditionalCq() { } - //@} + ///@} /** This method is called to initialize the global algorithmic * parameters. @@ -73,7 +71,7 @@ class IPOPTLIB_EXPORT IpoptAdditionalCq: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ IpoptAdditionalCq( const IpoptAdditionalCq&); @@ -81,7 +79,7 @@ class IPOPTLIB_EXPORT IpoptAdditionalCq: public ReferencedObject /** Default Assignment Operator */ void operator=( const IpoptAdditionalCq&); - //@} + ///@} }; /** Class for all IPOPT specific calculated quantities. */ @@ -90,7 +88,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ IpoptCalculatedQuantities( const SmartPtr& ip_nlp, @@ -98,7 +96,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject ); /** Destructor */ virtual ~IpoptCalculatedQuantities(); - //@} + ///@} /** Method for setting pointer for additional calculated * quantities. @@ -109,6 +107,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject SmartPtr add_cq ) { + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(!HaveAddCq()); add_cq_ = add_cq; } @@ -133,7 +132,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject ); /** @name Slacks */ - //@{ + ///@{ /** Slacks for x_L (at current iterate) */ SmartPtr curr_slack_x_L(); /** Slacks for x_U (at current iterate) */ @@ -154,10 +153,10 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject Index AdjustedTrialSlacks(); /** Reset the flags for "fudged" slacks */ void ResetAdjustedTrialSlacks(); - //@} + ///@} /** @name Objective function */ - //@{ + ///@{ /** Value of objective function (at current point) */ virtual Number curr_f(); /** Unscaled value of the objective function (at the current point) */ @@ -170,10 +169,10 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject SmartPtr curr_grad_f(); /** Gradient of objective function (at trial point) */ SmartPtr trial_grad_f(); - //@} + ///@} /** @name Barrier Objective Function */ - //@{ + ///@{ /** Barrier Objective Function Value * (at current iterate with current mu) */ @@ -196,10 +195,10 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject SmartPtr grad_kappa_times_damping_x(); /** Gradient of the damping term with respect to s (times kappa_d) */ SmartPtr grad_kappa_times_damping_s(); - //@} + ///@} /** @name Constraints */ - //@{ + ///@{ /** c(x) (at current point) */ SmartPtr curr_c(); /** unscaled c(x) (at current point) */ @@ -280,49 +279,143 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject ); /** Constraint Violation (at current iterate). * - * This value should - * be used in the line search, and not curr_primal_infeasibility(). + * This considers the inequality constraints with slacks, i.e., the violation of + * c(x) = 0, d(x) - s = 0, + * + * This value should be used in the line search instead of curr_primal_infeasibility(). * What type of norm is used depends on constr_viol_normtype */ virtual Number curr_constraint_violation(); /** Constraint Violation (at trial point). * - * This value should - * be used in the line search, and not curr_primal_infeasibility(). + * This considers the inequality constraints with slacks, i.e., the violation of + * c(x) = 0, d(x) - s = 0, + * + * This value should be used in the line search instead of curr_primal_infeasibility(). * What type of norm is used depends on constr_viol_normtype */ virtual Number trial_constraint_violation(); /** Real constraint violation in a given norm (at current iterate). * - * This considers the inequality constraints without slacks. + * This considers the inequality constraints without slacks, i.e., the violation of + * c(x) = 0, d_L <= d(x) <= d_U, with scaling applied. */ virtual Number curr_nlp_constraint_violation( ENormType NormType ); /** Unscaled real constraint violation in a given norm (at current iterate). * - * This considers the inequality constraints without slacks. + * This considers the inequality constraints without slacks, i.e., the violation of + * c(x) = 0, d_L <= d(x) <= d_U, without scaling applied. */ virtual Number unscaled_curr_nlp_constraint_violation( ENormType NormType ); /** Unscaled real constraint violation in a given norm (at trial iterate). * - * This considers the inequality constraints without slacks. + * This considers the inequality constraints without slacks, i.e., the violation of + * c(x) = 0, d_L <= d(x) <= d_U, with scaling applied. */ virtual Number unscaled_trial_nlp_constraint_violation( ENormType NormType ); - //@} + ///@} + + /// @name Variable bounds + /// @since 3.14.0 + /// @{ + + /** Violation of original variable lower bounds x_L. + * + * Computes violation of given unscaled solution w.r.t. OrigIpoptNLP::orig_x_L() if current NLP is a OrigIpoptNLP. + * If current NLP is not an original OrigIpoptNLP, returns zero vector. + * @since 3.14.0 + */ + SmartPtr unscaled_orig_x_L_violation( + const Vector& x + ); + /** Violation of original variable upper bounds x_U. + * + * Computes violation of given unscaled solution w.r.t. OrigIpoptNLP::orig_x_U() if current NLP is a OrigIpoptNLP. + * If current NLP is not an original OrigIpoptNLP, returns zero vector. + * @since 3.14.0 + */ + SmartPtr unscaled_orig_x_U_violation( + const Vector& x + ); + /** Violation of original variable lower bounds x_L. + * + * Computes violation of current (unscaled) solution w.r.t. OrigIpoptNLP::orig_x_L() if current NLP is a OrigIpoptNLP. + * If current NLP is not an original OrigIpoptNLP, returns zero vector. + * @since 3.14.0 + */ + SmartPtr unscaled_curr_orig_x_L_violation(); + /** Violation of original variable upper bounds x_U. + * + * Computes violation of current (unscaled) solution w.r.t. OrigIpoptNLP::orig_x_U() if current NLP is a OrigIpoptNLP. + * If current NLP is not an original OrigIpoptNLP, returns zero vector. + * @since 3.14.0 + */ + SmartPtr unscaled_curr_orig_x_U_violation(); + /** Violation of (unscaled) original variable bounds. + * + * Norm of unscaled_curr_violation_x_L() and unscaled_curr_violation_x_U(). + * @since 3.14.0 + */ + virtual Number unscaled_curr_orig_bounds_violation( + ENormType NormType + ); + + /** Violation of scaled original variable lower bounds x_L. + * + * Computes violation of given scaled solution w.r.t. OrigIpoptNLP::orig_x_L() if current NLP is a OrigIpoptNLP. + * If current NLP is not an original OrigIpoptNLP, returns zero vector. + * @since 3.14.0 + */ + SmartPtr orig_x_L_violation( + const Vector& x + ); + /** Violation of scaled original variable upper bounds x_U. + * + * Computes violation of given scaled solution w.r.t. OrigIpoptNLP::orig_x_U() if current NLP is a OrigIpoptNLP. + * If current NLP is not an original OrigIpoptNLP, returns zero vector. + * @since 3.14.0 + */ + SmartPtr orig_x_U_violation( + const Vector& x + ); + /** Violation of scaled original variable lower bounds x_L. + * + * Computes violation of current (scaled) solution w.r.t. OrigIpoptNLP::orig_x_L() if current NLP is a OrigIpoptNLP. + * If current NLP is not an original OrigIpoptNLP, returns zero vector. + * @since 3.14.0 + */ + SmartPtr curr_orig_x_L_violation(); + /** Violation of scaled original variable upper bounds x_U. + * + * Computes violation of current (scaled) solution w.r.t. OrigIpoptNLP::orig_x_U() if current NLP is a OrigIpoptNLP. + * If current NLP is not an original OrigIpoptNLP, returns zero vector. + * @since 3.14.0 + */ + SmartPtr curr_orig_x_U_violation(); + /** Violation of scaled original variable bounds. + * + * Norm of curr_violation_x_L() and curr_violation_x_U(). + * @since 3.14.0 + */ + virtual Number curr_orig_bounds_violation( + ENormType NormType + ); + ///@} /** @name Hessian matrices */ - //@{ + ///@{ /** exact Hessian at current iterate (uncached) */ SmartPtr curr_exact_hessian(); - //@} + ///@} /** @name primal-dual error and its components */ - //@{ + ///@{ /** x-part of gradient of Lagrangian function (at current point) */ SmartPtr curr_grad_lag_x(); /** x-part of gradient of Lagrangian function (at trial point) */ @@ -459,10 +552,10 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject virtual Number trial_primal_dual_system_error( Number mu ); - //@} + ///@} /** @name Computing fraction-to-the-boundary step sizes */ - //@{ + ///@{ /** Fraction to the boundary from (current) primal variables x and s * for a given step */ @@ -520,13 +613,13 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject const Vector& delta_s_L, const Vector& delta_s_U ); - //@} + ///@} /** @name Sigma matrices */ - //@{ + ///@{ SmartPtr curr_sigma_x(); SmartPtr curr_sigma_s(); - //@} + ///@} /** average of current values of the complementarities */ Number curr_avrg_compl(); @@ -592,7 +685,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ IpoptCalculatedQuantities(); @@ -605,24 +698,24 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject void operator=( const IpoptCalculatedQuantities& ); - //@} + ///@} /** @name Pointers for easy access to data and NLP information */ - //@{ + ///@{ /** Ipopt NLP object */ SmartPtr ip_nlp_; /** Ipopt Data object */ SmartPtr ip_data_; /** Chen-Goldfarb specific calculated quantities */ SmartPtr add_cq_; - //@} + ///@} /** @name Algorithmic Parameters that can be set through the * options list. * * Those parameters are initialize by calling the Initialize method. */ - //@{ + ///@{ /** Parameter in formula for computing overall primal-dual * optimality error */ @@ -641,10 +734,10 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject bool warm_start_same_structure_; /** Desired value of the barrier parameter */ Number mu_target_; - //@} + ///@} /** @name Caches for slacks */ - //@{ + ///@{ CachedResults > curr_slack_x_L_cache_; CachedResults > curr_slack_x_U_cache_; CachedResults > curr_slack_s_L_cache_; @@ -657,28 +750,28 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject Index num_adjusted_slack_x_U_; Index num_adjusted_slack_s_L_; Index num_adjusted_slack_s_U_; - //@} + ///@} /** @name Cached for objective function stuff */ - //@{ + ///@{ CachedResults curr_f_cache_; CachedResults trial_f_cache_; CachedResults > curr_grad_f_cache_; CachedResults > trial_grad_f_cache_; - //@} + ///@} /** @name Caches for barrier function stuff */ - //@{ + ///@{ CachedResults curr_barrier_obj_cache_; CachedResults trial_barrier_obj_cache_; CachedResults > curr_grad_barrier_obj_x_cache_; CachedResults > curr_grad_barrier_obj_s_cache_; CachedResults > grad_kappa_times_damping_x_cache_; CachedResults > grad_kappa_times_damping_s_cache_; - //@} + ///@} /** @name Caches for constraint stuff */ - //@{ + ///@{ CachedResults > curr_c_cache_; CachedResults > trial_c_cache_; CachedResults > curr_d_cache_; @@ -700,13 +793,13 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject CachedResults curr_nlp_constraint_violation_cache_; CachedResults unscaled_curr_nlp_constraint_violation_cache_; CachedResults unscaled_trial_nlp_constraint_violation_cache_; - //@} + ///@} /** Cache for the exact Hessian */ CachedResults > curr_exact_hessian_cache_; /** @name Components of primal-dual error */ - //@{ + ///@{ CachedResults > curr_grad_lag_x_cache_; CachedResults > trial_grad_lag_x_cache_; CachedResults > curr_grad_lag_s_cache_; @@ -738,19 +831,28 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject CachedResults curr_barrier_error_cache_; CachedResults curr_primal_dual_system_error_cache_; CachedResults trial_primal_dual_system_error_cache_; - //@} + ///@} + + /** @name Caches for violation of original bounds */ + ///@{ + CachedResults, SmartPtr > > unscaled_curr_orig_x_LU_viol_cache_; + CachedResults unscaled_curr_orig_bounds_viol_cache_; + CachedResults > curr_orig_x_L_viol_cache_; + CachedResults > curr_orig_x_U_viol_cache_; + CachedResults curr_orig_bounds_viol_cache_; + ///@} /** @name Caches for fraction to the boundary step sizes */ - //@{ + ///@{ CachedResults primal_frac_to_the_bound_cache_; CachedResults dual_frac_to_the_bound_cache_; - //@} + ///@} /** @name Caches for sigma matrices */ - //@{ + ///@{ CachedResults > curr_sigma_x_cache_; CachedResults > curr_sigma_s_cache_; - //@} + ///@} /** Cache for average of current complementarity */ CachedResults curr_avrg_compl_cache_; @@ -762,7 +864,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject /** @name Indicator vectors required for the linear damping terms * to handle unbounded solution sets. */ - //@{ + ///@{ /** Indicator vector for selecting the elements in x that have * only lower bounds. */ @@ -779,14 +881,14 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject * only upper bounds. */ SmartPtr dampind_s_U_; - //@} + ///@} /** @name Temporary vectors for intermediate calculations. * * We keep these around to avoid unnecessarily many new allocations * of Vectors. */ - //@{ + ///@{ SmartPtr tmp_x_; SmartPtr tmp_s_; SmartPtr tmp_c_; @@ -805,7 +907,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject Vector& Tmp_x_U(); Vector& Tmp_s_L(); Vector& Tmp_s_U(); - //@} + ///@} /** flag indicating if Initialize method has been called (for * debugging) @@ -813,7 +915,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject bool initialize_called_; /** @name Auxiliary functions */ - //@{ + ///@{ /** Compute new vector containing the slack to a lower bound * (uncached) */ @@ -874,7 +976,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject /** Check if slacks are becoming too small. * - * If slacks are becoming too small, they are change. + * If slacks are becoming too small, they are changed. * * @return number of corrected slacks */ @@ -899,19 +1001,7 @@ class IPOPTLIB_EXPORT IpoptCalculatedQuantities: public ReferencedObject SmartPtr& dampind_s_U ); - /** Check if we are in the restoration phase. - * - * @return true, if the ip_nlp is of the type RestoIpoptNLP - * - * @todo We probably want to - * handle this more elegant and don't have an explicit dependency - * here. Now I added this because otherwise the caching doesn't - * work properly since the restoration phase objective function - * depends on the current barrier parameter. - */ - bool in_restoration_phase(); - - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpIpoptData.cpp b/src/Algorithm/IpIpoptData.cpp index 7c2599451..f3af13b8f 100644 --- a/src/Algorithm/IpIpoptData.cpp +++ b/src/Algorithm/IpIpoptData.cpp @@ -11,11 +11,9 @@ namespace Ipopt { IpoptData::IpoptData( - SmartPtr add_data /*= NULL*/, - Number cpu_time_start /*= -1.*/ + SmartPtr add_data /*= NULL*/ ) - : cpu_time_start_(cpu_time_start), - add_data_(add_data) + : add_data_(add_data) { } IpoptData::~IpoptData() @@ -25,16 +23,20 @@ void IpoptData::RegisterOptions( const SmartPtr& roptions ) { - roptions->SetRegisteringCategory("Convergence"); + roptions->SetRegisteringCategory("Termination"); roptions->AddLowerBoundedNumberOption( "tol", "Desired convergence tolerance (relative).", 0., true, +#ifdef IPOPT_SINGLE + 1e-5, +#else 1e-8, +#endif "Determines the convergence tolerance for the algorithm. " "The algorithm terminates successfully, if the (scaled) NLP error becomes smaller than this value, and " "if the (absolute) criteria according to \"dual_inf_tol\", \"constr_viol_tol\", and \"compl_inf_tol\" are met. " - "(This is epsilon_tol in Eqn. (6) in implementation paper). " + "This is epsilon_tol in Eqn. (6) in implementation paper. " "See also \"acceptable_tol\" as a second termination criterion. " "Note, some other algorithmic features also use this quantity to determine thresholds etc."); } @@ -88,9 +90,6 @@ bool IpoptData::Initialize( initialize_called_ = true; - // will be set to cputime in IpoptApplication::call_optimize() - cpu_time_start_ = -1.; - bool retval = true; if( IsValid(add_data_) ) @@ -125,6 +124,11 @@ bool IpoptData::InitializeDataStructures( SmartPtr new_v_L; SmartPtr new_v_U; + // clear curr_ from previous optimize, if any, in case ip_nlp.InitializeStructures() fails, + // e.g., because OrigIpoptNLP throws a too-few-degrees-of-freedom exception + curr_ = NULL; + iterates_space_ = NULL; + // Get the required linear algebra structures from the model bool retValue = ip_nlp.InitializeStructures(new_x, want_x, new_y_c, want_y_c, new_y_d, want_y_d, new_z_L, want_z_L, new_z_U, want_z_U, new_v_L, new_v_U); diff --git a/src/Algorithm/IpIpoptData.hpp b/src/Algorithm/IpIpoptData.hpp index a029d40a0..067ef8fd6 100644 --- a/src/Algorithm/IpIpoptData.hpp +++ b/src/Algorithm/IpIpoptData.hpp @@ -30,7 +30,7 @@ class IPOPTLIB_EXPORT IpoptAdditionalData: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ IpoptAdditionalData() { } @@ -38,7 +38,7 @@ class IPOPTLIB_EXPORT IpoptAdditionalData: public ReferencedObject /** Destructor */ virtual ~IpoptAdditionalData() { } - //@} + ///@} /** This method is called to initialize the global algorithmic * parameters. @@ -71,7 +71,7 @@ class IPOPTLIB_EXPORT IpoptAdditionalData: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ IpoptAdditionalData( const IpoptAdditionalData& @@ -81,7 +81,7 @@ class IPOPTLIB_EXPORT IpoptAdditionalData: public ReferencedObject void operator=( const IpoptAdditionalData& ); - //@} + ///@} }; /** Class to organize all the data required by the algorithm. @@ -98,16 +98,15 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ IpoptData( - SmartPtr add_data = NULL, - Number cpu_time_start = -1. + SmartPtr add_data = NULL ); /** Destructor */ virtual ~IpoptData(); - //@} + ///@} /** Initialize Data Structures */ bool InitializeDataStructures( @@ -131,7 +130,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject ); /** @name Get Methods for Iterates */ - //@{ + ///@{ /** Current point */ inline SmartPtr curr() const; @@ -160,6 +159,11 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject void set_trial( SmartPtr& trial ); + /* ToDo: I may need to add versions of set_trial like the + * following, but I am not sure + */ + // void set_trial(const SmartPtr& trial_iterates); + // void set_trial(SmartPtr& trial_iterates); /** Set the values of the primal trial variables (x and s) from * provided Step with step length alpha. @@ -190,11 +194,6 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject const Vector& delta_v_U ); - /** ToDo: I may need to add versions of set_trial like the - * following, but I am not sure - */ - // void set_trial(const SmartPtr& trial_iterates); - // void set_trial(SmartPtr& trial_iterates); /** get the current delta */ inline SmartPtr delta() const; @@ -239,7 +238,6 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject /** Hessian or Hessian approximation (do not hold on to it, it might be changed) */ SmartPtr W() { - DBG_ASSERT(IsValid(W_)); return W_; } @@ -259,7 +257,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject * are overwritten in every iteration, so do not hold on to the * pointers (make copies instead) */ - //@{ + ///@{ /** Returns true, if the primal-dual step have been already * computed for the current iteration. * @@ -289,7 +287,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject { have_deltas_ = have_deltas; } - //@} + ///@} /** @name Affine-scaling step. * @@ -299,7 +297,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject * scaling steps, then the corrector step in the line search does * not have to recompute those solutions of the linear system. */ - //@{ + ///@{ /** Returns true, if the affine-scaling step have been already * computed for the current iteration. * @@ -329,20 +327,20 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject { have_affine_deltas_ = have_affine_deltas; } - //@} + ///@} /** @name Public Methods for updating iterates */ - //@{ + ///@{ /** Copy the trial values to the current values */ inline void CopyTrialToCurrent(); /** Set the current iterate values from the trial values. */ void AcceptTrialPoint(); - //@} + ///@} /** @name General algorithmic data */ - //@{ + ///@{ Index iter_count() const { return iter_count_; @@ -412,7 +410,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject { return tiny_step_flag_; } - //@} + ///@} /** Overall convergence tolerance. * @@ -421,7 +419,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject * depend on the specified tolerance, such as the minimum value * for the barrier parameter. */ - //@{ + ///@{ /** Obtain the tolerance. */ Number tol() const { @@ -444,7 +442,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject { tol_ = tol; } - //@} + ///@} /** Cpu time counter at the beginning of the optimization. * @@ -453,14 +451,14 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject * * Can only be called after beginning of optimization. */ + IPOPT_DEPRECATED Number cpu_time_start() const { - DBG_ASSERT(cpu_time_start_ >= 0); - return cpu_time_start_; + return timing_statistics_.OverallAlgorithm().StartCpuTime(); } /** @name Information gathered for iteration output */ - //@{ + ///@{ Number info_regu_x() const { return info_regu_x_; @@ -582,7 +580,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject info_skip_output_ = false; info_string_.erase(); } - //@} + ///@} /** Return Timing Statistics Object */ TimingStatistics& TimingStats() @@ -590,10 +588,13 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject return timing_statistics_; } - /** Resetting CPU Start Time */ - void ResetCpuStartTime() + /** Return Timing Statistics Object + * + * @since 3.14.11 + */ + const TimingStatistics& TimingStats() const { - cpu_time_start_ = CpuTime(); + return timing_statistics_; } /** Check if additional data has been set */ @@ -613,6 +614,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject SmartPtr add_data ) { + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(!HaveAddData()); add_data_ = add_data; } @@ -651,7 +653,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject private: /** @name Iterates */ - //@{ + ///@{ /** Main iteration variables (current iteration) */ SmartPtr curr_; @@ -662,7 +664,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject SmartPtr W_; /** @name Primal-dual Step */ - //@{ + ///@{ SmartPtr delta_; /** The following flag is set to true, if some other part of the * algorithm (like the method for computing the barrier @@ -670,10 +672,10 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject * direction. * * This flag is reset when the AcceptTrialPoint method is called. - * @todo we could cue off of a null delta_ */ + // ToDo we could cue off of a null delta_ bool have_deltas_; - //@} + ///@} /** @name Affine-scaling step. * @@ -682,17 +684,17 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject * of the barrier parameter to the corrector (in the line * search). */ - //@{ + ///@{ SmartPtr delta_aff_; /** The following flag is set to true, if some other part of the * algorithm (like the method for computing the barrier * parameter) has already computed the affine-scaling step. * * This flag is reset when the AcceptTrialPoint method is called. - * @todo we could cue off of a null delta_aff_ */ + // ToDo we could cue off of a null delta_aff_ bool have_affine_deltas_; - //@} + ///@} /** iteration count */ Index iter_count_; @@ -720,21 +722,21 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject * algorithm. They are set using an OptionsList object in the * Initialize method. */ - //@{ + ///@{ /** Overall convergence tolerance */ Number tol_; - //@} + ///@} /** @name Status data **/ - //@{ + ///@{ /** flag indicating whether the algorithm is in the free mu mode */ bool free_mu_mode_; /** flag indicating if a tiny step has been detected */ bool tiny_step_flag_; - //@} + ///@} /** @name Gathered information for iteration output */ - //@{ + ///@{ /** Size of regularization for the Hessian */ Number info_regu_x_; /** Primal step size */ @@ -757,7 +759,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject * summary header was printed */ int info_iters_since_header_; - //@} + ///@} /** VectorSpace for all the iterates */ SmartPtr iterates_space_; @@ -765,21 +767,18 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject /** TimingStatistics object collecting all Ipopt timing statistics */ TimingStatistics timing_statistics_; - /** CPU time counter at begin of optimization. */ - Number cpu_time_start_; - /** Object for the data specific for the Chen-Goldfarb penalty * method algorithm */ SmartPtr add_data_; /** @name Information about the perturbation of the primal-dual system */ - //@{ + ///@{ Number pd_pert_x_; Number pd_pert_s_; Number pd_pert_c_; Number pd_pert_d_; - //@} + ///@} /**@name Default Compiler Generated Methods * (Hidden to avoid implicit creation/calling). @@ -790,7 +789,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ IpoptData( const IpoptData& @@ -800,13 +799,13 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject void operator=( const IpoptData& ); - //@} + ///@} #if IPOPT_CHECKLEVEL > 0 /** Some debug flags to make sure vectors are not changed * behind the IpoptData's back */ - //@{ + ///@{ TaggedObject::Tag debug_curr_tag_; TaggedObject::Tag debug_trial_tag_; TaggedObject::Tag debug_delta_tag_; @@ -815,7 +814,7 @@ class IPOPTLIB_EXPORT IpoptData: public ReferencedObject TaggedObject::Tag debug_trial_tag_sum_; TaggedObject::Tag debug_delta_tag_sum_; TaggedObject::Tag debug_delta_aff_tag_sum_; - //@} + ///@} #endif }; @@ -877,7 +876,7 @@ void IpoptData::set_trial( #if IPOPT_CHECKLEVEL > 0 // verify the correct space - DBG_ASSERT(trial_->OwnerSpace() == (VectorSpace*)GetRawPtr(iterates_space_)); + DBG_ASSERT(trial_->OwnerSpace() == static_cast(GetRawPtr(iterates_space_))); if (IsValid(trial)) { debug_trial_tag_ = trial->GetTag(); diff --git a/src/Algorithm/IpIpoptNLP.hpp b/src/Algorithm/IpIpoptNLP.hpp index b8b1f9394..e3af43c8c 100644 --- a/src/Algorithm/IpIpoptNLP.hpp +++ b/src/Algorithm/IpIpoptNLP.hpp @@ -17,18 +17,26 @@ namespace Ipopt class IteratesVector; /** This is the abstract base class for classes that map - * the traditional NLP into - * something that is more useful by Ipopt. + * the traditional NLP into something that is more useful for %Ipopt. + * + * As for NLP, the represented %NLP is + * \f{eqnarray*} + * \mathrm{min} && f(x), \\ + * \mathrm{s.t.} && c(x) = 0, &\qquad y_c\\ + * && d_L \leq d(x) \leq d_U, &\qquad y_d \\ + * && x_L \leq x \leq x_U, &\qquad z_L, z_U + * \f} + * where \f$y_c\f$, \f$y_d\f$, \f$z_L\f$, \f$z_U\f$ name the dual variables of the corresponding constraints. * * This class takes care of storing the - * calculated model results, handles caching, + * calculated model results, handles caching, scaling, * and (some day) takes care of addition of slacks. */ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ IpoptNLP( const SmartPtr nlp_scaling ) @@ -38,7 +46,7 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject /** Destructor */ virtual ~IpoptNLP() { } - //@} + ///@} /** Initialization method. * @@ -59,11 +67,11 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject } /**@name Possible Exceptions */ - //@{ + ///@{ /** thrown if there is any error evaluating values from the nlp */ DECLARE_STD_EXCEPTION(Eval_Error); - //@} + ///@} /** Initialize (create) structures for the iteration data */ virtual bool InitializeStructures( SmartPtr& x, @@ -86,7 +94,7 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject ) = 0; /** Accessor methods for model data */ - //@{ + ///@{ /** Objective value */ virtual Number f( const Vector& x @@ -158,7 +166,7 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject * matrix (or it's approximation) */ virtual SmartPtr HessianMatrixSpace() const = 0; - //@} + ///@} /** Accessor method for vector/matrix spaces pointers. */ virtual void GetSpaces( @@ -188,7 +196,7 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject ) = 0; /** @name Counters for the number of function evaluations. */ - //@{ + ///@{ virtual Index f_evals() const = 0; virtual Index grad_f_evals() const = 0; virtual Index c_evals() const = 0; @@ -196,12 +204,12 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject virtual Index d_evals() const = 0; virtual Index jac_d_evals() const = 0; virtual Index h_evals() const = 0; - //@} + ///@} /** @name Special method for dealing with the fact that the * restoration phase objective function depends on the barrier * parameter */ - //@{ + ///@{ /** Method for telling the IpoptCalculatedQuantities class whether * the objective function depends on the barrier function. * @@ -247,10 +255,10 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject * This can be used in LeastSquareMults to obtain a "zero Hessian". */ virtual SmartPtr uninitialized_h() = 0; - //@} + ///@} /**@name solution routines */ - //@{ + ///@{ virtual void FinalizeSolution( SolverReturn status, const Vector& x, @@ -280,7 +288,7 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject SmartPtr ip_data, SmartPtr ip_cq ) = 0; - //@} + ///@} /** Returns the scaling strategy object */ SmartPtr NLP_scaling() const @@ -300,7 +308,7 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ IpoptNLP( const IpoptNLP& @@ -310,7 +318,7 @@ class IPOPTLIB_EXPORT IpoptNLP: public ReferencedObject void operator=( const IpoptNLP& ); - //@} + ///@} SmartPtr nlp_scaling_; }; diff --git a/src/Algorithm/IpIterateInitializer.hpp b/src/Algorithm/IpIterateInitializer.hpp index 9fae832f0..10b6613af 100644 --- a/src/Algorithm/IpIterateInitializer.hpp +++ b/src/Algorithm/IpIterateInitializer.hpp @@ -20,7 +20,7 @@ class IPOPTLIB_EXPORT IterateInitializer: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ IterateInitializer() { } @@ -28,7 +28,7 @@ class IPOPTLIB_EXPORT IterateInitializer: public AlgorithmStrategyObject /** Default destructor */ virtual ~IterateInitializer() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -49,7 +49,7 @@ class IPOPTLIB_EXPORT IterateInitializer: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ IterateInitializer( const IterateInitializer& @@ -59,7 +59,7 @@ class IPOPTLIB_EXPORT IterateInitializer: public AlgorithmStrategyObject void operator=( const IterateInitializer& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpIteratesVector.cpp b/src/Algorithm/IpIteratesVector.cpp index d0febe5fd..69ed5c4b4 100644 --- a/src/Algorithm/IpIteratesVector.cpp +++ b/src/Algorithm/IpIteratesVector.cpp @@ -138,19 +138,18 @@ IteratesVectorSpace::IteratesVectorSpace( const VectorSpace& v_L_space, const VectorSpace& v_U_space ) - : CompoundVectorSpace(8, - x_space.Dim() + s_space.Dim() + y_c_space.Dim() + y_d_space.Dim() + z_L_space.Dim() + z_U_space.Dim() - + v_L_space.Dim() + v_U_space.Dim()) + : CompoundVectorSpace(8, + x_space.Dim() + s_space.Dim() + y_c_space.Dim() + y_d_space.Dim() + z_L_space.Dim() + z_U_space.Dim() + + v_L_space.Dim() + v_U_space.Dim()), + x_space_(&x_space), + s_space_(&s_space), + y_c_space_(&y_c_space), + y_d_space_(&y_d_space), + z_L_space_(&z_L_space), + z_U_space_(&z_U_space), + v_L_space_(&v_L_space), + v_U_space_(&v_U_space) { - x_space_ = &x_space; - s_space_ = &s_space; - y_c_space_ = &y_c_space; - y_d_space_ = &y_d_space; - z_L_space_ = &z_L_space; - z_U_space_ = &z_U_space; - v_L_space_ = &v_L_space; - v_U_space_ = &v_U_space; - this->CompoundVectorSpace::SetCompSpace(0, *x_space_); this->CompoundVectorSpace::SetCompSpace(1, *s_space_); this->CompoundVectorSpace::SetCompSpace(2, *y_c_space_); diff --git a/src/Algorithm/IpIteratesVector.hpp b/src/Algorithm/IpIteratesVector.hpp index 016d9bdf9..8b5ce80bc 100644 --- a/src/Algorithm/IpIteratesVector.hpp +++ b/src/Algorithm/IpIteratesVector.hpp @@ -26,17 +26,17 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector { public: /** Constructors / Destructors */ - //@{ + ///@{ IteratesVector( const IteratesVectorSpace* owner_space, bool create_new ); virtual ~IteratesVector(); - //@} + ///@} /** Make New methods */ - //@{ + ///@{ /** Use this method to create a new iterates vector. * * The MakeNew method on the Vector class also works, but it does not give @@ -65,10 +65,10 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector * existing entries may or may not be modifiable. */ SmartPtr MakeNewContainer() const; - //@} + ///@} /** Iterates Set/Get Methods */ - //@{ + ///@{ /** Get the x iterate (const) */ SmartPtr x() const { @@ -91,9 +91,9 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector */ SmartPtr create_new_x_copy() { - SmartPtr curr_x = GetComp(0); - Set_x_NonConst(*curr_x->MakeNew()); - x_NonConst()->Copy(*curr_x); + SmartPtr curr_x_ = GetComp(0); + Set_x_NonConst(*curr_x_->MakeNew()); + x_NonConst()->Copy(*curr_x_); return x_NonConst(); } @@ -192,9 +192,9 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector */ SmartPtr create_new_y_c_copy() { - SmartPtr curr_y_c = GetComp(2); - Set_y_c_NonConst(*curr_y_c->MakeNew()); - y_c_NonConst()->Copy(*curr_y_c); + SmartPtr curr_y_c_ = GetComp(2); + Set_y_c_NonConst(*curr_y_c_->MakeNew()); + y_c_NonConst()->Copy(*curr_y_c_); return y_c_NonConst(); } @@ -242,9 +242,9 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector */ SmartPtr create_new_y_d_copy() { - SmartPtr curr_y_d = GetComp(3); - Set_y_d_NonConst(*curr_y_d->MakeNew()); - y_d_NonConst()->Copy(*curr_y_d); + SmartPtr curr_y_d_ = GetComp(3); + Set_y_d_NonConst(*curr_y_d_->MakeNew()); + y_d_NonConst()->Copy(*curr_y_d_); return y_d_NonConst(); } @@ -292,9 +292,9 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector * values into it. */ SmartPtr create_new_z_L_copy() { - SmartPtr curr_z_L = GetComp(4); - Set_z_L_NonConst(*curr_z_L->MakeNew()); - z_L_NonConst()->Copy(*curr_z_L); + SmartPtr curr_z_L_ = GetComp(4); + Set_z_L_NonConst(*curr_z_L_->MakeNew()); + z_L_NonConst()->Copy(*curr_z_L_); return z_L_NonConst(); } @@ -342,9 +342,9 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector */ SmartPtr create_new_z_U_copy() { - SmartPtr curr_z_U = GetComp(5); - Set_z_U_NonConst(*curr_z_U->MakeNew()); - z_U_NonConst()->Copy(*curr_z_U); + SmartPtr curr_z_U_ = GetComp(5); + Set_z_U_NonConst(*curr_z_U_->MakeNew()); + z_U_NonConst()->Copy(*curr_z_U_); return z_U_NonConst(); } @@ -598,7 +598,7 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector return tag; } - //@} + ///@} private: /**@name Default Compiler Generated Methods (Hidden to avoid @@ -609,7 +609,7 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ IteratesVector(); @@ -622,7 +622,7 @@ class IPOPTLIB_EXPORT IteratesVector: public CompoundVector void operator=( const IteratesVector& ); - //@} + ///@} const IteratesVectorSpace* owner_space_; @@ -666,7 +666,7 @@ class IPOPTLIB_EXPORT IteratesVectorSpace: public CompoundVectorSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor that takes the spaces for each of the iterates. * * @attention None of these can be NULL ! @@ -683,10 +683,10 @@ class IPOPTLIB_EXPORT IteratesVectorSpace: public CompoundVectorSpace ); virtual ~IteratesVectorSpace(); - //@} + ///@} /** Method for creating vectors . */ - //@{ + ///@{ /** Use this to create a new IteratesVector. * * You can pass-in @@ -745,7 +745,7 @@ class IPOPTLIB_EXPORT IteratesVectorSpace: public CompoundVectorSpace { return MakeNewIteratesVector(); } - //@} + ///@} /** This method hides the CompoundVectorSpace::SetCompSpace method * since the components of the Iterates are fixed at @@ -768,7 +768,7 @@ class IPOPTLIB_EXPORT IteratesVectorSpace: public CompoundVectorSpace * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor */ IteratesVectorSpace(); @@ -781,7 +781,7 @@ class IPOPTLIB_EXPORT IteratesVectorSpace: public CompoundVectorSpace IteratesVectorSpace& operator=( const IteratesVectorSpace& ); - //@} + ///@} /** Contained Spaces */ SmartPtr x_space_; diff --git a/src/Algorithm/IpIterationOutput.hpp b/src/Algorithm/IpIterationOutput.hpp index cc9a51ffe..41ecd8809 100644 --- a/src/Algorithm/IpIterationOutput.hpp +++ b/src/Algorithm/IpIterationOutput.hpp @@ -21,7 +21,7 @@ class IPOPTLIB_EXPORT IterationOutput: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ IterationOutput() { } @@ -29,7 +29,7 @@ class IPOPTLIB_EXPORT IterationOutput: public AlgorithmStrategyObject /** Destructor */ virtual ~IterationOutput() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -60,7 +60,7 @@ class IPOPTLIB_EXPORT IterationOutput: public AlgorithmStrategyObject * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ IterationOutput( const IterationOutput& @@ -69,7 +69,7 @@ class IPOPTLIB_EXPORT IterationOutput: public AlgorithmStrategyObject void operator=( const IterationOutput& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpLeastSquareMults.cpp b/src/Algorithm/IpLeastSquareMults.cpp index 9767b4498..11c79da13 100644 --- a/src/Algorithm/IpLeastSquareMults.cpp +++ b/src/Algorithm/IpLeastSquareMults.cpp @@ -79,6 +79,8 @@ bool LeastSquareMultipliers::CalculateMultipliers( bool check_NegEVals = augsyssolver_->ProvidesInertia(); retval = augsyssolver_->Solve(GetRawPtr(zeroW), 0.0, NULL, 1.0, NULL, 1.0, GetRawPtr(J_c), NULL, 0., GetRawPtr(J_d), NULL, 0., *rhs_x, *rhs_s, *rhs_c, *rhs_d, *sol_x, *sol_s, y_c, y_d, check_NegEVals, numberOfEVals); + // TODO should something be tried if inertia seem wrong (retval == SYMSOLVER_WRONG_INERTIA)? + // PDFullSpaceSolver::SolveOnce tries asking the linear solver to increase quality or perturbs the linear system if( retval != SYMSOLVER_SUCCESS ) { return false; diff --git a/src/Algorithm/IpLeastSquareMults.hpp b/src/Algorithm/IpLeastSquareMults.hpp index 6be191f8d..f4abcc238 100644 --- a/src/Algorithm/IpLeastSquareMults.hpp +++ b/src/Algorithm/IpLeastSquareMults.hpp @@ -23,7 +23,7 @@ class LeastSquareMultipliers: public EqMultiplierCalculator { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor. * * It needs to be given the strategy object for @@ -36,7 +36,7 @@ class LeastSquareMultipliers: public EqMultiplierCalculator /** Destructor */ virtual ~LeastSquareMultipliers() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -63,7 +63,7 @@ class LeastSquareMultipliers: public EqMultiplierCalculator * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ LeastSquareMultipliers(); @@ -75,7 +75,7 @@ class LeastSquareMultipliers: public EqMultiplierCalculator void operator=( const LeastSquareMultipliers& ); - //@} + ///@} /** augmented system solver to be used for solving the linear system */ SmartPtr augsyssolver_; diff --git a/src/Algorithm/IpLimMemQuasiNewtonUpdater.cpp b/src/Algorithm/IpLimMemQuasiNewtonUpdater.cpp index a3da5bf0a..e72e0bf1c 100644 --- a/src/Algorithm/IpLimMemQuasiNewtonUpdater.cpp +++ b/src/Algorithm/IpLimMemQuasiNewtonUpdater.cpp @@ -37,11 +37,10 @@ void LimMemQuasiNewtonUpdater::RegisterOptions( roptions->AddStringOption2( "limited_memory_update_type", - "Quasi-Newton update formula for the limited memory approximation.", + "Quasi-Newton update formula for the limited memory quasi-Newton approximation.", "bfgs", "bfgs", "BFGS update (with skipping)", - "sr1", "SR1 (not working well)", - "Determines which update formula is to be used for the limited-memory quasi-Newton approximation."); + "sr1", "SR1 (not working well)"); roptions->AddStringOption5( "limited_memory_initialization", @@ -86,12 +85,10 @@ void LimMemQuasiNewtonUpdater::RegisterOptions( 2, "If the update is skipped more than this number of successive iterations, the quasi-Newton approximation is reset."); - roptions->AddStringOption2( + roptions->AddBoolOption( "limited_memory_special_for_resto", "Determines if the quasi-Newton updates should be special during the restoration phase.", - "no", - "no", "use the same update as in regular iterations", - "yes", "use the a special update during restoration phase", + false, "Until Nov 2010, Ipopt used a special update during the restoration phase, but it turned out that this does not work well. " "The new default uses the regular update procedure and it improves results. " "If for some reason you want to get back to the original update, set this option to \"yes\"."); @@ -409,16 +406,16 @@ void LimMemQuasiNewtonUpdater::UpdateHessian() switch( limited_memory_initialization_ ) { case SCALAR1: - sigma_ = sTy_new / pow(s_new->Nrm2(), 2); + sigma_ = sTy_new / std::pow(s_new->Nrm2(), 2); break; case SCALAR2: - sigma_ = pow(y_new->Nrm2(), 2) / sTy_new; + sigma_ = std::pow(y_new->Nrm2(), 2) / sTy_new; break; case SCALAR3: - sigma_ = (sTy_new / pow(s_new->Nrm2(), 2) + pow(y_new->Nrm2(), 2) / sTy_new) / 2.; + sigma_ = (sTy_new / std::pow(s_new->Nrm2(), 2) + std::pow(y_new->Nrm2(), 2) / sTy_new) / 2.; break; case SCALAR4: - sigma_ = sqrt(sTy_new / pow(s_new->Nrm2(), 2) * pow(y_new->Nrm2(), 2) / sTy_new); + sigma_ = std::sqrt(sTy_new / std::pow(s_new->Nrm2(), 2) * std::pow(y_new->Nrm2(), 2) / sTy_new); break; case CONSTANT: sigma_ = limited_memory_init_val_; @@ -443,7 +440,7 @@ void LimMemQuasiNewtonUpdater::UpdateHessian() // First update V - here only the last column is updated DBG_ASSERT(sTy_new > 0.); SmartPtr v_new = y_new->MakeNewCopy(); - v_new->Scal(1. / sqrt(sTy_new)); + v_new->Scal(1. / std::sqrt(sTy_new)); if( augment_memory ) { AugmentMultiVector(V_, *v_new); @@ -558,21 +555,21 @@ void LimMemQuasiNewtonUpdater::UpdateHessian() else { // ToDo: What lower bound to use? - Number sTy_new = Max(1e-8, fabs(s_new->Dot(*y_new))); + Number sTy_new = Max(Number(1e-8), std::abs(s_new->Dot(*y_new))); DBG_ASSERT(sTy_new != 0.); switch( limited_memory_initialization_ ) { case SCALAR1: - sigma_ = sTy_new / pow(s_new->Nrm2(), 2); + sigma_ = sTy_new / std::pow(s_new->Nrm2(), 2); break; case SCALAR2: - sigma_ = pow(y_new->Nrm2(), 2) / sTy_new; + sigma_ = std::pow(y_new->Nrm2(), 2) / sTy_new; break; case SCALAR3: - sigma_ = (sTy_new / pow(s_new->Nrm2(), 2) + pow(y_new->Nrm2(), 2) / sTy_new) / 2.; + sigma_ = (sTy_new / std::pow(s_new->Nrm2(), 2) + std::pow(y_new->Nrm2(), 2) / sTy_new) / 2.; break; case SCALAR4: - sigma_ = sqrt(sTy_new / pow(s_new->Nrm2(), 2) * pow(y_new->Nrm2(), 2) / sTy_new); + sigma_ = std::sqrt(sTy_new / std::pow(s_new->Nrm2(), 2) * std::pow(y_new->Nrm2(), 2) / sTy_new); break; case CONSTANT: sigma_ = limited_memory_init_val_; @@ -693,7 +690,7 @@ void LimMemQuasiNewtonUpdater::UpdateHessian() lm_skipped_iter_++; } Jnlst().Printf(J_DETAILED, J_HESSIAN_APPROXIMATION, - "Number of successive iterations with skipping: %d\n", lm_skipped_iter_); + "Number of successive iterations with skipping: %" IPOPT_INDEX_FORMAT "\n", lm_skipped_iter_); // Keep stuff around in case we want to skip SR1 retroactively // because of negative curvature! @@ -750,6 +747,7 @@ void LimMemQuasiNewtonUpdater::RestoreInternalDataBackup() U_ = U_old_; } +#if 0 void LimMemQuasiNewtonUpdater::ReleaseInternalDataBackup() { DBG_START_METH("LimMemQuasiNewtonUpdater::ReleaseInternalDataBackup", @@ -766,6 +764,7 @@ void LimMemQuasiNewtonUpdater::ReleaseInternalDataBackup() V_old_ = NULL; U_old_ = NULL; } +#endif bool LimMemQuasiNewtonUpdater::UpdateInternalData( const Vector& s_new, @@ -899,7 +898,7 @@ bool LimMemQuasiNewtonUpdater::SplitEigenvalues( } // Determine the ratio of smallest over the largest eigenvalue - Number emax = Max(fabs(Evals[0]), fabs(Evals[dim - 1])); + Number emax = Max(std::abs(Evals[0]), std::abs(Evals[dim - 1])); if( emax == 0. ) { return true; @@ -959,7 +958,7 @@ bool LimMemQuasiNewtonUpdater::SplitEigenvalues( Number* Qminus_vals = Qminus->Values(); for( Index j = 0; j < nneg; j++ ) { - Number esqrt = sqrt(-Evals[j]); + Number esqrt = std::sqrt(-Evals[j]); for( Index i = 0; i < dim; i++ ) { Qminus_vals[i + j * dim] = Qvals[i + j * dim] / esqrt; @@ -973,7 +972,7 @@ bool LimMemQuasiNewtonUpdater::SplitEigenvalues( for( Index j = 0; j < dim - nneg; j++ ) { DBG_ASSERT(Evals[j + nneg] > 0.); - Number esqrt = sqrt(Evals[j + nneg]); + Number esqrt = std::sqrt(Evals[j + nneg]); for( Index i = 0; i < dim; i++ ) { Qplus_vals[i + j * dim] = Qvals[i + (j + nneg) * dim] / esqrt; @@ -984,8 +983,8 @@ bool LimMemQuasiNewtonUpdater::SplitEigenvalues( } bool LimMemQuasiNewtonUpdater::CheckSkippingBFGS( - Vector& s_new, - Vector& y_new + const Vector& s_new, + const Vector& y_new ) { Number sTy = s_new.Dot(y_new); @@ -993,7 +992,7 @@ bool LimMemQuasiNewtonUpdater::CheckSkippingBFGS( Number ynrm = y_new.Nrm2(); // ToDo make a parameter? - Number tol = sqrt(std::numeric_limits::epsilon()); + Number tol = std::sqrt(std::numeric_limits::epsilon()); Jnlst().Printf(J_DETAILED, J_HESSIAN_APPROXIMATION, "Limited-Memory test for skipping:\n"); @@ -1378,29 +1377,6 @@ void LimMemQuasiNewtonUpdater::SetW() { IpData().Set_W(GetRawPtr(W)); } - -#ifdef PRINT_W - // DELETEME - const DenseVector* dx = static_cast - (GetRawPtr(IpData().curr()->x())); - DBG_ASSERT(dynamic_cast(GetRawPtr(IpData().curr()->x()))); - SmartPtr tmpx = dx->MakeNewDenseVector(); - SmartPtr tmpy = dx->MakeNewDenseVector(); - for (Index i = 0; i < dx->Dim(); i++) - { - Number* tmpx_vals = tmpx->Values(); - for (Index j = 0; j < dx->Dim(); j++) - { - tmpx_vals[j] = 0.; - } - tmpx_vals[i] = 1.; - W->MultVector(1., *tmpx, 0., *tmpy); - tmpx->Print(Jnlst(), J_DETAILED, J_MAIN, "tmpx"); - tmpy->Print(Jnlst(), J_DETAILED, J_MAIN, "tmpy"); - } - // ENDDELETEME -#endif - } void LimMemQuasiNewtonUpdater::RecalcY( @@ -1418,9 +1394,9 @@ void LimMemQuasiNewtonUpdater::RecalcY( } void LimMemQuasiNewtonUpdater::RecalcD( - MultiVectorMatrix& S, - MultiVectorMatrix& Y, - SmartPtr& D + const MultiVectorMatrix& S, + const MultiVectorMatrix& Y, + SmartPtr& D ) { SmartPtr space = new DenseVectorSpace(S.NCols()); @@ -1433,8 +1409,8 @@ void LimMemQuasiNewtonUpdater::RecalcD( } void LimMemQuasiNewtonUpdater::RecalcL( - MultiVectorMatrix& S, - MultiVectorMatrix& Y, + const MultiVectorMatrix& S, + const MultiVectorMatrix& Y, SmartPtr& L ) { diff --git a/src/Algorithm/IpLimMemQuasiNewtonUpdater.hpp b/src/Algorithm/IpLimMemQuasiNewtonUpdater.hpp index f235d7898..549368f91 100644 --- a/src/Algorithm/IpLimMemQuasiNewtonUpdater.hpp +++ b/src/Algorithm/IpLimMemQuasiNewtonUpdater.hpp @@ -24,7 +24,7 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Default Constructor */ LimMemQuasiNewtonUpdater( bool update_for_resto @@ -33,7 +33,7 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater /** Destructor */ virtual ~LimMemQuasiNewtonUpdater() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -44,11 +44,11 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater virtual void UpdateHessian(); /** Methods for OptionsList */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -60,7 +60,7 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ LimMemQuasiNewtonUpdater( const LimMemQuasiNewtonUpdater& @@ -70,13 +70,13 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater void operator=( const LimMemQuasiNewtonUpdater& ); - //@} + ///@} /** Matrix space for the low-rank Hessian approximation. */ SmartPtr h_space_; /** @name Algorithmic parameters */ - //@{ + ///@{ /** Size of memory for limited memory update. */ Index limited_memory_max_history_; @@ -121,7 +121,7 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater * special manner for the restoration phase. */ bool limited_memory_special_for_resto_; - //@} + ///@} /** Flag indicating if the update is to be done for the original * NLP or for the restoration phase NLP. @@ -164,7 +164,7 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater Index lm_skipped_iter_; /** @name Information for the limited memory update */ - //@{ + ///@{ /** current size of limited memory */ Index curr_lm_memory_; @@ -296,10 +296,10 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater * Only for restoration phase. (backup) */ SmartPtr STDRS_old_; - //@} + ///@} /** @name Auxiliary function */ - //@{ + ///@{ /** Method deciding whether the BFGS update should be skipped. * * If Powell-damping is performed, the Vectors s_new and y_new @@ -308,8 +308,8 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater * @return true, if no update is to be performed this time. */ bool CheckSkippingBFGS( - Vector& s_new, - Vector& y_new + const Vector& s_new, + const Vector& y_new ); /** Update the internal data, such as the S, Y, L, D etc matrices @@ -467,15 +467,15 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater /** Method for recomputing D from S and Y */ void RecalcD( - MultiVectorMatrix& S, - MultiVectorMatrix& Y, - SmartPtr& D + const MultiVectorMatrix& S, + const MultiVectorMatrix& Y, + SmartPtr& D ); /** Method for recomputing L from S and Y */ void RecalcL( - MultiVectorMatrix& S, - MultiVectorMatrix& Y, + const MultiVectorMatrix& S, + const MultiVectorMatrix& Y, SmartPtr& L ); @@ -515,13 +515,13 @@ class LimMemQuasiNewtonUpdater: public HessianUpdater /** Release anything that we allocated for * StoreInternalDataBackup and is no longer needed. */ - void ReleaseInternalDataBackup(); + // void ReleaseInternalDataBackup(); /** Set the W field in IpData based on the current values of * B0_, V_, and U_. */ void SetW(); - //@} + ///@} }; diff --git a/src/Algorithm/IpLineSearch.hpp b/src/Algorithm/IpLineSearch.hpp index 5ecce1e5f..45a778f02 100644 --- a/src/Algorithm/IpLineSearch.hpp +++ b/src/Algorithm/IpLineSearch.hpp @@ -18,7 +18,7 @@ class IPOPTLIB_EXPORT LineSearch: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ LineSearch() { } @@ -26,7 +26,7 @@ class IPOPTLIB_EXPORT LineSearch: public AlgorithmStrategyObject /** Destructor */ virtual ~LineSearch() { } - //@} + ///@} /** Perform the line search. * @@ -88,7 +88,7 @@ class IPOPTLIB_EXPORT LineSearch: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ LineSearch( const LineSearch& @@ -97,7 +97,7 @@ class IPOPTLIB_EXPORT LineSearch: public AlgorithmStrategyObject void operator=( const LineSearch& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpLoqoMuOracle.cpp b/src/Algorithm/IpLoqoMuOracle.cpp index de09261fc..6904c0e33 100644 --- a/src/Algorithm/IpLoqoMuOracle.cpp +++ b/src/Algorithm/IpLoqoMuOracle.cpp @@ -50,18 +50,19 @@ bool LoqoMuOracle::CalculateMu( //Number factor = 1.-tau_min_; //This is the original values Number factor = 0.05; //This is the value I used otherwise - Number sigma = 0.1 * pow(Min(factor * (1. - xi) / xi, 2.), 3.); + Number sigma = Number(0.1) * std::pow(Min(factor * (Number(1.) - xi) / xi, Number(2.)), Number(3.)); Number mu = sigma * avrg_compl; Jnlst().Printf(J_DETAILED, J_BARRIER_UPDATE, " Barrier parameter proposed by LOQO rule is %lf\n", mu); - // DELETEME + /* char ssigma[40]; sprintf(ssigma, " sigma=%8.2e", sigma); IpData().Append_info_string(ssigma); sprintf(ssigma, " xi=%8.2e ", IpCq().curr_centrality_measure()); IpData().Append_info_string(ssigma); + */ new_mu = Max(Min(mu_max, mu), mu_min); return true; diff --git a/src/Algorithm/IpLoqoMuOracle.hpp b/src/Algorithm/IpLoqoMuOracle.hpp index 67ec65c39..f59a4998d 100644 --- a/src/Algorithm/IpLoqoMuOracle.hpp +++ b/src/Algorithm/IpLoqoMuOracle.hpp @@ -19,13 +19,13 @@ class LoqoMuOracle: public MuOracle { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Default Constructor */ LoqoMuOracle(); /** Destructor */ virtual ~LoqoMuOracle(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -51,7 +51,7 @@ class LoqoMuOracle: public MuOracle * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ LoqoMuOracle( const LoqoMuOracle& @@ -61,7 +61,7 @@ class LoqoMuOracle: public MuOracle void operator=( const LoqoMuOracle& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpLowRankAugSystemSolver.cpp b/src/Algorithm/IpLowRankAugSystemSolver.cpp index 6ec6439e3..b0cecf721 100644 --- a/src/Algorithm/IpLowRankAugSystemSolver.cpp +++ b/src/Algorithm/IpLowRankAugSystemSolver.cpp @@ -58,17 +58,17 @@ bool LowRankAugSystemSolver::InitializeImpl( ESymSolverStatus LowRankAugSystemSolver::Solve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& rhs_x, const Vector& rhs_s, const Vector& rhs_c, @@ -82,6 +82,8 @@ ESymSolverStatus LowRankAugSystemSolver::Solve( ) { DBG_START_METH("LowRankAugSystemSolver::Solve", dbg_verbosity); + DBG_ASSERT(J_c != NULL); // since we de-ref this pointer below + DBG_ASSERT(J_d != NULL); // since we de-ref this pointer below ESymSolverStatus retval; @@ -134,14 +136,15 @@ ESymSolverStatus LowRankAugSystemSolver::Solve( d_s_tag_ = 0; } delta_s_ = delta_s; - if( J_c ) - { - j_c_tag_ = J_c->GetTag(); - } - else - { - j_c_tag_ = 0; - } +// if( J_c ) +// { +// j_c_tag_ = J_c->GetTag(); +// } +// else +// { +// j_c_tag_ = 0; +// } + j_c_tag_ = J_c->GetTag(); if( D_c ) { d_c_tag_ = D_c->GetTag(); @@ -151,14 +154,15 @@ ESymSolverStatus LowRankAugSystemSolver::Solve( d_c_tag_ = 0; } delta_c_ = delta_c; - if( J_d ) - { - j_d_tag_ = J_d->GetTag(); - } - else - { - j_d_tag_ = 0; - } +// if( J_d ) +// { +// j_d_tag_ = J_d->GetTag(); +// } +// else +// { +// j_d_tag_ = 0; +// } + j_d_tag_ = J_d->GetTag(); if( D_d ) { d_d_tag_ = D_d->GetTag(); @@ -228,17 +232,17 @@ ESymSolverStatus LowRankAugSystemSolver::Solve( ESymSolverStatus LowRankAugSystemSolver::UpdateFactorization( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& proto_rhs_x, const Vector& proto_rhs_s, const Vector& proto_rhs_c, @@ -401,15 +405,15 @@ ESymSolverStatus LowRankAugSystemSolver::UpdateFactorization( ESymSolverStatus LowRankAugSystemSolver::SolveMultiVector( const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& proto_rhs_x, const Vector& proto_rhs_s, const Vector& proto_rhs_c, @@ -526,17 +530,17 @@ ESymSolverStatus LowRankAugSystemSolver::SolveMultiVector( bool LowRankAugSystemSolver::AugmentedSystemRequiresChange( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ) { DBG_START_METH("LowRankAugSystemSolver::AugmentedSystemRequiresChange", diff --git a/src/Algorithm/IpLowRankAugSystemSolver.hpp b/src/Algorithm/IpLowRankAugSystemSolver.hpp index 246ec5c38..2c00e875c 100644 --- a/src/Algorithm/IpLowRankAugSystemSolver.hpp +++ b/src/Algorithm/IpLowRankAugSystemSolver.hpp @@ -23,7 +23,7 @@ class LowRankAugSystemSolver: public AugSystemSolver { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor using only a linear solver object */ LowRankAugSystemSolver( AugSystemSolver& aug_system_solver @@ -31,7 +31,7 @@ class LowRankAugSystemSolver: public AugSystemSolver /** Destructor */ virtual ~LowRankAugSystemSolver(); - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ bool InitializeImpl( @@ -42,17 +42,17 @@ class LowRankAugSystemSolver: public AugSystemSolver /** Set up the augmented system and solve it for a given right hand side. */ virtual ESymSolverStatus Solve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& rhs_x, const Vector& rhs_s, const Vector& rhs_c, @@ -99,7 +99,7 @@ class LowRankAugSystemSolver: public AugSystemSolver * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor. */ LowRankAugSystemSolver(); @@ -111,7 +111,7 @@ class LowRankAugSystemSolver: public AugSystemSolver void operator=( const LowRankAugSystemSolver& ); - //@} + ///@} /** The augmented system solver object that should be used for the * factorization of the augmented system without the low-rank @@ -123,7 +123,7 @@ class LowRankAugSystemSolver: public AugSystemSolver matrix has to be updated compared to the most recent call of the Set method. */ - //@{ + ///@{ /** Tag for W matrix. * * If W has been given to Set as NULL, then this tag is set to 0. @@ -131,7 +131,7 @@ class LowRankAugSystemSolver: public AugSystemSolver TaggedObject::Tag w_tag_; /** Most recent value of W_factor */ - double w_factor_; + Number w_factor_; /** Tag for D_x vector, representing the diagonal matrix D_x. * @@ -140,7 +140,7 @@ class LowRankAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_x_tag_; /** Most recent value of delta_x from Set method */ - double delta_x_; + Number delta_x_; /** Tag for D_s vector, representing the diagonal matrix D_s. * If D_s has been given to Set as NULL, then this tag is set to 0. @@ -148,7 +148,7 @@ class LowRankAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_s_tag_; /** Most recent value of delta_s from Set method */ - double delta_s_; + Number delta_s_; /** Tag for J_c matrix. * @@ -163,7 +163,7 @@ class LowRankAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_c_tag_; /** Most recent value of delta_c from Set method */ - double delta_c_; + Number delta_c_; /** Tag for J_d matrix. * @@ -178,12 +178,12 @@ class LowRankAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_d_tag_; /** Most recent value of delta_d from Set method */ - double delta_d_; - //@} + Number delta_d_; + ///@} /** @name Information to be stored in order to resolve for the * same matrix with a different right hand side. */ - //@{ + ///@{ bool first_call_; SmartPtr J1_; SmartPtr J2_; @@ -197,7 +197,7 @@ class LowRankAugSystemSolver: public AugSystemSolver /** Vector space for Compound vectors that capture the entire * right hand side and solution vectors .*/ SmartPtr compound_sol_vecspace_; - //@} + ///@} /** Stores the number of negative eigenvalues detected during most * recent factorization. @@ -211,23 +211,23 @@ class LowRankAugSystemSolver: public AugSystemSolver Index num_neg_evals_; /** @name Internal functions */ - //@{ + ///@{ /** Method for updating the factorization, including J1_, J2_, * Vtilde1_, Utilde2, Wdiag_, compound_sol_vecspace_ */ ESymSolverStatus UpdateFactorization( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& proto_rhs_x, const Vector& proto_rhs_s, const Vector& proto_rhs_c, @@ -245,15 +245,15 @@ class LowRankAugSystemSolver: public AugSystemSolver */ ESymSolverStatus SolveMultiVector( const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& proto_rhs_x, const Vector& proto_rhs_s, const Vector& proto_rhs_c, @@ -274,19 +274,19 @@ class LowRankAugSystemSolver: public AugSystemSolver */ bool AugmentedSystemRequiresChange( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpLowRankSSAugSystemSolver.cpp b/src/Algorithm/IpLowRankSSAugSystemSolver.cpp index 6eae5b226..9551f90b9 100644 --- a/src/Algorithm/IpLowRankSSAugSystemSolver.cpp +++ b/src/Algorithm/IpLowRankSSAugSystemSolver.cpp @@ -61,17 +61,17 @@ bool LowRankSSAugSystemSolver::InitializeImpl( ESymSolverStatus LowRankSSAugSystemSolver::Solve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& rhs_x, const Vector& rhs_s, const Vector& rhs_c, @@ -85,6 +85,8 @@ ESymSolverStatus LowRankSSAugSystemSolver::Solve( ) { DBG_START_METH("LowRankSSAugSystemSolver::Solve", dbg_verbosity); + DBG_ASSERT(J_c != NULL); // since we de-ref this pointer below + DBG_ASSERT(J_d != NULL); // since we de-ref this pointer below ESymSolverStatus retval; @@ -137,14 +139,15 @@ ESymSolverStatus LowRankSSAugSystemSolver::Solve( d_s_tag_ = 0; } delta_s_ = delta_s; - if( J_c ) - { - j_c_tag_ = J_c->GetTag(); - } - else - { - j_c_tag_ = 0; - } +// if( J_c ) +// { +// j_c_tag_ = J_c->GetTag(); +// } +// else +// { +// j_c_tag_ = 0; +// } + j_c_tag_ = J_c->GetTag(); if( D_c ) { d_c_tag_ = D_c->GetTag(); @@ -154,14 +157,15 @@ ESymSolverStatus LowRankSSAugSystemSolver::Solve( d_c_tag_ = 0; } delta_c_ = delta_c; - if( J_d ) - { - j_d_tag_ = J_d->GetTag(); - } - else - { - j_d_tag_ = 0; - } +// if( J_d ) +// { +// j_d_tag_ = J_d->GetTag(); +// } +// else +// { +// j_d_tag_ = 0; +// } + j_d_tag_ = J_d->GetTag(); if( D_d ) { d_d_tag_ = D_d->GetTag(); @@ -204,17 +208,17 @@ ESymSolverStatus LowRankSSAugSystemSolver::Solve( ESymSolverStatus LowRankSSAugSystemSolver::UpdateExtendedData( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* /*D_x*/, - double /*delta_x*/, + Number /*delta_x*/, const Vector* /*D_s*/, - double /*delta_s*/, + Number /*delta_s*/, const Matrix& J_c, const Vector* D_c, - double /*delta_c*/, + Number /*delta_c*/, const Matrix& /*J_d*/, const Vector* /*D_d*/, - double /*delta_d*/, + Number /*delta_d*/, const Vector& proto_rhs_x, const Vector& /*proto_rhs_s*/, const Vector& proto_rhs_c, @@ -357,17 +361,17 @@ ESymSolverStatus LowRankSSAugSystemSolver::UpdateExtendedData( bool LowRankSSAugSystemSolver::AugmentedSystemRequiresChange( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ) { DBG_START_METH("LowRankSSAugSystemSolver::AugmentedSystemRequiresChange", diff --git a/src/Algorithm/IpLowRankSSAugSystemSolver.hpp b/src/Algorithm/IpLowRankSSAugSystemSolver.hpp index e544d74fa..2c06f0901 100644 --- a/src/Algorithm/IpLowRankSSAugSystemSolver.hpp +++ b/src/Algorithm/IpLowRankSSAugSystemSolver.hpp @@ -28,7 +28,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor using an existing augmented system solver. */ LowRankSSAugSystemSolver( AugSystemSolver& aug_system_solver, /**< augmented system solver to copy */ @@ -37,7 +37,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver /** Destructor */ virtual ~LowRankSSAugSystemSolver(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -47,17 +47,17 @@ class LowRankSSAugSystemSolver: public AugSystemSolver /** Set up the augmented system and solve it for a given right hand side. */ virtual ESymSolverStatus Solve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& rhs_x, const Vector& rhs_s, const Vector& rhs_c, @@ -105,7 +105,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor. */ LowRankSSAugSystemSolver(); @@ -117,7 +117,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver void operator=( const LowRankSSAugSystemSolver& ); - //@} + ///@} /** The augmented system solver object that should be used for the * factorization of the augmented system without the low-rank @@ -132,7 +132,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver matrix has to be updated compared to the most recent call of the Set method. */ - //@{ + ///@{ /** Tag for W matrix. * * If W has been given to Set as NULL, then this tag is set to 0. @@ -140,7 +140,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver TaggedObject::Tag w_tag_; /** Most recent value of W_factor */ - double w_factor_; + Number w_factor_; /** Tag for D_x vector, representing the diagonal matrix D_x. * @@ -149,7 +149,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_x_tag_; /** Most recent value of delta_x from Set method */ - double delta_x_; + Number delta_x_; /** Tag for D_s vector, representing the diagonal matrix D_s. * If D_s has been given to Set as NULL, then this tag is set to 0. @@ -157,7 +157,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_s_tag_; /** Most recent value of delta_s from Set method */ - double delta_s_; + Number delta_s_; /** Tag for J_c matrix. * @@ -172,7 +172,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_c_tag_; /** Most recent value of delta_c from Set method */ - double delta_c_; + Number delta_c_; /** Tag for J_d matrix. * @@ -187,15 +187,15 @@ class LowRankSSAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_d_tag_; /** Most recent value of delta_d from Set method */ - double delta_d_; - //@} + Number delta_d_; + ///@} /** Flag indicating if this is the first call */ bool first_call_; /** @name Information to be stored in order to resolve for the * same matrix with a different right hand side. */ - //@{ + ///@{ /** Hessian Matrix passed to the augmented system solver solving * the matrix without the low-rank update. */ @@ -216,7 +216,7 @@ class LowRankSSAugSystemSolver: public AugSystemSolver /** Number of components in V, so that it can be used to correct * the inertia */ Index negEvalsCorrection_; - //@} + ///@} /** Stores the number of negative eigenvalues detected during most * recent factorization. @@ -231,23 +231,23 @@ class LowRankSSAugSystemSolver: public AugSystemSolver Index num_neg_evals_; /** @name Internal functions */ - //@{ + ///@{ /** Method for updating the factorization, including J1_, J2_, * Vtilde1_, Utilde2, Wdiag_, compound_sol_vecspace_. */ ESymSolverStatus UpdateExtendedData( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& proto_rhs_x, const Vector& proto_rhs_s, const Vector& proto_rhs_c, @@ -261,19 +261,19 @@ class LowRankSSAugSystemSolver: public AugSystemSolver */ bool AugmentedSystemRequiresChange( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpMonotoneMuUpdate.cpp b/src/Algorithm/IpMonotoneMuUpdate.cpp index 7a3039938..a9fad9353 100644 --- a/src/Algorithm/IpMonotoneMuUpdate.cpp +++ b/src/Algorithm/IpMonotoneMuUpdate.cpp @@ -54,7 +54,7 @@ void MonotoneMuUpdate::RegisterOptions( "The convergence tolerance for each barrier problem in the monotone mode is " "the value of the barrier parameter times \"barrier_tol_factor\". " "This option is also used in the adaptive mu strategy during the monotone mode. " - "(This is kappa_epsilon in implementation paper)."); + "This is kappa_epsilon in implementation paper."); roptions->AddBoundedNumberOption( "mu_linear_decrease_factor", "Determines linear decrease rate of barrier parameter.", @@ -63,7 +63,7 @@ void MonotoneMuUpdate::RegisterOptions( 0.2, "For the Fiacco-McCormick update procedure the new barrier parameter mu is " "obtained by taking the minimum of mu*\"mu_linear_decrease_factor\" and mu^\"superlinear_decrease_power\". " - "(This is kappa_mu in implementation paper.) " + "This is kappa_mu in implementation paper. " "This option is also used in the adaptive mu strategy during the monotone mode."); roptions->AddBoundedNumberOption( "mu_superlinear_decrease_power", @@ -73,24 +73,25 @@ void MonotoneMuUpdate::RegisterOptions( 1.5, "For the Fiacco-McCormick update procedure the new barrier parameter mu is " "obtained by taking the minimum of mu*\"mu_linear_decrease_factor\" and mu^\"superlinear_decrease_power\". " - "(This is theta_mu in implementation paper.) " + "This is theta_mu in implementation paper. " "This option is also used in the adaptive mu strategy during the monotone mode."); roptions->AddStringOption2( "mu_allow_fast_monotone_decrease", "Allow skipping of barrier problem if barrier test is already met.", "yes", - "no", "Take at least one iteration per barrier problem", + "no", "Take at least one iteration per barrier problem even if the barrier test is already met for the updated barrier parameter", "yes", "Allow fast decrease of mu if barrier test it met", - "If set to \"no\", the algorithm enforces at least one iteration per barrier problem, " - "even if the barrier test is already met for the updated barrier parameter."); + "", + true); roptions->AddBoundedNumberOption( "tau_min", "Lower bound on fraction-to-the-boundary parameter tau.", 0., true, 1., true, 0.99, - "(This is tau_min in the implementation paper.) " - "This option is also used in the adaptive mu strategy during the monotone mode."); + "This is tau_min in the implementation paper. " + "This option is also used in the adaptive mu strategy during the monotone mode.", + true); } bool MonotoneMuUpdate::InitializeImpl( @@ -108,7 +109,7 @@ bool MonotoneMuUpdate::InitializeImpl( options.GetNumericValue("mu_target", mu_target_, prefix); IpData().Set_mu(mu_init_); - Number tau = Max(tau_min_, 1.0 - mu_init_); + Number tau = Max(tau_min_, Number(1.0) - mu_init_); IpData().Set_tau(tau); initialized_ = false; @@ -159,19 +160,6 @@ bool MonotoneMuUpdate::UpdateBarrierParameter() THROW_EXCEPTION(TINY_STEP_DETECTED, "Problem solved to best possible numerical accuracy"); } -#if 0 - //DELETEME - if (mu_changed) - { - SmartPtr iterates = IpData().curr()->MakeNewContainer(); - SmartPtr z_L = iterates->z_L()->MakeNewCopy(); - z_L->Scal(sqrt(new_mu / mu)); - iterates->Set_z_L(*z_L); - IpData().set_trial(iterates); - IpData().AcceptTrialPoint(); - } -#endif - // Set the new values for mu and tau IpData().Set_mu(new_mu); IpData().Set_tau(new_tau); @@ -222,13 +210,12 @@ void MonotoneMuUpdate::CalcNewMuAndTau( // Here we need the complementarity tolerance that is posed to the // scaled problem - Number compl_inf_tol = IpNLP().NLP_scaling()->apply_obj_scaling(compl_inf_tol_); - - new_mu = Min(mu_linear_decrease_factor_ * mu, pow(mu, mu_superlinear_decrease_power_)); - new_mu = Max(new_mu, mu_target_, Min(tol, compl_inf_tol) / (barrier_tol_factor_ + 1.)); + Number compl_inf_tol = std::abs(IpNLP().NLP_scaling()->apply_obj_scaling(compl_inf_tol_)); + new_mu = Min(mu_linear_decrease_factor_ * mu, std::pow(mu, mu_superlinear_decrease_power_)); + new_mu = Max(new_mu, mu_target_, Min(tol, compl_inf_tol) / (barrier_tol_factor_ + Number(1.))); // update the fraction to the boundary parameter - new_tau = Max(tau_min_, 1. - new_mu); + new_tau = Max(tau_min_, Number(1.) - new_mu); } } // namespace Ipopt diff --git a/src/Algorithm/IpMonotoneMuUpdate.hpp b/src/Algorithm/IpMonotoneMuUpdate.hpp index c25fd6988..95fd75d9f 100644 --- a/src/Algorithm/IpMonotoneMuUpdate.hpp +++ b/src/Algorithm/IpMonotoneMuUpdate.hpp @@ -22,7 +22,7 @@ class MonotoneMuUpdate: public MuUpdate { public: /**@name Constructors / Destructor */ - //@{ + ///@{ /** Default Constructor */ MonotoneMuUpdate( const SmartPtr& linesearch @@ -30,7 +30,7 @@ class MonotoneMuUpdate: public MuUpdate /** Destructor */ virtual ~MonotoneMuUpdate(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -61,7 +61,7 @@ class MonotoneMuUpdate: public MuUpdate * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ MonotoneMuUpdate(); /** Copy Constructor */ @@ -71,7 +71,7 @@ class MonotoneMuUpdate: public MuUpdate void operator=( const MonotoneMuUpdate&); - //@} + ///@} /** Internal method for computing the new values for mu and tau */ void CalcNewMuAndTau( @@ -80,7 +80,7 @@ class MonotoneMuUpdate: public MuUpdate ); /** @name Algorithmic parameters */ - //@{ + ///@{ /** Initial value of the barrier parameter */ Number mu_init_; Number barrier_tol_factor_; @@ -91,7 +91,7 @@ class MonotoneMuUpdate: public MuUpdate Number tau_min_; Number compl_inf_tol_; Number mu_target_; - //@} + ///@} SmartPtr linesearch_; diff --git a/src/Algorithm/IpMuOracle.hpp b/src/Algorithm/IpMuOracle.hpp index f9663a59b..cfd6048d3 100644 --- a/src/Algorithm/IpMuOracle.hpp +++ b/src/Algorithm/IpMuOracle.hpp @@ -20,7 +20,7 @@ class MuOracle: public AlgorithmStrategyObject { public: /**@name Constructors / Destructor */ - //@{ + ///@{ /** Default Constructor */ MuOracle() { } @@ -28,7 +28,7 @@ class MuOracle: public AlgorithmStrategyObject /** Destructor */ virtual ~MuOracle() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -61,7 +61,7 @@ class MuOracle: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ MuOracle( const MuOracle& @@ -70,7 +70,7 @@ class MuOracle: public AlgorithmStrategyObject void operator=( const MuOracle& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpMuUpdate.hpp b/src/Algorithm/IpMuUpdate.hpp index 4bbcc2a3d..f08316dfd 100644 --- a/src/Algorithm/IpMuUpdate.hpp +++ b/src/Algorithm/IpMuUpdate.hpp @@ -20,7 +20,7 @@ class IPOPTLIB_EXPORT MuUpdate: public AlgorithmStrategyObject { public: /**@name Constructors / Destructor */ - //@{ + ///@{ /** Default Constructor */ MuUpdate() { } @@ -28,7 +28,7 @@ class IPOPTLIB_EXPORT MuUpdate: public AlgorithmStrategyObject /** Destructor */ virtual ~MuUpdate() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -58,7 +58,7 @@ class IPOPTLIB_EXPORT MuUpdate: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ MuUpdate( const MuUpdate& @@ -68,7 +68,7 @@ class IPOPTLIB_EXPORT MuUpdate: public AlgorithmStrategyObject void operator=( const MuUpdate& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpNLPBoundsRemover.hpp b/src/Algorithm/IpNLPBoundsRemover.hpp index b3191f488..7b5e1a29d 100644 --- a/src/Algorithm/IpNLPBoundsRemover.hpp +++ b/src/Algorithm/IpNLPBoundsRemover.hpp @@ -24,7 +24,7 @@ class NLPBoundsRemover: public NLP { public: /**@name Constructors / Destructor */ - //@{ + ///@{ /** The constructor is given the NLP of which the bounds are to be * replaced by inequality constraints. */ @@ -36,10 +36,10 @@ class NLPBoundsRemover: public NLP /** Destructor */ virtual ~NLPBoundsRemover() { } - //@} + ///@} /** @name NLP Initialization.*/ - //@{ + ///@{ /** Overload if you want the chance to process options or parameters that * may be specific to the NLP */ @@ -84,10 +84,8 @@ class NLPBoundsRemover: public NLP Vector& d_U ); - /** Method for obtaining the starting point for all the iterates. - * - * @todo it might not make sense to ask for initial values for v_L and v_U? - */ + /** Method for obtaining the starting point for all the iterates. */ + // ToDo it might not make sense to ask for initial values for v_L and v_U? virtual bool GetStartingPoint( SmartPtr x, bool need_x, @@ -112,10 +110,10 @@ class NLPBoundsRemover: public NLP { return nlp_->GetWarmStartIterate(warm_start_iterate); } - //@} + ///@} /** @name NLP evaluation routines. */ - //@{ + ///@{ virtual bool Eval_f( const Vector& x, Number& f @@ -165,10 +163,10 @@ class NLPBoundsRemover: public NLP const Vector& yd, SymMatrix& h ); - //@} + ///@} /** @name NLP solution routines. */ - //@{ + ///@{ virtual void FinalizeSolution( SolverReturn status, const Vector& x, @@ -202,10 +200,10 @@ class NLPBoundsRemover: public NLP return nlp_->IntermediateCallBack(mode, iter, obj_value, inf_pr, inf_du, mu, d_norm, regularization_size, alpha_du, alpha_pr, ls_trials, ip_data, ip_cq); } - //@} + ///@} /** Routines to get the scaling parameters. */ - //@{ + ///@{ virtual void GetScalingParameters( const SmartPtr x_space, const SmartPtr c_space, @@ -215,7 +213,7 @@ class NLPBoundsRemover: public NLP SmartPtr& c_scaling, SmartPtr& d_scaling ) const; - //@} + ///@} virtual void GetQuasiNewtonApproximationSpaces( SmartPtr& approx_space, @@ -241,7 +239,7 @@ class NLPBoundsRemover: public NLP * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ NLPBoundsRemover(); /** Copy Constructor */ @@ -253,7 +251,7 @@ class NLPBoundsRemover: public NLP void operator=( const NLPBoundsRemover& ); - //@} + ///@} /** Pointer to the original NLP */ SmartPtr nlp_; diff --git a/src/Algorithm/IpNLPScaling.cpp b/src/Algorithm/IpNLPScaling.cpp index 32afbb029..6ee1e832e 100644 --- a/src/Algorithm/IpNLPScaling.cpp +++ b/src/Algorithm/IpNLPScaling.cpp @@ -593,12 +593,12 @@ SmartPtr StandardScalingBase::apply_jac_c_scaling( { SmartPtr ret = scaled_jac_c_space_->MakeNewScaledMatrix(false); ret->SetUnscaledMatrix(matrix); - return GetRawPtr(ret); + return ConstPtr(ret); } else { SmartPtr ret = matrix; - matrix = NULL; + // matrix = NULL; return ret; } } @@ -612,12 +612,12 @@ SmartPtr StandardScalingBase::apply_jac_d_scaling( { SmartPtr ret = scaled_jac_d_space_->MakeNewScaledMatrix(false); ret->SetUnscaledMatrix(matrix); - return GetRawPtr(ret); + return ConstPtr(ret); } else { SmartPtr ret = matrix; - matrix = NULL; + // matrix = NULL; return ret; } } @@ -631,12 +631,12 @@ SmartPtr StandardScalingBase::apply_hessian_scaling( { SmartPtr ret = scaled_h_space_->MakeNewSymScaledMatrix(false); ret->SetUnscaledMatrix(matrix); - return GetRawPtr(ret); + return ConstPtr(ret); } else { SmartPtr ret = matrix; - matrix = NULL; + // matrix = NULL; return ret; } } diff --git a/src/Algorithm/IpNLPScaling.hpp b/src/Algorithm/IpNLPScaling.hpp index f2d7d82b5..ea8b383e0 100644 --- a/src/Algorithm/IpNLPScaling.hpp +++ b/src/Algorithm/IpNLPScaling.hpp @@ -32,12 +32,12 @@ class IPOPTLIB_EXPORT NLPScalingObject: public ReferencedObject { public: /**@name Constructors / Destructor */ - //@{ + ///@{ NLPScalingObject(); /** Destructor */ virtual ~NLPScalingObject(); - //@} + ///@} /** Method to initialize the options */ bool Initialize( @@ -51,7 +51,7 @@ class IPOPTLIB_EXPORT NLPScalingObject: public ReferencedObject } /** Methods to map scaled and unscaled matrices */ - //@{ + ///@{ /** Returns an obj-scaled version of the given scalar */ virtual Number apply_obj_scaling( const Number& f @@ -163,10 +163,10 @@ class IPOPTLIB_EXPORT NLPScalingObject: public ReferencedObject apply_hessian_scaling( SmartPtr matrix ) = 0; - //@} + ///@} /** Methods for scaling bounds - these wrap those above */ - //@{ + ///@{ /** Returns an x-scaled vector in the x_L or x_U space */ SmartPtr apply_vector_scaling_x_LU_NonConst( const Matrix& Px_LU, @@ -208,12 +208,12 @@ class IPOPTLIB_EXPORT NLPScalingObject: public ReferencedObject const SmartPtr& lu, const VectorSpace& d_space ); - //@} + ///@} /** Methods for scaling the gradient of the objective - wraps the * virtual methods above */ - //@{ + ///@{ /** Returns a grad_f scaled version (d_f * D_x^{-1}) of the given vector */ virtual SmartPtr apply_grad_obj_scaling_NonConst( @@ -239,17 +239,17 @@ class IPOPTLIB_EXPORT NLPScalingObject: public ReferencedObject unapply_grad_obj_scaling( const SmartPtr& v ); - //@} + ///@} /** @name Methods for determining whether scaling for entities is done */ - //@{ + ///@{ /** Returns true if the primal x variables are scaled. */ virtual bool have_x_scaling() = 0; /** Returns true if the equality constraints are scaled. */ virtual bool have_c_scaling() = 0; /** Returns true if the inequality constraints are scaled. */ virtual bool have_d_scaling() = 0; - //@} + ///@} /** This method is called by the IpoptNLP's at a convenient time to * compute and/or read scaling factors @@ -293,7 +293,7 @@ class IPOPTLIB_EXPORT NLPScalingObject: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ NLPScalingObject( const NLPScalingObject& @@ -303,7 +303,7 @@ class IPOPTLIB_EXPORT NLPScalingObject: public ReferencedObject void operator=( const NLPScalingObject& ); - //@} + ///@} SmartPtr jnlst_; }; @@ -316,15 +316,15 @@ class IPOPTLIB_EXPORT StandardScalingBase: public NLPScalingObject { public: /**@name Constructors / Destructor */ - //@{ + ///@{ StandardScalingBase(); /** Destructor */ virtual ~StandardScalingBase(); - //@} + ///@} /** Methods to map scaled and unscaled matrices */ - //@{ + ///@{ virtual Number apply_obj_scaling( const Number& f ); @@ -406,14 +406,14 @@ class IPOPTLIB_EXPORT StandardScalingBase: public NLPScalingObject virtual SmartPtr apply_hessian_scaling( SmartPtr matrix); - //@} + ///@} /** @name Methods for determining whether scaling for entities is done */ - //@{ + ///@{ virtual bool have_x_scaling(); virtual bool have_c_scaling(); virtual bool have_d_scaling(); - //@} + ///@} /** This method is called by the IpoptNLP's at a convenient time to * compute and/or read scaling factors @@ -478,7 +478,7 @@ class IPOPTLIB_EXPORT StandardScalingBase: public NLPScalingObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ StandardScalingBase( const StandardScalingBase& @@ -488,22 +488,22 @@ class IPOPTLIB_EXPORT StandardScalingBase: public NLPScalingObject void operator=( const StandardScalingBase& ); - //@} + ///@} /** Scaling parameters - we only need to keep copies of * the objective scaling and the x scaling - the others we can * get from the scaled matrix spaces. */ - //@{ + ///@{ /** objective scaling parameter */ Number df_; /** x scaling */ SmartPtr dx_; - //@} + ///@} /** Scaled Matrix Spaces */ - //@{ + ///@{ /** Scaled Jacobian of c space */ SmartPtr scaled_jac_c_space_; @@ -512,13 +512,13 @@ class IPOPTLIB_EXPORT StandardScalingBase: public NLPScalingObject /** Scaled Hessian of Lagrangian spacea */ SmartPtr scaled_h_space_; - //@} + ///@} /** @name Algorithmic parameters */ - //@{ + ///@{ /** Additional scaling value for the objective function */ Number obj_scaling_factor_; - //@} + ///@} }; /** Class implementing the scaling object that doesn't to any scaling */ @@ -526,14 +526,14 @@ class IPOPTLIB_EXPORT NoNLPScalingObject: public StandardScalingBase { public: /**@name Constructors / Destructor */ - //@{ + ///@{ NoNLPScalingObject() { } /** Destructor */ virtual ~NoNLPScalingObject() { } - //@} + ///@} protected: /** Overloaded from StandardScalingBase */ @@ -564,7 +564,7 @@ class IPOPTLIB_EXPORT NoNLPScalingObject: public StandardScalingBase * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ NoNLPScalingObject( const NoNLPScalingObject& @@ -574,7 +574,7 @@ class IPOPTLIB_EXPORT NoNLPScalingObject: public StandardScalingBase void operator=( const NoNLPScalingObject& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpOptErrorConvCheck.cpp b/src/Algorithm/IpOptErrorConvCheck.cpp index b9cf38302..352757a1c 100644 --- a/src/Algorithm/IpOptErrorConvCheck.cpp +++ b/src/Algorithm/IpOptErrorConvCheck.cpp @@ -29,14 +29,21 @@ void OptimalityErrorConvergenceCheck::RegisterOptions( "Maximum number of iterations.", 0, 3000, - "The algorithm terminates with an error message if the number of iterations exceeded this number."); + "The algorithm terminates with a message if the number of iterations exceeded this number."); + roptions->AddLowerBoundedNumberOption( + "max_wall_time", + "Maximum number of walltime clock seconds.", + 0.0, true, + 1e20, + "A limit on walltime clock seconds that Ipopt can use to solve one problem. " + "If during the convergence check this limit is exceeded, Ipopt will terminate with a corresponding message."); roptions->AddLowerBoundedNumberOption( "max_cpu_time", "Maximum number of CPU seconds.", 0.0, true, - 1e6, + 1e20, "A limit on CPU seconds that Ipopt can use to solve one problem. " - "If during the convergence check this limit is exceeded, Ipopt will terminate with a corresponding error message."); + "If during the convergence check this limit is exceeded, Ipopt will terminate with a corresponding message."); roptions->AddLowerBoundedNumberOption( "dual_inf_tol", "Desired threshold for the dual infeasibility.", @@ -46,11 +53,13 @@ void OptimalityErrorConvergenceCheck::RegisterOptions( "Successful termination requires that the max-norm of the (unscaled) dual infeasibility is less than this threshold."); roptions->AddLowerBoundedNumberOption( "constr_viol_tol", - "Desired threshold for the constraint violation.", + "Desired threshold for the constraint and variable bound violation.", 0.0, true, 1e-4, - "Absolute tolerance on the constraint violation. " - "Successful termination requires that the max-norm of the (unscaled) constraint violation is less than this threshold."); + "Absolute tolerance on the constraint and variable bound violation. " + "Successful termination requires that the max-norm of the (unscaled) constraint violation is less than this threshold. " + "If option bound_relax_factor is not zero 0, then Ipopt relaxes given variable bounds. " + "The value of constr_viol_tol is used to restrict the absolute amount of this bound relaxation. "); roptions->AddLowerBoundedNumberOption( "compl_inf_tol", "Desired threshold for the complementarity conditions.", @@ -135,6 +144,7 @@ bool OptimalityErrorConvergenceCheck::InitializeImpl( ) { options.GetIntegerValue("max_iter", max_iterations_, prefix); + options.GetNumericValue("max_wall_time", max_wall_time_, prefix); options.GetNumericValue("max_cpu_time", max_cpu_time_, prefix); options.GetNumericValue("dual_inf_tol", dual_inf_tol_, prefix); options.GetNumericValue("constr_viol_tol", constr_viol_tol_, prefix); @@ -200,14 +210,6 @@ ConvergenceCheck::ConvergenceStatus OptimalityErrorConvergenceCheck::CheckConver Number constr_viol = IpCq().unscaled_curr_nlp_constraint_violation(NORM_MAX); Number compl_inf = IpCq().unscaled_curr_complementarity(mu_target_, NORM_MAX); - if( IpData().curr()->x()->Dim() == IpData().curr()->y_c()->Dim() ) - { - // the problem is square, there is no point in looking at dual - // infeasibility and complementarity as termination criterion - dual_inf_tol_ = 1e300; - compl_inf_tol_ = 1e300; - } - if( Jnlst().ProduceOutput(J_MOREDETAILED, J_MAIN) ) { Jnlst().Printf(J_MOREDETAILED, J_MAIN, @@ -227,6 +229,15 @@ ConvergenceCheck::ConvergenceStatus OptimalityErrorConvergenceCheck::CheckConver return ConvergenceCheck::CONVERGED; } + if( IpData().curr()->x()->Dim() == 0 ) + { + if( constr_viol <= constr_viol_tol_ ) + { + return ConvergenceCheck::CONVERGED; + } + THROW_EXCEPTION(LOCALLY_INFEASIBLE, "All variables are fixed and constraint violation is above tolerance. The problem is infeasible."); + } + if( acceptable_iter_ > 0 && CurrentIsAcceptable() ) { IpData().Append_info_string("A"); @@ -251,12 +262,16 @@ ConvergenceCheck::ConvergenceStatus OptimalityErrorConvergenceCheck::CheckConver return ConvergenceCheck::MAXITER_EXCEEDED; } - Number curr_cpu_time = CpuTime(); - if( max_cpu_time_ < 999999. && curr_cpu_time - IpData().cpu_time_start() > max_cpu_time_ ) + if( max_cpu_time_ < 1e20 && CpuTime() - IpData().TimingStats().OverallAlgorithm().StartCpuTime() >= max_cpu_time_ ) { return ConvergenceCheck::CPUTIME_EXCEEDED; } + if( max_wall_time_ < 1e20 && WallclockTime() - IpData().TimingStats().OverallAlgorithm().StartWallclockTime() >= max_wall_time_ ) + { + return ConvergenceCheck::WALLTIME_EXCEEDED; + } + return ConvergenceCheck::CONTINUE; } @@ -272,9 +287,8 @@ bool OptimalityErrorConvergenceCheck::CurrentIsAcceptable() if( IpData().iter_count() != last_obj_val_iter_ ) { - // DELETEME - Jnlst().Printf(J_MOREDETAILED, J_MAIN, - "obj val update iter = %d\n", IpData().iter_count()); + //Jnlst().Printf(J_MOREDETAILED, J_MAIN, + // "obj val update iter = %" IPOPT_INDEX_FORMAT "\n", IpData().iter_count()); last_obj_val_ = curr_obj_val_; curr_obj_val_ = IpCq().curr_f(); last_obj_val_iter_ = IpData().iter_count(); @@ -290,14 +304,6 @@ bool OptimalityErrorConvergenceCheck::CurrentIsAcceptable() DBG_PRINT((1, "acceptable_constr_viol_tol_ = %e\n", acceptable_constr_viol_tol_)); DBG_PRINT((1, "acceptable_compl_inf_tol_ = %e\n", acceptable_compl_inf_tol_)); - if( IpData().curr()->x()->Dim() == IpData().curr()->y_c()->Dim() ) - { - // the problem is square, there is no point in looking at dual - // infeasibility and complementarity as termination criterion - acceptable_dual_inf_tol_ = 1e300; - acceptable_compl_inf_tol_ = 1e300; - } - if( Jnlst().ProduceOutput(J_MOREDETAILED, J_MAIN) ) { Jnlst().Printf(J_MOREDETAILED, J_MAIN, @@ -313,16 +319,15 @@ bool OptimalityErrorConvergenceCheck::CurrentIsAcceptable() Jnlst().Printf(J_MOREDETAILED, J_MAIN, " curr_obj_val_ = %23.16e last_obj_val = %23.16e\n", curr_obj_val_, last_obj_val_); Jnlst().Printf(J_MOREDETAILED, J_MAIN, - " fabs(curr_obj_val_-last_obj_val_)/Max(1., fabs(curr_obj_val_)) = %23.16e acceptable_obj_change_tol_ = %23.16e\n", - fabs(curr_obj_val_ - last_obj_val_) / Max(1., fabs(curr_obj_val_)), acceptable_obj_change_tol_); - // DELETEME - Jnlst().Printf(J_MOREDETAILED, J_MAIN, - "test iter = %d\n", IpData().iter_count()); + " std::abs(curr_obj_val_-last_obj_val_)/Max(1., std::abs(curr_obj_val_)) = %23.16e acceptable_obj_change_tol_ = %23.16e\n", + std::abs(curr_obj_val_ - last_obj_val_) / Max(Number(1.), std::abs(curr_obj_val_)), acceptable_obj_change_tol_); + //Jnlst().Printf(J_MOREDETAILED, J_MAIN, + // "test iter = %" IPOPT_INDEX_FORMAT "\n", IpData().iter_count()); } return (overall_error <= acceptable_tol_ && dual_inf <= acceptable_dual_inf_tol_ && constr_viol <= acceptable_constr_viol_tol_ && compl_inf <= acceptable_compl_inf_tol_ - && fabs(curr_obj_val_ - last_obj_val_) / Max(1., fabs(curr_obj_val_)) <= acceptable_obj_change_tol_); + && std::abs(curr_obj_val_ - last_obj_val_) / Max(Number(1.), std::abs(curr_obj_val_)) <= acceptable_obj_change_tol_); } } // namespace Ipopt diff --git a/src/Algorithm/IpOptErrorConvCheck.hpp b/src/Algorithm/IpOptErrorConvCheck.hpp index 157669dc1..07ff1eb94 100644 --- a/src/Algorithm/IpOptErrorConvCheck.hpp +++ b/src/Algorithm/IpOptErrorConvCheck.hpp @@ -16,13 +16,13 @@ class OptimalityErrorConvergenceCheck: public ConvergenceCheck { public: /**@name Constructors / Destructor */ - //@{ + ///@{ /** Default Constructor */ OptimalityErrorConvergenceCheck(); /** Destructor */ virtual ~OptimalityErrorConvergenceCheck(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -45,7 +45,7 @@ class OptimalityErrorConvergenceCheck: public ConvergenceCheck protected: /** @name Algorithmic parameters */ - //@{ + ///@{ /** Maximal number of iterations */ Index max_iterations_; /** Tolerance on unscaled dual infeasibility */ @@ -76,9 +76,11 @@ class OptimalityErrorConvergenceCheck: public ConvergenceCheck Number diverging_iterates_tol_; /** Desired value of the barrier parameter */ Number mu_target_; + /** Upper bound on wallclock time */ + Number max_wall_time_; /** Upper bound on CPU time */ Number max_cpu_time_; - //@} + ///@} private: /**@name Default Compiler Generated Methods (Hidden to avoid @@ -89,7 +91,7 @@ class OptimalityErrorConvergenceCheck: public ConvergenceCheck * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ OptimalityErrorConvergenceCheck( const OptimalityErrorConvergenceCheck& @@ -99,7 +101,7 @@ class OptimalityErrorConvergenceCheck: public ConvergenceCheck void operator=( const OptimalityErrorConvergenceCheck& ); - //@} + ///@} /** Counter for successive iterations in which acceptability * criteria are met. diff --git a/src/Algorithm/IpOrigIpoptNLP.cpp b/src/Algorithm/IpOrigIpoptNLP.cpp index 75c035f63..07b9ba728 100644 --- a/src/Algorithm/IpOrigIpoptNLP.cpp +++ b/src/Algorithm/IpOrigIpoptNLP.cpp @@ -11,6 +11,7 @@ #include #include +#include namespace Ipopt { @@ -21,7 +22,8 @@ static const Index dbg_verbosity = 0; OrigIpoptNLP::OrigIpoptNLP( const SmartPtr& jnlst, const SmartPtr& nlp, - const SmartPtr& nlp_scaling + const SmartPtr& nlp_scaling, + TimingStatistics& timing_statistics ) : IpoptNLP(nlp_scaling), jnlst_(jnlst), @@ -35,7 +37,8 @@ OrigIpoptNLP::OrigIpoptNLP( jac_d_cache_(1), h_cache_(1), unscaled_x_cache_(1), - initialized_(false) + initialized_(false), + timing_statistics_(timing_statistics) { } @@ -54,62 +57,60 @@ void OrigIpoptNLP::RegisterOptions( 1e-8, "Before start of the optimization, the bounds given by the user are relaxed. " "This option sets the factor for this relaxation. " + "Additional, the constraint violation tolerance constr_viol_tol is used to bound the relaxation by an absolute value. " "If it is set to zero, then then bounds relaxation is disabled. " - "(See Eqn.(35) in implementation paper.) " + "See Eqn.(35) in implementation paper. " "Note that the constraint violation reported by Ipopt at the end of the solution process " - "does not include violations of the original (non-relaxed) variable bounds."); - roptions->AddStringOption2( + "does not include violations of the original (non-relaxed) variable bounds. See also option honor_original_bounds."); + roptions->AddBoolOption( "honor_original_bounds", "Indicates whether final points should be projected into original bounds.", - "yes", - "no", "Leave final point unchanged", - "yes", "Project final point back into original bounds", + false, "Ipopt might relax the bounds during the optimization (see, e.g., option \"bound_relax_factor\"). " - "This option determines whether the final point should be projected back into the user-provide original bounds after the optimization."); + "This option determines whether the final point should be projected back into the user-provide original bounds after the optimization. " + "Note that violations of constraints and complementarity reported by Ipopt at the end of the solution process " + "are for the non-projected point."); roptions->SetRegisteringCategory("Warm Start"); - roptions->AddStringOption2( + roptions->AddBoolOption( "warm_start_same_structure", "Indicates whether a problem with a structure identical to the previous one is to be solved.", - "no", - "no", "Assume this is a new problem.", - "yes", "Assume this is problem has known structure", - "If \"yes\" is chosen, then the algorithm assumes that an NLP is now to be solved, " - "whose structure is identical to one that already was considered (with the same NLP object)."); + false, + "If enabled, then the algorithm assumes that an NLP is now to be solved " + "whose structure is identical to one that already was considered (with the same NLP object).", + true); roptions->SetRegisteringCategory("NLP"); - roptions->AddStringOption2( + roptions->AddBoolOption( "check_derivatives_for_naninf", "Indicates whether it is desired to check for Nan/Inf in derivative matrices", - "no", - "no", "Don't check (faster).", - "yes", "Check Jacobians and Hessian for Nan and Inf.", + false, "Activating this option will cause an error if an invalid number is detected " "in the constraint Jacobians or the Lagrangian Hessian. " "If this is not activated, the test is skipped, and the algorithm might proceed with invalid numbers and fail. " "If test is activated and an invalid number is detected, " - "the matrix is written to output with print_level corresponding to J_MORE_DETAILED; " + "the matrix is written to output with print_level corresponding to J_MOREDETAILED (7); " "so beware of large output!"); - roptions->AddStringOption2( + roptions->AddBoolOption( + "grad_f_constant", + "Indicates whether to assume that the objective function is linear", + false, + "Activating this option will cause Ipopt to ask for the Gradient of the objective function " + "only once from the NLP and reuse this information later."); + roptions->AddBoolOption( "jac_c_constant", - "Indicates whether all equality constraints are linear", - "no", - "no", "Don't assume that all equality constraints are linear", - "yes", "Assume that equality constraints Jacobian are constant", + "Indicates whether to assume that all equality constraints are linear", + false, "Activating this option will cause Ipopt to ask for the Jacobian of the equality constraints " "only once from the NLP and reuse this information later."); - roptions->AddStringOption2( + roptions->AddBoolOption( "jac_d_constant", - "Indicates whether all inequality constraints are linear", - "no", - "no", "Don't assume that all inequality constraints are linear", - "yes", "Assume that equality constraints Jacobian are constant", + "Indicates whether to assume that all inequality constraints are linear", + false, "Activating this option will cause Ipopt to ask for the Jacobian of the inequality constraints " "only once from the NLP and reuse this information later."); - roptions->AddStringOption2( + roptions->AddBoolOption( "hessian_constant", - "Indicates whether the problem is a quadratic problem", - "no", - "no", "Assume that Hessian changes", - "yes", "Assume that Hessian is constant", + "Indicates whether to assume the problem is a QP (quadratic objective, linear constraints)", + false, "Activating this option will cause Ipopt to ask for the Hessian of the Lagrangian function " "only once from the NLP and reuse this information later."); roptions->SetRegisteringCategory("Hessian Approximation"); @@ -125,7 +126,9 @@ void OrigIpoptNLP::RegisterOptions( "Indicates in which subspace the Hessian information is to be approximated.", "nonlinear-variables", "nonlinear-variables", "only in space of nonlinear variables.", - "all-variables", "in space of all variables (without slacks)"); + "all-variables", "in space of all variables (without slacks)", + "", + true); } bool OrigIpoptNLP::Initialize( @@ -135,6 +138,7 @@ bool OrigIpoptNLP::Initialize( ) { options.GetNumericValue("bound_relax_factor", bound_relax_factor_, prefix); + options.GetNumericValue("constr_viol_tol", constr_viol_tol_, prefix); options.GetBoolValue("honor_original_bounds", honor_original_bounds_, prefix); options.GetBoolValue("warm_start_same_structure", warm_start_same_structure_, prefix); options.GetBoolValue("check_derivatives_for_naninf", check_derivatives_for_naninf_, prefix); @@ -144,6 +148,7 @@ bool OrigIpoptNLP::Initialize( options.GetEnumValue("hessian_approximation_space", enum_int, prefix); hessian_approximation_space_ = HessianApproximationSpace(enum_int); + options.GetBoolValue("grad_f_constant", grad_f_constant_, prefix); options.GetBoolValue("jac_c_constant", jac_c_constant_, prefix); options.GetBoolValue("jac_d_constant", jac_d_constant_, prefix); options.GetBoolValue("hessian_constant", hessian_constant_, prefix); @@ -181,15 +186,17 @@ bool OrigIpoptNLP::Initialize( // Reset the cache entries belonging to a dummy dependency. This // is required for repeated solve, since the cache is not updated // if a dimension is zero. It is also required if we choose - // jac_[cd]_constant and hessian_constant differently between - // runs + // jac_[cd]_constant, grad_f_constant, or hessian_constant differently between + // runs or when the values of these derivatives changes due to a problem change. std::vector deps(1); deps[0] = NULL; std::vector sdeps(0); + grad_f_cache_.InvalidateResult(deps, sdeps); c_cache_.InvalidateResult(deps, sdeps); d_cache_.InvalidateResult(deps, sdeps); jac_c_cache_.InvalidateResult(deps, sdeps); jac_d_cache_.InvalidateResult(deps, sdeps); + deps.resize(3, NULL); h_cache_.InvalidateResult(deps, sdeps); if( !nlp_->ProcessOptions(options, prefix) ) @@ -258,7 +265,7 @@ bool OrigIpoptNLP::InitializeStructures( h_space_ = new LowRankUpdateSymMatrixSpace(x_space_->Dim(), ConstPtr(P_approx), ConstPtr(approx_vecspace), true); jnlst_->Printf(J_DETAILED, J_INITIALIZATION, - "Hessian approximation will be done in smaller space of dimension %d (instead of %d)\n\n", + "Hessian approximation will be done in smaller space of dimension %" IPOPT_INDEX_FORMAT " (instead of %" IPOPT_INDEX_FORMAT ")\n\n", P_approx->NCols(), P_approx->NRows()); } else @@ -266,7 +273,7 @@ bool OrigIpoptNLP::InitializeStructures( DBG_ASSERT(IsNull(P_approx)); h_space_ = new LowRankUpdateSymMatrixSpace(x_space_->Dim(), ConstPtr(P_approx), ConstPtr(x_space_), true); jnlst_->Printf(J_DETAILED, J_INITIALIZATION, - "Hessian approximation will be done in the space of all %d x variables.\n\n", x_space_->Dim()); + "Hessian approximation will be done in the space of all %" IPOPT_INDEX_FORMAT " x variables.\n\n", x_space_->Dim()); } } @@ -289,22 +296,21 @@ bool OrigIpoptNLP::InitializeStructures( NLP_scaling()->DetermineScaling(x_space_, c_space_, d_space_, jac_c_space_, jac_d_space_, h_space_, scaled_jac_c_space_, scaled_jac_d_space_, scaled_h_space_, *Px_L, *x_L, *Px_U, *x_U); - if( x_space_->Dim() < c_space_->Dim() ) + if( x_space_->Dim() < c_space_->Dim() && x_space_->Dim() > 0 ) { char msg[128]; - Snprintf(msg, 127, "Too few degrees of freedom: %d equality constriants but only %d variables", + Snprintf(msg, 127, "Too few degrees of freedom: %" IPOPT_INDEX_FORMAT " equality constraints but only %" IPOPT_INDEX_FORMAT " variables", c_space_->Dim(), x_space_->Dim()); THROW_EXCEPTION(TOO_FEW_DOF, msg); } - ASSERT_EXCEPTION(x_space_->Dim() > 0, TOO_FEW_DOF, "Too few degrees of freedom (no free variables)!"); // cannot have any null pointers, want zero length vectors // instead of null - this will later need to be changed for _h; - retValue = (IsValid(x_space_) && IsValid(c_space_) && IsValid(d_space_) && IsValid(x_l_space_) - && IsValid(px_l_space_) && IsValid(x_u_space_) && IsValid(px_u_space_) && IsValid(d_u_space_) - && IsValid(pd_u_space_) && IsValid(d_l_space_) && IsValid(pd_l_space_) && IsValid(jac_c_space_) - && IsValid(jac_d_space_) && IsValid(h_space_) && IsValid(scaled_jac_c_space_) && IsValid(scaled_jac_d_space_) - && IsValid(scaled_h_space_)); + DBG_DO(retValue = IsValid(x_space_) && IsValid(c_space_) && IsValid(d_space_) && IsValid(x_l_space_) + && IsValid(px_l_space_) && IsValid(x_u_space_) && IsValid(px_u_space_) && IsValid(d_u_space_) + && IsValid(pd_u_space_) && IsValid(d_l_space_) && IsValid(pd_l_space_) && IsValid(jac_c_space_) + && IsValid(jac_d_space_) && IsValid(h_space_) && IsValid(scaled_jac_c_space_) && IsValid(scaled_jac_d_space_) + && IsValid(scaled_h_space_)); DBG_ASSERT(retValue && "Model cannot return null vector or matrix prototypes or spaces," " please return zero length vectors instead"); @@ -335,20 +341,24 @@ bool OrigIpoptNLP::InitializeStructures( d_L->Print(*jnlst_, J_MOREVECTOR, J_INITIALIZATION, "original d_L unscaled"); d_U->Print(*jnlst_, J_MOREVECTOR, J_INITIALIZATION, "original d_U unscaled"); - if( honor_original_bounds_ ) + if( bound_relax_factor_ > 0.0 ) { SmartPtr tmp; tmp = x_L->MakeNewCopy(); orig_x_L_ = ConstPtr(tmp); tmp = x_U->MakeNewCopy(); orig_x_U_ = ConstPtr(tmp); + tmp = d_L->MakeNewCopy(); + orig_d_L_ = ConstPtr(tmp); + tmp = d_U->MakeNewCopy(); + orig_d_U_ = ConstPtr(tmp); + + relax_bounds(-bound_relax_factor_, *x_L); + relax_bounds(bound_relax_factor_, *x_U); + relax_bounds(-bound_relax_factor_, *d_L); + relax_bounds(bound_relax_factor_, *d_U); } - relax_bounds(-bound_relax_factor_, *x_L); - relax_bounds(bound_relax_factor_, *x_U); - relax_bounds(-bound_relax_factor_, *d_L); - relax_bounds(bound_relax_factor_, *d_U); - x_L_ = ConstPtr(x_L); Px_L_ = ConstPtr(Px_L); x_U_ = ConstPtr(x_U); @@ -453,20 +463,22 @@ void OrigIpoptNLP::relax_bounds( ) { DBG_START_METH("OrigIpoptNLP::relax_bounds", dbg_verbosity); - if( bound_relax_factor != 0. ) - { - SmartPtr tmp = bounds.MakeNew(); - tmp->Copy(bounds); - tmp->ElementWiseAbs(); - SmartPtr ones = bounds.MakeNew(); - ones->Set(1.); - tmp->ElementWiseMax(*ones); - DBG_PRINT((1, "bound_relax_factor = %e", bound_relax_factor)); - DBG_PRINT_VECTOR(2, "tmp", *tmp); - DBG_PRINT_VECTOR(2, "bounds before", bounds); - bounds.Axpy(bound_relax_factor, *tmp); - DBG_PRINT_VECTOR(2, "bounds after", bounds); - } + DBG_ASSERT(bound_relax_factor != 0.); // checked in caller + + SmartPtr tmp = bounds.MakeNew(); + tmp->Copy(bounds); + tmp->ElementWiseAbs(); + tmp->Scal(std::abs(bound_relax_factor)); // |relaxfactor|*|bounds| + SmartPtr ones = bounds.MakeNew(); + ones->Set(std::abs(bound_relax_factor)); + tmp->ElementWiseMax(*ones); // |relaxfactor|*max(|bounds|,1) + ones->Set(constr_viol_tol_); + tmp->ElementWiseMin(*ones); // min(constr_viol_tol_,|relaxfactor|*max(|bounds|,1)) + DBG_PRINT((1, "bound_relax_factor = %e constr_viol_tol = %e", bound_relax_factor, constr_viol_tol_)); + DBG_PRINT_VECTOR(2, "tmp", *tmp); + DBG_PRINT_VECTOR(2, "bounds before", bounds); + bounds.Axpy(bound_relax_factor < 0.0 ? -1.0 : 1.0, *tmp); + DBG_PRINT_VECTOR(2, "bounds after", bounds); } Number OrigIpoptNLP::f( @@ -480,9 +492,9 @@ Number OrigIpoptNLP::f( { f_evals_++; SmartPtr unscaled_x = get_unscaled_x(x); - f_eval_time_.Start(); + timing_statistics_.f_eval_time().Start(); bool success = nlp_->Eval_f(*unscaled_x, ret); - f_eval_time_.End(); + timing_statistics_.f_eval_time().End(); DBG_PRINT((1, "success = %d ret = %e\n", success, ret)); ASSERT_EXCEPTION(success && IsFiniteNumber(ret), Eval_Error, "Error evaluating the objective function"); ret = NLP_scaling()->apply_obj_scaling(ret); @@ -507,19 +519,24 @@ SmartPtr OrigIpoptNLP::grad_f( { SmartPtr unscaled_grad_f; SmartPtr retValue; - if( !grad_f_cache_.GetCachedResult1Dep(retValue, &x) ) + const Vector* dep = NULL; + if( !grad_f_constant_ ) + { + dep = &x; + } + if( !grad_f_cache_.GetCachedResult1Dep(retValue, dep) ) { grad_f_evals_++; unscaled_grad_f = x_space_->MakeNew(); SmartPtr unscaled_x = get_unscaled_x(x); - grad_f_eval_time_.Start(); + timing_statistics_.grad_f_eval_time().Start(); bool success = nlp_->Eval_grad_f(*unscaled_x, *unscaled_grad_f); - grad_f_eval_time_.End(); + timing_statistics_.grad_f_eval_time().End(); ASSERT_EXCEPTION(success && IsFiniteNumber(unscaled_grad_f->Nrm2()), Eval_Error, "Error evaluating the gradient of the objective function"); retValue = NLP_scaling()->apply_grad_obj_scaling(ConstPtr(unscaled_grad_f)); - grad_f_cache_.AddCachedResult1Dep(retValue, &x); + grad_f_cache_.AddCachedResult1Dep(retValue, dep); } return retValue; @@ -558,9 +575,9 @@ SmartPtr OrigIpoptNLP::c( SmartPtr unscaled_c = c_space_->MakeNew(); c_evals_++; SmartPtr unscaled_x = get_unscaled_x(x); - c_eval_time_.Start(); + timing_statistics_.c_eval_time().Start(); bool success = nlp_->Eval_c(*unscaled_x, *unscaled_c); - c_eval_time_.End(); + timing_statistics_.c_eval_time().End(); if( !success || !IsFiniteNumber(unscaled_c->Nrm2()) ) { if( check_derivatives_for_naninf_ && !IsFiniteNumber(unscaled_c->Nrm2()) ) @@ -606,9 +623,9 @@ SmartPtr OrigIpoptNLP::d( DBG_PRINT_VECTOR(2, "scaled_x", x); SmartPtr unscaled_x = get_unscaled_x(x); - d_eval_time_.Start(); + timing_statistics_.d_eval_time().Start(); bool success = nlp_->Eval_d(*unscaled_x, *unscaled_d); - d_eval_time_.End(); + timing_statistics_.d_eval_time().End(); DBG_PRINT_VECTOR(2, "unscaled_d", *unscaled_d); if( !success || !IsFiniteNumber(unscaled_d->Nrm2()) ) { @@ -658,9 +675,9 @@ SmartPtr OrigIpoptNLP::jac_c( SmartPtr unscaled_jac_c = jac_c_space_->MakeNew(); SmartPtr unscaled_x = get_unscaled_x(x); - jac_c_eval_time_.Start(); + timing_statistics_.jac_c_eval_time().Start(); bool success = nlp_->Eval_jac_c(*unscaled_x, *unscaled_jac_c); - jac_c_eval_time_.End(); + timing_statistics_.jac_c_eval_time().End(); ASSERT_EXCEPTION(success, Eval_Error, "Error evaluating the jacobian of the equality constraints"); if( check_derivatives_for_naninf_ ) { @@ -712,9 +729,9 @@ SmartPtr OrigIpoptNLP::jac_d( SmartPtr unscaled_jac_d = jac_d_space_->MakeNew(); SmartPtr unscaled_x = get_unscaled_x(x); - jac_d_eval_time_.Start(); + timing_statistics_.jac_d_eval_time().Start(); bool success = nlp_->Eval_jac_d(*unscaled_x, *unscaled_jac_d); - jac_d_eval_time_.End(); + timing_statistics_.jac_d_eval_time().End(); ASSERT_EXCEPTION(success, Eval_Error, "Error evaluating the jacobian of the inequality constraints"); if( check_derivatives_for_naninf_ ) { @@ -776,9 +793,9 @@ SmartPtr OrigIpoptNLP::h( SmartPtr unscaled_yc = NLP_scaling()->apply_vector_scaling_c(&yc); SmartPtr unscaled_yd = NLP_scaling()->apply_vector_scaling_d(&yd); Number scaled_obj_factor = NLP_scaling()->apply_obj_scaling(obj_factor); - h_eval_time_.Start(); + timing_statistics_.h_eval_time().Start(); bool success = nlp_->Eval_h(*unscaled_x, scaled_obj_factor, *unscaled_yc, *unscaled_yd, *unscaled_h); - h_eval_time_.End(); + timing_statistics_.h_eval_time().End(); ASSERT_EXCEPTION(success, Eval_Error, "Error evaluating the hessian of the lagrangian"); if( check_derivatives_for_naninf_ ) { @@ -915,13 +932,14 @@ void OrigIpoptNLP::FinalizeSolution( unscaled_y_d = NLP_scaling()->apply_vector_scaling_d(&y_d); } - if( honor_original_bounds_ && (Px_L_->NCols() > 0 || Px_U_->NCols() > 0) ) + if( honor_original_bounds_ && bound_relax_factor_ > 0.0 && (Px_L_->NCols() > 0 || Px_U_->NCols() > 0) ) { // Make sure the user specified bounds are satisfied SmartPtr tmp; SmartPtr un_x = unscaled_x->MakeNewCopy(); if( Px_L_->NCols() > 0 ) { + DBG_ASSERT(IsValid(orig_x_L_)); tmp = orig_x_L_->MakeNewCopy(); Px_L_->TransMultVector(1., *un_x, 0., *tmp); Px_L_->MultVector(-1., *tmp, 1., *un_x); @@ -930,6 +948,7 @@ void OrigIpoptNLP::FinalizeSolution( } if( Px_U_->NCols() > 0 ) { + DBG_ASSERT(IsValid(orig_x_U_)); tmp = orig_x_U_->MakeNewCopy(); Px_U_->TransMultVector(1., *un_x, 0., *tmp); Px_U_->MultVector(-1., *tmp, 1., *un_x); @@ -982,67 +1001,6 @@ void OrigIpoptNLP::AdjustVariableBounds( d_U_ = new_d_U.MakeNewCopy(); } -void OrigIpoptNLP::PrintTimingStatistics( - Journalist& jnlst, - EJournalLevel level, - EJournalCategory category -) const -{ - if( !jnlst.ProduceOutput(level, category) ) - { - return; - } - - jnlst.Printf(level, category, - "Function Evaluations................: %10.3f (sys: %10.3f wall: %10.3f)\n", TotalFunctionEvaluationCpuTime(), TotalFunctionEvaluationSysTime(), TotalFunctionEvaluationWallclockTime()); - jnlst.Printf(level, category, - " Objective function.................: %10.3f (sys: %10.3f wall: %10.3f)\n", f_eval_time_.TotalCpuTime(), f_eval_time_.TotalSysTime(), f_eval_time_.TotalWallclockTime()); - jnlst.Printf(level, category, - " Objective function gradient........: %10.3f (sys: %10.3f wall: %10.3f)\n", grad_f_eval_time_.TotalCpuTime(), grad_f_eval_time_.TotalSysTime(), grad_f_eval_time_.TotalWallclockTime()); - jnlst.Printf(level, category, - " Equality constraints...............: %10.3f (sys: %10.3f wall: %10.3f)\n", c_eval_time_.TotalCpuTime(), c_eval_time_.TotalSysTime(), c_eval_time_.TotalWallclockTime()); - jnlst.Printf(level, category, - " Inequality constraints.............: %10.3f (sys: %10.3f wall: %10.3f)\n", d_eval_time_.TotalCpuTime(), d_eval_time_.TotalSysTime(), d_eval_time_.TotalWallclockTime()); - jnlst.Printf(level, category, - " Equality constraint Jacobian.......: %10.3f (sys: %10.3f wall: %10.3f)\n", jac_c_eval_time_.TotalCpuTime(), jac_c_eval_time_.TotalSysTime(), jac_c_eval_time_.TotalWallclockTime()); - jnlst.Printf(level, category, - " Inequality constraint Jacobian.....: %10.3f (sys: %10.3f wall: %10.3f)\n", jac_d_eval_time_.TotalCpuTime(), jac_d_eval_time_.TotalSysTime(), jac_d_eval_time_.TotalWallclockTime()); - jnlst.Printf(level, category, - " Lagrangian Hessian.................: %10.3f (sys: %10.3f wall: %10.3f)\n", h_eval_time_.TotalCpuTime(), h_eval_time_.TotalSysTime(), h_eval_time_.TotalWallclockTime()); -} - -Number OrigIpoptNLP::TotalFunctionEvaluationCpuTime() const -{ - return f_eval_time_.TotalCpuTime() + grad_f_eval_time_.TotalCpuTime() + c_eval_time_.TotalCpuTime() - + d_eval_time_.TotalCpuTime() + jac_c_eval_time_.TotalCpuTime() + jac_d_eval_time_.TotalCpuTime() - + h_eval_time_.TotalCpuTime(); -} - -Number OrigIpoptNLP::TotalFunctionEvaluationSysTime() const -{ - return f_eval_time_.TotalSysTime() + grad_f_eval_time_.TotalSysTime() + c_eval_time_.TotalSysTime() - + d_eval_time_.TotalSysTime() + jac_c_eval_time_.TotalSysTime() + jac_d_eval_time_.TotalSysTime() - + h_eval_time_.TotalSysTime(); -} - -Number OrigIpoptNLP::TotalFunctionEvaluationWallclockTime() const -{ - return f_eval_time_.TotalWallclockTime() + grad_f_eval_time_.TotalWallclockTime() + c_eval_time_.TotalWallclockTime() - + d_eval_time_.TotalWallclockTime() + jac_c_eval_time_.TotalWallclockTime() - + jac_d_eval_time_.TotalWallclockTime() + h_eval_time_.TotalWallclockTime(); -} - -void OrigIpoptNLP::ResetTimes() -{ - f_eval_time_.Reset(); - grad_f_eval_time_.Reset(); - c_eval_time_.Reset(); - d_eval_time_.Reset(); - jac_c_eval_time_.Reset(); - jac_d_eval_time_.Reset(); - h_eval_time_.Reset(); -} - SmartPtr OrigIpoptNLP::get_unscaled_x( const Vector& x ) diff --git a/src/Algorithm/IpOrigIpoptNLP.hpp b/src/Algorithm/IpOrigIpoptNLP.hpp index c623cf402..01eaa2d6c 100644 --- a/src/Algorithm/IpOrigIpoptNLP.hpp +++ b/src/Algorithm/IpOrigIpoptNLP.hpp @@ -29,27 +29,55 @@ enum HessianApproximationSpace }; /** This class maps the traditional NLP into - * something that is more useful by Ipopt. + * something that is more useful for %Ipopt. * * This class takes care of storing the - * calculated model results, handles caching, + * calculated model results, handles caching, scaling, * and (some day) takes care of addition of slacks. + * + * Given a NLP + * \f{eqnarray*} + * \mathrm{min} && f(x), \\ + * \mathrm{s.t.} && c(x) = 0, &\qquad y_c\\ + * && d_L \leq d(x) \leq d_U, &\qquad y_d \\ + * && x_L \leq x \leq x_U, &\qquad z_L, z_U + * \f} + * and (invertible diagonal) scaling matrices \f$s_o\f$, \f$s_c\f$, \f$s_d\f$, \f$s_x\f$, + * this class represents the %NLP + * \f{eqnarray*} + * \mathrm{min} && s_o f(s_x^{-1} \tilde x), \\ + * \mathrm{s.t.} && s_c c(s_x^{-1} \tilde x) = 0, &\qquad \tilde y_c \\ + * && s_d d_L \leq s_d d(s_x^{-1} \tilde x) \leq s_d d_U, &\qquad \tilde y_d \\ + * && s_x x_L \leq \tilde x \leq s_x x_U, &\qquad \tilde z_L, z_U + * \f} + * where \f$\tilde x\f$, \f$\tilde y_c\f$, \f$\tilde y_d\f$, \f$\tilde z_L\f$, \f$\tilde z_U\f$, + * are the primal and dual variables of the scaled problem (though, %Ipopt adds slack variables additionally). + * + * The correspondence between a scaled and its corresponding unscaled solution is + * \f{eqnarray*} + * x && = s_x^{-1} \tilde x \\ + * y_c && = s_o^{-1} s_c \tilde y_c \\ + * y_d && = s_o^{-1} s_d \tilde y_d \\ + * z_L && = s_o^{-1} s_x \tilde z_L \\ + * z_U && = s_o^{-1} s_x \tilde z_U + * \f} */ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP { public: /**@name Constructors / Destructor */ - //@{ + ///@{ /** Constructor */ OrigIpoptNLP( - const SmartPtr& jnlst, - const SmartPtr& nlp, - const SmartPtr& nlp_scaling + const SmartPtr& jnlst, ///< Journalist + const SmartPtr& nlp, ///< NLP + const SmartPtr& nlp_scaling, ///< NLP scaling + TimingStatistics& timing_statistics ///< Timing statistics @since 3.14.0 ); /** Destructor */ virtual ~OrigIpoptNLP(); - //@} + ///@} virtual bool Initialize( const Journalist& jnlst, @@ -82,7 +110,7 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP } /** Accessor methods for model data */ - //@{ + ///@{ /** Objective value */ virtual Number f( const Vector& x @@ -157,7 +185,7 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP */ virtual SmartPtr uninitialized_h(); - /** Lower bounds on x */ + /** Scaled lower bounds on x */ virtual SmartPtr x_L() const { return x_L_; @@ -169,7 +197,17 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP return Px_L_; } - /** Upper bounds on x */ + /** Original unscaled lower bounds on x + * + * Returns NULL if bounds are not relaxed. + * @since 3.14.0 + */ + virtual SmartPtr orig_x_L() const + { + return orig_x_L_; + } + + /** Scaled upper bounds on x */ virtual SmartPtr x_U() const { return x_U_; @@ -181,7 +219,17 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP return Px_U_; } - /** Lower bounds on d */ + /** Original unscaled upper bounds on x + * + * Returns NULL if bounds are not relaxed. + * @since 3.14.0 + */ + virtual SmartPtr orig_x_U() const + { + return orig_x_U_; + } + + /** Scaled lower bounds on d */ virtual SmartPtr d_L() const { return d_L_; @@ -193,7 +241,17 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP return Pd_L_; } - /** Upper bounds on d */ + /** Original unscaled lower bounds on d + * + * Returns NULL if bounds are not relaxed. + * @since 3.14.10 + */ + virtual SmartPtr orig_d_L() const + { + return orig_d_L_; + } + + /** Scaled upper bounds on d */ virtual SmartPtr d_U() const { return d_U_; @@ -205,6 +263,16 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP return Pd_U_; } + /** Original unscaled upper bounds on d + * + * Returns NULL if bounds are not relaxed. + * @since 3.14.10 + */ + virtual SmartPtr orig_d_U() const + { + return orig_d_U_; + } + virtual SmartPtr HessianMatrixSpace() const { return h_space_; @@ -214,7 +282,7 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP { return x_space_; } - //@} + ///@} /** Accessor method for vector/matrix spaces pointers */ virtual void GetSpaces( @@ -244,7 +312,7 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP ); /** @name Counters for the number of function evaluations. */ - //@{ + ///@{ virtual Index f_evals() const { return f_evals_; @@ -273,10 +341,10 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP { return h_evals_; } - //@} + ///@} /** Solution Routines - overloaded from IpoptNLP */ - //@{ + ///@{ void FinalizeSolution( SolverReturn status, const Vector& x, @@ -306,7 +374,7 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP SmartPtr ip_data, SmartPtr ip_cq ); - //@} + ///@} /** Called to register the options */ static void RegisterOptions( @@ -319,51 +387,6 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP return nlp_; } - /**@name Methods related to function evaluation timing. */ - //@{ - /** Reset the timing statistics */ - void ResetTimes(); - - void PrintTimingStatistics( - Journalist& jnlst, - EJournalLevel level, - EJournalCategory category - ) const; - - const TimedTask& f_eval_time() const - { - return f_eval_time_; - } - const TimedTask& grad_f_eval_time() const - { - return grad_f_eval_time_; - } - const TimedTask& c_eval_time() const - { - return c_eval_time_; - } - const TimedTask& jac_c_eval_time() const - { - return jac_c_eval_time_; - } - const TimedTask& d_eval_time() const - { - return d_eval_time_; - } - const TimedTask& jac_d_eval_time() const - { - return jac_d_eval_time_; - } - const TimedTask& h_eval_time() const - { - return h_eval_time_; - } - - Number TotalFunctionEvaluationCpuTime() const; - Number TotalFunctionEvaluationSysTime() const; - Number TotalFunctionEvaluationWallclockTime() const; - //@} - private: /** Journalist */ SmartPtr jnlst_; @@ -372,7 +395,7 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP SmartPtr nlp_; /** Necessary Vector/Matrix spaces */ - //@{ + ///@{ SmartPtr x_space_; SmartPtr c_space_; SmartPtr d_space_; @@ -391,10 +414,10 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP SmartPtr scaled_jac_c_space_; SmartPtr scaled_jac_d_space_; SmartPtr scaled_h_space_; - //@} + ///@} /**@name Storage for Model Quantities */ - //@{ + ///@{ /** Objective function */ CachedResults f_cache_; @@ -456,7 +479,13 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP /** Original unmodified upper bounds on x */ SmartPtr orig_x_U_; - //@} + + /** Original unmodified lower bounds on d */ + SmartPtr orig_d_L_; + + /** Original unmodified upper bounds on d */ + SmartPtr orig_d_U_; + ///@} /**@name Default Compiler Generated Methods * (Hidden to avoid implicit creation/calling). @@ -467,7 +496,7 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ OrigIpoptNLP(); @@ -480,10 +509,10 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP void operator=( const OrigIpoptNLP& ); - //@} + ///@} /** @name auxiliary functions */ - //@{ + ///@{ /** relax the bounds by a relative move of relax_bound_factor. * * Here, relax_bound_factor should be negative (or zero) for @@ -498,14 +527,17 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP SmartPtr get_unscaled_x( const Vector& x ); - //@} + ///@} /** @name Algorithmic parameters */ - //@{ + ///@{ /** relaxation factor for the bounds */ Number bound_relax_factor_; + /** constraint violation tolerance (from OptimalityErrorConvergenceCheck) */ + Number constr_viol_tol_; + /** Flag indicating whether the primal variables should be * projected back into original bounds are optimization. */ @@ -527,6 +559,11 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP */ bool check_derivatives_for_naninf_; + /** Flag indicating if we need to ask for objective + * Gradient only once + */ + bool grad_f_constant_; + /** Flag indicating if we need to ask for equality constraint * Jacobians only once */ @@ -539,10 +576,10 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP /** Flag indicating if we need to ask for Hessian only once */ bool hessian_constant_; - //@} + ///@} /** @name Counters for the function evaluations */ - //@{ + ///@{ Index f_evals_; Index grad_f_evals_; Index c_evals_; @@ -550,21 +587,15 @@ class IPOPTLIB_EXPORT OrigIpoptNLP: public IpoptNLP Index d_evals_; Index jac_d_evals_; Index h_evals_; - //@} + ///@} /** Flag indicating if initialization method has been called */ bool initialized_; /**@name Timing statistics for the function evaluations. */ - //@{ - TimedTask f_eval_time_; - TimedTask grad_f_eval_time_; - TimedTask c_eval_time_; - TimedTask jac_c_eval_time_; - TimedTask d_eval_time_; - TimedTask jac_d_eval_time_; - TimedTask h_eval_time_; - //@} + ///@{ + TimingStatistics& timing_statistics_; + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpOrigIterationOutput.cpp b/src/Algorithm/IpOrigIterationOutput.cpp index 14bac2764..c52258647 100644 --- a/src/Algorithm/IpOrigIterationOutput.cpp +++ b/src/Algorithm/IpOrigIterationOutput.cpp @@ -22,14 +22,12 @@ void OrigIterationOutput::RegisterOptions( SmartPtr roptions ) { - std::string prev_cat = roptions->RegisteringCategory(); + SmartPtr prev_cat = roptions->RegisteringCategory(); roptions->SetRegisteringCategory("Output"); - roptions->AddStringOption2( + roptions->AddBoolOption( "print_info_string", "Enables printing of additional info string at end of iteration output.", - "no", - "no", "don't print string", - "yes", "print string at end of each iteration output", + false, "This string contains some insider information about the current iteration. " "For details, look for \"Diagnostic Tags\" in the Ipopt documentation."); roptions->AddStringOption2( @@ -84,19 +82,19 @@ void OrigIterationOutput::WriteOutput() Jnlst().Printf(J_DETAILED, J_MAIN, "\n\n**************************************************\n"); Jnlst().Printf(J_DETAILED, J_MAIN, - "*** Summary of Iteration: %d:", IpData().iter_count()); + "*** Summary of Iteration: %" IPOPT_INDEX_FORMAT ":", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n\n"); if( IpData().info_iters_since_header() >= 10 && !IpData().info_skip_output() ) { // output the header - Jnlst().Printf(J_ITERSUMMARY, J_MAIN, + Jnlst().Printf(J_ITERSUMMARY, J_MAIN, "%s", header.c_str()); IpData().Set_info_iters_since_header(0); } else { - Jnlst().Printf(J_DETAILED, J_MAIN, + Jnlst().Printf(J_DETAILED, J_MAIN, "%s", header.c_str()); } Number inf_pr = 0.0; @@ -125,7 +123,6 @@ void OrigIterationOutput::WriteOutput() Number unscaled_f = IpCq().unscaled_curr_f(); // Retrieve some information set in the different parts of the algorithm - char info_iter = ' '; Number alpha_primal = IpData().info_alpha_primal(); char alpha_primal_char = IpData().info_alpha_primal_char(); Number alpha_dual = IpData().info_alpha_dual(); @@ -139,7 +136,7 @@ void OrigIterationOutput::WriteOutput() } else { - Snprintf(regu_x_buf, 7, "%5.1f", log10(regu_x)); + Snprintf(regu_x_buf, 7, "%5.1f", std::log10(regu_x)); regu_x_ptr = regu_x_buf; } Index ls_count = IpData().info_ls_count(); @@ -152,7 +149,7 @@ void OrigIterationOutput::WriteOutput() || last_output < 0.0) ) { Jnlst().Printf(J_ITERSUMMARY, J_MAIN, - "%4d%c%14.7e %7.2e %7.2e %5.1f %7.2e %5s %7.2e %7.2e%c%3d", iter, info_iter, unscaled_f, inf_pr, inf_du, log10(mu), dnrm, regu_x_ptr, alpha_dual, alpha_primal, alpha_primal_char, ls_count); + "%4" IPOPT_INDEX_FORMAT " %14.7e %7.2e %7.2e %5.1f %7.2e %5s %7.2e %7.2e%c%3" IPOPT_INDEX_FORMAT, iter, unscaled_f, inf_pr, inf_du, std::log10(mu), dnrm, regu_x_ptr, alpha_dual, alpha_primal, alpha_primal_char, ls_count); if( print_info_string_ ) { Jnlst().Printf(J_ITERSUMMARY, J_MAIN, @@ -179,7 +176,7 @@ void OrigIterationOutput::WriteOutput() Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n"); Jnlst().Printf(J_DETAILED, J_MAIN, - "*** Beginning Iteration %d from the following point:", IpData().iter_count()); + "*** Beginning Iteration %" IPOPT_INDEX_FORMAT " from the following point:", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n\n"); @@ -262,7 +259,7 @@ void OrigIterationOutput::WriteOutput() if( Jnlst().ProduceOutput(J_DETAILED, J_MAIN) ) { Jnlst().Printf(J_DETAILED, J_MAIN, - "\n\n***Current NLP Values for Iteration %d:\n", IpData().iter_count()); + "\n\n***Current NLP Values for Iteration %" IPOPT_INDEX_FORMAT ":\n", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n (scaled) (unscaled)\n"); Jnlst().Printf(J_DETAILED, J_MAIN, diff --git a/src/Algorithm/IpOrigIterationOutput.hpp b/src/Algorithm/IpOrigIterationOutput.hpp index 611a4d80e..27ca6adfa 100644 --- a/src/Algorithm/IpOrigIterationOutput.hpp +++ b/src/Algorithm/IpOrigIterationOutput.hpp @@ -18,13 +18,13 @@ class OrigIterationOutput: public IterationOutput { public: /**@name Constructors / Destructor */ - //@{ + ///@{ /** Default Constructor */ OrigIterationOutput(); /** Destructor */ virtual ~OrigIterationOutput(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -39,11 +39,11 @@ class OrigIterationOutput: public IterationOutput virtual void WriteOutput(); /** Methods for OptionsList */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods (Hidden to avoid @@ -54,7 +54,7 @@ class OrigIterationOutput: public IterationOutput * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ OrigIterationOutput( const OrigIterationOutput& @@ -64,7 +64,7 @@ class OrigIterationOutput: public IterationOutput void operator=( const OrigIterationOutput& ); - //@} + ///@} /** Flag indicating weather info string should be printed at end * of iteration summary line. @@ -75,7 +75,7 @@ class OrigIterationOutput: public IterationOutput InfPrOutput inf_pr_output_; /** Option indicating at which iteration frequency the summary line should be printed */ - int print_frequency_iter_; + Index print_frequency_iter_; /** Option indicating at which time frequency the summary line should be printed */ Number print_frequency_time_; diff --git a/src/Algorithm/IpPDFullSpaceSolver.cpp b/src/Algorithm/IpPDFullSpaceSolver.cpp index 982550882..195ab4dc0 100644 --- a/src/Algorithm/IpPDFullSpaceSolver.cpp +++ b/src/Algorithm/IpPDFullSpaceSolver.cpp @@ -58,14 +58,16 @@ void PDFullSpaceSolver::RegisterOptions( 0., true, 1e-10, "Iterative refinement is performed until the residual test ratio is less than this tolerance " - "(or until \"max_refinement_steps\" refinement steps are performed)."); + "(or until \"max_refinement_steps\" refinement steps are performed).", + true); roptions->AddLowerBoundedNumberOption( "residual_ratio_singular", "Threshold for declaring linear system singular after failed iterative refinement.", 0., true, 1e-5, "If the residual test ratio is larger than this value after failed iterative refinement, " - "the algorithm pretends that the linear system is singular."); + "the algorithm pretends that the linear system is singular.", + true); // ToDo Think about following option - are the correct norms used? roptions->AddLowerBoundedNumberOption( "residual_improvement_factor", @@ -73,7 +75,8 @@ void PDFullSpaceSolver::RegisterOptions( 0., true, 0.999999999, "If the improvement of the residual test ratio made by one iterative refinement step is not better than this factor, " - "iterative refinement is aborted."); + "iterative refinement is aborted.", + true); roptions->AddLowerBoundedNumberOption( "neg_curv_test_tol", "Tolerance for heuristic to ignore wrong inertia.", @@ -92,7 +95,6 @@ void PDFullSpaceSolver::RegisterOptions( "no", "use original IPOPT approach, in which the primal regularization is ignored"); } - bool PDFullSpaceSolver::InitializeImpl( const OptionsList& options, const std::string& prefix @@ -164,8 +166,8 @@ bool PDFullSpaceSolver::Solve( } // Receive data about matrix - SmartPtr x = IpData().curr()->x(); - SmartPtr s = IpData().curr()->s(); +// SmartPtr x = IpData().curr()->x(); +// SmartPtr s = IpData().curr()->s(); SmartPtr W = IpData().W(); SmartPtr J_c = IpCq().curr_jac_c(); SmartPtr J_d = IpCq().curr_jac_d(); @@ -251,8 +253,8 @@ bool PDFullSpaceSolver::Solve( // Beginning of loop for iterative refinement Index num_iter_ref = 0; bool quit_refinement = false; - while( !allow_inexact && !quit_refinement - && (num_iter_ref < min_refinement_steps_ || residual_ratio > residual_ratio_max_) ) + while( /* !allow_inexact &&*/ !quit_refinement // allow_inexact is always false here + && (num_iter_ref < min_refinement_steps_ || residual_ratio > residual_ratio_max_) ) { // To the next back solve @@ -439,7 +441,7 @@ bool PDFullSpaceSolver::SolveOnce( deps[10] = &slack_s_U; deps[11] = &sigma_x; deps[12] = &sigma_s; - void* dummy; + void* dummy = NULL; bool uptodate = dummy_cache_.GetCachedResult(dummy, deps); if( !uptodate ) { @@ -483,7 +485,7 @@ bool PDFullSpaceSolver::SolveOnce( { const Index numberOfEVals = rhs.y_c()->Dim() + rhs.y_d()->Dim(); // counter for the number of trial evaluations - // (ToDo is not at the correct place) + // ToDo is not at the correct place Index count = 0; // Get the very first perturbation values from the perturbation @@ -495,9 +497,7 @@ bool PDFullSpaceSolver::SolveOnce( perturbHandler_->ConsiderNewSystem(delta_x, delta_s, delta_c, delta_d); retval = SYMSOLVER_SINGULAR; - bool fail = false; - - while( retval != SYMSOLVER_SUCCESS && !fail ) + while( retval != SYMSOLVER_SUCCESS ) { if( pretend_singular ) @@ -616,7 +616,7 @@ bool PDFullSpaceSolver::SolveOnce( s_tmp->Scal(delta_s); xWx += s_tmp->Dot(*sol->s()); } - Number xs_nrmsq = pow(sol->x()->Nrm2(), 2) + pow(sol->s()->Nrm2(), 2); + Number xs_nrmsq = std::pow(sol->x()->Nrm2(), 2) + std::pow(sol->s()->Nrm2(), 2); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "In inertia heuristic: xWx = %e xx = %e\n", xWx, xs_nrmsq); @@ -637,11 +637,11 @@ bool PDFullSpaceSolver::SolveOnce( } } } - } // while (retval!=SYMSOLVER_SUCCESS && !fail) { + } // while (retval!=SYMSOLVER_SUCCESS) // Some output Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of trial factorizations performed: %d\n", count); + "Number of trial factorizations performed: %" IPOPT_INDEX_FORMAT "\n", count); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Perturbation parameters: delta_x=%e delta_s=%e\n delta_c=%e delta_d=%e\n", delta_x, delta_s, delta_c, delta_d); diff --git a/src/Algorithm/IpPDFullSpaceSolver.hpp b/src/Algorithm/IpPDFullSpaceSolver.hpp index b87704f8a..6e117821a 100644 --- a/src/Algorithm/IpPDFullSpaceSolver.hpp +++ b/src/Algorithm/IpPDFullSpaceSolver.hpp @@ -31,7 +31,7 @@ class PDFullSpaceSolver: public PDSystemSolver { public: /** @name /Destructor */ - //@{ + ///@{ /** Constructor that takes in the Augmented System solver that * is to be used inside */ @@ -42,7 +42,7 @@ class PDFullSpaceSolver: public PDSystemSolver /** Default destructor */ virtual ~PDFullSpaceSolver(); - //@} + ///@} /* overloaded from AlgorithmStrategyObject */ bool InitializeImpl( @@ -62,11 +62,11 @@ class PDFullSpaceSolver: public PDSystemSolver ); /** Methods for IpoptType */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -78,7 +78,7 @@ class PDFullSpaceSolver: public PDSystemSolver * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ PDFullSpaceSolver(); @@ -86,19 +86,19 @@ class PDFullSpaceSolver: public PDSystemSolver PDFullSpaceSolver& operator=( const PDFullSpaceSolver& ); - //@} + ///@} /** @name Strategy objects to hold on to. */ - //@{ + ///@{ /** Pointer to the Solver for the augmented system */ SmartPtr augSysSolver_; /** Pointer to the Perturbation Handler. */ SmartPtr perturbHandler_; - //@} + ///@} /**@name Data about the correction made to the system */ - //@{ + ///@{ /** A dummy cache to figure out if the deltas are still up to date */ CachedResults dummy_cache_; @@ -106,10 +106,10 @@ class PDFullSpaceSolver: public PDSystemSolver * of the augmented system solver has already been increased. */ bool augsys_improved_; - //@} + ///@} /** @name Parameters */ - //@{ + ///@{ /** Minimal number of iterative refinement performed per backsolve */ Index min_refinement_steps_; @@ -137,7 +137,7 @@ class PDFullSpaceSolver: public PDSystemSolver /** Do curvature test with primal regularization */ bool neg_curv_test_reg_; - //@} + ///@} /** Internal function for a single backsolve (which will be used * for iterative refinement on the outside). @@ -212,7 +212,7 @@ class PDFullSpaceSolver: public PDSystemSolver ); /** @name Auxiliary functions */ - //@{ + ///@{ /** Compute \f$ x = S^{-1}(r + \alpha Z P^T d)\f$ */ void SinvBlrmZPTdBr( Number alpha, @@ -223,7 +223,7 @@ class PDFullSpaceSolver: public PDSystemSolver const Vector& g, Vector& X ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpPDPerturbationHandler.cpp b/src/Algorithm/IpPDPerturbationHandler.cpp index e3f5dad2c..443c3626d 100644 --- a/src/Algorithm/IpPDPerturbationHandler.cpp +++ b/src/Algorithm/IpPDPerturbationHandler.cpp @@ -37,7 +37,7 @@ void PDPerturbationHandler::RegisterOptions( "If the inertia is not correct, a multiple of the identity matrix is added to the Hessian of the Lagrangian in the augmented system. " "This parameter gives the maximum value of the regularization parameter. " "If a regularization of that size is not enough, the algorithm skips this iteration and goes to the restoration phase. " - "(This is delta_w^max in the implementation paper.)"); + "This is delta_w^max in the implementation paper."); roptions->AddLowerBoundedNumberOption( "min_hessian_perturbation", "Smallest perturbation of the Hessian block.", @@ -45,7 +45,7 @@ void PDPerturbationHandler::RegisterOptions( 1e-20, "The size of the perturbation of the Hessian block is never selected smaller than this value, " "unless no perturbation is necessary. " - "(This is delta_w^min in implementation paper.)"); + "This is delta_w^min in implementation paper."); roptions->AddLowerBoundedNumberOption( "perturb_inc_fact_first", "Increase factor for x-s perturbation for very first perturbation.", @@ -54,7 +54,7 @@ void PDPerturbationHandler::RegisterOptions( "The factor by which the perturbation is increased when a trial value was not sufficient - " "this value is used for the computation of the very first perturbation and allows a different value for " "the first perturbation than that used for the remaining perturbations. " - "(This is bar_kappa_w^+ in the implementation paper.)"); + "This is bar_kappa_w^+ in the implementation paper."); roptions->AddLowerBoundedNumberOption( "perturb_inc_fact", "Increase factor for x-s perturbation.", @@ -62,7 +62,7 @@ void PDPerturbationHandler::RegisterOptions( 8., "The factor by which the perturbation is increased when a trial value was not sufficient - " "this value is used for the computation of all perturbations except for the first. " - "(This is kappa_w^+ in the implementation paper.)"); + "This is kappa_w^+ in the implementation paper."); roptions->AddBoundedNumberOption( "perturb_dec_fact", "Decrease factor for x-s perturbation.", @@ -71,34 +71,34 @@ void PDPerturbationHandler::RegisterOptions( 1. / 3., "The factor by which the perturbation is decreased when a trial value is deduced from " "the size of the most recent successful perturbation. " - "(This is kappa_w^- in the implementation paper.)"); + "This is kappa_w^- in the implementation paper."); roptions->AddLowerBoundedNumberOption( "first_hessian_perturbation", "Size of first x-s perturbation tried.", 0., true, 1e-4, - "The first value tried for the x-s perturbation in the inertia correction scheme." - "(This is delta_0 in the implementation paper.)"); + "The first value tried for the x-s perturbation in the inertia correction scheme. " + "This is delta_0 in the implementation paper."); roptions->AddLowerBoundedNumberOption( "jacobian_regularization_value", "Size of the regularization for rank-deficient constraint Jacobians.", 0., false, 1e-8, - "(This is bar delta_c in the implementation paper.)"); + "This is bar delta_c in the implementation paper."); roptions->AddLowerBoundedNumberOption( "jacobian_regularization_exponent", "Exponent for mu in the regularization for rank-deficient constraint Jacobians.", 0., false, 0.25, - "(This is kappa_c in the implementation paper.)"); - roptions->AddStringOption2( + "This is kappa_c in the implementation paper.", + true); + roptions->AddBoolOption( "perturb_always_cd", "Active permanent perturbation of constraint linearization.", - "no", - "no", "perturbation only used when required", - "yes", "always use perturbation", - "This options makes the delta_c and delta_d perturbation be used for the computation of every search direction. " - "Usually, it is only used when the iteration matrix is singular."); + false, + "Enabling this option leads to using the delta_c and delta_d perturbation for the computation of every search direction. " + "Usually, it is only used when the iteration matrix is singular.", + true); } bool PDPerturbationHandler::InitializeImpl( @@ -466,7 +466,7 @@ void PDPerturbationHandler::CurrentPerturbation( Number PDPerturbationHandler::delta_cd() { - return delta_cd_val_ * pow(IpData().curr_mu(), delta_cd_exp_); + return delta_cd_val_ * std::pow(IpData().curr_mu(), delta_cd_exp_); } void PDPerturbationHandler::finalize_test() diff --git a/src/Algorithm/IpPDPerturbationHandler.hpp b/src/Algorithm/IpPDPerturbationHandler.hpp index 250254ee8..2cc81c15e 100644 --- a/src/Algorithm/IpPDPerturbationHandler.hpp +++ b/src/Algorithm/IpPDPerturbationHandler.hpp @@ -24,14 +24,14 @@ class PDPerturbationHandler: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ PDPerturbationHandler(); /** Destructor */ virtual ~PDPerturbationHandler() { } - //@} + ///@} /* overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -103,7 +103,7 @@ class PDPerturbationHandler: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ PDPerturbationHandler( const PDPerturbationHandler& @@ -113,10 +113,10 @@ class PDPerturbationHandler: public AlgorithmStrategyObject void operator=( const PDPerturbationHandler& ); - //@} + ///@} /** @name Size of the most recent non-zero perturbation. */ - //@{ + ///@{ /** The last nonzero value for delta_x */ Number delta_x_last_; /** The last nonzero value for delta_s */ @@ -125,12 +125,12 @@ class PDPerturbationHandler: public AlgorithmStrategyObject Number delta_c_last_; /** The last nonzero value for delta_d */ Number delta_d_last_; - //@} + ///@} /** @name Size of the most recently suggested perturbation for the * current matrix. */ - //@{ + ///@{ /** The current value for delta_x */ Number delta_x_curr_; /** The current value for delta_s */ @@ -139,7 +139,7 @@ class PDPerturbationHandler: public AlgorithmStrategyObject Number delta_c_curr_; /** The current value for delta_d */ Number delta_d_curr_; - //@} + ///@} /** Flag indicating if for the given matrix the perturb for wrong * inertia method has already been called. @@ -147,7 +147,7 @@ class PDPerturbationHandler: public AlgorithmStrategyObject bool get_deltas_for_wrong_inertia_called_; /** @name Handling structural degeneracy */ - //@{ + ///@{ /** Type for degeneracy flags */ enum DegenType { @@ -186,10 +186,10 @@ class PDPerturbationHandler: public AlgorithmStrategyObject /** Current status */ TrialStatus test_status_; - //@} + ///@} /** @name Algorithmic parameters. */ - //@{ + ///@{ /** Maximal perturbation for x and s. */ Number delta_xs_max_; /** Smallest possible perturbation for x and s. */ @@ -217,10 +217,10 @@ class PDPerturbationHandler: public AlgorithmStrategyObject * always be used. */ bool perturb_always_cd_; - //@} + ///@} /** @name Auxiliary methods */ - //@{ + ///@{ /** Internal version of PerturbForWrongInertia with the * difference, that finalize_test is not called. * @@ -242,7 +242,7 @@ class PDPerturbationHandler: public AlgorithmStrategyObject /** Compute perturbation value for constraints */ Number delta_cd(); - //@} + ///@} }; diff --git a/src/Algorithm/IpPDSearchDirCalc.cpp b/src/Algorithm/IpPDSearchDirCalc.cpp index b0c5e29cf..7df9903af 100644 --- a/src/Algorithm/IpPDSearchDirCalc.cpp +++ b/src/Algorithm/IpPDSearchDirCalc.cpp @@ -35,15 +35,13 @@ void PDSearchDirCalculator::RegisterOptions( ) { roptions->SetRegisteringCategory("Step Calculation"); - roptions->AddStringOption2( + roptions->AddBoolOption( "fast_step_computation", "Indicates if the linear system should be solved quickly.", - "no", - "no", "Verify solution of linear system by computing residuals.", - "yes", "Trust that linear systems are solved well.", - "If set to yes, the algorithm assumes that the linear system that is solved to obtain the search direction, " + false, + "If enabled, the algorithm assumes that the linear system that is solved to obtain the search direction " "is solved sufficiently well. " - "In that case, no residuals are computed, and the computation of the search direction is a little faster."); + "In that case, no residuals are computed to verify the solution and the computation of the search direction is a little faster."); } bool PDSearchDirCalculator::InitializeImpl( diff --git a/src/Algorithm/IpPDSearchDirCalc.hpp b/src/Algorithm/IpPDSearchDirCalc.hpp index fc122a69f..376c39a43 100644 --- a/src/Algorithm/IpPDSearchDirCalc.hpp +++ b/src/Algorithm/IpPDSearchDirCalc.hpp @@ -20,7 +20,7 @@ class IPOPTLIB_EXPORT PDSearchDirCalculator: public SearchDirectionCalculator { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ PDSearchDirCalculator( const SmartPtr& pd_solver @@ -28,7 +28,7 @@ class IPOPTLIB_EXPORT PDSearchDirCalculator: public SearchDirectionCalculator /** Destructor */ virtual ~PDSearchDirCalculator(); - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -62,7 +62,7 @@ class IPOPTLIB_EXPORT PDSearchDirCalculator: public SearchDirectionCalculator * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ PDSearchDirCalculator(); @@ -75,15 +75,15 @@ class IPOPTLIB_EXPORT PDSearchDirCalculator: public SearchDirectionCalculator void operator=( const PDSearchDirCalculator& ); - //@} + ///@} /** @name Strategy objects */ - //@{ + ///@{ SmartPtr pd_solver_; - //@} + ///@} /** @name Algorithmic parameters */ - //@{ + ///@{ /** Flag indicating that we trust that the steps from the linear * solver are very good and that we don't need any residual * checks. */ @@ -95,7 +95,7 @@ class IPOPTLIB_EXPORT PDSearchDirCalculator: public SearchDirectionCalculator * to be set (or are automatically set) to certain values. */ bool mehrotra_algorithm_; - //@} + ///@} }; diff --git a/src/Algorithm/IpPDSystemSolver.hpp b/src/Algorithm/IpPDSystemSolver.hpp index 8d9e161c7..f519137f7 100644 --- a/src/Algorithm/IpPDSystemSolver.hpp +++ b/src/Algorithm/IpPDSystemSolver.hpp @@ -75,7 +75,7 @@ class IPOPTLIB_EXPORT PDSystemSolver: public AlgorithmStrategyObject { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Default Constructor */ PDSystemSolver() { } @@ -83,7 +83,7 @@ class IPOPTLIB_EXPORT PDSystemSolver: public AlgorithmStrategyObject /** Destructor */ virtual ~PDSystemSolver() { } - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -124,12 +124,12 @@ class IPOPTLIB_EXPORT PDSystemSolver: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Assignment Operator */ PDSystemSolver& operator=( const PDSystemSolver& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpPenaltyLSAcceptor.cpp b/src/Algorithm/IpPenaltyLSAcceptor.cpp index 83e6ed4bd..814dd41a0 100644 --- a/src/Algorithm/IpPenaltyLSAcceptor.cpp +++ b/src/Algorithm/IpPenaltyLSAcceptor.cpp @@ -40,16 +40,22 @@ void PenaltyLSAcceptor::RegisterOptions( "nu_init", "Initial value of the penalty parameter.", 0., true, - 1e-6); + 1e-6, + "", + true); roptions->AddLowerBoundedNumberOption( "nu_inc", "Increment of the penalty parameter.", 0., true, - 1e-4); + 1e-4, + "", + true); roptions->AddBoundedNumberOption( "rho", "Value in penalty parameter update formula.", 0., true, 1., true, - 1e-1); + 1e-1, + "", + true); } @@ -299,7 +305,7 @@ bool PenaltyLSAcceptor::TrySecondOrderCorrection( theta_soc_old = theta_trial; Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Trying second order correction number %d\n", count_soc + 1); + "Trying second order correction number %" IPOPT_INDEX_FORMAT "\n", count_soc + 1); // Compute SOC constraint violation c_soc->AddOneVector(1.0, *IpCq().trial_c(), alpha_primal_soc); @@ -375,7 +381,7 @@ bool PenaltyLSAcceptor::TrySecondOrderCorrection( if( accept ) { Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Second order correction step accepted with %d corrections.\n", count_soc + 1); + "Second order correction step accepted with %" IPOPT_INDEX_FORMAT " corrections.\n", count_soc + 1); // Accept all SOC quantities alpha_primal = alpha_primal_soc; actual_delta = delta_soc; @@ -406,7 +412,7 @@ char PenaltyLSAcceptor::UpdateForNextIteration( reference_JacC_delta_ = NULL; reference_JacD_delta_ = NULL; - char info_alpha_primal_char = ' '; + char info_alpha_primal_char; // Augment the filter if required if( last_nu_ != nu_ ) { diff --git a/src/Algorithm/IpPenaltyLSAcceptor.hpp b/src/Algorithm/IpPenaltyLSAcceptor.hpp index 17da22e8b..6d69ad630 100644 --- a/src/Algorithm/IpPenaltyLSAcceptor.hpp +++ b/src/Algorithm/IpPenaltyLSAcceptor.hpp @@ -23,7 +23,7 @@ class PenaltyLSAcceptor: public BacktrackingLSAcceptor { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * The PDSystemSolver object only needs to be provided @@ -36,7 +36,7 @@ class PenaltyLSAcceptor: public BacktrackingLSAcceptor /** Destructor */ virtual ~PenaltyLSAcceptor(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -134,21 +134,21 @@ class PenaltyLSAcceptor: public BacktrackingLSAcceptor * acceptability criteria and used externally (by the restoration phase * convergence check object, for instance). */ - //@{ + ///@{ /** Checks if a trial point is acceptable to the current iterate */ bool IsAcceptableToCurrentIterate( Number trial_barr, Number trial_theta, bool called_from_restoration = false ) const; - //@} + ///@} /** Methods for OptionsList */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -160,7 +160,7 @@ class PenaltyLSAcceptor: public BacktrackingLSAcceptor * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ PenaltyLSAcceptor( const PenaltyLSAcceptor& @@ -170,7 +170,7 @@ class PenaltyLSAcceptor: public BacktrackingLSAcceptor void operator=( const PenaltyLSAcceptor& ); - //@} + ///@} /** Compute predicted reduction for given step size */ Number CalcPred( @@ -179,7 +179,7 @@ class PenaltyLSAcceptor: public BacktrackingLSAcceptor /** @name Parameters for the penalty function line search * algorithm. Names as in the filter paper */ - //@{ + ///@{ /** Initial value of penalty parameter */ Number nu_init_; /** Incrememt for penalty parameter */ @@ -196,10 +196,10 @@ class PenaltyLSAcceptor: public BacktrackingLSAcceptor Number kappa_soc_; /** Second method correction method */ Index soc_method_; - //@} + ///@} /** @name Information related to watchdog procedure */ - //@{ + ///@{ /** Constraint violation at the point with respect to which * progress is to be made */ Number reference_theta_; @@ -224,24 +224,24 @@ class PenaltyLSAcceptor: public BacktrackingLSAcceptor Number watchdog_barr_; /** Predicted reduction to be compared with in watch dog. */ Number watchdog_pred_; - //@} + ///@} /** @name Penalty parameter */ - //@{ + ///@{ /** Current value of the penalty parameter */ Number nu_; /** Value of penalty parameter at beginning of the iteration. */ Number last_nu_; - //@} + ///@} /** When called from the restoration phase, this is the required * predicted reduction */ Number resto_pred_; /** @name Strategy objective that are used */ - //@{ + ///@{ SmartPtr pd_solver_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpProbingMuOracle.cpp b/src/Algorithm/IpProbingMuOracle.cpp index d3c73ead3..f96f3c179 100644 --- a/src/Algorithm/IpProbingMuOracle.cpp +++ b/src/Algorithm/IpProbingMuOracle.cpp @@ -114,7 +114,7 @@ bool ProbingMuOracle::CalculateMu( DBG_ASSERT(mu_curr > 0.); // Apply Mehrotra's rule - Number sigma = pow((mu_aff / mu_curr), 3); + Number sigma = std::pow((mu_aff / mu_curr), 3); // Make sure, sigma is not too large sigma = Min(sigma, sigma_max_); diff --git a/src/Algorithm/IpProbingMuOracle.hpp b/src/Algorithm/IpProbingMuOracle.hpp index c4cdb9ef5..f04d2dc63 100644 --- a/src/Algorithm/IpProbingMuOracle.hpp +++ b/src/Algorithm/IpProbingMuOracle.hpp @@ -20,7 +20,7 @@ class ProbingMuOracle: public MuOracle { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ ProbingMuOracle( const SmartPtr& pd_solver @@ -28,7 +28,7 @@ class ProbingMuOracle: public MuOracle /** Destructor */ virtual ~ProbingMuOracle(); - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -60,7 +60,7 @@ class ProbingMuOracle: public MuOracle * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ ProbingMuOracle(); @@ -73,7 +73,7 @@ class ProbingMuOracle: public MuOracle void operator=( const ProbingMuOracle& ); - //@} + ///@} /** Pointer to the object that should be used to solve the * primal-dual system. @@ -90,10 +90,10 @@ class ProbingMuOracle: public MuOracle ); /** @name Algorithmic parameters */ - //@{ + ///@{ /** safeguarding upper bound on centering parameter sigma */ Number sigma_max_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpQualityFunctionMuOracle.cpp b/src/Algorithm/IpQualityFunctionMuOracle.cpp index 612a1e9ab..b718be2b9 100644 --- a/src/Algorithm/IpQualityFunctionMuOracle.cpp +++ b/src/Algorithm/IpQualityFunctionMuOracle.cpp @@ -57,14 +57,16 @@ void QualityFunctionMuOracle::RegisterOptions( 0., true, 1e2, "This is the upper bound for the centering parameter chosen by the quality function based barrier parameter update. " - "(Only used if option \"mu_oracle\" is set to \"quality-function\".)"); + "Only used if option \"mu_oracle\" is set to \"quality-function\".", + true); roptions->AddLowerBoundedNumberOption( "sigma_min", "Minimum value of the centering parameter.", 0., false, 1e-6, "This is the lower bound for the centering parameter chosen by the quality function based barrier parameter update. " - "(Only used if option \"mu_oracle\" is set to \"quality-function\".)"); + "Only used if option \"mu_oracle\" is set to \"quality-function\".", + true); roptions->AddStringOption4( "quality_function_norm_type", "Norm used for components of the quality function.", @@ -73,7 +75,8 @@ void QualityFunctionMuOracle::RegisterOptions( "2-norm-squared", "use the 2-norm squared (sum of squares)", "max-norm", "use the infinity norm (max)", "2-norm", "use 2-norm", - "(Only used if option \"mu_oracle\" is set to \"quality-function\".)"); + "Only used if option \"mu_oracle\" is set to \"quality-function\".", + true); roptions->AddStringOption4( "quality_function_centrality", "The penalty term for centrality that is included in quality function.", @@ -84,7 +87,8 @@ void QualityFunctionMuOracle::RegisterOptions( "cubed-reciprocal", "complementarity * the reciprocal of the centrality measure cubed", "This determines whether a term is added to the quality function to penalize deviation from centrality with respect to complementarity. " "The complementarity measure here is the xi in the Loqo update rule. " - "(Only used if option \"mu_oracle\" is set to \"quality-function\".)"); + "Only used if option \"mu_oracle\" is set to \"quality-function\".", + true); roptions->AddStringOption2( "quality_function_balancing_term", "The balancing term included in the quality function for centrality.", @@ -93,14 +97,15 @@ void QualityFunctionMuOracle::RegisterOptions( "cubic", "Max(0,Max(dual_inf,primal_inf)-compl)^3", "This determines whether a term is added to the quality function that penalizes situations " "where the complementarity is much smaller than dual and primal infeasibilities. " - "(Only used if option \"mu_oracle\" is set to \"quality-function\".)"); + "Only used if option \"mu_oracle\" is set to \"quality-function\".", + true); roptions->AddLowerBoundedIntegerOption( "quality_function_max_section_steps", "Maximum number of search steps during direct search procedure determining the optimal centering parameter.", 0, 8, "The golden section search is performed for the quality function based mu oracle. " - "(Only used if option \"mu_oracle\" is set to \"quality-function\".)"); + "Only used if option \"mu_oracle\" is set to \"quality-function\"."); roptions->AddBoundedNumberOption( "quality_function_section_sigma_tol", "Tolerance for the section search procedure determining the optimal centering parameter (in sigma space).", @@ -108,7 +113,8 @@ void QualityFunctionMuOracle::RegisterOptions( 1., true, 1e-2, "The golden section search is performed for the quality function based mu oracle. " - "(Only used if option \"mu_oracle\" is set to \"quality-function\".)"); + "Only used if option \"mu_oracle\" is set to \"quality-function\".", + true); roptions->AddBoundedNumberOption( "quality_function_section_qf_tol", "Tolerance for the golden section search procedure determining the optimal centering parameter (in the function value space).", @@ -116,7 +122,8 @@ void QualityFunctionMuOracle::RegisterOptions( 1., true, 0., "The golden section search is performed for the quality function based mu oracle. " - "(Only used if option \"mu_oracle\" is set to \"quality-function\".)"); + "Only used if option \"mu_oracle\" is set to \"quality-function\".", + true); } bool QualityFunctionMuOracle::InitializeImpl( @@ -329,7 +336,7 @@ bool QualityFunctionMuOracle::CalculateMu( *step_cen_x_L, *step_cen_x_U, *step_cen_s_L, *step_cen_s_U, *step_cen->y_c(), *step_cen->y_d(), *step_cen->z_L(), *step_cen->z_U(), *step_cen->v_L(), *step_cen->v_U()); - Number sigma_1minus = 1. - Max(1e-4, quality_function_section_sigma_tol_); + Number sigma_1minus = 1. - Max(Number(1e-4), quality_function_section_sigma_tol_); Number qf_1minus = CalculateQualityFunction(sigma_1minus, *step_aff_x_L, *step_aff_x_U, *step_aff_s_L, *step_aff_s_U, *step_aff->y_c(), *step_aff->y_d(), *step_aff->z_L(), *step_aff->z_U(), *step_aff->v_L(), *step_aff->v_U(), *step_cen_x_L, *step_cen_x_U, *step_cen_s_L, *step_cen_s_U, *step_cen->y_c(), *step_cen->y_d(), *step_cen->z_L(), @@ -377,10 +384,9 @@ bool QualityFunctionMuOracle::CalculateMu( } } - //#define tracequalityfunction -#ifdef tracequalityfunction +#ifdef TRACEQUALITYFUNCTION char fname[100]; - Snprintf(fname, 100, "qf_values_%d.dat", IpData().iter_count()); + Snprintf(fname, 100, "qf_values_%" IPOPT_INDEX_FORMAT ".dat", IpData().iter_count()); FILE* fid = fopen(fname, "w"); Number sigma_1 = sigma_max_; @@ -462,19 +468,17 @@ bool QualityFunctionMuOracle::CalculateMu( curr_slack_s_L_ = NULL; curr_slack_s_U_ = NULL; - // DELETEME + /* char ssigma[40]; Snprintf(ssigma, 39, " sigma=%8.2e", sigma); IpData().Append_info_string(ssigma); - Snprintf(ssigma, 39, " qf=%d", count_qf_evals_); + Snprintf(ssigma, 39, " qf=%" IPOPT_INDEX_FORMAT "", count_qf_evals_); IpData().Append_info_string(ssigma); - /* - Snprintf(ssigma, 39, " xi=%8.2e ", IpCq().curr_centrality_measure()); - IpData().Append_info_string(ssigma); - if (sigma>1.) { - IpData().Append_info_string("LARGESIGMA"); - } - */ + Snprintf(ssigma, 39, " xi=%8.2e ", IpCq().curr_centrality_measure()); + IpData().Append_info_string(ssigma); + if( sigma > 1. ) + IpData().Append_info_string("LARGESIGMA"); + */ new_mu = mu; return true; @@ -578,11 +582,10 @@ Number QualityFunctionMuOracle::CalculateQualityFunction( compl_inf /= n_comp_; break; case NM_NORM_2_SQUARED: - dual_inf = pow(1. - alpha_dual, 2) * (pow(curr_grad_lag_x_nrm2_, 2) + pow(curr_grad_lag_s_nrm2_, 2)); - primal_inf = pow(1. - alpha_primal, 2) * (pow(curr_c_nrm2_, 2) + pow(curr_d_minus_s_nrm2_, 2)); - compl_inf = pow(tmp_slack_x_L_->Nrm2(), 2) + pow(tmp_slack_x_U_->Nrm2(), 2) + pow(tmp_slack_s_L_->Nrm2(), 2) - + pow(tmp_slack_s_U_->Nrm2(), 2); - + dual_inf = std::pow(1. - alpha_dual, 2) * (std::pow(curr_grad_lag_x_nrm2_, 2) + std::pow(curr_grad_lag_s_nrm2_, 2)); + primal_inf = std::pow(1. - alpha_primal, 2) * (std::pow(curr_c_nrm2_, 2) + std::pow(curr_d_minus_s_nrm2_, 2)); + compl_inf = std::pow(tmp_slack_x_L_->Nrm2(), 2) + std::pow(tmp_slack_x_U_->Nrm2(), 2) + std::pow(tmp_slack_s_L_->Nrm2(), 2) + + std::pow(tmp_slack_s_U_->Nrm2(), 2); dual_inf /= n_dual_; if( n_pri_ > 0 ) { @@ -598,19 +601,18 @@ Number QualityFunctionMuOracle::CalculateQualityFunction( tmp_slack_s_U_->Amax()); break; case NM_NORM_2: - dual_inf = (1. - alpha_dual) * sqrt(pow(curr_grad_lag_x_nrm2_, 2) + pow(curr_grad_lag_s_nrm2_, 2)); - primal_inf = (1. - alpha_primal) * sqrt(pow(curr_c_nrm2_, 2) + pow(curr_d_minus_s_nrm2_, 2)); - compl_inf = sqrt( - pow(tmp_slack_x_L_->Nrm2(), 2) + pow(tmp_slack_x_U_->Nrm2(), 2) + pow(tmp_slack_s_L_->Nrm2(), 2) - + pow(tmp_slack_s_U_->Nrm2(), 2)); - - dual_inf /= sqrt((Number) n_dual_); + dual_inf = (1. - alpha_dual) * std::sqrt(std::pow(curr_grad_lag_x_nrm2_, 2) + std::pow(curr_grad_lag_s_nrm2_, 2)); + primal_inf = (1. - alpha_primal) * std::sqrt(std::pow(curr_c_nrm2_, 2) + std::pow(curr_d_minus_s_nrm2_, 2)); + compl_inf = std::sqrt( + std::pow(tmp_slack_x_L_->Nrm2(), 2) + std::pow(tmp_slack_x_U_->Nrm2(), 2) + std::pow(tmp_slack_s_L_->Nrm2(), 2) + + std::pow(tmp_slack_s_U_->Nrm2(), 2)); + dual_inf /= std::sqrt((Number) n_dual_); if( n_pri_ > 0 ) { - primal_inf /= sqrt((Number) n_pri_); + primal_inf /= std::sqrt((Number) n_pri_); } DBG_ASSERT(n_comp_ > 0); - compl_inf /= sqrt((Number) n_comp_); + compl_inf /= std::sqrt((Number) n_comp_); break; default: DBG_ASSERT(false && "Unknown value for quality_function_norm_"); @@ -631,13 +633,13 @@ Number QualityFunctionMuOracle::CalculateQualityFunction( //Nothing break; case CEN_LOG: - quality_function -= compl_inf * log(xi); + quality_function -= compl_inf * std::log(xi); break; case CEN_RECIPROCAL: quality_function += compl_inf / xi; break; case CEN_CUBED_RECIPROCAL: - quality_function += compl_inf / pow(xi, 3); + quality_function += compl_inf / std::pow(xi, 3); break; default: DBG_ASSERT(false && "Unknown value for quality_function_centrality_"); @@ -649,7 +651,7 @@ Number QualityFunctionMuOracle::CalculateQualityFunction( //Nothing break; case BT_CUBIC: - quality_function += pow(Max(0., Max(dual_inf, primal_inf) - compl_inf), 3); + quality_function += std::pow(Max(Number(0.), Max(dual_inf, primal_inf) - compl_inf), 3); break; default: DBG_ASSERT(false && "Unknown value for quality_function_balancing term_"); @@ -696,7 +698,7 @@ Number QualityFunctionMuOracle::PerformGoldenSection( Number sigma_lo = ScaleSigma(sigma_lo_in); Number sigma; - Number gfac = (3. - sqrt(5.)) / 2.; + Number gfac = (3. - std::sqrt(5.)) / 2.; Number sigma_mid1 = sigma_lo + gfac * (sigma_up - sigma_lo); Number sigma_mid2 = sigma_lo + (1. - gfac) * (sigma_up - sigma_lo); @@ -798,7 +800,7 @@ Number QualityFunctionMuOracle::PerformGoldenSection( if( qtmp < q ) { sigma = sigma_up; - q = qtmp; + // never used: q = qtmp; } } else if( sigma_lo == ScaleSigma(sigma_lo_in) ) @@ -818,7 +820,7 @@ Number QualityFunctionMuOracle::PerformGoldenSection( if( qtmp < q ) { sigma = sigma_lo; - q = qtmp; + // never used: q = qtmp; } } } @@ -827,8 +829,8 @@ Number QualityFunctionMuOracle::PerformGoldenSection( } /* - Number QualityFunctionMuOracle::ScaleSigma(Number sigma) {return log(sigma);} - Number QualityFunctionMuOracle::UnscaleSigma(Number scaled_sigma) {return exp(scaled_sigma);} + Number QualityFunctionMuOracle::ScaleSigma(Number sigma) {return std::log(sigma);} + Number QualityFunctionMuOracle::UnscaleSigma(Number scaled_sigma) {return std::exp(scaled_sigma);} */ Number QualityFunctionMuOracle::ScaleSigma( @@ -876,16 +878,16 @@ Number QualityFunctionMuOracle::UnscaleSigma( ) { Number log_sigma; - Number log_sigma_up = log(sigma_up); - Number log_sigma_lo = log(sigma_lo); + Number log_sigma_up = std::log(sigma_up); + Number log_sigma_lo = std::log(sigma_lo); Number log_sigma_up_in = log_sigma_up; Number log_sigma_lo_in = log_sigma_lo; - Number gfac = (3.-sqrt(5.))/2.; + Number gfac = (3.-std::sqrt(5.))/2.; Number log_sigma_mid1 = log_sigma_lo + gfac*(log_sigma_up-log_sigma_lo); Number log_sigma_mid2 = log_sigma_lo + (1.-gfac)*(log_sigma_up-log_sigma_lo); - Number qmid1 = CalculateQualityFunction(exp(log_sigma_mid1), + Number qmid1 = CalculateQualityFunction(std::exp(log_sigma_mid1), step_aff_x_L, step_aff_x_U, step_aff_s_L, @@ -906,7 +908,7 @@ Number QualityFunctionMuOracle::UnscaleSigma( step_cen_z_U, step_cen_v_L, step_cen_v_U); - Number qmid2 = CalculateQualityFunction(exp(log_sigma_mid2), + Number qmid2 = CalculateQualityFunction(std::exp(log_sigma_mid2), step_aff_x_L, step_aff_x_U, step_aff_s_L, @@ -936,7 +938,7 @@ Number QualityFunctionMuOracle::UnscaleSigma( log_sigma_mid1 = log_sigma_mid2; qmid1 = qmid2; log_sigma_mid2 = log_sigma_lo + (1.-gfac)*(log_sigma_up-log_sigma_lo); - qmid2 = CalculateQualityFunction(exp(log_sigma_mid2), + qmid2 = CalculateQualityFunction(std::exp(log_sigma_mid2), step_aff_x_L, step_aff_x_U, step_aff_s_L, @@ -963,7 +965,7 @@ Number QualityFunctionMuOracle::UnscaleSigma( log_sigma_mid2 = log_sigma_mid1; qmid2 = qmid1; log_sigma_mid1 = log_sigma_lo + gfac*(log_sigma_up-log_sigma_lo); - qmid1 = CalculateQualityFunction(exp(log_sigma_mid1), + qmid1 = CalculateQualityFunction(std::exp(log_sigma_mid1), step_aff_x_L, step_aff_x_U, step_aff_s_L, @@ -997,7 +999,7 @@ Number QualityFunctionMuOracle::UnscaleSigma( q = qmid2; } if (log_sigma_up == log_sigma_up_in) { - Number qtmp = CalculateQualityFunction(exp(log_sigma_up), + Number qtmp = CalculateQualityFunction(std::exp(log_sigma_up), step_aff_x_L, step_aff_x_U, step_aff_s_L, @@ -1024,7 +1026,7 @@ Number QualityFunctionMuOracle::UnscaleSigma( } } else if (log_sigma_lo == log_sigma_lo_in) { - Number qtmp = CalculateQualityFunction(exp(log_sigma_lo), + Number qtmp = CalculateQualityFunction(std::exp(log_sigma_lo), step_aff_x_L, step_aff_x_U, step_aff_s_L, @@ -1051,7 +1053,7 @@ Number QualityFunctionMuOracle::UnscaleSigma( } } - return exp(log_sigma); + return std::exp(log_sigma); } */ diff --git a/src/Algorithm/IpQualityFunctionMuOracle.hpp b/src/Algorithm/IpQualityFunctionMuOracle.hpp index 51e096b3a..2ea1416f0 100644 --- a/src/Algorithm/IpQualityFunctionMuOracle.hpp +++ b/src/Algorithm/IpQualityFunctionMuOracle.hpp @@ -21,7 +21,7 @@ class QualityFunctionMuOracle: public MuOracle { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ QualityFunctionMuOracle( const SmartPtr& pd_solver @@ -30,7 +30,7 @@ class QualityFunctionMuOracle: public MuOracle /** Destructor */ virtual ~QualityFunctionMuOracle(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -53,7 +53,7 @@ class QualityFunctionMuOracle: public MuOracle /** @name Public enums. * Some of those are also used for the quality function. */ - //@{ + ///@{ /** enum for norm type */ enum NormEnum { @@ -78,7 +78,7 @@ class QualityFunctionMuOracle: public MuOracle BT_NONE = 0, BT_CUBIC }; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -90,7 +90,7 @@ class QualityFunctionMuOracle: public MuOracle * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ QualityFunctionMuOracle(); @@ -103,7 +103,7 @@ class QualityFunctionMuOracle: public MuOracle void operator=( const QualityFunctionMuOracle& ); - //@} + ///@} /** Pointer to the object that should be used to solve the * primal-dual system. @@ -113,7 +113,6 @@ class QualityFunctionMuOracle: public MuOracle /** Auxiliary function for computing the average complementarity * at a point, given step sizes and step. */ - // ToDo Replace pointers by references Number CalculateQualityFunction( Number sigma, const Vector& step_aff_x_L, @@ -171,7 +170,7 @@ class QualityFunctionMuOracle: public MuOracle /** Auxiliary functions for scaling the sigma axis in the golden * section procedure */ - //@{ + ///@{ Number ScaleSigma( Number sigma ); @@ -179,7 +178,7 @@ class QualityFunctionMuOracle: public MuOracle Number UnscaleSigma( Number scaled_sigma ); - //@} + ///@} /** Auxiliary function performing the golden section in the * logarithmic scale @@ -211,7 +210,7 @@ class QualityFunctionMuOracle: public MuOracle */ /** @name Algorithmic parameters */ - //@{ + ///@{ /** Upper bound on centering parameter sigma */ Number sigma_max_; @@ -245,13 +244,13 @@ class QualityFunctionMuOracle: public MuOracle * search for sigma. */ Index quality_function_max_section_steps_; - //@} + ///@} /** @name Temporary work space vectors. * * We use those to avoid repeated reallocation in CalculateQualityFunction. */ - //@{ + ///@{ SmartPtr tmp_step_x_L_; SmartPtr tmp_step_x_U_; SmartPtr tmp_step_s_L_; @@ -269,7 +268,7 @@ class QualityFunctionMuOracle: public MuOracle SmartPtr tmp_z_U_; SmartPtr tmp_v_L_; SmartPtr tmp_v_U_; - //@} + ///@} /* Counter for the qualify function evaluations */ Index count_qf_evals_; @@ -280,7 +279,7 @@ class QualityFunctionMuOracle: public MuOracle * I (AW) don't know if that really makes a difference, but * some of those things showed up in gprof. */ - //@{ + ///@{ bool initialized_; Index n_dual_; Index n_pri_; @@ -310,7 +309,7 @@ class QualityFunctionMuOracle: public MuOracle Number curr_grad_lag_s_amax_; Number curr_c_amax_; Number curr_d_minus_s_amax_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpRestoConvCheck.cpp b/src/Algorithm/IpRestoConvCheck.cpp index fdd855d27..6f6342154 100644 --- a/src/Algorithm/IpRestoConvCheck.cpp +++ b/src/Algorithm/IpRestoConvCheck.cpp @@ -46,7 +46,8 @@ void RestoConvergenceCheck::RegisterOptions( "max_resto_iter", "Maximum number of successive iterations in restoration phase.", 0, 3000000, "The algorithm terminates with an error message if the number of iterations successively taken " - "in the restoration phase exceeds this number."); + "in the restoration phase exceeds this number.", + true); } bool RestoConvergenceCheck::InitializeImpl( @@ -135,7 +136,7 @@ ConvergenceCheck::ConvergenceStatus RestoConvergenceCheck::CheckConvergence( if( successive_resto_iter_ > maximum_resto_iters_ ) { Jnlst().Printf(J_WARNING, J_MAIN, - "More than %d successive iterations taken in restoration phase.\n", maximum_resto_iters_); + "More than %" IPOPT_INDEX_FORMAT " successive iterations taken in restoration phase.\n", maximum_resto_iters_); return ConvergenceCheck::MAXITER_EXCEEDED; } successive_resto_iter_++; @@ -172,6 +173,10 @@ ConvergenceCheck::ConvergenceStatus RestoConvergenceCheck::CheckConvergence( } else if( orig_ip_cq->IsSquareProblem() && orig_trial_inf_pr <= Min(orig_ip_data->tol(), orig_constr_viol_tol_) ) { + // if tol < orig_trial_inf_pr <= orig_constr_viol_tol_, then the next else-if will set status = CONTINUE + // so below we may try to continue with tightened IpData().tol() + // if that isn't possible, we return with CONVERGED_TO_ACCEPTABLE_POINT + // in MinC_1NrmRestorationPhase we then check again and return with FEASIBLE_POINT_FOUND Jnlst().Printf(J_DETAILED, J_MAIN, "Restoration phase found points satisfying feasibility tolerance in square problem.\n"); status = CONVERGED; @@ -202,31 +207,33 @@ ConvergenceCheck::ConvergenceStatus RestoConvergenceCheck::CheckConvergence( status = OptimalityErrorConvergenceCheck::CheckConvergence(false); if( status == CONVERGED || status == CONVERGED_TO_ACCEPTABLE_POINT ) { - Number orig_trial_primal_inf = orig_ip_cq->trial_primal_infeasibility(NORM_MAX); // ToDo make the factor in following line an option - if( orig_trial_primal_inf <= 1e2 * IpData().tol() ) + if( orig_trial_inf_pr <= 1e2 * IpData().tol() && IpData().tol() > 1e-1 * orig_ip_data->tol() ) { - // if (orig_trial_primal_inf <= 1e2*orig_ip_data->tol()) { - if( IpData().tol() > 1e-1 * orig_ip_data->tol() ) - { - // For once, we tighten the convergence tolerance for the - // restoration phase problem in case the problem is only - // very slightly infeasible. - IpData().Set_tol(1e-2 * IpData().tol()); - status = CONTINUE; - Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Tightening restoration phase tolerance to %e.\n", IpData().tol()); - IpData().Append_info_string("!"); - } - else - { - Jnlst().Printf(J_WARNING, J_LINE_SEARCH, - "Restoration phase converged to a feasible point that is\n" - "unacceptable to the filter for the original problem.\n"); - THROW_EXCEPTION(RESTORATION_CONVERGED_TO_FEASIBLE_POINT, - "Restoration phase converged to a feasible point that is " - "unacceptable to the filter for the original problem."); - } + // For once, we tighten the convergence tolerance for the + // restoration phase problem in case the problem is only + // very slightly infeasible. + IpData().Set_tol(1e-2 * IpData().tol()); + status = CONTINUE; + Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, + "Tightening restoration phase tolerance to %e.\n", IpData().tol()); + IpData().Append_info_string("!"); + } + else if( orig_ip_cq->IsSquareProblem() && orig_trial_inf_pr <= orig_constr_viol_tol_ ) + { + // we are feasible w.r.t. constr_viol_tol, but not w.r.t. tol + // since the original problem is a square problem, we want to return the feasible-point-found status + // so we return here CONVERGED_TO_ACCEPTABLE_POINT and let MinC_1NrmRestorationPhase check again + status = CONVERGED_TO_ACCEPTABLE_POINT; + } + else if( orig_trial_inf_pr <= 1e2 * IpData().tol() ) + { + Jnlst().Printf(J_WARNING, J_LINE_SEARCH, + "Restoration phase converged to a feasible point that is\n" + "unacceptable to the filter for the original problem.\n"); + THROW_EXCEPTION(RESTORATION_CONVERGED_TO_FEASIBLE_POINT, + "Restoration phase converged to a feasible point that is " + "unacceptable to the filter for the original problem."); } else { diff --git a/src/Algorithm/IpRestoConvCheck.hpp b/src/Algorithm/IpRestoConvCheck.hpp index 120611ade..f25ffb96f 100644 --- a/src/Algorithm/IpRestoConvCheck.hpp +++ b/src/Algorithm/IpRestoConvCheck.hpp @@ -28,13 +28,13 @@ class RestoConvergenceCheck: public OptimalityErrorConvergenceCheck { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ RestoConvergenceCheck(); /** Destructor */ virtual ~RestoConvergenceCheck(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -62,7 +62,7 @@ class RestoConvergenceCheck: public OptimalityErrorConvergenceCheck * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ RestoConvergenceCheck( const RestoConvergenceCheck& @@ -72,7 +72,7 @@ class RestoConvergenceCheck: public OptimalityErrorConvergenceCheck void operator=( const RestoConvergenceCheck& ); - //@} + ///@} /** Method for checking progress with original globalization mechanism. */ virtual ConvergenceStatus TestOrigProgress( @@ -81,7 +81,7 @@ class RestoConvergenceCheck: public OptimalityErrorConvergenceCheck ) = 0; /** @name Algorithmic parameters */ - //@{ + ///@{ /** Fraction of required reduction in infeasibility before problem * is considered to be solved. */ Number kappa_resto_; @@ -94,7 +94,7 @@ class RestoConvergenceCheck: public OptimalityErrorConvergenceCheck /** Constraint violation tolerance for original algorithm */ Number orig_constr_viol_tol_; - //@} + ///@} /** Flag indicating that this is the first call. * diff --git a/src/Algorithm/IpRestoFilterConvCheck.hpp b/src/Algorithm/IpRestoFilterConvCheck.hpp index 59d8d90ee..9f1f67f2a 100644 --- a/src/Algorithm/IpRestoFilterConvCheck.hpp +++ b/src/Algorithm/IpRestoFilterConvCheck.hpp @@ -23,13 +23,13 @@ class RestoFilterConvergenceCheck: public RestoConvergenceCheck { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ RestoFilterConvergenceCheck(); /** Destructor */ virtual ~RestoFilterConvergenceCheck(); - //@} + ///@} /** Set the object for the original filter line search. * @@ -59,7 +59,7 @@ class RestoFilterConvergenceCheck: public RestoConvergenceCheck * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ RestoFilterConvergenceCheck( const RestoFilterConvergenceCheck& @@ -69,7 +69,7 @@ class RestoFilterConvergenceCheck: public RestoConvergenceCheck void operator=( const RestoFilterConvergenceCheck& ); - //@} + ///@} /** Method for checking progress with original filter * globalization mechanism. diff --git a/src/Algorithm/IpRestoIpoptNLP.cpp b/src/Algorithm/IpRestoIpoptNLP.cpp index f83c6af1e..20e584a99 100644 --- a/src/Algorithm/IpRestoIpoptNLP.cpp +++ b/src/Algorithm/IpRestoIpoptNLP.cpp @@ -41,13 +41,11 @@ void RestoIpoptNLP::RegisterOptions( SmartPtr roptions ) { - roptions->AddStringOption2( + roptions->AddBoolOption( "evaluate_orig_obj_at_resto_trial", "Determines if the original objective function should be evaluated at restoration phase trial points.", - "yes", - "no", "skip evaluation", - "yes", "evaluate at every trial point", - "Setting this option to \"yes\" makes the restoration phase algorithm evaluate the objective function " + true, + "Enabling this option makes the restoration phase algorithm evaluate the objective function " "of the original problem at every trial point encountered during the restoration phase, " "even if this value is not required. " "In this way, it is guaranteed that the original objective function can be evaluated without error " @@ -60,14 +58,16 @@ void RestoIpoptNLP::RegisterOptions( "Penalty parameter in the restoration phase objective function.", 0., true, 1e3, - "This is the parameter rho in equation (31a) in the Ipopt implementation paper."); + "This is the parameter rho in equation (31a) in the Ipopt implementation paper.", + true); roptions->AddLowerBoundedNumberOption( "resto_proximity_weight", "Weighting factor for the proximity term in restoration phase objective.", 0., false, 1., "This determines how the parameter zeta in equation (29a) in the implementation paper is computed. " - "zeta here is resto_proximity_weight*sqrt(mu), where mu is the current barrier parameter."); + "zeta here is resto_proximity_weight*sqrt(mu), where mu is the current barrier parameter.", + true); } bool RestoIpoptNLP::Initialize( @@ -203,7 +203,7 @@ bool RestoIpoptNLP::InitializeStructures( // matrix px_u total_rows = orig_x_space->Dim() + 2 * orig_c_space->Dim() + 2 * orig_d_space->Dim(); total_cols = orig_x_u_space->Dim(); - DBG_PRINT((1, "total_rows = %d, total_cols = %d\n", total_rows, total_cols)); + DBG_PRINT((1, "total_rows = %" IPOPT_INDEX_FORMAT ", total_cols = %" IPOPT_INDEX_FORMAT "\n", total_rows, total_cols)); px_u_space_ = new CompoundMatrixSpace(5, 1, total_rows, total_cols); px_u_space_->SetBlockRows(0, orig_x_space->Dim()); px_u_space_->SetBlockRows(1, orig_c_space->Dim()); @@ -274,7 +274,7 @@ bool RestoIpoptNLP::InitializeStructures( jac_d_space_->SetBlockCols(4, orig_d_space->Dim()); jac_d_space_->SetCompSpace(0, 0, *orig_jac_d_space); - DBG_PRINT((1, "orig_jac_d_space = %x\n", GetRawPtr(orig_jac_d_space))) + DBG_PRINT((1, "orig_jac_d_space = %p\n", GetRawPtr(orig_jac_d_space))) // Blocks (0,1) and (0,2) are zero'ed out // **NOTE: By placing "flat" identity matrices here, we are creating // potential issues for linalg operations that arise when the original @@ -294,7 +294,7 @@ bool RestoIpoptNLP::InitializeStructures( h_space_->SetBlockDim(3, orig_d_space->Dim()); h_space_->SetBlockDim(4, orig_d_space->Dim()); - SmartPtr DR_x_space = new DiagMatrixSpace(orig_x_space->Dim()); + SmartPtr DR2_x_space = new DiagMatrixSpace(orig_x_space->Dim()); if( hessian_approximation_ == LIMITED_MEMORY ) { const LowRankUpdateSymMatrixSpace* LR_h_space = static_cast(GetRawPtr( @@ -308,7 +308,7 @@ bool RestoIpoptNLP::InitializeStructures( { SmartPtr sumsym_mat_space = new SumSymMatrixSpace(orig_x_space->Dim(), 2); sumsym_mat_space->SetTermSpace(0, *orig_h_space); - sumsym_mat_space->SetTermSpace(1, *DR_x_space); + sumsym_mat_space->SetTermSpace(1, *DR2_x_space); h_space_->SetCompSpace(0, 0, *sumsym_mat_space, true); // All remaining blocks are zero'ed out } @@ -424,20 +424,29 @@ bool RestoIpoptNLP::InitializeStructures( // Initialize other data needed by the restoration nlp. x_ref is // the point to reference to which we based the regularization // term - x_ref_ = orig_x_space->MakeNew(); - x_ref_->Copy(*orig_ip_data_->curr()->x()); + SmartPtr x_ref = orig_x_space->MakeNew(); + x_ref->Copy(*orig_ip_data_->curr()->x()); + x_ref_ = x_ref; - dr_x_ = orig_x_space->MakeNew(); - dr_x_->Set(1.0); - SmartPtr tmp = dr_x_->MakeNew(); + SmartPtr dr_x = orig_x_space->MakeNew(); + dr_x->Set(1.0); + SmartPtr tmp = dr_x->MakeNew(); tmp->Copy(*x_ref_); - dr_x_->ElementWiseMax(*tmp); + dr_x->ElementWiseMax(*tmp); tmp->Scal(-1.); - dr_x_->ElementWiseMax(*tmp); - dr_x_->ElementWiseReciprocal(); + dr_x->ElementWiseMax(*tmp); + dr_x->ElementWiseReciprocal(); + dr_x_ = dr_x; DBG_PRINT_VECTOR(2, "dr_x_", *dr_x_); - DR_x_ = DR_x_space->MakeNewDiagMatrix(); - DR_x_->SetDiag(*dr_x_); + + // dr_x^2 + SmartPtr dr2_x = dr_x->MakeNewCopy(); + dr2_x->ElementWiseMultiply(*dr_x_); + dr2_x_ = dr2_x; + + SmartPtr DR2_x = DR2_x_space->MakeNewDiagMatrix(); + DR2_x->SetDiag(*dr2_x_); + DR2_x_ = DR2_x; return true; } @@ -507,7 +516,7 @@ SmartPtr RestoIpoptNLP::grad_f( SmartPtr x_only = c_vec->GetCompNonConst(0); x_only->Copy(*x_only_in); x_only->Axpy(-1.0, *x_ref_); - x_only->ElementWiseMultiply(*dr_x_); + x_only->ElementWiseMultiply(*dr2_x_); x_only->Scal(Eta(mu)); return ConstPtr(retPtr); @@ -620,7 +629,7 @@ SmartPtr RestoIpoptNLP::jac_d( // The zero parts remain NULL, the identities are created from the matrix // space (since auto_allocate was set to true in SetCompSpace) SmartPtr retPtr = jac_d_space_->MakeNewCompoundMatrix(); - DBG_PRINT((1, "jac_d_space_ = %x\n", GetRawPtr(jac_d_space_))) + DBG_PRINT((1, "jac_d_space_ = %p\n", GetRawPtr(jac_d_space_))) // Set the block for the original Jacobian retPtr->SetComp(0, 0, *jac_d_only); @@ -689,7 +698,7 @@ SmartPtr RestoIpoptNLP::h( SmartPtr h_sum_mat = retPtr->GetCompNonConst(0, 0); SmartPtr h_sum = static_cast(GetRawPtr(h_sum_mat)); h_sum->SetTerm(0, 1.0, *h_con_orig); - h_sum->SetTerm(1, obj_factor * Eta(mu), *DR_x_); + h_sum->SetTerm(1, obj_factor * Eta(mu), *DR2_x_); return GetRawPtr(retPtr); } @@ -708,7 +717,7 @@ SmartPtr RestoIpoptNLP::uninitialized_h() SmartPtr h_sum_mat = retPtr->GetCompNonConst(0, 0); SmartPtr h_sum = static_cast(GetRawPtr(h_sum_mat)); h_sum->SetTerm(0, 1.0, *h_con_orig); - h_sum->SetTerm(1, 1.0, *DR_x_); + h_sum->SetTerm(1, 1.0, *DR2_x_); } return GetRawPtr(retPtr); @@ -751,7 +760,7 @@ Number RestoIpoptNLP::Eta( Number mu ) const { - return eta_factor_ * pow(mu, eta_mu_exponent_); + return eta_factor_ * std::pow(mu, eta_mu_exponent_); } void RestoIpoptNLP::AdjustVariableBounds( diff --git a/src/Algorithm/IpRestoIpoptNLP.hpp b/src/Algorithm/IpRestoIpoptNLP.hpp index d0e8e1cd9..e26a29bb2 100644 --- a/src/Algorithm/IpRestoIpoptNLP.hpp +++ b/src/Algorithm/IpRestoIpoptNLP.hpp @@ -21,18 +21,34 @@ namespace Ipopt { -/** This class maps the traditional NLP into - * something that is more useful by Ipopt. +/** This class maps a IpoptNLP into one that is used for the restoration phase of %Ipopt. * - * This class takes care of storing the - * calculated model results, handles caching, - * and (some day) takes care of addition of slacks. + * Given a IpoptNLP + * \f{eqnarray*} + * \mathrm{min} && f(x), \\ + * \mathrm{s.t.} && c(x) = 0, &\qquad y_c\\ + * && d_L \leq d(x) \leq d_U, &\qquad y_d \\ + * && x_L \leq x \leq x_U, &\qquad z_L, z_U + * \f} + * parameters \f$\rho\f$, \f$\eta\f$, and a reference point \f$x_r\f$, + * a RestoIpoptNLP is the %NLP + * \f{eqnarray*} + * \mathrm{min} && \rho (p_c^Te + n_c^Te + p_d^Te + n_d^Te) + \frac{\eta}{2} \Vert D_r (x-x_r) \Vert_2^2, \\ + * \mathrm{s.t.} && c(x) - p_c + n_c = 0, &\qquad y_c\\ + * && d_L \leq d(x) - p_d + n_d \leq d_U, &\qquad y_d \\ + * && x_L \leq x \leq x_U, &\qquad z_L, z_U \\ + * && p_c, n_c, p_d, n_d \geq 0. &\qquad ... + * \f} + * where \f$D_r = \mathrm{diag}(\frac{1}{\max\{1,|x_{r,i}|\}},\ldots,\frac{1}{\max\{1,|x_{r,n}|\}})\f$. + * + * Parameter \f$\rho\f$ is determined by option `resto_penalty_parameter` (default = 1000). + * Parameter \f$\eta = \eta_f \sqrt{\mu}\f$, where \f$\eta_f\f$ is determined by option `resto_proximity_weight` (default = 1). */ class RestoIpoptNLP: public IpoptNLP { public: /**@name Constructors/Destructors */ - //@{ + ///@{ RestoIpoptNLP( IpoptNLP& orig_ip_nlp, IpoptData& orig_ip_data, @@ -41,7 +57,7 @@ class RestoIpoptNLP: public IpoptNLP /** Destructor */ ~RestoIpoptNLP(); - //@} + ///@} virtual bool Initialize( const Journalist& jnlst, @@ -88,7 +104,7 @@ class RestoIpoptNLP: public IpoptNLP { } /** Accessor methods for model data */ - //@{ + ///@{ /** Method for telling IpoptCalculatedQuantities that the * restoration phase objective function depends on the barrier * parameter @@ -222,7 +238,7 @@ class RestoIpoptNLP: public IpoptNLP { return GetRawPtr(x_space_); } - //@} + ///@} /** Accessor method for vector/matrix spaces pointers */ virtual void GetSpaces( @@ -272,7 +288,7 @@ class RestoIpoptNLP: public IpoptNLP /** @name Accessor method for the information of the original NLP. * * These methods are not overloaded from IpoptNLP. */ - //@{ + ///@{ IpoptNLP& OrigIpNLP() const { return *orig_ip_nlp_; @@ -287,7 +303,7 @@ class RestoIpoptNLP: public IpoptNLP { return *orig_ip_cq_; } - //@} + ///@} /** Accessor Method for obtaining the Rho penalization factor for * the ell_1 norm. @@ -298,7 +314,7 @@ class RestoIpoptNLP: public IpoptNLP } /** @name Counters for the number of function evaluations. */ - //@{ + ///@{ virtual Index f_evals() const { return f_evals_; @@ -327,7 +343,7 @@ class RestoIpoptNLP: public IpoptNLP { return h_evals_; } - //@} + ///@} /** Method to calculate eta, the factor for the regularization term */ Number Eta( @@ -348,7 +364,7 @@ class RestoIpoptNLP: public IpoptNLP private: /** @name Pointers for the original NLP information. */ - //@{ + ///@{ /** Pointer to the original IpoptNLP */ SmartPtr orig_ip_nlp_; @@ -357,10 +373,10 @@ class RestoIpoptNLP: public IpoptNLP /** Pointer to the original IpoptCalculatedQuantities */ SmartPtr orig_ip_cq_; - //@} + ///@} /** Necessary Vector/Matrix spaces */ - //@{ + ///@{ SmartPtr x_space_; SmartPtr c_space_; @@ -388,10 +404,10 @@ class RestoIpoptNLP: public IpoptNLP SmartPtr jac_d_space_; SmartPtr h_space_; - //@} + ///@} /**@name Storage for Model Quantities */ - //@{ + ///@{ /** Lower bounds on x */ SmartPtr x_L_; @@ -415,13 +431,11 @@ class RestoIpoptNLP: public IpoptNLP /** Permutation matrix (d_U_ -> d */ SmartPtr Pd_U_; - //@} + ///@} /** @name Values particular to the restoration phase problem statement */ - //@{ - /** Penalty parameter for the \$l_1\$ norm - * @todo make this parameter? - */ + ///@{ + /** Penalty parameter for the \$l_1\$ norm, given by resto_penalty_parameter */ Number rho_; /** scaling factor for eta calculation */ @@ -430,15 +444,16 @@ class RestoIpoptNLP: public IpoptNLP /** exponent for mu in eta calculation */ Number eta_mu_exponent_; - // TODO in the following we should use pointers to CONST values - // TODO We can get rid of one of the dr DR - /** Scaling factors for the \$x\$ part of the regularization term */ - SmartPtr dr_x_; - SmartPtr DR_x_; + /// Scaling factors for the \$x\$ part of the regularization term + SmartPtr dr_x_; + /// Squared scaling factors for the \$x\$ part of the regularization term, for grad_f + SmartPtr dr2_x_; + /// Matrix with squared scaling factors, for h() + SmartPtr DR2_x_; /** \$x\$ part of the reference point in the regularization term */ - SmartPtr x_ref_; - //@} + SmartPtr x_ref_; + ///@} /**@name Default Compiler Generated Methods * (Hidden to avoid implicit creation/calling). @@ -448,7 +463,7 @@ class RestoIpoptNLP: public IpoptNLP * 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 */ RestoIpoptNLP(); @@ -461,10 +476,10 @@ class RestoIpoptNLP: public IpoptNLP void operator=( const RestoIpoptNLP& ); - //@} + ///@} /** @name Algorithmic parameter */ - //@{ + ///@{ /** Flag indicating if evaluation of the objective should be * performed for every restoration phase objective function * evaluation. @@ -473,13 +488,13 @@ class RestoIpoptNLP: public IpoptNLP /** Flag indicating how Hessian information is obtained */ HessianApproximationType hessian_approximation_; - //@} + ///@} /** Flag indicating if initialization method has been called */ bool initialized_; /** @name Counters for the function evaluations */ - //@{ + ///@{ Index f_evals_; Index grad_f_evals_; Index c_evals_; @@ -487,7 +502,7 @@ class RestoIpoptNLP: public IpoptNLP Index d_evals_; Index jac_d_evals_; Index h_evals_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpRestoIterateInitializer.cpp b/src/Algorithm/IpRestoIterateInitializer.cpp index e577e66f2..6acf94506 100644 --- a/src/Algorithm/IpRestoIterateInitializer.cpp +++ b/src/Algorithm/IpRestoIterateInitializer.cpp @@ -50,7 +50,6 @@ bool RestoIterateInitializer::SetInitialIterates() // Get a grip on the restoration phase NLP and obtain the pointers // to the original NLP data SmartPtr resto_ip_nlp = static_cast(&IpNLP()); - SmartPtr orig_ip_nlp = static_cast(&resto_ip_nlp->OrigIpNLP()); SmartPtr orig_ip_data = static_cast(&resto_ip_nlp->OrigIpData()); SmartPtr orig_ip_cq = static_cast(&resto_ip_nlp->OrigIpCq()); diff --git a/src/Algorithm/IpRestoIterateInitializer.hpp b/src/Algorithm/IpRestoIterateInitializer.hpp index 87e5cccb1..4255e43d5 100644 --- a/src/Algorithm/IpRestoIterateInitializer.hpp +++ b/src/Algorithm/IpRestoIterateInitializer.hpp @@ -22,7 +22,7 @@ class RestoIterateInitializer: public IterateInitializer { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * If eq_mult_calculator is not NULL, it will be @@ -36,7 +36,7 @@ class RestoIterateInitializer: public IterateInitializer /** Destructor */ virtual ~RestoIterateInitializer() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -62,7 +62,7 @@ class RestoIterateInitializer: public IterateInitializer * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ RestoIterateInitializer(); @@ -75,16 +75,16 @@ class RestoIterateInitializer: public IterateInitializer void operator=( const RestoIterateInitializer& ); - //@} + ///@} /**@name Parameters for bumping x0 */ - //@{ + ///@{ /** If max-norm of the initial equality constraint multiplier * estimate is larger than this, the initial y_* variables are * set to zero. */ Number constr_mult_init_max_; - //@} + ///@} /** object to be used for the initialization of the equality * constraint multipliers. @@ -92,14 +92,14 @@ class RestoIterateInitializer: public IterateInitializer SmartPtr resto_eq_mult_calculator_; /** @name Auxiliary functions */ - //@{ + ///@{ /** Method for solving the quadratic vector equation v^2 + 2a*v - b = 0 */ void solve_quadratic( const Vector& a, const Vector& b, Vector& v ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpRestoIterationOutput.cpp b/src/Algorithm/IpRestoIterationOutput.cpp index 11b04e69e..d9d662f58 100644 --- a/src/Algorithm/IpRestoIterationOutput.cpp +++ b/src/Algorithm/IpRestoIterationOutput.cpp @@ -72,19 +72,19 @@ void RestoIterationOutput::WriteOutput() Jnlst().Printf(J_DETAILED, J_MAIN, "\n\n**************************************************\n"); Jnlst().Printf(J_DETAILED, J_MAIN, - "*** Summary of Iteration %d for original NLP:", IpData().iter_count()); + "*** Summary of Iteration %" IPOPT_INDEX_FORMAT " for original NLP:", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n\n"); if( IpData().info_iters_since_header() >= 10 && !IsValid(resto_orig_iteration_output_) ) { // output the header - Jnlst().Printf(J_ITERSUMMARY, J_MAIN, + Jnlst().Printf(J_ITERSUMMARY, J_MAIN, "%s", header.c_str()); IpData().Set_info_iters_since_header(0); } else { - Jnlst().Printf(J_DETAILED, J_MAIN, + Jnlst().Printf(J_DETAILED, J_MAIN, "%s", header.c_str()); } @@ -128,8 +128,6 @@ void RestoIterationOutput::WriteOutput() Number f = orig_ip_cq->unscaled_trial_f(); // Retrieve some information set in the different parts of the algorithm - char info_iter = 'r'; - Number alpha_primal = IpData().info_alpha_primal(); char alpha_primal_char = IpData().info_alpha_primal_char(); Number alpha_dual = IpData().info_alpha_dual(); @@ -143,7 +141,7 @@ void RestoIterationOutput::WriteOutput() } else { - Snprintf(regu_x_buf, 7, "%5.1f", log10(regu_x)); + Snprintf(regu_x_buf, 7, "%5.1f", std::log10(regu_x)); regu_x_ptr = regu_x_buf; } Index ls_count = IpData().info_ls_count(); @@ -155,7 +153,7 @@ void RestoIterationOutput::WriteOutput() WallclockTime()) - print_frequency_time_ || last_output < 0.0) ) { Jnlst().Printf(J_ITERSUMMARY, J_MAIN, - "%4d%c%14.7e %7.2e %7.2e %5.1f %7.2e %5s %7.2e %7.2e%c%3d", iter, info_iter, f, inf_pr, inf_du, log10(mu), dnrm, regu_x_ptr, alpha_dual, alpha_primal, alpha_primal_char, ls_count); + "%4" IPOPT_INDEX_FORMAT "r%14.7e %7.2e %7.2e %5.1f %7.2e %5s %7.2e %7.2e%c%3" IPOPT_INDEX_FORMAT, iter, f, inf_pr, inf_du, std::log10(mu), dnrm, regu_x_ptr, alpha_dual, alpha_primal, alpha_primal_char, ls_count); if( print_info_string_ ) { Jnlst().Printf(J_ITERSUMMARY, J_MAIN, @@ -182,7 +180,7 @@ void RestoIterationOutput::WriteOutput() Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n"); Jnlst().Printf(J_DETAILED, J_MAIN, - "*** Beginning Iteration %d from the following point:", IpData().iter_count()); + "*** Beginning Iteration %" IPOPT_INDEX_FORMAT " from the following point:", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n**************************************************\n\n"); @@ -266,7 +264,7 @@ void RestoIterationOutput::WriteOutput() if( Jnlst().ProduceOutput(J_DETAILED, J_MAIN) ) { Jnlst().Printf(J_DETAILED, J_MAIN, - "\n\n***Current NLP Values for Iteration (Restoration phase problem) %d:\n", IpData().iter_count()); + "\n\n***Current NLP Values for Iteration (Restoration phase problem) %" IPOPT_INDEX_FORMAT ":\n", IpData().iter_count()); Jnlst().Printf(J_DETAILED, J_MAIN, "\n (scaled) (unscaled)\n"); Jnlst().Printf(J_DETAILED, J_MAIN, diff --git a/src/Algorithm/IpRestoIterationOutput.hpp b/src/Algorithm/IpRestoIterationOutput.hpp index de8e90d11..7e21b2e18 100644 --- a/src/Algorithm/IpRestoIterationOutput.hpp +++ b/src/Algorithm/IpRestoIterationOutput.hpp @@ -22,7 +22,7 @@ class RestoIterationOutput: public IterationOutput { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * If resto_orig_iteration_output is not NULL, the @@ -36,7 +36,7 @@ class RestoIterationOutput: public IterationOutput /** Destructor */ virtual ~RestoIterationOutput(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -59,7 +59,7 @@ class RestoIterationOutput: public IterationOutput * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ RestoIterationOutput(); @@ -72,7 +72,7 @@ class RestoIterationOutput: public IterationOutput void operator=( const RestoIterationOutput& ); - //@} + ///@} /** Pointer to output strategy object during regular iterations. */ SmartPtr resto_orig_iteration_output_; @@ -86,7 +86,7 @@ class RestoIterationOutput: public IterationOutput InfPrOutput inf_pr_output_; /** Option indicating at which iteration frequency the summary line should be printed */ - int print_frequency_iter_; + Index print_frequency_iter_; /** Option indicating at which time frequency the summary line should be printed */ Number print_frequency_time_; diff --git a/src/Algorithm/IpRestoMinC_1Nrm.cpp b/src/Algorithm/IpRestoMinC_1Nrm.cpp index 830c9a1dd..87c96da38 100644 --- a/src/Algorithm/IpRestoMinC_1Nrm.cpp +++ b/src/Algorithm/IpRestoMinC_1Nrm.cpp @@ -56,7 +56,8 @@ void MinC_1NrmRestorationPhase::RegisterOptions( 0., "If the restoration phase is terminated because of the \"acceptable\" termination criteria and " "the primal infeasibility is smaller than this value, the restoration phase is declared to have failed. " - "The default value is actually 1e2*tol, where tol is the general termination tolerance."); + "The default value is actually 1e2*tol, where tol is the general termination tolerance.", + true); } bool MinC_1NrmRestorationPhase::InitializeImpl( @@ -75,7 +76,10 @@ bool MinC_1NrmRestorationPhase::InitializeImpl( // This is registered in OptimalityErrorConvergenceCheck options.GetNumericValue("constr_viol_tol", constr_viol_tol_, prefix); - // Avoid that the restoration phase is trigged by user option in + options.GetNumericValue("max_wall_time", max_wall_time_, prefix); + options.GetNumericValue("max_cpu_time", max_cpu_time_, prefix); + + // Avoid that the restoration phase is triggered by user option in // first iteration of the restoration phase resto_options_->SetStringValue("resto.start_with_resto", "no"); @@ -110,16 +114,40 @@ bool MinC_1NrmRestorationPhase::PerformRestoration() // Increase counter for restoration phase calls count_restorations_++; Jnlst().Printf(J_DETAILED, J_MAIN, - "Starting Restoration Phase for the %d. time\n", count_restorations_); + "Starting Restoration Phase for the %" IPOPT_INDEX_FORMAT ". time\n", count_restorations_); DBG_ASSERT(IpCq().curr_constraint_violation() > 0.); // ToDo set those up during initialize? // Create the restoration phase NLP etc objects - SmartPtr resto_ip_data = new IpoptData(NULL, IpData().cpu_time_start()); + SmartPtr resto_ip_data = new IpoptData(NULL); SmartPtr resto_ip_nlp = new RestoIpoptNLP(IpNLP(), IpData(), IpCq()); SmartPtr resto_ip_cq = new IpoptCalculatedQuantities(resto_ip_nlp, resto_ip_data); + if( max_wall_time_ < 1e20 ) + { + // setup timelimit for resto: original timelimit - elapsed time + Number elapsed = WallclockTime() - IpData().TimingStats().OverallAlgorithm().StartWallclockTime(); + DBG_ASSERT(elapsed >= 0); + if( elapsed >= max_wall_time_ ) + { + THROW_EXCEPTION(RESTORATION_WALLTIME_EXCEEDED, "Maximal wallclock time exceeded at start of restoration phase."); + } + resto_options_->SetNumericValue("resto.max_wall_time", max_wall_time_ - elapsed); + } + + if( max_cpu_time_ < 1e20 ) + { + // setup timelimit for resto: original timelimit - elapsed time + Number elapsed = CpuTime() - IpData().TimingStats().OverallAlgorithm().StartCpuTime(); + DBG_ASSERT(elapsed >= 0); + if( elapsed >= max_cpu_time_ ) + { + THROW_EXCEPTION(RESTORATION_CPUTIME_EXCEEDED, "Maximal CPU time exceeded at start of restoration phase."); + } + resto_options_->SetNumericValue("resto.max_cpu_time", max_cpu_time_ - elapsed); + } + // Determine if this is a square problem bool square_problem = IpCq().IsSquareProblem(); @@ -129,7 +157,7 @@ bool MinC_1NrmRestorationPhase::PerformRestoration() if( square_problem ) { actual_resto_options = new OptionsList(*resto_options_); - // If this is a square problem, the want the restoration phase + // If this is a square problem, then we want the restoration phase // never to be left until the problem is converged actual_resto_options->SetNumericValueIfUnset("required_infeasibility_reduction", 0.); } @@ -229,7 +257,7 @@ bool MinC_1NrmRestorationPhase::PerformRestoration() Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, "Optimal Objective Value = %.16E\n", resto_ip_cq->curr_f()); Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Number of Iterations = %d\n", resto_ip_data->iter_count()); + "Number of Iterations = %" IPOPT_INDEX_FORMAT "\n", resto_ip_data->iter_count()); } if( Jnlst().ProduceOutput(J_VECTOR, J_LINE_SEARCH) ) { @@ -238,10 +266,18 @@ bool MinC_1NrmRestorationPhase::PerformRestoration() retval = 0; } + else if( square_problem && resto_status == STOP_AT_ACCEPTABLE_POINT && IpCq().unscaled_curr_nlp_constraint_violation(NORM_MAX) < constr_viol_tol_ ) + { + // square problem with point that is feasible w.r.t. constr_viol_tol_, though probably not w.r.t. tol + // we can return feasibility-problem-solved here, but not optimal + Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, + "Recursive restoration phase algorithm terminated acceptably for square problem.\n"); + THROW_EXCEPTION(FEASIBILITY_PROBLEM_SOLVED, + "Restoration phase converged to sufficiently feasible point of original square problem."); + } else if( resto_status == STOP_AT_TINY_STEP || resto_status == STOP_AT_ACCEPTABLE_POINT ) { Number orig_primal_inf = IpCq().curr_primal_infeasibility(NORM_MAX); - // ToDo make the factor in following line an option if( orig_primal_inf <= resto_failure_feasibility_threshold_ ) { Jnlst().Printf(J_WARNING, J_LINE_SEARCH, @@ -262,6 +298,10 @@ bool MinC_1NrmRestorationPhase::PerformRestoration() { THROW_EXCEPTION(RESTORATION_CPUTIME_EXCEEDED, "Maximal CPU time exceeded in restoration phase."); } + else if( resto_status == WALLTIME_EXCEEDED ) + { + THROW_EXCEPTION(RESTORATION_WALLTIME_EXCEEDED, "Maximal wallclock time exceeded in restoration phase."); + } else if( resto_status == LOCAL_INFEASIBILITY ) { // converged to locally infeasible point - pass this on to the outer algorithm... @@ -273,15 +313,29 @@ bool MinC_1NrmRestorationPhase::PerformRestoration() "Restoration phase in the restoration phase failed.\n"); THROW_EXCEPTION(RESTORATION_FAILED, "Restoration phase in the restoration phase failed."); } + else if( resto_status == ERROR_IN_STEP_COMPUTATION ) + { + Jnlst().Printf(J_WARNING, J_LINE_SEARCH, + "Step computation in the restoration phase failed.\n"); + THROW_EXCEPTION(RESTORATION_FAILED, "Step computation in the restoration phase failed."); + } else if( resto_status == USER_REQUESTED_STOP ) { // Use requested stop during restoration phase - rethrow exception THROW_EXCEPTION(RESTORATION_USER_STOP, "User requested stop during restoration phase"); } + else if( resto_status == INVALID_NUMBER_DETECTED ) + { + // this could be that we got stuck at a point that can be evaluated, but not differentiated + Jnlst().Printf(J_STRONGWARNING, J_LINE_SEARCH, + "Restoration phase failed due to evaluation errors.\n"); + retval = 1; + } else { - Jnlst().Printf(J_ERROR, J_MAIN, - "Sorry, things failed ?!?!\n"); + // often this + Jnlst().Printf(J_STRONGWARNING, J_LINE_SEARCH, + "Restoration phase failed with unexpected solverreturn status %d\n", (int)resto_status); retval = 1; } @@ -310,14 +364,14 @@ bool MinC_1NrmRestorationPhase::PerformRestoration() if( constr_viol <= constr_viol_tol_ ) { Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Recursive restoration phase algorithm termined successfully for square problem.\n"); + "Recursive restoration phase algorithm terminated successfully for square problem.\n"); IpData().AcceptTrialPoint(); THROW_EXCEPTION(FEASIBILITY_PROBLEM_SOLVED, "Restoration phase converged to sufficiently feasible point of original square problem."); } } - // Update the bound multiplers, pretending that the entire + // Update the bound multipliers, pretending that the entire // progress in x and s in the restoration phase has been one // [rimal-dual Newton step (and therefore the result of solving // an augmented system) diff --git a/src/Algorithm/IpRestoMinC_1Nrm.hpp b/src/Algorithm/IpRestoMinC_1Nrm.hpp index fe14d3bef..e81ae1b54 100644 --- a/src/Algorithm/IpRestoMinC_1Nrm.hpp +++ b/src/Algorithm/IpRestoMinC_1Nrm.hpp @@ -21,7 +21,7 @@ class MinC_1NrmRestorationPhase: public RestorationPhase { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor, taking strategy objects. * * The resto_alg strategy object is the restoration phase Ipopt @@ -37,7 +37,7 @@ class MinC_1NrmRestorationPhase: public RestorationPhase /** Destructor */ virtual ~MinC_1NrmRestorationPhase(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -60,7 +60,7 @@ class MinC_1NrmRestorationPhase: public RestorationPhase * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ MinC_1NrmRestorationPhase(); @@ -73,13 +73,13 @@ class MinC_1NrmRestorationPhase: public RestorationPhase void operator=( const MinC_1NrmRestorationPhase& ); - //@} + ///@} /** @name Strategy objects */ - //@{ + ///@{ SmartPtr resto_alg_; SmartPtr eq_mult_calculator_; - //@} + ///@} /** Copy of original options, which is required to initialize the * Ipopt algorithm strategy object before restoration phase is @@ -88,7 +88,7 @@ class MinC_1NrmRestorationPhase: public RestorationPhase SmartPtr resto_options_; /** @name Algorithmic parameters */ - //@{ + ///@{ Number constr_mult_reset_threshold_; /** Maximal allowed value of a bound multiplier after restoration @@ -98,7 +98,7 @@ class MinC_1NrmRestorationPhase: public RestorationPhase /** Indicates whether problem can be expected to be infeasible. * - * This will request the to set kappa_resto to a small value for + * This will request to set kappa_resto to a small value for * the first time the restoration phase is called. (ToDo) */ bool expect_infeasible_problem_; @@ -106,12 +106,16 @@ class MinC_1NrmRestorationPhase: public RestorationPhase /** Constraint violation tolerance */ Number constr_viol_tol_; + /** Time limits */ + Number max_wall_time_; + Number max_cpu_time_; + /** Primal infeasibility tolerance for declaring failure of * restoration phase when the non-regular termination tests are * met. */ Number resto_failure_feasibility_threshold_; - //@} + ///@} /** Counter for the number of time that PerformRestoration is * called. @@ -119,7 +123,7 @@ class MinC_1NrmRestorationPhase: public RestorationPhase Index count_restorations_; /** @name Auxiliary methods */ - //@{ + ///@{ /** Method for computing "primal-dual" step in bound multipliers, * given step in slacks. */ @@ -129,7 +133,7 @@ class MinC_1NrmRestorationPhase: public RestorationPhase const Vector& curr_slack, const Vector& trial_slack ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpRestoPenaltyConvCheck.hpp b/src/Algorithm/IpRestoPenaltyConvCheck.hpp index e6b6df40e..ca97195ab 100644 --- a/src/Algorithm/IpRestoPenaltyConvCheck.hpp +++ b/src/Algorithm/IpRestoPenaltyConvCheck.hpp @@ -22,13 +22,13 @@ class RestoPenaltyConvergenceCheck: public RestoConvergenceCheck { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ RestoPenaltyConvergenceCheck(); /** Destructor */ virtual ~RestoPenaltyConvergenceCheck(); - //@} + ///@} /** Set the object for the original penalty line search. * @@ -59,7 +59,7 @@ class RestoPenaltyConvergenceCheck: public RestoConvergenceCheck * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ RestoPenaltyConvergenceCheck( const RestoPenaltyConvergenceCheck& @@ -69,7 +69,7 @@ class RestoPenaltyConvergenceCheck: public RestoConvergenceCheck void operator=( const RestoPenaltyConvergenceCheck& ); - //@} + ///@} /** Method for checking progress with original filter * globalization mechanism. diff --git a/src/Algorithm/IpRestoPhase.hpp b/src/Algorithm/IpRestoPhase.hpp index 7e5b14ae6..cc5f54109 100644 --- a/src/Algorithm/IpRestoPhase.hpp +++ b/src/Algorithm/IpRestoPhase.hpp @@ -16,7 +16,7 @@ namespace Ipopt { /** @name Exceptions */ -//@{ +///@{ /** Exception RESTORATION_FAILED for all trouble with the * restoration phase. */ @@ -24,8 +24,10 @@ DECLARE_STD_EXCEPTION(RESTORATION_CONVERGED_TO_FEASIBLE_POINT); DECLARE_STD_EXCEPTION(RESTORATION_FAILED); DECLARE_STD_EXCEPTION(RESTORATION_MAXITER_EXCEEDED); DECLARE_STD_EXCEPTION(RESTORATION_CPUTIME_EXCEEDED); +/// @since 3.14.0 +DECLARE_STD_EXCEPTION(RESTORATION_WALLTIME_EXCEEDED); DECLARE_STD_EXCEPTION(RESTORATION_USER_STOP); -//@} +///@} /** Base class for different restoration phases. * @@ -35,7 +37,7 @@ class RestorationPhase: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ RestorationPhase() { } @@ -43,7 +45,7 @@ class RestorationPhase: public AlgorithmStrategyObject /** Destructor */ virtual ~RestorationPhase() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -64,7 +66,7 @@ class RestorationPhase: public AlgorithmStrategyObject * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ RestorationPhase( const RestorationPhase& @@ -74,7 +76,7 @@ class RestorationPhase: public AlgorithmStrategyObject void operator=( const RestorationPhase& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpRestoRestoPhase.hpp b/src/Algorithm/IpRestoRestoPhase.hpp index d6e5f9282..92b23c73e 100644 --- a/src/Algorithm/IpRestoRestoPhase.hpp +++ b/src/Algorithm/IpRestoRestoPhase.hpp @@ -25,13 +25,13 @@ class RestoRestorationPhase: public RestorationPhase { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor. */ RestoRestorationPhase(); /** Destructor */ virtual ~RestoRestorationPhase(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -50,7 +50,7 @@ class RestoRestorationPhase: public RestorationPhase * declare them private and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ RestoRestorationPhase( const RestoRestorationPhase& @@ -60,17 +60,17 @@ class RestoRestorationPhase: public RestorationPhase void operator=( const RestoRestorationPhase& ); - //@} + ///@} /** @name Auxiliary methods */ - //@{ + ///@{ /** Method for solving the quadratic vector equation v^2 + 2a*v - b = 0 */ void solve_quadratic( const Vector& a, const Vector& b, Vector& v ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpSearchDirCalculator.hpp b/src/Algorithm/IpSearchDirCalculator.hpp index ef098b398..5d0f38eee 100644 --- a/src/Algorithm/IpSearchDirCalculator.hpp +++ b/src/Algorithm/IpSearchDirCalculator.hpp @@ -19,7 +19,7 @@ class IPOPTLIB_EXPORT SearchDirectionCalculator: public AlgorithmStrategyObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ SearchDirectionCalculator() { } @@ -27,7 +27,7 @@ class IPOPTLIB_EXPORT SearchDirectionCalculator: public AlgorithmStrategyObject /** Destructor */ virtual ~SearchDirectionCalculator() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -50,7 +50,7 @@ class IPOPTLIB_EXPORT SearchDirectionCalculator: public AlgorithmStrategyObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ // SearchDirectionCalculator(); @@ -63,7 +63,7 @@ class IPOPTLIB_EXPORT SearchDirectionCalculator: public AlgorithmStrategyObject void operator=( const SearchDirectionCalculator& ); - //@} + ///@} }; diff --git a/src/Algorithm/IpStdAugSystemSolver.cpp b/src/Algorithm/IpStdAugSystemSolver.cpp index a7e94efeb..f25cb1501 100644 --- a/src/Algorithm/IpStdAugSystemSolver.cpp +++ b/src/Algorithm/IpStdAugSystemSolver.cpp @@ -12,9 +12,7 @@ #include "IpSumSymMatrix.hpp" #include "IpDiagMatrix.hpp" #include "IpIdentityMatrix.hpp" -// ToDo: Remove below here - for debug only -#include "IpTripletHelper.hpp" -// ToDo: Remove above here +//#include "IpTripletHelper.hpp" #include @@ -82,17 +80,17 @@ bool StdAugSystemSolver::InitializeImpl( ESymSolverStatus StdAugSystemSolver::MultiSolve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, std::vector >& rhs_xV, std::vector >& rhs_sV, std::vector >& rhs_cV, @@ -125,7 +123,7 @@ ESymSolverStatus StdAugSystemSolver::MultiSolve( // Create the compound matrix of the augmented system if it has not // yet been created - It is assumed that the structure will not change // after this call - DBG_DO(bool debug_first_time_through = false;) + DBG_DO(bool debug_first_time_through = false); if( !IsValid(augmented_system_) ) { // pass in the information to form the structure of the augmented system @@ -135,7 +133,7 @@ ESymSolverStatus StdAugSystemSolver::MultiSolve( CreateAugmentedSpace(*W, *J_c, *J_d, *rhs_xV[0], *rhs_sV[0], *rhs_cV[0], *rhs_dV[0]); CreateAugmentedSystem(W, W_factor, D_x, delta_x, D_s, delta_s, *J_c, D_c, delta_c, *J_d, D_d, delta_d, *rhs_xV[0], *rhs_sV[0], *rhs_cV[0], *rhs_dV[0]); - DBG_DO(debug_first_time_through = true;) + DBG_DO(debug_first_time_through = true); } // Check if anything that was just passed in is different from @@ -166,16 +164,15 @@ ESymSolverStatus StdAugSystemSolver::MultiSolve( augrhs->SetComp(2, *rhs_cV[i]); augrhs->SetComp(3, *rhs_dV[i]); char buffer[16]; - Snprintf(buffer, 15, "RHS[%2d]", i); + Snprintf(buffer, 15, "RHS[%2" IPOPT_INDEX_FORMAT "]", i); augrhs->Print(Jnlst(), J_MOREVECTOR, J_LINEAR_ALGEBRA, buffer); augmented_rhsV[i] = GetRawPtr(augrhs); } augmented_system_->Print(Jnlst(), J_MATRIX, J_LINEAR_ALGEBRA, "KKT"); -#ifndef HAVE_MPI +#if 0 // debug code if( Jnlst().ProduceOutput(J_MOREMATRIX, J_LINEAR_ALGEBRA) ) { - // ToDo: remove below here - for debug only Index dbg_nz = TripletHelper::GetNumberEntries(*augmented_system_); Index* dbg_iRows = new Index[dbg_nz]; Index* dbg_jCols = new Index[dbg_nz]; @@ -187,7 +184,7 @@ ESymSolverStatus StdAugSystemSolver::MultiSolve( for( Index dbg_i = 0; dbg_i < dbg_nz; dbg_i++ ) { Jnlst().Printf(J_MOREMATRIX, J_LINEAR_ALGEBRA, - "(%d) KKT[%d][%d] = %23.15e\n", dbg_i, dbg_iRows[dbg_i], dbg_jCols[dbg_i], dbg_values[dbg_i]); + "(%" IPOPT_INDEX_FORMAT ") KKT[%" IPOPT_INDEX_FORMAT "][%" IPOPT_INDEX_FORMAT "] = %23.15e\n", dbg_i, dbg_iRows[dbg_i], dbg_jCols[dbg_i], dbg_values[dbg_i]); } delete[] dbg_iRows; dbg_iRows = NULL; @@ -195,7 +192,6 @@ ESymSolverStatus StdAugSystemSolver::MultiSolve( dbg_jCols = NULL; delete[] dbg_values; dbg_values = NULL; - // ToDo: remove above here } #endif @@ -219,7 +215,7 @@ ESymSolverStatus StdAugSystemSolver::MultiSolve( for( Index i = 0; i < nrhs; i++ ) { char buffer[16]; - Snprintf(buffer, 15, "SOL[%2d]", i); + Snprintf(buffer, 15, "SOL[%2" IPOPT_INDEX_FORMAT "]", i); augmented_solV[i]->Print(Jnlst(), J_MOREVECTOR, J_LINEAR_ALGEBRA, buffer); } } @@ -312,17 +308,17 @@ void StdAugSystemSolver::CreateAugmentedSpace( void StdAugSystemSolver::CreateAugmentedSystem( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& proto_x, const Vector& proto_s, const Vector& proto_c, @@ -473,17 +469,17 @@ void StdAugSystemSolver::CreateAugmentedSystem( bool StdAugSystemSolver::AugmentedSystemRequiresChange( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ) { DBG_START_METH("StdAugSystemSolver::AugmentedSystemRequiresChange", dbg_verbosity); diff --git a/src/Algorithm/IpStdAugSystemSolver.hpp b/src/Algorithm/IpStdAugSystemSolver.hpp index 669ebb10c..c3d9dab05 100644 --- a/src/Algorithm/IpStdAugSystemSolver.hpp +++ b/src/Algorithm/IpStdAugSystemSolver.hpp @@ -26,7 +26,7 @@ class StdAugSystemSolver: public AugSystemSolver { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor using only a linear solver object */ StdAugSystemSolver( SymLinearSolver& LinSolver @@ -34,7 +34,7 @@ class StdAugSystemSolver: public AugSystemSolver /** Destructor */ virtual ~StdAugSystemSolver(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -47,17 +47,17 @@ class StdAugSystemSolver: public AugSystemSolver */ virtual ESymSolverStatus MultiSolve( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix* J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix* J_d, const Vector* D_d, - double delta_d, + Number delta_d, std::vector >& rhs_xV, std::vector >& rhs_sV, std::vector >& rhs_cV, @@ -106,7 +106,7 @@ class StdAugSystemSolver: public AugSystemSolver * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor. */ StdAugSystemSolver(); @@ -119,7 +119,7 @@ class StdAugSystemSolver: public AugSystemSolver void operator=( const StdAugSystemSolver& ); - //@} + ///@} /** Create the matrix space for the Compound Sym Matrix that * represents the augmented system. @@ -145,17 +145,17 @@ class StdAugSystemSolver: public AugSystemSolver */ void CreateAugmentedSystem( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d, + Number delta_d, const Vector& proto_x, const Vector& proto_s, const Vector& proto_c, @@ -167,17 +167,17 @@ class StdAugSystemSolver: public AugSystemSolver */ bool AugmentedSystemRequiresChange( const SymMatrix* W, - double W_factor, + Number W_factor, const Vector* D_x, - double delta_x, + Number delta_x, const Vector* D_s, - double delta_s, + Number delta_s, const Matrix& J_c, const Vector* D_c, - double delta_c, + Number delta_c, const Matrix& J_d, const Vector* D_d, - double delta_d + Number delta_d ); /** The linear solver object that is to be used to solve the @@ -200,7 +200,7 @@ class StdAugSystemSolver: public AugSystemSolver matrix has to be updated compared to the most recent call of the Set method. */ - //@{ + ///@{ /** Tag for W matrix. * * If W has been given to Set as NULL, then this tag is set to 0. @@ -208,7 +208,7 @@ class StdAugSystemSolver: public AugSystemSolver TaggedObject::Tag w_tag_; /** Most recent value of W_factor */ - double w_factor_; + Number w_factor_; /** Tag for D_x vector, representing the diagonal matrix D_x. * @@ -217,7 +217,7 @@ class StdAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_x_tag_; /** Most recent value of delta_x from Set method */ - double delta_x_; + Number delta_x_; /** Tag for D_s vector, representing the diagonal matrix D_s. * @@ -226,7 +226,7 @@ class StdAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_s_tag_; /** Most recent value of delta_s from Set method */ - double delta_s_; + Number delta_s_; /** Tag for J_c matrix. * @@ -241,7 +241,7 @@ class StdAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_c_tag_; /** Most recent value of delta_c from set method */ - double delta_c_; + Number delta_c_; /** Tag for J_d matrix. * @@ -256,7 +256,7 @@ class StdAugSystemSolver: public AugSystemSolver TaggedObject::Tag d_d_tag_; /** Most recent value of delta_d from Set method */ - double delta_d_; + Number delta_d_; /** This is the tag of the matrix storing the augmented system. * @@ -266,7 +266,7 @@ class StdAugSystemSolver: public AugSystemSolver * well. */ TaggedObject::Tag augsys_tag_; - //@} + ///@} /** The resulting augmented matrix. * @@ -285,12 +285,12 @@ class StdAugSystemSolver: public AugSystemSolver SmartPtr old_w_; /** @name Algorithmic parameters */ - //@{ + ///@{ /** Flag indicating whether the TNLP with identical structure has * already been solved before. */ bool warm_start_same_structure_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpTimingStatistics.cpp b/src/Algorithm/IpTimingStatistics.cpp index 3aec134b8..e1cc98fe2 100644 --- a/src/Algorithm/IpTimingStatistics.cpp +++ b/src/Algorithm/IpTimingStatistics.cpp @@ -9,6 +9,113 @@ namespace Ipopt { +bool TimingStatistics::IsFunctionEvaluationTimeEnabled() const +{ + return f_eval_time_.IsEnabled() || grad_f_eval_time_.IsEnabled() || c_eval_time_.IsEnabled() + || d_eval_time_.IsEnabled() || jac_c_eval_time_.IsEnabled() || jac_d_eval_time_.IsEnabled() + || h_eval_time_.IsEnabled(); +} + +Number TimingStatistics::TotalFunctionEvaluationCpuTime() const +{ + return f_eval_time_.TotalCpuTime() + grad_f_eval_time_.TotalCpuTime() + c_eval_time_.TotalCpuTime() + + d_eval_time_.TotalCpuTime() + jac_c_eval_time_.TotalCpuTime() + jac_d_eval_time_.TotalCpuTime() + + h_eval_time_.TotalCpuTime(); +} + +Number TimingStatistics::TotalFunctionEvaluationSysTime() const +{ + return f_eval_time_.TotalSysTime() + grad_f_eval_time_.TotalSysTime() + c_eval_time_.TotalSysTime() + + d_eval_time_.TotalSysTime() + jac_c_eval_time_.TotalSysTime() + jac_d_eval_time_.TotalSysTime() + + h_eval_time_.TotalSysTime(); +} + +Number TimingStatistics::TotalFunctionEvaluationWallclockTime() const +{ + return f_eval_time_.TotalWallclockTime() + grad_f_eval_time_.TotalWallclockTime() + c_eval_time_.TotalWallclockTime() + + d_eval_time_.TotalWallclockTime() + jac_c_eval_time_.TotalWallclockTime() + + jac_d_eval_time_.TotalWallclockTime() + h_eval_time_.TotalWallclockTime(); +} + +/** Method for enabling all timed tasked. */ +void TimingStatistics::EnableTimes() +{ + OverallAlgorithm_.IsEnabled(); + PrintProblemStatistics_.Enable(); + InitializeIterates_.Enable(); + UpdateHessian_.Enable(); + OutputIteration_.Enable(); + UpdateBarrierParameter_.Enable(); + ComputeSearchDirection_.Enable(); + ComputeAcceptableTrialPoint_.Enable(); + AcceptTrialPoint_.Enable(); + CheckConvergence_.Enable(); + PDSystemSolverTotal_.Enable(); + PDSystemSolverSolveOnce_.Enable(); + ComputeResiduals_.Enable(); + StdAugSystemSolverMultiSolve_.Enable(); + LinearSystemScaling_.Enable(); + LinearSystemSymbolicFactorization_.Enable(); + LinearSystemFactorization_.Enable(); + LinearSystemBackSolve_.Enable(); + LinearSystemStructureConverter_.Enable(); + LinearSystemStructureConverterInit_.Enable(); + QualityFunctionSearch_.Enable(); + TryCorrector_.Enable(); + Task1_.Enable(); + Task2_.Enable(); + Task3_.Enable(); + Task4_.Enable(); + Task5_.Enable(); + Task6_.Enable(); + f_eval_time_.Enable(); + grad_f_eval_time_.Enable(); + c_eval_time_.Enable(); + d_eval_time_.Enable(); + jac_c_eval_time_.Enable(); + jac_d_eval_time_.Enable(); + h_eval_time_.Enable(); +} + +/** Method for disabling all timed tasks except for OverallAlgorithm */ +void TimingStatistics::DisableTimes() +{ + PrintProblemStatistics_.Disable(); + InitializeIterates_.Disable(); + UpdateHessian_.Disable(); + OutputIteration_.Disable(); + UpdateBarrierParameter_.Disable(); + ComputeSearchDirection_.Disable(); + ComputeAcceptableTrialPoint_.Disable(); + AcceptTrialPoint_.Disable(); + CheckConvergence_.Disable(); + PDSystemSolverTotal_.Disable(); + PDSystemSolverSolveOnce_.Disable(); + ComputeResiduals_.Disable(); + StdAugSystemSolverMultiSolve_.Disable(); + LinearSystemScaling_.Disable(); + LinearSystemSymbolicFactorization_.Disable(); + LinearSystemFactorization_.Disable(); + LinearSystemBackSolve_.Disable(); + LinearSystemStructureConverter_.Disable(); + LinearSystemStructureConverterInit_.Disable(); + QualityFunctionSearch_.Disable(); + TryCorrector_.Disable(); + Task1_.Disable(); + Task2_.Disable(); + Task3_.Disable(); + Task4_.Disable(); + Task5_.Disable(); + Task6_.Disable(); + f_eval_time_.Disable(); + grad_f_eval_time_.Disable(); + c_eval_time_.Disable(); + d_eval_time_.Disable(); + jac_c_eval_time_.Disable(); + jac_d_eval_time_.Disable(); + h_eval_time_.Disable(); +} + void TimingStatistics::ResetTimes() { OverallAlgorithm_.Reset(); @@ -39,12 +146,19 @@ void TimingStatistics::ResetTimes() Task4_.Reset(); Task5_.Reset(); Task6_.Reset(); + f_eval_time_.Reset(); + grad_f_eval_time_.Reset(); + c_eval_time_.Reset(); + d_eval_time_.Reset(); + jac_c_eval_time_.Reset(); + jac_d_eval_time_.Reset(); + h_eval_time_.Reset(); } void TimingStatistics::PrintAllTimingStatistics( - Journalist& jnlst, - EJournalLevel level, - EJournalCategory category + const Journalist& jnlst, + EJournalLevel level, + EJournalCategory category ) const { if( !jnlst.ProduceOutput(level, category) ) @@ -52,61 +166,125 @@ void TimingStatistics::PrintAllTimingStatistics( return; } - jnlst.Printf(level, category, - "OverallAlgorithm....................: %10.3f (sys: %10.3f wall: %10.3f)\n", OverallAlgorithm_.TotalCpuTime(), OverallAlgorithm_.TotalSysTime(), OverallAlgorithm_.TotalWallclockTime()); - jnlst.Printf(level, category, - " PrintProblemStatistics.............: %10.3f (sys: %10.3f wall: %10.3f)\n", PrintProblemStatistics_.TotalCpuTime(), PrintProblemStatistics_.TotalSysTime(), PrintProblemStatistics_.TotalWallclockTime()); - jnlst.Printf(level, category, - " InitializeIterates.................: %10.3f (sys: %10.3f wall: %10.3f)\n", InitializeIterates_.TotalCpuTime(), InitializeIterates_.TotalSysTime(), InitializeIterates_.TotalWallclockTime()); - jnlst.Printf(level, category, - " UpdateHessian......................: %10.3f (sys: %10.3f wall: %10.3f)\n", UpdateHessian_.TotalCpuTime(), UpdateHessian_.TotalSysTime(), UpdateHessian_.TotalWallclockTime()); - jnlst.Printf(level, category, - " OutputIteration....................: %10.3f (sys: %10.3f wall: %10.3f)\n", OutputIteration_.TotalCpuTime(), OutputIteration_.TotalSysTime(), OutputIteration_.TotalWallclockTime()); - jnlst.Printf(level, category, - " UpdateBarrierParameter.............: %10.3f (sys: %10.3f wall: %10.3f)\n", UpdateBarrierParameter_.TotalCpuTime(), UpdateBarrierParameter_.TotalSysTime(), UpdateBarrierParameter_.TotalWallclockTime()); - jnlst.Printf(level, category, - " ComputeSearchDirection.............: %10.3f (sys: %10.3f wall: %10.3f)\n", ComputeSearchDirection_.TotalCpuTime(), ComputeSearchDirection_.TotalSysTime(), ComputeSearchDirection_.TotalWallclockTime()); - jnlst.Printf(level, category, - " ComputeAcceptableTrialPoint........: %10.3f (sys: %10.3f wall: %10.3f)\n", ComputeAcceptableTrialPoint_.TotalCpuTime(), ComputeAcceptableTrialPoint_.TotalSysTime(), ComputeAcceptableTrialPoint_.TotalWallclockTime()); - jnlst.Printf(level, category, - " AcceptTrialPoint...................: %10.3f (sys: %10.3f wall: %10.3f)\n", AcceptTrialPoint_.TotalCpuTime(), AcceptTrialPoint_.TotalSysTime(), AcceptTrialPoint_.TotalWallclockTime()); - jnlst.Printf(level, category, - " CheckConvergence...................: %10.3f (sys: %10.3f wall: %10.3f)\n", CheckConvergence_.TotalCpuTime(), CheckConvergence_.TotalSysTime(), CheckConvergence_.TotalWallclockTime()); + if( OverallAlgorithm_.IsEnabled() ) + jnlst.Printf(level, category, + "OverallAlgorithm....................: %10.3f (sys: %10.3f wall: %10.3f)\n", OverallAlgorithm_.TotalCpuTime(), OverallAlgorithm_.TotalSysTime(), OverallAlgorithm_.TotalWallclockTime()); + else + { + jnlst.Printf(level, category, "OverallAlgorithm\n"); + } + if( PrintProblemStatistics_.IsEnabled() ) + jnlst.Printf(level, category, + " PrintProblemStatistics.............: %10.3f (sys: %10.3f wall: %10.3f)\n", PrintProblemStatistics_.TotalCpuTime(), PrintProblemStatistics_.TotalSysTime(), PrintProblemStatistics_.TotalWallclockTime()); + if( InitializeIterates_.IsEnabled() ) + jnlst.Printf(level, category, + " InitializeIterates.................: %10.3f (sys: %10.3f wall: %10.3f)\n", InitializeIterates_.TotalCpuTime(), InitializeIterates_.TotalSysTime(), InitializeIterates_.TotalWallclockTime()); + if( UpdateHessian_.IsEnabled() ) + jnlst.Printf(level, category, + " UpdateHessian......................: %10.3f (sys: %10.3f wall: %10.3f)\n", UpdateHessian_.TotalCpuTime(), UpdateHessian_.TotalSysTime(), UpdateHessian_.TotalWallclockTime()); + if( OutputIteration_.IsEnabled() ) + jnlst.Printf(level, category, + " OutputIteration....................: %10.3f (sys: %10.3f wall: %10.3f)\n", OutputIteration_.TotalCpuTime(), OutputIteration_.TotalSysTime(), OutputIteration_.TotalWallclockTime()); + if( UpdateBarrierParameter_.IsEnabled() ) + jnlst.Printf(level, category, + " UpdateBarrierParameter.............: %10.3f (sys: %10.3f wall: %10.3f)\n", UpdateBarrierParameter_.TotalCpuTime(), UpdateBarrierParameter_.TotalSysTime(), UpdateBarrierParameter_.TotalWallclockTime()); + if( ComputeSearchDirection_.IsEnabled() ) + jnlst.Printf(level, category, + " ComputeSearchDirection.............: %10.3f (sys: %10.3f wall: %10.3f)\n", ComputeSearchDirection_.TotalCpuTime(), ComputeSearchDirection_.TotalSysTime(), ComputeSearchDirection_.TotalWallclockTime()); + if( ComputeAcceptableTrialPoint_.IsEnabled() ) + jnlst.Printf(level, category, + " ComputeAcceptableTrialPoint........: %10.3f (sys: %10.3f wall: %10.3f)\n", ComputeAcceptableTrialPoint_.TotalCpuTime(), ComputeAcceptableTrialPoint_.TotalSysTime(), ComputeAcceptableTrialPoint_.TotalWallclockTime()); + if( AcceptTrialPoint_.IsEnabled() ) + jnlst.Printf(level, category, + " AcceptTrialPoint...................: %10.3f (sys: %10.3f wall: %10.3f)\n", AcceptTrialPoint_.TotalCpuTime(), AcceptTrialPoint_.TotalSysTime(), AcceptTrialPoint_.TotalWallclockTime()); + if( CheckConvergence_.IsEnabled() ) + jnlst.Printf(level, category, + " CheckConvergence...................: %10.3f (sys: %10.3f wall: %10.3f)\n", CheckConvergence_.TotalCpuTime(), CheckConvergence_.TotalSysTime(), CheckConvergence_.TotalWallclockTime()); + + if( PDSystemSolverTotal_.IsEnabled() ) + jnlst.Printf(level, category, + "PDSystemSolverTotal.................: %10.3f (sys: %10.3f wall: %10.3f)\n", PDSystemSolverTotal_.TotalCpuTime(), PDSystemSolverTotal_.TotalSysTime(), PDSystemSolverTotal_.TotalWallclockTime()); + else if( PDSystemSolverSolveOnce_.IsEnabled() || ComputeResiduals_.IsEnabled() || StdAugSystemSolverMultiSolve_.IsEnabled() || LinearSystemScaling_.IsEnabled() || LinearSystemSymbolicFactorization_.IsEnabled() || LinearSystemFactorization_.IsEnabled() || LinearSystemBackSolve_.IsEnabled() || LinearSystemStructureConverter_.IsEnabled() || LinearSystemStructureConverterInit_.IsEnabled() ) + { + jnlst.Printf(level, category, "PDSystemSolverTotal\n"); + } + if( PDSystemSolverSolveOnce_.IsEnabled() ) + jnlst.Printf(level, category, + " PDSystemSolverSolveOnce............: %10.3f (sys: %10.3f wall: %10.3f)\n", PDSystemSolverSolveOnce_.TotalCpuTime(), PDSystemSolverSolveOnce_.TotalSysTime(), PDSystemSolverSolveOnce_.TotalWallclockTime()); + if( ComputeResiduals_.IsEnabled() ) + jnlst.Printf(level, category, + " ComputeResiduals...................: %10.3f (sys: %10.3f wall: %10.3f)\n", ComputeResiduals_.TotalCpuTime(), ComputeResiduals_.TotalSysTime(), ComputeResiduals_.TotalWallclockTime()); + if( StdAugSystemSolverMultiSolve_.IsEnabled() ) + jnlst.Printf(level, category, + " StdAugSystemSolverMultiSolve.......: %10.3f (sys: %10.3f wall: %10.3f)\n", StdAugSystemSolverMultiSolve_.TotalCpuTime(), StdAugSystemSolverMultiSolve_.TotalSysTime(), StdAugSystemSolverMultiSolve_.TotalWallclockTime()); + if( LinearSystemScaling_.IsEnabled() ) + jnlst.Printf(level, category, + " LinearSystemScaling................: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemScaling_.TotalCpuTime(), LinearSystemScaling_.TotalSysTime(), LinearSystemScaling_.TotalWallclockTime()); + if( LinearSystemSymbolicFactorization_.IsEnabled() ) + jnlst.Printf(level, category, + " LinearSystemSymbolicFactorization..: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemSymbolicFactorization_.TotalCpuTime(), LinearSystemSymbolicFactorization_.TotalSysTime(), LinearSystemSymbolicFactorization_.TotalWallclockTime()); + if( LinearSystemFactorization_.IsEnabled() ) + jnlst.Printf(level, category, + " LinearSystemFactorization..........: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemFactorization_.TotalCpuTime(), LinearSystemFactorization_.TotalSysTime(), LinearSystemFactorization_.TotalWallclockTime()); + if( LinearSystemBackSolve_.IsEnabled() ) + jnlst.Printf(level, category, + " LinearSystemBackSolve..............: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemBackSolve_.TotalCpuTime(), LinearSystemBackSolve_.TotalSysTime(), LinearSystemBackSolve_.TotalWallclockTime()); + if( LinearSystemStructureConverter_.IsEnabled() ) + jnlst.Printf(level, category, + " LinearSystemStructureConverter.....: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemStructureConverter_.TotalCpuTime(), LinearSystemStructureConverter_.TotalSysTime(), LinearSystemStructureConverter_.TotalWallclockTime()); + if( LinearSystemStructureConverterInit_.IsEnabled() ) + jnlst.Printf(level, category, + " LinearSystemStructureConverterInit: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemStructureConverterInit_.TotalCpuTime(), LinearSystemStructureConverterInit_.TotalSysTime(), LinearSystemStructureConverterInit_.TotalWallclockTime()); + + if( QualityFunctionSearch_.IsEnabled() ) + jnlst.Printf(level, category, + "QualityFunctionSearch...............: %10.3f (sys: %10.3f wall: %10.3f)\n", QualityFunctionSearch_.TotalCpuTime(), QualityFunctionSearch_.TotalSysTime(), QualityFunctionSearch_.TotalWallclockTime()); + if( TryCorrector_.IsEnabled() ) + jnlst.Printf(level, category, + "TryCorrector........................: %10.3f (sys: %10.3f wall: %10.3f)\n", TryCorrector_.TotalCpuTime(), TryCorrector_.TotalSysTime(), TryCorrector_.TotalWallclockTime()); + if( Task1_.IsEnabled() ) + jnlst.Printf(level, category, + "Task1...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task1_.TotalCpuTime(), Task1_.TotalSysTime(), Task1_.TotalWallclockTime()); + if( Task2_.IsEnabled() ) + jnlst.Printf(level, category, + "Task2...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task2_.TotalCpuTime(), Task2_.TotalSysTime(), Task2_.TotalWallclockTime()); + if( Task3_.IsEnabled() ) + jnlst.Printf(level, category, + "Task3...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task3_.TotalCpuTime(), Task3_.TotalSysTime(), Task3_.TotalWallclockTime()); + if( Task4_.IsEnabled() ) + jnlst.Printf(level, category, + "Task4...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task4_.TotalCpuTime(), Task4_.TotalSysTime(), Task4_.TotalWallclockTime()); + if( Task5_.IsEnabled() ) + jnlst.Printf(level, category, + "Task5...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task5_.TotalCpuTime(), Task5_.TotalSysTime(), Task5_.TotalWallclockTime()); + if( Task6_.IsEnabled() ) + jnlst.Printf(level, category, + "Task6...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task6_.TotalCpuTime(), Task6_.TotalSysTime(), Task6_.TotalWallclockTime()); - jnlst.Printf(level, category, - "PDSystemSolverTotal.................: %10.3f (sys: %10.3f wall: %10.3f)\n", PDSystemSolverTotal_.TotalCpuTime(), PDSystemSolverTotal_.TotalSysTime(), PDSystemSolverTotal_.TotalWallclockTime()); - jnlst.Printf(level, category, - " PDSystemSolverSolveOnce............: %10.3f (sys: %10.3f wall: %10.3f)\n", PDSystemSolverSolveOnce_.TotalCpuTime(), PDSystemSolverSolveOnce_.TotalSysTime(), PDSystemSolverSolveOnce_.TotalWallclockTime()); - jnlst.Printf(level, category, - " ComputeResiduals...................: %10.3f (sys: %10.3f wall: %10.3f)\n", ComputeResiduals_.TotalCpuTime(), ComputeResiduals_.TotalSysTime(), ComputeResiduals_.TotalWallclockTime()); - jnlst.Printf(level, category, - " StdAugSystemSolverMultiSolve.......: %10.3f (sys: %10.3f wall: %10.3f)\n", StdAugSystemSolverMultiSolve_.TotalCpuTime(), StdAugSystemSolverMultiSolve_.TotalSysTime(), StdAugSystemSolverMultiSolve_.TotalWallclockTime()); - jnlst.Printf(level, category, - " LinearSystemScaling................: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemScaling_.TotalCpuTime(), LinearSystemScaling_.TotalSysTime(), LinearSystemScaling_.TotalWallclockTime()); - jnlst.Printf(level, category, - " LinearSystemSymbolicFactorization..: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemSymbolicFactorization_.TotalCpuTime(), LinearSystemSymbolicFactorization_.TotalSysTime(), LinearSystemSymbolicFactorization_.TotalWallclockTime()); - jnlst.Printf(level, category, - " LinearSystemFactorization..........: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemFactorization_.TotalCpuTime(), LinearSystemFactorization_.TotalSysTime(), LinearSystemFactorization_.TotalWallclockTime()); - jnlst.Printf(level, category, - " LinearSystemBackSolve..............: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemBackSolve_.TotalCpuTime(), LinearSystemBackSolve_.TotalSysTime(), LinearSystemBackSolve_.TotalWallclockTime()); - jnlst.Printf(level, category, - " LinearSystemStructureConverter.....: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemStructureConverter_.TotalCpuTime(), LinearSystemStructureConverter_.TotalSysTime(), LinearSystemStructureConverter_.TotalWallclockTime()); - jnlst.Printf(level, category, - " LinearSystemStructureConverterInit: %10.3f (sys: %10.3f wall: %10.3f)\n", LinearSystemStructureConverterInit_.TotalCpuTime(), LinearSystemStructureConverterInit_.TotalSysTime(), LinearSystemStructureConverterInit_.TotalWallclockTime()); - jnlst.Printf(level, category, - "QualityFunctionSearch...............: %10.3f (sys: %10.3f wall: %10.3f)\n", QualityFunctionSearch_.TotalCpuTime(), QualityFunctionSearch_.TotalSysTime(), QualityFunctionSearch_.TotalWallclockTime()); - jnlst.Printf(level, category, - "TryCorrector........................: %10.3f (sys: %10.3f wall: %10.3f)\n", TryCorrector_.TotalCpuTime(), TryCorrector_.TotalSysTime(), TryCorrector_.TotalWallclockTime()); - jnlst.Printf(level, category, - "Task1...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task1_.TotalCpuTime(), Task1_.TotalSysTime(), Task1_.TotalWallclockTime()); - jnlst.Printf(level, category, - "Task2...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task2_.TotalCpuTime(), Task2_.TotalSysTime(), Task2_.TotalWallclockTime()); - jnlst.Printf(level, category, - "Task3...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task3_.TotalCpuTime(), Task3_.TotalSysTime(), Task3_.TotalWallclockTime()); - jnlst.Printf(level, category, - "Task4...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task4_.TotalCpuTime(), Task4_.TotalSysTime(), Task4_.TotalWallclockTime()); - jnlst.Printf(level, category, - "Task5...............................: %10.3f (sys: %10.3f wall: %10.3f)\n", Task5_.TotalCpuTime(), Task5_.TotalSysTime(), Task5_.TotalWallclockTime()); + if( IsFunctionEvaluationTimeEnabled() ) + jnlst.Printf(level, category, + "Function Evaluations................: %10.3f (sys: %10.3f wall: %10.3f)\n", TotalFunctionEvaluationCpuTime(), TotalFunctionEvaluationSysTime(), TotalFunctionEvaluationWallclockTime()); + if( f_eval_time_.IsEnabled() ) + jnlst.Printf(level, category, + " Objective function.................: %10.3f (sys: %10.3f wall: %10.3f)\n", f_eval_time_.TotalCpuTime(), f_eval_time_.TotalSysTime(), f_eval_time_.TotalWallclockTime()); + if( grad_f_eval_time_.IsEnabled() ) + jnlst.Printf(level, category, + " Objective function gradient........: %10.3f (sys: %10.3f wall: %10.3f)\n", grad_f_eval_time_.TotalCpuTime(), grad_f_eval_time_.TotalSysTime(), grad_f_eval_time_.TotalWallclockTime()); + if( c_eval_time_.IsEnabled() ) + jnlst.Printf(level, category, + " Equality constraints...............: %10.3f (sys: %10.3f wall: %10.3f)\n", c_eval_time_.TotalCpuTime(), c_eval_time_.TotalSysTime(), c_eval_time_.TotalWallclockTime()); + if( d_eval_time_.IsEnabled() ) + jnlst.Printf(level, category, + " Inequality constraints.............: %10.3f (sys: %10.3f wall: %10.3f)\n", d_eval_time_.TotalCpuTime(), d_eval_time_.TotalSysTime(), d_eval_time_.TotalWallclockTime()); + if( jac_c_eval_time_.IsEnabled() ) + jnlst.Printf(level, category, + " Equality constraint Jacobian.......: %10.3f (sys: %10.3f wall: %10.3f)\n", jac_c_eval_time_.TotalCpuTime(), jac_c_eval_time_.TotalSysTime(), jac_c_eval_time_.TotalWallclockTime()); + if( jac_d_eval_time_.IsEnabled() ) + jnlst.Printf(level, category, + " Inequality constraint Jacobian.....: %10.3f (sys: %10.3f wall: %10.3f)\n", jac_d_eval_time_.TotalCpuTime(), jac_d_eval_time_.TotalSysTime(), jac_d_eval_time_.TotalWallclockTime()); + if( h_eval_time_.IsEnabled() ) + jnlst.Printf(level, category, + " Lagrangian Hessian.................: %10.3f (sys: %10.3f wall: %10.3f)\n", h_eval_time_.TotalCpuTime(), h_eval_time_.TotalSysTime(), h_eval_time_.TotalWallclockTime()); } } // namespace Ipopt diff --git a/src/Algorithm/IpTimingStatistics.hpp b/src/Algorithm/IpTimingStatistics.hpp index 721c29a5f..ba36c4a34 100644 --- a/src/Algorithm/IpTimingStatistics.hpp +++ b/src/Algorithm/IpTimingStatistics.hpp @@ -19,7 +19,7 @@ class IPOPTLIB_EXPORT TimingStatistics: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default constructor. */ TimingStatistics() { } @@ -27,25 +27,54 @@ class IPOPTLIB_EXPORT TimingStatistics: public ReferencedObject /** Destructor */ virtual ~TimingStatistics() { } - //@} + ///@} + + /// Whether timing of function evaluation has been enabled + /// @since 3.14.0 + bool IsFunctionEvaluationTimeEnabled() const; + /// total CPU time spend in function evaluation + /// @since 3.14.0 + Number TotalFunctionEvaluationCpuTime() const; + /// total system time spend in function evaluation + /// @since 3.14.0 + Number TotalFunctionEvaluationSysTime() const; + /// total wall-clock time spend in function evaluation + /// @since 3.14.0 + Number TotalFunctionEvaluationWallclockTime() const; /** Method for resetting all times. */ void ResetTimes(); + /** Method for enabling all timed tasked. + * @since 3.14.0 + */ + void EnableTimes(); + + /** Method for disabling all timed tasks except for OverallAlgorithm + * @since 3.14.0 + */ + void DisableTimes(); + /** Method for printing all timing information */ void PrintAllTimingStatistics( - Journalist& jnlst, - EJournalLevel level, - EJournalCategory category + const Journalist& jnlst, + EJournalLevel level, + EJournalCategory category ) const; /**@name Accessor methods to all timed tasks. */ - //@{ + ///@{ TimedTask& OverallAlgorithm() { return OverallAlgorithm_; } + /// @since 3.14.0 + const TimedTask& OverallAlgorithm() const + { + return OverallAlgorithm_; + } + TimedTask& PrintProblemStatistics() { return PrintProblemStatistics_; @@ -180,7 +209,49 @@ class IPOPTLIB_EXPORT TimingStatistics: public ReferencedObject { return Task6_; } - //@} + + /// @since 3.14.0 + TimedTask& f_eval_time() + { + return f_eval_time_; + } + + /// @since 3.14.0 + TimedTask& grad_f_eval_time() + { + return grad_f_eval_time_; + } + + /// @since 3.14.0 + TimedTask& c_eval_time() + { + return c_eval_time_; + } + + /// @since 3.14.0 + TimedTask& jac_c_eval_time() + { + return jac_c_eval_time_; + } + + /// @since 3.14.0 + TimedTask& d_eval_time() + { + return d_eval_time_; + } + + /// @since 3.14.0 + TimedTask& jac_d_eval_time() + { + return jac_d_eval_time_; + } + + /// @since 3.14.0 + TimedTask& h_eval_time() + { + return h_eval_time_; + } + ///@} private: /**@name Default Compiler Generated Methods @@ -192,7 +263,7 @@ class IPOPTLIB_EXPORT TimingStatistics: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ TimingStatistics( const TimingStatistics& @@ -202,10 +273,10 @@ class IPOPTLIB_EXPORT TimingStatistics: public ReferencedObject void operator=( const TimingStatistics& ); - //@} + ///@} /**@name All timed tasks. */ - //@{ + ///@{ TimedTask OverallAlgorithm_; TimedTask PrintProblemStatistics_; TimedTask InitializeIterates_; @@ -236,7 +307,15 @@ class IPOPTLIB_EXPORT TimingStatistics: public ReferencedObject TimedTask Task4_; TimedTask Task5_; TimedTask Task6_; - //@} + + TimedTask f_eval_time_; + TimedTask grad_f_eval_time_; + TimedTask c_eval_time_; + TimedTask jac_c_eval_time_; + TimedTask d_eval_time_; + TimedTask jac_d_eval_time_; + TimedTask h_eval_time_; + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/IpUserScaling.hpp b/src/Algorithm/IpUserScaling.hpp index c84cbad67..f0fd2612a 100644 --- a/src/Algorithm/IpUserScaling.hpp +++ b/src/Algorithm/IpUserScaling.hpp @@ -19,7 +19,7 @@ class UserScaling: public StandardScalingBase { public: /**@name Constructors/Destructors */ - //@{ + ///@{ UserScaling( const SmartPtr& nlp) : StandardScalingBase(), @@ -29,7 +29,7 @@ class UserScaling: public StandardScalingBase /** Destructor */ virtual ~UserScaling() { } - //@} + ///@} protected: virtual void DetermineScalingParametersImpl( @@ -60,7 +60,7 @@ class UserScaling: public StandardScalingBase * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ UserScaling( const UserScaling& @@ -70,7 +70,7 @@ class UserScaling: public StandardScalingBase void operator=( const UserScaling& ); - //@} + ///@} /** pointer to the NLP to get scaling parameters */ SmartPtr nlp_; diff --git a/src/Algorithm/IpWarmStartIterateInitializer.cpp b/src/Algorithm/IpWarmStartIterateInitializer.cpp index 5cb0ef17c..0b0491bcd 100644 --- a/src/Algorithm/IpWarmStartIterateInitializer.cpp +++ b/src/Algorithm/IpWarmStartIterateInitializer.cpp @@ -29,29 +29,29 @@ void WarmStartIterateInitializer::RegisterOptions( { roptions->AddLowerBoundedNumberOption( "warm_start_bound_push", - "same as bound_push for the regular initializer.", + "same as bound_push for the regular initializer", 0., true, 1e-3); roptions->AddBoundedNumberOption( "warm_start_bound_frac", - "same as bound_frac for the regular initializer.", + "same as bound_frac for the regular initializer", 0., true, 0.5, false, 1e-3); roptions->AddLowerBoundedNumberOption( "warm_start_slack_bound_push", - "same as slack_bound_push for the regular initializer.", + "same as slack_bound_push for the regular initializer", 0., true, 1e-3); roptions->AddBoundedNumberOption( "warm_start_slack_bound_frac", - "same as slack_bound_frac for the regular initializer.", + "same as slack_bound_frac for the regular initializer", 0., true, 0.5, false, 1e-3); roptions->AddLowerBoundedNumberOption( "warm_start_mult_bound_push", - "same as mult_bound_push for the regular initializer.", + "same as mult_bound_push for the regular initializer", 0., true, 1e-3); roptions->AddNumberOption( @@ -63,12 +63,15 @@ void WarmStartIterateInitializer::RegisterOptions( "Tells algorithm whether to use the GetWarmStartIterate method in the NLP.", "no", "no", "call GetStartingPoint in the NLP", - "yes", "call GetWarmStartIterate in the NLP"); - roptions->SetRegisteringCategory("Uncategorized"); + "yes", "call GetWarmStartIterate in the NLP", + "", + true); roptions->AddNumberOption( "warm_start_target_mu", - "Unsupported!", - 0.); + "", + 0., + "Experimental!", + true); } bool WarmStartIterateInitializer::InitializeImpl( @@ -406,7 +409,7 @@ void WarmStartIterateInitializer::adapt_to_target_mu( values_z[i] = target_mu / values_s[i]; if( values_z[i] > values_s[i] ) { - values_s[i] = values_z[i] = sqrt(target_mu); + values_s[i] = values_z[i] = std::sqrt(target_mu); } } else if( values_z[i] > 1e4 * values_s[i] ) @@ -414,12 +417,12 @@ void WarmStartIterateInitializer::adapt_to_target_mu( values_s[i] = target_mu / values_z[i]; if( values_s[i] > values_z[i] ) { - values_s[i] = values_z[i] = sqrt(target_mu); + values_s[i] = values_z[i] = std::sqrt(target_mu); } } else { - values_s[i] = values_z[i] = sqrt(target_mu); + values_s[i] = values_z[i] = std::sqrt(target_mu); } } } diff --git a/src/Algorithm/IpWarmStartIterateInitializer.hpp b/src/Algorithm/IpWarmStartIterateInitializer.hpp index aaea41b47..a8a947e5e 100644 --- a/src/Algorithm/IpWarmStartIterateInitializer.hpp +++ b/src/Algorithm/IpWarmStartIterateInitializer.hpp @@ -18,14 +18,14 @@ class WarmStartIterateInitializer: public IterateInitializer { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. */ WarmStartIterateInitializer(); /** Destructor */ virtual ~WarmStartIterateInitializer() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -51,7 +51,7 @@ class WarmStartIterateInitializer: public IterateInitializer * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ WarmStartIterateInitializer( const WarmStartIterateInitializer& @@ -61,10 +61,10 @@ class WarmStartIterateInitializer: public IterateInitializer void operator=( const WarmStartIterateInitializer& ); - //@} + ///@} /**@name Algorithmic Parameters */ - //@{ + ///@{ /** Absolute parameters for bumping x0 in warm start mode */ Number warm_start_bound_push_; @@ -96,10 +96,10 @@ class WarmStartIterateInitializer: public IterateInitializer * the warm start. */ bool warm_start_entire_iterate_; - //@} + ///@} /** @name Auxiliary functions */ - //@{ + ///@{ void process_target_mu( Number factor, const Vector& curr_vars, @@ -115,7 +115,7 @@ class WarmStartIterateInitializer: public IterateInitializer Vector& new_z, Number target_mu ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpGenKKTSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpGenKKTSolverInterface.hpp index 0e6576da5..c28c1da99 100644 --- a/src/Algorithm/LinearSolvers/IpGenKKTSolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpGenKKTSolverInterface.hpp @@ -19,13 +19,13 @@ class GenKKTSolverInterface: public AlgorithmStrategyObject { public: /** @name Constructor/Destructor */ - //@{ + ///@{ GenKKTSolverInterface() { } virtual ~GenKKTSolverInterface() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -33,7 +33,7 @@ class GenKKTSolverInterface: public AlgorithmStrategyObject ) = 0; /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ /** Solve operation for multiple right hand sides. * * The linear system is of the form @@ -100,10 +100,10 @@ class GenKKTSolverInterface: public AlgorithmStrategyObject * (see ProvidesInertia). */ virtual Index NumberOfNegEVals() const = 0; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ /** Request to increase quality of solution for next solve. * * The calling class asks linear solver to increase quality of @@ -118,7 +118,7 @@ class GenKKTSolverInterface: public AlgorithmStrategyObject * @return true, if linear solver provides inertia */ virtual bool ProvidesInertia() const = 0; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.cpp b/src/Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.cpp index b4caf9a3d..2a1c1ba37 100644 --- a/src/Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.cpp +++ b/src/Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.cpp @@ -16,23 +16,23 @@ extern "C" { void F77_FUNC(wsetmaxthrds, WSETMAXTHRDS)( - const ipfint* NTHREADS + const ipindex* NTHREADS ); void F77_FUNC(wismp, WISMP)( - const ipfint* N, - const ipfint* IA, - const ipfint* JA, - const double* AVALS, - double* B, - const ipfint* LDB, + const ipindex* N, + const ipindex* IA, + const ipindex* JA, + const double* AVALS, + double* B, + const ipindex* LDB, double* X, - const ipfint* LDX, - const ipfint* NRHS, - double* RMISC, - double* CVGH, - ipfint* IPARM, - double* DPARM + const ipindex* LDX, + const ipindex* NRHS, + double* RMISC, + double* CVGH, + ipindex* IPARM, + double* DPARM ); void F77_FUNC_(wsmp_clear, WSMP_CLEAR)(void); @@ -50,7 +50,7 @@ IterativeWsmpSolverInterface::IterativeWsmpSolverInterface() { DBG_START_METH("IterativeWsmpSolverInterface::IterativeWsmpSolverInterface()", dbg_verbosity); - IPARM_ = new ipfint[64]; + IPARM_ = new Index[64]; DPARM_ = new double[64]; } @@ -73,19 +73,23 @@ void IterativeWsmpSolverInterface::RegisterOptions( roptions->AddLowerBoundedIntegerOption( "wsmp_max_iter", "Maximal number of iterations in iterative WISMP", 1, - 1000); + 1000, + "", + true); roptions->AddLowerBoundedNumberOption( "wsmp_inexact_droptol", "Drop tolerance for inexact factorization preconditioner in WISMP.", 0.0, false, 0.0, - "DPARM(14) in WISMP"); + "DPARM(14) in WISMP", + true); roptions->AddLowerBoundedNumberOption( "wsmp_inexact_fillin_limit", "Fill-in limit for inexact factorization preconditioner in WISMP.", 0.0, false, 0.0, - "DPARM(15) in WISMP"); + "DPARM(15) in WISMP", + true); } bool IterativeWsmpSolverInterface::InitializeImpl( @@ -144,10 +148,10 @@ bool IterativeWsmpSolverInterface::InitializeImpl( #if 1 // Set the number of threads - ipfint NTHREADS = wsmp_num_threads_; + Index NTHREADS = wsmp_num_threads_; F77_FUNC(wsetmaxthrds, WSETMAXTHRDS)(&NTHREADS); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "WSMP will use %d threads.\n", wsmp_num_threads_); + "WSMP will use %" IPOPT_INDEX_FORMAT " threads.\n", wsmp_num_threads_); #else Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, "Not setting WISMP threads at the moment.\n"); @@ -157,9 +161,16 @@ bool IterativeWsmpSolverInterface::InitializeImpl( IPARM_[0] = 0; IPARM_[1] = 0; IPARM_[2] = 0; - ipfint idmy; - double ddmy; + Index idmy = 0; + double ddmy = 0.; F77_FUNC(wismp, WISMP)(&idmy, &idmy, &idmy, &ddmy, &ddmy, &idmy, &ddmy, &idmy, &idmy, &ddmy, &ddmy, IPARM_, DPARM_); + + if( IPARM_[63] < 0 ) + { + Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, "Error %" IPOPT_INDEX_FORMAT " from WSMP initialization.\n", IPARM_[63]); + return false; + } + IPARM_[3] = 3; // Upper triangular portion of matrix in CSR format // (same as for WSSMP) IPARM_[6] = 3; @@ -239,7 +250,7 @@ ESymSolverStatus IterativeWsmpSolverInterface::InitializeStructure( a_ = NULL; a_ = new double[nonzeros]; - // Do the symbolic facotrization + // Do the symbolic factorization ESymSolverStatus retval = SymbolicFactorization(ia, ja); if( retval != SYMSOLVER_SUCCESS ) { @@ -252,8 +263,8 @@ ESymSolverStatus IterativeWsmpSolverInterface::InitializeStructure( } ESymSolverStatus IterativeWsmpSolverInterface::SymbolicFactorization( - const Index* ia, - const Index* ja + const Index* /*ia*/, + const Index* /*ja*/ ) { DBG_START_METH("IterativeWsmpSolverInterface::SymbolicFactorization", @@ -275,16 +286,16 @@ ESymSolverStatus IterativeWsmpSolverInterface::InternalSymFact( } // Call WISMP for ordering and symbolic factorization - ipfint N = dim_; + Index N = dim_; IPARM_[1] = 1; // ordering IPARM_[2] = 1; // symbolic factorization - ipfint idmy; - double ddmy; + Index idmy = 0; + double ddmy = 0.; Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling WISMP-1-1 for symbolic analysis at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); + "Calling WISMP-1-1 for symbolic analysis.\n"); F77_FUNC(wismp, WISMP)(&N, ia, ja, a_, &ddmy, &idmy, &ddmy, &idmy, &idmy, &ddmy, &ddmy, IPARM_, DPARM_); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with WISMP-1-1 for symbolic analysis at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); + "Done with WISMP-1-1 for symbolic analysis.\n"); Index ierror = IPARM_[63]; if( ierror != 0 ) @@ -297,7 +308,7 @@ ESymSolverStatus IterativeWsmpSolverInterface::InternalSymFact( else if( ierror > 0 ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Matrix appears to be singular (with ierror = %d).\n", ierror); + "Matrix appears to be singular (with ierror = %" IPOPT_INDEX_FORMAT ").\n", ierror); if( HaveIpData() ) { IpData().TimingStats().LinearSystemSymbolicFactorization().End(); @@ -307,7 +318,7 @@ ESymSolverStatus IterativeWsmpSolverInterface::InternalSymFact( else { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in WISMP during ordering/symbolic factorization phase.\n Error code is %d.\n", ierror); + "Error in WISMP during ordering/symbolic factorization phase.\n Error code is %" IPOPT_INDEX_FORMAT ".\n", ierror); } if( HaveIpData() ) { @@ -316,7 +327,7 @@ ESymSolverStatus IterativeWsmpSolverInterface::InternalSymFact( return SYMSOLVER_FATAL_ERROR; } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Predicted memory usage for WISMP after symbolic factorization IPARM(23)= %d.\n", IPARM_[22]); + "Predicted memory usage for WISMP after symbolic factorization IPARM(23)= %" IPOPT_INDEX_FORMAT ".\n", IPARM_[22]); if( HaveIpData() ) { @@ -329,8 +340,8 @@ ESymSolverStatus IterativeWsmpSolverInterface::InternalSymFact( ESymSolverStatus IterativeWsmpSolverInterface::Factorization( const Index* ia, const Index* ja, - bool check_NegEVals, - Index numberOfNegEVals + bool /*check_NegEVals*/, + Index /*numberOfNegEVals*/ ) { DBG_START_METH("IterativeWsmpSolverInterface::Factorization", dbg_verbosity); @@ -345,18 +356,18 @@ ESymSolverStatus IterativeWsmpSolverInterface::Factorization( { matrix_file_number_++; char buf[256]; - Snprintf(buf, 255, "wsmp_matrix_%d_%d.dat", iter_count, matrix_file_number_); + Snprintf(buf, 255, "wsmp_matrix_%" IPOPT_INDEX_FORMAT "_%" IPOPT_INDEX_FORMAT ".dat", iter_count, matrix_file_number_); Jnlst().Printf(J_SUMMARY, J_LINEAR_ALGEBRA, "Writing WSMP matrix into file %s.\n", buf); FILE* fp = fopen(buf, "w"); - fprintf(fp, "%d\n", dim_); // N + fprintf(fp, "%" IPOPT_INDEX_FORMAT "\n", dim_); // N for( Index icol = 0; icol < dim_; icol++ ) { - fprintf(fp, "%d", ia[icol + 1] - ia[icol]); // number of elements for this column - // Now for each colum we write row indices and values + fprintf(fp, "%" IPOPT_INDEX_FORMAT "", ia[icol + 1] - ia[icol]); // number of elements for this column + // Now for each column we write row indices and values for( Index irow = ia[icol]; irow < ia[icol + 1]; irow++ ) { - fprintf(fp, " %23.16e %d", a_[irow - 1], ja[irow - 1]); + fprintf(fp, " %23.16e %" IPOPT_INDEX_FORMAT "", a_[irow - 1], ja[irow - 1]); } fprintf(fp, "\n"); } @@ -381,12 +392,12 @@ ESymSolverStatus IterativeWsmpSolverInterface::Factorization( } // Call WSSMP for numerical factorization - ipfint N = dim_; + Index N = dim_; IPARM_[1] = 2; // value analysis IPARM_[2] = 3; // preconditioner generation DPARM_[10] = wsmp_pivtol_; // set current pivot tolerance - ipfint idmy; - double ddmy; + Index idmy = 0; + double ddmy = 0.; // set drop tolerances for now.... if( wsmp_inexact_droptol_ != 0. ) @@ -401,12 +412,10 @@ ESymSolverStatus IterativeWsmpSolverInterface::Factorization( Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "Calling WISMP-2-3 with DPARM(14) = %8.2e and DPARM(15) = %8.2e.\n", DPARM_[13], DPARM_[14]); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling WISMP-2-3 for value analysis and preconditioner computation at cpu time %10.3f (wall %10.3f).\n", CpuTime(), - WallclockTime()); + "Calling WISMP-2-3 for value analysis and preconditioner computation.\n"); F77_FUNC(wismp, WISMP)(&N, ia, ja, a_, &ddmy, &idmy, &ddmy, &idmy, &idmy, &ddmy, &ddmy, IPARM_, DPARM_); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with WISMP-2-3 for value analysis and preconditioner computation at cpu time %10.3f (wall %10.3f).\n", - CpuTime(), WallclockTime()); + "Done with WISMP-2-3 for value analysis and preconditioner computation.\n"); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "Done with WISMP-2-3 with DPARM(14) = %8.2e and DPARM(15) = %8.2e.\n", DPARM_[13], DPARM_[14]); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, @@ -417,7 +426,7 @@ ESymSolverStatus IterativeWsmpSolverInterface::Factorization( if( ierror > 0 ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "WISMP detected that the matrix is singular and encountered %d zero pivots.\n", dim_ + 1 - ierror); + "WISMP detected that the matrix is singular and encountered %" IPOPT_INDEX_FORMAT " zero pivots.\n", dim_ + 1 - ierror); if( HaveIpData() ) { IpData().TimingStats().LinearSystemFactorization().End(); @@ -434,7 +443,7 @@ ESymSolverStatus IterativeWsmpSolverInterface::Factorization( else { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in WSMP during factorization phase.\n Error code is %d.\n", ierror); + "Error in WSMP during factorization phase.\n Error code is %" IPOPT_INDEX_FORMAT ".\n", ierror); } if( HaveIpData() ) { @@ -443,7 +452,7 @@ ESymSolverStatus IterativeWsmpSolverInterface::Factorization( return SYMSOLVER_FATAL_ERROR; } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Memory usage for WISMP after factorization IPARM(23) = %d\n", IPARM_[22]); + "Memory usage for WISMP after factorization IPARM(23) = %" IPOPT_INDEX_FORMAT "\n", IPARM_[22]); #if 0 // Check whether the number of negative eigenvalues matches the requested @@ -451,7 +460,7 @@ ESymSolverStatus IterativeWsmpSolverInterface::Factorization( if (check_NegEVals && (numberOfNegEVals != negevals_)) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Wrong inertia: required are %d, but we got %d.\n", + "Wrong inertia: required are %" IPOPT_INDEX_FORMAT ", but we got %" IPOPT_INDEX_FORMAT ".\n", numberOfNegEVals, negevals_); if (HaveIpData()) { @@ -485,12 +494,12 @@ ESymSolverStatus IterativeWsmpSolverInterface::Solve( // Call WISMP to solve for some right hand sides. The solution // will be stored in rhs_vals, and we need to make a copy of the // original right hand side before the call. - ipfint N = dim_; - ipfint LDB = dim_; + Index N = dim_; + Index LDB = dim_; double* RHS = new double[dim_ * nrhs]; - IpBlasDcopy(dim_ * nrhs, rhs_vals, 1, RHS, 1); - ipfint LDX = dim_; // Q: Do we have to zero out solution? - ipfint NRHS = nrhs; + IpBlasCopy(dim_ * nrhs, rhs_vals, 1, RHS, 1); + Index LDX = dim_; // Q: Do we have to zero out solution? + Index NRHS = nrhs; IPARM_[1] = 4; // Iterative solver solution IPARM_[2] = 4; @@ -507,10 +516,10 @@ ESymSolverStatus IterativeWsmpSolverInterface::Solve( double ddmy; Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling WISMP-4-4 for backsolve at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); + "Calling WISMP-4-4 for backsolve.\n"); F77_FUNC(wismp, WISMP)(&N, ia, ja, a_, RHS, &LDB, rhs_vals, &LDX, &NRHS, &ddmy, CVGH, IPARM_, DPARM_); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with WISMP-4-4 for backsolve at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); + "Done with WISMP-4-4 for backsolve.\n"); if( HaveIpData() ) { IpData().TimingStats().LinearSystemBackSolve().End(); @@ -527,14 +536,16 @@ ESymSolverStatus IterativeWsmpSolverInterface::Solve( else { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in WISMP during ordering/symbolic factorization phase.\n Error code is %d.\n", ierror); + "Error in WISMP during ordering/symbolic factorization phase.\n Error code is %" IPOPT_INDEX_FORMAT ".\n", ierror); } + delete[] CVGH; return SYMSOLVER_FATAL_ERROR; } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of iterative solver steps in WISMP: %d\n", IPARM_[25]); + "Number of iterative solver steps in WISMP: %" IPOPT_INDEX_FORMAT "\n", IPARM_[25]); if( Jnlst().ProduceOutput(J_MOREDETAILED, J_LINEAR_ALGEBRA) ) { + DBG_ASSERT(CVGH != NULL); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, "WISMP congergence history:\n"); for( Index i = 0; i <= IPARM_[25]; ++i ) @@ -542,8 +553,8 @@ ESymSolverStatus IterativeWsmpSolverInterface::Solve( Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, " Resid[%3d] = %13.6e\n", i, CVGH[i]); } - delete[] CVGH; } + delete[] CVGH; return SYMSOLVER_SUCCESS; } @@ -559,6 +570,7 @@ bool IterativeWsmpSolverInterface::IncreaseQuality() { // TODO!!!! return false; +#if 0 DBG_START_METH("IterativeWsmpSolverInterface::IncreaseQuality", dbg_verbosity); if( wsmp_pivtol_ == wsmp_pivtolmax_ ) { @@ -594,6 +606,7 @@ bool IterativeWsmpSolverInterface::IncreaseQuality() } return true; +#endif } } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.hpp index 28e2c3e1d..6c3555187 100644 --- a/src/Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.hpp @@ -9,6 +9,7 @@ #define __IPITERATIVEWSMPSOLVERINTERFACE_HPP__ #include "IpSparseSymLinearSolverInterface.hpp" +#include "IpTypes.h" namespace Ipopt { @@ -20,13 +21,13 @@ class IterativeWsmpSolverInterface: public SparseSymLinearSolverInterface { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor */ IterativeWsmpSolverInterface(); /** Destructor */ virtual ~IterativeWsmpSolverInterface(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -34,7 +35,7 @@ class IterativeWsmpSolverInterface: public SparseSymLinearSolverInterface ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ virtual ESymSolverStatus InitializeStructure( Index dim, Index nonzeros, @@ -55,10 +56,10 @@ class IterativeWsmpSolverInterface: public SparseSymLinearSolverInterface ); virtual Index NumberOfNegEVals() const; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ virtual bool IncreaseQuality(); virtual bool ProvidesInertia() const @@ -70,7 +71,7 @@ class IterativeWsmpSolverInterface: public SparseSymLinearSolverInterface { return CSR_Format_1_Offset; } - //@} + ///@} static void RegisterOptions( SmartPtr roptions @@ -85,7 +86,7 @@ class IterativeWsmpSolverInterface: public SparseSymLinearSolverInterface * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ IterativeWsmpSolverInterface( const IterativeWsmpSolverInterface& @@ -95,19 +96,19 @@ class IterativeWsmpSolverInterface: public SparseSymLinearSolverInterface void operator=( const IterativeWsmpSolverInterface& ); - //@} + ///@} /** @name Information about the matrix */ - //@{ + ///@{ /** Number of rows and columns of the matrix */ Index dim_; /** Array for storing the values of the matrix. */ double* a_; - //@} + ///@} /** @name Solver specific options */ - //@{ + ///@{ /** Option that controls the matching strategy. */ Index wsmp_num_threads_; /** Pivot tolerance */ @@ -120,21 +121,21 @@ class IterativeWsmpSolverInterface: public SparseSymLinearSolverInterface Index wsmp_write_matrix_iteration_; Number wsmp_inexact_droptol_; Number wsmp_inexact_fillin_limit_; - //@} + ///@} /** Counter for matrix file numbers */ Index matrix_file_number_; /** @name Information about most recent factorization/solve */ - //@{ + ///@{ #if 0 /** Number of negative eigenvalues */ Index negevals_; #endif - //@} + ///@} /** @name Initialization flags */ - //@{ + ///@{ /** Flag indicating if internal data is initialized. * For initialization, this object needs to have seen a matrix */ @@ -147,18 +148,18 @@ class IterativeWsmpSolverInterface: public SparseSymLinearSolverInterface * already been performed. */ bool have_symbolic_factorization_; - //@} + ///@} /** @name Solver specific information */ - //@{ + ///@{ /** Integer parameter array for WISMP. */ - ipfint* IPARM_; + ipindex* IPARM_; /** Double precision parameter array for WISMP. */ double* DPARM_; - //@} + ///@} /** @name Internal functions */ - //@{ + ///@{ /** Call Wsmp to do the analysis phase. */ ESymSolverStatus SymbolicFactorization( @@ -187,7 +188,7 @@ class IterativeWsmpSolverInterface: public SparseSymLinearSolverInterface Index nrhs, double* rhs_vals ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpLinearSolvers.c b/src/Algorithm/LinearSolvers/IpLinearSolvers.c new file mode 100644 index 000000000..12858a430 --- /dev/null +++ b/src/Algorithm/LinearSolvers/IpLinearSolvers.c @@ -0,0 +1,81 @@ +// Copyright (C) 2005, 2006 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. + +#include "IpLinearSolvers.h" +#include "IpoptConfig.h" +#ifdef IPOPT_HAS_HSL +#include "CoinHslConfig.h" +#endif + +IpoptLinearSolver IpoptGetAvailableLinearSolvers( + int buildinonly +) +{ + IpoptLinearSolver solvers = 0u; + +#ifndef IPOPT_INT64 +#if (defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA27S)) || (!defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA27)) + solvers |= IPOPTLINEARSOLVER_MA27; +#endif + +#if (defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA57S)) || (!defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA57)) + solvers |= IPOPTLINEARSOLVER_MA57; +#endif + +#if (defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA77S)) || (!defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA77)) + solvers |= IPOPTLINEARSOLVER_MA77; +#endif + +#if (defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA86S)) || (!defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA86)) + solvers |= IPOPTLINEARSOLVER_MA86; +#endif + +#if (defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA97S)) || (!defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MA97)) + solvers |= IPOPTLINEARSOLVER_MA97; +#endif + +#if (defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MC19S)) || (!defined(IPOPT_SINGLE) && defined(COINHSL_HAS_MC19)) + solvers |= IPOPTLINEARSOLVER_MC19; +#endif + +#ifdef PARDISO_LIB + solvers |= IPOPTLINEARSOLVER_PARDISO; +#endif +#endif + +#ifdef IPOPT_HAS_PARDISO_MKL + solvers |= IPOPTLINEARSOLVER_PARDISOMKL; +#endif + +#if !defined(IPOPT_SINGLE) && defined(IPOPT_HAS_SPRAL) + solvers |= IPOPTLINEARSOLVER_SPRAL; +#endif + +#if !defined(IPOPT_SINGLE) && defined(IPOPT_HAS_WSMP) + solvers |= IPOPTLINEARSOLVER_WSMP; +#endif + +#ifdef IPOPT_HAS_MUMPS + solvers |= IPOPTLINEARSOLVER_MUMPS; +#endif + +#if defined(IPOPT_HAS_LINEARSOLVERLOADER) + if( !buildinonly ) + { +#ifndef IPOPT_INT64 + solvers |= IPOPTLINEARSOLVER_MA27; + solvers |= IPOPTLINEARSOLVER_MA57; + solvers |= IPOPTLINEARSOLVER_MA77; + solvers |= IPOPTLINEARSOLVER_MA86; + solvers |= IPOPTLINEARSOLVER_MA97; + solvers |= IPOPTLINEARSOLVER_MC19; + solvers |= IPOPTLINEARSOLVER_PARDISO; +#endif + } +#else + (void) buildinonly; +#endif + + return solvers; +} diff --git a/src/Algorithm/LinearSolvers/IpLinearSolvers.h b/src/Algorithm/LinearSolvers/IpLinearSolvers.h new file mode 100644 index 000000000..3cb57bef4 --- /dev/null +++ b/src/Algorithm/LinearSolvers/IpLinearSolvers.h @@ -0,0 +1,46 @@ +// Copyright (C) 2021 COIN-OR Foundation +// All Rights Reserved. +// This code is published under the Eclipse Public License. + +#ifndef __IPLINEARSOLVERS_H__ +#define __IPLINEARSOLVERS_H__ + +#include "IpoptConfig.h" +#include "IpTypes.h" + +#define IPOPTLINEARSOLVER_MA27 0x001u +#define IPOPTLINEARSOLVER_MA57 0x002u +#define IPOPTLINEARSOLVER_MA77 0x004u +#define IPOPTLINEARSOLVER_MA86 0x008u +#define IPOPTLINEARSOLVER_MA97 0x010u +#define IPOPTLINEARSOLVER_MC19 0x020u +#define IPOPTLINEARSOLVER_ALLHSL (IPOPTLINEARSOLVER_MA27 | IPOPTLINEARSOLVER_MA57 | IPOPTLINEARSOLVER_MA77 | IPOPTLINEARSOLVER_MA86 | IPOPTLINEARSOLVER_MA97 | IPOPTLINEARSOLVER_MC19) + +#define IPOPTLINEARSOLVER_PARDISO 0x040u +#define IPOPTLINEARSOLVER_PARDISOMKL 0x080u +#define IPOPTLINEARSOLVER_SPRAL 0x100u +#define IPOPTLINEARSOLVER_WSMP 0x200u +#define IPOPTLINEARSOLVER_MUMPS 0x400u + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef unsigned int IpoptLinearSolver; + +/** get bitflags indicating which linear solvers (and mc19) are available to Ipopt + * + * If buildinonly if set to a nonzero value, then only report linear solvers that have been linked into Ipopt. + * Otherwise, also linear solvers are reported which are loaded from a shared library at runtime, if this feature has been compiled. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT IpoptLinearSolver IPOPT_CALLCONV IpoptGetAvailableLinearSolvers( + int buildinonly +); + +#ifdef __cplusplus +} +#endif + +#endif /* __IPLINEARSOLVERS_H__ */ diff --git a/src/Algorithm/LinearSolvers/IpLinearSolversRegOp.cpp b/src/Algorithm/LinearSolvers/IpLinearSolversRegOp.cpp index 0606f5b2c..465cfe334 100644 --- a/src/Algorithm/LinearSolvers/IpLinearSolversRegOp.cpp +++ b/src/Algorithm/LinearSolvers/IpLinearSolversRegOp.cpp @@ -5,10 +5,8 @@ // Authors: Carl Laird, Andreas Waechter IBM 2005-08-16 #include "IpoptConfig.h" -#ifdef IPOPT_HAS_HSL -#include "CoinHslConfig.h" -#endif #include "IpLinearSolversRegOp.hpp" +#include "IpLinearSolvers.h" #include "IpRegOptions.hpp" #include "IpTSymLinearSolver.hpp" @@ -19,10 +17,16 @@ #include "IpMa97SolverInterface.hpp" #include "IpMa28TDependencyDetector.hpp" #include "IpPardisoSolverInterface.hpp" +#ifdef IPOPT_HAS_PARDISO_MKL +#include "IpPardisoMKLSolverInterface.hpp" +#endif #ifdef IPOPT_HAS_MUMPS # include "IpMumpsSolverInterface.hpp" #endif -#ifdef HAVE_WSMP +#ifdef IPOPT_HAS_SPRAL +# include "IpSpralSolverInterface.hpp" +#endif +#ifdef IPOPT_HAS_WSMP # include "IpWsmpSolverInterface.hpp" # include "IpIterativeWsmpSolverInterface.hpp" #endif @@ -36,49 +40,86 @@ void RegisterOptions_LinearSolvers( { roptions->SetRegisteringCategory("Linear Solver"); TSymLinearSolver::RegisterOptions(roptions); -#if defined(COINHSL_HAS_MA27) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - roptions->SetRegisteringCategory("MA27 Linear Solver"); - Ma27TSolverInterface::RegisterOptions(roptions); -#endif -#if defined(COINHSL_HAS_MA57) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - roptions->SetRegisteringCategory("MA57 Linear Solver"); - Ma57TSolverInterface::RegisterOptions(roptions); -#endif -#if defined(COINHSL_HAS_MA77) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - roptions->SetRegisteringCategory("MA77 Linear Solver"); - Ma77SolverInterface::RegisterOptions(roptions); + + IpoptLinearSolver availablesolvers = IpoptGetAvailableLinearSolvers(false); + +#ifndef IPOPT_INT64 + if( availablesolvers & IPOPTLINEARSOLVER_MA27 ) + { + roptions->SetRegisteringCategory("MA27 Linear Solver"); + Ma27TSolverInterface::RegisterOptions(roptions); + } + + if( availablesolvers & IPOPTLINEARSOLVER_MA57 ) + { + roptions->SetRegisteringCategory("MA57 Linear Solver"); + Ma57TSolverInterface::RegisterOptions(roptions); + } + + if( availablesolvers & IPOPTLINEARSOLVER_MA77 ) + { + roptions->SetRegisteringCategory("MA77 Linear Solver"); + Ma77SolverInterface::RegisterOptions(roptions); + } + + if( availablesolvers & IPOPTLINEARSOLVER_MA86 ) + { + roptions->SetRegisteringCategory("MA86 Linear Solver"); + Ma86SolverInterface::RegisterOptions(roptions); + } + + if( availablesolvers & IPOPTLINEARSOLVER_MA97 ) + { + roptions->SetRegisteringCategory("MA97 Linear Solver"); + Ma97SolverInterface::RegisterOptions(roptions); + } #endif -#if defined(COINHSL_HAS_MA86) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - roptions->SetRegisteringCategory("MA86 Linear Solver"); - Ma86SolverInterface::RegisterOptions(roptions); + +#ifdef IPOPT_HAS_MUMPS + if( availablesolvers & IPOPTLINEARSOLVER_MUMPS ) + { + roptions->SetRegisteringCategory("Mumps Linear Solver"); + MumpsSolverInterface::RegisterOptions(roptions); + } #endif -#if defined(COINHSL_HAS_MA97) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - roptions->SetRegisteringCategory("MA97 Linear Solver"); - Ma97SolverInterface::RegisterOptions(roptions); + +#ifndef IPOPT_INT64 + if( availablesolvers & IPOPTLINEARSOLVER_PARDISO ) + { + roptions->SetRegisteringCategory("Pardiso (pardiso-project.org) Linear Solver"); + PardisoSolverInterface::RegisterOptions(roptions); + } #endif -#ifdef IPOPT_HAS_MUMPS - roptions->SetRegisteringCategory("Mumps Linear Solver"); - MumpsSolverInterface::RegisterOptions(roptions); +#ifdef IPOPT_HAS_PARDISO_MKL + if( availablesolvers & IPOPTLINEARSOLVER_PARDISOMKL ) + { + roptions->SetRegisteringCategory("Pardiso (MKL) Linear Solver"); + PardisoMKLSolverInterface::RegisterOptions(roptions); + } #endif -#if defined(IPOPT_HAS_PARDISO) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - roptions->SetRegisteringCategory("Pardiso Linear Solver"); - PardisoSolverInterface::RegisterOptions(roptions); +#ifdef IPOPT_HAS_SPRAL + if( availablesolvers & IPOPTLINEARSOLVER_SPRAL ) + { + roptions->SetRegisteringCategory("SPRAL Linear Solver"); + SpralSolverInterface::RegisterOptions(roptions); + } #endif -#ifdef HAVE_WSMP - roptions->SetRegisteringCategory("WSMP Linear Solver"); - WsmpSolverInterface::RegisterOptions(roptions); - IterativeWsmpSolverInterface::RegisterOptions(roptions); +#ifdef IPOPT_HAS_WSMP + if( availablesolvers & IPOPTLINEARSOLVER_WSMP ) + { + roptions->SetRegisteringCategory("WSMP Linear Solver"); + WsmpSolverInterface::RegisterOptions(roptions); + IterativeWsmpSolverInterface::RegisterOptions(roptions); + } #endif -#if defined(COINHSL_HAS_MA28) && defined(F77_FUNC) +#if ((defined(COINHSL_HAS_MA28) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA28S) && defined(IPOPT_SINGLE))) && defined(F77_FUNC) roptions->SetRegisteringCategory("MA28 Linear Solver"); Ma28TDependencyDetector::RegisterOptions(roptions); #endif - - roptions->SetRegisteringCategory("Uncategorized"); } } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpMa27TSolverInterface.cpp b/src/Algorithm/LinearSolvers/IpMa27TSolverInterface.cpp index 3554da544..ab659b268 100644 --- a/src/Algorithm/LinearSolvers/IpMa27TSolverInterface.cpp +++ b/src/Algorithm/LinearSolvers/IpMa27TSolverInterface.cpp @@ -5,79 +5,36 @@ // Authors: Carl Laird, Andreas Waechter IBM 2005-03-17 #include "IpoptConfig.h" +#include "IpMa27TSolverInterface.hpp" + +#include #ifdef IPOPT_HAS_HSL #include "CoinHslConfig.h" -#else -/* if we build for the Linear Solver loader, then use normal C-naming style */ -#define IPOPT_HSL_FUNC(name,NAME) name #endif -// if we do not have MA27 in HSL or the linear solver loader, then we want to build the MA27 interface -#if defined(COINHSL_HAS_MA27) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - -#include "IpMa27TSolverInterface.hpp" - -#include +#if (defined(COINHSL_HAS_MA27) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA27S) && defined(IPOPT_SINGLE)) +#ifdef IPOPT_SINGLE +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name,NAME) +#else +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name ## d,NAME ## D) +#endif -/** Prototypes for MA27's Fortran subroutines */ +/** MA27 functions from HSL library (symbols resolved at linktime) */ extern "C" { - void IPOPT_HSL_FUNC(ma27id, MA27ID)( - ipfint* ICNTL, - double* CNTL - ); - - void IPOPT_HSL_FUNC(ma27ad, MA27AD)( - ipfint* N, - ipfint* NZ, - const ipfint* IRN, - const ipfint* ICN, - ipfint* IW, - ipfint* LIW, - ipfint* IKEEP, - ipfint* IW1, - ipfint* NSTEPS, - ipfint* IFLAG, - ipfint* ICNTL, - double* CNTL, - ipfint* INFO, - double* OPS - ); - - void IPOPT_HSL_FUNC(ma27bd, MA27BD)( - ipfint* N, - ipfint* NZ, - const ipfint* IRN, - const ipfint* ICN, - double* A, - ipfint* LA, - ipfint* IW, - ipfint* LIW, - ipfint* IKEEP, - ipfint* NSTEPS, - ipfint* MAXFRT, - ipfint* IW1, - ipfint* ICNTL, - double* CNTL, - ipfint* INFO - ); - - void IPOPT_HSL_FUNC(ma27cd, MA27CD)( - ipfint* N, - double* A, - ipfint* LA, - ipfint* IW, - ipfint* LIW, - double* W, - ipfint* MAXFRT, - double* RHS, - ipfint* IW1, - ipfint* NSTEPS, - ipfint* ICNTL, - double* CNTL - ); + IPOPT_DECL_MA27A(IPOPT_HSL_FUNCP(ma27a, MA27A)); + IPOPT_DECL_MA27B(IPOPT_HSL_FUNCP(ma27b, MA27B)); + IPOPT_DECL_MA27C(IPOPT_HSL_FUNCP(ma27c, MA27C)); + IPOPT_DECL_MA27I(IPOPT_HSL_FUNCP(ma27i, MA27I)); } +#else +#ifdef IPOPT_SINGLE +#define HSLFUNCNAMESUFFIX "" +#else +#define HSLFUNCNAMESUFFIX "d" +#endif +#endif namespace Ipopt { @@ -85,19 +42,31 @@ namespace Ipopt static const Index dbg_verbosity = 0; #endif -Ma27TSolverInterface::Ma27TSolverInterface() - : dim_(0), - nonzeros_(0), - initialized_(false), - pivtol_changed_(false), - refactorize_(false), - liw_(0), - iw_(NULL), - ikeep_(NULL), - la_(0), - a_(NULL), - la_increase_(false), - liw_increase_(false) +/** pointer to MA27 function that can be set via Ma27TSolverInterface::SetFunctions() */ +static IPOPT_DECL_MA27A(*user_ma27a) = NULL; +static IPOPT_DECL_MA27B(*user_ma27b) = NULL; +static IPOPT_DECL_MA27C(*user_ma27c) = NULL; +static IPOPT_DECL_MA27I(*user_ma27i) = NULL; + +Ma27TSolverInterface::Ma27TSolverInterface( + SmartPtr hslloader_ +) : hslloader(hslloader_), + ma27a(NULL), + ma27b(NULL), + ma27c(NULL), + ma27i(NULL), + dim_(0), + nonzeros_(0), + initialized_(false), + pivtol_changed_(false), + refactorize_(false), + liw_(0), + iw_(NULL), + ikeep_(NULL), + la_(0), + a_(NULL), + la_increase_(false), + liw_increase_(false) { DBG_START_METH("Ma27TSolverInterface::Ma27TSolverInterface()", dbg_verbosity); } @@ -115,62 +84,78 @@ void Ma27TSolverInterface::RegisterOptions( SmartPtr roptions ) { + roptions->AddBoundedIntegerOption( + "ma27_print_level", + "Debug printing level for the linear solver MA27", + 0, 4, 0, + "0: no printing; 1: Error messages only; 2: Error and warning messages; 3: Error and warning messages and terse monitoring; 4: All information."); roptions->AddBoundedNumberOption( "ma27_pivtol", "Pivot tolerance for the linear solver MA27.", 0.0, true, 1.0, true, 1e-8, - "A smaller number pivots for sparsity, a larger number pivots for stability. " - "This option is only available if Ipopt has been compiled with MA27."); + "A smaller number pivots for sparsity, a larger number pivots for stability."); roptions->AddBoundedNumberOption( "ma27_pivtolmax", "Maximum pivot tolerance for the linear solver MA27.", 0.0, true, 1.0, true, 1e-4, - "Ipopt may increase pivtol as high as pivtolmax to get a more accurate solution to the linear system. " - "This option is only available if Ipopt has been compiled with MA27."); + "Ipopt may increase pivtol as high as ma27_pivtolmax to get a more accurate solution to the linear system."); roptions->AddLowerBoundedNumberOption( "ma27_liw_init_factor", "Integer workspace memory for MA27.", 1.0, false, 5.0, "The initial integer workspace memory = liw_init_factor * memory required by unfactored system. " - "Ipopt will increase the workspace size by meminc_factor if required. " - "This option is only available if Ipopt has been compiled with MA27."); + "Ipopt will increase the workspace size by ma27_meminc_factor if required."); roptions->AddLowerBoundedNumberOption( "ma27_la_init_factor", "Real workspace memory for MA27.", 1.0, false, 5.0, "The initial real workspace memory = la_init_factor * memory required by unfactored system. " - "Ipopt will increase the workspace size by meminc_factor if required. " - "This option is only available if Ipopt has been compiled with MA27."); + "Ipopt will increase the workspace size by ma27_meminc_factor if required."); roptions->AddLowerBoundedNumberOption( "ma27_meminc_factor", "Increment factor for workspace size for MA27.", 1.0, false, 2.0, - "If the integer or real workspace is not large enough, Ipopt will increase its size by this factor. " - "This option is only available if Ipopt has been compiled with MA27."); - roptions->AddStringOption2( + "If the integer or real workspace is not large enough, Ipopt will increase its size by this factor."); + roptions->AddBoolOption( "ma27_skip_inertia_check", - "Always pretend inertia is correct.", - "no", - "no", "check inertia", - "yes", "skip inertia check", + "Whether to always pretend that inertia is correct.", + false, "Setting this option to \"yes\" essentially disables inertia check. " - "This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control."); - roptions->AddStringOption2( + "This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control.", + true); + roptions->AddBoolOption( "ma27_ignore_singularity", - "Enables MA27's ability to solve a linear system even if the matrix is singular.", - "no", - "no", "Don't have MA27 solve singular systems", - "yes", "Have MA27 solve singular systems", + "Whether to use MA27's ability to solve a linear system even if the matrix is singular.", + false, "Setting this option to \"yes\" means that Ipopt will call MA27 to compute solutions for right hand sides, " "even if MA27 has detected that the matrix is singular (but is still able to solve the linear system). " - "In some cases this might be better than using Ipopt's heuristic of small perturbation of the lower diagonal of the KKT matrix."); + "In some cases this might be better than using Ipopt's heuristic of small perturbation of the lower diagonal of the KKT matrix.", + true); +} + +void Ma27TSolverInterface::SetFunctions( + IPOPT_DECL_MA27A(*ma27a), + IPOPT_DECL_MA27B(*ma27b), + IPOPT_DECL_MA27C(*ma27c), + IPOPT_DECL_MA27I(*ma27i) +) +{ + DBG_ASSERT(ma27a != NULL); + DBG_ASSERT(ma27b != NULL); + DBG_ASSERT(ma27c != NULL); + DBG_ASSERT(ma27i != NULL); + + user_ma27a = ma27a; + user_ma27b = ma27b; + user_ma27c = ma27c; + user_ma27i = ma27i; } bool Ma27TSolverInterface::InitializeImpl( @@ -178,6 +163,37 @@ bool Ma27TSolverInterface::InitializeImpl( const std::string& prefix ) { + if( user_ma27a != NULL ) + { + // someone set MA27 functions via setFunctions - prefer these + ma27a = user_ma27a; + ma27b = user_ma27b; + ma27c = user_ma27c; + ma27i = user_ma27i; + } + else + { +#if (defined(COINHSL_HAS_MA27) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA27S) && defined(IPOPT_SINGLE)) + // use HSL functions that should be available in linked HSL library + ma27a = &::IPOPT_HSL_FUNCP(ma27a, MA27A); + ma27b = &::IPOPT_HSL_FUNCP(ma27b, MA27B); + ma27c = &::IPOPT_HSL_FUNCP(ma27c, MA27C); + ma27i = &::IPOPT_HSL_FUNCP(ma27i, MA27I); +#else + DBG_ASSERT(IsValid(hslloader)); + + ma27a = (IPOPT_DECL_MA27A(*))hslloader->loadSymbol("ma27a" HSLFUNCNAMESUFFIX); + ma27b = (IPOPT_DECL_MA27B(*))hslloader->loadSymbol("ma27b" HSLFUNCNAMESUFFIX); + ma27c = (IPOPT_DECL_MA27C(*))hslloader->loadSymbol("ma27c" HSLFUNCNAMESUFFIX); + ma27i = (IPOPT_DECL_MA27I(*))hslloader->loadSymbol("ma27i" HSLFUNCNAMESUFFIX); +#endif + } + + DBG_ASSERT(ma27a != NULL); + DBG_ASSERT(ma27b != NULL); + DBG_ASSERT(ma27c != NULL); + DBG_ASSERT(ma27i != NULL); + options.GetNumericValue("ma27_pivtol", pivtol_, prefix); if( options.GetNumericValue("ma27_pivtolmax", pivtolmax_, prefix) ) { @@ -189,6 +205,8 @@ bool Ma27TSolverInterface::InitializeImpl( pivtolmax_ = Max(pivtolmax_, pivtol_); } + Index print_level; + options.GetIntegerValue("ma27_print_level", print_level, prefix); options.GetNumericValue("ma27_liw_init_factor", liw_init_factor_, prefix); options.GetNumericValue("ma27_la_init_factor", la_init_factor_, prefix); options.GetNumericValue("ma27_meminc_factor", meminc_factor_, prefix); @@ -198,12 +216,20 @@ bool Ma27TSolverInterface::InitializeImpl( options.GetBoolValue("warm_start_same_structure", warm_start_same_structure_, prefix); /* Set the default options for MA27 */ - IPOPT_HSL_FUNC(ma27id, MA27ID)(icntl_, cntl_); -#if IPOPT_VERBOSITY == 0 + ma27i(icntl_, cntl_); - icntl_[0] = 0; // Suppress error messages - icntl_[1] = 0; // Suppress diagnostic messages -#endif + if( print_level == 0 ) + { + icntl_[0] = 0; // Suppress error messages + } + if( print_level <= 1 ) + { + icntl_[1] = 0; // Suppress warning messages + } + if( print_level >= 2 ) + { + icntl_[2] = print_level - 2; // diagnostic messages level + } // Reset all private data initialized_ = false; @@ -232,7 +258,7 @@ ESymSolverStatus Ma27TSolverInterface::MultiSolve( const Index* airn, const Index* ajcn, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ) @@ -276,7 +302,7 @@ ESymSolverStatus Ma27TSolverInterface::MultiSolve( return Backsolve(nrhs, rhs_vals); } -double* Ma27TSolverInterface::GetValuesArrayPtr() +Number* Ma27TSolverInterface::GetValuesArrayPtr() { DBG_START_METH("Ma27TSolverInterface::GetValuesArrayPtr", dbg_verbosity); DBG_ASSERT(initialized_); @@ -289,7 +315,7 @@ double* Ma27TSolverInterface::GetValuesArrayPtr() { delete[] a_; a_ = NULL; - a_ = new double[nonzeros_]; + a_ = new Number[nonzeros_]; } return a_; @@ -346,21 +372,29 @@ ESymSolverStatus Ma27TSolverInterface::SymbolicFactorization( iw_ = NULL; // Overestimation factor for LIW (20% recommended in MA27 documentation) - const double LiwFact = 2.0; // This is 100% overestimation + const Number LiwFact = 2.0; // This is 100% overestimation Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "In Ma27TSolverInterface::InitializeStructure: Using overestimation factor LiwFact = %e\n", LiwFact); - liw_ = (ipfint) (LiwFact * (double(2 * nonzeros_ + 3 * dim_ + 1))); - iw_ = new ipfint[liw_]; + liw_ = (Index) (LiwFact * (Number(2 * nonzeros_ + 3 * dim_ + 1))); + try + { + iw_ = new Index[liw_]; + } + catch( const std::bad_alloc& ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "Failed to allocate initial working space (iw_) for MA27\n"); + throw; // will be caught in IpIpoptApplication + } // Get memory for IKEEP delete[] ikeep_; ikeep_ = NULL; - ikeep_ = new ipfint[3 * dim_]; + ikeep_ = new Index[3 * dim_]; if( Jnlst().ProduceOutput(J_MOREMATRIX, J_LINEAR_ALGEBRA) ) { Jnlst().Printf(J_MOREMATRIX, J_LINEAR_ALGEBRA, - "\nMatrix structure given to MA27 with dimension %d and %d nonzero entries:\n", dim_, nonzeros_); + "\nMatrix structure given to MA27 with dimension %" IPOPT_INDEX_FORMAT " and %" IPOPT_INDEX_FORMAT " nonzero entries:\n", dim_, nonzeros_); for( Index i = 0; i < nonzeros_; i++ ) { Jnlst().Printf(J_MOREMATRIX, J_LINEAR_ALGEBRA, @@ -368,30 +402,30 @@ ESymSolverStatus Ma27TSolverInterface::SymbolicFactorization( } } - // Call MA27AD (cast to ipfint for Index types) - ipfint N = dim_; - ipfint NZ = nonzeros_; - ipfint IFLAG = 0; - double OPS; - ipfint INFO[20]; - ipfint* IW1 = new ipfint[2 * dim_]; // Get memory for IW1 (only local) - IPOPT_HSL_FUNC(ma27ad, MA27AD)(&N, &NZ, airn, ajcn, iw_, &liw_, ikeep_, IW1, &nsteps_, &IFLAG, icntl_, cntl_, INFO, &OPS); + // Call MA27AX + Index N = dim_; + Index NZ = nonzeros_; + Index IFLAG = 0; + Number OPS; + Index INFO[20]; + Index* IW1 = new Index[2 * dim_]; // Get memory for IW1 (only local) + ma27a(&N, &NZ, airn, ajcn, iw_, &liw_, ikeep_, IW1, &nsteps_, &IFLAG, icntl_, cntl_, INFO, &OPS); delete[] IW1; // No longer required // Receive several information - const ipfint& iflag = INFO[0]; // Information flag - const ipfint& ierror = INFO[1]; // Error flag - const ipfint& nrlnec = INFO[4]; // recommended value for la - const ipfint& nirnec = INFO[5]; // recommended value for liw + const Index& iflag = INFO[0]; // Information flag + const Index& ierror = INFO[1]; // Error flag + const Index& nrlnec = INFO[4]; // recommended value for la + const Index& nirnec = INFO[5]; // recommended value for liw Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Return values from MA27AD: IFLAG = %d, IERROR = %d\n", iflag, ierror); + "Return values from MA27AD: IFLAG = %" IPOPT_INDEX_FORMAT ", IERROR = %" IPOPT_INDEX_FORMAT "\n", iflag, ierror); // Check if error occurred if( iflag != 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "*** Error from MA27AD *** IFLAG = %d IERROR = %d\n", iflag, ierror); + "*** Error from MA27AD *** IFLAG = %" IPOPT_INDEX_FORMAT " IERROR = %" IPOPT_INDEX_FORMAT "\n", iflag, ierror); if( iflag == 1 ) Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, "The index of a matrix is out of range.\nPlease check your implementation of the Jacobian and Hessian matrices.\n"); @@ -402,26 +436,33 @@ ESymSolverStatus Ma27TSolverInterface::SymbolicFactorization( return SYMSOLVER_FATAL_ERROR; } - // ToDo: try and catch - // Reserve memory for iw_ for later calls, based on suggested size - delete[] iw_; - iw_ = NULL; - Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Size of integer work space recommended by MA27 is %d\n", nirnec); - liw_ = (ipfint) (liw_init_factor_ * (double) (nirnec)); - Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Setting integer work space size to %d\n", liw_); - iw_ = new ipfint[liw_]; + try + { + // Reserve memory for iw_ for later calls, based on suggested size + delete[] iw_; + iw_ = NULL; + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Size of integer work space recommended by MA27 is %" IPOPT_INDEX_FORMAT "\n", nirnec); + ComputeMemIncrease(liw_, liw_init_factor_ * (Number) nirnec, 0, "integer working space for MA27"); + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Setting integer work space size to %" IPOPT_INDEX_FORMAT "\n", liw_); + iw_ = new Index[liw_]; - // Reserve memory for a_ - delete[] a_; - a_ = NULL; - Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Size of doublespace recommended by MA27 is %d\n", nrlnec); - la_ = Max(nonzeros_, (ipfint) (la_init_factor_ * (double) (nrlnec))); - Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Setting double work space size to %d\n", la_); - a_ = new double[la_]; + // Reserve memory for a_ + delete[] a_; + a_ = NULL; + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Size of doublespace recommended by MA27 is %" IPOPT_INDEX_FORMAT "\n", nrlnec); + ComputeMemIncrease(la_, la_init_factor_ * (Number) nrlnec, nonzeros_, "double working space for MA27"); + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Setting double work space size to %" IPOPT_INDEX_FORMAT "\n", la_); + a_ = new Number[la_]; + } + catch( const std::bad_alloc& ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "Failed to allocate more working space for MA27\n"); + throw; // will be caught in IpIpoptApplication + } if( HaveIpData() ) { @@ -448,18 +489,26 @@ ESymSolverStatus Ma27TSolverInterface::Factorization( if( la_increase_ ) { - double* a_old = a_; - ipfint la_old = la_; - la_ = (ipfint) (meminc_factor_ * (double) (la_)); - a_ = new double[la_]; + Number* a_old = a_; + Index la_old = la_; + ComputeMemIncrease(la_, meminc_factor_ * (Number) la_, 0, "double working space for MA27"); + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "In Ma27TSolverInterface::Factorization: Increasing la from %" IPOPT_INDEX_FORMAT " to %" IPOPT_INDEX_FORMAT "\n", la_old, la_); + try + { + a_ = new Number[la_]; + } + catch( const std::bad_alloc& ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "Failed to allocate more working space (a_) for MA27\n"); + throw; // will be caught in IpIpoptApplication + } for( Index i = 0; i < nonzeros_; i++ ) { a_[i] = a_old[i]; } delete[] a_old; la_increase_ = false; - Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "In Ma27TSolverInterface::Factorization: Increasing la from %d to %d\n", la_old, la_); } // Check if liw should be increased @@ -467,40 +516,47 @@ ESymSolverStatus Ma27TSolverInterface::Factorization( { delete[] iw_; iw_ = NULL; - ipfint liw_old = liw_; - liw_ = (ipfint) (meminc_factor_ * (double) (liw_)); - iw_ = new ipfint[liw_]; - liw_increase_ = false; + Index liw_old = liw_; + ComputeMemIncrease(liw_, meminc_factor_ * (Number) liw_, 0, "integer working space for MA27"); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "In Ma27TSolverInterface::Factorization: Increasing liw from %d to %d\n", liw_old, liw_); + "In Ma27TSolverInterface::Factorization: Increasing liw from %" IPOPT_INDEX_FORMAT " to %" IPOPT_INDEX_FORMAT "\n", liw_old, liw_); + try + { + iw_ = new Index[liw_]; + } + catch( const std::bad_alloc& ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "Failed to allocate more working space (iw_) for MA27\n"); + throw; // will be caught in IpIpoptApplication + } + liw_increase_ = false; } - ipfint iflag; // Information flag - ipfint ncmpbr; // Number of double precision compressions - ipfint ncmpbi; // Number of integer compressions + Index iflag; // Information flag + Index ncmpbr; // Number of double precision compressions + Index ncmpbi; // Number of integer compressions - // Call MA27BD; possibly repeatedly if workspaces are too small - ipfint N = dim_; - ipfint NZ = nonzeros_; - ipfint* IW1 = new ipfint[2 * dim_]; - ipfint INFO[20]; + // Call MA27BX; possibly repeatedly if workspaces are too small + Index N = dim_; + Index NZ = nonzeros_; + Index* IW1 = new Index[2 * dim_]; + Index INFO[20]; cntl_[0] = pivtol_; // Set pivot tolerance - IPOPT_HSL_FUNC(ma27bd, MA27BD)(&N, &NZ, airn, ajcn, a_, &la_, iw_, &liw_, ikeep_, &nsteps_, &maxfrt_, IW1, icntl_, cntl_, - INFO); + ma27b(&N, &NZ, airn, ajcn, a_, &la_, iw_, &liw_, ikeep_, &nsteps_, &maxfrt_, IW1, icntl_, cntl_, INFO); delete[] IW1; // Receive information about the factorization iflag = INFO[0]; // Information flag - const ipfint& ierror = INFO[1]; // Error flag + const Index& ierror = INFO[1]; // Error flag ncmpbr = INFO[11]; // Number of double compressions ncmpbi = INFO[12]; // Number of integer compressions negevals_ = INFO[14]; // Number of negative eigenvalues Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Return values from MA27BD: IFLAG = %d, IERROR = %d\n", iflag, ierror); + "Return values from MA27BD: IFLAG = %" IPOPT_INDEX_FORMAT ", IERROR = %" IPOPT_INDEX_FORMAT "\n", iflag, ierror); - DBG_PRINT((1, "Return from MA27BD iflag = %d and ierror = %d\n", + DBG_PRINT((1, "Return from MA27BD iflag = %" IPOPT_INDEX_FORMAT " and ierror = %" IPOPT_INDEX_FORMAT "\n", iflag, ierror)); // Check if factorization failed due to insufficient memory space @@ -513,23 +569,31 @@ ESymSolverStatus Ma27TSolverInterface::Factorization( iw_ = NULL; delete[] a_; a_ = NULL; - ipfint liw_old = liw_; - ipfint la_old = la_; + Index liw_old = liw_; + Index la_old = la_; if( iflag == -3 ) { - liw_ = (ipfint) (meminc_factor_ * (double) (ierror)); - la_ = (ipfint) (meminc_factor_ * (double) (la_)); + ComputeMemIncrease(liw_, meminc_factor_ * (Number) ierror, 0, "integer working space for MA27"); + ComputeMemIncrease(la_, meminc_factor_ * (Number) la_, 0, "double working space for MA27"); } else { - liw_ = (ipfint) (meminc_factor_ * (double) (liw_)); - la_ = (ipfint) (meminc_factor_ * (double) (ierror)); + ComputeMemIncrease(liw_, meminc_factor_ * (Number) liw_, 0, "integer working space for MA27"); + ComputeMemIncrease(la_, meminc_factor_ * (Number) ierror, 0, "double working space for MA27"); } - iw_ = new ipfint[liw_]; - a_ = new double[la_]; Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "MA27BD returned iflag=%d and requires more memory.\n Increase liw from %d to %d and la from %d to %d and factorize again.\n", + "MA27BD returned iflag=%" IPOPT_INDEX_FORMAT " and requires more memory.\n Increase liw from %" IPOPT_INDEX_FORMAT " to %" IPOPT_INDEX_FORMAT " and la from %" IPOPT_INDEX_FORMAT " to %" IPOPT_INDEX_FORMAT " and factorize again.\n", iflag, liw_old, liw_, la_old, la_); + try + { + iw_ = new Index[liw_]; + a_ = new Number[la_]; + } + catch( const std::bad_alloc& ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "Failed to allocate more working space (iw_ and a_) for MA27\n"); + throw; // will be caught in IpIpoptApplication + } if( HaveIpData() ) { IpData().TimingStats().LinearSystemFactorization().End(); @@ -550,7 +614,7 @@ ESymSolverStatus Ma27TSolverInterface::Factorization( { Index missing_rank = dim_ - INFO[1]; Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "MA27BD returned iflag=%d and detected rank deficiency of degree %d.\n", iflag, missing_rank); + "MA27BD returned iflag=%" IPOPT_INDEX_FORMAT " and detected rank deficiency of degree %" IPOPT_INDEX_FORMAT ".\n", iflag, missing_rank); // We correct the number of negative eigenvalues here to include // the zero eigenvalues, since otherwise we indicate the wrong // inertia. @@ -572,19 +636,19 @@ ESymSolverStatus Ma27TSolverInterface::Factorization( { la_increase_ = true; Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "MA27BD returned ncmpbr=%d. Increase la before the next factorization.\n", ncmpbr); + "MA27BD returned ncmpbr=%" IPOPT_INDEX_FORMAT ". Increase la before the next factorization.\n", ncmpbr); } if( ncmpbi >= 10 ) { liw_increase_ = true; Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "MA27BD returned ncmpbi=%d. Increase liw before the next factorization.\n", ncmpbr); + "MA27BD returned ncmpbi=%" IPOPT_INDEX_FORMAT ". Increase liw before the next factorization.\n", ncmpbr); } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of doubles for MA27 to hold factorization (INFO(9)) = %d\n", INFO[8]); + "Number of doubles for MA27 to hold factorization (INFO(9)) = %" IPOPT_INDEX_FORMAT "\n", INFO[8]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of integers for MA27 to hold factorization (INFO(10)) = %d\n", INFO[9]); + "Number of integers for MA27 to hold factorization (INFO(10)) = %" IPOPT_INDEX_FORMAT "\n", INFO[9]); // Check whether the number of negative eigenvalues matches the requested // count @@ -595,7 +659,7 @@ ESymSolverStatus Ma27TSolverInterface::Factorization( if( !skip_inertia_check_ && check_NegEVals && (numberOfNegEVals != negevals_) ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "In Ma27TSolverInterface::Factorization: negevals_ = %d, but numberOfNegEVals = %d\n", negevals_, + "In Ma27TSolverInterface::Factorization: negevals_ = %" IPOPT_INDEX_FORMAT ", but numberOfNegEVals = %" IPOPT_INDEX_FORMAT "\n", negevals_, numberOfNegEVals); return SYMSOLVER_WRONG_INERTIA; } @@ -605,7 +669,7 @@ ESymSolverStatus Ma27TSolverInterface::Factorization( ESymSolverStatus Ma27TSolverInterface::Backsolve( Index nrhs, - double* rhs_vals + Number* rhs_vals ) { DBG_START_METH("Ma27TSolverInterface::Backsolve", dbg_verbosity); @@ -614,11 +678,11 @@ ESymSolverStatus Ma27TSolverInterface::Backsolve( IpData().TimingStats().LinearSystemBackSolve().Start(); } - ipfint N = dim_; - double* W = new double[maxfrt_]; - ipfint* IW1 = new ipfint[nsteps_]; + Index N = dim_; + Number* W = new Number[maxfrt_]; + Index* IW1 = new Index[nsteps_]; - // For each right hand side, call MA27CD + // For each right hand side, call MA27CX for( Index irhs = 0; irhs < nrhs; irhs++ ) { if( DBG_VERBOSITY() >= 2 ) @@ -628,10 +692,7 @@ ESymSolverStatus Ma27TSolverInterface::Backsolve( DBG_PRINT((2, "rhs[%5d] = %23.15e\n", i, rhs_vals[irhs * dim_ + i])); } } - - IPOPT_HSL_FUNC(ma27cd, MA27CD)(&N, a_, &la_, iw_, &liw_, W, &maxfrt_, &rhs_vals[irhs * dim_], IW1, &nsteps_, icntl_, - cntl_); - + ma27c(&N, a_, &la_, iw_, &liw_, W, &maxfrt_, &rhs_vals[irhs * dim_], IW1, &nsteps_, icntl_, cntl_); if( DBG_VERBOSITY() >= 2 ) { for( Index i = 0; i < dim_; i++ ) @@ -671,12 +732,10 @@ bool Ma27TSolverInterface::IncreaseQuality() Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Increasing pivot tolerance for MA27 from %7.2e ", pivtol_); - pivtol_ = Min(pivtolmax_, pow(pivtol_, 0.75)); + pivtol_ = Min(pivtolmax_, std::pow(pivtol_, Number(0.75))); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "to %7.2e.\n", pivtol_); return true; } } // namespace Ipopt - -#endif /* COINHSL_HAS_MA27 or IPOPT_HAS_LINEARSOLVERLOADER */ diff --git a/src/Algorithm/LinearSolvers/IpMa27TSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpMa27TSolverInterface.hpp index 8a951e778..177c5d4d8 100644 --- a/src/Algorithm/LinearSolvers/IpMa27TSolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpMa27TSolverInterface.hpp @@ -8,6 +8,67 @@ #define __IPMA27TSOLVERINTERFACE_HPP__ #include "IpSparseSymLinearSolverInterface.hpp" +#include "IpLibraryLoader.hpp" +#include "IpTypes.h" + +/// @since 3.14.0 +#define IPOPT_DECL_MA27A(x) void (x)( \ + ipindex* N, \ + ipindex* NZ, \ + const ipindex* IRN, \ + const ipindex* ICN, \ + ipindex* IW, \ + ipindex* LIW, \ + ipindex* IKEEP, \ + ipindex* IW1, \ + ipindex* NSTEPS,\ + ipindex* IFLAG, \ + ipindex* ICNTL, \ + ipnumber* CNTL, \ + ipindex* INFO, \ + ipnumber* OPS \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA27B(x) void (x)( \ + ipindex* N, \ + ipindex* NZ, \ + const ipindex* IRN, \ + const ipindex* ICN, \ + ipnumber* A, \ + ipindex* LA, \ + ipindex* IW, \ + ipindex* LIW, \ + ipindex* IKEEP, \ + ipindex* NSTEPS, \ + ipindex* MAXFRT, \ + ipindex* IW1, \ + ipindex* ICNTL, \ + ipnumber* CNTL, \ + ipindex* INFO \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA27C(x) void (x)( \ + ipindex* N, \ + ipnumber* A, \ + ipindex* LA, \ + ipindex* IW, \ + ipindex* LIW, \ + ipnumber* W, \ + ipindex* MAXFRT, \ + ipnumber* RHS, \ + ipindex* IW1, \ + ipindex* NSTEPS, \ + ipindex* ICNTL, \ + ipnumber* CNTL \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA27I(x) void (x)( \ + ipindex* ICNTL, \ + ipnumber* CNTL \ +) namespace Ipopt { @@ -18,13 +79,15 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor */ - Ma27TSolverInterface(); + Ma27TSolverInterface( + SmartPtr hslloader_ ///< @since 3.14.0 + ); /** Destructor */ virtual ~Ma27TSolverInterface(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -32,7 +95,7 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ virtual ESymSolverStatus InitializeStructure( Index dim, Index nonzeros, @@ -40,22 +103,22 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface const Index* ajcn ); - virtual double* GetValuesArrayPtr(); + virtual Number* GetValuesArrayPtr(); virtual ESymSolverStatus MultiSolve( bool new_matrix, const Index* airn, const Index* ajcn, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals); virtual Index NumberOfNegEVals() const; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ virtual bool IncreaseQuality(); virtual bool ProvidesInertia() const @@ -67,13 +130,22 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface { return Triplet_Format; } - //@} + ///@} - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} + + /// set MA27 functions to use for every instantiation of this class + /// @since 3.14.0 + static void SetFunctions( + IPOPT_DECL_MA27A(*ma27a), + IPOPT_DECL_MA27B(*ma27b), + IPOPT_DECL_MA27C(*ma27c), + IPOPT_DECL_MA27I(*ma27i) + ); private: /**@name Default Compiler Generated Methods @@ -83,7 +155,7 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface * them for us, so we declare them private * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ Ma27TSolverInterface( const Ma27TSolverInterface& @@ -93,25 +165,36 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface void operator=( const Ma27TSolverInterface& ); - //@} + ///@} + + /**@name MA27 function pointers + * @{ + */ + SmartPtr hslloader; + + IPOPT_DECL_MA27A(*ma27a); + IPOPT_DECL_MA27B(*ma27b); + IPOPT_DECL_MA27C(*ma27c); + IPOPT_DECL_MA27I(*ma27i); + ///@} /** @name Information about the matrix */ - //@{ + ///@{ /** Number of rows and columns of the matrix */ Index dim_; /** Number of nonzeros of the matrix */ Index nonzeros_; - //@} + ///@} /** @name Information about most recent factorization/solve */ - //@{ + ///@{ /** Number of negative eigenvalues */ Index negevals_; - //@} + ///@} /** @name Initialization flags */ - //@{ + ///@{ /** Flag indicating if internal data is initialized. * * For initialization, this object needs to have seen a matrix. @@ -126,10 +209,10 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface * again. */ bool refactorize_; - //@} + ///@} /** @name Solver specific data/options */ - //@{ + ///@{ /** Pivot tolerance */ Number pivtol_; @@ -152,43 +235,43 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface * is detected, but right hands sides are still accepted. */ bool ignore_singularity_; - //@} + ///@} /** @name Data for the linear solver. * Storing factorization and other solver specific data structure. */ - //@{ + ///@{ /** integer control values */ - ipfint icntl_[30]; + Index icntl_[30]; /** real control values */ - double cntl_[5]; + Number cntl_[5]; /** length of integer work space */ - ipfint liw_; + Index liw_; /** integer work space */ - ipfint* iw_; + Index* iw_; /** MA27's IKEEP */ - ipfint* ikeep_; + Index* ikeep_; /** MA27's NSTEPS */ - ipfint nsteps_; + Index nsteps_; /** MA27's MAXFRT */ - ipfint maxfrt_; + Index maxfrt_; /** length LA of A */ - ipfint la_; + Index la_; /** factor A of matrix */ - double* a_; + Number* a_; /** flag indicating that la should be increased before next factorization */ bool la_increase_; /** flag indicating that liw should be increased before next factorization */ bool liw_increase_; - //@} + ///@} /** @name Internal functions */ - //@{ - /** Call MA27AD and reserve memory for MA27 data. + ///@{ + /** Call MA27AX and reserve memory for MA27 data. * * Reserve memory for iw_ and ikeep_, call MA27AD to perform * symbolic manipulations, and reserve all the remaining data memory @@ -198,7 +281,7 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface const Index* ajcn ); - /** Call MA27BD to factorize the Matrix. + /** Call MA27BX to factorize the Matrix. * * It is assumed that the first nonzeros_ element of a_ contain the values * of the matrix to be factorized. @@ -210,12 +293,12 @@ class Ma27TSolverInterface: public SparseSymLinearSolverInterface Index numberOfNegEVals ); - /** Call MA27CD to do the backsolve. */ + /** Call MA27CX to do the backsolve. */ ESymSolverStatus Backsolve( Index nrhs, - double* rhs_vals + Number* rhs_vals ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpMa28Partition.F b/src/Algorithm/LinearSolvers/IpMa28Partition.F index 6b9f189b0..c3bdc5267 100644 --- a/src/Algorithm/LinearSolvers/IpMa28Partition.F +++ b/src/Algorithm/LinearSolvers/IpMa28Partition.F @@ -14,13 +14,11 @@ subroutine MA28PART(TASK, N, M, NZ, A, IROW, ICOL, PIVTOL, C C******************************************************************************* C -C $Id$ -C C------------------------------------------------------------------------------- C Title C------------------------------------------------------------------------------- C -CT Interface to MA28 for detecting degenerate constraints +CT Interface to MA28 double precision for detecting degenerate constraints C C------------------------------------------------------------------------------- C Programm description diff --git a/src/Algorithm/LinearSolvers/IpMa28TDependencyDetector.cpp b/src/Algorithm/LinearSolvers/IpMa28TDependencyDetector.cpp index 97ba15bc0..5d7c0272c 100644 --- a/src/Algorithm/LinearSolvers/IpMa28TDependencyDetector.cpp +++ b/src/Algorithm/LinearSolvers/IpMa28TDependencyDetector.cpp @@ -5,13 +5,14 @@ // Authors: Andreas Waechter IBM 2007-04-17 #include "IpoptConfig.h" +#include "IpTypes.h" #ifdef IPOPT_HAS_HSL #include "CoinHslConfig.h" #endif -// if we have MA28 in HSL or the linear solver loader, then we want to build the MA28 interface -#if defined(COINHSL_HAS_MA28) && defined(F77_FUNC) +// if we have MA28 in HSL and can compile Fortran code, then we want to build the MA28 interface +#if ((defined(COINHSL_HAS_MA28) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA28S) && defined(IPOPT_SINGLE))) && defined(F77_FUNC) #include "IpMa28TDependencyDetector.hpp" @@ -20,23 +21,23 @@ extern "C" { void F77_FUNC(ma28part, MA28PART)( - ipfint* TASK, - ipfint* N, - ipfint* M, - ipfint* NZ, - double* A, - ipfint* IROW, - ipfint* ICOL, - double* PIVTOL, - ipfint* FILLFACT, - ipfint* IVAR, - ipfint* NDEGEN, - ipfint* IDEGEN, - ipfint* LIW, - ipfint* IW, - ipfint* LRW, - double* RW, - ipfint* IERR + ipindex* TASK, + ipindex* N, + ipindex* M, + ipindex* NZ, + ipnumber* A, + ipindex* IROW, + ipindex* ICOL, + ipnumber* PIVTOL, + ipindex* FILLFACT, + ipindex* IVAR, + ipindex* NDEGEN, + ipindex* IDEGEN, + ipindex* LIW, + ipindex* IW, + ipindex* LRW, + ipnumber* RW, + ipindex* IERR ); } @@ -58,8 +59,7 @@ void Ma28TDependencyDetector::RegisterOptions( "Pivot tolerance for linear solver MA28.", 0.0, true, 1., false, - 0.01, - "This is used when MA28 tries to find the dependent constraints."); + 0.01); } bool Ma28TDependencyDetector::InitializeImpl( @@ -84,33 +84,31 @@ bool Ma28TDependencyDetector::DetermineDependentRows( DBG_START_METH("Ma28TDependencyDetector::DetermineDependentRows", dbg_verbosity); - DBG_ASSERT(sizeof(ipfint) == sizeof(Index)); - c_deps.clear(); // Now comes the interesting part: // Call Ma28 to get the dependencies - ipfint TASK = 0; - ipfint N = n_cols; - ipfint M = n_rows; - ipfint NZ = n_jac_nz; - double PIVTOL = ma28_pivtol_; - ipfint FILLFACT = 40; - ipfint* IVAR; - ipfint NDEGEN; - ipfint* IDEGEN; - ipfint LRW; - ipfint LIW; - double ddummy; - ipfint idummy; - ipfint IERR; + Index TASK = 0; + Index N = n_cols; + Index M = n_rows; + Index NZ = n_jac_nz; + Number PIVTOL = ma28_pivtol_; + Index FILLFACT = 40; + Index* IVAR; + Index NDEGEN; + Index* IDEGEN; + Index LRW; + Index LIW; + Number ddummy; + Index idummy; + Index IERR; // First determine how much work space we need to allocate - IVAR = new ipfint[N]; - IDEGEN = new ipfint[M]; + IVAR = new Index[N]; + IDEGEN = new Index[M]; F77_FUNC(ma28part, MA28PART)(&TASK, &N, &M, &NZ, &ddummy, jac_c_iRow, jac_c_jCol, &PIVTOL, &FILLFACT, IVAR, &NDEGEN, IDEGEN, &LIW, &idummy, &LRW, &ddummy, &IERR); - ipfint* IW = new ipfint[LIW]; - double* RW = new double[LRW]; + Index* IW = new Index[LIW]; + Number* RW = new Number[LRW]; // Now do the actual factorization and determine dependent constraints TASK = 1; @@ -122,7 +120,7 @@ bool Ma28TDependencyDetector::DetermineDependentRows( if( IERR != 0 ) { jnlst_->Printf(J_WARNING, J_INITIALIZATION, - "MA28 returns IERR = %d when trying to determine dependent constraints\n", IERR); + "MA28 returns IERR = %" IPOPT_INDEX_FORMAT " when trying to determine dependent constraints\n", IERR); delete[] IDEGEN; return false; } @@ -139,4 +137,4 @@ bool Ma28TDependencyDetector::DetermineDependentRows( } // namespace Ipopt -#endif /* COINHSL_HAS_MA28 */ +#endif /* COINHSL_HAS_MA28(s) */ diff --git a/src/Algorithm/LinearSolvers/IpMa28TDependencyDetector.hpp b/src/Algorithm/LinearSolvers/IpMa28TDependencyDetector.hpp index e9f1b4c71..be6bfdfc9 100644 --- a/src/Algorithm/LinearSolvers/IpMa28TDependencyDetector.hpp +++ b/src/Algorithm/LinearSolvers/IpMa28TDependencyDetector.hpp @@ -16,12 +16,12 @@ class Ma28TDependencyDetector: public TDependencyDetector { public: /** @name Constructor/Destructor */ - //@{ + ///@{ Ma28TDependencyDetector(); virtual ~Ma28TDependencyDetector() { } - //@} + ///@} /** Has to be called to initialize and reset these objects. */ virtual bool InitializeImpl( @@ -63,7 +63,7 @@ class Ma28TDependencyDetector: public TDependencyDetector * them for us, so we declare them private * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ Ma28TDependencyDetector( const Ma28TDependencyDetector& @@ -73,15 +73,15 @@ class Ma28TDependencyDetector: public TDependencyDetector void operator=( const Ma28TDependencyDetector& ); - //@} + ///@} SmartPtr jnlst_; /** @name Algorithmic parameters */ - //@{ + ///@{ /** Pivot tolerance for MA28 */ Number ma28_pivtol_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpMa28sPartition.F b/src/Algorithm/LinearSolvers/IpMa28sPartition.F new file mode 100644 index 000000000..c062f754f --- /dev/null +++ b/src/Algorithm/LinearSolvers/IpMa28sPartition.F @@ -0,0 +1,262 @@ +C Copyright (C) 2002, 2007 Carnegie Mellon University and others. +C All Rights Reserved. +C This code is published under the Eclipse Public License. +C +C This code is based on the file Ipopt/IPOPT/ipopt/ma28_call.F in the +C Ipopt 2.2.1e distribution. +C +C This code provides an interface to MA28. Since Fortran COMMON blocks +C might be difficult to access from C++, we write this interface in Fortran +C and not C. +C + subroutine MA28PART(TASK, N, M, NZ, A, IROW, ICOL, PIVTOL, + 1 FILLFACT, IVAR, NDEGEN, IDEGEN, LIW, IW, LRW, RW, IERR) +C +C******************************************************************************* +C +C------------------------------------------------------------------------------- +C Title +C------------------------------------------------------------------------------- +C +CT Interface to MA28 single precision for detecting degenerate constraints +C +C------------------------------------------------------------------------------- +C Programm description +C------------------------------------------------------------------------------- +C +CB +C +C------------------------------------------------------------------------------- +C Author, date +C------------------------------------------------------------------------------- +C +CA Andreas Waechter 30/01/07 Based on Ipopt/IPOPT/ipopt/ma28_call.F +CA in the Ipopt 2.2.1e distribution. +C +C------------------------------------------------------------------------------- +C Documentation +C------------------------------------------------------------------------------- +C +CD +C +C------------------------------------------------------------------------------- +C Parameter list +C------------------------------------------------------------------------------- +C +C Name I/O Type Meaning +C +CP TASK I INT information about what to do: +CP =0: initialize, tell LIW, LRW +CP =1: factorize nonsquare matrix in order to +CP get partition into dependent and independent +CP variables and find dependent constraints +CP N I INT total number of variables (only TASK = 0,1) +CP M I INT number of constraints = number of depentent vars +CP NZ I INT number of nonzero elements in A +CP A I R TASK =1,2: nonzero elements of matrix +CP (unchanged on exit) +CP (note: NZ is different for TASK=1 and others) +CP IROW I INT TASK =1,2: row indices for A (unchanged on exit) +CP ICOL I INT TASK =1,2: col indices for A (unchanged on exit) +CP PIVTOL I R pivot tolerance (e.g., 1.d-4 ?) +CP FILLFACT I INT estimated fillin factor (e.g. 40) +CP IVAR O INT TASK = 1: IVAR( 1,..,M) containts the indices of +CP a set of linear independent columns of A +CP IVAR(M+1,..,N) containts the indices of the +CP remaining column indices +CP NDEGEN O INT Number of linearly dependent constraints +CP IDEGEN O INT List of linearly dependent constraints +CP LIW I INT length of IW (Output for TASK = 0) +CP IW W INT integer work space +CP LRW I INT length of RW (Output for TASK = 0) +CP RW W R real work space +CP IERR O INT =0: everything OK +CP >0: Error occured; abort optimization +CP <0: Warning; message to user +C +C******************************************************************************* +C +C Declarations +C +C******************************************************************************* +C + IMPLICIT NONE +C +C------------------------------------------------------------------------------- +C Parameter list +C------------------------------------------------------------------------------- +C + integer TASK + integer N + integer M + integer NZ + real A(NZ) + integer IROW(NZ) + integer ICOL(NZ) + real PIVTOL + integer FILLFACT + integer IVAR(N) + integer NDEGEN + integer IDEGEN(*) + integer LRW + real RW(LRW) + integer LIW + integer IW(LIW) + integer IERR +C +C------------------------------------------------------------------------------- +C COMMON blocks +C------------------------------------------------------------------------------- +C + integer LP, MP, IRNCP, ICNCP, MINIRN, MINICN, IRANK + logical LBLOCK, GROW, ABORT1, ABORT2 + real EPS, RMIN, RESID + + COMMON/MA28E/LP, MP, LBLOCK, GROW + COMMON/MA28F/EPS, RMIN, RESID, IRNCP, ICNCP, MINIRN, MINICN, + * IRANK, ABORT1, ABORT2 +C +C------------------------------------------------------------------------------- +C Local varibales +C------------------------------------------------------------------------------- +C + integer LIRN, LICN, p_a, p_icn, p_ikeep + integer i, k, ii, l, j, iflag, nind, nsize + integer p_iwend, p_rwend, p_irn, p_iw, p_w +C +C******************************************************************************* +C +C Executable Statements +C +C******************************************************************************* +C + LICN = FILLFACT*NZ + LIRN = FILLFACT*NZ + + p_iwend = 0 + p_rwend = 0 + IERR = 0 +C +C Set MA28 COMMON block parameters +C + LBLOCK = .false. + ABORT1 = .true. + ABORT2 = .true. + +C Allow for more constraints than variables + nsize = MAX(N, M) + + goto (10, 100) TASK+1 + +C Wrong argument for TASK + IERR = -1 + return + +C------------------------------------------------------------------------------- +C Start: Compute work space requirement +C------------------------------------------------------------------------------- + 10 continue + +C Determine storage space + LRW = LICN + LIW = LICN + 5*nsize + +C TASK = 1 + LIW = LIW + LIRN + 8*nsize + LRW = LRW + nsize + +C------------------------------------------------------------------------------- +C End: Compute work space requirement +C------------------------------------------------------------------------------- + goto 9999 + +C------------------------------------------------------------------------------- +C Start: Partitioning +C------------------------------------------------------------------------------- + 100 continue + +C +C Get work space pointers +C + p_icn = p_iwend + p_ikeep = p_icn + LICN + p_irn = p_ikeep + 5*nsize + p_iw = p_irn + LIRN + p_iwend = p_iw + 8*nsize + + p_a = p_rwend + p_w = p_a + LICN + p_rwend = p_w + nsize + + if( p_rwend.gt.LRW ) then + IERR = 98 + goto 9999 + elseif( p_iwend.gt.LIW ) then + IERR = 99 + goto 9999 + endif +C +C Copy A, IROW, ICOL into work space (delete old factorization!) +C + call SCOPY(NZ, A, 1, RW(p_a+1) , 1) + do i = 1, NZ + IW(p_irn+i) = IROW(i) + IW(p_icn+i) = ICOL(i) + enddo +C +C Do the factorization +C + ABORT1 = .false. + ABORT2 = .false. + + call MA28A(nsize, NZ, RW(p_a+1), LICN, IW(p_irn+1), LIRN, + 1 IW(p_icn+1), PIVTOL, IW(p_ikeep+1), IW(p_iw+1), + 1 RW(p_w+1), iflag) + if( iflag.lt.0 ) then + IERR = 514 + goto 9999 + endif +C +C Get the partitioning out of IKEEP +C + k = 0 + do i = 1, N + ii = IW(p_ikeep+2*N+i) + if( ii.lt.0 ) then +C indepentent variable + k = k + 1 + IW(p_ikeep+k) = -ii + endif + enddo + nind = N - M + if( k.gt.nind ) then +C get the dependent constraints + NDEGEN = k-nind + do i = 1, NDEGEN + IDEGEN(i) = IW(p_ikeep+N+M-NDEGEN+i) + enddo + else + NDEGEN = 0 + endif + k = M + l = 0 + do i = 1, N + do j = 1, nind + if( i.eq.IW(p_ikeep+j) ) then + k = k + 1 + IVAR(k) = i + goto 110 + endif + enddo + l = l + 1 + IVAR(l) = i + 110 continue + enddo +C------------------------------------------------------------------------------- +C End: Partitioning +C------------------------------------------------------------------------------- + goto 9999 + + 9999 continue + return + end diff --git a/src/Algorithm/LinearSolvers/IpMa57TSolverInterface.cpp b/src/Algorithm/LinearSolvers/IpMa57TSolverInterface.cpp index 83b7d935c..ffe81ffa9 100644 --- a/src/Algorithm/LinearSolvers/IpMa57TSolverInterface.cpp +++ b/src/Algorithm/LinearSolvers/IpMa57TSolverInterface.cpp @@ -6,105 +6,38 @@ // original version (based on MA27TSolverInterface.cpp) #include "IpoptConfig.h" +#include "IpMa57TSolverInterface.hpp" + +#include +#include #ifdef IPOPT_HAS_HSL #include "CoinHslConfig.h" -#else -/* if we build for the Linear Solver loader, then use normal C-naming style */ -#define IPOPT_HSL_FUNC(name,NAME) name #endif -// if we do not have MA57 in HSL or the linear solver loader, then we want to build the MA57 interface -#if defined(COINHSL_HAS_MA57) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - -#include "IpMa57TSolverInterface.hpp" - -#include -#include -#include +#if (defined(COINHSL_HAS_MA57) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA57S) && defined(IPOPT_SINGLE)) +#ifdef IPOPT_SINGLE +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name,NAME) +#else +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name ## d,NAME ## D) +#endif -/** Prototypes for MA57's Fortran subroutines */ +/** MA57 functions from HSL library (symbols resolved at linktime) */ extern "C" { - /** MA57ID -- Initialize solver. */ - extern void IPOPT_HSL_FUNC (ma57id, MA57ID)( - double* cntl, - ma57int* icntl - ); - - /** MA57AD -- Symbolic Factorization. */ - extern void IPOPT_HSL_FUNC (ma57ad, MA57AD)( - ma57int* n, /**< Order of matrix. */ - ma57int* ne, /**< Number of entries. */ - const ma57int* irn, /**< Matrix nonzero row structure */ - const ma57int* jcn, /**< Matrix nonzero column structure */ - ma57int* lkeep, /**< Workspace for the pivot order of length 3*n */ - ma57int* keep, /**< Workspace for the pivot order of length 3*n */ - /* Automatically iflag = 0; ikeep pivot order iflag = 1 */ - ma57int* iwork, /**< Integer work space. */ - ma57int* icntl, /**< Integer Control parameter of length 30 */ - ma57int* info, /**< Statistical Information; Integer array of length 20 */ - double* rinfo /**< Double Control parameter of length 5 */ - ); - - /** MA57BD -- Numerical Factorization. */ - extern void IPOPT_HSL_FUNC (ma57bd, MA57BD)( - ma57int* n, /**< Order of matrix. */ - ma57int* ne, /**< Number of entries. */ - double* a, /**< Numerical values. */ - double* fact, /**< Entries of factors. */ - ma57int* lfact, /**< Length of array `fact'. */ - ma57int* ifact, /**< Indexing info for factors. */ - ma57int* lifact, /**< Length of array `ifact'. */ - ma57int* lkeep, /**< Length of array `keep'. */ - ma57int* keep, /**< Integer array. */ - ma57int* iwork, /**< Workspace of length `n'. */ - ma57int* icntl, /**< Integer Control parameter of length 20. */ - double* cntl, /**< Double Control parameter of length 5. */ - ma57int* info, /**< Statistical Information; Integer array of length 40. */ - double* rinfo /**< Statistical Information; Real array of length 20. */ - ); - - /** MA57CD -- Solution. */ - extern void IPOPT_HSL_FUNC (ma57cd, MA57CD)( - /** Solution job. Solve for... - * - JOB <= 1: A - * - JOB == 2: PLP^t - * - JOB == 3: PDP^t - * - JOB >= 4: PL^t P^t - */ - ma57int* job, - ma57int* n, /**< Order of matrix. */ - double* fact, /**< Entries of factors. */ - ma57int* lfact, /**< Length of array `fact'. */ - ma57int* ifact, /**< Indexing info for factors. */ - ma57int* lifact, /**< Length of array `ifact'. */ - ma57int* nrhs, /**< Number of right hand sides. */ - double* rhs, /**< Numerical Values. */ - ma57int* lrhs, /**< Leading dimensions of `rhs'. */ - double* work, /**< Real workspace. */ - ma57int* lwork, /**< Length of `work', >= N*NRHS. */ - ma57int* iwork, /**< Integer array of length `n'. */ - ma57int* icntl, /**< Integer Control parameter array of length 20. */ - ma57int* info /**< Statistical Information; Integer array of length 40. */ - ); - - /** MC57ED -- Copy arrays. */ - extern void IPOPT_HSL_FUNC (ma57ed, MA57ED)( - ma57int* n, - ma57int* ic, /**< 0: copy real array. >=1: copy integer array. */ - ma57int* keep, - double* fact, - ma57int* lfact, - double* newfac, - ma57int* lnew, - ma57int* ifact, - ma57int* lifact, - ma57int* newifc, - ma57int* linew, - ma57int* info - ); + IPOPT_DECL_MA57A(IPOPT_HSL_FUNCP(ma57a, MA57A)); + IPOPT_DECL_MA57B(IPOPT_HSL_FUNCP(ma57b, MA57B)); + IPOPT_DECL_MA57C(IPOPT_HSL_FUNCP(ma57c, MA57C)); + IPOPT_DECL_MA57E(IPOPT_HSL_FUNCP(ma57e, MA57E)); + IPOPT_DECL_MA57I(IPOPT_HSL_FUNCP(ma57i, MA57I)); } +#else +#ifdef IPOPT_SINGLE +#define HSLFUNCNAMESUFFIX "" +#else +#define HSLFUNCNAMESUFFIX "d" +#endif +#endif namespace Ipopt { @@ -112,6 +45,13 @@ namespace Ipopt static const Index dbg_verbosity = 0; #endif +/** pointer to MA57 function that can be set via Ma57TSolverInterface::SetFunctions() */ +static IPOPT_DECL_MA57A(*user_ma57a) = NULL; +static IPOPT_DECL_MA57B(*user_ma57b) = NULL; +static IPOPT_DECL_MA57C(*user_ma57c) = NULL; +static IPOPT_DECL_MA57E(*user_ma57e) = NULL; +static IPOPT_DECL_MA57I(*user_ma57i) = NULL; + const char* ma57_err_msg[] = { "Operation successful.\n", @@ -214,17 +154,24 @@ const char* ma57_wrn_msg[] = "continue the factorization.\n" }; -Ma57TSolverInterface::Ma57TSolverInterface() - : dim_(0), - nonzeros_(0), - initialized_(false), - pivtol_changed_(false), - refactorize_(false), - wd_keep_(NULL), - wd_iwork_(NULL), - wd_fact_(NULL), - wd_ifact_(NULL), - a_(NULL) +Ma57TSolverInterface::Ma57TSolverInterface( + SmartPtr hslloader_ +) : hslloader(hslloader_), + ma57a(NULL), + ma57b(NULL), + ma57c(NULL), + ma57e(NULL), + ma57i(NULL), + dim_(0), + nonzeros_(0), + initialized_(false), + pivtol_changed_(false), + refactorize_(false), + wd_keep_(NULL), + wd_iwork_(NULL), + wd_fact_(NULL), + wd_ifact_(NULL), + a_(NULL) { DBG_START_METH("Ma57TSolverInterface::Ma57TSolverInterface()", dbg_verbosity); } @@ -245,30 +192,32 @@ void Ma57TSolverInterface::RegisterOptions( SmartPtr roptions ) { + roptions->AddLowerBoundedIntegerOption( + "ma57_print_level", + "Debug printing level for the linear solver MA57", + 0, 0, + "0: no printing; 1: Error messages only; 2: Error and warning messages; 3: Error and warning messages and terse monitoring; >=4: All information."); roptions->AddBoundedNumberOption( "ma57_pivtol", "Pivot tolerance for the linear solver MA57.", 0.0, true, 1.0, true, 1e-8, - "A smaller number pivots for sparsity, a larger number pivots for stability. " - "This option is only available if Ipopt has been compiled with MA57."); + "A smaller number pivots for sparsity, a larger number pivots for stability."); roptions->AddBoundedNumberOption( "ma57_pivtolmax", "Maximum pivot tolerance for the linear solver MA57.", 0.0, true, 1.0, true, 1e-4, - "Ipopt may increase pivtol as high as ma57_pivtolmax to get a more accurate solution to the linear system. " - "This option is only available if Ipopt has been compiled with MA57."); + "Ipopt may increase pivtol as high as ma57_pivtolmax to get a more accurate solution to the linear system."); roptions->AddLowerBoundedNumberOption( "ma57_pre_alloc", "Safety factor for work space memory allocation for the linear solver MA57.", 1., false, 1.05, "If 1 is chosen, the suggested amount of work space is used. " - "However, choosing a larger number might avoid reallocation if the suggest values do not suffice. " - "This option is only available if Ipopt has been compiled with MA57."); + "However, choosing a larger number might avoid reallocation if the suggest values do not suffice."); roptions->AddBoundedIntegerOption( "ma57_pivot_order", "Controls pivot order in MA57", @@ -279,13 +228,10 @@ void Ma57TSolverInterface::RegisterOptions( 5, #endif "This is ICNTL(6) in MA57."); - roptions->AddStringOption2( + roptions->AddBoolOption( "ma57_automatic_scaling", - "Controls MA57 automatic scaling", - "no", - "no", "Do not scale the linear system matrix", - "yes", "Scale the linear system matrix", - "This option controls the internal scaling option of MA57. " + "Controls whether to enable automatic scaling in MA57", + false, "For higher reliability of the MA57 solver, you may want to set this option to yes. " "This is ICNTL(15) in MA57."); @@ -314,7 +260,28 @@ void Ma57TSolverInterface::RegisterOptions( "This can be particularly efficient if the matrix is highly rank deficient. " "This is ICNTL(16) in MA57."); // CET 04-29-2010 +} +/// set MA57 functions to use for every instantiation of this class +void Ma57TSolverInterface::SetFunctions( + IPOPT_DECL_MA57A(*ma57a), + IPOPT_DECL_MA57B(*ma57b), + IPOPT_DECL_MA57C(*ma57c), + IPOPT_DECL_MA57E(*ma57e), + IPOPT_DECL_MA57I(*ma57i) +) +{ + DBG_ASSERT(ma57a != NULL); + DBG_ASSERT(ma57b != NULL); + DBG_ASSERT(ma57c != NULL); + DBG_ASSERT(ma57e != NULL); + DBG_ASSERT(ma57i != NULL); + + user_ma57a = ma57a; + user_ma57b = ma57b; + user_ma57c = ma57c; + user_ma57e = ma57e; + user_ma57i = ma57i; } bool Ma57TSolverInterface::InitializeImpl( @@ -322,7 +289,46 @@ bool Ma57TSolverInterface::InitializeImpl( const std::string& prefix ) { + if( user_ma57a != NULL ) + { + // someone set MA57 functions via setFunctions - prefer these + ma57a = user_ma57a; + ma57b = user_ma57b; + ma57c = user_ma57c; + ma57e = user_ma57e; + ma57i = user_ma57i; + } + else + { +#if (defined(COINHSL_HAS_MA57) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA57S) && defined(IPOPT_SINGLE)) + // use HSL functions that should be available in linked HSL library + ma57a = &::IPOPT_HSL_FUNCP(ma57a, MA57A); + ma57b = &::IPOPT_HSL_FUNCP(ma57b, MA57B); + ma57c = &::IPOPT_HSL_FUNCP(ma57c, MA57C); + ma57e = &::IPOPT_HSL_FUNCP(ma57e, MA57E); + ma57i = &::IPOPT_HSL_FUNCP(ma57i, MA57I); +#else + // try to load HSL functions from a shared library at runtime + DBG_ASSERT(IsValid(hslloader)); + + ma57a = (IPOPT_DECL_MA57A(*))hslloader->loadSymbol("ma57a" HSLFUNCNAMESUFFIX); + ma57b = (IPOPT_DECL_MA57B(*))hslloader->loadSymbol("ma57b" HSLFUNCNAMESUFFIX); + ma57c = (IPOPT_DECL_MA57C(*))hslloader->loadSymbol("ma57c" HSLFUNCNAMESUFFIX); + ma57e = (IPOPT_DECL_MA57E(*))hslloader->loadSymbol("ma57e" HSLFUNCNAMESUFFIX); + ma57i = (IPOPT_DECL_MA57I(*))hslloader->loadSymbol("ma57i" HSLFUNCNAMESUFFIX); +#endif + } + + DBG_ASSERT(ma57a != NULL); + DBG_ASSERT(ma57b != NULL); + DBG_ASSERT(ma57c != NULL); + DBG_ASSERT(ma57e != NULL); + DBG_ASSERT(ma57i != NULL); + // Obtain the options settings + Index print_level; + options.GetIntegerValue("ma57_print_level", print_level, prefix); + options.GetNumericValue("ma57_pivtol", pivtol_, prefix); if( options.GetNumericValue("ma57_pivtolmax", pivtolmax_, prefix) ) { @@ -357,36 +363,35 @@ bool Ma57TSolverInterface::InitializeImpl( // CET 04-29-2010 /* Initialize. */ - IPOPT_HSL_FUNC (ma57id, MA57ID)(wd_cntl_, wd_icntl_); - + ma57i(wd_cntl_, wd_icntl_); /* Custom settings for MA57. */ - wd_icntl_[1 - 1] = 0; /* Error stream */ - wd_icntl_[2 - 1] = 0; /* Warning stream. */ + wd_icntl_[0] = 0; /* Error stream */ + wd_icntl_[1] = 0; /* Warning stream. */ - wd_icntl_[4 - 1] = 1; /* Print statistics. NOT Used. */ - wd_icntl_[5 - 1] = 0; /* Print error. */ + wd_icntl_[3] = 1; /* Print statistics. NOT Used. */ + wd_icntl_[4] = print_level; /* Print level. */ - wd_icntl_[6 - 1] = ma57_pivot_order; /* Pivoting order. */ + wd_icntl_[5] = ma57_pivot_order; /* Pivoting order. */ - wd_cntl_[1 - 1] = pivtol_; /* Pivot threshold. */ - wd_icntl_[7 - 1] = 1; /* Pivoting strategy. */ + wd_cntl_[0] = pivtol_; /* Pivot threshold. */ + wd_icntl_[6] = 1; /* Pivoting strategy. */ // CET: Added 04-29-2010 at suggestion of Jonathan Hogg of HSL - wd_icntl_[11 - 1] = ma57_block_size; /* Block size used by Level 3 BLAS in MA57BD - should be a multiple of 8. Default is 16. */ - wd_icntl_[12 - 1] = ma57_node_amalgamation; /* Two nodes of the assembly tree are merged only if both involve less than ICNTL(12) eliminations. Default is 16. */ + wd_icntl_[10] = ma57_block_size; /* Block size used by Level 3 BLAS in MA57BD - should be a multiple of 8. Default is 16. */ + wd_icntl_[11] = ma57_node_amalgamation; /* Two nodes of the assembly tree are merged only if both involve less than ICNTL(12) eliminations. Default is 16. */ // CET: 04-29-2010 if( ma57_automatic_scaling ) { - wd_icntl_[15 - 1] = 1; + wd_icntl_[14] = 1; } else { - wd_icntl_[15 - 1] = 0; + wd_icntl_[14] = 0; } // CET: Added 04-29-2010 at suggestion of Jonathan Hogg of HSL - wd_icntl_[16 - 1] = ma57_small_pivot_flag; /* If set to 1, small entries are removed and corresponding pivots are placed at the end of factorization. May be useful for highly rank deficient matrices. Default is 0. */ + wd_icntl_[15] = ma57_small_pivot_flag; /* If set to 1, small entries are removed and corresponding pivots are placed at the end of factorization. May be useful for highly rank deficient matrices. Default is 0. */ // CET: 04-29-2010 // wd_icntl[8-1] = 0; /* Retry factorization. */ @@ -421,7 +426,7 @@ ESymSolverStatus Ma57TSolverInterface::MultiSolve( const Index* airn, const Index* ajcn, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ) @@ -466,7 +471,7 @@ ESymSolverStatus Ma57TSolverInterface::MultiSolve( return Backsolve(nrhs, rhs_vals); } -double* Ma57TSolverInterface::GetValuesArrayPtr() +Number* Ma57TSolverInterface::GetValuesArrayPtr() { DBG_START_METH("Ma57TSolverInterface::GetValuesArrayPtr", dbg_verbosity); DBG_ASSERT(initialized_); @@ -493,7 +498,7 @@ ESymSolverStatus Ma57TSolverInterface::InitializeStructure( // elements delete[] a_; a_ = NULL; - a_ = new double[nonzeros_]; + a_ = new Number[nonzeros_]; // Do the symbolic factorization retval = SymbolicFactorization(airn, ajcn); @@ -531,12 +536,12 @@ ESymSolverStatus Ma57TSolverInterface::SymbolicFactorization( wd_lkeep_ = 5 * n + ne + (n > ne ? n : ne) + 42; - wd_cntl_[1 - 1] = pivtol_; /* Pivot threshold. */ + wd_cntl_[0] = pivtol_; /* Pivot threshold. */ wd_iwork_ = new ma57int[5 * n]; wd_keep_ = new ma57int[wd_lkeep_]; - // Initialize to 0 as otherwise MA57ED can sometimes fail - for( int k = 0; k < wd_lkeep_; k++ ) + // Initialize to 0 as otherwise MA57EX can sometimes fail + for( ma57int k = 0; k < wd_lkeep_; k++ ) { wd_keep_[k] = 0; } @@ -548,7 +553,7 @@ ESymSolverStatus Ma57TSolverInterface::SymbolicFactorization( { airn_ma57int = new ma57int[ne]; ajcn_ma57int = new ma57int[ne]; - for( int k = 0; k < ne; ++k ) + for( ma57int k = 0; k < ne; ++k ) { airn_ma57int[k] = (ma57int) airn[k]; ajcn_ma57int[k] = (ma57int) ajcn[k]; @@ -559,10 +564,7 @@ ESymSolverStatus Ma57TSolverInterface::SymbolicFactorization( airn_ma57int = (ma57int*) (void*) const_cast(airn); ajcn_ma57int = (ma57int*) (void*) const_cast(ajcn); } - - IPOPT_HSL_FUNC (ma57ad, MA57AD)(&n, &ne, airn_ma57int, ajcn_ma57int, &wd_lkeep_, wd_keep_, wd_iwork_, wd_icntl_, wd_info_, - wd_rinfo_); - + ma57a(&n, &ne, airn_ma57int, ajcn_ma57int, &wd_lkeep_, wd_keep_, wd_iwork_, wd_icntl_, wd_info_, wd_rinfo_); // free copy-casted ma57int arrays, no longer needed if( sizeof(ma57int) != sizeof(Index) ) { @@ -573,11 +575,13 @@ ESymSolverStatus Ma57TSolverInterface::SymbolicFactorization( if( wd_info_[0] < 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "*** Error from MA57AD *** INFO(0) = %d\n", wd_info_[0]); + "*** Error from MA57AD *** INFO(0) = %" IPOPT_INDEX_FORMAT "\n", wd_info_[0]); } - wd_lfact_ = (ma57int) ((Number) wd_info_[8] * ma57_pre_alloc_); - wd_lifact_ = (ma57int) ((Number) wd_info_[9] * ma57_pre_alloc_); + wd_lfact_ = 0; + wd_lifact_ = 0; + ComputeMemIncrease(wd_lfact_, (Number)wd_info_[8] * ma57_pre_alloc_, 0, "double working space for MA57"); + ComputeMemIncrease(wd_lifact_, (Number)wd_info_[9] * ma57_pre_alloc_, 0, "integer working space for MA57"); // XXX MH: Why is this necessary? Is `::Factorization' called more // than once per object lifetime? Where should allocation take @@ -592,13 +596,13 @@ ESymSolverStatus Ma57TSolverInterface::SymbolicFactorization( delete[] wd_ifact_; wd_ifact_ = NULL; - wd_fact_ = new double[wd_lfact_]; + wd_fact_ = new Number[wd_lfact_]; wd_ifact_ = new ma57int[wd_lifact_]; Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Suggested lfact (*%e): %d\n", ma57_pre_alloc_, wd_lfact_); + "Suggested lfact (*%e): %" IPOPT_INDEX_FORMAT "\n", ma57_pre_alloc_, wd_lfact_); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Suggested lifact (*%e): %d\n", ma57_pre_alloc_, wd_lifact_); + "Suggested lifact (*%e): %" IPOPT_INDEX_FORMAT "\n", ma57_pre_alloc_, wd_lifact_); if( HaveIpData() ) { @@ -620,23 +624,22 @@ ESymSolverStatus Ma57TSolverInterface::Factorization( IpData().TimingStats().LinearSystemFactorization().Start(); } - int fact_error = 1; + bool fact_error = true; - wd_cntl_[1 - 1] = pivtol_; /* Pivot threshold. */ + wd_cntl_[0] = pivtol_; /* Pivot threshold. */ ma57int n = dim_; ma57int ne = nonzeros_; - while( fact_error > 0 ) + while( fact_error ) { - IPOPT_HSL_FUNC (ma57bd, MA57BD)(&n, &ne, a_, wd_fact_, &wd_lfact_, wd_ifact_, &wd_lifact_, &wd_lkeep_, wd_keep_, - wd_iwork_, wd_icntl_, wd_cntl_, wd_info_, wd_rinfo_); - + ma57b(&n, &ne, a_, wd_fact_, &wd_lfact_, wd_ifact_, &wd_lifact_, &wd_lkeep_, wd_keep_, + wd_iwork_, wd_icntl_, wd_cntl_, wd_info_, wd_rinfo_); negevals_ = (Index) wd_info_[24 - 1]; // Number of negative eigenvalues if( wd_info_[0] == 0 ) { - fact_error = 0; + fact_error = false; } else if( wd_info_[0] == -3 ) { @@ -646,26 +649,26 @@ ESymSolverStatus Ma57TSolverInterface::Factorization( * copy the contents of FACT into it using MA57E/ED, and recall * MA57B/BD. */ - double* temp; + Number* temp; ma57int ic = 0; - wd_lfact_ = (ma57int) ((Number) wd_info_[16] * ma57_pre_alloc_); + ComputeMemIncrease(wd_lfact_, (Number)wd_info_[16] * ma57_pre_alloc_, 0, "double working space for MA57"); Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "Reallocating memory for MA57: lfact (%d)\n", wd_lfact_); + "Reallocating memory for MA57: lfact (%" IPOPT_INDEX_FORMAT ")\n", wd_lfact_); - if( (size_t) wd_lfact_ > std::numeric_limits::max() / sizeof(double) ) - { - Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Cannot allocate memory of size %d exceeding SIZE_MAX = %u\n", wd_lfact_, std::numeric_limits::max()); - return SYMSOLVER_FATAL_ERROR; - } + // I removed this, because the call to new below should already check this, too, and would throw a std::bad_alloc (which we catch) (or std::bad_array_new_length if C++11) + // if( (size_t) wd_lfact_ > std::numeric_limits::max() / sizeof(Number) ) + // { + // Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, + // "Cannot allocate memory of size %" IPOPT_INDEX_FORMAT " exceeding SIZE_MAX = %zd\n", wd_lfact_, std::numeric_limits::max()); + // return SYMSOLVER_FATAL_ERROR; + // } - temp = new double[wd_lfact_]; + temp = new Number[wd_lfact_]; ma57int idmy; - IPOPT_HSL_FUNC (ma57ed, MA57ED)(&n, &ic, wd_keep_, wd_fact_, &wd_info_[1], temp, &wd_lfact_, wd_ifact_, &wd_info_[1], - &idmy, &wd_lfact_, wd_info_); - + ma57e(&n, &ic, wd_keep_, wd_fact_, &wd_info_[1], temp, &wd_lfact_, wd_ifact_, &wd_info_[1], + &idmy, &wd_lfact_, wd_info_); delete[] wd_fact_; wd_fact_ = temp; } @@ -681,25 +684,24 @@ ESymSolverStatus Ma57TSolverInterface::Factorization( ma57int* temp; ma57int ic = 1; - wd_lifact_ = (ma57int) ((Number) wd_info_[17] * ma57_pre_alloc_); + ComputeMemIncrease(wd_lifact_, (Number)wd_info_[17] * ma57_pre_alloc_, 0, "integer working space for MA57"); temp = new ma57int[wd_lifact_]; Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Reallocating lifact (%d)\n", wd_lifact_); - - double ddmy; - IPOPT_HSL_FUNC (ma57ed, MA57ED)(&n, &ic, wd_keep_, wd_fact_, &wd_info_[1], &ddmy, &wd_lifact_, wd_ifact_, - &wd_info_[1], temp, &wd_lifact_, wd_info_); + "Reallocating lifact (%" IPOPT_INDEX_FORMAT ")\n", wd_lifact_); + Number ddmy; + ma57e(&n, &ic, wd_keep_, wd_fact_, &wd_info_[1], &ddmy, &wd_lifact_, wd_ifact_, + &wd_info_[1], temp, &wd_lifact_, wd_info_); delete[] wd_ifact_; wd_ifact_ = temp; } else if( wd_info_[0] < 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in MA57BD: %d\n", wd_info_[0]); + "Error in MA57BD: %" IPOPT_INDEX_FORMAT "\n", wd_info_[0]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "MA57 Error message: %s\n", ma57_err_msg[-wd_info_[1 - 1]]); + "MA57 Error message: %s\n", ma57_err_msg[-wd_info_[0]]); return SYMSOLVER_FATAL_ERROR; } // Check if the system is singular. @@ -710,23 +712,23 @@ ESymSolverStatus Ma57TSolverInterface::Factorization( IpData().TimingStats().LinearSystemFactorization().End(); } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "System singular, rank = %d\n", wd_info_[25 - 1]); + "System singular, rank = %" IPOPT_INDEX_FORMAT "\n", wd_info_[24]); return SYMSOLVER_SINGULAR; } else if( wd_info_[0] > 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Warning in MA57BD: %d\n", wd_info_[0]); + "Warning in MA57BD: %" IPOPT_INDEX_FORMAT "\n", wd_info_[0]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "MA57 Warning message: %s\n", ma57_wrn_msg[wd_info_[1 - 1]]); + "MA57 Warning message: %s\n", ma57_wrn_msg[wd_info_[0]]); // For now, abort the process so that we don't miss any problems return SYMSOLVER_FATAL_ERROR; } } - double peak_mem = 1.0e-3 * ((double) wd_lfact_ * 8.0 + (double) wd_lifact_ * 4.0 + (double) wd_lkeep_ * 4.0); + Number peak_mem = 1.0e-3 * ((Number) wd_lfact_ * sizeof(Number) + (Number) wd_lifact_ * sizeof(ma57int) + (Number) wd_lkeep_ * sizeof(ma57int)); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "MA57 peak memory use: %dKB\n", (ma57int) (peak_mem)); + "MA57 peak memory use: %zdKB\n", (size_t) (peak_mem)); // Check whether the number of negative eigenvalues matches the // requested count. @@ -737,7 +739,7 @@ ESymSolverStatus Ma57TSolverInterface::Factorization( if( check_NegEVals && (numberOfNegEVals != negevals_) ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "In Ma57TSolverInterface::Factorization: negevals_ = %d, but numberOfNegEVals = %d\n", negevals_, numberOfNegEVals); + "In Ma57TSolverInterface::Factorization: negevals_ = %" IPOPT_INDEX_FORMAT ", but numberOfNegEVals = %" IPOPT_INDEX_FORMAT "\n", negevals_, numberOfNegEVals); return SYMSOLVER_WRONG_INERTIA; } @@ -746,10 +748,10 @@ ESymSolverStatus Ma57TSolverInterface::Factorization( ESymSolverStatus Ma57TSolverInterface::Backsolve( Index nrhs, - double* rhs_vals + Number* rhs_vals ) { - DBG_START_METH("Ma27TSolverInterface::Backsolve", dbg_verbosity); + DBG_START_METH("Ma57TSolverInterface::Backsolve", dbg_verbosity); if( HaveIpData() ) { IpData().TimingStats().LinearSystemBackSolve().Start(); @@ -762,10 +764,10 @@ ESymSolverStatus Ma57TSolverInterface::Backsolve( ma57int lrhs = n; ma57int lwork; - double* work; + Number* work; lwork = n * nrhs; - work = new double[lwork]; + work = new Number[lwork]; // For each right hand side, call MA57CD // XXX MH: MA57 can do several RHSs; just do one solve... @@ -780,14 +782,12 @@ ESymSolverStatus Ma57TSolverInterface::Backsolve( } } } - - IPOPT_HSL_FUNC (ma57cd, MA57CD)(&job, &n, wd_fact_, &wd_lfact_, wd_ifact_, &wd_lifact_, &nrhs_X, rhs_vals, &lrhs, work, - &lwork, wd_iwork_, wd_icntl_, wd_info_); - + ma57c(&job, &n, wd_fact_, &wd_lfact_, wd_ifact_, &wd_lifact_, &nrhs_X, rhs_vals, &lrhs, work, + &lwork, wd_iwork_, wd_icntl_, wd_info_); if( wd_info_[0] != 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in MA57CD: %d.\n", wd_info_[0]); + "Error in MA57CD: %" IPOPT_INDEX_FORMAT ".\n", wd_info_[0]); } if( DBG_VERBOSITY() >= 2 ) @@ -829,12 +829,10 @@ bool Ma57TSolverInterface::IncreaseQuality() Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Increasing pivot tolerance for MA57 from %7.2e ", pivtol_); - pivtol_ = Min(pivtolmax_, pow(pivtol_, 0.75)); + pivtol_ = Min(pivtolmax_, std::pow(pivtol_, Number(0.75))); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "to %7.2e.\n", pivtol_); return true; } } // namespace Ipopt - -#endif /* COINHSL_HAS_MA57 or IPOPT_HAS_LINEARSOLVERLOADER */ diff --git a/src/Algorithm/LinearSolvers/IpMa57TSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpMa57TSolverInterface.hpp index bfffa703a..36cfb6cfe 100644 --- a/src/Algorithm/LinearSolvers/IpMa57TSolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpMa57TSolverInterface.hpp @@ -9,14 +9,96 @@ #define __IPMA57TSOLVERINTERFACE_HPP__ #include "IpSparseSymLinearSolverInterface.hpp" +#include "IpLibraryLoader.hpp" +#include "IpTypes.h" #ifdef FUNNY_MA57_FINT #include typedef ptrdiff_t ma57int; #else -typedef ipfint ma57int; +#include "IpTypes.h" +typedef ipindex ma57int; #endif +/// @since 3.14.0 +#define IPOPT_DECL_MA57A(x) void (x)( \ + ipindex* n, /**< Order of matrix. */ \ + ipindex* ne, /**< Number of entries. */ \ + const ipindex* irn, /**< Matrix nonzero row structure */ \ + const ipindex* jcn, /**< Matrix nonzero column structure */ \ + ipindex* lkeep, /**< Workspace for the pivot order of lenght 3*n */ \ + ipindex* keep, /**< Workspace for the pivot order of lenght 3*n */ \ + /* Automatically iflag = 0; ikeep pivot order iflag = 1 */ \ + ipindex* iwork, /**< Integer work space. */ \ + ipindex* icntl, /**< Integer Control parameter of length 30 */ \ + ipindex* info, /**< Statistical Information; Integer array of length 20 */ \ + ipnumber* rinfo /**< Double Control parameter of length 5 */ \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA57B(x) void (x)( \ + ipindex* n, /**< Order of matrix. */ \ + ipindex* ne, /**< Number of entries. */ \ + ipnumber* a, /**< Numerical values. */ \ + ipnumber* fact, /**< Entries of factors. */ \ + ipindex* lfact, /**< Length of array `fact'. */ \ + ipindex* ifact, /**< Indexing info for factors. */ \ + ipindex* lifact, /**< Length of array `ifact'. */ \ + ipindex* lkeep, /**< Length of array `keep'. */ \ + ipindex* keep, /**< Integer array. */ \ + ipindex* iwork, /**< Workspace of length `n'. */ \ + ipindex* icntl, /**< Integer Control parameter of length 20. */ \ + ipnumber* cntl, /**< Double Control parameter of length 5. */ \ + ipindex* info, /**< Statistical Information; Integer array of length 40. */ \ + ipnumber* rinfo /**< Statistical Information; Real array of length 20. */ \ +) + +/* Solution job: Solve for... + * - JOB <= 1: A + * - JOB == 2: PLP^t + * - JOB == 3: PDP^t + * - JOB >= 4: PL^t P^t + */ +/// @since 3.14.0 +#define IPOPT_DECL_MA57C(x) void (x)( \ + ipindex* job, /**< Solution job. */ \ + ipindex* n, /**< Order of matrix. */ \ + ipnumber* fact, /**< Entries of factors. */ \ + ipindex* lfact, /**< Length of array `fact'. */ \ + ipindex* ifact, /**< Indexing info for factors. */ \ + ipindex* lifact, /**< Length of array `ifact'. */ \ + ipindex* nrhs, /**< Number of right hand sides. */ \ + ipnumber* rhs, /**< Numerical Values. */ \ + ipindex* lrhs, /**< Leading dimensions of `rhs'. */ \ + ipnumber* work, /**< Real workspace. */ \ + ipindex* lwork, /**< Length of `work', >= N*NRHS. */ \ + ipindex* iwork, /**< Integer array of length `n'. */ \ + ipindex* icntl, /**< Integer Control parameter array of length 20. */ \ + ipindex* info /**< Statistical Information; Integer array of length 40. */ \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA57E(x) void (x)( \ + ipindex* n, \ + ipindex* ic, /**< 0: copy real array. >=1: copy integer array. */ \ + ipindex* keep, \ + ipnumber* fact, \ + ipindex* lfact, \ + ipnumber* newfac, \ + ipindex* lnew, \ + ipindex* ifact, \ + ipindex* lifact, \ + ipindex* newifc, \ + ipindex* linew, \ + ipindex* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA57I(x) void (x)( \ + ipnumber* cntl, \ + ipindex* icntl \ +) + namespace Ipopt { /** Interface to the symmetric linear solver MA57, derived from @@ -26,13 +108,15 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor */ - Ma57TSolverInterface(); + Ma57TSolverInterface( + SmartPtr hslloader_ ///< @since 3.14.0 + ); /** Destructor */ virtual ~Ma57TSolverInterface(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -40,7 +124,7 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ virtual ESymSolverStatus InitializeStructure( Index dim, Index nonzeros, @@ -48,23 +132,23 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface const Index* ajcn ); - virtual double* GetValuesArrayPtr(); + virtual Number* GetValuesArrayPtr(); virtual ESymSolverStatus MultiSolve( bool new_matrix, const Index* airn, const Index* ajcn, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ); virtual Index NumberOfNegEVals() const; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ virtual bool IncreaseQuality(); virtual bool ProvidesInertia() const @@ -76,13 +160,23 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface { return Triplet_Format; } - //@} + ///@} - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} + + /// set MA57 functions to use for every instantiation of this class + /// @since 3.14.0 + static void SetFunctions( + IPOPT_DECL_MA57A(*ma57a), + IPOPT_DECL_MA57B(*ma57b), + IPOPT_DECL_MA57C(*ma57c), + IPOPT_DECL_MA57E(*ma57e), + IPOPT_DECL_MA57I(*ma57i) + ); private: /**@name Default Compiler Generated Methods @@ -92,7 +186,7 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface * them for us, so we declare them private * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ Ma57TSolverInterface( const Ma57TSolverInterface& @@ -102,25 +196,42 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface void operator=( const Ma57TSolverInterface& ); - //@} + ///@} + + /**@name MA57 function pointers + * @{ + */ + SmartPtr hslloader; + + /// symbolic factorization + IPOPT_DECL_MA57A(*ma57a); + /// numerical factorization + IPOPT_DECL_MA57B(*ma57b); + /// solution + IPOPT_DECL_MA57C(*ma57c); + /// copy arrays + IPOPT_DECL_MA57E(*ma57e); + /// initialize solver + IPOPT_DECL_MA57I(*ma57i); + ///@} /** @name Information about the matrix */ - //@{ + ///@{ /** Number of rows and columns of the matrix */ Index dim_; /** Number of nonzeros of the matrix */ Index nonzeros_; - //@} + ///@} /** @name Information about most recent factorization/solve */ - //@{ + ///@{ /** Number of negative eigenvalues */ Index negevals_; - //@} + ///@} /** @name Initialization flags */ - //@{ + ///@{ /** Flag indicating if internal data is initialized. * * For initialization, this object needs to have seen a matrix @@ -135,10 +246,10 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface * again. */ bool refactorize_; - //@} + ///@} /** @name Solver specific data/options */ - //@{ + ///@{ /** Pivot tolerance */ Number pivtol_; /** Maximal pivot tolerance */ @@ -149,35 +260,35 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface * already been solved before. */ bool warm_start_same_structure_; - //@} + ///@} /** @name Data for the linear solver. * Storing factorization and other solver specific data structure. */ - //@{ - double wd_cntl_[5]; + ///@{ + Number wd_cntl_[5]; ma57int wd_icntl_[20]; ma57int wd_info_[40]; - double wd_rinfo_[20]; + Number wd_rinfo_[20]; ma57int wd_lkeep_; /* LKEEP >= 5*N + NE + max(N,NE) + 42. */ ma57int* wd_keep_; ma57int* wd_iwork_; /* 5 * N. */ - double* wd_fact_; + Number* wd_fact_; ma57int wd_lfact_; ma57int* wd_ifact_; ma57int wd_lifact_; /** factor A of matrix */ - double* a_; - //@} + Number* a_; + ///@} /** @name Internal functions */ - //@{ - /** Call MA57AD and reserve memory for MA57 data. + ///@{ + /** Call MA57AX and reserve memory for MA57 data. * * Reserve memory for iw_ and ikeep_, call MA57AD to perform * symbolic manipulations, and reserve all the remaining data memory @@ -187,7 +298,7 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface const Index* ajcn ); - /** Call MA57BD to factorize the Matrix. + /** Call MA57BX to factorize the Matrix. * * It is assumed that the first nonzeros_ element of a_ contain the values * of the matrix to be factorized. @@ -199,12 +310,12 @@ class Ma57TSolverInterface: public SparseSymLinearSolverInterface Index numberOfNegEVals ); - /** Call MA57CD to do the backsolve. */ + /** Call MA57CX to do the backsolve. */ ESymSolverStatus Backsolve( Index nrhs, - double* rhs_vals + Number* rhs_vals ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpMa77SolverInterface.cpp b/src/Algorithm/LinearSolvers/IpMa77SolverInterface.cpp index f88c74c75..26d947ab1 100644 --- a/src/Algorithm/LinearSolvers/IpMa77SolverInterface.cpp +++ b/src/Algorithm/LinearSolvers/IpMa77SolverInterface.cpp @@ -9,26 +9,37 @@ // Carl Laird, Andreas Waechter IBM 2004-03-17 #include "IpoptConfig.h" +#include "IpMa77SolverInterface.hpp" + +#include +#include #ifdef IPOPT_HAS_HSL #include "CoinHslConfig.h" #endif -// if we do not have HSL_MA77 in HSL or the linear solver loader, then we want to build the MA77 interface -#if defined(COINHSL_HAS_MA77) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - -#include "IpMa77SolverInterface.hpp" -#include -#include using namespace std; -extern "C" -{ -#include "hsl_mc68i.h" -} - namespace Ipopt { +static IPOPT_DECL_MA77_DEFAULT_CONTROL(*user_ma77_default_control) = NULL; +static IPOPT_DECL_MA77_OPEN_NELT(*user_ma77_open_nelt) = NULL; +static IPOPT_DECL_MA77_OPEN(*user_ma77_open) = NULL; +static IPOPT_DECL_MA77_INPUT_VARS(*user_ma77_input_vars) = NULL; +static IPOPT_DECL_MA77_INPUT_REALS(*user_ma77_input_reals) = NULL; +static IPOPT_DECL_MA77_ANALYSE(*user_ma77_analyse) = NULL; +static IPOPT_DECL_MA77_FACTOR(*user_ma77_factor) = NULL; +static IPOPT_DECL_MA77_FACTOR_SOLVE(*user_ma77_factor_solve) = NULL; +static IPOPT_DECL_MA77_SOLVE(*user_ma77_solve) = NULL; +static IPOPT_DECL_MA77_RESID(*user_ma77_resid) = NULL; +static IPOPT_DECL_MA77_SCALE(*user_ma77_scale) = NULL; +static IPOPT_DECL_MA77_ENQUIRE_POSDEF(*user_ma77_enquire_posdef) = NULL; +static IPOPT_DECL_MA77_ENQUIRE_INDEF(*user_ma77_enquire_indef) = NULL; +static IPOPT_DECL_MA77_ALTER(*user_ma77_alter) = NULL; +static IPOPT_DECL_MA77_RESTART(*user_ma77_restart) = NULL; +static IPOPT_DECL_MA77_FINALISE(*user_ma77_finalise) = NULL; +static IPOPT_DECL_MC68_DEFAULT_CONTROL(*user_mc68_default_control) = NULL; +static IPOPT_DECL_MC68_ORDER(*user_mc68_order) = NULL; Ma77SolverInterface::~Ma77SolverInterface() { @@ -48,19 +59,13 @@ void Ma77SolverInterface::RegisterOptions( roptions->AddIntegerOption( "ma77_print_level", "Debug printing level for the linear solver MA77", - -1); - /* - "<0 no printing.\n" - "0 Error and warning messages only.\n" - "=1 Limited diagnostic printing.\n" - ">1 Additional diagnostic printing."); - */ + -1, + "<0: no printing; 0: Error and warning messages only; 1: Limited diagnostic printing; >1 Additional diagnostic printing."); roptions->AddLowerBoundedIntegerOption( "ma77_buffer_lpage", - "Number of scalars per MA77 buffer page", + "Number of scalars per MA77 in-core buffer page in the out-of-core solver MA77", 1, 4096, - "Number of scalars per an in-core buffer in the out-of-core solver MA77. " "Must be at most ma77_file_size."); roptions->AddLowerBoundedIntegerOption( "ma77_buffer_npage", @@ -116,15 +121,75 @@ void Ma77SolverInterface::RegisterOptions( "Maximum value to which u will be increased to improve quality."); roptions->AddStringOption2( "ma77_order", - "Controls type of ordering used by HSL_MA77", + "Controls type of ordering used by MA77", #ifdef COINHSL_HAS_METIS "metis", #else "amd", #endif "amd", "Use the HSL_MC68 approximate minimum degree algorithm", - "metis", "Use the MeTiS nested dissection algorithm (if available)", - "This option controls ordering for the solver HSL_MA77."); + "metis", "Use the MeTiS nested dissection algorithm (if available)"); +} + +/// set MA77 functions to use for every instantiation of this class +void Ma77SolverInterface::SetFunctions( + IPOPT_DECL_MA77_DEFAULT_CONTROL(*ma77_default_control), + IPOPT_DECL_MA77_OPEN_NELT(*ma77_open_nelt), + IPOPT_DECL_MA77_OPEN(*ma77_open), + IPOPT_DECL_MA77_INPUT_VARS(*ma77_input_vars), + IPOPT_DECL_MA77_INPUT_REALS(*ma77_input_reals), + IPOPT_DECL_MA77_ANALYSE(*ma77_analyse), + IPOPT_DECL_MA77_FACTOR(*ma77_factor), + IPOPT_DECL_MA77_FACTOR_SOLVE(*ma77_factor_solve), + IPOPT_DECL_MA77_SOLVE(*ma77_solve), + IPOPT_DECL_MA77_RESID(*ma77_resid), + IPOPT_DECL_MA77_SCALE(*ma77_scale), + IPOPT_DECL_MA77_ENQUIRE_POSDEF(*ma77_enquire_posdef), + IPOPT_DECL_MA77_ENQUIRE_INDEF(*ma77_enquire_indef), + IPOPT_DECL_MA77_ALTER(*ma77_alter), + IPOPT_DECL_MA77_RESTART(*ma77_restart), + IPOPT_DECL_MA77_FINALISE(*ma77_finalise), + IPOPT_DECL_MC68_DEFAULT_CONTROL(*mc68_default_control), + IPOPT_DECL_MC68_ORDER(*mc68_order) +) +{ + DBG_ASSERT(ma77_default_control != NULL); + DBG_ASSERT(ma77_open_nelt != NULL); + DBG_ASSERT(ma77_open != NULL); + DBG_ASSERT(ma77_input_vars != NULL); + DBG_ASSERT(ma77_input_reals != NULL); + DBG_ASSERT(ma77_analyse != NULL); + DBG_ASSERT(ma77_factor != NULL); + DBG_ASSERT(ma77_factor_solve != NULL); + DBG_ASSERT(ma77_solve != NULL); + DBG_ASSERT(ma77_resid != NULL); + DBG_ASSERT(ma77_scale != NULL); + DBG_ASSERT(ma77_enquire_posdef != NULL); + DBG_ASSERT(ma77_enquire_indef != NULL); + DBG_ASSERT(ma77_alter != NULL); + DBG_ASSERT(ma77_restart != NULL); + DBG_ASSERT(ma77_finalise != NULL); + DBG_ASSERT(mc68_default_control != NULL); + DBG_ASSERT(mc68_order != NULL); + + user_ma77_default_control = ma77_default_control; + user_ma77_open_nelt = ma77_open_nelt; + user_ma77_open = ma77_open; + user_ma77_input_vars = ma77_input_vars; + user_ma77_input_reals = ma77_input_reals; + user_ma77_analyse = ma77_analyse; + user_ma77_factor = ma77_factor; + user_ma77_factor_solve = ma77_factor_solve; + user_ma77_solve = ma77_solve; + user_ma77_resid = ma77_resid; + user_ma77_scale = ma77_scale; + user_ma77_enquire_posdef = ma77_enquire_posdef; + user_ma77_enquire_indef = ma77_enquire_indef; + user_ma77_alter = ma77_alter; + user_ma77_restart = ma77_restart; + user_ma77_finalise = ma77_finalise; + user_mc68_default_control = mc68_default_control; + user_mc68_order = mc68_order; } bool Ma77SolverInterface::InitializeImpl( @@ -132,6 +197,95 @@ bool Ma77SolverInterface::InitializeImpl( const std::string& prefix ) { + if( user_ma77_default_control != NULL ) + { + ma77_default_control = user_ma77_default_control; + ma77_open_nelt = user_ma77_open_nelt; + ma77_open = user_ma77_open; + ma77_input_vars = user_ma77_input_vars; + ma77_input_reals = user_ma77_input_reals; + ma77_analyse = user_ma77_analyse; + ma77_factor = user_ma77_factor; + ma77_factor_solve = user_ma77_factor_solve; + ma77_solve = user_ma77_solve; + ma77_resid = user_ma77_resid; + ma77_scale = user_ma77_scale; + ma77_enquire_posdef = user_ma77_enquire_posdef; + ma77_enquire_indef = user_ma77_enquire_indef; + ma77_alter = user_ma77_alter; + ma77_restart = user_ma77_restart; + ma77_finalise = user_ma77_finalise; + mc68_default_control = user_mc68_default_control; + mc68_order = user_mc68_order; + } + else + { +#if (defined(COINHSL_HAS_MA77) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA77S) && defined(IPOPT_SINGLE)) + // use HSL functions that should be available in linked HSL library + ma77_default_control = &::ma77_default_control; + ma77_open_nelt = &::ma77_open_nelt; + ma77_open = &::ma77_open; + ma77_input_vars = &::ma77_input_vars; + ma77_input_reals = &::ma77_input_reals; + ma77_analyse = &::ma77_analyse; + ma77_factor = &::ma77_factor; + ma77_factor_solve = &::ma77_factor_solve; + ma77_solve = &::ma77_solve; + ma77_resid = &::ma77_resid; + ma77_scale = &::ma77_scale; + ma77_enquire_posdef = &::ma77_enquire_posdef; + ma77_enquire_indef = &::ma77_enquire_indef; + ma77_alter = &::ma77_alter; + ma77_restart = &::ma77_restart; + ma77_finalise = &::ma77_finalise; + mc68_default_control = &::mc68_default_control; + mc68_order = &::mc68_order; +#else + // try to load HSL functions from a shared library at runtime + DBG_ASSERT(IsValid(hslloader)); + +#define STR2(x) #x +#define STR(x) STR2(x) + ma77_default_control = (IPOPT_DECL_MA77_DEFAULT_CONTROL(*))hslloader->loadSymbol(STR(ma77_default_control)); + ma77_open_nelt = (IPOPT_DECL_MA77_OPEN_NELT(*))hslloader->loadSymbol(STR(ma77_open_nelt)); + ma77_open = (IPOPT_DECL_MA77_OPEN(*))hslloader->loadSymbol(STR(ma77_open)); + ma77_input_vars = (IPOPT_DECL_MA77_INPUT_VARS(*))hslloader->loadSymbol(STR(ma77_input_vars)); + ma77_input_reals = (IPOPT_DECL_MA77_INPUT_REALS(*))hslloader->loadSymbol(STR(ma77_input_reals)); + ma77_analyse = (IPOPT_DECL_MA77_ANALYSE(*))hslloader->loadSymbol(STR(ma77_analyse)); + ma77_factor = (IPOPT_DECL_MA77_FACTOR(*))hslloader->loadSymbol(STR(ma77_factor)); + ma77_factor_solve = (IPOPT_DECL_MA77_FACTOR_SOLVE(*))hslloader->loadSymbol(STR(ma77_factor_solve)); + ma77_solve = (IPOPT_DECL_MA77_SOLVE(*))hslloader->loadSymbol(STR(ma77_solve)); + ma77_resid = (IPOPT_DECL_MA77_RESID(*))hslloader->loadSymbol(STR(ma77_resid)); + ma77_scale = (IPOPT_DECL_MA77_SCALE(*))hslloader->loadSymbol(STR(ma77_scale)); + ma77_enquire_posdef = (IPOPT_DECL_MA77_ENQUIRE_POSDEF(*))hslloader->loadSymbol(STR(ma77_enquire_posdef)); + ma77_enquire_indef = (IPOPT_DECL_MA77_ENQUIRE_INDEF(*))hslloader->loadSymbol(STR(ma77_enquire_indef)); + ma77_alter = (IPOPT_DECL_MA77_ALTER(*))hslloader->loadSymbol(STR(ma77_alter)); + ma77_restart = (IPOPT_DECL_MA77_RESTART(*))hslloader->loadSymbol(STR(ma77_restart)); + ma77_finalise = (IPOPT_DECL_MA77_FINALISE(*))hslloader->loadSymbol(STR(ma77_finalise)); + mc68_default_control = (IPOPT_DECL_MC68_DEFAULT_CONTROL(*))hslloader->loadSymbol(STR(mc68_default_control)); + mc68_order = (IPOPT_DECL_MC68_ORDER(*))hslloader->loadSymbol(STR(mc68_order)); +#endif + } + + DBG_ASSERT(ma77_default_control != NULL); + DBG_ASSERT(ma77_open_nelt != NULL); + DBG_ASSERT(ma77_open != NULL); + DBG_ASSERT(ma77_input_vars != NULL); + DBG_ASSERT(ma77_input_reals != NULL); + DBG_ASSERT(ma77_analyse != NULL); + DBG_ASSERT(ma77_factor != NULL); + DBG_ASSERT(ma77_factor_solve != NULL); + DBG_ASSERT(ma77_solve != NULL); + DBG_ASSERT(ma77_resid != NULL); + DBG_ASSERT(ma77_scale != NULL); + DBG_ASSERT(ma77_enquire_posdef != NULL); + DBG_ASSERT(ma77_enquire_indef != NULL); + DBG_ASSERT(ma77_alter != NULL); + DBG_ASSERT(ma77_restart != NULL); + DBG_ASSERT(ma77_finalise != NULL); + DBG_ASSERT(mc68_default_control != NULL); + DBG_ASSERT(mc68_order != NULL); + ma77_default_control(&control_); control_.f_arrays = 1; // Use Fortran numbering (faster) control_.bits = 32; @@ -139,17 +293,23 @@ bool Ma77SolverInterface::InitializeImpl( // values to be refactorized after a -11 (singular) error. //control_.action = 0; // false, should exit with error on singularity - options.GetIntegerValue("ma77_print_level", control_.print_level, prefix); - options.GetIntegerValue("ma77_buffer_lpage", control_.buffer_lpage[0], prefix); - options.GetIntegerValue("ma77_buffer_lpage", control_.buffer_lpage[1], prefix); - options.GetIntegerValue("ma77_buffer_npage", control_.buffer_npage[0], prefix); - options.GetIntegerValue("ma77_buffer_npage", control_.buffer_npage[1], prefix); - int temp; + Index temp; + options.GetIntegerValue("ma77_print_level", temp, prefix); + control_.print_level = temp; + options.GetIntegerValue("ma77_buffer_lpage", temp, prefix); + control_.buffer_lpage[0] = temp; + options.GetIntegerValue("ma77_buffer_lpage", temp, prefix); + control_.buffer_lpage[1] = temp; + options.GetIntegerValue("ma77_buffer_npage", temp, prefix); + control_.buffer_npage[0] = temp; + options.GetIntegerValue("ma77_buffer_npage", temp, prefix); + control_.buffer_npage[1] = temp; options.GetIntegerValue("ma77_file_size", temp, prefix); control_.file_size = temp; options.GetIntegerValue("ma77_maxstore", temp, prefix); control_.maxstore = temp; - options.GetIntegerValue("ma77_nemin", control_.nemin, prefix); + options.GetIntegerValue("ma77_nemin", temp, prefix); + control_.nemin = temp; options.GetNumericValue("ma77_small", control_.small, prefix); options.GetNumericValue("ma77_static", control_.static_, prefix); options.GetNumericValue("ma77_u", control_.u, prefix); @@ -190,8 +350,8 @@ ESymSolverStatus Ma77SolverInterface::InitializeStructure( // mc68 requires a half matrix. A future version will support full // matrix entry, and this code should be removed when it is available. - Index* ia_half = new Index[dim + 1]; - Index* ja_half = new Index[ia[dim] - 1]; + int* ia_half = new int[dim + 1]; + int* ja_half = new int[ia[dim] - 1]; { int k = 0; for( int i = 0; i < dim; i++ ) @@ -210,7 +370,7 @@ ESymSolverStatus Ma77SolverInterface::InitializeStructure( mc68_default_control(&control68); control68.f_array_in = 1; // Use Fortran numbering (faster) control68.f_array_out = 1; // Use Fortran numbering (faster) - Index* perm = new Index[dim]; + int* perm = new int[dim]; if( ordering_ == ORDER_METIS ) { mc68_order(3, dim, ia_half, ja_half, perm, &control68, &info68); /* MeTiS */ @@ -223,6 +383,7 @@ ESymSolverStatus Ma77SolverInterface::InitializeStructure( { delete[] ia_half; delete[] ja_half; + delete[] perm; return SYMSOLVER_FATAL_ERROR; } } @@ -233,6 +394,7 @@ ESymSolverStatus Ma77SolverInterface::InitializeStructure( { delete[] ia_half; delete[] ja_half; + delete[] perm; return SYMSOLVER_FATAL_ERROR; } } @@ -243,6 +405,7 @@ ESymSolverStatus Ma77SolverInterface::InitializeStructure( ma77_open(ndim_, "ma77_int", "ma77_real", "ma77_work", "ma77_delay", &keep_, &control_, &info); if( info.flag < 0 ) { + delete[] perm; return SYMSOLVER_FATAL_ERROR; } @@ -252,6 +415,7 @@ ESymSolverStatus Ma77SolverInterface::InitializeStructure( ma77_input_vars(i + 1, ia[i + 1] - ia[i], &(ja[ia[i] - 1]), &keep_, &control_, &info); if( info.flag < 0 ) { + delete[] perm; return SYMSOLVER_FATAL_ERROR; } } @@ -270,7 +434,7 @@ ESymSolverStatus Ma77SolverInterface::InitializeStructure( { delete[] val_; } - val_ = new double[nonzeros]; + val_ = new Number[nonzeros]; if( info.flag >= 0 ) { @@ -287,7 +451,7 @@ ESymSolverStatus Ma77SolverInterface::MultiSolve( const Index* ia, const Index* /*ja*/, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ) @@ -357,12 +521,10 @@ bool Ma77SolverInterface::IncreaseQuality() Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Increasing pivot tolerance for HSL_MA77 from %7.2e ", control_.u); - control_.u = Min(umax_, pow(control_.u, 0.75)); + control_.u = Min(umax_, std::pow(control_.u, Number(0.75))); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "to %7.2e.\n", control_.u); return true; } } // namespace Ipopt - -#endif /* COINHSL_HAS_MA77 or IPOPT_HAS_LINEARSOLVERLOADER */ diff --git a/src/Algorithm/LinearSolvers/IpMa77SolverInterface.hpp b/src/Algorithm/LinearSolvers/IpMa77SolverInterface.hpp index 10538fb89..0502ffbde 100644 --- a/src/Algorithm/LinearSolvers/IpMa77SolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpMa77SolverInterface.hpp @@ -11,12 +11,192 @@ #define __IPMA77SOLVERINTERFACE_HPP__ #include "IpSparseSymLinearSolverInterface.hpp" +#include "IpLibraryLoader.hpp" +#include "IpTypes.h" extern "C" { +#ifdef IPOPT_SINGLE +#include "hsl_ma77s.h" +#else #include "hsl_ma77d.h" +#endif +#include "hsl_mc68i.h" } +/// @since 3.14.0 +#define IPOPT_DECL_MA77_DEFAULT_CONTROL(x) void (x)( \ + struct ma77_control* control \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_OPEN_NELT(x) void (x)( \ + const int n, \ + const char* fname1, \ + const char* fname2, \ + const char* fname3, \ + const char* fname4, \ + void** keep, \ + const struct ma77_control* control,\ + struct ma77_info* info, \ + const int nelt \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_OPEN(x) void (x)( \ + const int n, \ + const char* fname1, \ + const char* fname2, \ + const char* fname3, \ + const char* fname4, \ + void** keep, \ + const struct ma77_control* control,\ + struct ma77_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_INPUT_VARS(x) void (x)( \ + const int idx, \ + const int nvar, \ + const int list[], \ + void** keep, \ + const struct ma77_control* control,\ + struct ma77_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_INPUT_REALS(x) void (x)( \ + const int idx, \ + const int length, \ + const ipnumber reals[],\ + void** keep, \ + const struct ma77_control* control,\ + struct ma77_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_ANALYSE(x) void (x)( \ + const int order[], \ + void** keep, \ + const struct ma77_control* control, \ + struct ma77_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_FACTOR(x) void (x)( \ + const int posdef, \ + void** keep, \ + const struct ma77_control* control,\ + struct ma77_info* info, \ + const ipnumber* scale \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_FACTOR_SOLVE(x) void (x)( \ + const int posdef, \ + void** keep, \ + const struct ma77_control* control,\ + struct ma77_info* info, \ + const ipnumber* scale, \ + const int nrhs, \ + const int lx, \ + ipnumber rhs[] \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_SOLVE(x) void (x)( \ + const int job, \ + const int nrhs, \ + const int lx, \ + ipnumber xx[], \ + void** keep, \ + const struct ma77_control* control,\ + struct ma77_info* info, \ + const ipnumber* scale \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_RESID(x) void (x)( \ + const int nrhs, \ + const int lx, \ + const ipnumber xx[], \ + const int lresid, \ + ipnumber resid[], \ + void** keep, \ + const struct ma77_control* control, \ + struct ma77_info* info, \ + ipnumber* anorm_bnd\ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_SCALE(x) void (x)( \ + ipnumber scale[], \ + void** keep, \ + const struct ma77_control* control, \ + struct ma77_info* info, \ + ipnumber* anorm \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_ENQUIRE_POSDEF(x) void (x)( \ + ipnumber d[], \ + void** keep, \ + const struct ma77_control* control,\ + struct ma77_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_ENQUIRE_INDEF(x) void (x)( \ + int piv_order[], \ + ipnumber d[], \ + void** keep, \ + const struct ma77_control* control, \ + struct ma77_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_ALTER(x) void (x)( \ + const ipnumber d[], \ + void** keep, \ + const struct ma77_control* control, \ + struct ma77_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_RESTART(x) void (x)( \ + const char* restart_file, \ + const char* fname1, \ + const char* fname2, \ + const char* fname3, \ + const char* fname4, \ + void** keep, \ + const struct ma77_control* control, \ + struct ma77_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA77_FINALISE(x) void (x)( \ + void** keep, \ + const struct ma77_control* control,\ + struct ma77_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MC68_DEFAULT_CONTROL(x) void (x)( \ + struct mc68_control* control \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MC68_ORDER(x) void (x)( \ + int ord, \ + int n, \ + const int ptr[], \ + const int row[], \ + int perm[], \ + const struct mc68_control* control,\ + struct mc68_info* info \ +) + namespace Ipopt { @@ -30,22 +210,67 @@ class Ma77SolverInterface: public SparseSymLinearSolverInterface }; int ndim_; ///< Number of dimensions - double* val_; ///< Storage for variables + Number* val_; ///< Storage for variables int numneg_; ///< Number of negative pivots in last factorization void* keep_; ///< Stores pointer to factors (only understood by Fortran code!) bool pivtol_changed_; ///< indicates if pivtol has been changed /* Options */ struct ma77_control control_; - double umax_; + Number umax_; int ordering_; + /**@name MA77 and MC68 function pointers + * @{ + */ + SmartPtr hslloader; + + IPOPT_DECL_MA77_DEFAULT_CONTROL(*ma77_default_control); + IPOPT_DECL_MA77_OPEN_NELT(*ma77_open_nelt); + IPOPT_DECL_MA77_OPEN(*ma77_open); + IPOPT_DECL_MA77_INPUT_VARS(*ma77_input_vars); + IPOPT_DECL_MA77_INPUT_REALS(*ma77_input_reals); + IPOPT_DECL_MA77_ANALYSE(*ma77_analyse); + IPOPT_DECL_MA77_FACTOR(*ma77_factor); + IPOPT_DECL_MA77_FACTOR_SOLVE(*ma77_factor_solve); + IPOPT_DECL_MA77_SOLVE(*ma77_solve); + IPOPT_DECL_MA77_RESID(*ma77_resid); + IPOPT_DECL_MA77_SCALE(*ma77_scale); + IPOPT_DECL_MA77_ENQUIRE_POSDEF(*ma77_enquire_posdef); + IPOPT_DECL_MA77_ENQUIRE_INDEF(*ma77_enquire_indef); + IPOPT_DECL_MA77_ALTER(*ma77_alter); + IPOPT_DECL_MA77_RESTART(*ma77_restart); + IPOPT_DECL_MA77_FINALISE(*ma77_finalise); + IPOPT_DECL_MC68_DEFAULT_CONTROL(*mc68_default_control); + IPOPT_DECL_MC68_ORDER(*mc68_order); + ///@} + public: - Ma77SolverInterface() - : val_(NULL), - keep_(NULL), - pivtol_changed_(false) + Ma77SolverInterface( + SmartPtr hslloader_ ///< @since 3.14.0 + ) : val_(NULL), + keep_(NULL), + pivtol_changed_(false), + hslloader(hslloader_), + ma77_default_control(NULL), + ma77_open_nelt(NULL), + ma77_open(NULL), + ma77_input_vars(NULL), + ma77_input_reals(NULL), + ma77_analyse(NULL), + ma77_factor(NULL), + ma77_factor_solve(NULL), + ma77_solve(NULL), + ma77_resid(NULL), + ma77_scale(NULL), + ma77_enquire_posdef(NULL), + ma77_enquire_indef(NULL), + ma77_alter(NULL), + ma77_restart(NULL), + ma77_finalise(NULL), + mc68_default_control(NULL), + mc68_order(NULL) { } ~Ma77SolverInterface(); @@ -54,13 +279,36 @@ class Ma77SolverInterface: public SparseSymLinearSolverInterface SmartPtr roptions ); + /// set MA77 and MC68 functions to use for every instantiation of this class + /// @since 3.14.0 + static void SetFunctions( + IPOPT_DECL_MA77_DEFAULT_CONTROL(*ma77_default_control), + IPOPT_DECL_MA77_OPEN_NELT(*ma77_open_nelt), + IPOPT_DECL_MA77_OPEN(*ma77_open), + IPOPT_DECL_MA77_INPUT_VARS(*ma77_input_vars), + IPOPT_DECL_MA77_INPUT_REALS(*ma77_input_reals), + IPOPT_DECL_MA77_ANALYSE(*ma77_analyse), + IPOPT_DECL_MA77_FACTOR(*ma77_factor), + IPOPT_DECL_MA77_FACTOR_SOLVE(*ma77_factor_solve), + IPOPT_DECL_MA77_SOLVE(*ma77_solve), + IPOPT_DECL_MA77_RESID(*ma77_resid), + IPOPT_DECL_MA77_SCALE(*ma77_scale), + IPOPT_DECL_MA77_ENQUIRE_POSDEF(*ma77_enquire_posdef), + IPOPT_DECL_MA77_ENQUIRE_INDEF(*ma77_enquire_indef), + IPOPT_DECL_MA77_ALTER(*ma77_alter), + IPOPT_DECL_MA77_RESTART(*ma77_restart), + IPOPT_DECL_MA77_FINALISE(*ma77_finalise), + IPOPT_DECL_MC68_DEFAULT_CONTROL(*mc68_default_control), + IPOPT_DECL_MC68_ORDER(*mc68_order) + ); + bool InitializeImpl( const OptionsList& options, const std::string& prefix ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ ESymSolverStatus InitializeStructure( Index dim, Index nonzeros, @@ -68,7 +316,7 @@ class Ma77SolverInterface: public SparseSymLinearSolverInterface const Index* ja ); - double* GetValuesArrayPtr() + Number* GetValuesArrayPtr() { return val_; } @@ -78,7 +326,7 @@ class Ma77SolverInterface: public SparseSymLinearSolverInterface const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ); @@ -87,10 +335,10 @@ class Ma77SolverInterface: public SparseSymLinearSolverInterface { return numneg_; } - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ bool IncreaseQuality(); bool ProvidesInertia() const @@ -102,11 +350,11 @@ class Ma77SolverInterface: public SparseSymLinearSolverInterface { return CSR_Full_Format_1_Offset; } - //@} + ///@} /** @name Methods related to the detection of linearly dependent * rows in a matrix */ - //@{ + ///@{ bool ProvidesDegeneracyDetection() const { return false; diff --git a/src/Algorithm/LinearSolvers/IpMa86SolverInterface.cpp b/src/Algorithm/LinearSolvers/IpMa86SolverInterface.cpp index 5839779ed..e8155d31c 100644 --- a/src/Algorithm/LinearSolvers/IpMa86SolverInterface.cpp +++ b/src/Algorithm/LinearSolvers/IpMa86SolverInterface.cpp @@ -9,27 +9,29 @@ // Carl Laird, Andreas Waechter IBM 2004-03-17 #include "IpoptConfig.h" +#include "IpMa86SolverInterface.hpp" + +#include +#include #ifdef IPOPT_HAS_HSL #include "CoinHslConfig.h" #endif -// if we do not have MA86 in HSL or the linear solver loader, then we want to build the MA86 interface -#if defined(COINHSL_HAS_MA86) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - -#include "IpMa86SolverInterface.hpp" -#include -#include using namespace std; -extern "C" -{ -#include "hsl_mc68i.h" -} - namespace Ipopt { +static IPOPT_DECL_MA86_DEFAULT_CONTROL(*user_ma86_default_control) = NULL; +static IPOPT_DECL_MA86_ANALYSE(*user_ma86_analyse) = NULL; +static IPOPT_DECL_MA86_FACTOR(*user_ma86_factor) = NULL; +static IPOPT_DECL_MA86_FACTOR_SOLVE(*user_ma86_factor_solve) = NULL; +static IPOPT_DECL_MA86_SOLVE(*user_ma86_solve) = NULL; +static IPOPT_DECL_MA86_FINALISE(*user_ma86_finalise) = NULL; +static IPOPT_DECL_MC68_DEFAULT_CONTROL(*user_mc68_default_control) = NULL; +static IPOPT_DECL_MC68_ORDER(*user_mc68_order) = NULL; + Ma86SolverInterface::~Ma86SolverInterface() { delete[] val_; @@ -48,13 +50,8 @@ void Ma86SolverInterface::RegisterOptions( roptions->AddIntegerOption( "ma86_print_level", "Debug printing level", - -1); - /* - "<0 no printing.\n" - "0 Error and warning messages only.\n" - "=1 Limited diagnostic printing.\n" - ">1 Additional diagnostic printing."); - */ + -1, + "<0: no printing; 0: Error and warning messages only; 1: Limited diagnostic printing; >1 Additional diagnostic printing."); roptions->AddLowerBoundedIntegerOption( "ma86_nemin", "Node Amalgamation parameter", @@ -109,18 +106,100 @@ void Ma86SolverInterface::RegisterOptions( "metis", "Use the MeTiS nested dissection algorithm (if available)"); } +void Ma86SolverInterface::SetFunctions( + IPOPT_DECL_MA86_DEFAULT_CONTROL(*ma86_default_control), + IPOPT_DECL_MA86_ANALYSE(*ma86_analyse), + IPOPT_DECL_MA86_FACTOR(*ma86_factor), + IPOPT_DECL_MA86_FACTOR_SOLVE(*ma86_factor_solve), + IPOPT_DECL_MA86_SOLVE(*ma86_solve), + IPOPT_DECL_MA86_FINALISE(*ma86_finalise), + IPOPT_DECL_MC68_DEFAULT_CONTROL(*mc68_default_control), + IPOPT_DECL_MC68_ORDER(*mc68_order) +) +{ + DBG_ASSERT(ma86_default_control != NULL); + DBG_ASSERT(ma86_analyse != NULL); + DBG_ASSERT(ma86_factor != NULL); + DBG_ASSERT(ma86_factor_solve != NULL); + DBG_ASSERT(ma86_solve != NULL); + DBG_ASSERT(ma86_finalise != NULL); + DBG_ASSERT(mc68_default_control != NULL); + DBG_ASSERT(mc68_order != NULL); + + user_ma86_default_control = ma86_default_control; + user_ma86_analyse = ma86_analyse; + user_ma86_factor = ma86_factor; + user_ma86_factor_solve = ma86_factor_solve; + user_ma86_solve = ma86_solve; + user_ma86_finalise = ma86_finalise; + user_mc68_default_control = mc68_default_control; + user_mc68_order = mc68_order; +} + bool Ma86SolverInterface::InitializeImpl( const OptionsList& options, const std::string& prefix ) { + if( user_ma86_default_control != NULL ) + { + ma86_default_control = user_ma86_default_control; + ma86_analyse = user_ma86_analyse; + ma86_factor = user_ma86_factor; + ma86_factor_solve = user_ma86_factor_solve; + ma86_solve = user_ma86_solve; + ma86_finalise = user_ma86_finalise; + mc68_default_control = user_mc68_default_control; + mc68_order = user_mc68_order; + } + else + { +#if (defined(COINHSL_HAS_MA86) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA86S) && defined(IPOPT_SINGLE)) + // use HSL functions that should be available in linked HSL library + ma86_default_control = &::ma86_default_control; + ma86_analyse = &::ma86_analyse; + ma86_factor = &::ma86_factor; + ma86_factor_solve = &::ma86_factor_solve; + ma86_solve = &::ma86_solve; + ma86_finalise = &::ma86_finalise; + mc68_default_control = &::mc68_default_control; + mc68_order = &::mc68_order; +#else + // try to load HSL functions from a shared library at runtime + DBG_ASSERT(IsValid(hslloader)); + +#define STR2(x) #x +#define STR(x) STR2(x) + ma86_default_control = (IPOPT_DECL_MA86_DEFAULT_CONTROL(*))hslloader->loadSymbol(STR(ma86_default_control)); + ma86_analyse = (IPOPT_DECL_MA86_ANALYSE(*))hslloader->loadSymbol(STR(ma86_analyse)); + ma86_factor = (IPOPT_DECL_MA86_FACTOR(*))hslloader->loadSymbol(STR(ma86_factor)); + ma86_factor_solve = (IPOPT_DECL_MA86_FACTOR_SOLVE(*))hslloader->loadSymbol(STR(ma86_factor_solve)); + ma86_solve = (IPOPT_DECL_MA86_SOLVE(*))hslloader->loadSymbol(STR(ma86_solve)); + ma86_finalise = (IPOPT_DECL_MA86_FINALISE(*))hslloader->loadSymbol(STR(ma86_finalise)); + mc68_default_control = (IPOPT_DECL_MC68_DEFAULT_CONTROL(*))hslloader->loadSymbol(STR(mc68_default_control)); + mc68_order = (IPOPT_DECL_MC68_ORDER(*))hslloader->loadSymbol(STR(mc68_order)); +#endif + } + + DBG_ASSERT(ma86_default_control != NULL); + DBG_ASSERT(ma86_analyse != NULL); + DBG_ASSERT(ma86_factor != NULL); + DBG_ASSERT(ma86_factor_solve != NULL); + DBG_ASSERT(ma86_solve != NULL); + DBG_ASSERT(ma86_finalise != NULL); + DBG_ASSERT(mc68_default_control != NULL); + DBG_ASSERT(mc68_order != NULL); + ma86_default_control(&control_); control_.f_arrays = 1; // Use Fortran numbering (faster) /* Note: we can't set control_.action = false as we need to know the * intertia. (Otherwise we just enter the restoration phase and fail) */ - options.GetIntegerValue("ma86_print_level", control_.diagnostics_level, prefix); - options.GetIntegerValue("ma86_nemin", control_.nemin, prefix); + Index temp; + options.GetIntegerValue("ma86_print_level", temp, prefix); + control_.diagnostics_level = temp; + options.GetIntegerValue("ma86_nemin", temp, prefix); + control_.nemin = temp; options.GetNumericValue("ma86_small", control_.small_, prefix); options.GetNumericValue("ma86_static", control_.static_, prefix); options.GetNumericValue("ma86_u", control_.u, prefix); @@ -166,27 +245,36 @@ ESymSolverStatus Ma86SolverInterface::InitializeStructure( struct ma86_info info, info2; struct mc68_control control68; struct mc68_info info68; - Index* order_amd, *order_metis; - void* keep_amd, *keep_metis; + int* order_amd; + int* order_metis; + void* keep_amd; + void* keep_metis; // Store size for later use ndim_ = dim; + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemSymbolicFactorization().Start(); + } + // Determine an ordering mc68_default_control(&control68); control68.f_array_in = 1; // Use Fortran numbering (faster) control68.f_array_out = 1; // Use Fortran numbering (faster) order_amd = NULL; order_metis = NULL; + DBG_ASSERT(ordering_ == ORDER_METIS || ordering_ == ORDER_AMD || ordering_ == ORDER_AUTO); if( ordering_ == ORDER_METIS || ordering_ == ORDER_AUTO ) { - order_metis = new Index[dim]; + order_metis = new int[dim]; mc68_order(3, dim, ia, ja, order_metis, &control68, &info68); /* MeTiS */ if( info68.flag == -5 ) { // MeTiS not available ordering_ = ORDER_AMD; delete[] order_metis; + order_metis = NULL; } else if( info68.flag < 0 ) { @@ -195,7 +283,7 @@ ESymSolverStatus Ma86SolverInterface::InitializeStructure( } if( ordering_ == ORDER_AMD || ordering_ == ORDER_AUTO ) { - order_amd = new Index[dim]; + order_amd = new int[dim]; mc68_order(1, dim, ia, ja, order_amd, &control68, &info68); /* AMD */ } if( info68.flag < 0 ) @@ -203,11 +291,6 @@ ESymSolverStatus Ma86SolverInterface::InitializeStructure( return SYMSOLVER_FATAL_ERROR; } - if( HaveIpData() ) - { - IpData().TimingStats().LinearSystemSymbolicFactorization().Start(); - } - // perform analyse if( ordering_ == ORDER_AUTO ) { @@ -263,7 +346,7 @@ ESymSolverStatus Ma86SolverInterface::InitializeStructure( { delete[] val_; } - val_ = new double[nonzeros]; + val_ = new Number[nonzeros]; if( info.flag >= 0 ) { @@ -280,7 +363,7 @@ ESymSolverStatus Ma86SolverInterface::MultiSolve( const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals) { @@ -303,7 +386,7 @@ ESymSolverStatus Ma86SolverInterface::MultiSolve( { return SYMSOLVER_FATAL_ERROR; } - if( info.flag == 2 || info.flag == -3 ) + if( info.flag == 2 /* || info.flag == -3 */ ) { return SYMSOLVER_SINGULAR; } @@ -351,12 +434,10 @@ bool Ma86SolverInterface::IncreaseQuality() Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Increasing pivot tolerance for HSL_MA86 from %7.2e ", control_.u); - control_.u = Min(umax_, pow(control_.u, 0.75)); + control_.u = Min(umax_, std::pow(control_.u, Number(0.75))); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "to %7.2e.\n", control_.u); return true; } } // namespace Ipopt - -#endif /* COINHSL_HAS_MA86 or IPOPT_HAS_LINEARSOLVERLOADER */ diff --git a/src/Algorithm/LinearSolvers/IpMa86SolverInterface.hpp b/src/Algorithm/LinearSolvers/IpMa86SolverInterface.hpp index 40681d83d..dd906e970 100644 --- a/src/Algorithm/LinearSolvers/IpMa86SolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpMa86SolverInterface.hpp @@ -12,11 +12,83 @@ #define __IPMA86SOLVERINTERFACE_HPP__ #include "IpSparseSymLinearSolverInterface.hpp" +#include "IpMa77SolverInterface.hpp" // to get MC68 declaration macros +#include "IpLibraryLoader.hpp" +#include "IpTypes.h" + extern "C" { +#ifdef IPOPT_SINGLE +#include "hsl_ma86s.h" +#else #include "hsl_ma86d.h" +#endif } +/// @since 3.14.0 +#define IPOPT_DECL_MA86_DEFAULT_CONTROL(x) void (x)( \ + struct ma86_control* control \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA86_ANALYSE(x) void (x)( \ + const int n, \ + const int ptr[], \ + const int row[], \ + int order[], \ + void** keep, \ + const struct ma86_control* control, \ + struct ma86_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA86_FACTOR(x) void (x)( \ + const int n, \ + const int ptr[], \ + const int row[], \ + const ipnumber val[], \ + const int order[], \ + void** keep, \ + const struct ma86_control* control, \ + struct ma86_info* info, \ + const ipnumber scale[] \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA86_FACTOR_SOLVE(x) void (x)( \ + const int n, \ + const int ptr[], \ + const int row[], \ + const ipnumber val[], \ + const int order[], \ + void** keep, \ + const struct ma86_control* control, \ + struct ma86_info* info, \ + const int nrhs, \ + const int ldx, \ + ipnumber xx[], \ + const ipnumber scale[] \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA86_SOLVE(x) void (x)( \ + const int job, \ + const int nrhs, \ + const int ldx, \ + ipnumber* xx, \ + const int order[],\ + void** keep, \ + const struct ma86_control* control,\ + struct ma86_info* info, \ + const ipnumber scale[] \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA86_FINALISE(x) void (x)( \ + void** keep, \ + const struct ma86_control* control \ +) + namespace Ipopt { @@ -31,24 +103,49 @@ class Ma86SolverInterface: public SparseSymLinearSolverInterface }; int ndim_; ///< Number of dimensions - double* val_; ///< Storage for variables + Number* val_; ///< Storage for variables int numneg_; ///< Number of negative pivots in last factorization - Index* order_; ///< Fill reducing permutation + int* order_; ///< Fill reducing permutation void* keep_; ///< Stores pointer to factors (only understood by Fortran code!) bool pivtol_changed_; ///< indicates if pivtol has been changed /* Options */ struct ma86_control control_; - double umax_; + Number umax_; int ordering_; + /**@name MA68 and MC68 function pointers + * @{ + */ + SmartPtr hslloader; + + IPOPT_DECL_MA86_DEFAULT_CONTROL(*ma86_default_control); + IPOPT_DECL_MA86_ANALYSE(*ma86_analyse); + IPOPT_DECL_MA86_FACTOR(*ma86_factor); + IPOPT_DECL_MA86_FACTOR_SOLVE(*ma86_factor_solve); + IPOPT_DECL_MA86_SOLVE(*ma86_solve); + IPOPT_DECL_MA86_FINALISE(*ma86_finalise); + IPOPT_DECL_MC68_DEFAULT_CONTROL(*mc68_default_control); + IPOPT_DECL_MC68_ORDER(*mc68_order); + ///@} + public: - Ma86SolverInterface() - : val_(NULL), - order_(NULL), - keep_(NULL), - pivtol_changed_(false) + Ma86SolverInterface( + SmartPtr hslloader_ ///< @since 3.14.0 + ) : val_(NULL), + order_(NULL), + keep_(NULL), + pivtol_changed_(false), + hslloader(hslloader_), + ma86_default_control(NULL), + ma86_analyse(NULL), + ma86_factor(NULL), + ma86_factor_solve(NULL), + ma86_solve(NULL), + ma86_finalise(NULL), + mc68_default_control(NULL), + mc68_order(NULL) { } ~Ma86SolverInterface(); @@ -57,13 +154,26 @@ class Ma86SolverInterface: public SparseSymLinearSolverInterface SmartPtr roptions ); + /// set MA86 and MC68 functions to use for every instantiation of this class + /// @since 3.14.0 + static void SetFunctions( + IPOPT_DECL_MA86_DEFAULT_CONTROL(*ma86_default_control), + IPOPT_DECL_MA86_ANALYSE(*ma86_analyse), + IPOPT_DECL_MA86_FACTOR(*ma86_factor), + IPOPT_DECL_MA86_FACTOR_SOLVE(*ma86_factor_solve), + IPOPT_DECL_MA86_SOLVE(*ma86_solve), + IPOPT_DECL_MA86_FINALISE(*ma86_finalise), + IPOPT_DECL_MC68_DEFAULT_CONTROL(*mc68_default_control), + IPOPT_DECL_MC68_ORDER(*mc68_order) + ); + bool InitializeImpl( const OptionsList& options, const std::string& prefix ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ ESymSolverStatus InitializeStructure( Index dim, Index nonzeros, @@ -71,7 +181,7 @@ class Ma86SolverInterface: public SparseSymLinearSolverInterface const Index* ja ); - double* GetValuesArrayPtr() + Number* GetValuesArrayPtr() { return val_; } @@ -81,7 +191,7 @@ class Ma86SolverInterface: public SparseSymLinearSolverInterface const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ); @@ -90,10 +200,10 @@ class Ma86SolverInterface: public SparseSymLinearSolverInterface { return numneg_; } - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ bool IncreaseQuality(); bool ProvidesInertia() const @@ -105,11 +215,11 @@ class Ma86SolverInterface: public SparseSymLinearSolverInterface { return CSR_Format_1_Offset; } - //@} + ///@} /** @name Methods related to the detection of linearly dependent * rows in a matrix */ - //@{ + ///@{ bool ProvidesDegeneracyDetection() const { return false; diff --git a/src/Algorithm/LinearSolvers/IpMa97SolverInterface.cpp b/src/Algorithm/LinearSolvers/IpMa97SolverInterface.cpp index 2cdc612cb..02f41ffcf 100644 --- a/src/Algorithm/LinearSolvers/IpMa97SolverInterface.cpp +++ b/src/Algorithm/LinearSolvers/IpMa97SolverInterface.cpp @@ -4,52 +4,59 @@ // All Rights Reserved. // This code is published under the Eclipse Public License. // -// $Id: IpMa97SolverInterface.cpp 2003 2011-06-03 03:53:44Z andreasw $ -// // Authors: Jonathan Hogg STFC 2012-12-21 // Jonathan Hogg 2009-07-29 // Carl Laird, Andreas Waechter IBM 2004-03-17 #include "IpoptConfig.h" - -#ifdef IPOPT_HAS_HSL -#include "CoinHslConfig.h" -#else -/* if we build for the Linear Solver loader, then use normal C-naming style */ -#define IPOPT_HSL_FUNC(name,NAME) name -#endif - -// if we have MA97 in HSL or the linear solver loader, then we want to build the MA97 interface -#if defined(COINHSL_HAS_MA97) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - #include "IpMa97SolverInterface.hpp" + #include #include #include #include -using namespace std; +#ifdef IPOPT_HAS_HSL +#include "CoinHslConfig.h" +#endif /* Uncomment the following line to enable the ma97_dump_matrix option. * This option requires a version of the coinhsl that supports this function. + * This is only available when linking against coinhsl, not when loading at runtime. */ //#define MA97_DUMP_MATRIX #ifdef MA97_DUMP_MATRIX +#ifdef IPOPT_SINGLE +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name,NAME) +#else +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name ## d,NAME ## D) +#endif + extern "C" { - extern void IPOPT_HSL_FUNC(dump_mat_csc, DUMP_MAT_CSC) ( - const ipfint* factidx, - const ipfint* n, - const ipfint* ptr, - const ipfint* row, - const double* a + extern void IPOPT_HSL_FUNCP(dump_mat_csc, DUMP_MAT_CSC) ( + const ipindex* factidx, + const ipindex* n, + const ipindex* ptr, + const ipindex* row, + const ipnumber* a ); } #endif +using namespace std; + namespace Ipopt { +static IPOPT_DECL_MA97_DEFAULT_CONTROL(*user_ma97_default_control) = NULL; +static IPOPT_DECL_MA97_ANALYSE(*user_ma97_analyse) = NULL; +static IPOPT_DECL_MA97_FACTOR(*user_ma97_factor) = NULL; +static IPOPT_DECL_MA97_FACTOR_SOLVE(*user_ma97_factor_solve) = NULL; +static IPOPT_DECL_MA97_SOLVE(*user_ma97_solve) = NULL; +static IPOPT_DECL_MA97_FINALISE(*user_ma97_finalise) = NULL; +static IPOPT_DECL_MA97_FREE_AKEEP(*user_ma97_free_akeep) = NULL; + Ma97SolverInterface::~Ma97SolverInterface() { delete[] val_; @@ -68,12 +75,8 @@ void Ma97SolverInterface::RegisterOptions( roptions->AddIntegerOption( "ma97_print_level", "Debug printing level", - -1 /* changed from 0 to -1, as MA97 would write error messages about singular systems to stdout, which are "errors" that Ipopt handles fine */ - /* - "<0 no printing.\n" - "0 Error and warning messages only.\n" - "=1 Limited diagnostic printing.\n" - ">1 Additional diagnostic printing."*/); + -1, + "<0: no printing; 0: Error and warning messages only; 1: Limited diagnostic printing; >1 Additional diagnostic printing."); roptions->AddLowerBoundedIntegerOption( "ma97_nemin", "Node Amalgamation parameter", @@ -118,7 +121,8 @@ void Ma97SolverInterface::RegisterOptions( "mc64", "Scale linear system matrix using MC64", "mc77", "Scale linear system matrix using MC77 [1,3,0]", "If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch1. " - "If ma97_switch2 is triggered it is disabled."); + "If ma97_switch2 is triggered it is disabled.", + true); roptions->AddStringOption9( "ma97_switch1", "First switch, determine when ma97_scaling1 is enabled.", @@ -133,7 +137,8 @@ void Ma97SolverInterface::RegisterOptions( "od_hd", "Combination of on_demand and high_delay", "od_hd_reuse", "Combination of on_demand_reuse and high_delay_reuse", "If ma97_scaling=dynamic, ma97_scaling1 is enabled according to this condition. " - "If ma97_switch2 occurs this option is henceforth ignored."); + "If ma97_switch2 occurs this option is henceforth ignored.", + true); roptions->AddStringOption4( "ma97_scaling2", "Second scaling.", @@ -143,7 +148,8 @@ void Ma97SolverInterface::RegisterOptions( "mc64", "Scale linear system matrix using MC64", "mc77", "Scale linear system matrix using MC77 [1,3,0]", "If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch2. " - "If ma97_switch3 is triggered it is disabled."); + "If ma97_switch3 is triggered it is disabled.", + true); roptions->AddStringOption9( "ma97_switch2", "Second switch, determine when ma97_scaling2 is enabled.", @@ -158,7 +164,8 @@ void Ma97SolverInterface::RegisterOptions( "od_hd", "Combination of on_demand and high_delay", "od_hd_reuse", "Combination of on_demand_reuse and high_delay_reuse", "If ma97_scaling=dynamic, ma97_scaling2 is enabled according to this condition. " - "If ma97_switch3 occurs this option is henceforth ignored."); + "If ma97_switch3 occurs this option is henceforth ignored.", + true); roptions->AddStringOption4( "ma97_scaling3", "Third scaling.", @@ -167,7 +174,8 @@ void Ma97SolverInterface::RegisterOptions( "mc30", "Scale linear system matrix using MC30", "mc64", "Scale linear system matrix using MC64", "mc77", "Scale linear system matrix using MC77 [1,3,0]", - "If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch3."); + "If ma97_scaling=dynamic, this scaling is used according to the trigger ma97_switch3.", + true); roptions->AddStringOption9( "ma97_switch3", "Third switch, determine when ma97_scaling3 is enabled.", @@ -181,7 +189,8 @@ void Ma97SolverInterface::RegisterOptions( "high_delay_reuse", "Scaling to be used only when previous itr created more that 0.05*n additional delays, otherwise reuse scaling from previous itr", "od_hd", "Combination of on_demand and high_delay", "od_hd_reuse", "Combination of on_demand_reuse and high_delay_reuse", - "If ma97_scaling=dynamic, ma97_scaling3 is enabled according to this condition."); + "If ma97_scaling=dynamic, ma97_scaling3 is enabled according to this condition.", + true); roptions->AddStringOption7( "ma97_order", "Controls type of ordering", @@ -206,7 +215,37 @@ void Ma97SolverInterface::RegisterOptions( "Controls if blas2 or blas3 routines are used for solve", "no", "no", "Use BLAS2 (faster, some implementations bit incompatible)", - "yes", "Use BLAS3 (slower)"); + "yes", "Use BLAS3 (slower)", + "", + true); +} + +/// set MA97 functions to use for every instantiation of this class +void Ma97SolverInterface::SetFunctions( + IPOPT_DECL_MA97_DEFAULT_CONTROL(*ma97_default_control), + IPOPT_DECL_MA97_ANALYSE(*ma97_analyse), + IPOPT_DECL_MA97_FACTOR(*ma97_factor), + IPOPT_DECL_MA97_FACTOR_SOLVE(*ma97_factor_solve), + IPOPT_DECL_MA97_SOLVE(*ma97_solve), + IPOPT_DECL_MA97_FINALISE(*ma97_finalise), + IPOPT_DECL_MA97_FREE_AKEEP(*ma97_free_akeep) +) +{ + DBG_ASSERT(ma97_default_control != NULL); + DBG_ASSERT(ma97_analyse != NULL); + DBG_ASSERT(ma97_factor != NULL); + DBG_ASSERT(ma97_factor_solve != NULL); + DBG_ASSERT(ma97_solve != NULL); + DBG_ASSERT(ma97_finalise != NULL); + DBG_ASSERT(ma97_free_akeep != NULL); + + user_ma97_default_control = ma97_default_control; + user_ma97_analyse = ma97_analyse; + user_ma97_factor = ma97_factor; + user_ma97_factor_solve = ma97_factor_solve; + user_ma97_solve = ma97_solve; + user_ma97_finalise = ma97_finalise; + user_ma97_free_akeep = ma97_free_akeep; } int Ma97SolverInterface::ScaleNameToNum( @@ -239,16 +278,64 @@ bool Ma97SolverInterface::InitializeImpl( const std::string& prefix ) { + if( user_ma97_default_control != NULL ) + { + ma97_default_control = user_ma97_default_control; + ma97_analyse = user_ma97_analyse; + ma97_factor = user_ma97_factor; + ma97_factor_solve = user_ma97_factor_solve; + ma97_solve = user_ma97_solve; + ma97_finalise = user_ma97_finalise; + ma97_free_akeep = user_ma97_free_akeep; + } + else + { +#if (defined(COINHSL_HAS_MA97) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA97S) && defined(IPOPT_SINGLE)) + // use HSL functions that should be available in linked HSL library + ma97_default_control = &::ma97_default_control; + ma97_analyse = &::ma97_analyse; + ma97_factor = &::ma97_factor; + ma97_factor_solve = &::ma97_factor_solve; + ma97_solve = &::ma97_solve; + ma97_finalise = &::ma97_finalise; + ma97_free_akeep = &::ma97_free_akeep; +#else + // try to load HSL functions from a shared library at runtime + DBG_ASSERT(IsValid(hslloader)); + +#define STR2(x) #x +#define STR(x) STR2(x) + ma97_default_control = (IPOPT_DECL_MA97_DEFAULT_CONTROL(*))hslloader->loadSymbol(STR(ma97_default_control)); + ma97_analyse = (IPOPT_DECL_MA97_ANALYSE(*))hslloader->loadSymbol(STR(ma97_analyse)); + ma97_factor = (IPOPT_DECL_MA97_FACTOR(*))hslloader->loadSymbol(STR(ma97_factor)); + ma97_factor_solve = (IPOPT_DECL_MA97_FACTOR_SOLVE(*))hslloader->loadSymbol(STR(ma97_factor_solve)); + ma97_solve = (IPOPT_DECL_MA97_SOLVE(*))hslloader->loadSymbol(STR(ma97_solve)); + ma97_finalise = (IPOPT_DECL_MA97_FINALISE(*))hslloader->loadSymbol(STR(ma97_finalise)); + ma97_free_akeep = (IPOPT_DECL_MA97_FREE_AKEEP(*))hslloader->loadSymbol(STR(ma97_free_akeep)); +#endif + } + + DBG_ASSERT(ma97_default_control != NULL); + DBG_ASSERT(ma97_analyse != NULL); + DBG_ASSERT(ma97_factor != NULL); + DBG_ASSERT(ma97_factor_solve != NULL); + DBG_ASSERT(ma97_solve != NULL); + DBG_ASSERT(ma97_finalise != NULL); + DBG_ASSERT(ma97_free_akeep != NULL); + ma97_default_control(&control_); control_.f_arrays = 1; // Use Fortran numbering (faster) control_.action = 0; // false, shuold exit with error on singularity - options.GetIntegerValue("ma97_print_level", control_.print_level, prefix); - options.GetIntegerValue("ma97_nemin", control_.nemin, prefix); + Index temp; + options.GetIntegerValue("ma97_print_level", temp, prefix); + control_.print_level = temp; + options.GetIntegerValue("ma97_nemin", temp, prefix); + control_.nemin = temp; options.GetNumericValue("ma97_small", control_.small, prefix); options.GetNumericValue("ma97_u", control_.u, prefix); options.GetNumericValue("ma97_umax", umax_, prefix); - std::string order_method, scaling_method, rescale_strategy; + std::string order_method, scaling_method; options.GetStringValue("ma97_order", order_method, prefix); if( order_method == "metis" ) { @@ -384,7 +471,8 @@ ESymSolverStatus Ma97SolverInterface::InitializeStructure( ) { struct ma97_info info, info2; - void* akeep_amd, *akeep_metis; + void* akeep_amd; + void* akeep_metis; // Store size for later use ndim_ = dim; @@ -394,7 +482,7 @@ ESymSolverStatus Ma97SolverInterface::InitializeStructure( { delete[] val_; } - val_ = new double[nonzeros]; + val_ = new Number[nonzeros]; // Check if analyse needs to be postponed if( ordering_ == ORDER_MATCHED_AMD || ordering_ == ORDER_MATCHED_METIS ) @@ -431,7 +519,7 @@ ESymSolverStatus Ma97SolverInterface::InitializeStructure( return SYMSOLVER_FATAL_ERROR; } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "AMD nfactor = %d, nflops = %d:\n", info2.num_factor, info2.num_flops); + "AMD nfactor = %ld, nflops = %ld:\n", info2.num_factor, info2.num_flops); control_.ordering = 3; // METIS ma97_analyse(0, dim, ia, ja, NULL, &akeep_metis, &control_, &info, NULL); if( info.flag < 0 ) @@ -439,7 +527,7 @@ ESymSolverStatus Ma97SolverInterface::InitializeStructure( return SYMSOLVER_FATAL_ERROR; } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "MeTiS nfactor = %d, nflops = %d:\n", info.num_factor, info.num_flops); + "MeTiS nfactor = %ld, nflops = %ld:\n", info.num_factor, info.num_flops); if( info.num_flops > info2.num_flops ) { // Use AMD @@ -503,7 +591,7 @@ ESymSolverStatus Ma97SolverInterface::InitializeStructure( } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "HSL_MA97: PREDICTED nfactor %d, maxfront %d\n", info.num_factor, info.maxfront); + "HSL_MA97: PREDICTED nfactor %ld, maxfront %d\n", info.num_factor, info.maxfront); if( HaveIpData() ) { @@ -525,13 +613,12 @@ ESymSolverStatus Ma97SolverInterface::MultiSolve( const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ) { struct ma97_info info; - Number t1 = 0, t2; if( new_matrix || pivtol_changed_ ) { @@ -541,7 +628,7 @@ ESymSolverStatus Ma97SolverInterface::MultiSolve( { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Dumping matrix %d\n", fctidx_); - IPOPT_HSL_FUNC (dump_mat_csc, DUMP_MAT_CSC) + IPOPT_HSL_FUNCP(dump_mat_csc, DUMP_MAT_CSC) (&fctidx_, &ndim_, ia, ja, val_); fctidx_++; } @@ -556,7 +643,7 @@ ESymSolverStatus Ma97SolverInterface::MultiSolve( control_.scaling = scaling_type_; if( scaling_type_ != 0 && scaling_ == NULL ) { - scaling_ = new double[ndim_]; // alloc if not already + scaling_ = new Number[ndim_]; // alloc if not already } } else @@ -591,7 +678,7 @@ ESymSolverStatus Ma97SolverInterface::MultiSolve( } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "HSL_MA97: PREDICTED nfactor %d, maxfront %d\n", info.num_factor, info.maxfront); + "HSL_MA97: PREDICTED nfactor %ld, maxfront %d\n", info.num_factor, info.maxfront); if( HaveIpData() ) { @@ -611,6 +698,7 @@ ESymSolverStatus Ma97SolverInterface::MultiSolve( } + Number t1 = 0; if( HaveIpData() ) { t1 = IpData().TimingStats().LinearSystemFactorization().TotalWallclockTime(); @@ -620,11 +708,11 @@ ESymSolverStatus Ma97SolverInterface::MultiSolve( //ma97_factor_solve(4, ia, ja, val_, nrhs, rhs_vals, ndim_, &akeep_, &fkeep_, // &control_, &info, scaling_); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "HSL_MA97: delays %d, nfactor %d, nflops %ld, maxfront %d\n", info.num_delay, info.num_factor, info.num_flops, info.maxfront); + "HSL_MA97: delays %d, nfactor %ld, nflops %ld, maxfront %d\n", info.num_delay, info.num_factor, info.num_flops, info.maxfront); if( HaveIpData() ) { IpData().TimingStats().LinearSystemFactorization().End(); - t2 = IpData().TimingStats().LinearSystemFactorization().TotalWallclockTime(); + Number t2 = IpData().TimingStats().LinearSystemFactorization().TotalWallclockTime(); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Ma97SolverInterface::Factorization: ma97_factor_solve took %10.3f\n", t2 - t1); } @@ -691,7 +779,7 @@ ESymSolverStatus Ma97SolverInterface::MultiSolve( if( check_NegEVals && info.num_neg != numberOfNegEVals ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "In Ma97SolverInterface::Factorization: info.num_neg = %d, but numberOfNegEVals = %d\n", info.num_neg, numberOfNegEVals); + "In Ma97SolverInterface::Factorization: info.num_neg = %d, but numberOfNegEVals = %" IPOPT_INDEX_FORMAT "\n", info.num_neg, numberOfNegEVals); return SYMSOLVER_WRONG_INERTIA; } @@ -721,7 +809,14 @@ ESymSolverStatus Ma97SolverInterface::MultiSolve( } } - return SYMSOLVER_SUCCESS; + if( info.flag >= 0 ) + { + return SYMSOLVER_SUCCESS; + } + else + { + return SYMSOLVER_FATAL_ERROR; + } } bool Ma97SolverInterface::IncreaseQuality() @@ -752,12 +847,10 @@ bool Ma97SolverInterface::IncreaseQuality() pivtol_changed_ = true; Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Increasing pivot tolerance for HSL_MA97 from %7.2e ", control_.u); - control_.u = Min(umax_, pow(control_.u, 0.75)); + control_.u = Min(umax_, std::pow(control_.u, Number(0.75))); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "to %7.2e.\n", control_.u); return true; } } // namespace Ipopt - -#endif /* COINHSL_HAS_MA97 or IPOPT_HAS_LINEARSOLVERLOADER */ diff --git a/src/Algorithm/LinearSolvers/IpMa97SolverInterface.hpp b/src/Algorithm/LinearSolvers/IpMa97SolverInterface.hpp index 0c941f489..12a79bbe8 100644 --- a/src/Algorithm/LinearSolvers/IpMa97SolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpMa97SolverInterface.hpp @@ -12,11 +12,88 @@ #define __IPMA97SOLVERINTERFACE_HPP__ #include "IpSparseSymLinearSolverInterface.hpp" +#include "IpLibraryLoader.hpp" +#include "IpTypes.h" + extern "C" { +#ifdef IPOPT_SINGLE +#include "hsl_ma97s.h" +#else #include "hsl_ma97d.h" +#endif } +/// @since 3.14.0 +#define IPOPT_DECL_MA97_DEFAULT_CONTROL(x) void (x)( \ + struct ma97_control* control \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA97_ANALYSE(x) void (x)( \ + const int check, \ + const int n, \ + const int ptr[], \ + const int row[], \ + ipnumber val[], \ + void** akeep, \ + const struct ma97_control* control,\ + struct ma97_info* info, \ + int order[] \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA97_FACTOR(x) void (x)( \ + int matrix_type, \ + const int ptr[], \ + const int row[], \ + const ipnumber val[], \ + void** akeep, \ + void** fkeep, \ + const struct ma97_control* control, \ + struct ma97_info* info, \ + ipnumber scale[] \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA97_FACTOR_SOLVE(x) void (x)( \ + int matrix_type, \ + const int ptr[], \ + const int row[], \ + const ipnumber val[], \ + int nrhs, \ + ipnumber xx[], \ + int ldx, \ + void** akeep, \ + void** fkeep, \ + const struct ma97_control* control, \ + struct ma97_info* info, \ + ipnumber scale[] \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA97_SOLVE(x) void (x)( \ + const int job, \ + const int nrhs, \ + ipnumber* xx, \ + const int ldx, \ + void** akeep, \ + void** fkeep, \ + const struct ma97_control* control, \ + struct ma97_info* info \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA97_FINALISE(x) void (x)( \ + void** akeep, \ + void** fkeep \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_MA97_FREE_AKEEP(x) void (x)( \ + void** akeep \ +) + namespace Ipopt { @@ -47,19 +124,19 @@ class Ma97SolverInterface: public SparseSymLinearSolverInterface }; int ndim_; ///< Number of dimensions - double* val_; ///< Storage for variables + Number* val_; ///< Storage for variables int numneg_; ///< Number of negative pivots in last factorization int numdelay_; ///< Number of delayed pivots last time we scaled void* akeep_; ///< Stores pointer to factors (only understood Fortran code!) void* fkeep_; ///< Stores pointer to factors (only understood Fortran code!) bool pivtol_changed_; ///< indicates if pivtol has been changed bool rescale_; ///< Indicates if we should rescale next factorization - double* scaling_; ///< Store scaling for reuse if doing dynamic scaling + Number* scaling_; ///< Store scaling for reuse if doing dynamic scaling int fctidx_; ///< Current factorization number to dump to /* Options */ struct ma97_control control_; - double umax_; + Number umax_; int ordering_; int scaling_type_; enum scale_opts switch_[3]; @@ -67,19 +144,42 @@ class Ma97SolverInterface: public SparseSymLinearSolverInterface int current_level_; bool dump_; + /**@name MA97 function pointers + * @{ + */ + SmartPtr hslloader; + + IPOPT_DECL_MA97_DEFAULT_CONTROL(*ma97_default_control); + IPOPT_DECL_MA97_ANALYSE(*ma97_analyse); + IPOPT_DECL_MA97_FACTOR(*ma97_factor); + IPOPT_DECL_MA97_FACTOR_SOLVE(*ma97_factor_solve); + IPOPT_DECL_MA97_SOLVE(*ma97_solve); + IPOPT_DECL_MA97_FINALISE(*ma97_finalise); + IPOPT_DECL_MA97_FREE_AKEEP(*ma97_free_akeep); + ///@} + public: - Ma97SolverInterface() - : val_(NULL), - numdelay_(0), - akeep_(NULL), - fkeep_(NULL), - pivtol_changed_(false), - rescale_(false), - scaling_(NULL), - fctidx_(0), - scaling_type_(0), - dump_(false) + Ma97SolverInterface( + SmartPtr hslloader_ ///< @since 3.14.0 + ) : val_(NULL), + numdelay_(0), + akeep_(NULL), + fkeep_(NULL), + pivtol_changed_(false), + rescale_(false), + scaling_(NULL), + fctidx_(0), + scaling_type_(0), + dump_(false), + hslloader(hslloader_), + ma97_default_control(NULL), + ma97_analyse(NULL), + ma97_factor(NULL), + ma97_factor_solve(NULL), + ma97_solve(NULL), + ma97_finalise(NULL), + ma97_free_akeep(NULL) { } ~Ma97SolverInterface(); @@ -88,13 +188,25 @@ class Ma97SolverInterface: public SparseSymLinearSolverInterface SmartPtr roptions ); + /// set MA97 functions to use for every instantiation of this class + /// @since 3.14.0 + static void SetFunctions( + IPOPT_DECL_MA97_DEFAULT_CONTROL(*ma97_default_control), + IPOPT_DECL_MA97_ANALYSE(*ma97_analyse), + IPOPT_DECL_MA97_FACTOR(*ma97_factor), + IPOPT_DECL_MA97_FACTOR_SOLVE(*ma97_factor_solve), + IPOPT_DECL_MA97_SOLVE(*ma97_solve), + IPOPT_DECL_MA97_FINALISE(*ma97_finalise), + IPOPT_DECL_MA97_FREE_AKEEP(*ma97_free_akeep) + ); + bool InitializeImpl( const OptionsList& options, const std::string& prefix ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ ESymSolverStatus InitializeStructure( Index dim, Index nonzeros, @@ -102,7 +214,7 @@ class Ma97SolverInterface: public SparseSymLinearSolverInterface const Index* ja ); - double* GetValuesArrayPtr() + Number* GetValuesArrayPtr() { return val_; } @@ -112,7 +224,7 @@ class Ma97SolverInterface: public SparseSymLinearSolverInterface const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ); @@ -121,10 +233,10 @@ class Ma97SolverInterface: public SparseSymLinearSolverInterface { return numneg_; } - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ bool IncreaseQuality(); bool ProvidesInertia() const @@ -136,11 +248,11 @@ class Ma97SolverInterface: public SparseSymLinearSolverInterface { return CSR_Format_1_Offset; } - //@} + ///@} /** @name Methods related to the detection of linearly dependent * rows in a matrix */ - //@{ + ///@{ bool ProvidesDegeneracyDetection() const { return false; @@ -154,7 +266,7 @@ class Ma97SolverInterface: public SparseSymLinearSolverInterface { return SYMSOLVER_FATAL_ERROR; } - //@} + ///@} /** converts a scaling option name to its ma97 option number */ static int ScaleNameToNum( diff --git a/src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.cpp b/src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.cpp index 0ef99d395..d630e0522 100644 --- a/src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.cpp +++ b/src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.cpp @@ -5,36 +5,34 @@ // Authors: Carl Laird, Andreas Waechter IBM 2004-03-17 #include "IpoptConfig.h" +#include "IpMc19TSymScalingMethod.hpp" +#include "IpTypes.h" + +#include #ifdef IPOPT_HAS_HSL #include "CoinHslConfig.h" -#else -/* if we build for the Linear Solver loader, then use normal C-naming style */ -#define IPOPT_HSL_FUNC(name,NAME) name #endif -// if we do not have MC19 in HSL or the linear solver loader, then we want to build the MC19 interface -#if defined(COINHSL_HAS_MC19) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - -#include "IpMc19TSymScalingMethod.hpp" - -#include +#if (defined(COINHSL_HAS_MC19) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MC19S) && defined(IPOPT_SINGLE)) +#ifdef IPOPT_SINGLE +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name,NAME) +#else +#define IPOPT_HSL_FUNCP(name,NAME) IPOPT_HSL_FUNC(name ## d,NAME ## D) +#endif /** Prototypes for MC19's Fortran subroutines */ extern "C" { -// here we assume that float corresponds to Fortran's single precision - void IPOPT_HSL_FUNC(mc19ad, MC19AD)( - ipfint* N, - ipfint* NZ, - double* A, - ipfint* IRN, - ipfint* ICN, - float* R, - float* C, - float* W - ); + IPOPT_DECL_MC19A(IPOPT_HSL_FUNCP(mc19a, MC19A)); } +#else +#ifdef IPOPT_SINGLE +#define HSLFUNCNAMESUFFIX "" +#else +#define HSLFUNCNAMESUFFIX "d" +#endif +#endif namespace Ipopt { @@ -42,21 +40,58 @@ namespace Ipopt static const Index dbg_verbosity = 0; #endif +static IPOPT_DECL_MC19A(*user_mc19a) = NULL; + +/// set MC19 function to use for every instantiation of this class +void Mc19TSymScalingMethod::SetFunctions( + IPOPT_DECL_MC19A(*mc19a) +) +{ + DBG_ASSERT(mc19a != NULL); + + user_mc19a = mc19a; +} + +IPOPT_DECL_MC19A(*Mc19TSymScalingMethod::GetMC19A()) +{ + return user_mc19a; +} + bool Mc19TSymScalingMethod::InitializeImpl( const OptionsList& /*options*/, const std::string& /*prefix*/ ) { + if( user_mc19a != NULL ) + { + // someone set MC19 functions via setFunctions - prefer these + mc19a = user_mc19a; + } + else + { +#if (defined(COINHSL_HAS_MC19) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MC19S) && defined(IPOPT_SINGLE)) + // use HSL function that should be available in linked HSL library + mc19a = &::IPOPT_HSL_FUNCP(mc19a, MC19A); +#else + // try to load HSL function from a shared library at runtime + DBG_ASSERT(IsValid(hslloader)); + + mc19a = (IPOPT_DECL_MC19A(*))hslloader->loadSymbol("mc19a" HSLFUNCNAMESUFFIX); +#endif + } + + DBG_ASSERT(mc19a != NULL); + return true; } bool Mc19TSymScalingMethod::ComputeSymTScalingFactors( Index n, Index nnz, - const ipfint* airn, - const ipfint* ajcn, - const double* a, - double* scaling_factors + const Index* airn, + const Index* ajcn, + const Number* a, + Number* scaling_factors ) { DBG_START_METH("Mc19TSymScalingMethod::ComputeSymTScalingFactors", @@ -71,27 +106,18 @@ bool Mc19TSymScalingMethod::ComputeSymTScalingFactors( } // First copy the symmetric matrix into an unsymmetric (MA28) // format matrix - ipfint* AIRN2 = new ipfint[2 * nnz]; - ipfint* AJCN2 = new ipfint[2 * nnz]; - double* A2 = new double[2 * nnz]; - ipfint nnz2 = 0; + Index* AIRN2 = new Index[2 * nnz]; + Index* AJCN2 = new Index[2 * nnz]; + Number* A2 = new Number[2 * nnz]; + Index nnz2 = 0; for( Index i = 0; i < nnz; i++ ) { + // ToDo decide if small values in A2 should be set to 0, + // tolerance should probably be based on maximal element in A if( airn[i] == ajcn[i] ) { AIRN2[nnz2] = airn[i]; AJCN2[nnz2] = ajcn[i]; - /* - // ToDo decide if there should be a cut-off for small values in A - // probably based on maximal element in A - // DELETEME - if (fabs(a[i])<1e-10) { - A2[nnz2] = 0.; - } - else { - A2[nnz2] = a[i]; - } - */ A2[nnz2] = a[i]; nnz2++; } @@ -99,28 +125,11 @@ bool Mc19TSymScalingMethod::ComputeSymTScalingFactors( { AIRN2[nnz2] = airn[i]; AJCN2[nnz2] = ajcn[i]; - /* - // DELETEME - if (fabs(a[i])<1e-10) { - A2[nnz2] = 0.; - } - else { - A2[nnz2] = a[i]; - } - */ A2[nnz2] = a[i]; nnz2++; + AIRN2[nnz2] = ajcn[i]; AJCN2[nnz2] = airn[i]; - /* - // DELETEME - if (fabs(a[i])<1e-10) { - A2[nnz2] = 0.; - } - else { - A2[nnz2] = a[i]; - } - */ A2[nnz2] = a[i]; nnz2++; } @@ -139,7 +148,7 @@ bool Mc19TSymScalingMethod::ComputeSymTScalingFactors( float* R = new float[n]; float* C = new float[n]; float* W = new float[5 * n]; - IPOPT_HSL_FUNC(mc19ad, MC19AD)(&n, &nnz2, A2, AIRN2, AJCN2, R, C, W); + mc19a(&n, &nnz2, A2, AIRN2, AJCN2, R, C, W); delete[] W; if( DBG_VERBOSITY() >= 3 ) @@ -159,7 +168,7 @@ bool Mc19TSymScalingMethod::ComputeSymTScalingFactors( Number smax = 0.; for( Index i = 0; i < n; i++ ) { - scaling_factors[i] = exp((double) ((R[i] + C[i]) / 2.)); + scaling_factors[i] = std::exp((Number) ((R[i] + C[i]) / 2.)); sum += scaling_factors[i]; smax = Max(smax, scaling_factors[i]); } @@ -193,5 +202,3 @@ bool Mc19TSymScalingMethod::ComputeSymTScalingFactors( } } // namespace Ipopt - -#endif /* COINHSL_HAS_MC19 or IPOPT_HAS_LINEARSOLVERLOADER */ diff --git a/src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.hpp b/src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.hpp index 4e152c5f0..d7853f1f7 100644 --- a/src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.hpp +++ b/src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.hpp @@ -9,6 +9,22 @@ #include "IpUtils.hpp" #include "IpTSymScalingMethod.hpp" +#include "IpLibraryLoader.hpp" +#include "IpTypes.h" + +// note that R,C,W are single-precision also in the double-precision version of MC19 (MC19AD) +// here we assume that float corresponds to Fortran's single precision +/// @since 3.14.0 +#define IPOPT_DECL_MC19A(x) void (x)( \ + const ipindex* N, \ + const ipindex* NZ, \ + ipnumber* A, \ + ipindex* IRN, \ + ipindex* ICN, \ + float* R, \ + float* C, \ + float* W \ +) namespace Ipopt { @@ -20,13 +36,16 @@ class Mc19TSymScalingMethod: public TSymScalingMethod { public: /** @name Constructor/Destructor */ - //@{ - Mc19TSymScalingMethod() + ///@{ + Mc19TSymScalingMethod( + SmartPtr hslloader_ ///< @since 3.14.0 + ) : hslloader(hslloader_), + mc19a(NULL) { } virtual ~Mc19TSymScalingMethod() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -39,19 +58,31 @@ class Mc19TSymScalingMethod: public TSymScalingMethod virtual bool ComputeSymTScalingFactors( Index n, Index nnz, - const ipfint* airn, - const ipfint* ajcn, - const double* a, - double* scaling_factors + const Index* airn, + const Index* ajcn, + const Number* a, + Number* scaling_factors + ); + + /// set MC19 function to use for every instantiation of this class + /// @since 3.14.0 + static void SetFunctions( + IPOPT_DECL_MC19A(*mc19a) ); + /// get MC19A function that has been set via SetFunctions + /// + /// this does not return a MC19A that has been linked in or loaded from a library at runtime + /// @since 3.14.0 + static IPOPT_DECL_MC19A(*GetMC19A()); + 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. */ - //@{ + ///@{ /** Copy Constructor */ Mc19TSymScalingMethod( const Mc19TSymScalingMethod& @@ -61,6 +92,14 @@ class Mc19TSymScalingMethod: public TSymScalingMethod void operator=( const Mc19TSymScalingMethod& ); + + /**@name MC19 function pointer + * @{ + */ + SmartPtr hslloader; + + IPOPT_DECL_MC19A(*mc19a); + /**@} */ }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp b/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp index 8118aaf1d..620893610 100644 --- a/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp +++ b/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp @@ -11,11 +11,9 @@ // (incorporated by AW on 2006-11-11 into Ipopt package) // // NOTES: -// - Since Mumps 5.1.0, mumps_->nz should be replaced by mumps_->nnz +// - Since Mumps 5.1.0, mumps_->nz (MUMPS_INT) is deprecated and mumps_->nnz (MUMPS_INT8) should be used. +// For now (Mumps 5.4.0), mumps_->nz still works and has no disadvantage for us. -// The following line is a fix for otherwise twice-defined global variable -// (This would have to be taken out for a parallel MUMPS version!) -#define MPI_COMM_WORLD IPOPT_MPI_COMM_WORLD #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-variable" #endif @@ -32,28 +30,35 @@ #include "IpMumpsSolverInterface.hpp" +#if IPOPT_SINGLE +#include "smumps_c.h" +#define MUMPS_STRUC_C SMUMPS_STRUC_C +#define mumps_c smumps_c +#else #include "dmumps_c.h" +#define MUMPS_STRUC_C DMUMPS_STRUC_C +#define mumps_c dmumps_c +#endif #include #include -namespace Ipopt -{ -#if IPOPT_VERBOSITY > 0 -static const Index dbg_verbosity = 0; +#if !defined(IPOPT_MUMPS_NOMUTEX) && __cplusplus < 201103L +#define IPOPT_MUMPS_NOMUTEX +#endif +#ifndef IPOPT_MUMPS_NOMUTEX +#include +/// a mutex to ensure that only one thread is running MUMPS functions at a time +static std::mutex mumps_call_mutex; #endif #define USE_COMM_WORLD -987654 -int MumpsSolverInterface::instancecount_mpi = 0; - -MumpsSolverInterface::MumpsSolverInterface() +// initialize MPI when library is loaded; finalize MPI when library is unloaded +#if defined(__GNUC__) && defined(IPOPT_MPIINIT) && !defined(MUMPS_MPI_H) && defined(HAVE_MPI_INITIALIZED) +__attribute__((constructor)) +static void MPIinit(void) { - DBG_START_METH("MumpsSolverInterface::MumpsSolverInterface()", - dbg_verbosity); - -#ifndef MUMPS_MPI_H -#if defined(HAVE_MPI_INITIALIZED) int mpi_initialized; MPI_Initialized(&mpi_initialized); if( !mpi_initialized ) @@ -61,28 +66,46 @@ MumpsSolverInterface::MumpsSolverInterface() int argc = 1; char** argv = NULL; MPI_Init(&argc, &argv); - assert(instancecount_mpi == 0); - instancecount_mpi = 1; } - else if( instancecount_mpi > 0 ) +} + +__attribute__((destructor)) +static void MPIfini(void) +{ + int mpi_finalized; + MPI_Finalized(&mpi_finalized); + if(!mpi_finalized) { - ++instancecount_mpi; + MPI_Finalize(); } +} #endif - int myid; - MPI_Comm_rank(MPI_COMM_WORLD, &myid); + +namespace Ipopt +{ +#if IPOPT_VERBOSITY > 0 +static const Index dbg_verbosity = 0; #endif +MumpsSolverInterface::MumpsSolverInterface() +{ + DBG_START_METH("MumpsSolverInterface::MumpsSolverInterface()", + dbg_verbosity); + //initialize mumps - DMUMPS_STRUC_C* mumps_ = (DMUMPS_STRUC_C*) calloc(1, sizeof(DMUMPS_STRUC_C)); + MUMPS_STRUC_C* mumps_ = static_cast(calloc(1, sizeof(MUMPS_STRUC_C))); mumps_->job = -1; //initialize mumps mumps_->par = 1; //working host for sequential version - mumps_->sym = 2; //general symetric matrix + mumps_->sym = 2; //general symmetric matrix mumps_->comm_fortran = USE_COMM_WORLD; - dmumps_c(mumps_); - mumps_->icntl[1] = 0; - mumps_->icntl[2] = 0; //QUIETLY! - mumps_->icntl[3] = 0; + +#ifndef IPOPT_MUMPS_NOMUTEX + const std::lock_guard lock(mumps_call_mutex); +#endif + + mumps_c(mumps_); + mumps_->icntl[2] = 0; // global info stream + mumps_->icntl[3] = 0; // print level mumps_ptr_ = (void*) mumps_; } @@ -91,21 +114,13 @@ MumpsSolverInterface::~MumpsSolverInterface() DBG_START_METH("MumpsSolverInterface::~MumpsSolverInterface()", dbg_verbosity); - DMUMPS_STRUC_C* mumps_ = (DMUMPS_STRUC_C*) mumps_ptr_; - mumps_->job = -2; //terminate mumps - dmumps_c(mumps_); -#ifndef MUMPS_MPI_H -#ifdef HAVE_MPI_INITIALIZED - if( instancecount_mpi == 1 ) - { - int mpi_finalized; - MPI_Finalized(&mpi_finalized); - assert(!mpi_finalized); - MPI_Finalize(); - } - --instancecount_mpi; -#endif +#ifndef IPOPT_MUMPS_NOMUTEX + const std::lock_guard lock(mumps_call_mutex); #endif + + MUMPS_STRUC_C* mumps_ = static_cast(mumps_ptr_); + mumps_->job = -2; //terminate mumps + mumps_c(mumps_); delete[] mumps_->a; free(mumps_); } @@ -114,28 +129,31 @@ void MumpsSolverInterface::RegisterOptions( SmartPtr roptions ) { + roptions->AddLowerBoundedIntegerOption( + "mumps_print_level", + "Debug printing level for the linear solver MUMPS", + 0, 0, + "0: no printing; 1: Error messages only; 2: Error, warning, and main statistic messages; 3: Error and warning messages and terse diagnostics; >=4: All information."); roptions->AddBoundedNumberOption( "mumps_pivtol", "Pivot tolerance for the linear solver MUMPS.", 0.0, false, 1.0, false, 1e-6, - "A smaller number pivots for sparsity, a larger number pivots for stability. " - "This option is only available if Ipopt has been compiled with MUMPS."); + "A smaller number pivots for sparsity, a larger number pivots for stability."); roptions->AddBoundedNumberOption( "mumps_pivtolmax", "Maximum pivot tolerance for the linear solver MUMPS.", 0, false, 1, false, 0.1, - "Ipopt may increase pivtol as high as pivtolmax to get a more accurate solution to the linear system. " - "This option is only available if Ipopt has been compiled with MUMPS."); + "Ipopt may increase pivtol as high as pivtolmax to get a more accurate solution to the linear system."); roptions->AddLowerBoundedIntegerOption( "mumps_mem_percent", "Percentage increase in the estimated working space for MUMPS.", 0, 1000, - "In MUMPS when significant extra fill-in is caused by numerical pivoting, " + "When significant extra fill-in is caused by numerical pivoting, " "larger values of mumps_mem_percent may help use the workspace more efficiently. " "On the other hand, if memory requirement are too large at the very beginning of the optimization, " "choosing a much smaller value for this option, such as 5, might reduce memory requirements."); @@ -159,11 +177,15 @@ void MumpsSolverInterface::RegisterOptions( "This is ICNTL(8) in MUMPS."); roptions->AddNumberOption( "mumps_dep_tol", - "Pivot threshold for detection of linearly dependent constraints in MUMPS.", + "Threshold to consider a pivot at zero in detection of linearly dependent constraints with MUMPS.", 0.0, - "When MUMPS is used to determine linearly dependent constraints, " - "this is determines the threshold for a pivot to be considered zero. " - "This is CNTL(3) in MUMPS."); + "This is CNTL(3) in MUMPS.", true); +} + +/// give name of MUMPS with version info +std::string MumpsSolverInterface::GetName() +{ + return "MUMPS " MUMPS_VERSION; } bool MumpsSolverInterface::InitializeImpl( @@ -171,6 +193,9 @@ bool MumpsSolverInterface::InitializeImpl( const std::string& prefix ) { + Index print_level; + options.GetIntegerValue("mumps_print_level", print_level, prefix); + options.GetNumericValue("mumps_pivtol", pivtol_, prefix); if( options.GetNumericValue("mumps_pivtolmax", pivtolmax_, prefix) ) { @@ -198,7 +223,7 @@ bool MumpsSolverInterface::InitializeImpl( refactorize_ = false; have_symbolic_factorization_ = false; - DMUMPS_STRUC_C* mumps_ = (DMUMPS_STRUC_C*) mumps_ptr_; + MUMPS_STRUC_C* mumps_ = static_cast(mumps_ptr_); if( !warm_start_same_structure_ ) { mumps_->n = 0; @@ -210,6 +235,12 @@ bool MumpsSolverInterface::InitializeImpl( "MumpsSolverInterface called with warm_start_same_structure, but the problem is solved for the first time."); } + if( print_level > 0 ) + { + mumps_->icntl[2] = 6; // global info stream + mumps_->icntl[3] = print_level; // print level + } + return true; } @@ -218,7 +249,7 @@ ESymSolverStatus MumpsSolverInterface::MultiSolve( const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ) @@ -226,9 +257,9 @@ ESymSolverStatus MumpsSolverInterface::MultiSolve( DBG_START_METH("MumpsSolverInterface::MultiSolve", dbg_verbosity); DBG_ASSERT(!check_NegEVals || ProvidesInertia()); DBG_ASSERT(initialized_); - DBG_ASSERT(((DMUMPS_STRUC_C*)mumps_ptr_)->irn == ia); + DBG_ASSERT(static_cast(mumps_ptr_)->irn == ia); (void) ia; - DBG_ASSERT(((DMUMPS_STRUC_C*)mumps_ptr_)->jcn == ja); + DBG_ASSERT(static_cast(mumps_ptr_)->jcn == ja); (void) ja; if( pivtol_changed_ ) @@ -274,9 +305,9 @@ ESymSolverStatus MumpsSolverInterface::MultiSolve( return Solve(nrhs, rhs_vals); } -double* MumpsSolverInterface::GetValuesArrayPtr() +Number* MumpsSolverInterface::GetValuesArrayPtr() { - DMUMPS_STRUC_C* mumps_ = (DMUMPS_STRUC_C*) mumps_ptr_; + MUMPS_STRUC_C* mumps_ = static_cast(mumps_ptr_); DBG_START_METH("MumpsSolverInterface::GetValuesArrayPtr", dbg_verbosity) DBG_ASSERT(initialized_); return mumps_->a; @@ -284,14 +315,14 @@ double* MumpsSolverInterface::GetValuesArrayPtr() static void dump_matrix( - DMUMPS_STRUC_C* mumps_data + MUMPS_STRUC_C* mumps_data ) { -#ifdef write_matrices +#ifdef MUMPS_DUMP_MATRIX // Dump the matrix for (int i = 0; i < 40; i++) { - printf("%d\n", mumps_data->icntl[i]); + printf("%" IPOPT_INDEX_FORMAT "\n", mumps_data->icntl[i]); } for (int i = 0; i < 5; i++) { @@ -299,13 +330,13 @@ void dump_matrix( } printf("%-15d :N\n", mumps_data->n); printf("%-15d :NZ", mumps_data->nz); - for (int i = 0; i < mumps_data->nz; i++) + for (Index i = 0; i < mumps_data->nz; i++) { - printf("\n%d %d %25.15e", mumps_data->irn[i], mumps_data->jcn[i], mumps_data->a[i]); + printf("\n%" IPOPT_INDEX_FORMAT " %" IPOPT_INDEX_FORMAT " %25.15e", mumps_data->irn[i], mumps_data->jcn[i], mumps_data->a[i]); } printf(" :values"); // Dummy RHS for now - for (int i = 0; i < mumps_data->n; i++) + for (Index i = 0; i < mumps_data->n; i++) { printf("\n%25.15e", 0.); } @@ -322,7 +353,7 @@ ESymSolverStatus MumpsSolverInterface::InitializeStructure( const Index* ja ) { - DMUMPS_STRUC_C* mumps_ = (DMUMPS_STRUC_C*) mumps_ptr_; + MUMPS_STRUC_C* mumps_ = static_cast(mumps_ptr_); DBG_START_METH("MumpsSolverInterface::InitializeStructure", dbg_verbosity); ESymSolverStatus retval = SYMSOLVER_SUCCESS; @@ -333,9 +364,9 @@ ESymSolverStatus MumpsSolverInterface::InitializeStructure( delete[] mumps_->a; mumps_->a = NULL; - mumps_->a = new double[nonzeros]; - mumps_->irn = const_cast(ia); - mumps_->jcn = const_cast(ja); + mumps_->a = new Number[nonzeros]; + mumps_->irn = const_cast(ia); + mumps_->jcn = const_cast(ja); // make sure we do the symbolic factorization before a real // factorization @@ -355,7 +386,11 @@ ESymSolverStatus MumpsSolverInterface::SymbolicFactorization() { DBG_START_METH("MumpsSolverInterface::SymbolicFactorization", dbg_verbosity); - DMUMPS_STRUC_C* mumps_data = (DMUMPS_STRUC_C*) mumps_ptr_; + MUMPS_STRUC_C* mumps_data = static_cast(mumps_ptr_); + +#ifndef IPOPT_MUMPS_NOMUTEX + const std::lock_guard lock(mumps_call_mutex); +#endif if( HaveIpData() ) { @@ -364,10 +399,6 @@ ESymSolverStatus MumpsSolverInterface::SymbolicFactorization() mumps_data->job = 1; //symbolic ordering pass - //mumps_data->icntl[1] = 6; - //mumps_data->icntl[2] = 6;//QUIETLY! - //mumps_data->icntl[3] = 4; - mumps_data->icntl[5] = mumps_permuting_scaling_; mumps_data->icntl[6] = mumps_pivot_order_; mumps_data->icntl[7] = mumps_scaling_; @@ -380,34 +411,34 @@ ESymSolverStatus MumpsSolverInterface::SymbolicFactorization() dump_matrix(mumps_data); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling MUMPS-1 for symbolic factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); - dmumps_c(mumps_data); + "Calling MUMPS-1 for symbolic factorization.\n"); + mumps_c(mumps_data); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with MUMPS-1 for symbolic factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); - int error = mumps_data->info[0]; - const int& mumps_permuting_scaling_used = mumps_data->infog[22]; - const int& mumps_pivot_order_used = mumps_data->infog[6]; + "Done with MUMPS-1 for symbolic factorization.\n"); + Index error = mumps_data->info[0]; + const Index& mumps_permuting_scaling_used = mumps_data->infog[22]; + const Index& mumps_pivot_order_used = mumps_data->infog[6]; Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "MUMPS used permuting_scaling %d and pivot_order %d.\n", mumps_permuting_scaling_used, mumps_pivot_order_used); + "MUMPS used permuting_scaling %" IPOPT_INDEX_FORMAT " and pivot_order %" IPOPT_INDEX_FORMAT ".\n", mumps_permuting_scaling_used, mumps_pivot_order_used); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - " scaling will be %d.\n", mumps_data->icntl[7]); + " scaling will be %" IPOPT_INDEX_FORMAT ".\n", mumps_data->icntl[7]); if( HaveIpData() ) { IpData().TimingStats().LinearSystemSymbolicFactorization().End(); } - //return appropriat value + //return appropriate value if( error == -6 ) //system is singular { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "MUMPS returned INFO(1) = %d matrix is singular.\n", error); + "MUMPS returned INFO(1) = %" IPOPT_INDEX_FORMAT " matrix is singular.\n", error); return SYMSOLVER_SINGULAR; } if( error < 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error=%d returned from MUMPS in Factorization.\n", error); + "Error=%" IPOPT_INDEX_FORMAT " returned from MUMPS in Factorization.\n", error); return SYMSOLVER_FATAL_ERROR; } @@ -420,17 +451,21 @@ ESymSolverStatus MumpsSolverInterface::Factorization( ) { DBG_START_METH("MumpsSolverInterface::Factorization", dbg_verbosity); - DMUMPS_STRUC_C* mumps_data = (DMUMPS_STRUC_C*) mumps_ptr_; + MUMPS_STRUC_C* mumps_data = static_cast(mumps_ptr_); + +#ifndef IPOPT_MUMPS_NOMUTEX + const std::lock_guard lock(mumps_call_mutex); +#endif mumps_data->job = 2; //numerical factorization dump_matrix(mumps_data); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling MUMPS-2 for numerical factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); - dmumps_c(mumps_data); + "Calling MUMPS-2 for numerical factorization.\n"); + mumps_c(mumps_data); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with MUMPS-2 for numerical factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); - int error = mumps_data->info[0]; + "Done with MUMPS-2 for numerical factorization.\n"); + Index error = mumps_data->info[0]; //Check for errors if( error == -8 || error == -9 ) //not enough memory @@ -439,22 +474,18 @@ ESymSolverStatus MumpsSolverInterface::Factorization( for( int trycount = 0; trycount < trycount_max; trycount++ ) { Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "MUMPS returned INFO(1) = %d and requires more memory, reallocating. Attempt %d\n", error, trycount + 1); - Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - " Increasing icntl[13] from %d to ", mumps_data->icntl[13]); - double mem_percent = mumps_data->icntl[13]; - mumps_data->icntl[13] = (Index) (2.0 * mem_percent); + "MUMPS returned INFO(1) = %" IPOPT_INDEX_FORMAT " and requires more memory, reallocating. Attempt %d\n", error, trycount + 1); + MUMPS_INT old_mem_percent = mumps_data->icntl[13]; + ComputeMemIncrease(mumps_data->icntl[13], 2.0 * (Number)old_mem_percent, MUMPS_INT(0), "percent extra working space for MUMPS"); Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "%d.\n", mumps_data->icntl[13]); + " Increasing icntl[13] from %" IPOPT_INDEX_FORMAT " to %" IPOPT_INDEX_FORMAT ".\n", old_mem_percent, mumps_data->icntl[13]); dump_matrix(mumps_data); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling MUMPS-2 (repeated) for numerical factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), - WallclockTime()); - dmumps_c(mumps_data); + "Calling MUMPS-2 (repeated) for numerical factorization.\n"); + mumps_c(mumps_data); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with MUMPS-2 (repeated) for numerical factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), - WallclockTime()); + "Done with MUMPS-2 (repeated) for numerical factorization.\n"); error = mumps_data->info[0]; if( error != -8 && error != -9 ) { @@ -470,14 +501,14 @@ ESymSolverStatus MumpsSolverInterface::Factorization( } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of doubles for MUMPS to hold factorization (INFO(9)) = %d\n", mumps_data->info[8]); + "Number of doubles for MUMPS to hold factorization (INFO(9)) = %" IPOPT_INDEX_FORMAT "\n", mumps_data->info[8]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of integers for MUMPS to hold factorization (INFO(10)) = %d\n", mumps_data->info[9]); + "Number of integers for MUMPS to hold factorization (INFO(10)) = %" IPOPT_INDEX_FORMAT "\n", mumps_data->info[9]); if( error == -10 ) //system is singular { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "MUMPS returned INFO(1) = %d matrix is singular.\n", error); + "MUMPS returned INFO(1) = %" IPOPT_INDEX_FORMAT " matrix is singular.\n", error); return SYMSOLVER_SINGULAR; } @@ -486,7 +517,7 @@ ESymSolverStatus MumpsSolverInterface::Factorization( if( error == -13 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "MUMPS returned INFO(1) =%d - out of memory when trying to allocate %d %s.\nIn some cases it helps to decrease the value of the option \"mumps_mem_percent\".\n", + "MUMPS returned INFO(1) =%" IPOPT_INDEX_FORMAT " - out of memory when trying to allocate %" IPOPT_INDEX_FORMAT " %s.\nIn some cases it helps to decrease the value of the option \"mumps_mem_percent\".\n", error, mumps_data->info[1] < 0 ? -mumps_data->info[1] : mumps_data->info[1], mumps_data->info[1] < 0 ? "MB" : "bytes"); return SYMSOLVER_FATAL_ERROR; @@ -494,14 +525,14 @@ ESymSolverStatus MumpsSolverInterface::Factorization( if( error < 0 ) //some other error { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "MUMPS returned INFO(1) =%d MUMPS failure.\n", error); + "MUMPS returned INFO(1) =%" IPOPT_INDEX_FORMAT " MUMPS failure.\n", error); return SYMSOLVER_FATAL_ERROR; } if( check_NegEVals && (numberOfNegEVals != negevals_) ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "In MumpsSolverInterface::Factorization: negevals_ = %d, but numberOfNegEVals = %d\n", negevals_, + "In MumpsSolverInterface::Factorization: negevals_ = %" IPOPT_INDEX_FORMAT ", but numberOfNegEVals = %" IPOPT_INDEX_FORMAT "\n", negevals_, numberOfNegEVals); return SYMSOLVER_WRONG_INERTIA; } @@ -511,11 +542,16 @@ ESymSolverStatus MumpsSolverInterface::Factorization( ESymSolverStatus MumpsSolverInterface::Solve( Index nrhs, - double* rhs_vals + Number* rhs_vals ) { DBG_START_METH("MumpsSolverInterface::Solve", dbg_verbosity); - DMUMPS_STRUC_C* mumps_data = (DMUMPS_STRUC_C*) mumps_ptr_; + MUMPS_STRUC_C* mumps_data = static_cast(mumps_ptr_); + +#ifndef IPOPT_MUMPS_NOMUTEX + const std::lock_guard lock(mumps_call_mutex); +#endif + ESymSolverStatus retval = SYMSOLVER_SUCCESS; if( HaveIpData() ) { @@ -527,15 +563,15 @@ ESymSolverStatus MumpsSolverInterface::Solve( mumps_data->rhs = &(rhs_vals[offset]); mumps_data->job = 3; //solve Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling MUMPS-3 for solve at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); - dmumps_c(mumps_data); + "Calling MUMPS-3 for solve.\n"); + mumps_c(mumps_data); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with MUMPS-3 for solve at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); - int error = mumps_data->info[0]; + "Done with MUMPS-3 for solve.\n"); + Index error = mumps_data->info[0]; if( error < 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error=%d returned from MUMPS in Solve.\n", error); + "Error=%" IPOPT_INDEX_FORMAT " returned from MUMPS in Solve.\n", error); retval = SYMSOLVER_FATAL_ERROR; } } @@ -565,9 +601,9 @@ bool MumpsSolverInterface::IncreaseQuality() Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Increasing pivot tolerance for MUMPS from %7.2e ", pivtol_); - //this is a more aggresive update then MA27 - //this should be tuned - pivtol_ = Min(pivtolmax_, pow(pivtol_, 0.5)); + //this is a more aggressive update then MA27 + //ToDo this should be tuned + pivtol_ = Min(pivtolmax_, std::pow(pivtol_, Number(0.5))); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "to %7.2e.\n", pivtol_); return true; @@ -586,7 +622,7 @@ ESymSolverStatus MumpsSolverInterface::DetermineDependentRows( { DBG_START_METH("MumpsSolverInterface::DetermineDependentRows", dbg_verbosity); - DMUMPS_STRUC_C* mumps_data = (DMUMPS_STRUC_C*) mumps_ptr_; + MUMPS_STRUC_C* mumps_data = static_cast(mumps_ptr_); c_deps.clear(); @@ -609,14 +645,18 @@ ESymSolverStatus MumpsSolverInterface::DetermineDependentRows( } // perform the factorization, in order to find dependent rows/columns +#ifndef IPOPT_MUMPS_NOMUTEX + const std::lock_guard lock(mumps_call_mutex); +#endif + //Set flags to ask MUMPS for checking linearly dependent rows mumps_data->icntl[23] = 1; mumps_data->cntl[2] = mumps_dep_tol_; mumps_data->job = 2; //numerical factorization dump_matrix(mumps_data); - dmumps_c(mumps_data); - int error = mumps_data->info[0]; + mumps_c(mumps_data); + Index error = mumps_data->info[0]; //Check for errors if( error == -8 || error == -9 ) //not enough memory @@ -625,16 +665,14 @@ ESymSolverStatus MumpsSolverInterface::DetermineDependentRows( for( int trycount = 0; trycount < trycount_max; trycount++ ) { Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "MUMPS returned INFO(1) = %d and requires more memory, reallocating. Attempt %d\n", error, trycount + 1); - Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - " Increasing icntl[13] from %d to ", mumps_data->icntl[13]); - double mem_percent = mumps_data->icntl[13]; - mumps_data->icntl[13] = (Index) (2.0 * mem_percent); + "MUMPS returned INFO(1) = %" IPOPT_INDEX_FORMAT " and requires more memory, reallocating. Attempt %d\n", error, trycount + 1); + MUMPS_INT old_mem_percent = mumps_data->icntl[13]; + ComputeMemIncrease(mumps_data->icntl[13], 2.0 * (Number)old_mem_percent, MUMPS_INT(0), "percent extra working space for MUMPS"); Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "%d.\n", mumps_data->icntl[13]); + " Increasing icntl[13] from %" IPOPT_INDEX_FORMAT " to %" IPOPT_INDEX_FORMAT ".\n", old_mem_percent, mumps_data->icntl[13]); dump_matrix(mumps_data); - dmumps_c(mumps_data); + mumps_c(mumps_data); error = mumps_data->info[0]; if( error != -8 && error != -9 ) { @@ -657,7 +695,7 @@ ESymSolverStatus MumpsSolverInterface::DetermineDependentRows( if( error < 0 ) //some other error { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "MUMPS returned INFO(1) =%d MUMPS failure.\n", error); + "MUMPS returned INFO(1) =%" IPOPT_INDEX_FORMAT " MUMPS failure.\n", error); return SYMSOLVER_FATAL_ERROR; } @@ -671,4 +709,3 @@ ESymSolverStatus MumpsSolverInterface::DetermineDependentRows( } } //end Ipopt namespace - diff --git a/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.hpp index ec8805699..22d137e15 100644 --- a/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpMumpsSolverInterface.hpp @@ -25,13 +25,13 @@ class MumpsSolverInterface: public SparseSymLinearSolverInterface { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor */ MumpsSolverInterface(); /** Destructor */ virtual ~MumpsSolverInterface(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -39,7 +39,7 @@ class MumpsSolverInterface: public SparseSymLinearSolverInterface ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ virtual ESymSolverStatus InitializeStructure( Index dim, Index nonzeros, @@ -47,23 +47,23 @@ class MumpsSolverInterface: public SparseSymLinearSolverInterface const Index* ajcn ); - virtual double* GetValuesArrayPtr(); + virtual Number* GetValuesArrayPtr(); virtual ESymSolverStatus MultiSolve( bool new_matrix, const Index* airn, const Index* ajcn, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ); virtual Index NumberOfNegEVals() const; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ virtual bool IncreaseQuality(); virtual bool ProvidesInertia() const @@ -75,12 +75,16 @@ class MumpsSolverInterface: public SparseSymLinearSolverInterface { return Triplet_Format; } - //@} + ///@} static void RegisterOptions( SmartPtr roptions ); + /// give name of MUMPS with version info + /// @since 3.14.0 + static std::string GetName(); + virtual bool ProvidesDegeneracyDetection() const; virtual ESymSolverStatus DetermineDependentRows( @@ -97,7 +101,7 @@ class MumpsSolverInterface: public SparseSymLinearSolverInterface * them for us, so we declare them private * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ MumpsSolverInterface( const MumpsSolverInterface& @@ -107,22 +111,22 @@ class MumpsSolverInterface: public SparseSymLinearSolverInterface void operator=( const MumpsSolverInterface& ); - //@} + ///@} /** @name Information about the matrix */ - //@{ + ///@{ /** Primary MUMP data structure */ void* mumps_ptr_; - //@} + ///@} /** @name Information about most recent factorization/solve */ - //@{ + ///@{ /** Number of negative eigenvalues */ Index negevals_; - //@} + ///@} /** @name Initialization flags */ - //@{ + ///@{ /** Flag indicating if internal data is initialized. * For initialization, this object needs to have seen a matrix. */ @@ -136,15 +140,10 @@ class MumpsSolverInterface: public SparseSymLinearSolverInterface * again. */ bool refactorize_; - /** Counter on number of alive Mumps interface objects, if we have called MPI_Initialize. - * - * When the last object is destroyed, we will call MPI_Finalize. - */ - static int instancecount_mpi; - //@} + ///@} /** @name Solver specific data/options */ - //@{ + ///@{ /** Pivot tolerance */ Number pivtol_; @@ -170,13 +169,13 @@ class MumpsSolverInterface: public SparseSymLinearSolverInterface * already been solved before. */ bool warm_start_same_structure_; - //@} + ///@} /** Flag indicating if symbolic factorization has already been called */ bool have_symbolic_factorization_; /** @name Internal functions */ - //@{ + ///@{ /** Call MUMPS (job=1) to perform symbolic manipulations, and reserve * memory. */ @@ -194,9 +193,9 @@ class MumpsSolverInterface: public SparseSymLinearSolverInterface /** Call MUMPS (job=3) to do the solve. */ ESymSolverStatus Solve( Index nrhs, - double* rhs_vals + Number* rhs_vals ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.cpp b/src/Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.cpp new file mode 100644 index 000000000..7684b59de --- /dev/null +++ b/src/Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.cpp @@ -0,0 +1,724 @@ +// Copyright (C) 2005, 2010 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// Authors: Carl Laird, Andreas Waechter IBM 2005-03-17 +// +// Olaf Schenk Univ of Basel 2005-09-20 +// - changed options, added PHASE_ flag + +/* some useful links: + * MKL documentation: https://software.intel.com/en-us/intel-mkl/documentation + * API differences MKL vs Basel PARDISO: https://software.intel.com/content/www/us/en/develop/articles/summary-of-the-api-differences-between-university-of-basel-ub-pardiso-and-intel-mkl-pardiso.html + */ + +#include "IpoptConfig.h" +#include "IpPardisoMKLSolverInterface.hpp" + +#include +#include +#include +#include +#include +#include + +/* Prototypes for MKL Pardiso's subroutines */ +extern "C" +{ + void IPOPT_LAPACK_FUNC(pardisoinit, PARDISOINIT)( + void* PT, + const ipindex* MTYPE, + ipindex* IPARM + ); + + void IPOPT_LAPACK_FUNC(pardiso, PARDISO)( + void** PT, + const ipindex* MAXFCT, + const ipindex* MNUM, + const ipindex* MTYPE, + const ipindex* PHASE, + const ipindex* N, + const ipnumber* A, + const ipindex* IA, + const ipindex* JA, + const ipindex* PERM, + const ipindex* NRHS, + ipindex* IPARM, + const ipindex* MSGLVL, + ipnumber* B, + ipnumber* X, + ipindex* E, + ipnumber* DPARM + ); +} + +namespace Ipopt +{ +#if IPOPT_VERBOSITY > 0 +static const Index dbg_verbosity = 0; +#endif + +PardisoMKLSolverInterface::PardisoMKLSolverInterface() + : a_(NULL), + negevals_(-1), + initialized_(false), + MAXFCT_(1), + MNUM_(1), + MTYPE_(-2), + MSGLVL_(0), + debug_last_iter_(-1) +{ + DBG_START_METH("PardisoMKLSolverInterface::PardisoMKLSolverInterface()", dbg_verbosity); + + PT_ = new void* [64]; + IPARM_ = new Index[64]; + DPARM_ = new Number[64]; +} + +PardisoMKLSolverInterface::~PardisoMKLSolverInterface() +{ + DBG_START_METH("PardisoMKLSolverInterface::~PardisoMKLSolverInterface()", + dbg_verbosity); + + // Tell Pardiso to release all memory + if( initialized_ ) + { + Index PHASE = -1; + Index N = dim_; + Index NRHS = 0; + Index ERROR; + Index idmy = 0; + Number ddmy = 0.; + IPOPT_LAPACK_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, &MSGLVL_, &ddmy, + &ddmy, &ERROR, DPARM_); + DBG_ASSERT(ERROR == 0); + } + + delete[] PT_; + delete[] IPARM_; + delete[] DPARM_; + delete[] a_; +} + +void PardisoMKLSolverInterface::RegisterOptions( + SmartPtr roptions +) +{ + roptions->AddStringOption3( + "pardisomkl_matching_strategy", + "Matching strategy to be used by Pardiso", + "complete+2x2", + "complete", "Match complete (IPAR(13)=1)", + "complete+2x2", "Match complete+2x2 (IPAR(13)=2)", + "constraints", "Match constraints (IPAR(13)=3)", + "This is IPAR(13) in Pardiso manual."); + roptions->AddStringOption2( + "pardisomkl_redo_symbolic_fact_only_if_inertia_wrong", + "Toggle for handling case when elements were perturbed by Pardiso.", + "no", + "no", "Always redo symbolic factorization when elements were perturbed", + "yes", "Only redo symbolic factorization when elements were perturbed if also the inertia was wrong", + "", + true); + roptions->AddBoolOption( + "pardisomkl_repeated_perturbation_means_singular", + "Whether to assume that matrix is singular if elements were perturbed after recent symbolic factorization.", + false, + "", + true); + //roptions->AddLowerBoundedIntegerOption( + // "pardisomkl_out_of_core_power", + // "Enables out-of-core variant of Pardiso", + // 0, 0, + // "Setting this option to a positive integer k makes Pardiso work in the " + // "out-of-core variant where the factor is split in 2^k subdomains. This " + // "is IPARM(50) in the Pardiso manual. This option is only available if " + // "Ipopt has been compiled with Pardiso."); + roptions->AddLowerBoundedIntegerOption( + "pardisomkl_msglvl", + "Pardiso message level", + 0, + 0, + "This is MSGLVL in the Pardiso manual."); + roptions->AddBoolOption( + "pardisomkl_skip_inertia_check", + "Whether to pretend that inertia is correct.", + false, + "Setting this option to \"yes\" essentially disables inertia check. " + "This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control.", + true); + roptions->AddIntegerOption( + "pardisomkl_max_iterative_refinement_steps", + "Limit on number of iterative refinement steps.", + // ToDo: Decide how many iterative refinement steps in Pardiso. + // For MKL Pardiso, it seems that setting it to 1 makes it more + // robust and just a little bit slower. + // Setting it to 1 should decrease the number of iterative refinement + // steps by 1 in case that perturbed pivots have been used, and increase + // it by 1 otherwise. + 1, + "The solver does not perform more than the absolute value of this value steps of iterative refinement and " + "stops the process if a satisfactory level of accuracy of the solution in terms of backward error is achieved. " + "If negative, the accumulation of the residue uses extended precision real and complex data types. " + "Perturbed pivots result in iterative refinement. " + "The solver automatically performs two steps of iterative refinements when perturbed pivots are obtained during the numerical factorization and this option is set to 0."); + roptions->AddStringOption4( + "pardisomkl_order", + "Controls the fill-in reduction ordering algorithm for the input matrix.", + "metis", + "amd", "minimum degree algorithm", + "one", "undocumented", + "metis", "MeTiS nested dissection algorithm", + "pmetis", "parallel (OpenMP) version of MeTiS nested dissection algorithm"); +} + +bool PardisoMKLSolverInterface::InitializeImpl( + const OptionsList& options, + const std::string& prefix +) +{ + Index enum_int; + options.GetEnumValue("pardisomkl_matching_strategy", enum_int, prefix); + match_strat_ = PardisoMatchingStrategy(enum_int); + options.GetBoolValue("pardisomkl_redo_symbolic_fact_only_if_inertia_wrong", + pardiso_redo_symbolic_fact_only_if_inertia_wrong_, prefix); + options.GetBoolValue("pardisomkl_repeated_perturbation_means_singular", pardiso_repeated_perturbation_means_singular_, + prefix); + //Index pardiso_out_of_core_power; + //options.GetIntegerValue("pardiso_out_of_core_power", + // pardiso_out_of_core_power, prefix); + options.GetBoolValue("pardisomkl_skip_inertia_check", skip_inertia_check_, prefix); + Index pardiso_msglvl; + options.GetIntegerValue("pardisomkl_msglvl", pardiso_msglvl, prefix); + Index max_iterref_steps; + options.GetIntegerValue("pardisomkl_max_iterative_refinement_steps", max_iterref_steps, prefix); + Index order; + options.GetEnumValue("pardisomkl_order", order, prefix); + + // Number value = 0.0; + + // Tell Pardiso to release all memory if it had been used before + if( initialized_ ) + { + Index PHASE = -1; + Index N = dim_; + Index NRHS = 0; + Index ERROR; + Index idmy = 0; + Number ddmy = 0.; + IPOPT_LAPACK_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, &MSGLVL_, &ddmy, + &ddmy, &ERROR, DPARM_); + DBG_ASSERT(ERROR == 0); + } + + // Reset all private data + dim_ = 0; + nonzeros_ = 0; + have_symbolic_factorization_ = false; + initialized_ = false; + delete[] a_; + a_ = NULL; + + // Call Pardiso's initialization routine + memset(PT_, 0, 64); // needs to be initialized to 0 according to MKL Pardiso docu + IPARM_[0] = 0; // Tell it to fill IPARM with default values(?) + + IPOPT_LAPACK_FUNC(pardisoinit, PARDISOINIT)(PT_, &MTYPE_, IPARM_); + + // Set some parameters for Pardiso + // https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/sparse-solver-routines/onemkl-pardiso-parallel-direct-sparse-solver-interface/pardiso-iparm-parameter.html + IPARM_[0] = 1; // Don't use the default values + IPARM_[1] = order; + // For MKL PARDSIO, the documentation says, "iparm(3) Reserved. Set to zero.", so we don't set IPARM_[2] + IPARM_[5] = 1;// Overwrite right-hand side + IPARM_[7] = max_iterref_steps; + IPARM_[9] = 12;// pivot perturbation (as higher as less perturbation) + IPARM_[10] = 2;// enable scaling (recommended for interior-point indefinite matrices) + IPARM_[12] = (int)match_strat_;// enable matching (recommended, as above) + IPARM_[20] = 3;// bunch-kaufman pivoting + IPARM_[23] = 1;// parallel fac + IPARM_[24] = 0;// parallel solve + //IPARM_[26] = 1; // matrix checker +#ifdef IPOPT_SINGLE + IPARM_[27] = 1; // Use single precision +#else + IPARM_[27] = 0; // Use double precision +#endif + + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Pardiso matrix ordering (IPARM(2)): %" IPOPT_INDEX_FORMAT "\n", IPARM_[1]); + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Pardiso max. iterref. steps (IPARM(8)): %" IPOPT_INDEX_FORMAT "\n", IPARM_[7]); + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Pardiso matching strategy (IPARM(13)): %" IPOPT_INDEX_FORMAT "\n", IPARM_[12]); + + MSGLVL_ = pardiso_msglvl; + + // Option for the out of core variant + //IPARM_[49] = pardiso_out_of_core_power; + + return true; +} + +ESymSolverStatus PardisoMKLSolverInterface::MultiSolve( + bool new_matrix, + const Index* ia, + const Index* ja, + Index nrhs, + Number* rhs_vals, + bool check_NegEVals, + Index numberOfNegEVals +) +{ + DBG_START_METH("PardisoMKLSolverInterface::MultiSolve", dbg_verbosity); + DBG_ASSERT(!check_NegEVals || ProvidesInertia()); + DBG_ASSERT(initialized_); + + // check if a factorization has to be done + if( new_matrix ) + { + // perform the factorization + ESymSolverStatus retval; + retval = Factorization(ia, ja, check_NegEVals, numberOfNegEVals); + if( retval != SYMSOLVER_SUCCESS ) + { + DBG_PRINT((1, "FACTORIZATION FAILED!\n")); + return retval; // Matrix singular or error occurred + } + } + + // do the solve + return Solve(ia, ja, nrhs, rhs_vals); +} + +Number* PardisoMKLSolverInterface::GetValuesArrayPtr() +{ + DBG_ASSERT(initialized_); + DBG_ASSERT(a_); + return a_; +} + +ESymSolverStatus PardisoMKLSolverInterface::InitializeStructure( + Index dim, + Index nonzeros, + const Index* ia, + const Index* ja +) +{ + DBG_START_METH("PardisoMKLSolverInterface::InitializeStructure", dbg_verbosity); + dim_ = dim; + nonzeros_ = nonzeros; + + // Make space for storing the matrix elements + delete[] a_; + a_ = NULL; + a_ = new Number[nonzeros_]; + + // Do the symbolic factorization + ESymSolverStatus retval = SymbolicFactorization(ia, ja); + if( retval != SYMSOLVER_SUCCESS ) + { + return retval; + } + + initialized_ = true; + + return retval; +} + +ESymSolverStatus PardisoMKLSolverInterface::SymbolicFactorization( + const Index* /*ia*/, + const Index* /*ja*/ +) +{ + DBG_START_METH("PardisoMKLSolverInterface::SymbolicFactorization", + dbg_verbosity); + + // Since Pardiso requires the values of the nonzeros of the matrix + // for an efficient symbolic factorization, we postpone that task + // until the first call of Factorize. All we do here is to reset + // the flag (in case this interface is called for a matrix with a + // new structure). + + have_symbolic_factorization_ = false; + + return SYMSOLVER_SUCCESS; +} + +static +void write_iajaa_matrix( + Index N, + const Index* ia, + const Index* ja, + Number* a_, + Number* rhs_vals, + int iter_cnt, + int sol_cnt +) +{ + if( getenv("IPOPT_WRITE_MAT") ) + { + /* Write header */ + char mat_name[128]; + char mat_pref[32]; + + Index NNZ = ia[N] - 1; + Index i; + + if( getenv("IPOPT_WRITE_PREFIX") ) + { + strcpy(mat_pref, getenv("IPOPT_WRITE_PREFIX")); + } + else + { + strcpy(mat_pref, "mat-ipopt"); + } + + Snprintf(mat_name, 127, "%s_%03d-%02d.iajaa", mat_pref, iter_cnt, sol_cnt); + + // Open and write matrix file. + std::ofstream mat_file(mat_name); + mat_file << std::setprecision(std::numeric_limits::digits10 + 1); + + mat_file << N << std::endl; + mat_file << NNZ << std::endl; + + for( i = 0; i < N + 1; i++ ) + { + mat_file << ia[i] << std::endl; + } + for( i = 0; i < NNZ; i++ ) + { + mat_file << ja[i] << std::endl; + } + for( i = 0; i < NNZ; i++ ) + { + mat_file << a_[i] << std::endl; + } + + /* Right hand side. */ + if( rhs_vals ) + for( i = 0; i < N; i++ ) + { + mat_file << rhs_vals[i] << std::endl; + } + } + + /* additional matrix format */ + if( getenv("IPOPT_WRITE_MAT_MTX") ) + { + /* Write header */ + char mat_name[128]; + char mat_pref[32]; + + Index i; + Index j; + + if( getenv("IPOPT_WRITE_PREFIX") ) + { + strcpy(mat_pref, getenv("IPOPT_WRITE_PREFIX")); + } + else + { + strcpy(mat_pref, "mat-ipopt"); + } + + Snprintf(mat_name, 127, "%s_%03d-%02d.mtx", mat_pref, iter_cnt, sol_cnt); + + // Open and write matrix file. + std::ofstream mat_file(mat_name); + mat_file << std::setprecision(std::numeric_limits::digits10 + 1); + + for( i = 0; i < N; i++ ) + for( j = ia[i]; j < ia[i + 1] - 1; j++ ) + { + mat_file << ' ' << i + 1 << ' ' << ja[j - 1] << ' ' << a_[j - 1] << std::endl; + } + } +} + +ESymSolverStatus PardisoMKLSolverInterface::Factorization( + const Index* ia, + const Index* ja, + bool check_NegEVals, + Index numberOfNegEVals +) +{ + DBG_START_METH("PardisoMKLSolverInterface::Factorization", dbg_verbosity); + + // Call Pardiso to do the factorization + Index PHASE; + Index N = dim_; + Index PERM = 0; // This should not be accessed by Pardiso + Index NRHS = 0; + Number B; // This should not be accessed by Pardiso in factorization + // phase + Number X; // This should not be accessed by Pardiso in factorization + // phase + Index ERROR; + + bool done = false; + bool just_performed_symbolic_factorization = false; + + while( !done ) + { + if( !have_symbolic_factorization_ ) + { + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemSymbolicFactorization().Start(); + } + PHASE = 11; + + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Calling Pardiso for symbolic factorization.\n"); + IPOPT_LAPACK_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, + &PHASE, &N, a_, ia, ja, &PERM, + &NRHS, IPARM_, &MSGLVL_, &B, &X, &ERROR, DPARM_); + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemSymbolicFactorization().End(); + } + if( ERROR == -7 ) + { + Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, + "Pardiso symbolic factorization returns ERROR = %" IPOPT_INDEX_FORMAT ". Matrix is singular.\n", ERROR); + return SYMSOLVER_SINGULAR; + } + else if( ERROR != 0 ) + { + Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, + "Error in Pardiso during symbolic factorization phase. ERROR = %" IPOPT_INDEX_FORMAT ".\n", ERROR); + return SYMSOLVER_FATAL_ERROR; + } + have_symbolic_factorization_ = true; + just_performed_symbolic_factorization = true; + + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Memory in KB required for the symbolic factorization = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[14]); + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Integer memory in KB required for the numerical factorization = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[15]); + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Double memory in KB required for the numerical factorization = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[16]); + } + + PHASE = 22; + + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemFactorization().Start(); + } + Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, + "Calling Pardiso for factorization.\n"); + // Dump matrix to file, and count number of solution steps. + if( HaveIpData() ) + { + if( IpData().iter_count() != debug_last_iter_ ) + { + debug_cnt_ = 0; + } + debug_last_iter_ = IpData().iter_count(); + debug_cnt_++; + } + else + { + debug_cnt_ = 0; + debug_last_iter_ = 0; + } + + IPOPT_LAPACK_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, + &PHASE, &N, a_, ia, ja, &PERM, + &NRHS, IPARM_, &MSGLVL_, &B, &X, &ERROR, DPARM_); + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemFactorization().End(); + } + + if( ERROR == -7 ) + { + Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, + "Pardiso factorization returns ERROR = %" IPOPT_INDEX_FORMAT ". Matrix is singular.\n", ERROR); + return SYMSOLVER_SINGULAR; + } + else if( ERROR == -4 ) + { + // I think this means that the matrix is singular + return SYMSOLVER_SINGULAR; + } + else if( ERROR != 0 ) + { + Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, + "Error in Pardiso during factorization phase. ERROR = %" IPOPT_INDEX_FORMAT ".\n", ERROR); + return SYMSOLVER_FATAL_ERROR; + } + + negevals_ = Max(IPARM_[22], numberOfNegEVals); + if( IPARM_[13] != 0 ) + { + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Number of perturbed pivots in factorization phase = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[13]); + if( !pardiso_redo_symbolic_fact_only_if_inertia_wrong_ || (negevals_ != numberOfNegEVals) ) + { + if( HaveIpData() ) + { + IpData().Append_info_string("Pn"); + } + have_symbolic_factorization_ = false; + // We assume now that if there was just a symbolic + // factorization and we still have perturbed pivots, that + // the system is actually singular, if + // pardiso_repeated_perturbation_means_singular_ is true + if( just_performed_symbolic_factorization ) + { + if( pardiso_repeated_perturbation_means_singular_ ) + { + if( HaveIpData() ) + { + IpData().Append_info_string("Ps"); + } + return SYMSOLVER_SINGULAR; + } + else + { + done = true; + } + } + else + { + done = false; + } + } + else + { + if( HaveIpData() ) + { + IpData().Append_info_string("Pp"); + } + done = true; + } + } + else + { + done = true; + } + } + + DBG_ASSERT(IPARM_[21] + IPARM_[22] == dim_); + + // Check whether the number of negative eigenvalues matches the requested + // count + if( skip_inertia_check_ ) + { + numberOfNegEVals = negevals_; + } + + if( check_NegEVals && (numberOfNegEVals != negevals_) ) + { + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Wrong inertia: required are %" IPOPT_INDEX_FORMAT ", but we got %" IPOPT_INDEX_FORMAT ".\n", numberOfNegEVals, negevals_); + return SYMSOLVER_WRONG_INERTIA; + } + + return SYMSOLVER_SUCCESS; +} + +ESymSolverStatus PardisoMKLSolverInterface::Solve( + const Index* ia, + const Index* ja, + Index nrhs, + Number* rhs_vals +) +{ + DBG_START_METH("PardisoMKLSolverInterface::Solve", dbg_verbosity); + + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemBackSolve().Start(); + } + // Call Pardiso to do the solve for the given right-hand sides + Index PHASE = 33; + Index N = dim_; + Index PERM = 0; // This should not be accessed by Pardiso + Index NRHS = nrhs; + Number* X = new Number[nrhs * dim_]; + + Number* ORIG_RHS = new Number[nrhs * dim_]; + Index ERROR; + // Initialize solution with zero and save right hand side + for( int i = 0; i < N; i++ ) + { + X[i] = 0.; + ORIG_RHS[i] = rhs_vals[i]; + } + + // Dump matrix to file if requested + Index iter_count = 0; + if( HaveIpData() ) + { + iter_count = IpData().iter_count(); + } + + write_iajaa_matrix(N, ia, ja, a_, rhs_vals, iter_count, debug_cnt_); + + for( int i = 0; i < N; i++ ) + { + rhs_vals[i] = ORIG_RHS[i]; + } + IPOPT_LAPACK_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, a_, ia, ja, &PERM, &NRHS, IPARM_, &MSGLVL_, rhs_vals, X, + &ERROR, DPARM_); + + if( ERROR <= -100 && ERROR >= -102 ) + { + Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, + "Iterative solver in Pardiso did not converge (ERROR = %" IPOPT_INDEX_FORMAT ")\n", ERROR); + Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, + " Decreasing drop tolerances from DPARM_[4] = %e and DPARM_[5] = %e\n", DPARM_[4], DPARM_[5]); + PHASE = 23; + DPARM_[4] /= 2.0; + DPARM_[5] /= 2.0; + Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, + " to DPARM_[4] = %e and DPARM_[5] = %e\n", DPARM_[4], DPARM_[5]); + ERROR = 0; + } + + delete[] X; + delete[] ORIG_RHS; + + if( IPARM_[6] != 0 ) + { + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Number of iterative refinement steps = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[6]); + if( HaveIpData() ) + { + IpData().Append_info_string("Pi"); + } + } + + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemBackSolve().End(); + } + if( ERROR != 0 ) + { + Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, + "Error in Pardiso during solve phase. ERROR = %" IPOPT_INDEX_FORMAT ".\n", ERROR); + return SYMSOLVER_FATAL_ERROR; + } + return SYMSOLVER_SUCCESS; +} + +Index PardisoMKLSolverInterface::NumberOfNegEVals() const +{ + DBG_START_METH("PardisoMKLSolverInterface::NumberOfNegEVals", dbg_verbosity); + DBG_ASSERT(negevals_ >= 0); + return negevals_; +} + +bool PardisoMKLSolverInterface::IncreaseQuality() +{ + // At the moment, I don't see how we could tell Pardiso to do better + // (maybe switch from IPARM[20]=1 to IPARM[20]=2?) + return false; +} + +} // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.hpp new file mode 100644 index 000000000..787352bb0 --- /dev/null +++ b/src/Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.hpp @@ -0,0 +1,208 @@ +// Copyright (C) 2004, 2010 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// Authors: Carl Laird, Andreas Waechter IBM 2005-03-17 + +#ifndef __IPPARDISOMKLSOLVERINTERFACE_HPP__ +#define __IPPARDISOMKLSOLVERINTERFACE_HPP__ + +#include "IpoptConfig.h" +#include "IpSparseSymLinearSolverInterface.hpp" +#include "IpLibraryLoader.hpp" +#include "IpTypes.h" + +namespace Ipopt +{ + +/** Interface to the linear solver Pardiso as distributed by Intel MKL, derived from SparseSymLinearSolverInterface. + * @since 3.14.0 + */ +class PardisoMKLSolverInterface: public SparseSymLinearSolverInterface +{ +public: + /** @name Constructor/Destructor */ + ///@{ + /** Constructor */ + PardisoMKLSolverInterface(); + + /** Destructor */ + virtual ~PardisoMKLSolverInterface(); + ///@} + + bool InitializeImpl( + const OptionsList& options, + const std::string& prefix + ); + + /** @name Methods for requesting solution of the linear system. */ + ///@{ + virtual ESymSolverStatus InitializeStructure( + Index dim, + Index nonzeros, + const Index* ia, + const Index* ja + ); + + virtual Number* GetValuesArrayPtr(); + + virtual ESymSolverStatus MultiSolve( + bool new_matrix, + const Index* ia, + const Index* ja, + Index nrhs, + Number* rhs_vals, + bool check_NegEVals, + Index numberOfNegEVals); + + virtual Index NumberOfNegEVals() const; + ///@} + + //* @name Options of Linear solver */ + ///@{ + virtual bool IncreaseQuality(); + + virtual bool ProvidesInertia() const + { + return true; + } + + EMatrixFormat MatrixFormat() const + { + return CSR_Format_1_Offset; + } + ///@} + + ///@{ + static void RegisterOptions( + SmartPtr roptions + ); + ///@} + +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. */ + ///@{ + /** Copy Constructor */ + PardisoMKLSolverInterface( + const PardisoMKLSolverInterface&); + + /** Default Assignment Operator */ + void operator=( + const PardisoMKLSolverInterface&); + ///@} + + /** @name Information about the matrix */ + ///@{ + /** Number of rows and columns of the matrix */ + Index dim_; + + /** Number of nonzeros of the matrix in triplet representation. */ + Index nonzeros_; + + /** Array for storing the values of the matrix. */ + Number* a_; + ///@} + + /** @name Information about most recent factorization/solve */ + ///@{ + /** Number of negative eigenvalues */ + Index negevals_; + ///@} + + /** @name Solver specific options */ + ///@{ + /** Type for matching strategies */ + enum PardisoMatchingStrategy + { + COMPLETE, + COMPLETE2x2, + CONSTRAINT + }; + /** Option that controls the matching strategy. */ + PardisoMatchingStrategy match_strat_; + /** Flag indicating if symbolic factorization has already been performed. */ + bool have_symbolic_factorization_; + /** Flag indicating whether the symbolic factorization should only + * be done after perturbed elements, if the inertia was wrong + */ + bool pardiso_redo_symbolic_fact_only_if_inertia_wrong_; + /** Flag indicating whether repeated perturbed elements even after + * a new symbolic factorization should be interpreted as a + * singular matrix + */ + bool pardiso_repeated_perturbation_means_singular_; + /** Flag indicating if the inertia is always assumed to be + * correct. + */ + bool skip_inertia_check_; + ///@} + + /** @name Initialization flags */ + ///@{ + /** Flag indicating if internal data is initialized. + * For initialization, this object needs to have seen a matrix. + */ + bool initialized_; + ///@} + + /** @name Solver specific information */ + ///@{ + /** Internal data address pointers. */ + void** PT_; + /** Maximal number of factors with identical nonzero + * structure. Here, we only store one factorization. Is always 1. + */ + Index MAXFCT_; + /** Actual matrix for the solution phase. Is always 1.*/ + Index MNUM_; + /** Matrix type; real and symmetric indefinite. Is always -2.*/ + Index MTYPE_; + /** Parameter and info array for Pardiso. */ + Index* IPARM_; + /** Parameter and info array for Pardiso. */ + Number* DPARM_; + /** Message level. */ + Index MSGLVL_; + ///@} + + /**@name Some counters for debugging */ + ///@{ + Index debug_last_iter_; + Index debug_cnt_; + ///@} + + /** @name Internal functions */ + ///@{ + /** Call Pardiso to do the analysis phase. */ + ESymSolverStatus SymbolicFactorization( + const Index* ia, + const Index* ja + ); + + /** Call Pardiso to factorize the Matrix. */ + ESymSolverStatus Factorization( + const Index* ia, + const Index* ja, + bool check_NegEVals, + Index numberOfNegEVals + ); + + /** Call Pardiso to do the Solve. */ + ESymSolverStatus Solve( + const Index* ia, + const Index* ja, + Index nrhs, + Number* rhs_vals + ); + ///@} +}; + +} // namespace Ipopt + +#endif /* __IPPARDISOMKLSOLVERINTERFACE_HPP__ */ diff --git a/src/Algorithm/LinearSolvers/IpPardisoSolverInterface.cpp b/src/Algorithm/LinearSolvers/IpPardisoSolverInterface.cpp index 3d6d467d1..af628cb62 100644 --- a/src/Algorithm/LinearSolvers/IpPardisoSolverInterface.cpp +++ b/src/Algorithm/LinearSolvers/IpPardisoSolverInterface.cpp @@ -7,111 +7,60 @@ // Olaf Schenk Univ of Basel 2005-09-20 // - changed options, added PHASE_ flag -/* some useful links: - * MKL documentation: https://software.intel.com/en-us/intel-mkl/documentation - * API differences MKL vs Basel PARDISO: http://software.intel.com/en-us/articles/summary-of-api-differences-between-intel-mkl-pardiso-and-university-of-basel-pardiso-400 - */ - #include "IpoptConfig.h" #include "IpPardisoSolverInterface.hpp" #include -#include #include #include +#include +#include +#include -// determine the correct name of the Pardiso function -#ifndef IPOPT_HAS_PARDISO -// if we build for the Linear Solver loader, then use normal C-naming style -# define IPOPT_PARDISO_FUNC(name,NAME) name -#endif - -/* Prototypes for Pardiso's subroutines */ -extern "C" +namespace Ipopt { -#ifdef IPOPT_HAS_PARDISO_MKL - void IPOPT_PARDISO_FUNC(pardisoinit, PARDISOINIT)( - void* PT, - const ipfint* MTYPE, - ipfint* IPARM - ); -#else -// The following is a fix to allow linking with Pardiso library under Windows - void IPOPT_PARDISO_FUNC(pardisoinit, PARDISOINIT)( - void* PT, - const ipfint* MTYPE, - const ipfint* SOLVER, - ipfint* IPARM, - double* DPARM, - ipfint* ERROR - ); +#if IPOPT_VERBOSITY > 0 +static const Index dbg_verbosity = 0; #endif - void IPOPT_PARDISO_FUNC(pardiso, PARDISO)( - void** PT, - const ipfint* MAXFCT, - const ipfint* MNUM, - const ipfint* MTYPE, - const ipfint* PHASE, - const ipfint* N, - const double* A, - const ipfint* IA, - const ipfint* JA, - const ipfint* PERM, - const ipfint* NRHS, - ipfint* IPARM, - const ipfint* MSGLVL, - double* B, - double* X, - ipfint* ERROR, - double* DPARM - ); - +/** pointer to Pardiso function that can be set via PardisoSolverInterface::SetFunctions() */ +static IPOPT_DECL_PARDISOINIT(*user_pardisoinit) = NULL; +static IPOPT_DECL_PARDISO(*user_pardiso) = NULL; +static bool user_isparallel = false; #ifdef PARDISO_MATCHING_PREPROCESS - void IPOPT_PARDISO_FUNC(smat_reordering_pardiso_wsmp, SMAT_REORDERING_PARDISO_WSMP)( - const ipfint* N, - const ipfint* ia, - const ipfint* ja, - const double* a_, - ipfint* a2, - ipfint* ja2, - double* a2_, - ipfint* perm2, - double* scale2, - ipfint* tmp2_, - ipfint preprocess - ); +static IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(*user_smat_reordering_pardiso_wsmp) = NULL; #endif -} -namespace Ipopt -{ -#if IPOPT_VERBOSITY > 0 -static const Index dbg_verbosity = 0; +PardisoSolverInterface::PardisoSolverInterface( + SmartPtr pardisoloader_ +) : a_(NULL), +#ifdef PARDISO_MATCHING_PREPROCESS + ia2(NULL), + ja2(NULL), + a2_(NULL), + perm2(NULL), + scale2(NULL), #endif - -PardisoSolverInterface::PardisoSolverInterface() - : a_(NULL), + negevals_(-1), + initialized_(false), + MAXFCT_(1), + MNUM_(1), + MTYPE_(-2), + MSGLVL_(0), + debug_last_iter_(-1), + pardisoloader(pardisoloader_), + pardisoinit(NULL), + pardiso(NULL), #ifdef PARDISO_MATCHING_PREPROCESS - ia2(NULL), - ja2(NULL), - a2_(NULL), - perm2(NULL), - scale2(NULL), + smat_reordering_pardiso_wsmp(NULL), #endif - negevals_(-1), - initialized_(false), - MAXFCT_(1), - MNUM_(1), - MTYPE_(-2), - MSGLVL_(0), - debug_last_iter_(-1) + pardiso_exist_parallel(false) { DBG_START_METH("PardisoSolverInterface::PardisoSolverInterface()", dbg_verbosity); PT_ = new void* [64]; - IPARM_ = new ipfint[64]; - DPARM_ = new double[64]; + IPARM_ = new Index[64]; + DPARM_ = new Number[64]; } PardisoSolverInterface::~PardisoSolverInterface() @@ -122,14 +71,14 @@ PardisoSolverInterface::~PardisoSolverInterface() // Tell Pardiso to release all memory if( initialized_ ) { - ipfint PHASE = -1; - ipfint N = dim_; - ipfint NRHS = 0; - ipfint ERROR; - ipfint idmy; - double ddmy; - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, &MSGLVL_, &ddmy, - &ddmy, &ERROR, DPARM_); + Index PHASE = -1; + Index N = dim_; + Index NRHS = 0; + Index ERROR; + Index idmy = 0; + Number ddmy = 0.; + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, &MSGLVL_, &ddmy, + &ddmy, &ERROR, DPARM_); DBG_ASSERT(ERROR == 0); } @@ -152,7 +101,6 @@ void PardisoSolverInterface::RegisterOptions( SmartPtr roptions ) { - // Todo Use keywords instead of integer numbers roptions->AddStringOption3( "pardiso_matching_strategy", "Matching strategy to be used by Pardiso", @@ -166,13 +114,15 @@ void PardisoSolverInterface::RegisterOptions( "Toggle for handling case when elements were perturbed by Pardiso.", "no", "no", "Always redo symbolic factorization when elements were perturbed", - "yes", "Only redo symbolic factorization when elements were perturbed if also the inertia was wrong"); - roptions->AddStringOption2( + "yes", "Only redo symbolic factorization when elements were perturbed if also the inertia was wrong", + "", + true); + roptions->AddBoolOption( "pardiso_repeated_perturbation_means_singular", - "Interpretation of perturbed elements.", - "no", - "no", "Don't assume that matrix is singular if elements were perturbed after recent symbolic factorization", - "yes", "Assume that matrix is singular if elements were perturbed after recent symbolic factorization"); + "Whether to assume that matrix is singular if elements were perturbed after recent symbolic factorization.", + false, + "", + true); //roptions->AddLowerBoundedIntegerOption( // "pardiso_out_of_core_power", // "Enables out-of-core variant of Pardiso", @@ -186,122 +136,127 @@ void PardisoSolverInterface::RegisterOptions( "Pardiso message level", 0, 0, - "This determines the amount of analysis output from the Pardiso solver. " "This is MSGLVL in the Pardiso manual."); - roptions->AddStringOption2( + roptions->AddBoolOption( "pardiso_skip_inertia_check", - "Always pretend inertia is correct.", - "no", - "no", "check inertia", - "yes", "skip inertia check", + "Whether to pretend that inertia is correct.", + false, "Setting this option to \"yes\" essentially disables inertia check. " - "This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control."); + "This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control.", + true); roptions->AddIntegerOption( "pardiso_max_iterative_refinement_steps", "Limit on number of iterative refinement steps.", - // ToDo: Decide how many iterative refinement steps in Pardiso. - // For now, we keep the default (0) for Basel Pardiso. - // For MKL Pardiso, it seems that setting it to 1 makes it more - // robust and just a little bit slower. - // Setting it to 1 should decrease the number of iterative refinement - // steps by 1 in case that perturbed pivots have been used, and increase - // it by 1 otherwise. -#ifdef IPOPT_HAS_PARDISO_MKL - 1, -#else 0, -#endif "The solver does not perform more than the absolute value of this value steps of iterative refinement and " "stops the process if a satisfactory level of accuracy of the solution in terms of backward error is achieved. " "If negative, the accumulation of the residue uses extended precision real and complex data types. " "Perturbed pivots result in iterative refinement. " "The solver automatically performs two steps of iterative refinements when perturbed pivots are obtained during the numerical factorization and this option is set to 0."); -#ifdef IPOPT_HAS_PARDISO_MKL - roptions->AddStringOption4( - "pardiso_order", - "Controls the fill-in reduction ordering algorithm for the input matrix.", - "metis", - "amd", "minimum degree algorithm", - "one", "undocumented", - "metis", "MeTiS nested dissection algorithm", - "pmetis", "parallel (OpenMP) version of MeTiS nested dissection algorithm"); -#else roptions->AddStringOption6( "pardiso_order", "Controls the fill-in reduction ordering algorithm for the input matrix.", "metis", "amd", "minimum degree algorithm", - "one", "undocumented", + "one", "", "metis", "MeTiS nested dissection algorithm", "pmetis", "parallel (OpenMP) version of MeTiS nested dissection algorithm", - "four", "undocumented", - "five", "undocumented"); -#endif -#ifndef IPOPT_HAS_PARDISO_MKL + "four", "", + "five", ""); roptions->AddLowerBoundedIntegerOption( "pardiso_max_iter", "Maximum number of Krylov-Subspace Iteration", 1, 500, - "DPARM(1)"); + "DPARM(1)", + true); roptions->AddBoundedNumberOption( "pardiso_iter_relative_tol", "Relative Residual Convergence", 0.0, true, 1.0, true, 1e-6, - "DPARM(2)"); + "DPARM(2)", + true); roptions->AddLowerBoundedIntegerOption( "pardiso_iter_coarse_size", "Maximum Size of Coarse Grid Matrix", 1, 5000, - "DPARM(3)"); + "DPARM(3)", + true); roptions->AddLowerBoundedIntegerOption( "pardiso_iter_max_levels", "Maximum Size of Grid Levels", 1, 10, - "DPARM(4)"); + "DPARM(4)", + true); roptions->AddBoundedNumberOption( "pardiso_iter_dropping_factor", "dropping value for incomplete factor", 0.0, true, 1.0, true, 0.5, - "DPARM(5)"); + "DPARM(5)", + true); roptions->AddBoundedNumberOption( "pardiso_iter_dropping_schur", "dropping value for sparsify schur complement factor", 0.0, true, 1.0, true, 1e-1, - "DPARM(6)"); + "DPARM(6)", + true); roptions->AddLowerBoundedIntegerOption( "pardiso_iter_max_row_fill", "max fill for each row", 1, 10000000, - "DPARM(7)"); + "DPARM(7)", + true); roptions->AddLowerBoundedNumberOption( "pardiso_iter_inverse_norm_factor", "", 1, true, 5000000, - "DPARM(8)"); - roptions->AddStringOption2( + "DPARM(8)", + true); + roptions->AddBoolOption( "pardiso_iterative", - "Switch on iterative solver in Pardiso library", - "no", - "no", "do not switch on iterative solver", - "yes", "switch on iterative solver" - "This option is not available for Pardiso < 4.0 or MKL Pardiso"); + "Switch for iterative solver in Pardiso library", + false, + "", + true); roptions->AddLowerBoundedIntegerOption( "pardiso_max_droptol_corrections", "Maximal number of decreases of drop tolerance during one solve.", 1, 4, - "This is relevant only for iterative Pardiso options."); + "This is relevant only for iterative Pardiso options.", + true); +} + +void PardisoSolverInterface::SetFunctions( + IPOPT_DECL_PARDISOINIT(*pardisoinit), + IPOPT_DECL_PARDISO(*pardiso), + bool isparallel, + IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(*smat_reordering_pardiso_wsmp) +) +{ + DBG_ASSERT(pardisoinit != NULL); + DBG_ASSERT(pardiso != NULL); +#ifdef PARDISO_MATCHING_PREPROCESS + DBG_ASSERT(smat_reordering_pardiso_wsmp != NULL); +#endif + + user_pardisoinit = pardisoinit; + user_pardiso = pardiso; + user_isparallel = isparallel; +#ifdef PARDISO_MATCHING_PREPROCESS + user_smat_reordering_pardiso_wsmp = smat_reordering_pardiso_wsmp; +#else + (void)smat_reordering_pardiso_wsmp; #endif } @@ -310,6 +265,45 @@ bool PardisoSolverInterface::InitializeImpl( const std::string& prefix ) { + if( user_pardisoinit != NULL ) + { + pardisoinit = user_pardisoinit; + pardiso = user_pardiso; + pardiso_exist_parallel = user_isparallel; +#ifdef PARDISO_MATCHING_PREPROCESS + smat_reordering_pardiso_wsmp = user_smat_reordering_pardiso_wsmp; +#endif + } + else + { + DBG_ASSERT(IsValid(pardisoloader)); + + pardisoinit = (IPOPT_DECL_PARDISOINIT(*))pardisoloader->loadSymbol("pardisoinit"); + pardiso = (IPOPT_DECL_PARDISO(*))pardisoloader->loadSymbol("pardiso"); +#ifdef PARDISO_MATCHING_PREPROCESS + smat_reordering_pardiso_wsmp = (IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(*))pardisoloader->loadSymbol("smat_reordering_pardiso_wsmp"); +#endif + // load pardiso_ipopt_newinterface only as check that we get Pardiso >= 4.0.0 from pardiso-project + pardisoloader->loadSymbol("pardiso_ipopt_newinterface"); + // set pardiso_exist_parallel to true if symbol pardiso_exist_parallel exists in pardiso library + // ignore if symbol doesn't exist (pardiso_exist_parallel == false) + try + { + pardisoloader->loadSymbol("pardiso_exist_parallel"); + pardiso_exist_parallel = true; + } + catch( const DYNAMIC_LIBRARY_FAILURE& ) + { + DBG_ASSERT(!pardiso_exist_parallel); + } + } + + DBG_ASSERT(pardisoinit != NULL); + DBG_ASSERT(pardiso != NULL); +#ifdef PARDISO_MATCHING_PREPROCESS + DBG_ASSERT(smat_reordering_pardiso_wsmp); +#endif + Index enum_int; options.GetEnumValue("pardiso_matching_strategy", enum_int, prefix); match_strat_ = PardisoMatchingStrategy(enum_int); @@ -321,15 +315,14 @@ bool PardisoSolverInterface::InitializeImpl( //options.GetIntegerValue("pardiso_out_of_core_power", // pardiso_out_of_core_power, prefix); options.GetBoolValue("pardiso_skip_inertia_check", skip_inertia_check_, prefix); - int pardiso_msglvl; + Index pardiso_msglvl; options.GetIntegerValue("pardiso_msglvl", pardiso_msglvl, prefix); - int max_iterref_steps; + Index max_iterref_steps; options.GetIntegerValue("pardiso_max_iterative_refinement_steps", max_iterref_steps, prefix); - int order; + Index order; options.GetEnumValue("pardiso_order", order, prefix); -#ifndef IPOPT_HAS_PARDISO_MKL options.GetBoolValue("pardiso_iterative", pardiso_iterative_, prefix); - int pardiso_max_iter; + Index pardiso_max_iter; options.GetIntegerValue("pardiso_max_iter", pardiso_max_iter, prefix); Number pardiso_iter_relative_tol; options.GetNumericValue("pardiso_iter_relative_tol", pardiso_iter_relative_tol, prefix); @@ -346,23 +339,20 @@ bool PardisoSolverInterface::InitializeImpl( Number pardiso_iter_inverse_norm_factor; options.GetNumericValue("pardiso_iter_inverse_norm_factor", pardiso_iter_inverse_norm_factor, prefix); options.GetIntegerValue("pardiso_max_droptol_corrections", pardiso_max_droptol_corrections_, prefix); -#else - pardiso_iterative_ = false; -#endif // Number value = 0.0; // Tell Pardiso to release all memory if it had been used before if( initialized_ ) { - ipfint PHASE = -1; - ipfint N = dim_; - ipfint NRHS = 0; - ipfint ERROR; - ipfint idmy; - double ddmy; - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, &MSGLVL_, &ddmy, - &ddmy, &ERROR, DPARM_); + Index PHASE = -1; + Index N = dim_; + Index NRHS = 0; + Index ERROR; + Index idmy; + Number ddmy; + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, &ddmy, &idmy, &idmy, &idmy, &NRHS, IPARM_, &MSGLVL_, &ddmy, + &ddmy, &ERROR, DPARM_); DBG_ASSERT(ERROR == 0); } @@ -395,60 +385,44 @@ bool PardisoSolverInterface::InitializeImpl( memset(PT_, 0, 64); // needs to be initialized to 0 according to MKL Pardiso docu IPARM_[0] = 0; // Tell it to fill IPARM with default values(?) -#ifndef IPOPT_HAS_PARDISO_MKL - ipfint ERROR = 0; - ipfint SOLVER = 0; // initialize only direct solver + Index ERROR = 0; + Index SOLVER = 0; // initialize only direct solver - IPOPT_PARDISO_FUNC(pardisoinit, PARDISOINIT)(PT_, &MTYPE_, &SOLVER, IPARM_, DPARM_, &ERROR); -#else - IPOPT_PARDISO_FUNC(pardisoinit, PARDISOINIT)(PT_, &MTYPE_, IPARM_); -#endif + pardisoinit(PT_, &MTYPE_, &SOLVER, IPARM_, DPARM_, &ERROR); + + if( ERROR != 0 ) + { + Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, "Problem with Pardiso license (error %" IPOPT_INDEX_FORMAT " from pardisoinit).\n", ERROR); + return false; + } // Set some parameters for Pardiso IPARM_[0] = 1; // Don't use the default values int num_procs = 1; -#if defined(IPOPT_HAS_PARDISO_PARALLEL) || ! defined(IPOPT_HAS_PARDISO) - // Obtain the numbers of processors from the value of OMP_NUM_THREADS - char* var = getenv("OMP_NUM_THREADS"); - if( var != NULL ) + if( pardiso_exist_parallel ) { - sscanf(var, "%d", &num_procs); - if( num_procs < 1 ) + // Obtain the numbers of processors from the value of OMP_NUM_THREADS + char* var = getenv("OMP_NUM_THREADS"); + if( var != NULL ) { - Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Invalid value for OMP_NUM_THREADS (\"%s\").\n", var); - return false; + sscanf(var, "%d", &num_procs); + if( num_procs < 1 ) + { + Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, + "Invalid value for OMP_NUM_THREADS (\"%s\").\n", var); + return false; + } + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, + "Using environment OMP_NUM_THREADS = %d as the number of processors for PARDISO.\n", num_procs); } - Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Using environment OMP_NUM_THREADS = %d as the number of processors for PARDISO.\n", num_procs); } -#if defined(IPOPT_HAS_PARDISO) && ! defined(IPOPT_HAS_PARDISO_MKL) - // If we run Pardiso through the linear solver loader, - // we do not know whether it is the parallel version, so we do not report a warning if OMP_NUM_THREADS is not set. - // If we run Pardiso from MKL, then OMP_NUM_THREADS does not need to be set, so no warning. else { Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, "You should set the environment variable OMP_NUM_THREADS to the number of processors used in Pardiso (e.g., 1).\n\n"); } -#endif -#endif -#ifdef IPOPT_HAS_PARDISO_MKL - IPARM_[1] = order; - (void) num_procs; - // For MKL PARDSIO, the documentation says, "iparm(3) Reserved. Set to zero.", so we don't set IPARM_[2] - IPARM_[5] = 1;// Overwrite right-hand side - IPARM_[7] = max_iterref_steps; - IPARM_[9] = 12;// pivot perturbation (as higher as less perturbation) - IPARM_[10] = 2;// enable scaling (recommended for interior-point indefinite matrices) - IPARM_[12] = (int)match_strat_;// enable matching (recommended, as above) - IPARM_[20] = 3;// bunch-kaufman pivoting - IPARM_[23] = 1;// parallel fac - IPARM_[24] = 0;// parallel solve - //IPARM_[26] = 1; // matrix checker -#else IPARM_[1] = order; IPARM_[2] = num_procs; // Set the number of processors IPARM_[5] = 1; // Overwrite right-hand side @@ -465,24 +439,23 @@ bool PardisoSolverInterface::InitializeImpl( IPARM_[20] = 3; // Results in better accuracy IPARM_[23] = 1; // parallel fac IPARM_[24] = 1; // parallel solve - IPARM_[28] = 0; // 32-bit factorization +#ifdef IPOPT_SINGLE + IPARM_[28] = 1; // 32-bit factorization (single precision) +#else + IPARM_[28] = 0; // 64-bit factorization (double precision) +#endif IPARM_[29] = 80; // we need this for IPOPT interface //IPARM_[33] = 1; // bit-by-bit identical results in parallel run -#endif Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Pardiso matrix ordering (IPARM(2)): %d\n", IPARM_[1]); + "Pardiso matrix ordering (IPARM(2)): %" IPOPT_INDEX_FORMAT "\n", IPARM_[1]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Pardiso max. iterref. steps (IPARM(8)): %d\n", IPARM_[7]); + "Pardiso max. iterref. steps (IPARM(8)): %" IPOPT_INDEX_FORMAT "\n", IPARM_[7]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Pardiso matching strategy (IPARM(13)): %d\n", IPARM_[12]); + "Pardiso matching strategy (IPARM(13)): %" IPOPT_INDEX_FORMAT "\n", IPARM_[12]); if( pardiso_iterative_ ) { -#ifdef IPOPT_HAS_PARDISO_MKL - THROW_EXCEPTION(OPTION_INVALID, - "You chose to use the iterative version of Pardiso, but you need to use a Pardiso version of at least 4.0."); -#else IPARM_[31] = 1; // active direct solver DPARM_[0] = pardiso_max_iter; // maximum number of Krylov-Subspace Iteration @@ -517,7 +490,6 @@ bool PardisoSolverInterface::InitializeImpl( // Default is 500 // 2 <= value < 50000 DPARM_[8] = 25; // maximum number of non-improvement steps -#endif } MSGLVL_ = pardiso_msglvl; @@ -533,7 +505,7 @@ ESymSolverStatus PardisoSolverInterface::MultiSolve( const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ) @@ -559,7 +531,7 @@ ESymSolverStatus PardisoSolverInterface::MultiSolve( return Solve(ia, ja, nrhs, rhs_vals); } -double* PardisoSolverInterface::GetValuesArrayPtr() +Number* PardisoSolverInterface::GetValuesArrayPtr() { DBG_ASSERT(initialized_); DBG_ASSERT(a_); @@ -580,7 +552,7 @@ ESymSolverStatus PardisoSolverInterface::InitializeStructure( // Make space for storing the matrix elements delete[] a_; a_ = NULL; - a_ = new double[nonzeros_]; + a_ = new Number[nonzeros_]; // Do the symbolic facotrization ESymSolverStatus retval = SymbolicFactorization(ia, ja); @@ -615,11 +587,11 @@ ESymSolverStatus PardisoSolverInterface::SymbolicFactorization( static void write_iajaa_matrix( - int N, + Index N, const Index* ia, const Index* ja, - double* a_, - double* rhs_vals, + Number* a_, + Number* rhs_vals, int iter_cnt, int sol_cnt ) @@ -627,12 +599,11 @@ void write_iajaa_matrix( if( getenv("IPOPT_WRITE_MAT") ) { /* Write header */ - FILE* mat_file; char mat_name[128]; char mat_pref[32]; - ipfint NNZ = ia[N] - 1; - ipfint i; + Index NNZ = ia[N] - 1; + Index i; if( getenv("IPOPT_WRITE_PREFIX") ) { @@ -646,43 +617,42 @@ void write_iajaa_matrix( Snprintf(mat_name, 127, "%s_%03d-%02d.iajaa", mat_pref, iter_cnt, sol_cnt); // Open and write matrix file. - mat_file = fopen(mat_name, "w"); + std::ofstream mat_file(mat_name); + mat_file << std::setprecision(std::numeric_limits::digits10 + 1); - fprintf(mat_file, "%d\n", N); - fprintf(mat_file, "%d\n", NNZ); + mat_file << N << std::endl; + mat_file << NNZ << std::endl; for( i = 0; i < N + 1; i++ ) { - fprintf(mat_file, "%d\n", ia[i]); + mat_file << ia[i] << std::endl; } for( i = 0; i < NNZ; i++ ) { - fprintf(mat_file, "%d\n", ja[i]); + mat_file << ja[i] << std::endl; } for( i = 0; i < NNZ; i++ ) { - fprintf(mat_file, "%32.24e\n", a_[i]); + mat_file << a_[i] << std::endl; } /* Right hand side. */ if( rhs_vals ) for( i = 0; i < N; i++ ) { - fprintf(mat_file, "%32.24e\n", rhs_vals[i]); + mat_file << rhs_vals[i] << std::endl; } - - fclose(mat_file); } - /* addtional matrix format */ + + /* additional matrix format */ if( getenv("IPOPT_WRITE_MAT_MTX") ) { /* Write header */ - FILE* mat_file; char mat_name[128]; char mat_pref[32]; - ipfint i; - ipfint j; + Index i; + Index j; if( getenv("IPOPT_WRITE_PREFIX") ) { @@ -696,15 +666,14 @@ void write_iajaa_matrix( Snprintf(mat_name, 127, "%s_%03d-%02d.mtx", mat_pref, iter_cnt, sol_cnt); // Open and write matrix file. - mat_file = fopen(mat_name, "w"); + std::ofstream mat_file(mat_name); + mat_file << std::setprecision(std::numeric_limits::digits10 + 1); for( i = 0; i < N; i++ ) for( j = ia[i]; j < ia[i + 1] - 1; j++ ) { - fprintf(mat_file, " %d %d %32.24e \n", i + 1, ja[j - 1], a_[j - 1]); + mat_file << ' ' << i + 1 << ' ' << ja[j - 1] << ' ' << a_[j - 1] << std::endl; } - - fclose(mat_file); } } @@ -718,15 +687,15 @@ ESymSolverStatus PardisoSolverInterface::Factorization( DBG_START_METH("PardisoSolverInterface::Factorization", dbg_verbosity); // Call Pardiso to do the factorization - ipfint PHASE; - ipfint N = dim_; - ipfint PERM; // This should not be accessed by Pardiso - ipfint NRHS = 0; - double B; // This should not be accessed by Pardiso in factorization + Index PHASE; + Index N = dim_; + Index PERM; // This should not be accessed by Pardiso + Index NRHS = 0; + Number B; // This should not be accessed by Pardiso in factorization // phase - double X; // This should not be accessed by Pardiso in factorization + Number X; // This should not be accessed by Pardiso in factorization // phase - ipfint ERROR; + Index ERROR; bool done = false; bool just_performed_symbolic_factorization = false; @@ -757,14 +726,14 @@ ESymSolverStatus PardisoSolverInterface::Factorization( delete[] scale2; scale2 = NULL; - ia2 = new ipfint[N + 1]; - ja2 = new ipfint[nonzeros_]; - a2_ = new double[nonzeros_]; - perm2 = new ipfint[N]; - scale2 = new double[N]; - ipfint* tmp2_ = new ipfint[N]; + ia2 = new Index[N + 1]; + ja2 = new Index[nonzeros_]; + a2_ = new Number[nonzeros_]; + perm2 = new Index[N]; + scale2 = new Number[N]; + Index* tmp2_ = new Index[N]; - IPOPT_PARDISO_FUNC(smat_reordering_pardiso_wsmp, SMAT_REORDERING_PARDISO_WSMP)(&N, ia, ja, a_, ia2, ja2, a2_, perm2, scale2, tmp2_, 0); + smat_reordering_pardiso_wsmp(&N, ia, ja, a_, ia2, ja2, a2_, perm2, scale2, tmp2_, 0); delete[] tmp2_; @@ -772,13 +741,13 @@ ESymSolverStatus PardisoSolverInterface::Factorization( Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Calling Pardiso for symbolic factorization.\n"); - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, #ifdef PARDISO_MATCHING_PREPROCESS - &PHASE, &N, a2_, ia2, ja2, &PERM, + &PHASE, &N, a2_, ia2, ja2, &PERM, #else - &PHASE, &N, a_, ia, ja, &PERM, + &PHASE, &N, a_, ia, ja, &PERM, #endif - &NRHS, IPARM_, &MSGLVL_, &B, &X, &ERROR, DPARM_); + &NRHS, IPARM_, &MSGLVL_, &B, &X, &ERROR, DPARM_); if( HaveIpData() ) { IpData().TimingStats().LinearSystemSymbolicFactorization().End(); @@ -786,24 +755,24 @@ ESymSolverStatus PardisoSolverInterface::Factorization( if( ERROR == -7 ) { Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Pardiso symbolic factorization returns ERROR = %d. Matrix is singular.\n", ERROR); + "Pardiso symbolic factorization returns ERROR = %" IPOPT_INDEX_FORMAT ". Matrix is singular.\n", ERROR); return SYMSOLVER_SINGULAR; } else if( ERROR != 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in Pardiso during symbolic factorization phase. ERROR = %d.\n", ERROR); + "Error in Pardiso during symbolic factorization phase. ERROR = %" IPOPT_INDEX_FORMAT ".\n", ERROR); return SYMSOLVER_FATAL_ERROR; } have_symbolic_factorization_ = true; just_performed_symbolic_factorization = true; Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Memory in KB required for the symbolic factorization = %d.\n", IPARM_[14]); + "Memory in KB required for the symbolic factorization = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[14]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Integer memory in KB required for the numerical factorization = %d.\n", IPARM_[15]); + "Integer memory in KB required for the numerical factorization = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[15]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Double memory in KB required for the numerical factorization = %d.\n", IPARM_[16]); + "Double memory in KB required for the numerical factorization = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[16]); } PHASE = 22; @@ -831,18 +800,18 @@ ESymSolverStatus PardisoSolverInterface::Factorization( } #ifdef PARDISO_MATCHING_PREPROCESS - ipfint* tmp3_ = new ipfint[N]; - IPOPT_PARDISO_FUNC(smat_reordering_pardiso_wsmp, SMAT_REORDERING_PARDISO_WSMP)(&N, ia, ja, a_, ia2, ja2, a2_, perm2, scale2, tmp3_, 1); + Index* tmp3_ = new Index[N]; + smat_reordering_pardiso_wsmp(&N, ia, ja, a_, ia2, ja2, a2_, perm2, scale2, tmp3_, 1); delete[] tmp3_; #endif - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, #ifdef PARDISO_MATCHING_PREPROCESS - &PHASE, &N, a2_, ia2, ja2, &PERM, + &PHASE, &N, a2_, ia2, ja2, &PERM, #else - &PHASE, &N, a_, ia, ja, &PERM, + &PHASE, &N, a_, ia, ja, &PERM, #endif - &NRHS, IPARM_, &MSGLVL_, &B, &X, &ERROR, DPARM_); + &NRHS, IPARM_, &MSGLVL_, &B, &X, &ERROR, DPARM_); if( HaveIpData() ) { IpData().TimingStats().LinearSystemFactorization().End(); @@ -851,7 +820,7 @@ ESymSolverStatus PardisoSolverInterface::Factorization( if( ERROR == -7 ) { Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Pardiso factorization returns ERROR = %d. Matrix is singular.\n", ERROR); + "Pardiso factorization returns ERROR = %" IPOPT_INDEX_FORMAT ". Matrix is singular.\n", ERROR); return SYMSOLVER_SINGULAR; } else if( ERROR == -4 ) @@ -863,7 +832,7 @@ ESymSolverStatus PardisoSolverInterface::Factorization( else if( ERROR != 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in Pardiso during factorization phase. ERROR = %d.\n", ERROR); + "Error in Pardiso during factorization phase. ERROR = %" IPOPT_INDEX_FORMAT ".\n", ERROR); return SYMSOLVER_FATAL_ERROR; } @@ -871,7 +840,7 @@ ESymSolverStatus PardisoSolverInterface::Factorization( if( IPARM_[13] != 0 ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of perturbed pivots in factorization phase = %d.\n", IPARM_[13]); + "Number of perturbed pivots in factorization phase = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[13]); if( !pardiso_redo_symbolic_fact_only_if_inertia_wrong_ || (negevals_ != numberOfNegEVals) ) { if( HaveIpData() ) @@ -930,7 +899,7 @@ ESymSolverStatus PardisoSolverInterface::Factorization( if( check_NegEVals && (numberOfNegEVals != negevals_) ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Wrong inertia: required are %d, but we got %d.\n", numberOfNegEVals, negevals_); + "Wrong inertia: required are %" IPOPT_INDEX_FORMAT ", but we got %" IPOPT_INDEX_FORMAT ".\n", numberOfNegEVals, negevals_); return SYMSOLVER_WRONG_INERTIA; } @@ -941,7 +910,7 @@ ESymSolverStatus PardisoSolverInterface::Solve( const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals + Number* rhs_vals ) { DBG_START_METH("PardisoSolverInterface::Solve", dbg_verbosity); @@ -951,16 +920,16 @@ ESymSolverStatus PardisoSolverInterface::Solve( IpData().TimingStats().LinearSystemBackSolve().Start(); } // Call Pardiso to do the solve for the given right-hand sides - ipfint PHASE = 33; - ipfint N = dim_; - ipfint PERM; // This should not be accessed by Pardiso - ipfint NRHS = nrhs; - double* X = new double[nrhs * dim_]; - - double* ORIG_RHS = new double[nrhs * dim_]; - ipfint ERROR; + Index PHASE = 33; + Index N = dim_; + Index PERM; // This should not be accessed by Pardiso + Index NRHS = nrhs; + Number* X = new Number[nrhs * dim_]; + + Number* ORIG_RHS = new Number[nrhs * dim_]; + Index ERROR; // Initialize solution with zero and save right hand side - for( int i = 0; i < N; i++ ) + for( Index i = 0; i < N; i++ ) { X[i] = 0.; ORIG_RHS[i] = rhs_vals[i]; @@ -981,41 +950,42 @@ ESymSolverStatus PardisoSolverInterface::Solve( int attempts = 0; const int max_attempts = pardiso_iterative_ ? pardiso_max_droptol_corrections_ + 1 : 1; + DBG_ASSERT(max_attempts > 0); while( attempts < max_attempts ) { #ifdef PARDISO_MATCHING_PREPROCESS - for (int i = 0; i < N; i++) + for (Index i = 0; i < N; i++) { rhs_vals[perm2[i]] = scale2[i] * ORIG_RHS[ i ]; } - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, - &PHASE, &N, a2_, ia2, ja2, &PERM, - &NRHS, IPARM_, &MSGLVL_, rhs_vals, X, - &ERROR, DPARM_); - for (int i = 0; i < N; i++) + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, + &PHASE, &N, a2_, ia2, ja2, &PERM, + &NRHS, IPARM_, &MSGLVL_, rhs_vals, X, + &ERROR, DPARM_); + for (Index i = 0; i < N; i++) { X[i] = rhs_vals[ perm2[i]]; } - for (int i = 0; i < N; i++) + for (Index i = 0; i < N; i++) { rhs_vals[i] = scale2[i] * X[i]; } #else - for( int i = 0; i < N; i++ ) + for( Index i = 0; i < N; i++ ) { rhs_vals[i] = ORIG_RHS[i]; } - IPOPT_PARDISO_FUNC(pardiso, PARDISO)(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, a_, ia, ja, &PERM, &NRHS, IPARM_, &MSGLVL_, rhs_vals, X, - &ERROR, DPARM_); + pardiso(PT_, &MAXFCT_, &MNUM_, &MTYPE_, &PHASE, &N, a_, ia, ja, &PERM, &NRHS, IPARM_, &MSGLVL_, rhs_vals, X, + &ERROR, DPARM_); #endif if( ERROR <= -100 && ERROR >= -102 ) { Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, - "Iterative solver in Pardiso did not converge (ERROR = %d)\n", ERROR); + "Iterative solver in Pardiso did not converge (ERROR = %" IPOPT_INDEX_FORMAT ")\n", ERROR); Jnlst().Printf(J_WARNING, J_LINEAR_ALGEBRA, " Decreasing drop tolerances from DPARM_[4] = %e and DPARM_[5] = %e\n", DPARM_[4], DPARM_[5]); PHASE = 23; @@ -1039,7 +1009,7 @@ ESymSolverStatus PardisoSolverInterface::Solve( if( IPARM_[6] != 0 ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of iterative refinement steps = %d.\n", IPARM_[6]); + "Number of iterative refinement steps = %" IPOPT_INDEX_FORMAT ".\n", IPARM_[6]); if( HaveIpData() ) { IpData().Append_info_string("Pi"); @@ -1053,7 +1023,7 @@ ESymSolverStatus PardisoSolverInterface::Solve( if( ERROR != 0 ) { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in Pardiso during solve phase. ERROR = %d.\n", ERROR); + "Error in Pardiso during solve phase. ERROR = %" IPOPT_INDEX_FORMAT ".\n", ERROR); return SYMSOLVER_FATAL_ERROR; } return SYMSOLVER_SUCCESS; diff --git a/src/Algorithm/LinearSolvers/IpPardisoSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpPardisoSolverInterface.hpp index ae1ac237f..d5a4a1e2d 100644 --- a/src/Algorithm/LinearSolvers/IpPardisoSolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpPardisoSolverInterface.hpp @@ -7,27 +7,79 @@ #ifndef __IPPARDISOSOLVERINTERFACE_HPP__ #define __IPPARDISOSOLVERINTERFACE_HPP__ +#include "IpoptConfig.h" #include "IpSparseSymLinearSolverInterface.hpp" +#include "IpLibraryLoader.hpp" +#include "IpTypes.h" //#define PARDISO_MATCHING_PREPROCESS +/* assuming PARDISO 4.0.0 or above */ +/// @since 3.14.0 +#define IPOPT_DECL_PARDISOINIT(x) void (x)( \ + void* PT, \ + const ipindex* MTYPE, \ + const ipindex* SOLVER, \ + ipindex* IPARM, \ + ipnumber* DPARM, \ + ipindex* E \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_PARDISO(x) void (x)( \ + void** PT, \ + const ipindex* MAXFCT, \ + const ipindex* MNUM, \ + const ipindex* MTYPE, \ + const ipindex* PHASE, \ + const ipindex* N, \ + const ipnumber* A, \ + const ipindex* IA, \ + const ipindex* JA, \ + const ipindex* PERM, \ + const ipindex* NRHS, \ + ipindex* IPARM, \ + const ipindex* MSGLVL, \ + ipnumber* B, \ + ipnumber* X, \ + ipindex* E, \ + ipnumber* DPARM \ +) + +/// @since 3.14.0 +#define IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(x) void (x)( \ + const ipindex* N, \ + const ipindex* ia, \ + const ipindex* ja, \ + const ipnumber* a_, \ + ipindex* a2, \ + ipindex* ja2, \ + ipnumber* a2_, \ + ipindex* perm2, \ + ipnumber* scale2, \ + ipindex* tmp2_, \ + ipindex preprocess \ +) + namespace Ipopt { -/** Interface to the linear solver Pardiso, derived from +/** Interface to the linear solver Pardiso as distributed by pardiso-project.org, derived from * SparseSymLinearSolverInterface. */ class PardisoSolverInterface: public SparseSymLinearSolverInterface { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor */ - PardisoSolverInterface(); + PardisoSolverInterface( + SmartPtr pardisoloader_ ///< @since 3.14.0 + ); /** Destructor */ virtual ~PardisoSolverInterface(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -35,7 +87,7 @@ class PardisoSolverInterface: public SparseSymLinearSolverInterface ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ virtual ESymSolverStatus InitializeStructure( Index dim, Index nonzeros, @@ -43,22 +95,22 @@ class PardisoSolverInterface: public SparseSymLinearSolverInterface const Index* ja ); - virtual double* GetValuesArrayPtr(); + virtual Number* GetValuesArrayPtr(); virtual ESymSolverStatus MultiSolve( bool new_matrix, const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals); virtual Index NumberOfNegEVals() const; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ virtual bool IncreaseQuality(); virtual bool ProvidesInertia() const @@ -70,13 +122,27 @@ class PardisoSolverInterface: public SparseSymLinearSolverInterface { return CSR_Format_1_Offset; } - //@} + ///@} - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} + + /// set Pardiso functions to use for every instantiation of this class + /// + /// unless PARDISO_MATCHING_PREPROCESS has been defined, @arg smat_reordering_pardiso_wsmp is ignored + /// @since 3.14.0 + static void SetFunctions( + IPOPT_DECL_PARDISOINIT(*pardisoinit), + IPOPT_DECL_PARDISO(*pardiso), + bool isparallel, + IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(*smat_reordering_pardiso_wsmp) +#ifndef PARDISO_MATCHING_PREPROCESS + = NULL +#endif + ); private: /**@name Default Compiler Generated Methods @@ -86,7 +152,7 @@ class PardisoSolverInterface: public SparseSymLinearSolverInterface * them for us, so we declare them private * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ PardisoSolverInterface( const PardisoSolverInterface&); @@ -94,10 +160,10 @@ class PardisoSolverInterface: public SparseSymLinearSolverInterface /** Default Assignment Operator */ void operator=( const PardisoSolverInterface&); - //@} + ///@} /** @name Information about the matrix */ - //@{ + ///@{ /** Number of rows and columns of the matrix */ Index dim_; @@ -105,26 +171,26 @@ class PardisoSolverInterface: public SparseSymLinearSolverInterface Index nonzeros_; /** Array for storing the values of the matrix. */ - double* a_; - //@} + Number* a_; + ///@} #ifdef PARDISO_MATCHING_PREPROCESS /** Array for storing the values of a second matrix that has been already reordered. */ - ipfint* ia2; - ipfint* ja2; - double* a2_; - ipfint* perm2; - double* scale2; + Index* ia2; + Index* ja2; + Number* a2_; + Index* perm2; + Number* scale2; #endif /** @name Information about most recent factorization/solve */ - //@{ + ///@{ /** Number of negative eigenvalues */ Index negevals_; - //@} + ///@} /** @name Solver specific options */ - //@{ + ///@{ /** Type for matching strategies */ enum PardisoMatchingStrategy { @@ -153,44 +219,58 @@ class PardisoSolverInterface: public SparseSymLinearSolverInterface bool pardiso_iterative_; /** Maximal number of decreases of drop tolerance during one solve. */ Index pardiso_max_droptol_corrections_; - //@} + ///@} /** @name Initialization flags */ - //@{ + ///@{ /** Flag indicating if internal data is initialized. * For initialization, this object needs to have seen a matrix. */ bool initialized_; - //@} + ///@} /** @name Solver specific information */ - //@{ + ///@{ /** Internal data address pointers. */ void** PT_; /** Maximal number of factors with identical nonzero * structure. Here, we only store one factorization. Is always 1. */ - ipfint MAXFCT_; + Index MAXFCT_; /** Actual matrix for the solution phase. Is always 1.*/ - ipfint MNUM_; + Index MNUM_; /** Matrix type; real and symmetric indefinite. Is always -2.*/ - ipfint MTYPE_; + Index MTYPE_; /** Parameter and info array for Pardiso. */ - ipfint* IPARM_; + Index* IPARM_; /** Parameter and info array for Pardiso. */ - double* DPARM_; + Number* DPARM_; /** Message level. */ - ipfint MSGLVL_; - //@} + Index MSGLVL_; + ///@} /**@name Some counters for debugging */ - //@{ + ///@{ Index debug_last_iter_; Index debug_cnt_; - //@} + ///@} + + /**@name PARDISO function pointers + * @{ + */ + SmartPtr pardisoloader; + + IPOPT_DECL_PARDISOINIT(*pardisoinit); + IPOPT_DECL_PARDISO(*pardiso); +#ifdef PARDISO_MATCHING_PREPROCESS + IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(*smat_reordering_pardiso_wsmp); +#endif + + bool pardiso_exist_parallel; + /**@} */ /** @name Internal functions */ - //@{ + ///@{ /** Call Pardiso to do the analysis phase. */ ESymSolverStatus SymbolicFactorization( const Index* ia, @@ -210,10 +290,11 @@ class PardisoSolverInterface: public SparseSymLinearSolverInterface const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals + Number* rhs_vals ); - //@} + ///@} }; } // namespace Ipopt -#endif + +#endif /* __IPPARDISOSOLVERINTERFACE_HPP__ */ diff --git a/src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.cpp b/src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.cpp index 430ebb644..b72fdc77f 100644 --- a/src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.cpp +++ b/src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.cpp @@ -26,10 +26,10 @@ bool SlackBasedTSymScalingMethod::InitializeImpl( bool SlackBasedTSymScalingMethod::ComputeSymTScalingFactors( Index /*n*/, Index /*nnz*/, - const ipfint* /*airn*/, - const ipfint* /*ajcn*/, - const double* /*a*/, - double* scaling_factors + const Index* /*airn*/, + const Index* /*ajcn*/, + const Number* /*a*/, + Number* scaling_factors ) { DBG_START_METH("SlackBasedTSymScalingMethod::ComputeTSymScalingFactors", diff --git a/src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.hpp b/src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.hpp index 41de56173..1490d744a 100644 --- a/src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.hpp +++ b/src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.hpp @@ -22,13 +22,13 @@ class SlackBasedTSymScalingMethod: public TSymScalingMethod { public: /** @name Constructor/Destructor */ - //@{ + ///@{ SlackBasedTSymScalingMethod() { } virtual ~SlackBasedTSymScalingMethod() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -41,10 +41,10 @@ class SlackBasedTSymScalingMethod: public TSymScalingMethod virtual bool ComputeSymTScalingFactors( Index n, Index nnz, - const ipfint* airn, - const ipfint* ajcn, - const double* a, - double* scaling_factors + const Index* airn, + const Index* ajcn, + const Number* a, + Number* scaling_factors ); private: @@ -53,7 +53,7 @@ class SlackBasedTSymScalingMethod: public TSymScalingMethod * 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. */ - //@{ + ///@{ /** Copy Constructor */ SlackBasedTSymScalingMethod( const SlackBasedTSymScalingMethod& diff --git a/src/Algorithm/LinearSolvers/IpSparseSymLinearSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpSparseSymLinearSolverInterface.hpp index 0cfb4528b..f9110e9f4 100644 --- a/src/Algorithm/LinearSolvers/IpSparseSymLinearSolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpSparseSymLinearSolverInterface.hpp @@ -19,9 +19,11 @@ namespace Ipopt * * This defines the general interface to linear solvers for sparse * symmetric indefinite matrices. The matrices can be provided - * either in "triplet format" (like for Harwell's MA27 solver), or - * in compressed sparse row (CSR) format for the lower triangular - * part of the symmetric matrix. + * either in "triplet format" for the lower triangular part + * (like for Harwell's MA27 solver), or in compressed sparse row + * (CSR) format for the upper triangular part of the symmetric matrix. + * The latter may equivalently (or better) be referred as compressed + * sparse column (CSC) format for the lower triangular part. * * The solver should be able to compute the inertia of the matrix, * or more specifically, the number of negative eigenvalues in the @@ -99,26 +101,26 @@ class SparseSymLinearSolverInterface: public AlgorithmStrategyObject /** Enum to specify sparse matrix format. */ enum EMatrixFormat { - /** Triplet (MA27) format */ + /** Triplet (MA27) format for lower triangular part */ Triplet_Format, - /** Compressed sparse row format for lower triangular part, with 0 offset */ + /** Compressed sparse row format for upper triangular part, with 0 offset */ CSR_Format_0_Offset, - /** Compressed sparse row format for lower triangular part, with 1 offset */ + /** Compressed sparse row format for upper triangular part, with 1 offset */ CSR_Format_1_Offset, - /** Compressed sparse row format for both lwr and upr parts, with 0 offset */ + /** Compressed sparse row format for both lower and upper parts, with 0 offset */ CSR_Full_Format_0_Offset, - /** Compressed sparse row format for both lwr and upr parts, with 1 offset */ + /** Compressed sparse row format for both lower and upper parts, with 1 offset */ CSR_Full_Format_1_Offset }; /** @name Constructor/Destructor */ - //@{ + ///@{ SparseSymLinearSolverInterface() { } virtual ~SparseSymLinearSolverInterface() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -126,7 +128,7 @@ class SparseSymLinearSolverInterface: public AlgorithmStrategyObject ) = 0; /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ /** Method for initializing internal structures. * * Here, ndim gives the number of rows and columns of the matrix, @@ -150,7 +152,7 @@ class SparseSymLinearSolverInterface: public AlgorithmStrategyObject * The returned array must have space for at * least nonzero elements. */ - virtual double* GetValuesArrayPtr() = 0; + virtual Number* GetValuesArrayPtr() = 0; /** Solve operation for multiple right hand sides. * @@ -190,7 +192,7 @@ class SparseSymLinearSolverInterface: public AlgorithmStrategyObject const Index* ia, const Index* ja, Index nrhs, - double* rhs_vals, + Number* rhs_vals, bool check_NegEVals, Index numberOfNegEVals ) = 0; @@ -203,10 +205,10 @@ class SparseSymLinearSolverInterface: public AlgorithmStrategyObject * (see ProvidesInertia). */ virtual Index NumberOfNegEVals() const = 0; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ /** Request to increase quality of solution for next solve. * * The calling class asks linear solver to increase quality of @@ -227,11 +229,11 @@ class SparseSymLinearSolverInterface: public AlgorithmStrategyObject * understands. */ virtual EMatrixFormat MatrixFormat() const = 0; - //@} + ///@} /** @name Methods related to the detection of linearly dependent * rows in a matrix */ - //@{ + ///@{ /** Query whether the indices of linearly dependent rows/columns * can be determined by this linear solver. */ diff --git a/src/Algorithm/LinearSolvers/IpSpralSolverInterface.cpp b/src/Algorithm/LinearSolvers/IpSpralSolverInterface.cpp new file mode 100644 index 000000000..811b74d02 --- /dev/null +++ b/src/Algorithm/LinearSolvers/IpSpralSolverInterface.cpp @@ -0,0 +1,744 @@ +// Copyright (C) 2012, The Science and Technology Facilities Council. +// Copyright (C) 2009, Jonathan Hogg . +// Copyright (C) 2004, 2007 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// Authors: Byron Tasseff LANL 2020-03-21 +// Jonathan Hogg STFC 2012-12-21 +// Jonathan Hogg 2009-07-29 +// Carl Laird, Andreas Waechter IBM 2004-03-17 + +#include "IpoptConfig.h" +#include "IpSpralSolverInterface.hpp" + +#include +#include +#include + +using namespace std; + +namespace Ipopt +{ + +SpralSolverInterface::~SpralSolverInterface() +{ + delete[] val_; + delete[] scaling_; + + spral_ssids_free(&akeep_, &fkeep_); +} + +void SpralSolverInterface::RegisterOptions( + SmartPtr roptions +) +{ + roptions->AddLowerBoundedIntegerOption( + "spral_cpu_block_size", + "CPU Parallelization Block Size", + 1, + 256, + "Block size to use for parallelization of large nodes on CPU resources."); + + roptions->AddLowerBoundedNumberOption( + "spral_gpu_perf_coeff", + "GPU Performance Coefficient", + 0.0, true, + 1.0, + "How many times faster a GPU is than a CPU at factoring a subtree."); + + roptions->AddStringOption2( + "spral_ignore_numa", "Non-uniform memory access (NUMA) region setting.", + "yes", "no", "Do not treat CPUs and GPUs as belonging to a single NUMA region.", + "yes", "Treat CPUs and GPUs as belonging to a single NUMA region."); + + roptions->AddLowerBoundedNumberOption( + "spral_max_load_inbalance", + "Maximum Permissible Load", + 1.0, true, + 1.2, + "Maximum permissible load inbalance for leaf subtree allocations."); + + roptions->AddLowerBoundedNumberOption( + "spral_min_gpu_work", + "Minimum GPU Work", + 0.0, false, + 5.0e9, + "Minimum number of FLOPS in subtree before scheduling on GPU."); + + roptions->AddLowerBoundedIntegerOption( + "spral_nemin", + "Node Amalgamation Parameter", + 1, + 32, + "Two nodes in the elimination tree are merged if the result has fewer than spral_nemin variables."); + + roptions->AddStringOption2( + "spral_order", + "Controls type of ordering used by SPRAL", + "matching", + "metis", "Use METIS with default settings.", + "matching", "Use matching-based elimination ordering."); + + roptions->AddStringOption3( + "spral_pivot_method", + "Specifies strategy for scaling in SPRAL linear solver.", + "block", + "aggressive", "Aggressive a posteori pivoting.", + "block", "Block a posteori pivoting.", + "threshold", "Threshold partial pivoting (not parallel)."); + + roptions->AddIntegerOption( + "spral_print_level", + "Print level for the linear solver SPRAL", + -1, + "<0: no printing, 0: errors and warning messages, 1: limited diagnostics, >1: additional diagnostics"); + + roptions->AddStringOption6( + "spral_scaling", + "Specifies strategy for scaling in SPRAL linear solver.", + "matching", + "none", "Do not scale the linear system matrix.", + "mc64", "Scale using weighted bipartite matching (MC64).", + "auction", "Scale using the auction algorithm.", + "matching", "Scale using the matching-based ordering.", + "ruiz", "Scale using the norm-equilibration algorithm of Ruiz (MC77).", + "dynamic", "Dynamically select scaling according to switch options."); + + roptions->AddStringOption5( + "spral_scaling_1", + "First scaling strategy.", + "matching", + "none", "Do not scale the linear system matrix.", + "mc64", "Scale using weighted bipartite matching (MC64).", + "auction", "Scale using the auction algorithm.", + "matching", "Scale using the matching-based ordering.", + "ruiz", "Scale using the norm-equilibration algorithm of Ruiz (MC77).", + "If spral_scaling = dynamic, this scaling is used according to the trigger " + "spral_switch_1. If spral_switch_2 is triggered, it is disabled.", + true); + + roptions->AddStringOption5( + "spral_scaling_2", + "Second scaling strategy.", + "mc64", + "none", "Do not scale the linear system matrix.", + "mc64", "Scale using weighted bipartite matching (MC64).", + "auction", "Scale using the auction algorithm.", + "matching", "Scale using the matching-based ordering.", + "ruiz", "Scale using the norm-equilibration algorithm of Ruiz (MC77).", + "If spral_scaling = dynamic, this scaling is used according to the trigger " + "spral_switch_2. If spral_switch_3 is triggered, it is disabled.", + true); + + roptions->AddStringOption5( + "spral_scaling_3", + "Third scaling strategy.", + "none", + "none", "Do not scale the linear system matrix.", + "mc64", "Scale using weighted bipartite matching (MC64).", + "auction", "Scale using the auction algorithm.", + "matching", "Scale using the matching-based ordering.", + "ruiz", "Scale using the norm-equilibration algorithm of Ruiz (MC77).", + "If spral_scaling = dynamic, this scaling is used according to the trigger spral_switch_3.", + true); + + roptions->AddStringOption9( + "spral_switch_1", + "First switch, determining when spral_scaling_1 is enabled.", + "at_start", + "never", "Scaling is never enabled.", + "at_start", "Scaling is used from the very start.", + "at_start_reuse", "Scaling is used on the first iteration, then reused thereafter.", + "on_demand", "Scaling is used when iterative refinement has failed.", + "on_demand_reuse", "As on_demand, but scaling from previous iteration is reused.", + "high_delay", "Scaling is used after more than 0.05*n delays are present.", + "high_delay_reuse", "Scaling is used only when previous iteration created " + "more that 0.05*n additional delays; otherwise, reuse scaling from the previous iteration.", + "od_hd", "Combination of on_demand and high_delay.", + "od_hd_reuse", "Combination of on_demand_reuse and high_delay_reuse", + "If spral_scaling = dynamic, spral_scaling_1 is enabled according to this " + "condition. If spral_switch_2 occurs, this option is henceforth ignored.", + true); + + roptions->AddStringOption9( + "spral_switch_2", + "Second switch, determining when spral_scaling_2 is enabled.", + "on_demand", + "never", "Scaling is never enabled.", + "at_start", "Scaling is used from the very start.", + "at_start_reuse", "Scaling is used on the first iteration, then reused thereafter.", + "on_demand", "Scaling is used when iterative refinement has failed.", + "on_demand_reuse", "As on_demand, but scaling from previous iteration is reused.", + "high_delay", "Scaling is used after more than 0.05*n delays are present.", + "high_delay_reuse", "Scaling is used only when previous iteration created " + "more that 0.05*n additional delays; otherwise, reuse scaling from the previous iteration.", + "od_hd", "Combination of on_demand and high_delay.", + "od_hd_reuse", "Combination of on_demand_reuse and high_delay_reuse", + "If spral_scaling = dynamic, spral_scaling_2 is enabled according to this " + "condition. If spral_switch_3 occurs, this option is henceforth ignored.", + true); + + roptions->AddStringOption9( + "spral_switch_3", + "Third switch, determining when spral_scaling_3 is enabled.", + "never", + "never", "Scaling is never enabled.", + "at_start", "Scaling is used from the very start.", + "at_start_reuse", "Scaling is used on the first iteration, then reused thereafter.", + "on_demand", "Scaling is used when iterative refinement has failed.", + "on_demand_reuse", "As on_demand, but scaling from previous iteration is reused.", + "high_delay", "Scaling is used after more than 0.05*n delays are present.", + "high_delay_reuse", "Scaling is used only when previous iteration created " + "more that 0.05*n additional delays; otherwise, reuse scaling from the previous iteration.", + "od_hd", "Combination of on_demand and high_delay.", + "od_hd_reuse", "Combination of on_demand_reuse and high_delay_reuse", + "If spral_scaling = dynamic, spral_scaling_3 is enabled according to this condition.", + true); + + roptions->AddLowerBoundedNumberOption( + "spral_small", + "Zero Pivot Threshold", + 0.0, true, + 1.0e-20, + "Any pivot less than spral_small is treated as zero."); + + roptions->AddLowerBoundedNumberOption( + "spral_small_subtree_threshold", + "Small Subtree Threshold", + 0.0, true, + 4.0e6, + "Maximum number of FLOPS in a subtree treated as a single task."); + + roptions->AddBoundedNumberOption( + "spral_u", + "Pivoting Threshold", + 0.0, true, + 0.5, false, + 1.0e-8, + "Relative pivot threshold used in symmetric indefinite case."); + + roptions->AddBoundedNumberOption( + "spral_umax", + "Maximum Pivoting Threshold", + 0.0, true, + 0.5, false, + 1.0e-4, + "See SPRAL documentation."); + + roptions->AddBoolOption( + "spral_use_gpu", + "Specifies whether or not graphics processing units (GPUs) are used by the SPRAL linear solver if present.", + true); +} + +int SpralSolverInterface::PivotMethodNameToNum( + const std::string& name +) +{ + if( name == "aggressive" ) + { + return 0; + } + else if( name == "block" ) + { + return 1; + } + else if( name == "threshold" ) + { + return 2; + } + else + { + assert(0); + return -1; + } +} + +int SpralSolverInterface::ScaleNameToNum( + const std::string& name +) +{ + if( name == "none" ) + { + return 0; + } + else if( name == "mc64" ) + { + return 1; + } + else if( name == "auction" ) + { + return 2; + } + else if( name == "matching" ) + { + return 3; + } + else if( name == "ruiz" ) + { + return 4; + } + else + { + assert(0); + return -1; + } +} + +bool SpralSolverInterface::InitializeImpl( + const OptionsList& options, + const std::string& prefix +) +{ + spral_ssids_default_options(&control_); + control_.array_base = 1; // Use Fortran numbering + control_.action = true; // Continue factorization on discovery of a zero pivot. + /* Note: we can't set control_.action = false as we need to know the + * inertia. (Otherwise we just enter the restoration phase and fail.) */ + + options.GetBoolValue("spral_ignore_numa", control_.ignore_numa, prefix); + options.GetBoolValue("spral_use_gpu", control_.use_gpu, prefix); + options.GetIntegerValue("spral_cpu_block_size", control_.cpu_block_size, prefix); + options.GetIntegerValue("spral_nemin", control_.nemin, prefix); + options.GetIntegerValue("spral_print_level", control_.print_level, prefix); + options.GetNumericValue("spral_small", control_.small, prefix); + options.GetNumericValue("spral_u", control_.u, prefix); + options.GetNumericValue("spral_umax", umax_, prefix); + + // Set gpu_perf_coeff. + double gpu_perf_coeff_tmp = 1.0; + options.GetNumericValue("spral_gpu_perf_coeff", gpu_perf_coeff_tmp, prefix); + control_.gpu_perf_coeff = (float)gpu_perf_coeff_tmp; + + // Set max_load_inbalance. + double max_load_inbalance_tmp = 1.2; + options.GetNumericValue("spral_max_load_inbalance", max_load_inbalance_tmp, prefix); + control_.max_load_inbalance = (float)max_load_inbalance_tmp; + + // Set min_gpu_work. + double min_gpu_work_tmp = 5.0e9; + options.GetNumericValue("spral_min_gpu_work", min_gpu_work_tmp, prefix); + control_.min_gpu_work = (int64_t)min_gpu_work_tmp; + + // Set the pivot method. + std::string pivot_method; + options.GetStringValue("spral_pivot_method", pivot_method, prefix); // TODO use GetEnumValue? + control_.pivot_method = PivotMethodNameToNum(pivot_method); + + // Set small_subtree_threshold. + double small_subtree_threshold_tmp = 4.0e6; + options.GetNumericValue("spral_small_subtree_threshold", small_subtree_threshold_tmp, prefix); + control_.small_subtree_threshold = (int64_t)small_subtree_threshold_tmp; + + // Reset all private data. + pivtol_changed_ = false; + + std::string order_method; + options.GetStringValue("spral_order", order_method, prefix); + + if( order_method == "metis" ) + { + control_.ordering = 1; + } + else if( order_method == "matching" ) + { + control_.ordering = 2; + } + + std::string scaling_method; + options.GetStringValue("spral_scaling", scaling_method, prefix); + current_level_ = 0; + + if( scaling_method == "dynamic" ) + { + scaling_type_ = 0; + std::string switch_val[3], scaling_val[3]; + + options.GetStringValue("spral_switch_1", switch_val[0], prefix); + options.GetStringValue("spral_scaling_1", scaling_val[0], prefix); + options.GetStringValue("spral_switch_2", switch_val[1], prefix); + options.GetStringValue("spral_scaling_2", scaling_val[1], prefix); + options.GetStringValue("spral_switch_3", switch_val[2], prefix); + options.GetStringValue("spral_scaling_3", scaling_val[2], prefix); + + for( int i = 0; i < 3; i++ ) + { + scaling_val_[i] = ScaleNameToNum(scaling_val[i]); + + if( switch_val[i] == "never" ) + { + switch_[i] = SWITCH_NEVER; + } + else if( switch_val[i] == "at_start" ) + { + switch_[i] = SWITCH_AT_START; + scaling_type_ = scaling_val_[i]; + current_level_ = i; + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "SPRAL: Enabled " + "scaling level %d on initialization\n", current_level_); + } + else if( switch_val[i] == "at_start_reuse" ) + { + switch_[i] = SWITCH_AT_START_REUSE; + scaling_type_ = scaling_val_[i]; + current_level_ = i; + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "SPRAL: Enabled " + "scaling level %d on initialization\n", current_level_); + } + else if( switch_val[i] == "on_demand" ) + { + switch_[i] = SWITCH_ON_DEMAND; + } + else if( switch_val[i] == "on_demand_reuse" ) + { + switch_[i] = SWITCH_ON_DEMAND_REUSE; + } + else if( switch_val[i] == "high_delay" ) + { + switch_[i] = SWITCH_NDELAY; + } + else if( switch_val[i] == "high_delay_reuse" ) + { + switch_[i] = SWITCH_NDELAY_REUSE; + } + else if( switch_val[i] == "od_hd" ) + { + switch_[i] = SWITCH_OD_ND; + } + else if( switch_val[i] == "od_hd_reuse" ) + { + switch_[i] = SWITCH_OD_ND_REUSE; + } + } + } + else + { + switch_[0] = SWITCH_AT_START; + switch_[1] = SWITCH_NEVER; + switch_[2] = SWITCH_NEVER; + scaling_type_ = ScaleNameToNum(scaling_method); + } + + // Set whether we scale on first iteration or not + switch ( switch_[current_level_] ) + { + case SWITCH_NEVER: + case SWITCH_ON_DEMAND: + case SWITCH_ON_DEMAND_REUSE: + case SWITCH_NDELAY: + case SWITCH_NDELAY_REUSE: + case SWITCH_OD_ND: + case SWITCH_OD_ND_REUSE: + rescale_ = false; + break; + case SWITCH_AT_START: + case SWITCH_AT_START_REUSE: + rescale_ = true; + break; + } + + // Set scaling and ordering. + control_.scaling = scaling_type_; + control_.ordering = scaling_type_ != 3 ? 1 : 2; + + return true; // All is well. +} + +ESymSolverStatus SpralSolverInterface::InitializeStructure( + Index dim, + Index nonzeros, + const Index* ia, + const Index* ja +) +{ + struct spral_ssids_inform info; + + // Store size for later use + ndim_ = dim; + + // Setup memory for values + delete[] val_; + val_ = new double[nonzeros]; + + // Correct scaling and ordering if necessary. + if( control_.ordering == 2 && control_.scaling != 3 ) + { + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "In SpralSolverInterface, " + "matching-based ordering was used, but matching-based scaling was " + "not. Setting scaling using the matching-based ordering.\n"); + control_.scaling = scaling_type_ = 3; + } + + if( control_.ordering != 2 && control_.scaling == 3 ) + { + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "In SpralSolverInterface, " + "matching-based scaling was used, but matching-based ordering was " + "not. Setting ordering using the matching-based algorithm.\n"); + control_.ordering = 2; + } + + // Perform analyse. + if( !( control_.ordering == 2 && control_.scaling == 3 ) ) + { + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemSymbolicFactorization().Start(); + } + + spral_ssids_analyse_ptr32(false, ndim_, NULL, ia, ja, NULL, &akeep_, &control_, &info); + + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "nfactor = %" PRId64 ", nflops = %" PRId64 ":\n", + info.num_factor, info.num_flops); + + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemSymbolicFactorization().End(); + } + + if( info.flag < 0 ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "In SpralSolverInterface::InitializeStructure: " + "Unhandled error. info.flag = %d.\n", info.flag); + return SYMSOLVER_FATAL_ERROR; + } + } + + return SYMSOLVER_SUCCESS; +} + +ESymSolverStatus SpralSolverInterface::MultiSolve( + bool new_matrix, + const Index* ia, + const Index* ja, + Index nrhs, + double* rhs_vals, + bool check_NegEVals, + Index numberOfNegEVals +) +{ + struct spral_ssids_inform info; + + if( new_matrix || pivtol_changed_ ) + { + // Set scaling option + if( rescale_ ) + { + control_.scaling = scaling_type_; + control_.ordering = scaling_type_ != 3 ? 1 : 2; + + if( scaling_type_ != 0 && scaling_ == NULL ) + { + scaling_ = new double[ndim_]; + } + } + else + { + control_.scaling = 0; // None or user (depends if scaling_ is allocated). + } + + if( control_.ordering == 2 && control_.scaling == 3 && rescale_ ) + { + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemSymbolicFactorization().Start(); + } + + spral_ssids_analyse_ptr32(false, ndim_, NULL, ia, ja, val_, &akeep_, &control_, &info); + + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "nfactor = %" PRId64 ", nflops = %" PRId64 ":\n", + info.num_factor, info.num_flops); + + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemSymbolicFactorization().End(); + } + + if ( info.flag == 6 || info.flag == -5 ) + { + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "In SpralSolverInterface::Factorization: " + "Singular system, estimated rank %d of %d\n", info.matrix_rank, ndim_); + return SYMSOLVER_SINGULAR; + } + + if ( info.flag < 0 ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "In SpralSolverInterface::Factorization: " + "Unhandled error. info.flag = %d.\n", info.flag); + return SYMSOLVER_FATAL_ERROR; + } + } + + Number t1 = 0; + if( HaveIpData() ) + { + t1 = IpData().TimingStats().LinearSystemFactorization().TotalWallclockTime(); + IpData().TimingStats().LinearSystemFactorization().Start(); + } + + spral_ssids_factor_ptr32(false, ia, ja, val_, scaling_, akeep_, &fkeep_, &control_, &info); + + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "SPRAL: delays %d, nfactor %" PRId64 ", " + "nflops %" PRId64 ", maxfront %d\n", info.num_delay, info.num_factor, info.num_flops, + info.maxfront); + + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemFactorization().End(); + Number t2 = IpData().TimingStats().LinearSystemFactorization().TotalWallclockTime(); + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "SpralSolverInterface::Factorization: " + "spral_factor_solve took %10.3f\n", t2 - t1); + } + + if( info.flag == 7 || info.flag == 6 || info.flag == -5 ) + { + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "In SpralSolverInterface::Factorization: " + "Singular system, estimated rank %d of %d\n", info.matrix_rank, ndim_); + return SYMSOLVER_SINGULAR; + } + + if( info.flag < 0 ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "In SpralSolverInterface::Factorization: " + "Unhandled error. info.flag = %d.\n", info.flag); + if( info.flag == -53 ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "Maybe one forgot to set environment variable OMP_CANCELLATION to TRUE.\n"); + } + if( control_.print_level < 0 ) + { + Jnlst().Printf(J_STRONGWARNING, J_LINEAR_ALGEBRA, "Set spral_print_level=0 to see more details.\n"); + } + return SYMSOLVER_FATAL_ERROR; + } + + for( int i = current_level_; i < 3; i++ ) + { + switch( switch_[i] ) + { + case SWITCH_NEVER: + case SWITCH_AT_START: + case SWITCH_ON_DEMAND: + // Nothing to do here. + break; + case SWITCH_AT_START_REUSE: + // Scaled exactly once, never changed again. + rescale_ = false; + break; + case SWITCH_ON_DEMAND_REUSE: + if( i == current_level_ && rescale_ ) + { + rescale_ = false; + } + + break; + case SWITCH_NDELAY_REUSE: + case SWITCH_OD_ND_REUSE: + if( rescale_ ) + { + // Need to do this before we reset rescale. + numdelay_ = info.num_delay; + } + + if( i == current_level_ && rescale_ ) + { + rescale_ = false; + } + // fall through + case SWITCH_NDELAY: + case SWITCH_OD_ND: + if( rescale_ ) + { + numdelay_ = info.num_delay; + } + + if( info.num_delay - numdelay_ > 0.05 * ndim_ ) + { + // Number of delays has signficantly increased, so trigger. + current_level_ = i; + scaling_type_ = scaling_val_[i]; + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "SPRAL: " + "Enabling scaling %d due to excess delays\n", i); + rescale_ = true; + } + + break; + } + } + + if( check_NegEVals && info.num_neg != numberOfNegEVals ) + { + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "In SpralSolverInterface::Factorization: " + "info.num_neg = %d, but numberOfNegEVals = %" IPOPT_INDEX_FORMAT "\n", info.num_neg, numberOfNegEVals); + return SYMSOLVER_WRONG_INERTIA; + } + + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemBackSolve().Start(); + } + + spral_ssids_solve(0, nrhs, rhs_vals, ndim_, akeep_, fkeep_, &control_, &info); + + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemBackSolve().End(); + } + + numneg_ = info.num_neg; + + pivtol_changed_ = false; + } + else + { + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemBackSolve().Start(); + } + + spral_ssids_solve(0, nrhs, rhs_vals, ndim_, akeep_, fkeep_, &control_, &info); + + if( HaveIpData() ) + { + IpData().TimingStats().LinearSystemBackSolve().End(); + } + } + + return SYMSOLVER_SUCCESS; +} + +bool SpralSolverInterface::IncreaseQuality() +{ + for( int i = current_level_; i < 3; i++ ) + { + switch( switch_[i] ) + { + case SWITCH_ON_DEMAND: + case SWITCH_ON_DEMAND_REUSE: + case SWITCH_OD_ND: + case SWITCH_OD_ND_REUSE: + rescale_ = true; + current_level_ = i; + scaling_type_ = scaling_val_[i]; + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "SPRAL: Enabling scaling " + "%d due to failure of iterative refinement\n", current_level_); + break; + default: + ; + } + } + + if( control_.u >= umax_ ) + { + return false; + } + + pivtol_changed_ = true; + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Increasing pivot tolerance " + "for SPRAL from %7.2e ", control_.u); + control_.u = Min(umax_, std::pow(control_.u, 0.75)); + Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "to %7.2e.\n", control_.u); + return true; +} + +} // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpSpralSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpSpralSolverInterface.hpp new file mode 100644 index 000000000..320e64b0c --- /dev/null +++ b/src/Algorithm/LinearSolvers/IpSpralSolverInterface.hpp @@ -0,0 +1,170 @@ +// Copyright (C) 2012, The Science and Technology Facilities Council (STFC) +// Copyright (C) 2009, Jonathan Hogg +// Copyright (C) 2004, 2007 International Business Machines and others. +// All Rights Reserved. +// This code is published under the Eclipse Public License. +// +// Authors: Byron Tasseff LANL 2020-03-21 +// Jonathan Hogg STFC 2012-12-21 +// Jonathan Hogg 2009-07-29 +// Carl Laird, Andreas Waechter IBM 2004-03-17 + +#ifndef __IPSPRALSOLVERINTERFACE_HPP__ +#define __IPSPRALSOLVERINTERFACE_HPP__ + +#include "IpSparseSymLinearSolverInterface.hpp" + +extern "C" +{ +#include "spral_ssids.h" +} + +namespace Ipopt +{ + +/** Interface to the linear solver SPRAL. + * @since 3.14.0 + */ +class SpralSolverInterface: public SparseSymLinearSolverInterface +{ +private: + enum scaling_opts + { + SWITCH_NEVER, + SWITCH_AT_START, + SWITCH_AT_START_REUSE, + SWITCH_ON_DEMAND, + SWITCH_ON_DEMAND_REUSE, + SWITCH_NDELAY, + SWITCH_NDELAY_REUSE, + SWITCH_OD_ND, + SWITCH_OD_ND_REUSE + }; + + int ndim_; ///< Number of dimensions + double* val_; ///< Storage for variables + int numneg_; ///< Number of negative pivots in last factorization + int numdelay_; ///< Number of delayed pivots last time we scaled + void* akeep_; ///< Stores pointer to factors + void* fkeep_; ///< Stores pointer to factors + bool pivtol_changed_; ///< indicates if pivtol has been changed + bool rescale_; ///< Indicates if we should rescale next factorization + double* scaling_; ///< Store scaling for reuse if doing dynamic scaling + int fctidx_; ///< Current factorization number to dump to + + /* Options */ + struct spral_ssids_options control_; + double umax_; + int ordering_; + int scaling_type_; + enum scaling_opts switch_[3]; + int scaling_val_[3]; + int current_level_; + bool dump_; + +public: + + SpralSolverInterface() + : val_(NULL), + numdelay_(0), + akeep_(NULL), + fkeep_(NULL), + pivtol_changed_(false), + rescale_(false), + scaling_(NULL), + fctidx_(0), + scaling_type_(0), + dump_(false) + { } + + ~SpralSolverInterface(); + + static void RegisterOptions( + SmartPtr roptions + ); + + /// give name of MUMPS with version info + static std::string GetName(); + + bool InitializeImpl( + const OptionsList& options, + const std::string& prefix + ); + + /** @name Methods for requesting solution of the linear system. */ + ///@{ + ESymSolverStatus InitializeStructure( + Index dim, + Index nonzeros, + const Index* ia, + const Index* ja + ); + + double* GetValuesArrayPtr() + { + return val_; + } + + ESymSolverStatus MultiSolve( + bool new_matrix, + const Index* ia, + const Index* ja, + Index nrhs, + double* rhs_vals, + bool check_NegEVals, + Index numberOfNegEVals + ); + + Index NumberOfNegEVals() const + { + return numneg_; + } + ///@} + + /** @name Options of Linear solver */ + ///@{ + bool IncreaseQuality(); + + bool ProvidesInertia() const + { + return true; + } + + EMatrixFormat MatrixFormat() const + { + return CSR_Format_1_Offset; + } + ///@} + + /** @name Methods related to the detection of linearly dependent + * rows in a matrix */ + ///@{ + bool ProvidesDegeneracyDetection() const + { + return false; + } + + ESymSolverStatus DetermineDependentRows( + const Index* /*ia*/, + const Index* /*ja*/, + std::list& /*c_deps*/ + ) + { + return SYMSOLVER_FATAL_ERROR; + } + ///@} + + /** converts a scaling option name to its spral option number */ + static int ScaleNameToNum( + const std::string& name + ); + + /** converts a pivot method option name to its spral option number */ + static int PivotMethodNameToNum( + const std::string& name + ); +}; + +} // namespace Ipopt + +#endif diff --git a/src/Algorithm/LinearSolvers/IpSymLinearSolver.hpp b/src/Algorithm/LinearSolvers/IpSymLinearSolver.hpp index b82728e89..b72329c42 100644 --- a/src/Algorithm/LinearSolvers/IpSymLinearSolver.hpp +++ b/src/Algorithm/LinearSolvers/IpSymLinearSolver.hpp @@ -51,13 +51,13 @@ class IPOPTLIB_EXPORT SymLinearSolver: public AlgorithmStrategyObject { public: /** @name Constructor/Destructor */ - //@{ + ///@{ SymLinearSolver() { } virtual ~SymLinearSolver() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -65,7 +65,7 @@ class IPOPTLIB_EXPORT SymLinearSolver: public AlgorithmStrategyObject ) = 0; /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ /** Solve operation for multiple right hand sides. * * Solves the linear system A * Sol = Rhs with multiple right hand sides. @@ -115,10 +115,10 @@ class IPOPTLIB_EXPORT SymLinearSolver: public AlgorithmStrategyObject * (see ProvidesInertia). */ virtual Index NumberOfNegEVals() const = 0; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ /** Request to increase quality of solution for next solve. * * Ask linear solver to increase quality of solution for the next @@ -133,7 +133,7 @@ class IPOPTLIB_EXPORT SymLinearSolver: public AlgorithmStrategyObject * @return true, if linear solver provides inertia */ virtual bool ProvidesInertia() const = 0; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpTDependencyDetector.hpp b/src/Algorithm/LinearSolvers/IpTDependencyDetector.hpp index 6c04d59fc..8e79ee042 100644 --- a/src/Algorithm/LinearSolvers/IpTDependencyDetector.hpp +++ b/src/Algorithm/LinearSolvers/IpTDependencyDetector.hpp @@ -20,13 +20,13 @@ class TDependencyDetector: public AlgorithmStrategyObject { public: /** @name Constructor/Destructor */ - //@{ + ///@{ TDependencyDetector() { } virtual ~TDependencyDetector() { } - //@} + ///@} /** Has to be called to initialize and reset these objects. */ virtual bool InitializeImpl( @@ -63,7 +63,7 @@ class TDependencyDetector: public AlgorithmStrategyObject * them for us, so we declare them private * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ TDependencyDetector( const TDependencyDetector& @@ -73,7 +73,7 @@ class TDependencyDetector: public AlgorithmStrategyObject void operator=( const TDependencyDetector& ); - //@} + ///@} }; diff --git a/src/Algorithm/LinearSolvers/IpTSymDependencyDetector.hpp b/src/Algorithm/LinearSolvers/IpTSymDependencyDetector.hpp index 15e214870..afcd9e056 100644 --- a/src/Algorithm/LinearSolvers/IpTSymDependencyDetector.hpp +++ b/src/Algorithm/LinearSolvers/IpTSymDependencyDetector.hpp @@ -20,13 +20,13 @@ class TSymDependencyDetector: public TDependencyDetector { public: /** @name Constructor/Destructor */ - //@{ + ///@{ TSymDependencyDetector( TSymLinearSolver& tsym_linear_solver); virtual ~TSymDependencyDetector() { } - //@} + ///@} /** Has to be called to initialize and reset these objects. */ virtual bool InitializeImpl( @@ -68,7 +68,7 @@ class TSymDependencyDetector: public TDependencyDetector * 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 */ TSymDependencyDetector(); @@ -81,7 +81,7 @@ class TSymDependencyDetector: public TDependencyDetector void operator=( const TSymDependencyDetector& ); - //@} + ///@} SmartPtr jnlst_; diff --git a/src/Algorithm/LinearSolvers/IpTSymLinearSolver.cpp b/src/Algorithm/LinearSolvers/IpTSymLinearSolver.cpp index b9e35c3af..c284befc8 100644 --- a/src/Algorithm/LinearSolvers/IpTSymLinearSolver.cpp +++ b/src/Algorithm/LinearSolvers/IpTSymLinearSolver.cpp @@ -47,12 +47,10 @@ TSymLinearSolver::~TSymLinearSolver() void TSymLinearSolver::RegisterOptions( SmartPtr roptions) { - roptions->AddStringOption2( + roptions->AddBoolOption( "linear_scaling_on_demand", "Flag indicating that linear scaling is only done if it seems required.", - "yes", - "no", "Always scale the linear system.", - "yes", "Start using linear system scaling if solutions seem not good.", + true, "This option is only important if a linear scaling method (e.g., mc19) is used. " "If you choose \"no\", then the scaling factors are computed for every linear system from the start. " "This can be quite expensive. " @@ -200,18 +198,18 @@ ESymSolverStatus TSymLinearSolver::MultiSolve( // Retrieve the right hand sides and scale if required Index nrhs = (Index) rhsV.size(); - double* rhs_vals = new double[dim_ * nrhs]; + Number* rhs_vals = new Number[dim_ * nrhs]; for( Index irhs = 0; irhs < nrhs; irhs++ ) { TripletHelper::FillValuesFromVector(dim_, *rhsV[irhs], &rhs_vals[irhs * (dim_)]); if( Jnlst().ProduceOutput(J_MOREMATRIX, J_LINEAR_ALGEBRA) ) { Jnlst().Printf(J_MOREMATRIX, J_LINEAR_ALGEBRA, - "Right hand side %d in TSymLinearSolver:\n", irhs); + "Right hand side %" IPOPT_INDEX_FORMAT " in TSymLinearSolver:\n", irhs); for( Index i = 0; i < dim_; i++ ) { Jnlst().Printf(J_MOREMATRIX, J_LINEAR_ALGEBRA, - "Trhs[%5d,%5d] = %23.16e\n", irhs, i, rhs_vals[irhs * (dim_) + i]); + "Trhs[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "] = %23.16e\n", irhs, i, rhs_vals[irhs * (dim_) + i]); } } if( use_scaling_ ) @@ -297,11 +295,11 @@ ESymSolverStatus TSymLinearSolver::MultiSolve( if( Jnlst().ProduceOutput(J_MOREMATRIX, J_LINEAR_ALGEBRA) ) { Jnlst().Printf(J_MOREMATRIX, J_LINEAR_ALGEBRA, - "Solution %d in TSymLinearSolver:\n", irhs); + "Solution %" IPOPT_INDEX_FORMAT " in TSymLinearSolver:\n", irhs); for( Index i = 0; i < dim_; i++ ) { Jnlst().Printf(J_MOREMATRIX, J_LINEAR_ALGEBRA, - "Tsol[%5d,%5d] = %23.16e\n", irhs, i, rhs_vals[irhs * (dim_) + i]); + "Tsol[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "] = %23.16e\n", irhs, i, rhs_vals[irhs * (dim_) + i]); } } TripletHelper::PutValuesInVector(dim_, &rhs_vals[irhs * (dim_)], *solV[irhs]); @@ -384,7 +382,7 @@ ESymSolverStatus TSymLinearSolver::InitializeStructure( { IpData().TimingStats().LinearSystemScaling().Start(); } - scaling_factors_ = new double[dim_]; + scaling_factors_ = new Number[dim_]; if( HaveIpData() ) { IpData().TimingStats().LinearSystemScaling().End(); @@ -460,12 +458,12 @@ void TSymLinearSolver::GiveMatrixToSolver( DBG_START_METH("TSymLinearSolver::GiveMatrixToSolver", dbg_verbosity); DBG_PRINT((1, "new_matrix = %d\n", new_matrix)); - double* pa = solver_interface_->GetValuesArrayPtr(); - double* atriplet; + Number* pa = solver_interface_->GetValuesArrayPtr(); + Number* atriplet; if( matrix_format_ != SparseSymLinearSolverInterface::Triplet_Format ) { - atriplet = new double[nonzeros_triplet_]; + atriplet = new Number[nonzeros_triplet_]; } else { @@ -478,7 +476,7 @@ void TSymLinearSolver::GiveMatrixToSolver( { for( Index i = 0; i < nonzeros_triplet_; i++ ) { - DBG_PRINT((3, "KKTunscaled(%6d,%6d) = %24.16e\n", airn_[i], ajcn_[i], atriplet[i])); + DBG_PRINT((3, "KKTunscaled(%6" IPOPT_INDEX_FORMAT ",%6" IPOPT_INDEX_FORMAT ") = %24.16e\n", airn_[i], ajcn_[i], atriplet[i])); } } @@ -505,7 +503,7 @@ void TSymLinearSolver::GiveMatrixToSolver( for( Index i = 0; i < dim_; i++ ) { Jnlst().Printf(J_MOREVECTOR, J_LINEAR_ALGEBRA, - "scaling factor[%6d] = %22.17e\n", i, scaling_factors_[i]); + "scaling factor[%6" IPOPT_INDEX_FORMAT "] = %22.17e\n", i, scaling_factors_[i]); } } just_switched_on_scaling_ = false; @@ -518,7 +516,7 @@ void TSymLinearSolver::GiveMatrixToSolver( { for( Index i = 0; i < nonzeros_triplet_; i++ ) { - DBG_PRINT((3, "KKTscaled(%6d,%6d) = %24.16e\n", airn_[i], ajcn_[i], atriplet[i])); + DBG_PRINT((3, "KKTscaled(%6" IPOPT_INDEX_FORMAT ",%6" IPOPT_INDEX_FORMAT ") = %24.16e\n", airn_[i], ajcn_[i], atriplet[i])); } } IpData().TimingStats().LinearSystemScaling().End(); @@ -562,12 +560,12 @@ ESymSolverStatus TSymLinearSolver::DetermineDependentRows( airn_ = new Index[nonzeros_triplet_]; ajcn_ = new Index[nonzeros_triplet_]; - for( int i = 0; i < n_jac_nz; i++ ) + for( Index i = 0; i < n_jac_nz; i++ ) { airn_[i] = jac_c_iRow[i] + n_cols; ajcn_[i] = jac_c_jCol[i]; } - for( int i = 0; i < dim_; i++ ) + for( Index i = 0; i < dim_; i++ ) { airn_[n_jac_nz + i] = i + 1; ajcn_[n_jac_nz + i] = i + 1; @@ -619,36 +617,36 @@ ESymSolverStatus TSymLinearSolver::DetermineDependentRows( { IpData().TimingStats().LinearSystemScaling().Start(); } - scaling_factors_ = new double[dim_]; + scaling_factors_ = new Number[dim_]; if( HaveIpData() ) { IpData().TimingStats().LinearSystemScaling().End(); } } - double* pa = solver_interface_->GetValuesArrayPtr(); - double* atriplet; + Number* pa = solver_interface_->GetValuesArrayPtr(); + Number* atriplet; if( matrix_format_ != SparseSymLinearSolverInterface::Triplet_Format ) { - atriplet = new double[nonzeros_triplet_]; + atriplet = new Number[nonzeros_triplet_]; } else { atriplet = pa; } - IpBlasDcopy(n_jac_nz, jac_c_vals, 1, atriplet, 1); + IpBlasCopy(n_jac_nz, jac_c_vals, 1, atriplet, 1); const Number one = 1.; - IpBlasDcopy(n_cols, &one, 0, atriplet + n_jac_nz, 1); + IpBlasCopy(n_cols, &one, 0, atriplet + n_jac_nz, 1); const Number zero = 0.; - IpBlasDcopy(n_rows, &zero, 0, atriplet + n_jac_nz + n_cols, 1); + IpBlasCopy(n_rows, &zero, 0, atriplet + n_jac_nz + n_cols, 1); if( DBG_VERBOSITY() >= 3 ) { for( Index i = 0; i < nonzeros_triplet_; i++ ) { - DBG_PRINT((3, "KKTunscaled(%6d,%6d) = %24.16e\n", airn_[i], ajcn_[i], atriplet[i])); + DBG_PRINT((3, "KKTunscaled(%6" IPOPT_INDEX_FORMAT ",%6" IPOPT_INDEX_FORMAT ") = %24.16e\n", airn_[i], ajcn_[i], atriplet[i])); } } @@ -672,7 +670,7 @@ ESymSolverStatus TSymLinearSolver::DetermineDependentRows( for( Index i = 0; i < dim_; i++ ) { Jnlst().Printf(J_MOREVECTOR, J_LINEAR_ALGEBRA, - "scaling factor[%6d] = %22.17e\n", i, scaling_factors_[i]); + "scaling factor[%6" IPOPT_INDEX_FORMAT "] = %22.17e\n", i, scaling_factors_[i]); } } for( Index i = 0; i < nonzeros_triplet_; i++ ) @@ -683,7 +681,7 @@ ESymSolverStatus TSymLinearSolver::DetermineDependentRows( { for( Index i = 0; i < nonzeros_triplet_; i++ ) { - DBG_PRINT((3, "KKTscaled(%6d,%6d) = %24.16e\n", airn_[i], ajcn_[i], atriplet[i])); + DBG_PRINT((3, "KKTscaled(%6" IPOPT_INDEX_FORMAT ",%6" IPOPT_INDEX_FORMAT ") = %24.16e\n", airn_[i], ajcn_[i], atriplet[i])); } } IpData().TimingStats().LinearSystemScaling().End(); @@ -708,7 +706,7 @@ ESymSolverStatus TSymLinearSolver::DetermineDependentRows( // We need to correct the indices if( retval == SYMSOLVER_SUCCESS ) { - for( std::list::iterator i = c_deps.begin(); i != c_deps.end(); i++ ) + for( std::list::iterator i = c_deps.begin(); i != c_deps.end(); ++i ) { *i -= n_cols; } diff --git a/src/Algorithm/LinearSolvers/IpTSymLinearSolver.hpp b/src/Algorithm/LinearSolvers/IpTSymLinearSolver.hpp index 5286a37bb..c13fe7299 100644 --- a/src/Algorithm/LinearSolvers/IpTSymLinearSolver.hpp +++ b/src/Algorithm/LinearSolvers/IpTSymLinearSolver.hpp @@ -34,7 +34,7 @@ class TSymLinearSolver: public SymLinearSolver { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor. * * The solver_interface is a pointer to a linear @@ -49,14 +49,14 @@ class TSymLinearSolver: public SymLinearSolver /** Destructor */ virtual ~TSymLinearSolver(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, const std::string& prefix); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ virtual ESymSolverStatus MultiSolve( const SymMatrix& A, std::vector >& rhsV, @@ -66,19 +66,19 @@ class TSymLinearSolver: public SymLinearSolver ); virtual Index NumberOfNegEVals() const; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ virtual bool IncreaseQuality(); virtual bool ProvidesInertia() const; - //@} + ///@} /** @name Methods related to the detection of linearly dependent * rows in a matrix */ - //@{ + ///@{ bool ProvidesDegeneracyDetection() const; ESymSolverStatus DetermineDependentRows( @@ -90,14 +90,14 @@ class TSymLinearSolver: public SymLinearSolver Index* jac_c_jCol, std::list& c_deps ); - //@} + ///@} /** Methods for OptionsList */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -107,7 +107,7 @@ class TSymLinearSolver: public SymLinearSolver * 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 */ TSymLinearSolver(); @@ -120,10 +120,10 @@ class TSymLinearSolver: public SymLinearSolver void operator=( const TSymLinearSolver& ); - //@} + ///@} /** @name Information about the matrix */ - //@{ + ///@{ /** Tag for the incoming matrix */ TaggedObject::Tag atag_; @@ -142,10 +142,10 @@ class TSymLinearSolver: public SymLinearSolver * with the CSR format. */ Index nonzeros_compressed_; - //@} + ///@} /** @name Initialization flags */ - //@{ + ///@{ /** Flag indicating if the internal structures are initialized. * * For initialization, this object needs to have seen a matrix. @@ -159,12 +159,12 @@ class TSymLinearSolver: public SymLinearSolver * called for the linear solver. */ bool initialized_; - //@} + ///@} /** Strategy Object for an interface to a linear solver. */ SmartPtr solver_interface_; /** @name Stuff for scaling of the linear system. */ - //@{ + ///@{ /** Strategy Object for a method that computes scaling factors for * the matrices. * @@ -172,15 +172,15 @@ class TSymLinearSolver: public SymLinearSolver */ SmartPtr scaling_method_; /** Array storing the scaling factors */ - double* scaling_factors_; + Number* scaling_factors_; /** Flag indicating whether scaling should be performed */ bool use_scaling_; /** Flag indicating whether we just switched on the scaling */ bool just_switched_on_scaling_; - //@} + ///@} /** @name information about the matrix. */ - //@{ + ///@{ /** row indices of matrix in triplet (MA27) format. */ Index* airn_; /** column indices of matrix in triplet (MA27) format. */ @@ -193,18 +193,18 @@ class TSymLinearSolver: public SymLinearSolver SmartPtr triplet_to_csr_converter_; /** Flag indicating what matrix data format the solver requires. */ SparseSymLinearSolverInterface::EMatrixFormat matrix_format_; - //@} + ///@} /** @name Algorithmic parameters */ - //@{ + ///@{ /** Flag indicating whether the TNLP with identical structure has * already been solved before. */ bool warm_start_same_structure_; - //@} + ///@} /** @name Internal functions */ - //@{ + ///@{ /** Initialize nonzero structure. * * Set dim_ and nonzeros_, and copy the nonzero structure of symT_A @@ -221,7 +221,7 @@ class TSymLinearSolver: public SymLinearSolver bool new_matrix, const SymMatrix& sym_A ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpTSymScalingMethod.hpp b/src/Algorithm/LinearSolvers/IpTSymScalingMethod.hpp index 59ebeea47..855989d1f 100644 --- a/src/Algorithm/LinearSolvers/IpTSymScalingMethod.hpp +++ b/src/Algorithm/LinearSolvers/IpTSymScalingMethod.hpp @@ -22,13 +22,13 @@ class TSymScalingMethod: public AlgorithmStrategyObject { public: /** @name Constructor/Destructor */ - //@{ + ///@{ TSymScalingMethod() { } ~TSymScalingMethod() { } - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -43,8 +43,8 @@ class TSymScalingMethod: public AlgorithmStrategyObject Index nnz, const Index* airn, const Index* ajcn, - const double* a, - double* scaling_factors + const Number* a, + Number* scaling_factors ) = 0; private: @@ -53,7 +53,7 @@ class TSymScalingMethod: public AlgorithmStrategyObject * 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. */ - //@{ + ///@{ /** Copy Constructor */ TSymScalingMethod( const TSymScalingMethod& diff --git a/src/Algorithm/LinearSolvers/IpTripletToCSRConverter.cpp b/src/Algorithm/LinearSolvers/IpTripletToCSRConverter.cpp index e8d6a2d29..4ab2bc527 100644 --- a/src/Algorithm/LinearSolvers/IpTripletToCSRConverter.cpp +++ b/src/Algorithm/LinearSolvers/IpTripletToCSRConverter.cpp @@ -53,8 +53,7 @@ Index TripletToCSRConverter::InitializeConverter( DBG_START_METH("TSymLinearSolver::InitializeStructure", dbg_verbosity); - DBG_ASSERT(dim > 0); - DBG_ASSERT(nonzeros > 0); + DBG_ASSERT(hf_ == Triangular_Format || hf_ == Full_Format); delete[] ia_; delete[] ja_; @@ -65,13 +64,28 @@ Index TripletToCSRConverter::InitializeConverter( dim_ = dim; nonzeros_triplet_ = nonzeros; + if( nonzeros == 0 ) + { + ia_ = NULL; + ja_ = NULL; + ipos_first_ = NULL; + ipos_double_triplet_ = NULL; + ipos_double_compressed_ = NULL; + nonzeros_compressed_ = 0; + num_doubles_ = 0; + initialized_ = true; + return 0; + } + + DBG_ASSERT(dim > 0); + // Create a list with all triplet entries std::vector entry_list(nonzeros); std::vector::iterator list_iterator = entry_list.begin(); for( Index i = 0; i < nonzeros; i++ ) { list_iterator->Set(airn[i], ajcn[i], i); - list_iterator++; + ++list_iterator; } DBG_ASSERT(list_iterator == entry_list.end()); @@ -79,7 +93,7 @@ Index TripletToCSRConverter::InitializeConverter( { for( Index i = 0; i < nonzeros; i++ ) { - DBG_PRINT((2, "airn[%5d] = %5d acjn[%5d] = %5d\n", i, airn[i], i, ajcn[i])); + DBG_PRINT((2, "airn[%5" IPOPT_INDEX_FORMAT "] = %5" IPOPT_INDEX_FORMAT " acjn[%5" IPOPT_INDEX_FORMAT "] = %5" IPOPT_INDEX_FORMAT "\n", i, airn[i], i, ajcn[i])); } } @@ -134,7 +148,7 @@ Index TripletToCSRConverter::InitializeConverter( } } - list_iterator++; + ++list_iterator; Index idouble = 0; Index idouble_full = 0; while( list_iterator != entry_list.end() ) @@ -179,7 +193,7 @@ Index TripletToCSRConverter::InitializeConverter( } } - list_iterator++; + ++list_iterator; } nonzeros_compressed_++; for( Index i = cur_row; i <= dim_; i++ ) @@ -305,15 +319,15 @@ Index TripletToCSRConverter::InitializeConverter( { for( Index i = 0; i <= dim_; i++ ) { - DBG_PRINT((2, "ia[%5d] = %5d\n", i, ia_[i])); + DBG_PRINT((2, "ia[%5" IPOPT_INDEX_FORMAT "] = %5" IPOPT_INDEX_FORMAT "\n", i, ia_[i])); } for( Index i = 0; i < nonzeros_compressed_; i++ ) { - DBG_PRINT((2, "ja[%5d] = %5d ipos_first[%5d] = %5d\n", i, ja_[i], i, ipos_first_[i])); + DBG_PRINT((2, "ja[%5" IPOPT_INDEX_FORMAT "] = %5" IPOPT_INDEX_FORMAT " ipos_first[%5" IPOPT_INDEX_FORMAT "] = %5" IPOPT_INDEX_FORMAT "\n", i, ja_[i], i, ipos_first_[i])); } for( Index i = 0; i < nonzeros_triplet_ - nonzeros_compressed_; i++ ) { - DBG_PRINT((2, "ipos_double_triplet[%5d] = %5d ipos_double_compressed[%5d] = %5d\n", i, ipos_double_triplet_[i], i, ipos_double_compressed_[i])); + DBG_PRINT((2, "ipos_double_triplet[%5" IPOPT_INDEX_FORMAT "] = %5" IPOPT_INDEX_FORMAT " ipos_double_compressed[%5" IPOPT_INDEX_FORMAT "] = %5" IPOPT_INDEX_FORMAT "\n", i, ipos_double_triplet_[i], i, ipos_double_compressed_[i])); } } @@ -348,11 +362,11 @@ void TripletToCSRConverter::ConvertValues( { for( Index i = 0; i < nonzeros_triplet; i++ ) { - DBG_PRINT((2, "atriplet[%5d] = %24.16e\n", i, a_triplet[i])); + DBG_PRINT((2, "atriplet[%5" IPOPT_INDEX_FORMAT "] = %24.16e\n", i, a_triplet[i])); } for( Index i = 0; i < nonzeros_compressed; i++ ) { - DBG_PRINT((2, "acompre[%5d] = %24.16e\n", i, a_compressed[i])); + DBG_PRINT((2, "acompre[%5" IPOPT_INDEX_FORMAT "] = %24.16e\n", i, a_compressed[i])); } } } diff --git a/src/Algorithm/LinearSolvers/IpTripletToCSRConverter.hpp b/src/Algorithm/LinearSolvers/IpTripletToCSRConverter.hpp index 879f14a88..995da184f 100644 --- a/src/Algorithm/LinearSolvers/IpTripletToCSRConverter.hpp +++ b/src/Algorithm/LinearSolvers/IpTripletToCSRConverter.hpp @@ -47,7 +47,7 @@ class TripletToCSRConverter: public ReferencedObject } /** @name Accessor methods. */ - //@{ + ///@{ /** Row position. */ Index IRow() const { @@ -65,7 +65,7 @@ class TripletToCSRConverter: public ReferencedObject { return i_pos_triplet_; } - //@} + ///@} /** Comparison operator. * @@ -80,11 +80,11 @@ class TripletToCSRConverter: public ReferencedObject private: /** @name Entry content. */ - //@{ + ///@{ Index i_row_; Index j_col_; Index i_pos_triplet_; - //@} + ///@} }; public: @@ -98,7 +98,7 @@ class TripletToCSRConverter: public ReferencedObject }; /** @name Constructor/Destructor */ - //@{ + ///@{ /* Constructor. * * If offset is 0, then the counting of indices in the compressed @@ -112,7 +112,7 @@ class TripletToCSRConverter: public ReferencedObject /** Destructor */ virtual ~TripletToCSRConverter(); - //@} + ///@} /** Initialize the converter, given the fixed structure of the matrix. * @@ -135,7 +135,7 @@ class TripletToCSRConverter: public ReferencedObject ); /** @name Accessor methods */ - //@{ + ///@{ /** Return the IA array for the condensed format. */ const Index* IA() const { @@ -155,7 +155,7 @@ class TripletToCSRConverter: public ReferencedObject DBG_ASSERT(initialized_); return ipos_first_; } - //@} + ///@} /** Convert the values of the nonzero elements. * @@ -179,7 +179,7 @@ class TripletToCSRConverter: public ReferencedObject * 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 */ TripletToCSRConverter(); @@ -192,7 +192,7 @@ class TripletToCSRConverter: public ReferencedObject void operator=( const TripletToCSRConverter& ); - //@} + ///@} /** Offset for CSR numbering. */ Index offset_; @@ -222,7 +222,7 @@ class TripletToCSRConverter: public ReferencedObject bool initialized_; /** @name Arrays for cross-positions for the conversion of values. */ - //@{ + ///@{ /** First elements assignment. * * For i with 0 <= i <= nonzeros_compressed-1, the i-th element in @@ -240,7 +240,7 @@ class TripletToCSRConverter: public ReferencedObject /** Position of multiple elements in compressed matrix. */ Index* ipos_double_compressed_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/IpWsmpSolverInterface.cpp b/src/Algorithm/LinearSolvers/IpWsmpSolverInterface.cpp index 99db23045..dd9d047c0 100644 --- a/src/Algorithm/LinearSolvers/IpWsmpSolverInterface.cpp +++ b/src/Algorithm/LinearSolvers/IpWsmpSolverInterface.cpp @@ -15,44 +15,34 @@ extern "C" { void IPOPT_WSMP_FUNC(wsetmaxthrds, WSETMAXTHRDS)( - const ipfint* NTHREADS + const ipindex* NTHREADS ); void IPOPT_WSMP_FUNC(wssmp, WSSMP)( - const ipfint* N, - const ipfint* IA, - const ipfint* JA, - const double* AVALS, - double* DIAG, - ipfint* PERM, - ipfint* INVP, - double* B, - const ipfint* LDB, - const ipfint* NRHS, - double* AUX, - const ipfint* NAUX, - ipfint* MRP, - ipfint* IPARM, - double* DPARM + const ipindex* N, + const ipindex* IA, + const ipindex* JA, + const double* AVALS, + double* DIAG, + ipindex* PERM, + ipindex* INVP, + double* B, + const ipindex* LDB, + const ipindex* NRHS, + double* AUX, + const ipindex* NAUX, + ipindex* MRP, + ipindex* IPARM, + double* DPARM ); void IPOPT_WSMP_FUNC_(wsmp_clear, WSMP_CLEAR)(void); -#ifdef PARDISO_MATCHING_PREPROCESS - void IPOPT_PARDISO_FUNC(smat_reordering_pardiso_wsmp, SMAT_REORDERING_PARDISO_WSMP)( - const ipfint* N, - const ipfint* ia, - const ipfint* ja, - const double* a_, - ipfint* a2, - ipfint* ja2, - double* a2_, - ipfint* perm2, - double* scale2, - ipfint* tmp2_, - ipfint preprocess + void IPOPT_WSMP_FUNC_(wsmp_version, WSMP_VERSION)( + int* V, + int* R, + int* M ); -#endif } namespace Ipopt @@ -61,24 +51,29 @@ namespace Ipopt static const Index dbg_verbosity = 3; #endif -WsmpSolverInterface::WsmpSolverInterface() - : a_(NULL), +WsmpSolverInterface::WsmpSolverInterface( +#ifdef PARDISO_MATCHING_PREPROCESS + SmartPtr pardisoloader_ +#endif +) : a_(NULL), #ifdef PARDISO_MATCHING_PREPROCESS - ia2(NULL), - ja2(NULL), - a2_(NULL), - perm2(NULL), - scale2(NULL), + ia2(NULL), + ja2(NULL), + a2_(NULL), + perm2(NULL), + scale2(NULL), + pardisoloader(pardisoloader_), + smat_reordering_pardiso_wsmp(NULL), #endif - negevals_(-1), - initialized_(false), - PERM_(NULL), - INVP_(NULL), - MRP_(NULL) + negevals_(-1), + initialized_(false), + PERM_(NULL), + INVP_(NULL), + MRP_(NULL) { DBG_START_METH("WsmpSolverInterface::WsmpSolverInterface()", dbg_verbosity); - IPARM_ = new ipfint[64]; + IPARM_ = new Index[64]; DPARM_ = new double[64]; } @@ -113,45 +108,40 @@ void WsmpSolverInterface::RegisterOptions( roptions->AddIntegerOption( "wsmp_num_threads", "Number of threads to be used in WSMP", - 1, - "This option is only available if Ipopt has been compiled with WSMP."); + 1); roptions->AddBoundedIntegerOption( "wsmp_ordering_option", "Determines how ordering is done in WSMP", -2, 3, 1, - "This corresponds to the value of WSSMP's IPARM(16)." - "This option is only available if Ipopt has been compiled with WSMP."); + "This corresponds to the value of WSSMP's IPARM(16)."); roptions->AddBoundedIntegerOption( "wsmp_ordering_option2", "Determines how ordering is done in WSMP", 0, 3, 1, - "This corresponds to the value of WSSMP's IPARM(20)." - "This option is only available if Ipopt has been compiled with WSMP."); + "This corresponds to the value of WSSMP's IPARM(20).", + true); roptions->AddBoundedNumberOption( "wsmp_pivtol", "Pivot tolerance for the linear solver WSMP.", 0.0, true, 1.0, true, 1e-4, - "A smaller number pivots for sparsity, a larger number pivots for stability. " - "This option is only available if Ipopt has been compiled with WSMP."); + "A smaller number pivots for sparsity, a larger number pivots for stability."); roptions->AddBoundedNumberOption( "wsmp_pivtolmax", "Maximum pivot tolerance for the linear solver WSMP.", 0.0, true, 1.0, true, 1e-1, - "Ipopt may increase pivtol as high as pivtolmax to get a more accurate solution to the linear system. " - "This option is only available if Ipopt has been compiled with WSMP."); + "Ipopt may increase pivtol as high as pivtolmax to get a more accurate solution to the linear system."); roptions->AddBoundedIntegerOption( "wsmp_scaling", "Determines how the matrix is scaled by WSMP.", 0, 3, 0, - "This corresponds to the value of WSSMP's IPARM(10). " - "This option is only available if Ipopt has been compiled with WSMP."); + "This corresponds to the value of WSSMP's IPARM(10)."); roptions->AddBoundedNumberOption( "wsmp_singularity_threshold", "WSMP's singularity threshold.", @@ -159,33 +149,40 @@ void WsmpSolverInterface::RegisterOptions( 1.0, true, 1e-18, "WSMP's DPARM(10) parameter. " - "The smaller this value the less likely a matrix is declared singular. " - "This option is only available if Ipopt has been compiled with WSMP."); - roptions->SetRegisteringCategory("Uncategorized"); // ???? + "The smaller this value the less likely a matrix is declared singular."); roptions->AddLowerBoundedIntegerOption( "wsmp_write_matrix_iteration", "Iteration in which the matrices are written to files.", -1, -1, - "If non-negative, this option determines the iteration in which all matrices given to WSMP are written to files. " - "This option is only available if Ipopt has been compiled with WSMP."); - roptions->AddStringOption2( + "If non-negative, this option determines the iteration in which all matrices given to WSMP are written to files.", + true); + roptions->AddBoolOption( "wsmp_skip_inertia_check", - "Always pretend inertia is correct.", - "no", - "no", "check inertia", - "yes", "skip inertia check", + "Whether to always pretend that inertia is correct.", + false, "Setting this option to \"yes\" essentially disables inertia check. " - "This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control."); + "This option makes the algorithm non-robust and easily fail, but it might give some insight into the necessity of inertia control.", + true); roptions->AddStringOption2( "wsmp_no_pivoting", - "Use the static pivoting option of WSMP.", + "Whether to use the static pivoting option of WSMP.", "no", "no", "use the regular version", "yes", "use static pivoting", - "Setting this option to \"yes\" means that WSMP instructed not to do pivoting. " + "Setting this option to \"yes\" means that WSMP is instructed not to do pivoting. " "This works only in certain situations (when the Hessian block is known to be positive definite or when we are using L-BFGS). " - "It can also lead to a lot of fill-in."); + "It can also lead to a lot of fill-in.", + true); +} + +void WsmpSolverInterface::GetVersion( + int& V, + int& R, + int& M +) +{ + IPOPT_WSMP_FUNC_(wsmp_version, WSMP_VERSION)(&V, &R, &M); } bool WsmpSolverInterface::InitializeImpl( @@ -193,6 +190,12 @@ bool WsmpSolverInterface::InitializeImpl( const std::string& prefix ) { +#ifdef PARDISO_MATCHING_PREPROCESS + DBG_ASSERT(IsValid(pardisoloader)); + smat_reordering_pardiso_wsmp = (IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(*))pardisoloader->loadSymbol("smat_reordering_pardiso_wsmp"); + DBG_ASSERT(smat_reordering_pardiso_wsmp); +#endif + options.GetIntegerValue("wsmp_num_threads", wsmp_num_threads_, prefix); Index wsmp_ordering_option; options.GetIntegerValue("wsmp_ordering_option", wsmp_ordering_option, prefix); @@ -249,19 +252,26 @@ bool WsmpSolverInterface::InitializeImpl( #endif // Set the number of threads - ipfint NTHREADS = wsmp_num_threads_; + Index NTHREADS = wsmp_num_threads_; IPOPT_WSMP_FUNC(wsetmaxthrds, WSETMAXTHRDS)(&NTHREADS); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "WSMP will use %d threads.\n", wsmp_num_threads_); + "WSMP will use %" IPOPT_INDEX_FORMAT " threads.\n", wsmp_num_threads_); // Get WSMP's default parameters and set the ones we want differently IPARM_[0] = 0; IPARM_[1] = 0; IPARM_[2] = 0; - ipfint idmy; - double ddmy; + Index idmy = 0; + double ddmy = 0.; IPOPT_WSMP_FUNC(wssmp, WSSMP)(&idmy, &idmy, &idmy, &ddmy, &ddmy, &idmy, &idmy, &ddmy, &idmy, &idmy, &ddmy, &idmy, &idmy, - IPARM_, DPARM_); + IPARM_, DPARM_); + + if( IPARM_[63] < 0 ) + { + Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, "Error %" IPOPT_INDEX_FORMAT " from WSMP initialization.\n", IPARM_[63]); + return false; + } + IPARM_[15] = wsmp_ordering_option; // ordering option IPARM_[17] = 0; // use local minimum fill-in ordering IPARM_[19] = wsmp_ordering_option2; // for ordering in IP methods? @@ -309,7 +319,7 @@ ESymSolverStatus WsmpSolverInterface::MultiSolve( if( !printed_num_threads_ ) { Jnlst().Printf(J_ITERSUMMARY, J_LINEAR_ALGEBRA, - " -- WSMP is working with %d thread%s.\n", IPARM_[32], IPARM_[32] == 1 ? "" : "s"); + " -- WSMP is working with %" IPOPT_INDEX_FORMAT " thread%s.\n", IPARM_[32], IPARM_[32] == 1 ? "" : "s"); printed_num_threads_ = true; } // check if a factorization has to be done @@ -353,7 +363,7 @@ ESymSolverStatus WsmpSolverInterface::InitializeStructure( a_ = NULL; a_ = new double[nonzeros]; - // Do the symbolic facotrization + // Do the symbolic factorization ESymSolverStatus retval = SymbolicFactorization(ia, ja); if( retval != SYMSOLVER_SUCCESS ) { @@ -366,8 +376,8 @@ ESymSolverStatus WsmpSolverInterface::InitializeStructure( } ESymSolverStatus WsmpSolverInterface::SymbolicFactorization( - const Index* ia, - const Index* ja + const Index* /*ia*/, + const Index* /*ja*/ ) { DBG_START_METH("WsmpSolverInterface::SymbolicFactorization", @@ -396,11 +406,11 @@ ESymSolverStatus WsmpSolverInterface::InternalSymFact( INVP_ = NULL; delete[] MRP_; MRP_ = NULL; - PERM_ = new ipfint[dim_]; - INVP_ = new ipfint[dim_]; - MRP_ = new ipfint[dim_]; + PERM_ = new Index[dim_]; + INVP_ = new Index[dim_]; + MRP_ = new Index[dim_]; - ipfint N = dim_; + Index N = dim_; #ifdef PARDISO_MATCHING_PREPROCESS @@ -419,22 +429,21 @@ ESymSolverStatus WsmpSolverInterface::InternalSymFact( delete[] scale2; scale2 = NULL; - ia2 = new ipfint[N + 1]; - ja2 = new ipfint[nonzeros_]; + ia2 = new Index[N + 1]; + ja2 = new Index[nonzeros_]; a2_ = new double[nonzeros_]; - perm2 = new ipfint[N]; + perm2 = new Index[N]; scale2 = new double[N]; - ipfint* tmp2_ = new ipfint[N]; + Index* tmp2_ = new Index[N]; - IPOPT_PARDISO_FUNC(smat_reordering_pardiso_wsmp, SMAT_REORDERING_PARDISO_WSMP)(&N, ia, ja, a_, ia2, ja2, a2_, perm2, - scale2, tmp2_, 0); + smat_reordering_pardiso_wsmp(&N, ia, ja, a_, ia2, ja2, a2_, perm2, scale2, tmp2_, 0); delete[] tmp2_; #endif // Call WSSMP for ordering and symbolic factorization - ipfint NAUX = 0; + Index NAUX = 0; IPARM_[1] = 1; // ordering IPARM_[2] = 2; // symbolic factorization #ifdef PARDISO_MATCHING_PREPROCESS @@ -446,28 +455,26 @@ ESymSolverStatus WsmpSolverInterface::InternalSymFact( // =6 limited pivots DPARM_[21] = 2e-8;// set pivot perturbation #endif - ipfint idmy; - double ddmy; + Index idmy = 0; + double ddmy = 0.; if( wsmp_no_pivoting_ ) { IPARM_[14] = dim_ - numberOfNegEVals; // CHECK Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Restricting WSMP static pivot sequence with IPARM(15) = %d\n", IPARM_[14]); + "Restricting WSMP static pivot sequence with IPARM(15) = %" IPOPT_INDEX_FORMAT "\n", IPARM_[14]); } Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling WSSMP-1-2 for ordering and symbolic factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), - WallclockTime()); + "Calling WSSMP-1-2 for ordering and symbolic factorization.\n"); #ifdef PARDISO_MATCHING_PREPROCESS IPOPT_WSMP_FUNC(wssmp, WSSMP)(&N, ia2, ja2, a2_, &ddmy, PERM_, INVP_, #else IPOPT_WSMP_FUNC(wssmp, WSSMP)(&N, ia, ja, a_, &ddmy, PERM_, INVP_, #endif - &ddmy, &idmy, &idmy, &ddmy, &NAUX, MRP_, IPARM_, DPARM_); + &ddmy, &idmy, &idmy, &ddmy, &NAUX, MRP_, IPARM_, DPARM_); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with WSSMP-1-2 for ordering and symbolic factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), - WallclockTime()); + "Done with WSSMP-1-2 for ordering and symbolic factorization.\n"); Index ierror = IPARM_[63]; if( ierror != 0 ) @@ -480,7 +487,7 @@ ESymSolverStatus WsmpSolverInterface::InternalSymFact( else if( ierror > 0 ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Matrix appears to be singular (with ierror = %d).\n", ierror); + "Matrix appears to be singular (with ierror = %" IPOPT_INDEX_FORMAT ").\n", ierror); if( HaveIpData() ) { IpData().TimingStats().LinearSystemSymbolicFactorization().End(); @@ -490,7 +497,7 @@ ESymSolverStatus WsmpSolverInterface::InternalSymFact( else { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in WSMP during ordering/symbolic factorization phase.\n Error code is %d.\n", ierror); + "Error in WSMP during ordering/symbolic factorization phase.\n Error code is %" IPOPT_INDEX_FORMAT ".\n", ierror); } if( HaveIpData() ) { @@ -499,9 +506,9 @@ ESymSolverStatus WsmpSolverInterface::InternalSymFact( return SYMSOLVER_FATAL_ERROR; } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Predicted memory usage for WSSMP after symbolic factorization IPARM(23)= %d.\n", IPARM_[22]); + "Predicted memory usage for WSSMP after symbolic factorization IPARM(23)= %" IPOPT_INDEX_FORMAT ".\n", IPARM_[22]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Predicted number of nonzeros in factor for WSSMP after symbolic factorization IPARM(23)= %d.\n", IPARM_[23]); + "Predicted number of nonzeros in factor for WSSMP after symbolic factorization IPARM(23)= %" IPOPT_INDEX_FORMAT ".\n", IPARM_[23]); if( HaveIpData() ) { @@ -530,18 +537,18 @@ ESymSolverStatus WsmpSolverInterface::Factorization( { matrix_file_number_++; char buf[256]; - Snprintf(buf, 255, "wsmp_matrix_%d_%d.dat", iter_count, matrix_file_number_); + Snprintf(buf, 255, "wsmp_matrix_%" IPOPT_INDEX_FORMAT "_%" IPOPT_INDEX_FORMAT ".dat", iter_count, matrix_file_number_); Jnlst().Printf(J_SUMMARY, J_LINEAR_ALGEBRA, "Writing WSMP matrix into file %s.\n", buf); FILE* fp = fopen(buf, "w"); - fprintf(fp, "%d\n", dim_); // N + fprintf(fp, "%" IPOPT_INDEX_FORMAT "\n", dim_); // N for( Index icol = 0; icol < dim_; icol++ ) { - fprintf(fp, "%d", ia[icol + 1] - ia[icol]); // number of elements for this column + fprintf(fp, "%" IPOPT_INDEX_FORMAT "", ia[icol + 1] - ia[icol]); // number of elements for this column // Now for each colum we write row indices and values for( Index irow = ia[icol]; irow < ia[icol + 1]; irow++ ) { - fprintf(fp, " %23.16e %d", a_[irow - 1], ja[irow - 1]); + fprintf(fp, " %23.16e %" IPOPT_INDEX_FORMAT "", a_[irow - 1], ja[irow - 1]); } fprintf(fp, "\n"); } @@ -566,39 +573,38 @@ ESymSolverStatus WsmpSolverInterface::Factorization( } // Call WSSMP for numerical factorization - ipfint N = dim_; - ipfint NAUX = 0; + Index N = dim_; + Index NAUX = 0; IPARM_[1] = 3; // numerical factorization IPARM_[2] = 3; // numerical factorization DPARM_[10] = wsmp_pivtol_; // set current pivot tolerance - ipfint idmy; - double ddmy; + Index idmy = 0; + double ddmy = 0.; #ifdef PARDISO_MATCHING_PREPROCESS { - ipfint* tmp2_ = new ipfint[N]; - IPOPT_PARDISO_FUNC(smat_reordering_pardiso_wsmp, SMAT_REORDERING_PARDISO_WSMP)(&N, ia, ja, a_, ia2, ja2, a2_, perm2, scale2, tmp2_, 1); + Index* tmp2_ = new Index[N]; + smat_reordering_pardiso_wsmp(&N, ia, ja, a_, ia2, ja2, a2_, perm2, scale2, tmp2_, 1); delete[] tmp2_; } #endif Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling WSSMP-3-3 for numerical factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); + "Calling WSSMP-3-3 for numerical factorization.\n"); #ifdef PARDISO_MATCHING_PREPROCESS IPOPT_WSMP_FUNC(wssmp, WSSMP)(&N, ia2, ja2, a2_, &ddmy, PERM_, INVP_, &ddmy, &idmy, #else IPOPT_WSMP_FUNC(wssmp, WSSMP)(&N, ia, ja, a_, &ddmy, PERM_, INVP_, &ddmy, &idmy, #endif - &idmy, &ddmy, &NAUX, MRP_, IPARM_, DPARM_); + &idmy, &ddmy, &NAUX, MRP_, IPARM_, DPARM_); Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with WSSMP-3-3 for numerical factorization at cpu time %10.3f (wall %10.3f).\n", CpuTime(), - WallclockTime()); + "Done with WSSMP-3-3 for numerical factorization.\n"); const Index ierror = IPARM_[63]; if( ierror > 0 ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "WSMP detected that the matrix is singular and encountered %d zero pivots.\n", dim_ + 1 - ierror); + "WSMP detected that the matrix is singular and encountered %" IPOPT_INDEX_FORMAT " zero pivots.\n", dim_ + 1 - ierror); if( HaveIpData() ) { IpData().TimingStats().LinearSystemFactorization().End(); @@ -615,7 +621,7 @@ ESymSolverStatus WsmpSolverInterface::Factorization( else { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in WSMP during factorization phase.\n Error code is %d.\n", ierror); + "Error in WSMP during factorization phase.\n Error code is %" IPOPT_INDEX_FORMAT ".\n", ierror); } if( HaveIpData() ) { @@ -624,9 +630,9 @@ ESymSolverStatus WsmpSolverInterface::Factorization( return SYMSOLVER_FATAL_ERROR; } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Memory usage for WSSMP after factorization IPARM(23) = %d\n", IPARM_[22]); + "Memory usage for WSSMP after factorization IPARM(23) = %" IPOPT_INDEX_FORMAT "\n", IPARM_[22]); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of nonzeros in WSSMP after factorization IPARM(24) = %d\n", IPARM_[23]); + "Number of nonzeros in WSSMP after factorization IPARM(24) = %" IPOPT_INDEX_FORMAT "\n", IPARM_[23]); if( factorizations_since_recomputed_ordering_ != -1 ) { @@ -640,7 +646,7 @@ ESymSolverStatus WsmpSolverInterface::Factorization( if( check_NegEVals && (numberOfNegEVals != negevals_) ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Wrong inertia: required are %d, but we got %d.\n", numberOfNegEVals, negevals_); + "Wrong inertia: required are %" IPOPT_INDEX_FORMAT ", but we got %" IPOPT_INDEX_FORMAT ".\n", numberOfNegEVals, negevals_); if( skip_inertia_check_ ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, @@ -682,41 +688,41 @@ ESymSolverStatus WsmpSolverInterface::Solve( // Call WSMP to solve for some right hand sides (including // iterative refinement) // ToDo: Make iterative refinement an option? - ipfint N = dim_; - ipfint LDB = dim_; - ipfint NRHS = nrhs; - ipfint NAUX = 0; - IPARM_[1] = 4; // Forward and Backward Elimintation + Index N = dim_; + Index LDB = dim_; + Index NRHS = nrhs; + Index NAUX = 0; + IPARM_[1] = 4; // Forward and Backward Elimination IPARM_[2] = 5; // Iterative refinement IPARM_[5] = 1; DPARM_[5] = 1e-12; double ddmy; Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Calling WSSMP-4-5 for backsolve at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); + "Calling WSSMP-4-5 for backsolve.\n"); #ifdef PARDISO_MATCHING_PREPROCESS double* X = new double[nrhs * N]; // Initialize solution with zero and save right hand side - for (int i = 0; i < nrhs * N; i++) + for (Index i = 0; i < nrhs * N; i++) { X[perm2[i]] = scale2[i] * rhs_vals[i]; } IPOPT_WSMP_FUNC(wssmp, WSSMP)(&N, ia, ja, a_, &ddmy, PERM_, INVP_, - X, &LDB, &NRHS, &ddmy, &NAUX, - MRP_, IPARM_, DPARM_); - for (int i = 0; i < N; i++) + X, &LDB, &NRHS, &ddmy, &NAUX, + MRP_, IPARM_, DPARM_); + for (Index i = 0; i < N; i++) { rhs_vals[i] = scale2[i] * X[perm2[i]]; } #else IPOPT_WSMP_FUNC(wssmp, WSSMP)(&N, ia, ja, a_, &ddmy, PERM_, INVP_, rhs_vals, &LDB, &NRHS, &ddmy, &NAUX, MRP_, IPARM_, - DPARM_); + DPARM_); #endif Jnlst().Printf(J_MOREDETAILED, J_LINEAR_ALGEBRA, - "Done with WSSMP-4-5 for backsolve at cpu time %10.3f (wall %10.3f).\n", CpuTime(), WallclockTime()); + "Done with WSSMP-4-5 for backsolve.\n"); if( HaveIpData() ) { IpData().TimingStats().LinearSystemBackSolve().End(); @@ -733,12 +739,12 @@ ESymSolverStatus WsmpSolverInterface::Solve( else { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in WSMP during ordering/symbolic factorization phase.\n Error code is %d.\n", ierror); + "Error in WSMP during ordering/symbolic factorization phase.\n Error code is %" IPOPT_INDEX_FORMAT ".\n", ierror); } return SYMSOLVER_FATAL_ERROR; } Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "Number of iterative refinement steps in WSSMP: %d\n", IPARM_[5]); + "Number of iterative refinement steps in WSSMP: %" IPOPT_INDEX_FORMAT "\n", IPARM_[5]); #ifdef PARDISO_MATCHING_PREPROCESS delete [] X; @@ -776,7 +782,7 @@ bool WsmpSolverInterface::IncreaseQuality() Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "Increasing pivot tolerance for WSMP from %7.2e ", wsmp_pivtol_); - wsmp_pivtol_ = Min(wsmp_pivtolmax_, pow(wsmp_pivtol_, 0.75)); + wsmp_pivtol_ = Min(wsmp_pivtolmax_, std::pow(wsmp_pivtol_, 0.75)); Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, "to %7.2e.\n", wsmp_pivtol_); return true; @@ -812,27 +818,27 @@ ESymSolverStatus WsmpSolverInterface::DetermineDependentRows( // Call WSSMP for numerical factorization to detect degenerate // rows/columns - ipfint N = dim_; - ipfint NAUX = 0; + Index N = dim_; + Index NAUX = 0; IPARM_[1] = 3; // numerical factorization IPARM_[2] = 3; // numerical factorization DPARM_[10] = wsmp_pivtol_; // set current pivot tolerance - ipfint idmy; - double ddmy; + Index idmy = 0; + double ddmy = 0.; #ifdef PARDISO_MATCHING_PREPROCESS IPOPT_WSMP_FUNC(wssmp, WSSMP)(&N, ia2, ja2, a2_, &ddmy, PERM_, INVP_, &ddmy, &idmy, - &idmy, &ddmy, &NAUX, MRP_, IPARM_, DPARM_); + &idmy, &ddmy, &NAUX, MRP_, IPARM_, DPARM_); #else IPOPT_WSMP_FUNC(wssmp, WSSMP)(&N, ia, ja, a_, &ddmy, PERM_, INVP_, &ddmy, &idmy, &idmy, &ddmy, &NAUX, MRP_, IPARM_, - DPARM_); + DPARM_); #endif const Index ierror = IPARM_[63]; if( ierror == 0 ) { - int ii = 0; - for( int i = 0; i < N; i++ ) + Index ii = 0; + for( Index i = 0; i < N; i++ ) { if( MRP_[i] == -1 ) { @@ -845,7 +851,7 @@ ESymSolverStatus WsmpSolverInterface::DetermineDependentRows( if( ierror > 0 ) { Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "WSMP detected that the matrix is singular and encountered %d zero pivots.\n", dim_ + 1 - ierror); + "WSMP detected that the matrix is singular and encountered %" IPOPT_INDEX_FORMAT " zero pivots.\n", dim_ + 1 - ierror); if( HaveIpData() ) { IpData().TimingStats().LinearSystemFactorization().End(); @@ -862,7 +868,7 @@ ESymSolverStatus WsmpSolverInterface::DetermineDependentRows( else { Jnlst().Printf(J_ERROR, J_LINEAR_ALGEBRA, - "Error in WSMP during factorization phase.\n Error code is %d.\n", ierror); + "Error in WSMP during factorization phase.\n Error code is %" IPOPT_INDEX_FORMAT ".\n", ierror); } if( HaveIpData() ) { diff --git a/src/Algorithm/LinearSolvers/IpWsmpSolverInterface.hpp b/src/Algorithm/LinearSolvers/IpWsmpSolverInterface.hpp index e3a0726f9..ff0f9dedc 100644 --- a/src/Algorithm/LinearSolvers/IpWsmpSolverInterface.hpp +++ b/src/Algorithm/LinearSolvers/IpWsmpSolverInterface.hpp @@ -8,8 +8,8 @@ #define __IPWSMPSOLVERINTERFACE_HPP__ #include "IpSparseSymLinearSolverInterface.hpp" - -//#define PARDISO_MATCHING_PREPROCESS +#include "IpPardisoSolverInterface.hpp" // for IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP +#include "IpTypes.h" namespace Ipopt { @@ -21,13 +21,17 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor */ - WsmpSolverInterface(); + WsmpSolverInterface( +#ifdef PARDISO_MATCHING_PREPROCESS + SmartPtr pardisoloader_ ///< @since 3.14.0 +#endif + ); /** Destructor */ virtual ~WsmpSolverInterface(); - //@} + ///@} bool InitializeImpl( const OptionsList& options, @@ -35,7 +39,7 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface ); /** @name Methods for requesting solution of the linear system. */ - //@{ + ///@{ virtual ESymSolverStatus InitializeStructure( Index dim, Index nonzeros, @@ -56,10 +60,10 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface ); virtual Index NumberOfNegEVals() const; - //@} + ///@} //* @name Options of Linear solver */ - //@{ + ///@{ virtual bool IncreaseQuality(); virtual bool ProvidesInertia() const @@ -71,13 +75,20 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface { return CSR_Format_1_Offset; } - //@} + ///@} - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + + /// give WSMP version + static void GetVersion( + int& V, + int& R, + int& M + ); + ///@} virtual bool ProvidesDegeneracyDetection() const; @@ -95,7 +106,7 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface * them for us, so we declare them private * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ WsmpSolverInterface( const WsmpSolverInterface& @@ -105,10 +116,10 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface void operator=( const WsmpSolverInterface& ); - //@} + ///@} /** @name Information about the matrix */ - //@{ + ///@{ /** Number of rows and columns of the matrix */ Index dim_; @@ -120,19 +131,19 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface #ifdef PARDISO_MATCHING_PREPROCESS /** @name Arrays for storing the values of a second matrix that has been already reordered. */ - //@{ - ipfint* ia2; - ipfint* ja2; + ///@{ + Index* ia2; + Index* ja2; double* a2_; - ipfint* perm2; + Index* perm2; double* scale2; - //@} + ///@} #endif - //@} + ///@} /** @name Solver specific options */ - //@{ + ///@{ /** Option that controls the matching strategy. */ Index wsmp_num_threads_; /** Pivot tolerance */ @@ -152,19 +163,19 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface bool skip_inertia_check_; /** Flag indicating whether the positive definite version of WSMP should be used */ bool wsmp_no_pivoting_; - //@} + ///@} /** Counter for matrix file numbers */ Index matrix_file_number_; /** @name Information about most recent factorization/solve */ - //@{ + ///@{ /** Number of negative eigenvalues */ Index negevals_; - //@} + ///@} /** @name Initialization flags */ - //@{ + ///@{ /** Flag indicating if internal data is initialized. * * For initialization, this object needs to have seen a matrix. @@ -185,24 +196,33 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface * the last recomputation of the ordering. */ Index factorizations_since_recomputed_ordering_; - //@} + ///@} /** @name Solver specific information */ - //@{ + ///@{ /** Integer parameter array for WSSMP. */ - ipfint* IPARM_; + Index* IPARM_; /** Double precision parameter array for WSSMP. */ double* DPARM_; /** WSSMP's permutation vector */ - ipfint* PERM_; + Index* PERM_; /** WSSMP's inverse permutation vector */ - ipfint* INVP_; + Index* INVP_; /** WSSMP's internal MRP array */ - ipfint* MRP_; - //@} + Index* MRP_; + ///@} + + /**@name PARDISO function pointer + * @{ + */ +#ifdef PARDISO_MATCHING_PREPROCESS + SmartPtr pardisoloader; + IPOPT_DECL_SMAT_REORDERING_PARDISO_WSMP(*smat_reordering_pardiso_wsmp); +#endif + /**@} */ /** @name Internal functions */ - //@{ + ///@{ /** Call Wsmp to do the analysis phase. */ ESymSolverStatus SymbolicFactorization( const Index* ia, @@ -231,7 +251,7 @@ class WsmpSolverInterface: public SparseSymLinearSolverInterface Index nrhs, double* rhs_vals ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Algorithm/LinearSolvers/Makefile.am b/src/Algorithm/LinearSolvers/Makefile.am deleted file mode 100644 index 797675abb..000000000 --- a/src/Algorithm/LinearSolvers/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (C) 2004, 2011 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = IpSymLinearSolver.hpp - -noinst_LTLIBRARIES = liblinsolvers.la - -liblinsolvers_la_SOURCES = \ - IpLinearSolversRegOp.cpp \ - IpSlackBasedTSymScalingMethod.cpp \ - IpTripletToCSRConverter.cpp \ - IpTSymDependencyDetector.cpp \ - IpTSymLinearSolver.cpp - -liblinsolvers_la_SOURCES += \ - IpMa27TSolverInterface.cpp \ - IpMa57TSolverInterface.cpp \ - IpMa86SolverInterface.cpp \ - IpMa97SolverInterface.cpp \ - IpMc19TSymScalingMethod.cpp \ - IpMa77SolverInterface.cpp - -if BUILD_LINEARSOLVERLOADER - liblinsolvers_la_SOURCES += IpPardisoSolverInterface.cpp -else -if HAVE_PARDISO - liblinsolvers_la_SOURCES += IpPardisoSolverInterface.cpp -endif -endif # BUILD_LINEARSOLVERLOADER - -if HAVE_MA28 - liblinsolvers_la_SOURCES += IpMa28TDependencyDetector.cpp - liblinsolvers_la_SOURCES += IpMa28Partition.F -endif - -if HAVE_WSMP - liblinsolvers_la_SOURCES += IpWsmpSolverInterface.cpp IpIterativeWsmpSolverInterface.cpp -endif - -if COIN_HAS_MUMPS - liblinsolvers_la_SOURCES += IpMumpsSolverInterface.cpp -endif - -#liblinsolvers_la_LDFLAGS = $(LT_LDFLAGS) - -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../LinAlg \ - -I$(srcdir)/../../LinAlg/TMatrices \ - -I$(srcdir)/.. \ - -I$(srcdir)/../../Interfaces \ - -I$(srcdir)/../../contrib/CGPenalty \ - $(IPOPTLIB_CFLAGS) diff --git a/src/Algorithm/LinearSolvers/Makefile.in b/src/Algorithm/LinearSolvers/Makefile.in deleted file mode 100644 index 32988a740..000000000 --- a/src/Algorithm/LinearSolvers/Makefile.in +++ /dev/null @@ -1,820 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2004, 2011 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - - -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@BUILD_LINEARSOLVERLOADER_TRUE@am__append_1 = IpPardisoSolverInterface.cpp -@BUILD_LINEARSOLVERLOADER_FALSE@@HAVE_PARDISO_TRUE@am__append_2 = IpPardisoSolverInterface.cpp -@HAVE_MA28_TRUE@am__append_3 = IpMa28TDependencyDetector.cpp \ -@HAVE_MA28_TRUE@ IpMa28Partition.F -@HAVE_WSMP_TRUE@am__append_4 = IpWsmpSolverInterface.cpp IpIterativeWsmpSolverInterface.cpp -@COIN_HAS_MUMPS_TRUE@am__append_5 = IpMumpsSolverInterface.cpp -subdir = src/Algorithm/LinearSolvers -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -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 -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -liblinsolvers_la_LIBADD = -@BUILD_LINEARSOLVERLOADER_TRUE@am__objects_1 = \ -@BUILD_LINEARSOLVERLOADER_TRUE@ IpPardisoSolverInterface.lo -@BUILD_LINEARSOLVERLOADER_FALSE@@HAVE_PARDISO_TRUE@am__objects_2 = IpPardisoSolverInterface.lo -@HAVE_MA28_TRUE@am__objects_3 = IpMa28TDependencyDetector.lo \ -@HAVE_MA28_TRUE@ IpMa28Partition.lo -@HAVE_WSMP_TRUE@am__objects_4 = IpWsmpSolverInterface.lo \ -@HAVE_WSMP_TRUE@ IpIterativeWsmpSolverInterface.lo -@COIN_HAS_MUMPS_TRUE@am__objects_5 = IpMumpsSolverInterface.lo -am_liblinsolvers_la_OBJECTS = IpLinearSolversRegOp.lo \ - IpSlackBasedTSymScalingMethod.lo IpTripletToCSRConverter.lo \ - IpTSymDependencyDetector.lo IpTSymLinearSolver.lo \ - IpMa27TSolverInterface.lo IpMa57TSolverInterface.lo \ - IpMa86SolverInterface.lo IpMa97SolverInterface.lo \ - IpMc19TSymScalingMethod.lo IpMa77SolverInterface.lo \ - $(am__objects_1) $(am__objects_2) $(am__objects_3) \ - $(am__objects_4) $(am__objects_5) -liblinsolvers_la_OBJECTS = $(am_liblinsolvers_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 = -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)/IpIterativeWsmpSolverInterface.Plo \ - ./$(DEPDIR)/IpLinearSolversRegOp.Plo \ - ./$(DEPDIR)/IpMa27TSolverInterface.Plo \ - ./$(DEPDIR)/IpMa28TDependencyDetector.Plo \ - ./$(DEPDIR)/IpMa57TSolverInterface.Plo \ - ./$(DEPDIR)/IpMa77SolverInterface.Plo \ - ./$(DEPDIR)/IpMa86SolverInterface.Plo \ - ./$(DEPDIR)/IpMa97SolverInterface.Plo \ - ./$(DEPDIR)/IpMc19TSymScalingMethod.Plo \ - ./$(DEPDIR)/IpMumpsSolverInterface.Plo \ - ./$(DEPDIR)/IpPardisoSolverInterface.Plo \ - ./$(DEPDIR)/IpSlackBasedTSymScalingMethod.Plo \ - ./$(DEPDIR)/IpTSymDependencyDetector.Plo \ - ./$(DEPDIR)/IpTSymLinearSolver.Plo \ - ./$(DEPDIR)/IpTripletToCSRConverter.Plo \ - ./$(DEPDIR)/IpWsmpSolverInterface.Plo -am__mv = mv -f -PPF77COMPILE = $(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS) -LTPPF77COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(F77) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_FFLAGS) $(FFLAGS) -AM_V_PPF77 = $(am__v_PPF77_@AM_V@) -am__v_PPF77_ = $(am__v_PPF77_@AM_DEFAULT_V@) -am__v_PPF77_0 = @echo " PPF77 " $@; -am__v_PPF77_1 = -F77LD = $(F77) -F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_F77LD = $(am__v_F77LD_@AM_V@) -am__v_F77LD_ = $(am__v_F77LD_@AM_DEFAULT_V@) -am__v_F77LD_0 = @echo " F77LD " $@; -am__v_F77LD_1 = -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) \ - $(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) \ - $(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) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(liblinsolvers_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -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__installdirs = "$(DESTDIR)$(includeipoptdir)" -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 -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = IpSymLinearSolver.hpp -noinst_LTLIBRARIES = liblinsolvers.la -liblinsolvers_la_SOURCES = IpLinearSolversRegOp.cpp \ - IpSlackBasedTSymScalingMethod.cpp IpTripletToCSRConverter.cpp \ - IpTSymDependencyDetector.cpp IpTSymLinearSolver.cpp \ - IpMa27TSolverInterface.cpp IpMa57TSolverInterface.cpp \ - IpMa86SolverInterface.cpp IpMa97SolverInterface.cpp \ - IpMc19TSymScalingMethod.cpp IpMa77SolverInterface.cpp \ - $(am__append_1) $(am__append_2) $(am__append_3) \ - $(am__append_4) $(am__append_5) - -#liblinsolvers_la_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../LinAlg \ - -I$(srcdir)/../../LinAlg/TMatrices \ - -I$(srcdir)/.. \ - -I$(srcdir)/../../Interfaces \ - -I$(srcdir)/../../contrib/CGPenalty \ - $(IPOPTLIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .F .cpp .f .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; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Algorithm/LinearSolvers/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Algorithm/LinearSolvers/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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}; \ - } - -liblinsolvers.la: $(liblinsolvers_la_OBJECTS) $(liblinsolvers_la_DEPENDENCIES) $(EXTRA_liblinsolvers_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(liblinsolvers_la_OBJECTS) $(liblinsolvers_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpIterativeWsmpSolverInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpLinearSolversRegOp.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMa27TSolverInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMa28TDependencyDetector.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMa57TSolverInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMa77SolverInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMa86SolverInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMa97SolverInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMc19TSymScalingMethod.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMumpsSolverInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpPardisoSolverInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpSlackBasedTSymScalingMethod.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTSymDependencyDetector.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTSymLinearSolver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTripletToCSRConverter.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpWsmpSolverInterface.Plo@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) - -.F.o: - $(AM_V_PPF77)$(PPF77COMPILE) -c -o $@ $< - -.F.obj: - $(AM_V_PPF77)$(PPF77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.F.lo: - $(AM_V_PPF77)$(LTPPF77COMPILE) -c -o $@ $< -.F.f: - $(F77COMPILE) -F $< - -.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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -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 \ - 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 $$?; \ - 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 - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -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) \ - $$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 - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(includeipoptdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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 -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/IpIterativeWsmpSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpLinearSolversRegOp.Plo - -rm -f ./$(DEPDIR)/IpMa27TSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMa28TDependencyDetector.Plo - -rm -f ./$(DEPDIR)/IpMa57TSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMa77SolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMa86SolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMa97SolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMc19TSymScalingMethod.Plo - -rm -f ./$(DEPDIR)/IpMumpsSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpPardisoSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpSlackBasedTSymScalingMethod.Plo - -rm -f ./$(DEPDIR)/IpTSymDependencyDetector.Plo - -rm -f ./$(DEPDIR)/IpTSymLinearSolver.Plo - -rm -f ./$(DEPDIR)/IpTripletToCSRConverter.Plo - -rm -f ./$(DEPDIR)/IpWsmpSolverInterface.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-includeipoptHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -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 -f ./$(DEPDIR)/IpIterativeWsmpSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpLinearSolversRegOp.Plo - -rm -f ./$(DEPDIR)/IpMa27TSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMa28TDependencyDetector.Plo - -rm -f ./$(DEPDIR)/IpMa57TSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMa77SolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMa86SolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMa97SolverInterface.Plo - -rm -f ./$(DEPDIR)/IpMc19TSymScalingMethod.Plo - -rm -f ./$(DEPDIR)/IpMumpsSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpPardisoSolverInterface.Plo - -rm -f ./$(DEPDIR)/IpSlackBasedTSymScalingMethod.Plo - -rm -f ./$(DEPDIR)/IpTSymDependencyDetector.Plo - -rm -f ./$(DEPDIR)/IpTSymLinearSolver.Plo - -rm -f ./$(DEPDIR)/IpTripletToCSRConverter.Plo - -rm -f ./$(DEPDIR)/IpWsmpSolverInterface.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-includeipoptHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES \ - 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-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-man install-pdf install-pdf-am 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-includeipoptHEADERS - -.PRECIOUS: Makefile - - -# 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/Algorithm/LinearSolvers/hsl_ma77d.h b/src/Algorithm/LinearSolvers/hsl_ma77d.h index 1395d63b9..df1880b0c 100644 --- a/src/Algorithm/LinearSolvers/hsl_ma77d.h +++ b/src/Algorithm/LinearSolvers/hsl_ma77d.h @@ -1,8 +1,40 @@ -/* COPYRIGHT (c) 2011, 2013 The Science and Technology Facilities Council (STFC) - * All Rights Reserved. - * This code is published under the Eclipse Public License. +/* + * COPYRIGHT (c) 2011 Science and Technology Facilities Council (STFC) + * Original date 18 May 2011 + * All rights reserved + * + * Written by: Jonathan Hogg + * + * THIS FILE ONLY may be redistributed under the below modified BSD licence. + * All other files distributed as part of the HSL_MA77 package + * require a licence to be obtained from STFC and may NOT be redistributed + * without permission. Please refer to your licence for HSL_MA77 for full terms + * and conditions. STFC may be contacted via hsl(at)stfc.ac.uk. + * + * Modified BSD licence (this header file only): + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of STFC nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL STFC BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Authors: Jonathan Hogg STFC 2011-05-18 */ #ifndef HSL_MA77D_H @@ -33,107 +65,66 @@ typedef double ma77pkgtype_d_; -/** Data type for user controls - * - * @note 0 is false, non-zero is true - */ -struct ma77_control_d -{ - /**@name C/Fortran interface related controls - * @{ - */ - /** Treat arrays as 1-based (Fortran) if true or 0-based (C) if false. */ - int f_arrays; - /** @} */ +/* Data type for user controls */ +struct ma77_control_d { + /* Note: 0 is false, non-zero is true */ - /** @name Printing controls - * @{ - */ - int print_level; - /** unit for diagnostic messages - * - * Printing is suppressed if unit_diagnostics < 0. - */ - int unit_diagnostics; - /** unit for error messages - * - * Printing is suppressed if unit_error < 0. - */ - int unit_error; - /* unit for warning messages - * - * Printing is suppressed if unit_warning < 0. - */ - int unit_warning; - /** @} */ + /* C/Fortran interface related controls */ + int f_arrays; /* Treat arrays as 1-based (Fortran) if true or 0-based (C) if + false. */ - /** @name Controls used by MA77_open - * @{ - */ + /* Printing controls */ + int print_level; + int unit_diagnostics; /* unit for diagnostic messages + Printing is suppressed if unit_diagnostics < 0. */ + int unit_error; /* unit for error messages + Printing is suppressed if unit_error < 0. */ + int unit_warning; /* unit for warning messages + Printing is suppressed if unit_warning < 0. */ + + /* Controls used by MA77_open */ int bits; int buffer_lpage[2]; int buffer_npage[2]; long int file_size; long int maxstore; long int storage[3]; - /** @} */ - /** @name Controls used by MA77_analyse - * @{ - */ - /** Node amalgamation parameter. - * - * A child node is merged with its parent if they both involve fewer than nemin eliminations. - */ - int nemin; - /** @} */ + /* Controls used by MA77_analyse */ + int nemin; /* Node amalgamation parameter. A child node is merged with its + parent if they both involve fewer than nemin eliminations.*/ - /** @name Controls used by MA77_scale - * @{ - */ + /* Controls used by MA77_scale */ int maxit; int infnorm; ma77pkgtype_d_ thresh; - /** @} */ - /** @name Controls used by MA77_factor with posdef true - * @{ - */ + /* Controls used by MA77_factor with posdef true */ int nb54; - /** @} */ - /** @name Controls used by MA77_factor with posdef false - * @{ - */ - /** Keep going even if matrix is singular if true, or abort if false */ - int action; + /* Controls used by MA77_factor with posdef false */ + int action; /* Keep going even if matrix is singular if true, or abort + if false */ ma77pkgtype_d_ multiplier; int nb64; int nbi; ma77pkgtype_d_ small; ma77pkgtype_d_ static_; long int storage_indef; - ma77pkgtype_d_ u; /**< Pivot tolerance*/ - ma77pkgtype_d_ umin; /**< Minimum pivot tolerance*/ - /** @} */ + ma77pkgtype_d_ u; /* Pivot tolerance*/ + ma77pkgtype_d_ umin; /* Minimum pivot tolerance*/ - /** @name Controls used by ma77_solve_fredholm - * @{ - */ - ma77pkgtype_d_ consist_tol; /**< Tolerance for consistent singular system */ - /** @} */ + /* Controls used by ma77_solve_fredholm */ + ma77pkgtype_d_ consist_tol; /* Tolerance for consistent singular system */ /* Pad data structure to allow for future growth */ - int ispare[5]; - long int lspare[5]; - ma77pkgtype_d_ rspare[5]; + int ispare[5]; long int lspare[5]; ma77pkgtype_d_ rspare[5]; }; /***************************************************/ -/** data type for returning information to user.*/ -struct ma77_info_d -{ +/* data type for returning information to user.*/ +struct ma77_info_d { ma77pkgtype_d_ detlog; int detsign; int flag; @@ -166,184 +157,64 @@ struct ma77_info_d int unused; ma77pkgtype_d_ usmall; - /* if we do not have MA77, we assume its is loaded via the linear solver loader, for which we assume HSL 2013 */ /* Pad data structure to allow for future growth */ - int ispare[5]; - long int lspare[5]; - ma77pkgtype_d_ rspare[5]; + int ispare[5]; long int lspare[5]; ma77pkgtype_d_ rspare[5]; }; -/** Initialise control with default values */ -void ma77_default_control_d( - struct ma77_control_d* control -); - -void ma77_open_nelt( - const int n, - const char* fname1, - const char* fname2, - const char* fname3, - const char* fname4, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const int nelt -); - -void ma77_open_d( - const int n, - const char* fname1, - const char* fname2, - const char* fname3, - const char* fname4, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -void ma77_input_vars( - const int idx, - const int nvar, - const int list[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -void ma77_input_reals_d( - const int idx, - const int length, - const ma77pkgtype_d_ reals[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -/** Analyse the sparsity pattern and prepare for factorization */ -void ma77_analyse( - const int order[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -/** To factorize the matrix */ -void ma77_factor_d( - const int posdef, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const ma77pkgtype_d_* scale -); - -/** To factorize the matrix AND solve AX = B */ -void ma77_factor_solve_d( - const int posdef, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const ma77pkgtype_d_* scale, - const int nrhs, - const int lx, - ma77pkgtype_d_ rhs[] -); - -/** To solve AX = B using the computed factors */ -void ma77_solve_d( - const int job, - const int nrhs, - const int lx, - ma77pkgtype_d_ x[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const ma77pkgtype_d_* scale -); - -void ma77_resid_d( - const int nrhs, - const int lx, - const ma77pkgtype_d_ x[], - const int lresid, - ma77pkgtype_d_ resid[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - ma77pkgtype_d_* anorm_bnd -); - -void ma77_scale_d( - ma77pkgtype_d_ scale[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - ma77pkgtype_d_* anorm -); - -void ma77_enquire_posdef_d( - ma77pkgtype_d_ d[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -void ma77_enquire_indef_d( - int piv_order[], - ma77pkgtype_d_ d[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -void ma77_alter_d( - ma77pkgtype_d_ d[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -void ma77_restart_d( - const char* restart_file, - const char* fname1, - const char* fname2, - const char* fname3, - const char* fname4, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -/* exists only for HSL 2013 */ -void ma77_solve_fredholm_d( - int nrhs, - int flag_out[], - int lx, - ma77pkgtype_d_ x[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const ma77pkgtype_d_* scale -); - -/* exists only for HSL 2013 */ -void ma77_lmultiply_d( - int trans, - int k, - int lx, - ma77pkgtype_d_ x[], - int ly, - ma77pkgtype_d_ y[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const ma77pkgtype_d_* scale -); - -/** To clean up memory in keep */ -void ma77_finalise_d( - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); +/* Initialise control with default values */ +void ma77_default_control_d(struct ma77_control_d *control); +void ma77_open_nelt(const int n, const char* fname1, const char* fname2, + const char *fname3, const char *fname4, void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info, + const int nelt); +void ma77_open_d(const int n, const char* fname1, const char* fname2, + const char *fname3, const char *fname4, void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info); +void ma77_input_vars(const int idx, const int nvar, const int list[], + void **keep, const struct ma77_control_d *control, struct ma77_info_d *info); +void ma77_input_reals_d(const int idx, const int length, + const ma77pkgtype_d_ reals[], void **keep, const struct ma77_control_d *control, + struct ma77_info_d *info); +/* Analyse the sparsity pattern and prepare for factorization */ +void ma77_analyse(const int order[], void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info); +/* To factorize the matrix */ +void ma77_factor_d(const int posdef, void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info, + const ma77pkgtype_d_ *scale); +/* To factorize the matrix AND solve AX = B */ +void ma77_factor_solve_d(const int posdef, void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info, + const ma77pkgtype_d_ *scale, const int nrhs, const int lx, + ma77pkgtype_d_ rhs[]); +/* To solve AX = B using the computed factors */ +void ma77_solve_d(const int job, const int nrhs, const int lx, ma77pkgtype_d_ x[], + void **keep, const struct ma77_control_d *control, struct ma77_info_d *info, + const ma77pkgtype_d_ *scale); +void ma77_resid_d(const int nrhs, const int lx, const ma77pkgtype_d_ x[], + const int lresid, ma77pkgtype_d_ resid[], void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info, + ma77pkgtype_d_ *anorm_bnd); +void ma77_scale_d(ma77pkgtype_d_ scale[], void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info, + ma77pkgtype_d_ *anorm); +void ma77_enquire_posdef_d(ma77pkgtype_d_ d[], void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info); +void ma77_enquire_indef_d(int piv_order[], ma77pkgtype_d_ d[], void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info); +void ma77_alter_d(const ma77pkgtype_d_ d[], void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info); +void ma77_restart_d(const char *restart_file, const char *fname1, + const char *fname2, const char *fname3, const char *fname4, void **keep, + const struct ma77_control_d *control, struct ma77_info_d *info); +void ma77_solve_fredholm_d(int nrhs, int flag_out[], int lx, ma77pkgtype_d_ x[], + void **keep, const struct ma77_control_d *control, + struct ma77_info_d *info, const ma77pkgtype_d_ *scale); +void ma77_lmultiply_d(int trans, int k, int lx, ma77pkgtype_d_ x[], int ly, + ma77pkgtype_d_ y[], void **keep, const struct ma77_control_d *control, + struct ma77_info_d *info, const ma77pkgtype_d_ *scale); +/* To clean up memory in keep */ +void ma77_finalise_d(void **keep, const struct ma77_control_d *control, + struct ma77_info_d *info); #endif diff --git a/src/Algorithm/LinearSolvers/hsl_ma77s.h b/src/Algorithm/LinearSolvers/hsl_ma77s.h new file mode 100644 index 000000000..ff7b92caf --- /dev/null +++ b/src/Algorithm/LinearSolvers/hsl_ma77s.h @@ -0,0 +1,220 @@ +/* + * COPYRIGHT (c) 2011 Science and Technology Facilities Council (STFC) + * Original date 18 May 2011 + * All rights reserved + * + * Written by: Jonathan Hogg + * + * THIS FILE ONLY may be redistributed under the below modified BSD licence. + * All other files distributed as part of the HSL_MA77 package + * require a licence to be obtained from STFC and may NOT be redistributed + * without permission. Please refer to your licence for HSL_MA77 for full terms + * and conditions. STFC may be contacted via hsl(at)stfc.ac.uk. + * + * Modified BSD licence (this header file only): + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of STFC nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL STFC BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef HSL_MA77S_H +#define HSL_MA77S_H + +#ifndef ma77_default_control +#define ma77_control ma77_control_s +#define ma77_info ma77_info_s +#define ma77_default_control ma77_default_control_s +#define ma77_open_nelt ma77_open_nelt_s +#define ma77_open ma77_open_s +#define ma77_input_vars ma77_input_vars_s +#define ma77_input_reals ma77_input_reals_s +#define ma77_analyse ma77_analyse_s +#define ma77_factor ma77_factor_s +#define ma77_factor_solve ma77_factor_solve_s +#define ma77_solve ma77_solve_s +#define ma77_resid ma77_resid_s +#define ma77_scale ma77_scale_s +#define ma77_enquire_posdef ma77_enquire_posdef_s +#define ma77_enquire_indef ma77_enquire_indef_s +#define ma77_alter ma77_alter_s +#define ma77_restart ma77_restart_s +#define ma77_finalise ma77_finalise_s +#define ma77_solve_fredholm ma77_solve_fredholm_s +#define ma77_lmultiply ma77_lmultiply_s +#endif + +typedef float ma77pkgtype_s_; + +/* Data type for user controls */ +struct ma77_control_s { + /* Note: 0 is false, non-zero is true */ + + /* C/Fortran interface related controls */ + int f_arrays; /* Treat arrays as 1-based (Fortran) if true or 0-based (C) if + false. */ + + /* Printing controls */ + int print_level; + int unit_diagnostics; /* unit for diagnostic messages + Printing is suppressed if unit_diagnostics < 0. */ + int unit_error; /* unit for error messages + Printing is suppressed if unit_error < 0. */ + int unit_warning; /* unit for warning messages + Printing is suppressed if unit_warning < 0. */ + + /* Controls used by MA77_open */ + int bits; + int buffer_lpage[2]; + int buffer_npage[2]; + long int file_size; + long int maxstore; + long int storage[3]; + + /* Controls used by MA77_analyse */ + int nemin; /* Node amalgamation parameter. A child node is merged with its + parent if they both involve fewer than nemin eliminations.*/ + + /* Controls used by MA77_scale */ + int maxit; + int infnorm; + ma77pkgtype_s_ thresh; + + /* Controls used by MA77_factor with posdef true */ + int nb54; + + /* Controls used by MA77_factor with posdef false */ + int action; /* Keep going even if matrix is singular if true, or abort + if false */ + ma77pkgtype_s_ multiplier; + int nb64; + int nbi; + ma77pkgtype_s_ small; + ma77pkgtype_s_ static_; + long int storage_indef; + ma77pkgtype_s_ u; /* Pivot tolerance*/ + ma77pkgtype_s_ umin; /* Minimum pivot tolerance*/ + + /* Controls used by ma77_solve_fredholm */ + ma77pkgtype_s_ consist_tol; /* Tolerance for consistent singular system */ + + /* Pad data structure to allow for future growth */ + int ispare[5]; long int lspare[5]; ma77pkgtype_s_ rspare[5]; +}; + +/***************************************************/ + +/* data type for returning information to user.*/ +struct ma77_info_s { + ma77pkgtype_s_ detlog; + int detsign; + int flag; + int iostat; + int matrix_dup; + int matrix_rank; + int matrix_outrange; + int maxdepth; + int maxfront; + long int minstore; + int ndelay; + long int nfactor; + long int nflops; + int niter; + int nsup; + int num_neg; + int num_nothresh; + int num_perturbed; + int ntwo; + int stat; + int index[4]; + long int nio_read[2]; + long int nio_write[2]; + long int nwd_read[2]; + long int nwd_write[2]; + int num_file[4]; + long int storage[4]; + int tree_nodes; + int unit_restart; + int unused; + ma77pkgtype_s_ usmall; + + /* Pad data structure to allow for future growth */ + int ispare[5]; long int lspare[5]; ma77pkgtype_s_ rspare[5]; +}; + +/* Initialise control with default values */ +void ma77_default_control_s(struct ma77_control_s *control); +void ma77_open_nelt_s(const int n, const char* fname1, const char* fname2, + const char *fname3, const char *fname4, void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info, + const int nelt); +void ma77_open_s(const int n, const char* fname1, const char* fname2, + const char *fname3, const char *fname4, void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info); +void ma77_input_vars_s(const int idx, const int nvar, const int list[], + void **keep, const struct ma77_control_s *control, struct ma77_info_s *info); +void ma77_input_reals_s(const int idx, const int length, + const ma77pkgtype_s_ reals[], void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info); +/* Analyse the sparsity pattern and prepare for factorization */ +void ma77_analyse_s(const int order[], void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info); +/* To factorize the matrix */ +void ma77_factor_s(const int posdef, void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info, + const ma77pkgtype_s_ *scale); +/* To factorize the matrix AND solve AX = B */ +void ma77_factor_solve_s(const int posdef, void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info, + const ma77pkgtype_s_ *scale, const int nrhs, const int lx, + ma77pkgtype_s_ rhs[]); +/* To solve AX = B using the computed factors */ +void ma77_solve_s(const int job, const int nrhs, const int lx, ma77pkgtype_s_ x[], + void **keep, const struct ma77_control_s *control, struct ma77_info_s *info, + const ma77pkgtype_s_ *scale); +void ma77_resid_s(const int nrhs, const int lx, const ma77pkgtype_s_ x[], + const int lresid, ma77pkgtype_s_ resid[], void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info, + ma77pkgtype_s_ *anorm_bnd); +void ma77_scale_s(ma77pkgtype_s_ scale[], void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info, + ma77pkgtype_s_ *anorm); +void ma77_enquire_posdef_s(ma77pkgtype_s_ d[], void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info); +void ma77_enquire_indef_s(int piv_order[], ma77pkgtype_s_ d[], void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info); +void ma77_alter_s(const ma77pkgtype_s_ d[], void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info); +void ma77_restart_s(const char *restart_file, const char *fname1, + const char *fname2, const char *fname3, const char *fname4, void **keep, + const struct ma77_control_s *control, struct ma77_info_s *info); +void ma77_solve_fredholm_s(int nrhs, int flag_out[], int lx, ma77pkgtype_s_ x[], + void **keep, const struct ma77_control_s *control, + struct ma77_info_s *info, const ma77pkgtype_s_ *scale); +void ma77_lmultiply_s(int trans, int k, int lx, ma77pkgtype_s_ x[], int ly, + ma77pkgtype_s_ y[], void **keep, const struct ma77_control_s *control, + struct ma77_info_s *info, const ma77pkgtype_s_ *scale); +/* To clean up memory in keep */ +void ma77_finalise_s(void **keep, const struct ma77_control_s *control, + struct ma77_info_s *info); + +#endif diff --git a/src/Algorithm/LinearSolvers/hsl_ma86d.h b/src/Algorithm/LinearSolvers/hsl_ma86d.h index 621c3cfbc..590453eb9 100644 --- a/src/Algorithm/LinearSolvers/hsl_ma86d.h +++ b/src/Algorithm/LinearSolvers/hsl_ma86d.h @@ -1,8 +1,40 @@ -/* COPYRIGHT (c) 2011 Science and Technology Facilities Council (STFC) - * All Rights Reserved. - * This code is published under the Eclipse Public License. +/* + * COPYRIGHT (c) 2011 Science and Technology Facilities Council (STFC) + * Original date 25 Feburary 2011 + * All rights reserved + * + * Written by: Jonathan Hogg + * + * THIS FILE ONLY may be redistributed under the below modified BSD licence. + * All other files distributed as part of the HSL_MA86 package + * require a licence to be obtained from STFC and may NOT be redistributed + * without permission. Please refer to your licence for HSL_MA86 for full terms + * and conditions. STFC may be contacted via hsl(at)stfc.ac.uk. + * + * Modified BSD licence (this header file only): + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of STFC nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL STFC BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Authors: Jonathan Hogg STFC 2011-02-25 */ #ifndef HSL_MA86D_H @@ -22,168 +54,92 @@ typedef double ma86pkgtype_d_; typedef double ma86realtype_d_; -/** Data type for user controls - * - * @note 0 is false, non-zero is true - */ -struct ma86_control_d -{ - /** @name C/Fortran interface related controls - * @{ - */ - /** Treat arrays as 1-based (Fortran) if true or 0-based (C) if false. */ - int f_arrays; - /** @} */ - - /** @name Printing controls - * @{ - */ - /** Controls diagnostic printing - * - * Possible values are: - * - < 0: no printing. - * - 0: error and warning messages only. - * - 1: as 0 plus basic diagnostic printing. - * - 2: as 1 plus some more detailed diagnostic messages. - * - 3: as 2 plus all entries of user-supplied arrays. - */ - int diagnostics_level; - /** unit for diagnostic messages - * - * Printing is suppressed if unit_diagnostics < 0. - */ - int unit_diagnostics; - /** unit for error messages - * - * Printing is suppressed if unit_error < 0. - */ - int unit_error; - /** unit for warning messages - * - * Printing is suppressed if unit_warning < 0. - */ - int unit_warning; - /** @} */ - - /** @name Controls used by ma86_analyse - * @{ - */ - /** Node amalgamation parameter. - * - * A child node is merged with its parent if they both involve fewer than nemin eliminations - */ - int nemin; - /* Controls the size of the blocks used within each node (used to set nb within node_type - */ - int nb; - /** @} */ - - /** @name Controls used by ma86_factor and ma86_factor_solve - * @{ - */ - /** Keep going even if matrix is singular if true, or abort if false */ - int action; - /** Inner block size for use with ma64*/ - int nbi; - /** Size of task pool arrays*/ - int pool_size; - /** Pivots less than small are treated as zero*/ - ma86realtype_d_ small_; - /** Control static pivoting*/ - ma86realtype_d_ static_; - /** Pivot tolerance*/ - ma86realtype_d_ u; - /** Minimum pivot tolerance*/ - ma86realtype_d_ umin; - /** Scaling algorithm to use */ - int scaling; +/* Data type for user controls */ +struct ma86_control_d { + /* Note: 0 is false, non-zero is true */ + + /* C/Fortran interface related controls */ + int f_arrays; /* Treat arrays as 1-based (Fortran) if true or 0-based (C) if + false. */ + + /* Printing controls */ + int diagnostics_level; /* Controls diagnostic printing.*/ + /* Possible values are: + < 0: no printing. + 0: error and warning messages only. + 1: as 0 plus basic diagnostic printing. + 2: as 1 plus some more detailed diagnostic messages. + 3: as 2 plus all entries of user-supplied arrays. */ + int unit_diagnostics; /* unit for diagnostic messages + Printing is suppressed if unit_diagnostics < 0. */ + int unit_error; /* unit for error messages + Printing is suppressed if unit_error < 0. */ + int unit_warning; /* unit for warning messages + Printing is suppressed if unit_warning < 0. */ + + /* Controls used by ma86_analyse */ + int nemin; /* Node amalgamation parameter. A child node is merged with its + parent if they both involve fewer than nemin eliminations.*/ + int nb; /* Controls the size of the blocks used within each node (used to + set nb within node_type)*/ + + /* Controls used by ma86_factor and ma86_factor_solve */ + int action; /* Keep going even if matrix is singular if true, or abort + if false */ + int nbi; /* Inner block size for use with ma64*/ + int pool_size; /* Size of task pool arrays*/ + ma86realtype_d_ small_; /* Pivots less than small are treated as zero*/ + ma86realtype_d_ static_;/* Control static pivoting*/ + ma86realtype_d_ u; /* Pivot tolerance*/ + ma86realtype_d_ umin; /* Minimum pivot tolerance*/ + int scaling; /* Scaling algorithm to use */ }; /***************************************************/ -/** data type for returning information to user */ -struct ma86_info_d -{ - ma86realtype_d_ detlog; /**< Holds logarithm of abs det A (or 0) */ - int detsign; /**< Holds sign of determinant (+/-1 or 0) */ - int flag; /**< Error return flag (0 on success) */ - int matrix_rank; /**< Rank of matrix */ - int maxdepth; /**< Maximum depth of the tree. */ - int num_delay; /**< Number of delayed pivots */ - long num_factor; /**< Number of entries in the factor. */ - long num_flops; /**< Number of flops for factor. */ - int num_neg; /**< Number of negative pivots */ - int num_nodes; /**< Number of nodes */ - int num_nothresh; /**< Number of pivots not satisfying u */ - int num_perturbed; /**< Number of perturbed pivots */ - int num_two; /**< Number of 2x2 pivots */ - int pool_size; /**< Maximum size of task pool used */ - int stat; /**< STAT value on error return -1. */ - ma86realtype_d_ usmall; /**< smallest threshold parameter used */ +/* data type for returning information to user.*/ +struct ma86_info_d { + ma86realtype_d_ detlog; /* Holds logarithm of abs det A (or 0) */ + int detsign; /* Holds sign of determinant (+/-1 or 0) */ + int flag; /* Error return flag (0 on success) */ + int matrix_rank; /* Rank of matrix */ + int maxdepth; /* Maximum depth of the tree. */ + int num_delay; /* Number of delayed pivots */ + long num_factor; /* Number of entries in the factor. */ + long num_flops; /* Number of flops for factor. */ + int num_neg; /* Number of negative pivots */ + int num_nodes; /* Number of nodes */ + int num_nothresh; /* Number of pivots not satisfying u */ + int num_perturbed; /* Number of perturbed pivots */ + int num_two; /* Number of 2x2 pivots */ + int pool_size; /* Maximum size of task pool used */ + int stat; /* STAT value on error return -1. */ + ma86realtype_d_ usmall; /* smallest threshold parameter used */ }; -/** Initialise control with default values */ -void ma86_default_control_d( - struct ma86_control_d* control -); - -/** Analyse the sparsity pattern and prepare for factorization */ -void ma86_analyse_d( - const int n, - const int ptr[], - const int row[], - int order[], - void** keep, - const struct ma86_control_d* control, - struct ma86_info_d* info -); - -/** To factorize the matrix */ -void ma86_factor_d( - const int n, - const int ptr[], - const int row[], - const ma86pkgtype_d_ val[], - const int order[], - void** keep, - const struct ma86_control_d* control, - struct ma86_info_d* info, - const ma86realtype_d_ scale[] -); - -/** To factorize the matrix AND solve AX = B */ -void ma86_factor_solve_d( - const int n, - const int ptr[], - const int row[], - const ma86pkgtype_d_ val[], - const int order[], - void** keep, - const struct ma86_control_d* control, - struct ma86_info_d* info, - const int nrhs, - const int ldx, - ma86pkgtype_d_ x[], - const ma86realtype_d_ scale[] -); - -/** To solve AX = B using the computed factors */ -void ma86_solve_d( - const int job, - const int nrhs, - const int ldx, - ma86pkgtype_d_* x, - const int order[], - void** keep, - const struct ma86_control_d* control, - struct ma86_info_d* info, - const ma86realtype_d_ scale[] -); - -/** To clean up memory in keep */ -void ma86_finalise_d( - void** keep, - const struct ma86_control_d* control -); +/* Initialise control with default values */ +void ma86_default_control_d(struct ma86_control_d *control); +/* Analyse the sparsity pattern and prepare for factorization */ +void ma86_analyse_d(const int n, const int ptr[], const int row[], int order[], + void **keep, const struct ma86_control_d *control, + struct ma86_info_d *info); +/* To factorize the matrix */ +void ma86_factor_d(const int n, const int ptr[], const int row[], + const ma86pkgtype_d_ val[], const int order[], void **keep, + const struct ma86_control_d *control, struct ma86_info_d *info, + const ma86realtype_d_ scale[]); +/* To factorize the matrix AND solve AX = B */ +void ma86_factor_solve_d(const int n, const int ptr[], const int row[], + const ma86pkgtype_d_ val[], const int order[], void **keep, + const struct ma86_control_d *control, struct ma86_info_d *info, + const int nrhs, const int ldx, ma86pkgtype_d_ x[], + const ma86realtype_d_ scale[]); +/* To solve AX = B using the computed factors */ +void ma86_solve_d(const int job, const int nrhs, const int ldx, + ma86pkgtype_d_ *x, const int order[], void **keep, + const struct ma86_control_d *control, struct ma86_info_d *info, + const ma86realtype_d_ scale[]); +/* To clean up memory in keep */ +void ma86_finalise_d(void **keep, const struct ma86_control_d *control); #endif diff --git a/src/Algorithm/LinearSolvers/hsl_ma86s.h b/src/Algorithm/LinearSolvers/hsl_ma86s.h new file mode 100644 index 000000000..4fbab91d1 --- /dev/null +++ b/src/Algorithm/LinearSolvers/hsl_ma86s.h @@ -0,0 +1,145 @@ +/* + * COPYRIGHT (c) 2011 Science and Technology Facilities Council (STFC) + * Original date 25 Feburary 2011 + * All rights reserved + * + * Written by: Jonathan Hogg + * + * THIS FILE ONLY may be redistributed under the below modified BSD licence. + * All other files distributed as part of the HSL_MA86 package + * require a licence to be obtained from STFC and may NOT be redistributed + * without permission. Please refer to your licence for HSL_MA86 for full terms + * and conditions. STFC may be contacted via hsl(at)stfc.ac.uk. + * + * Modified BSD licence (this header file only): + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of STFC nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL STFC BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef HSL_MA86S_H +#define HSL_MA86S_H + +#ifndef ma86_default_control +#define ma86_control ma86_control_s +#define ma86_info ma86_info_s +#define ma86_default_control ma86_default_control_s +#define ma86_analyse ma86_analyse_s +#define ma86_factor ma86_factor_s +#define ma86_factor_solve ma86_factor_solve_s +#define ma86_solve ma86_solve_s +#define ma86_finalise ma86_finalise_s +#endif + +typedef float ma86pkgtype_s_; +typedef float ma86realtype_s_; + +/* Data type for user controls */ +struct ma86_control_s { + /* Note: 0 is false, non-zero is true */ + + /* C/Fortran interface related controls */ + int f_arrays; /* Treat arrays as 1-based (Fortran) if true or 0-based (C) if + false. */ + + /* Printing controls */ + int diagnostics_level; /* Controls diagnostic printing.*/ + /* Possible values are: + < 0: no printing. + 0: error and warning messages only. + 1: as 0 plus basic diagnostic printing. + 2: as 1 plus some more detailed diagnostic messages. + 3: as 2 plus all entries of user-supplied arrays. */ + int unit_diagnostics; /* unit for diagnostic messages + Printing is suppressed if unit_diagnostics < 0. */ + int unit_error; /* unit for error messages + Printing is suppressed if unit_error < 0. */ + int unit_warning; /* unit for warning messages + Printing is suppressed if unit_warning < 0. */ + + /* Controls used by ma86_analyse */ + int nemin; /* Node amalgamation parameter. A child node is merged with its + parent if they both involve fewer than nemin eliminations.*/ + int nb; /* Controls the size of the blocks used within each node (used to + set nb within node_type)*/ + + /* Controls used by ma86_factor and ma86_factor_solve */ + int action; /* Keep going even if matrix is singular if true, or abort + if false */ + int nbi; /* Inner block size for use with ma64*/ + int pool_size; /* Size of task pool arrays*/ + ma86realtype_s_ small_; /* Pivots less than small are treated as zero*/ + ma86realtype_s_ static_;/* Control static pivoting*/ + ma86realtype_s_ u; /* Pivot tolerance*/ + ma86realtype_s_ umin; /* Minimum pivot tolerance*/ + int scaling; /* Scaling algorithm to use */ +}; + +/***************************************************/ + +/* data type for returning information to user.*/ +struct ma86_info_s { + ma86realtype_s_ detlog; /* Holds logarithm of abs det A (or 0) */ + int detsign; /* Holds sign of determinant (+/-1 or 0) */ + int flag; /* Error return flag (0 on success) */ + int matrix_rank; /* Rank of matrix */ + int maxdepth; /* Maximum depth of the tree. */ + int num_delay; /* Number of delayed pivots */ + long num_factor; /* Number of entries in the factor. */ + long num_flops; /* Number of flops for factor. */ + int num_neg; /* Number of negative pivots */ + int num_nodes; /* Number of nodes */ + int num_nothresh; /* Number of pivots not satisfying u */ + int num_perturbed; /* Number of perturbed pivots */ + int num_two; /* Number of 2x2 pivots */ + int pool_size; /* Maximum size of task pool used */ + int stat; /* STAT value on error return -1. */ + ma86realtype_s_ usmall; /* smallest threshold parameter used */ +}; + +/* Initialise control with default values */ +void ma86_default_control_s(struct ma86_control_s *control); +/* Analyse the sparsity pattern and prepare for factorization */ +void ma86_analyse_s(const int n, const int ptr[], const int row[], int order[], + void **keep, const struct ma86_control_s *control, + struct ma86_info_s *info); +/* To factorize the matrix */ +void ma86_factor_s(const int n, const int ptr[], const int row[], + const ma86pkgtype_s_ val[], const int order[], void **keep, + const struct ma86_control_s *control, struct ma86_info_s *info, + const ma86realtype_s_ scale[]); +/* To factorize the matrix AND solve AX = B */ +void ma86_factor_solve_s(const int n, const int ptr[], const int row[], + const ma86pkgtype_s_ val[], const int order[], void **keep, + const struct ma86_control_s *control, struct ma86_info_s *info, + const int nrhs, const int ldx, ma86pkgtype_s_ x[], + const ma86realtype_s_ scale[]); +/* To solve AX = B using the computed factors */ +void ma86_solve_s(const int job, const int nrhs, const int ldx, + ma86pkgtype_s_ *x, const int order[], void **keep, + const struct ma86_control_s *control, struct ma86_info_s *info, + const ma86realtype_s_ scale[]); +/* To clean up memory in keep */ +void ma86_finalise_s(void **keep, const struct ma86_control_s *control); + +#endif diff --git a/src/Algorithm/LinearSolvers/hsl_ma97d.h b/src/Algorithm/LinearSolvers/hsl_ma97d.h index c3e48eb2c..9f4a4235b 100644 --- a/src/Algorithm/LinearSolvers/hsl_ma97d.h +++ b/src/Algorithm/LinearSolvers/hsl_ma97d.h @@ -1,8 +1,42 @@ -/* COPYRIGHT (c) 2012 The Science and Technology Facilities Council (STFC) - * All Rights Reserved. - * This code is published under the Eclipse Public License. +/* + * COPYRIGHT (c) 2011 Science and Technology Facilities Council (STFC) + * Original date 20 September 2011 + * All rights reserved + * + * Written by: Jonathan Hogg + * + * Version 2.8.0 + * + * THIS FILE ONLY may be redistributed under the below modified BSD licence. + * All other files distributed as part of the HSL_MA97 package + * require a licence to be obtained from STFC and may NOT be redistributed + * without permission. Please refer to your licence for HSL_MA97 for full terms + * and conditions. STFC may be contacted via hsl(at)stfc.ac.uk. + * + * Modified BSD licence (this header file only): + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of STFC nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL STFC BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Authors: Jonathan Hogg STFC 2012-12-21 */ #ifndef HSL_MA97D_H @@ -31,220 +65,114 @@ typedef double ma97pkgtype_d_; typedef double ma97realtype_d_; -struct ma97_control_d -{ - int f_arrays; /**< Use C or Fortran numbering */ - int action; /**< Continue on singularity if !=0 (true), otherwise abort */ - int nemin; /**< Supernode amalgamation if parent and child have fewer than nemin eliminations */ - ma97realtype_d_ multiplier; /**< Amount of extra memory to allow for delays */ - /** Control scaling algorithm used: - * - * - 0 - user supplied order (order absent=identity) - * - 1 - AMD - * - 2 - MD (as in MA27) - * - 3 - METIS nested dissection - * - 4 - MA47 - * - 5 - Automatic choice between 1 and 3 - */ - int ordering; - int print_level; /**< <0 for no printing, 0 for basic, >1 for most */ - int scaling; /**< 0 user/none, 1 mc64, 2 mc77 */ - ma97realtype_d_ small; /**< Minimum value to count as non-zero */ - ma97realtype_d_ u; /**< Pivoting parameter */ - int unit_diagnostics; /**< Fortran unit for diagnostics (<0 disables) */ - int unit_error; /**< Fortran unit for error msgs (<0 disables) */ - int unit_warning; /**< Fortran unit for warning msgs (<0 disables) */ - long factor_min; /**< Min number of flops for parallel execution */ - int solve_blas3; /**< Use BLAS3 in solve in true, else BLAS2 */ - long solve_min; /**< Min number of entries for parallel execution */ - int solve_mf; /**< If true use m/f solve, else use s/n */ - ma97realtype_d_ consist_tol; /**< Consistent equation tolerance */ - - /* Reserve space for future interface changes */ - int ispare[5]; - ma97realtype_d_ rspare[10]; +struct ma97_control_d { + int f_arrays; /* Use C or Fortran numbering */ + int action; /* Continue on singularity if !=0 (true), + otherwise abort */ + int nemin; /* Supernode amalgamation if parent and child + have fewer than nemin eliminations */ + ma97realtype_d_ multiplier;/* Amount of extra memory to allow for delays */ + int ordering; /* Control scaling algorithm used: + 0 - user supplied order (order absent=identity) + 1 - AMD + 2 - MD (as in MA27) + 3 - METIS nested dissection + 4 - MA47 + 5 - Automatic choice between 1 and 3 */ + int print_level; /* <0 for no printing, 0 for basic, >1 for most */ + int scaling; /* 0 user/none, 1 mc64, 2 mc77 */ + ma97realtype_d_ small; /* Minimum value to count as non-zero */ + ma97realtype_d_ u; /* Pivoting parameter */ + int unit_diagnostics; /* Fortran unit for diagnostics (<0 disables) */ + int unit_error; /* Fortran unit for error msgs (<0 disables) */ + int unit_warning; /* Fortran unit for warning msgs (<0 disables) */ + long factor_min; /* Min number of flops for parallel execution */ + int solve_blas3; /* Use BLAS3 in solve in true, else BLAS2 */ + long solve_min; /* Min number of entries for parallel exection */ + int solve_mf; /* If true use m/f solve, else use s/n */ + ma97realtype_d_ consist_tol; /* Consistent equation tolerance */ + + /* Reserve space for future interface changes */ + int ispare[5]; ma97realtype_d_ rspare[10]; }; -struct ma97_info -{ - int flag; /**< <0 on error */ - int flag68; - int flag77; - int matrix_dup; /**< number duplicate entries in A */ - int matrix_rank; /**< matrix rank */ - int matrix_outrange; /**< number of out of range entries in A */ - int matrix_missing_diag; /**< number of zero diagonal entries in A */ - int maxdepth; /**< height of assembly tree */ - int maxfront; /**< maximum dimension of frontal matrix */ - int num_delay; /**< number of times a pivot was delayed */ - long num_factor; /**< number of entries in L */ - long num_flops; /**< number of floating point operations */ - int num_neg; /**< number of negative pivots */ - int num_sup; /**< number of supernodes in assembly tree */ - int num_two; /**< number of 2x2 pivots */ - int ordering; /**< ordering used (as per control.ordering) */ - int stat; /**< error code from failed memory allocation */ - - /* Reserve space for future interface changes */ - int ispare[5]; - ma97realtype_d_ rspare[10]; +struct ma97_info_d { + int flag; /* <0 on error */ + int flag68; + int flag77; + int matrix_dup; /* number duplicate entries in A */ + int matrix_rank; /* matrix rank */ + int matrix_outrange; /* number of out of range entries in A */ + int matrix_missing_diag; /* number of zero diagonal entries in A */ + int maxdepth; /* height of assembly tree */ + int maxfront; /* maximum no. rows in a supernode */ + int num_delay; /* number of times a pivot was delayed */ + long num_factor; /* number of entries in L */ + long num_flops; /* number of floating point operations */ + int num_neg; /* number of negative pivots */ + int num_sup; /* number of supernodes in assembly tree */ + int num_two; /* number of 2x2 pivots */ + int ordering; /* ordering used (as per control.ordering) */ + int stat; /* error code from failed memory allocation */ + int maxsupernode; /* maximum no. columns in a supernode */ + + /* Reserve space for future interface changes */ + int ispare[4]; ma97realtype_d_ rspare[10]; }; -/** Set default values of control */ -void ma97_default_control_d( - struct ma97_control_d* control -); - -/** Perform symbolic analysis of matrix (sparse column entry) */ -void ma97_analyse_d( - int check, - int n, - const int ptr[], - const int row[], - ma97pkgtype_d_ val[], - void** akeep, - const struct ma97_control_d* control, - struct ma97_info_d* info, - int order[] -); - -/** Perform symbolic analysis of matrix (coordinate entry) */ -void ma97_analyse_coord_d( - int n, - int ne, - const int row[], - const int col[], - ma97pkgtype_d_ val[], - void** akeep, - const struct ma97_control_d* control, - struct ma97_info_d* info, - int order[] -); - -/** Perform numerical factorization, following call to ma97_analyse */ -void ma97_factor_d( - int matrix_type, - const int ptr[], - const int row[], - const ma97pkgtype_d_ val[], - void** akeep, - void** fkeep, - const struct ma97_control_d* control, - struct ma97_info_d* info, - ma97realtype_d_ scale[] -); - -/** Perform numerical factorization and solve, following call to ma97_analyse */ -void ma97_factor_solve_d( - int matrix_type, - const int ptr[], - const int row[], - const ma97pkgtype_d_ val[], - int nrhs, - ma97pkgtype_d_ x[], - int ldx, - void** akeep, - void** fkeep, - const struct ma97_control_d* control, - struct ma97_info_d* info, - ma97realtype_d_ scale[] -); - -/** Perform forward and back substitutions, following call to ma97_factor */ -void ma97_solve_d( - int job, - int nrhs, - ma97pkgtype_d_ x[], - int ldx, - void** akeep, - void** fkeep, - const struct ma97_control_d* control, - struct ma97_info_d* info -); - -/** Free memory in akeep */ -void ma97_free_akeep_d( - void** akeep -); - -/** Free memory in fkeep */ -void ma97_free_fkeep_d( - void** fkeep -); - -/** Free memory in akeep and fkeep */ -void ma97_finalise_d( - void** akeep, - void** fkeep -); - -/** Return diagonal entries of L */ -void ma97_enquire_posdef_d( - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info, - ma97realtype_d_ d[] -); - -/** Return diagonal, subdiagonal and/or pivot order of D */ -void ma97_enquire_indef_d( - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info, - int* piv_order, - ma97pkgtype_d_* d -); - -/** Alter diagonal and subdiagonal of D */ -void ma97_alter_d( - const ma97pkgtype_d_ d[], - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info -); - -/** Fredholm alternative for singular systems */ -void ma97_solve_fredholm_d( - int nrhs, - int flag_out[], - ma97pkgtype_d_ x[], - int ldx, - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info -); - -/** Form (S^{-1}PL) X or (S^{-1}PL)^T X */ -void ma97_lmultiply_d( - int trans, - int k, - const ma97pkgtype_d_ x[], - int ldx, - ma97pkgtype_d_ y[], - int ldy, - void** akeep, - void** fkeep, - const struct ma97_control_d* control, - struct ma97_info_d* info -); - -/** Perform a sparse forward solve */ -void ma97_sparse_fwd_solve_d( - int nbi, - const int bindex[], - const ma97pkgtype_d_ b[], - const int order[], - int* nxi, - int xindex[], - ma97pkgtype_d_ x[], - void** akeep, - void** fkeep, - const struct ma97_control_d* control, - struct ma97_info_d* info -); +/* Set default values of control */ +void ma97_default_control_d(struct ma97_control_d *control); +/* Perform symbolic analysis of matrix (sparse column entry) */ +void ma97_analyse_d(int check, int n, const int ptr[], const int row[], + ma97pkgtype_d_ val[], void **akeep, const struct ma97_control_d *control, + struct ma97_info_d *info, int order[]); +/* Perform symbolic analysis of matrix (coordinate entry) */ +void ma97_analyse_coord_d(int n, int ne, const int row[], const int col[], + ma97pkgtype_d_ val[], void **akeep, const struct ma97_control_d *control, + struct ma97_info_d *info, int order[]); +/* Perform numerical factorization, following call to ma97_analyse */ +void ma97_factor_d(int matrix_type, const int ptr[], const int row[], + const ma97pkgtype_d_ val[], void **akeep, void **fkeep, + const struct ma97_control_d *control, struct ma97_info_d *info, + ma97realtype_d_ scale[]); +/* Perform numerical factorization and solve, following call to ma97_analyse */ +void ma97_factor_solve_d(int matrix_type, const int ptr[], const int row[], + const ma97pkgtype_d_ val[], int nrhs, ma97pkgtype_d_ x[], int ldx, + void **akeep, void **fkeep, const struct ma97_control_d *control, + struct ma97_info_d *info, ma97realtype_d_ scale[]); +/* Perform forward and back substitutions, following call to ma97_factor */ +void ma97_solve_d(int job, int nrhs, ma97pkgtype_d_ x[], int ldx, + void **akeep, void **fkeep, const struct ma97_control_d *control, + struct ma97_info_d *info); +/* Free memory in akeep */ +void ma97_free_akeep_d(void **akeep); +/* Free memory in fkeep */ +void ma97_free_fkeep_d(void **fkeep); +/* Free memory in akeep and fkeep */ +void ma97_finalise_d(void **akeep, void **fkeep); +/* Return diagonal entries of L */ +void ma97_enquire_posdef_d(void **akeep, void **fkeep, + const struct ma97_control *control, struct ma97_info *info, + ma97realtype_d_ d[]); +/* Return diagonal, subdiagonal and/or pivot order of D */ +void ma97_enquire_indef_d(void **akeep, void **fkeep, + const struct ma97_control *control, struct ma97_info *info, + int *piv_order, ma97pkgtype_d_ *d); +/* Alter diagonal and subdiagonal of D */ +void ma97_alter_d(const ma97pkgtype_d_ d[], void **akeep, void **fkeep, + const struct ma97_control *control, struct ma97_info *info); +/* Fredholm alternative for singular systems */ +void ma97_solve_fredholm_d(int nrhs, int flag_out[], ma97pkgtype_d_ x[], + int ldx, void **akeep, void **fkeep, const struct ma97_control_d *control, + struct ma97_info_d *info); +/* Form (S^{-1}PL) X or (S^{-1}PL)^T X */ +void ma97_lmultiply_d(int trans, int k, const ma97pkgtype_d_ x[], int ldx, + ma97pkgtype_d_ y[], int ldy, void **akeep, void **fkeep, + const struct ma97_control_d *control, struct ma97_info_d *info); +/* Perform a sparse forward solve */ +void ma97_sparse_fwd_solve_d(int nbi, const int bindex[], + const ma97pkgtype_d_ b[], const int order[], int *nxi, int xindex[], + ma97pkgtype_d_ x[], void **akeep, void **fkeep, + const struct ma97_control_d *control, struct ma97_info_d *info); #endif diff --git a/src/Algorithm/LinearSolvers/hsl_ma97s.h b/src/Algorithm/LinearSolvers/hsl_ma97s.h new file mode 100644 index 000000000..54ca3b7ca --- /dev/null +++ b/src/Algorithm/LinearSolvers/hsl_ma97s.h @@ -0,0 +1,178 @@ +/* + * COPYRIGHT (c) 2011 Science and Technology Facilities Council (STFC) + * Original date 20 September 2011 + * All rights reserved + * + * Written by: Jonathan Hogg + * + * Version 2.8.0 + * + * THIS FILE ONLY may be redistributed under the below modified BSD licence. + * All other files distributed as part of the HSL_MA97 package + * require a licence to be obtained from STFC and may NOT be redistributed + * without permission. Please refer to your licence for HSL_MA97 for full terms + * and conditions. STFC may be contacted via hsl(at)stfc.ac.uk. + * + * Modified BSD licence (this header file only): + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of STFC nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL STFC BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef HSL_MA97S_H +#define HSL_MA97S_H + +#ifndef ma97_default_control +#define ma97_control ma97_control_s +#define ma97_info ma97_info_s +#define ma97_default_control ma97_default_control_s +#define ma97_analyse ma97_analyse_s +#define ma97_analyse_coord ma97_analyse_coord_s +#define ma97_factor ma97_factor_s +#define ma97_factor_solve ma97_factor_solve_s +#define ma97_solve ma97_solve_s +#define ma97_free_akeep ma97_free_akeep_s +#define ma97_free_fkeep ma97_free_fkeep_s +#define ma97_finalise ma97_finalise_s +#define ma97_enquire_posdef ma97_enquire_posdef_s +#define ma97_enquire_indef ma97_enquire_indef_s +#define ma97_alter ma97_alter_s +#define ma97_solve_fredholm ma97_solve_fredholm_s +#define ma97_lmultiply ma97_lmultiply_s +#define ma97_sparse_fwd_solve ma97_sparse_fwd_solve_s +#endif + +typedef float ma97pkgtype_s_; +typedef float ma97realtype_s_; + +struct ma97_control_s { + int f_arrays; /* Use C or Fortran numbering */ + int action; /* Continue on singularity if !=0 (true), + otherwise abort */ + int nemin; /* Supernode amalgamation if parent and child + have fewer than nemin eliminations */ + ma97realtype_s_ multiplier;/* Amount of extra memory to allow for delays */ + int ordering; /* Control scaling algorithm used: + 0 - user supplied order (order absent=identity) + 1 - AMD + 2 - MD (as in MA27) + 3 - METIS nested dissection + 4 - MA47 + 5 - Automatic choice between 1 and 3 */ + int print_level; /* <0 for no printing, 0 for basic, >1 for most */ + int scaling; /* 0 user/none, 1 mc64, 2 mc77 */ + ma97realtype_s_ small; /* Minimum value to count as non-zero */ + ma97realtype_s_ u; /* Pivoting parameter */ + int unit_diagnostics; /* Fortran unit for diagnostics (<0 disables) */ + int unit_error; /* Fortran unit for error msgs (<0 disables) */ + int unit_warning; /* Fortran unit for warning msgs (<0 disables) */ + long factor_min; /* Min number of flops for parallel execution */ + int solve_blas3; /* Use BLAS3 in solve in true, else BLAS2 */ + long solve_min; /* Min number of entries for parallel exection */ + int solve_mf; /* If true use m/f solve, else use s/n */ + ma97realtype_s_ consist_tol; /* Consistent equation tolerance */ + + /* Reserve space for future interface changes */ + int ispare[5]; ma97realtype_s_ rspare[10]; +}; + +struct ma97_info_s { + int flag; /* <0 on error */ + int flag68; + int flag77; + int matrix_dup; /* number duplicate entries in A */ + int matrix_rank; /* matrix rank */ + int matrix_outrange; /* number of out of range entries in A */ + int matrix_missing_diag; /* number of zero diagonal entries in A */ + int maxdepth; /* height of assembly tree */ + int maxfront; /* maximum no. rows in a supernode */ + int num_delay; /* number of times a pivot was delayed */ + long num_factor; /* number of entries in L */ + long num_flops; /* number of floating point operations */ + int num_neg; /* number of negative pivots */ + int num_sup; /* number of supernodes in assembly tree */ + int num_two; /* number of 2x2 pivots */ + int ordering; /* ordering used (as per control.ordering) */ + int stat; /* error code from failed memory allocation */ + int maxsupernode; /* maximum no. columns in a supernode */ + + /* Reserve space for future interface changes */ + int ispare[4]; ma97realtype_s_ rspare[10]; +}; + +/* Set default values of control */ +void ma97_default_control_s(struct ma97_control_s *control); +/* Perform symbolic analysis of matrix (sparse column entry) */ +void ma97_analyse_s(int check, int n, const int ptr[], const int row[], + ma97pkgtype_s_ val[], void **akeep, const struct ma97_control_s *control, + struct ma97_info_s *info, int order[]); +/* Perform symbolic analysis of matrix (coordinate entry) */ +void ma97_analyse_coord_s(int n, int ne, const int row[], const int col[], + ma97pkgtype_s_ val[], void **akeep, const struct ma97_control_s *control, + struct ma97_info_s *info, int order[]); +/* Perform numerical factorization, following call to ma97_analyse */ +void ma97_factor_s(int matrix_type, const int ptr[], const int row[], + const ma97pkgtype_s_ val[], void **akeep, void **fkeep, + const struct ma97_control_s *control, struct ma97_info_s *info, + ma97realtype_s_ scale[]); +/* Perform numerical factorization and solve, following call to ma97_analyse */ +void ma97_factor_solve_s(int matrix_type, const int ptr[], const int row[], + const ma97pkgtype_s_ val[], int nrhs, ma97pkgtype_s_ x[], int ldx, + void **akeep, void **fkeep, const struct ma97_control_s *control, + struct ma97_info_s *info, ma97realtype_s_ scale[]); +/* Perform forward and back substitutions, following call to ma97_factor */ +void ma97_solve_s(int job, int nrhs, ma97pkgtype_s_ x[], int ldx, + void **akeep, void **fkeep, const struct ma97_control_s *control, + struct ma97_info_s *info); +/* Free memory in akeep */ +void ma97_free_akeep_s(void **akeep); +/* Free memory in fkeep */ +void ma97_free_fkeep_s(void **fkeep); +/* Free memory in akeep and fkeep */ +void ma97_finalise_s(void **akeep, void **fkeep); +/* Return diagonal entries of L */ +void ma97_enquire_posdef_s(void **akeep, void **fkeep, + const struct ma97_control *control, struct ma97_info *info, + ma97realtype_s_ d[]); +/* Return diagonal, subdiagonal and/or pivot order of D */ +void ma97_enquire_indef_s(void **akeep, void **fkeep, + const struct ma97_control *control, struct ma97_info *info, + int *piv_order, ma97pkgtype_s_ *d); +/* Alter diagonal and subdiagonal of D */ +void ma97_alter_s(const ma97pkgtype_s_ d[], void **akeep, void **fkeep, + const struct ma97_control *control, struct ma97_info *info); +/* Fredholm alternative for singular systems */ +void ma97_solve_fredholm_s(int nrhs, int flag_out[], ma97pkgtype_s_ x[], + int ldx, void **akeep, void **fkeep, const struct ma97_control_s *control, + struct ma97_info_s *info); +/* Form (S^{-1}PL) X or (S^{-1}PL)^T X */ +void ma97_lmultiply_s(int trans, int k, const ma97pkgtype_s_ x[], int ldx, + ma97pkgtype_s_ y[], int ldy, void **akeep, void **fkeep, + const struct ma97_control_s *control, struct ma97_info_s *info); +/* Perform a sparse forward solve */ +void ma97_sparse_fwd_solve_s(int nbi, const int bindex[], + const ma97pkgtype_s_ b[], const int order[], int *nxi, int xindex[], + ma97pkgtype_s_ x[], void **akeep, void **fkeep, + const struct ma97_control_s *control, struct ma97_info_s *info); + +#endif diff --git a/src/Algorithm/LinearSolvers/hsl_mc68i.h b/src/Algorithm/LinearSolvers/hsl_mc68i.h index 094c1c1e1..4ace4f562 100644 --- a/src/Algorithm/LinearSolvers/hsl_mc68i.h +++ b/src/Algorithm/LinearSolvers/hsl_mc68i.h @@ -1,19 +1,45 @@ -/* COPYRIGHT (c) 2011, 2013 Science and Technology Facilities Council (STFC) - * All Rights Reserved. - * This code is published under the Eclipse Public License. +/* + * COPYRIGHT (c) 2011 Science and Technology Facilities Council (STFC) + * Original date 2 March 2011 + * All rights reserved + * + * Written by: Jonathan Hogg + * + * THIS FILE ONLY may be redistributed under the below modified BSD licence. + * All other files distributed as part of the HSL_MC68 package + * require a licence to be obtained from STFC and may NOT be redistributed + * without permission. Please refer to your licence for HSL_MC68 for full terms + * and conditions. STFC may be contacted via hsl(at)stfc.ac.uk. + * + * Modified BSD licence (this header file only): + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of STFC nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL STFC BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Authors: Jonathan Hogg STFC 2011-02-25 */ -#ifndef HSL_MC68I_H -#define HSL_MC68I_H +#ifndef HSL_MC68I +#define HSL_MC68I -#include "IpoptConfig.h" -#ifdef COIN_HAS_HSL -#include "CoinHslConfig.h" -#endif - -/* if we do not have MC68, we assume its is loaded via the linear solver loader, for which we assume HSL 2013 */ #ifndef mc68_default_control #define mc68_control mc68_control_i #define mc68_info mc68_info_i @@ -21,62 +47,40 @@ #define mc68_order mc68_order_i #endif -struct mc68_control -{ - /** @name Extra options for C version - * @{ - */ - /** 0 for C array indexing, 1 for Fortran indexing */ - int f_array_in; - /** 0 for C array indexing, 1 for Fortran indexing - * - * @note 2x2 pivot information discarded if C indexing is used for output! - */ - int f_array_out; - long min_l_workspace; /**< Initial size of workspace, as argument in Fortran */ - /** @} */ - - /** @name Options from Fortran version - * @{ - */ - int lp; /**< stream number for error messages */ - int wp; /**< stream number for warning messages */ - int mp; /**< stream number for diagnostic messages */ - int nemin; /**< stream number for diagnostic messages */ - int print_level; /**< amount of informational output required */ - int row_full_thresh; /**< percentage threshold for full row */ - int row_search; /**< Number of rows searched for pivot with ord=6 */ - /** @} */ +struct mc68_control_i { + /* Extra options for C version */ + int f_array_in; /* 0 for C array indexing, 1 for Fortran indexing */ + int f_array_out; /* 0 for C array indexing, 1 for Fortran indexing + * NOTE: 2x2 pivot information discarded if C indexing + * is used for output! */ + int min_l_workspace; /* Initial size of workspace, as argument in Fortran */ + /* Options from Fortran version */ + int lp; /* stream number for error messages */ + int wp; /* stream number for warning messages */ + int mp; /* stream number for diagnostic messages */ + int nemin; /* stream number for diagnostic messages */ + int print_level; /* amount of informational output required */ + int row_full_thresh; /* percentage threshold for full row */ + int row_search; /* Number of rows searched for pivot with ord=6 */ }; -struct mc68_info -{ - int flag; /**< error/warning flag */ - int iostat; /**< holds Fortran iostat parameter */ - int stat; /**< holds Fortran stat parameter */ - int out_range; /**< holds number of out of range entries ignored */ - int duplicate; /**< holds number of duplicate entries */ - int n_compressions; /**< holds number of compressions in order */ - int n_zero_eigs; /**< holds the number of zero eigs from ma47 */ - long l_workspace; /**< holds length of workspace iw used in order */ - int zb01_info; /**< holds flag from zb01_expand1 call */ - int n_dense_rows; /**< holds number of dense rows from amdd */ +struct mc68_info_i { + int flag; /* error/warning flag */ + int iostat; /* holds Fortran iostat parameter */ + int stat; /* holds Fortran stat parameter */ + int out_range; /* holds number of out of range entries ignored */ + int duplicate; /* holds number of duplicate entries */ + int n_compressions; /* holds number of compressions in order */ + int n_zero_eigs; /* holds the number of zero eigs from ma47 */ + long l_workspace; /* holds length of workspace iw used in order */ + int zb01_info; /* holds flag from zb01_expand1 call */ + int n_dense_rows; /* holds number of dense rows from amdd */ }; -/** Set default values for control struct */ -void mc68_default_control( - struct mc68_control* control -); - -/** Perform ordering */ -void mc68_order( - int ord, - int n, - const int ptr[], - const int row[], - int perm[], - const struct mc68_control* control, - struct mc68_info* info -); +/* Set default values for control struct */ +void mc68_default_control_i(struct mc68_control *control); +/* Perform ordering */ +void mc68_order_i(int ord, int n, const int ptr[], const int row[], + int perm[], const struct mc68_control_i *control, struct mc68_info_i *info); #endif diff --git a/src/Algorithm/Makefile.am b/src/Algorithm/Makefile.am deleted file mode 100644 index d728375b3..000000000 --- a/src/Algorithm/Makefile.am +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (C) 2004, 2010 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -SUBDIRS = LinearSolvers Inexact - -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpAlgBuilder.hpp \ - IpAlgStrategy.hpp \ - IpAugSystemSolver.hpp \ - IpConvCheck.hpp \ - IpEqMultCalculator.hpp \ - IpHessianUpdater.hpp \ - IpIpoptAlg.hpp \ - IpIpoptCalculatedQuantities.hpp \ - IpIpoptData.hpp \ - IpIpoptNLP.hpp \ - IpIterateInitializer.hpp \ - IpIteratesVector.hpp \ - IpIterationOutput.hpp \ - IpOrigIpoptNLP.hpp \ - IpLineSearch.hpp \ - IpMuUpdate.hpp \ - IpNLPScaling.hpp \ - IpPDSystemSolver.hpp \ - IpSearchDirCalculator.hpp \ - IpTimingStatistics.hpp - -noinst_LTLIBRARIES = libipoptalg.la - -libipoptalg_la_SOURCES = \ - IpAdaptiveMuUpdate.cpp \ - IpAlgBuilder.cpp \ - IpAlgorithmRegOp.cpp \ - IpAugRestoSystemSolver.cpp \ - IpBacktrackingLineSearch.cpp \ - IpDefaultIterateInitializer.cpp \ - IpEquilibrationScaling.cpp \ - IpExactHessianUpdater.cpp \ - IpFilter.cpp \ - IpFilterLSAcceptor.cpp \ - IpGenAugSystemSolver.cpp \ - IpGradientScaling.cpp \ - IpIpoptAlg.cpp \ - IpIpoptCalculatedQuantities.cpp \ - IpIpoptData.cpp \ - IpIteratesVector.cpp \ - IpLeastSquareMults.cpp \ - IpLimMemQuasiNewtonUpdater.cpp \ - IpLoqoMuOracle.cpp \ - IpLowRankAugSystemSolver.cpp \ - IpLowRankSSAugSystemSolver.cpp \ - IpMonotoneMuUpdate.cpp \ - IpNLPBoundsRemover.cpp \ - IpNLPScaling.cpp \ - IpOptErrorConvCheck.cpp \ - IpOrigIpoptNLP.cpp \ - IpOrigIterationOutput.cpp \ - IpPDFullSpaceSolver.cpp \ - IpPDPerturbationHandler.cpp \ - IpPDSearchDirCalc.cpp \ - IpPenaltyLSAcceptor.cpp \ - IpProbingMuOracle.cpp \ - IpQualityFunctionMuOracle.cpp \ - IpRestoConvCheck.cpp \ - IpRestoFilterConvCheck.cpp \ - IpRestoIpoptNLP.cpp \ - IpRestoIterateInitializer.cpp \ - IpRestoIterationOutput.cpp \ - IpRestoMinC_1Nrm.cpp \ - IpRestoPenaltyConvCheck.cpp \ - IpRestoRestoPhase.cpp \ - IpStdAugSystemSolver.cpp \ - IpTimingStatistics.cpp \ - IpUserScaling.cpp \ - IpWarmStartIterateInitializer.cpp - -#libipoptalg_la_LDFLAGS = $(LT_LDFLAGS) - -AM_CPPFLAGS = \ - -I$(srcdir)/../Common \ - -I$(srcdir)/../LinAlg \ - -I$(srcdir)/../LinAlg/TMatrices \ - -I$(srcdir)/../Interfaces \ - -I$(srcdir)/LinearSolvers \ - -I$(srcdir)/../contrib/CGPenalty \ - -I$(srcdir)/../contrib/LinearSolverLoader \ - $(IPOPTLIB_CFLAGS) diff --git a/src/Algorithm/Makefile.in b/src/Algorithm/Makefile.in deleted file mode 100644 index daafe6800..000000000 --- a/src/Algorithm/Makefile.in +++ /dev/null @@ -1,1012 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2004, 2010 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - - -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/Algorithm -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -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 -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libipoptalg_la_LIBADD = -am_libipoptalg_la_OBJECTS = IpAdaptiveMuUpdate.lo IpAlgBuilder.lo \ - IpAlgorithmRegOp.lo IpAugRestoSystemSolver.lo \ - IpBacktrackingLineSearch.lo IpDefaultIterateInitializer.lo \ - IpEquilibrationScaling.lo IpExactHessianUpdater.lo IpFilter.lo \ - IpFilterLSAcceptor.lo IpGenAugSystemSolver.lo \ - IpGradientScaling.lo IpIpoptAlg.lo \ - IpIpoptCalculatedQuantities.lo IpIpoptData.lo \ - IpIteratesVector.lo IpLeastSquareMults.lo \ - IpLimMemQuasiNewtonUpdater.lo IpLoqoMuOracle.lo \ - IpLowRankAugSystemSolver.lo IpLowRankSSAugSystemSolver.lo \ - IpMonotoneMuUpdate.lo IpNLPBoundsRemover.lo IpNLPScaling.lo \ - IpOptErrorConvCheck.lo IpOrigIpoptNLP.lo \ - IpOrigIterationOutput.lo IpPDFullSpaceSolver.lo \ - IpPDPerturbationHandler.lo IpPDSearchDirCalc.lo \ - IpPenaltyLSAcceptor.lo IpProbingMuOracle.lo \ - IpQualityFunctionMuOracle.lo IpRestoConvCheck.lo \ - IpRestoFilterConvCheck.lo IpRestoIpoptNLP.lo \ - IpRestoIterateInitializer.lo IpRestoIterationOutput.lo \ - IpRestoMinC_1Nrm.lo IpRestoPenaltyConvCheck.lo \ - IpRestoRestoPhase.lo IpStdAugSystemSolver.lo \ - IpTimingStatistics.lo IpUserScaling.lo \ - IpWarmStartIterateInitializer.lo -libipoptalg_la_OBJECTS = $(am_libipoptalg_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 = -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)/IpAdaptiveMuUpdate.Plo \ - ./$(DEPDIR)/IpAlgBuilder.Plo ./$(DEPDIR)/IpAlgorithmRegOp.Plo \ - ./$(DEPDIR)/IpAugRestoSystemSolver.Plo \ - ./$(DEPDIR)/IpBacktrackingLineSearch.Plo \ - ./$(DEPDIR)/IpDefaultIterateInitializer.Plo \ - ./$(DEPDIR)/IpEquilibrationScaling.Plo \ - ./$(DEPDIR)/IpExactHessianUpdater.Plo ./$(DEPDIR)/IpFilter.Plo \ - ./$(DEPDIR)/IpFilterLSAcceptor.Plo \ - ./$(DEPDIR)/IpGenAugSystemSolver.Plo \ - ./$(DEPDIR)/IpGradientScaling.Plo ./$(DEPDIR)/IpIpoptAlg.Plo \ - ./$(DEPDIR)/IpIpoptCalculatedQuantities.Plo \ - ./$(DEPDIR)/IpIpoptData.Plo ./$(DEPDIR)/IpIteratesVector.Plo \ - ./$(DEPDIR)/IpLeastSquareMults.Plo \ - ./$(DEPDIR)/IpLimMemQuasiNewtonUpdater.Plo \ - ./$(DEPDIR)/IpLoqoMuOracle.Plo \ - ./$(DEPDIR)/IpLowRankAugSystemSolver.Plo \ - ./$(DEPDIR)/IpLowRankSSAugSystemSolver.Plo \ - ./$(DEPDIR)/IpMonotoneMuUpdate.Plo \ - ./$(DEPDIR)/IpNLPBoundsRemover.Plo \ - ./$(DEPDIR)/IpNLPScaling.Plo \ - ./$(DEPDIR)/IpOptErrorConvCheck.Plo \ - ./$(DEPDIR)/IpOrigIpoptNLP.Plo \ - ./$(DEPDIR)/IpOrigIterationOutput.Plo \ - ./$(DEPDIR)/IpPDFullSpaceSolver.Plo \ - ./$(DEPDIR)/IpPDPerturbationHandler.Plo \ - ./$(DEPDIR)/IpPDSearchDirCalc.Plo \ - ./$(DEPDIR)/IpPenaltyLSAcceptor.Plo \ - ./$(DEPDIR)/IpProbingMuOracle.Plo \ - ./$(DEPDIR)/IpQualityFunctionMuOracle.Plo \ - ./$(DEPDIR)/IpRestoConvCheck.Plo \ - ./$(DEPDIR)/IpRestoFilterConvCheck.Plo \ - ./$(DEPDIR)/IpRestoIpoptNLP.Plo \ - ./$(DEPDIR)/IpRestoIterateInitializer.Plo \ - ./$(DEPDIR)/IpRestoIterationOutput.Plo \ - ./$(DEPDIR)/IpRestoMinC_1Nrm.Plo \ - ./$(DEPDIR)/IpRestoPenaltyConvCheck.Plo \ - ./$(DEPDIR)/IpRestoRestoPhase.Plo \ - ./$(DEPDIR)/IpStdAugSystemSolver.Plo \ - ./$(DEPDIR)/IpTimingStatistics.Plo \ - ./$(DEPDIR)/IpUserScaling.Plo \ - ./$(DEPDIR)/IpWarmStartIterateInitializer.Plo -am__mv = mv -f -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) \ - $(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) \ - $(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 = -SOURCES = $(libipoptalg_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -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__installdirs = "$(DESTDIR)$(includeipoptdir)" -HEADERS = $(includeipopt_HEADERS) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS -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 -DIST_SUBDIRS = $(SUBDIRS) -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = LinearSolvers Inexact -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpAlgBuilder.hpp \ - IpAlgStrategy.hpp \ - IpAugSystemSolver.hpp \ - IpConvCheck.hpp \ - IpEqMultCalculator.hpp \ - IpHessianUpdater.hpp \ - IpIpoptAlg.hpp \ - IpIpoptCalculatedQuantities.hpp \ - IpIpoptData.hpp \ - IpIpoptNLP.hpp \ - IpIterateInitializer.hpp \ - IpIteratesVector.hpp \ - IpIterationOutput.hpp \ - IpOrigIpoptNLP.hpp \ - IpLineSearch.hpp \ - IpMuUpdate.hpp \ - IpNLPScaling.hpp \ - IpPDSystemSolver.hpp \ - IpSearchDirCalculator.hpp \ - IpTimingStatistics.hpp - -noinst_LTLIBRARIES = libipoptalg.la -libipoptalg_la_SOURCES = \ - IpAdaptiveMuUpdate.cpp \ - IpAlgBuilder.cpp \ - IpAlgorithmRegOp.cpp \ - IpAugRestoSystemSolver.cpp \ - IpBacktrackingLineSearch.cpp \ - IpDefaultIterateInitializer.cpp \ - IpEquilibrationScaling.cpp \ - IpExactHessianUpdater.cpp \ - IpFilter.cpp \ - IpFilterLSAcceptor.cpp \ - IpGenAugSystemSolver.cpp \ - IpGradientScaling.cpp \ - IpIpoptAlg.cpp \ - IpIpoptCalculatedQuantities.cpp \ - IpIpoptData.cpp \ - IpIteratesVector.cpp \ - IpLeastSquareMults.cpp \ - IpLimMemQuasiNewtonUpdater.cpp \ - IpLoqoMuOracle.cpp \ - IpLowRankAugSystemSolver.cpp \ - IpLowRankSSAugSystemSolver.cpp \ - IpMonotoneMuUpdate.cpp \ - IpNLPBoundsRemover.cpp \ - IpNLPScaling.cpp \ - IpOptErrorConvCheck.cpp \ - IpOrigIpoptNLP.cpp \ - IpOrigIterationOutput.cpp \ - IpPDFullSpaceSolver.cpp \ - IpPDPerturbationHandler.cpp \ - IpPDSearchDirCalc.cpp \ - IpPenaltyLSAcceptor.cpp \ - IpProbingMuOracle.cpp \ - IpQualityFunctionMuOracle.cpp \ - IpRestoConvCheck.cpp \ - IpRestoFilterConvCheck.cpp \ - IpRestoIpoptNLP.cpp \ - IpRestoIterateInitializer.cpp \ - IpRestoIterationOutput.cpp \ - IpRestoMinC_1Nrm.cpp \ - IpRestoPenaltyConvCheck.cpp \ - IpRestoRestoPhase.cpp \ - IpStdAugSystemSolver.cpp \ - IpTimingStatistics.cpp \ - IpUserScaling.cpp \ - IpWarmStartIterateInitializer.cpp - - -#libipoptalg_la_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir)/../Common \ - -I$(srcdir)/../LinAlg \ - -I$(srcdir)/../LinAlg/TMatrices \ - -I$(srcdir)/../Interfaces \ - -I$(srcdir)/LinearSolvers \ - -I$(srcdir)/../contrib/CGPenalty \ - -I$(srcdir)/../contrib/LinearSolverLoader \ - $(IPOPTLIB_CFLAGS) - -all: all-recursive - -.SUFFIXES: -.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 ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Algorithm/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Algorithm/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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}; \ - } - -libipoptalg.la: $(libipoptalg_la_OBJECTS) $(libipoptalg_la_DEPENDENCIES) $(EXTRA_libipoptalg_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(libipoptalg_la_OBJECTS) $(libipoptalg_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpAdaptiveMuUpdate.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpAlgBuilder.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpAlgorithmRegOp.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpAugRestoSystemSolver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpBacktrackingLineSearch.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpDefaultIterateInitializer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpEquilibrationScaling.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpExactHessianUpdater.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpFilter.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpFilterLSAcceptor.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpGenAugSystemSolver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpGradientScaling.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpIpoptAlg.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpIpoptCalculatedQuantities.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpIpoptData.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpIteratesVector.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpLeastSquareMults.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpLimMemQuasiNewtonUpdater.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpLoqoMuOracle.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpLowRankAugSystemSolver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpLowRankSSAugSystemSolver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMonotoneMuUpdate.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpNLPBoundsRemover.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpNLPScaling.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpOptErrorConvCheck.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpOrigIpoptNLP.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpOrigIterationOutput.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpPDFullSpaceSolver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpPDPerturbationHandler.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpPDSearchDirCalc.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpPenaltyLSAcceptor.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpProbingMuOracle.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpQualityFunctionMuOracle.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRestoConvCheck.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRestoFilterConvCheck.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRestoIpoptNLP.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRestoIterateInitializer.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRestoIterationOutput.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRestoMinC_1Nrm.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRestoPenaltyConvCheck.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRestoRestoPhase.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpStdAugSystemSolver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTimingStatistics.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpUserScaling.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpWarmStartIterateInitializer.Plo@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@ $(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@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -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 \ - 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 $$?; \ - 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) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -ctags: ctags-recursive - -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) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -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 -check-am: all-am -check: check-recursive -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(includeipoptdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -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 -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-recursive - -rm -f ./$(DEPDIR)/IpAdaptiveMuUpdate.Plo - -rm -f ./$(DEPDIR)/IpAlgBuilder.Plo - -rm -f ./$(DEPDIR)/IpAlgorithmRegOp.Plo - -rm -f ./$(DEPDIR)/IpAugRestoSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpBacktrackingLineSearch.Plo - -rm -f ./$(DEPDIR)/IpDefaultIterateInitializer.Plo - -rm -f ./$(DEPDIR)/IpEquilibrationScaling.Plo - -rm -f ./$(DEPDIR)/IpExactHessianUpdater.Plo - -rm -f ./$(DEPDIR)/IpFilter.Plo - -rm -f ./$(DEPDIR)/IpFilterLSAcceptor.Plo - -rm -f ./$(DEPDIR)/IpGenAugSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpGradientScaling.Plo - -rm -f ./$(DEPDIR)/IpIpoptAlg.Plo - -rm -f ./$(DEPDIR)/IpIpoptCalculatedQuantities.Plo - -rm -f ./$(DEPDIR)/IpIpoptData.Plo - -rm -f ./$(DEPDIR)/IpIteratesVector.Plo - -rm -f ./$(DEPDIR)/IpLeastSquareMults.Plo - -rm -f ./$(DEPDIR)/IpLimMemQuasiNewtonUpdater.Plo - -rm -f ./$(DEPDIR)/IpLoqoMuOracle.Plo - -rm -f ./$(DEPDIR)/IpLowRankAugSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpLowRankSSAugSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpMonotoneMuUpdate.Plo - -rm -f ./$(DEPDIR)/IpNLPBoundsRemover.Plo - -rm -f ./$(DEPDIR)/IpNLPScaling.Plo - -rm -f ./$(DEPDIR)/IpOptErrorConvCheck.Plo - -rm -f ./$(DEPDIR)/IpOrigIpoptNLP.Plo - -rm -f ./$(DEPDIR)/IpOrigIterationOutput.Plo - -rm -f ./$(DEPDIR)/IpPDFullSpaceSolver.Plo - -rm -f ./$(DEPDIR)/IpPDPerturbationHandler.Plo - -rm -f ./$(DEPDIR)/IpPDSearchDirCalc.Plo - -rm -f ./$(DEPDIR)/IpPenaltyLSAcceptor.Plo - -rm -f ./$(DEPDIR)/IpProbingMuOracle.Plo - -rm -f ./$(DEPDIR)/IpQualityFunctionMuOracle.Plo - -rm -f ./$(DEPDIR)/IpRestoConvCheck.Plo - -rm -f ./$(DEPDIR)/IpRestoFilterConvCheck.Plo - -rm -f ./$(DEPDIR)/IpRestoIpoptNLP.Plo - -rm -f ./$(DEPDIR)/IpRestoIterateInitializer.Plo - -rm -f ./$(DEPDIR)/IpRestoIterationOutput.Plo - -rm -f ./$(DEPDIR)/IpRestoMinC_1Nrm.Plo - -rm -f ./$(DEPDIR)/IpRestoPenaltyConvCheck.Plo - -rm -f ./$(DEPDIR)/IpRestoRestoPhase.Plo - -rm -f ./$(DEPDIR)/IpStdAugSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpTimingStatistics.Plo - -rm -f ./$(DEPDIR)/IpUserScaling.Plo - -rm -f ./$(DEPDIR)/IpWarmStartIterateInitializer.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: install-includeipoptHEADERS - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f ./$(DEPDIR)/IpAdaptiveMuUpdate.Plo - -rm -f ./$(DEPDIR)/IpAlgBuilder.Plo - -rm -f ./$(DEPDIR)/IpAlgorithmRegOp.Plo - -rm -f ./$(DEPDIR)/IpAugRestoSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpBacktrackingLineSearch.Plo - -rm -f ./$(DEPDIR)/IpDefaultIterateInitializer.Plo - -rm -f ./$(DEPDIR)/IpEquilibrationScaling.Plo - -rm -f ./$(DEPDIR)/IpExactHessianUpdater.Plo - -rm -f ./$(DEPDIR)/IpFilter.Plo - -rm -f ./$(DEPDIR)/IpFilterLSAcceptor.Plo - -rm -f ./$(DEPDIR)/IpGenAugSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpGradientScaling.Plo - -rm -f ./$(DEPDIR)/IpIpoptAlg.Plo - -rm -f ./$(DEPDIR)/IpIpoptCalculatedQuantities.Plo - -rm -f ./$(DEPDIR)/IpIpoptData.Plo - -rm -f ./$(DEPDIR)/IpIteratesVector.Plo - -rm -f ./$(DEPDIR)/IpLeastSquareMults.Plo - -rm -f ./$(DEPDIR)/IpLimMemQuasiNewtonUpdater.Plo - -rm -f ./$(DEPDIR)/IpLoqoMuOracle.Plo - -rm -f ./$(DEPDIR)/IpLowRankAugSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpLowRankSSAugSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpMonotoneMuUpdate.Plo - -rm -f ./$(DEPDIR)/IpNLPBoundsRemover.Plo - -rm -f ./$(DEPDIR)/IpNLPScaling.Plo - -rm -f ./$(DEPDIR)/IpOptErrorConvCheck.Plo - -rm -f ./$(DEPDIR)/IpOrigIpoptNLP.Plo - -rm -f ./$(DEPDIR)/IpOrigIterationOutput.Plo - -rm -f ./$(DEPDIR)/IpPDFullSpaceSolver.Plo - -rm -f ./$(DEPDIR)/IpPDPerturbationHandler.Plo - -rm -f ./$(DEPDIR)/IpPDSearchDirCalc.Plo - -rm -f ./$(DEPDIR)/IpPenaltyLSAcceptor.Plo - -rm -f ./$(DEPDIR)/IpProbingMuOracle.Plo - -rm -f ./$(DEPDIR)/IpQualityFunctionMuOracle.Plo - -rm -f ./$(DEPDIR)/IpRestoConvCheck.Plo - -rm -f ./$(DEPDIR)/IpRestoFilterConvCheck.Plo - -rm -f ./$(DEPDIR)/IpRestoIpoptNLP.Plo - -rm -f ./$(DEPDIR)/IpRestoIterateInitializer.Plo - -rm -f ./$(DEPDIR)/IpRestoIterationOutput.Plo - -rm -f ./$(DEPDIR)/IpRestoMinC_1Nrm.Plo - -rm -f ./$(DEPDIR)/IpRestoPenaltyConvCheck.Plo - -rm -f ./$(DEPDIR)/IpRestoRestoPhase.Plo - -rm -f ./$(DEPDIR)/IpStdAugSystemSolver.Plo - -rm -f ./$(DEPDIR)/IpTimingStatistics.Plo - -rm -f ./$(DEPDIR)/IpUserScaling.Plo - -rm -f ./$(DEPDIR)/IpWarmStartIterateInitializer.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-includeipoptHEADERS - -.MAKE: $(am__recursive_targets) install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--depfiles check check-am clean clean-generic clean-libtool \ - clean-noinstLTLIBRARIES 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-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-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am 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-includeipoptHEADERS - -.PRECIOUS: Makefile - - -# 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/AmplTNLP.cpp b/src/Apps/AmplSolver/AmplTNLP.cpp index 7b72d8cc7..29f7777bf 100644 --- a/src/Apps/AmplSolver/AmplTNLP.cpp +++ b/src/Apps/AmplSolver/AmplTNLP.cpp @@ -25,11 +25,10 @@ namespace Ipopt static const Index dbg_verbosity = 0; #endif -AmplTNLP::AmplTNLP( - const SmartPtr& jnlst, +void AmplTNLP::gutsOfConstructor( + const SmartPtr regoptions, const SmartPtr options, - char**& argv, - SmartPtr suffix_handler /* = NULL */, + const char* const* argv, bool allow_discrete /* = false */, SmartPtr ampl_options_list /* = NULL */, const char* ampl_option_string /* = NULL */, @@ -37,26 +36,7 @@ AmplTNLP::AmplTNLP( 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 @@ -64,17 +44,16 @@ AmplTNLP::AmplTNLP( // Most of them are data members of an asl object // Create the ASL structure - ASL_pfgh* asl = (ASL_pfgh*) ASL_alloc(ASL_read_pfgh); + ASL_pfgh* asl = reinterpret_cast(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; + nerror_ = (void*) new fint; + *(fint*)nerror_ = 0; // Read the options and stub - char* stub = get_options(options, ampl_options_list, ampl_option_string, ampl_invokation_string, ampl_banner_string, + char* stub = get_options(regoptions, options, ampl_options_list, ampl_option_string, ampl_invokation_string, ampl_banner_string, argv); FILE* nl = NULL; if( nl_file_content ) @@ -88,7 +67,7 @@ AmplTNLP::AmplTNLP( 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)); + nl = jac0dim(stub, (ftnlen)strlen(stub)); DBG_ASSERT(nl); } jnlst_->Printf(J_SUMMARY, J_MAIN, "\n"); @@ -97,9 +76,9 @@ AmplTNLP::AmplTNLP( 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", + jnlst_->Printf(J_WARNING, J_MAIN, "==> Warning: Treating %d binary and %d integer variables as continuous.\n\n", nbv, niv + nlvbi + nlvci + nlvoi); - allow_discrete = true; + // never used: allow_discrete = true; } allow_discrete = true; ASSERT_EXCEPTION(allow_discrete || (nbv == 0 && niv == 0 && nlvbi == 0 && nlvci == 0 && nlvoi == 0), IpoptException, @@ -109,9 +88,9 @@ AmplTNLP::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"); + "\n\n***** Ipopt does not support complementarity constraints. Aborting. *****\n\n"); ASSERT_EXCEPTION(n_cc == 0, IpoptException, - "Currently, the AMPL interface to Ipopt does not support complementarity constraints."); + "Ipopt does not support complementarity constraints."); } DBG_ASSERT(nlo == 0 || nlo == 1); // Can handle nonlinear obj. @@ -131,14 +110,17 @@ AmplTNLP::AmplTNLP( havepi0 = new char[n_con]; // prepare for suffixes - if( IsValid(suffix_handler) ) + if( IsValid(suffix_handler_) ) { - suffix_handler->PrepareAmplForSuffixes(asl_); + suffix_handler_->PrepareAmplForSuffixes(asl); } // read the rest of the nl file +#ifdef IPOPT_INT64 + int retcode = pfgh_read(nl, ASL_return_read_err | ASL_findgroups | ASL_allow_Z | ASL_use_Z); +#else int retcode = pfgh_read(nl, ASL_return_read_err | ASL_findgroups); - +#endif switch( retcode ) { case ASL_readerr_none: @@ -149,54 +131,118 @@ AmplTNLP::AmplTNLP( { 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; } } } +AmplTNLP::AmplTNLP( + const SmartPtr& jnlst, + const SmartPtr regoptions, + const SmartPtr options, + const char* const* 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); + + gutsOfConstructor(regoptions, options, argv, allow_discrete, ampl_options_list, ampl_option_string, ampl_invokation_string, ampl_banner_string, nl_file_content); +} + +AmplTNLP::AmplTNLP( + const SmartPtr& jnlst, + const SmartPtr options, + // cppcheck-suppress constParameter + 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); + + gutsOfConstructor(NULL, options, argv, allow_discrete, ampl_options_list, ampl_option_string, ampl_invokation_string, ampl_banner_string, nl_file_content); +} + void AmplTNLP::set_active_objective( Index in_obj_no ) @@ -209,6 +255,7 @@ void AmplTNLP::set_active_objective( "Internal error: AmplTNLP::set_active_objective called after AmplTNLP::call_hesset."); } ASL_pfgh* asl = asl_; + DBG_ASSERT(asl); obj_no = in_obj_no; set_active_objective_called_ = true; } @@ -222,6 +269,7 @@ void AmplTNLP::call_hesset() } ASL_pfgh* asl = asl_; + DBG_ASSERT(asl); if( n_obj == 0 ) { @@ -319,7 +367,7 @@ bool AmplTNLP::get_nlp_info( ) { ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + DBG_ASSERT(asl); if( !hesset_called_ ) { @@ -328,7 +376,11 @@ bool AmplTNLP::get_nlp_info( n = n_var; // # of variables (variable types have been asserted in the constructor m = n_con; // # of constraints +#ifdef IPOPT_INT64 + nnz_jac_g = nZc; // # of non-zeros in the jacobian +#else nnz_jac_g = nzc; // # of non-zeros in the jacobian +#endif nnz_h_lag = nz_h_full_; // # of non-zeros in the hessian index_style = TNLP::FORTRAN_STYLE; @@ -348,7 +400,7 @@ bool AmplTNLP::get_var_con_metadata( ) { ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + DBG_ASSERT(asl); // pick up the variable and constraints names if available Index rlen = maxrownamelen; @@ -399,7 +451,7 @@ bool AmplTNLP::get_bounds_info( ) { ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + DBG_ASSERT(asl); DBG_ASSERT(n == n_var); DBG_ASSERT(m == n_con); @@ -425,6 +477,7 @@ bool AmplTNLP::get_constraints_linearity( ) { ASL_pfgh* asl = AmplSolverObject(); + DBG_ASSERT(asl); //check that n is good DBG_ASSERT(n == n_con); (void) n; @@ -456,7 +509,7 @@ bool AmplTNLP::get_starting_point( ) { ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + DBG_ASSERT(asl); DBG_ASSERT(n == n_var); DBG_ASSERT(m == n_con); @@ -470,8 +523,8 @@ bool AmplTNLP::get_starting_point( { // Modified for warm-start from AMPL DBG_ASSERT(IsValid(suffix_handler_)); - const double* zL_init = suffix_handler_->GetNumberSuffixValues("ipopt_zL_in", AmplSuffixHandler::Variable_Source); - const double* zU_init = suffix_handler_->GetNumberSuffixValues("ipopt_zU_in", AmplSuffixHandler::Variable_Source); + const Number* zL_init = suffix_handler_->GetNumberSuffixValues("ipopt_zL_in", AmplSuffixHandler::Variable_Source); + const Number* 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; @@ -515,7 +568,7 @@ bool AmplTNLP::eval_grad_f( DBG_START_METH("AmplTNLP::eval_grad_f", dbg_verbosity); ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + DBG_ASSERT(asl); if( !apply_new_x(new_x, n, x) ) { @@ -559,6 +612,7 @@ bool AmplTNLP::eval_g( DBG_START_METH("AmplTNLP::eval_g", dbg_verbosity); DBG_DO(ASL_pfgh* asl = asl_); + DBG_ASSERT(asl); DBG_ASSERT(n == n_var); DBG_ASSERT(m == n_con); @@ -584,7 +638,7 @@ bool AmplTNLP::eval_jac_g( DBG_START_METH("AmplTNLP::eval_jac_g", dbg_verbosity); ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + DBG_ASSERT(asl); DBG_ASSERT(n == n_var); DBG_ASSERT(m == n_con); (void) m; @@ -646,17 +700,21 @@ bool AmplTNLP::eval_h( DBG_START_METH("AmplTNLP::eval_h", dbg_verbosity); ASL_pfgh* asl = asl_; - DBG_ASSERT(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++ ) + Index k = 0; + for( Index i = 0; i < n; i++ ) { - for( int j = sputinfo->hcolstarts[i]; j < sputinfo->hcolstarts[i + 1]; j++ ) +#ifdef IPOPT_INT64 + for( size_t j = sputinfo->hcolstartsZ[i]; j < sputinfo->hcolstartsZ[i + 1]; j++ ) +#else + for( Index j = sputinfo->hcolstarts[i]; j < sputinfo->hcolstarts[i + 1]; j++ ) +#endif { iRow[k] = i + 1; jCol[k] = sputinfo->hrownos[j] + 1; @@ -720,6 +778,7 @@ void AmplTNLP::finalize_solution( ) { ASL_pfgh* asl = asl_; + DBG_ASSERT(asl); if( !x_sol_ ) { @@ -742,81 +801,124 @@ void AmplTNLP::finalize_solution( lambda_sol_ = new Number[m]; } - IpBlasDcopy(n, x, 1, x_sol_, 1); - IpBlasDcopy(m, g, 1, g_sol_, 1); + IpBlasCopy(n, x, 1, x_sol_, 1); + IpBlasCopy(m, g, 1, g_sol_, 1); if( obj_sign_ == -1.0 ) // maximization { - for( int i = 0; i < n; ++i ) + for( Index i = 0; i < n; ++i ) { z_L_sol_[i] = -z_L[i]; } - IpBlasDcopy(n, z_U, 1, z_U_sol_, 1); - IpBlasDcopy(m, lambda, 1, lambda_sol_, 1); + IpBlasCopy(n, z_U, 1, z_U_sol_, 1); + IpBlasCopy(m, lambda, 1, lambda_sol_, 1); } else { - IpBlasDcopy(n, z_L, 1, z_L_sol_, 1); - for( int i = 0; i < n; ++i ) + IpBlasCopy(n, z_L, 1, z_L_sol_, 1); + for( Index i = 0; i < n; ++i ) { z_U_sol_[i] = -z_U[i]; } - for( int i = 0; i < m; ++i ) + for( Index i = 0; i < m; ++i ) { lambda_sol_[i] = -lambda[i]; } } obj_sol_ = obj_value; - std::string message; - if( status == SUCCESS ) - { - message = "Optimal Solution Found"; - solve_result_num = 0; - } - else if( status == MAXITER_EXCEEDED ) - { - message = "Maximum Number of Iterations Exceeded."; - solve_result_num = 400; - } - else if( status == CPUTIME_EXCEEDED ) - { - message = "Maximum CPU Time Exceeded."; - solve_result_num = 401; - } - else if( status == STOP_AT_TINY_STEP ) + std::string message = " \nIpopt " IPOPT_VERSION ": "; + switch( status ) { - message = "Search Direction becomes Too Small."; - solve_result_num = 500; - } - else if( status == STOP_AT_ACCEPTABLE_POINT ) - { - message = "Solved To Acceptable Level."; - solve_result_num = 1; - } - else if( status == FEASIBLE_POINT_FOUND ) - { - message = "Found feasible point for square problem."; - solve_result_num = 2; - } - 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 ) - { - message = "Restoration Phase Failed."; - solve_result_num = 501; - } - else if( status == DIVERGING_ITERATES ) - { - message = "Iterates diverging; problem might be unbounded."; - solve_result_num = 300; - } - else - { - message = "Unknown Error"; - solve_result_num = 502; + case SUCCESS: + message += "Optimal Solution Found"; + solve_result_num = 0; + break; + + case STOP_AT_ACCEPTABLE_POINT: + message += "Solved To Acceptable Level."; + solve_result_num = 1; + break; + + case FEASIBLE_POINT_FOUND: + message += "Found feasible point for square problem."; + solve_result_num = 2; + break; + + case LOCAL_INFEASIBILITY: + message += "Converged to a locally infeasible point. Problem may be infeasible."; + solve_result_num = 200; + break; + + case DIVERGING_ITERATES: + message += "Iterates diverging; problem might be unbounded."; + solve_result_num = 300; + break; + + case MAXITER_EXCEEDED: + message += "Maximum Number of Iterations Exceeded."; + solve_result_num = 400; + break; + + case CPUTIME_EXCEEDED: + message += "Maximum CPU Time Exceeded."; + solve_result_num = 401; + break; + + case WALLTIME_EXCEEDED: + message += "Maximum Wallclock Time Exceeded."; + solve_result_num = 402; + break; + + case USER_REQUESTED_STOP: + message += "User requested stop."; + solve_result_num = 403; + break; + + case STOP_AT_TINY_STEP: + message += "Search Direction becomes Too Small."; + solve_result_num = 500; + break; + + case RESTORATION_FAILURE: + message += "Restoration Phase Failed."; + solve_result_num = 501; + break; + + case ERROR_IN_STEP_COMPUTATION: + message += "Error in step computation."; + solve_result_num = 502; + break; + + // the following should be dead code, i.e., finalize_solution isn't called in these cases + case INVALID_NUMBER_DETECTED: + message += "Invalid number in NLP function or derivative detected."; + solve_result_num = 550; + break; + + case TOO_FEW_DEGREES_OF_FREEDOM: + message += "NLP has too few degrees of freedom."; + solve_result_num = 551; + break; + + case INVALID_OPTION: + message += "Invalid option setting."; + solve_result_num = 552; + break; + + case OUT_OF_MEMORY: + message += "Out of memory."; + solve_result_num = 553; + break; + + case INTERNAL_ERROR: + message += "Internal error."; + solve_result_num = 554; + break; + + case UNASSIGNED: + message += "Unknown Error"; + solve_result_num = 599; + break; } if( IsValid(suffix_handler_) ) @@ -827,8 +929,7 @@ void AmplTNLP::finalize_solution( } // Write the .sol file - message = " \nIpopt " IPOPT_VERSION ": " + message; - write_solution_file(message.c_str()); + write_solution_file(message); } bool AmplTNLP::internal_objval( @@ -839,7 +940,7 @@ bool AmplTNLP::internal_objval( DBG_START_METH("AmplTNLP::internal_objval", dbg_verbosity); ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + DBG_ASSERT(asl); objval_called_with_current_x_ = false; // in case the call below fails if( n_obj == 0 ) @@ -871,14 +972,14 @@ bool AmplTNLP::internal_conval( DBG_START_METH("AmplTNLP::internal_conval", dbg_verbosity); ASL_pfgh* asl = asl_; - DBG_ASSERT(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]; + g = new Number[m]; allocated = true; } conval(const_cast(x), g, (fint* )nerror_); @@ -886,7 +987,6 @@ bool AmplTNLP::internal_conval( if( allocated ) { delete[] g; - g = NULL; } if( nerror_ok(nerror_) ) @@ -907,7 +1007,7 @@ bool AmplTNLP::apply_new_x( dbg_verbosity); ASL_pfgh* asl = asl_; - DBG_ASSERT(asl_); + DBG_ASSERT(asl); if( new_x ) { @@ -983,14 +1083,14 @@ bool AmplTNLP::get_scaling_parameters( ) { DBG_ASSERT(IsValid(suffix_handler_)); - const double* obj = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Objective_Source); + const Number* 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); + const Number* x = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Variable_Source); if( x ) { use_x_scaling = true; - for( int i = 0; i < n; i++ ) + for( Index i = 0; i < n; i++ ) { if( x[i] > 0.0 ) { @@ -1007,11 +1107,11 @@ bool AmplTNLP::get_scaling_parameters( use_x_scaling = false; } - const double* g = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Constraint_Source); + const Number* g = suffix_handler_->GetNumberSuffixValues("scaling_factor", AmplSuffixHandler::Constraint_Source); if( g ) { use_g_scaling = true; - for( int i = 0; i < m; i++ ) + for( Index i = 0; i < m; i++ ) { if( g[i] > 0 ) { @@ -1034,6 +1134,7 @@ bool AmplTNLP::get_scaling_parameters( Index AmplTNLP::get_number_of_nonlinear_variables() { ASL_pfgh* asl = asl_; + DBG_ASSERT(asl); return Max(nlvo, nlvc); } @@ -1042,7 +1143,8 @@ bool AmplTNLP::get_list_of_nonlinear_variables( Index* pos_nonlin_vars ) { - DBG_DO(ASL_pfgh* asl = asl_;) + DBG_DO(ASL_pfgh* asl = asl_); + DBG_ASSERT(asl); DBG_ASSERT(num_nonlin_vars == Max(nlvo, nlvc)); // The first variables are the nonlinear ones (using Fortran @@ -1065,6 +1167,8 @@ extern "C" AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; real real_val; + // cppcheck-suppress autoVariables + // cppcheck-suppress unmatchedSuppression kw->info = &real_val; char* retval = D_val(oi, kw, value); kw->info = (void*) pinfo; @@ -1087,6 +1191,8 @@ extern "C" AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; int int_val; + // cppcheck-suppress autoVariables + // cppcheck-suppress unmatchedSuppression kw->info = &int_val; char* retval = I_val(oi, kw, value); kw->info = (void*) pinfo; @@ -1109,6 +1215,8 @@ extern "C" AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; char* str_val; + // cppcheck-suppress autoVariables + // cppcheck-suppress unmatchedSuppression kw->info = &str_val; char* retval = C_val(oi, kw, value); kw->info = (void*) pinfo; @@ -1131,17 +1239,21 @@ extern "C" AmplOptionsList::PrivatInfo* pinfo = (AmplOptionsList::PrivatInfo*) kw->info; char* str_val; + // cppcheck-suppress autoVariables + // cppcheck-suppress unmatchedSuppression kw->info = &str_val; char* retval = C_val(oi, kw, value); kw->info = (void*) pinfo; fint** nerror = (fint**) pinfo->NError(); + // cppcheck-suppress uninitvar if( strcmp(str_val, "yes") == 0 ) { delete *nerror; *nerror = NULL; } + // cppcheck-suppress uninitvar else if( strcmp(str_val, "no") == 0 ) { delete *nerror; @@ -1159,9 +1271,9 @@ extern "C" } AmplOptionsList::AmplOption::AmplOption( - const std::string ipopt_option_name, - AmplOptionType type, - const std::string description + const std::string& ipopt_option_name, + AmplOptionType type, + const std::string& description ) : ipopt_option_name_(ipopt_option_name), type_(type) @@ -1178,7 +1290,7 @@ AmplOptionsList::~AmplOptionsList() keyword* keywords = (keyword*) keywds_; for( Index i = 0; i < nkeywds_; i++ ) { - PrivatInfo* pinfo = (PrivatInfo*) keywords[i].info; + PrivatInfo* pinfo = static_cast(keywords[i].info); delete pinfo; delete[] keywords[i].name; } @@ -1198,7 +1310,7 @@ void* AmplOptionsList::Keywords( keyword* keywords = (keyword*) keywds_; for( Index i = 0; i < nkeywds_; i++ ) { - PrivatInfo* pinfo = (PrivatInfo*) keywords[i].info; + PrivatInfo* pinfo = static_cast(keywords[i].info); delete pinfo; delete[] keywords[i].name; } @@ -1214,7 +1326,7 @@ void* AmplOptionsList::Keywords( Index ioption = 0; for( std::map >::iterator iter = ampl_options_map_.begin(); - iter != ampl_options_map_.end(); iter++ ) + iter != ampl_options_map_.end(); ++iter ) { keywords[ioption].name = new char[iter->first.size() + 1]; strcpy(keywords[ioption].name, iter->first.c_str()); @@ -1266,8 +1378,7 @@ void AmplOptionsList::MakeValidLatexString( std::string& dest ) const { - std::string::iterator c; - for( c = source.begin(); c != source.end(); c++ ) + for( std::string::iterator c = source.begin(); c != source.end(); ++c ) { if( *c == '_' ) { @@ -1359,14 +1470,19 @@ void AmplOptionsList::PrintDoxygen( } } +static const char sname_default[] = "ipopt"; +static const char bsname_default[] = "Ipopt " IPOPT_VERSION; +static const char opname_default[] = "ipopt_options"; + char* AmplTNLP::get_options( + const SmartPtr regoptions, const SmartPtr& options, SmartPtr& ampl_options_list, const char* ampl_option_string, const char* ampl_invokation_string, const char* ampl_banner_string, - char**& argv + const char* const* argv ) { ASL_pfgh* asl = asl_; @@ -1376,168 +1492,158 @@ AmplTNLP::get_options( ampl_options_list = new AmplOptionsList(); } - // Output - ampl_options_list->AddAmplOption("print_level", "print_level", AmplOptionsList::Integer_Option, "Verbosity level"); + if( IsValid(regoptions) ) + { + for( RegisteredOptions::RegOptionsList::const_iterator it_opt(regoptions->RegisteredOptionsList().begin()); it_opt != regoptions->RegisteredOptionsList().end(); ++it_opt ) + { + AmplOptionsList::AmplOptionType ampltype = AmplOptionsList::Number_Option; + + switch( it_opt->second->Type() ) + { + case Ipopt::OT_Number: + ampltype = AmplOptionsList::Number_Option; + break; + case Ipopt::OT_Integer: + ampltype = AmplOptionsList::Integer_Option; + break; + case Ipopt::OT_String: + ampltype = AmplOptionsList::String_Option; + break; + case Ipopt::OT_Unknown: + continue; + } + ampl_options_list->AddAmplOption(it_opt->first, it_opt->first, ampltype, it_opt->second->ShortDescription()); + } + } + else + { + // old deprecated use of AmplTNLP: manually list some options + // Output + ampl_options_list->AddAmplOption("print_level", "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("max_wall_time", "max_wall_time", AmplOptionsList::Number_Option, "Wallclock time limit"); + 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"); + } + + // Synonyms for AMPL interface only 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"); -#endif // AMPL's wantsol option // description was originally taken from WS_desc_ASL+5, but that didn't make it through DLL boundaries @@ -1549,13 +1655,10 @@ AmplTNLP::get_options( ampl_options_list->AddAmplOption("halt_on_ampl_error", "", AmplOptionsList::HaltOnError_Option, "Exit with message on evaluation error"); - int n_options = ampl_options_list->NumberOfAmplOptions(); + Index 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; @@ -1593,7 +1696,7 @@ AmplTNLP::get_options( Oinfo->opname = new char[strlen(opname) + 1]; strcpy(Oinfo->opname, opname); Oinfo->keywds = keywds; - Oinfo->n_keywds = n_options; + Oinfo->n_keywds = (int)n_options; // Set the default for the remaining entries Oinfo->flags = 0; Oinfo->version = NULL; @@ -1615,7 +1718,7 @@ AmplTNLP::get_options( Oinfo_ptr_ = Oinfo; - char* stub = getstops(argv, Oinfo); + char* stub = getstops(const_cast(argv), Oinfo); return stub; } @@ -1650,7 +1753,7 @@ AmplSuffixHandler::~AmplSuffixHandler() Index n = (Index) suffix_ids_.size(); for( Index i = 0; i < n; i++ ) { - delete[] suftab_[i].name; + free(suftab_[i].name); suftab_[i].name = NULL; } } @@ -1669,10 +1772,7 @@ void AmplSuffixHandler::PrepareAmplForSuffixes( 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].name = strdup(suffix_ids_[i].c_str()); suftab_[i].table = 0; if( suffix_sources_[i] == Variable_Source ) @@ -1707,10 +1807,10 @@ void AmplSuffixHandler::PrepareAmplForSuffixes( suf_declare(suftab_, n); } -const Index* +const int* AmplSuffixHandler::GetIntegerSuffixValues( - std::string suffix_string, - Suffix_Source source + const std::string& suffix_string, + Suffix_Source source ) const { ASL_pfgh* asl = asl_; @@ -1735,21 +1835,20 @@ AmplSuffixHandler::GetIntegerSuffixValues( } else { - kind = 0; - DBG_ASSERT(false && "Unknown suffix source in GetIntegerSuffixValues"); + THROW_EXCEPTION(IpoptException, "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 +std::vector AmplSuffixHandler::GetIntegerSuffixValues( + Index n, + const std::string& suffix_string, + Suffix_Source source ) const { - std::vector ret; - const Index* ptr = GetIntegerSuffixValues(suffix_string, source); + std::vector ret; + const int* ptr = GetIntegerSuffixValues(suffix_string, source); if( ptr ) { ret.reserve(n); @@ -1761,10 +1860,9 @@ std::vector AmplSuffixHandler::GetIntegerSuffixValues( return ret; } -const Number* -AmplSuffixHandler::GetNumberSuffixValues( - std::string suffix_string, - Suffix_Source source +const Number* AmplSuffixHandler::GetNumberSuffixValues( + const std::string& suffix_string, + Suffix_Source source ) const { ASL_pfgh* asl = asl_; @@ -1789,17 +1887,17 @@ AmplSuffixHandler::GetNumberSuffixValues( } else { - kind = 0; - DBG_ASSERT(false && "Unknown suffix source in GetNumberSuffixValues"); + THROW_EXCEPTION(IpoptException, "Unknown suffix source in GetNumberSuffixValues"); } 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 + Index n, + const std::string& suffix_string, + Suffix_Source source +) const { std::vector ret; const Number* ptr = GetNumberSuffixValues(suffix_string, source); diff --git a/src/Apps/AmplSolver/AmplTNLP.hpp b/src/Apps/AmplSolver/AmplTNLP.hpp index fa2df57b5..d0fed168d 100644 --- a/src/Apps/AmplSolver/AmplTNLP.hpp +++ b/src/Apps/AmplSolver/AmplTNLP.hpp @@ -45,9 +45,9 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplSuffixHandler: public ReferencedObject }; void AddAvailableSuffix( - std::string suffix_string, - Suffix_Source source, - Suffix_Type type + const std::string& suffix_string, + Suffix_Source source, + Suffix_Type type ) { suffix_ids_.push_back(suffix_string); @@ -56,26 +56,26 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplSuffixHandler: public ReferencedObject // suffix_values_.push_back(); } - const Index* GetIntegerSuffixValues( - std::string suffix_string, - Suffix_Source source + const int* GetIntegerSuffixValues( + const std::string& suffix_string, + Suffix_Source source ) const; const Number* GetNumberSuffixValues( - std::string suffix_string, - Suffix_Source source + const std::string& suffix_string, + Suffix_Source source ) const; - std::vector GetIntegerSuffixValues( + std::vector GetIntegerSuffixValues( Index n, - std::string suffix_string, - Suffix_Source source + const std::string& suffix_string, + Suffix_Source source ) const; std::vector GetNumberSuffixValues( Index n, - std::string suffix_string, - Suffix_Source source + const std::string& suffix_string, + Suffix_Source source ) const; private: @@ -88,7 +88,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplSuffixHandler: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ //AmplSuffixHandler(); /** Copy Constructor */ @@ -100,7 +100,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplSuffixHandler: public ReferencedObject void operator=( const AmplSuffixHandler& ); - //@} + ///@} mutable ASL_pfgh* asl_; @@ -140,9 +140,9 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplOptionsList: public ReferencedObject { public: AmplOption( - const std::string ipopt_option_name, - AmplOptionType type, - const std::string description); + const std::string& ipopt_option_name, + AmplOptionType type, + const std::string& description); ~AmplOption() { @@ -171,7 +171,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplOptionsList: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ AmplOption(); @@ -182,7 +182,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplOptionsList: public ReferencedObject /** Default Assignment Operator */ void operator=( const AmplOption&); - //@} + ///@} const std::string ipopt_option_name_; const AmplOptionType type_; @@ -193,7 +193,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplOptionsList: public ReferencedObject { public: PrivatInfo( - const std::string ipopt_name, + const std::string& ipopt_name, SmartPtr options, SmartPtr jnlst, void** nerror = NULL @@ -239,10 +239,10 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplOptionsList: public ReferencedObject /** Adding a new AMPL Option */ void AddAmplOption( - const std::string ampl_option_name, - const std::string ipopt_option_name, + const std::string& ampl_option_name, + const std::string& ipopt_option_name, AmplOptionsList::AmplOptionType type, - const std::string description + const std::string& description ) { SmartPtr new_option = new AmplOption(ipopt_option_name, type, description); @@ -272,7 +272,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplOptionsList: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ //AmplOptionsList(); /** Copy Constructor */ @@ -284,7 +284,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplOptionsList: public ReferencedObject void operator=( const AmplOptionsList& ); - //@} + ///@} void MakeValidLatexString( std::string source, @@ -317,8 +317,29 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP { public: /**@name Constructors/Destructors */ - //@{ - /** Constructor. */ + ///@{ + /** Constructor. + * @since 3.14.0 + */ + AmplTNLP( + const SmartPtr& jnlst, + const SmartPtr regoptions, + const SmartPtr options, + const char* const* 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 + ); + + /** Constructor without RegisteredOptions. + * + * @deprecated Use other constructor that also expects regoptions instead. + */ + IPOPT_DEPRECATED AmplTNLP( const SmartPtr& jnlst, const SmartPtr options, @@ -334,13 +355,13 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP /** 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, @@ -443,10 +464,10 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP Index m, Number* g_scaling ); - //@} + ///@} /** @name Solution Methods */ - //@{ + ///@{ virtual void finalize_solution( SolverReturn status, Index n, @@ -460,19 +481,19 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP 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() { @@ -482,8 +503,8 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP /** 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? */ + // ToDo Maybe this should be at a different place, or collect the numbers itself? void write_solution_file( const std::string& message ) const; @@ -503,7 +524,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP Index& nbv_, Index& niv_ ) const; - //@} + ///@} /** A method for setting the index of the objective function to be * considered. @@ -521,49 +542,55 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP * * 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) + const std::string& tag, + const std::vector& meta_data + ) { var_string_md_[tag] = meta_data; } void set_integer_metadata_for_var( - std::string tag, - std::vector meta_data) + const std::string& tag, + const std::vector& meta_data + ) { var_integer_md_[tag] = meta_data; } void set_numeric_metadata_for_var( - std::string tag, - std::vector meta_data) + const std::string& tag, + const std::vector& meta_data + ) { var_numeric_md_[tag] = meta_data; } void set_string_metadata_for_con( - std::string tag, - std::vector meta_data) + const std::string& tag, + const std::vector& meta_data + ) { con_string_md_[tag] = meta_data; } void set_integer_metadata_for_con( - std::string tag, - std::vector meta_data) + const std::string& tag, + const std::vector& meta_data + ) { con_integer_md_[tag] = meta_data; } void set_numeric_metadata_for_con( - std::string tag, - std::vector meta_data) + const std::string& tag, + const std::vector& meta_data + ) { con_numeric_md_[tag] = meta_data; } - //@} + ///@} /** Method for returning the suffix handler */ SmartPtr get_suffix_handler() @@ -581,7 +608,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ AmplTNLP(); @@ -594,8 +621,21 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP void operator=( const AmplTNLP& ); - //@} + ///@} + void gutsOfConstructor( + const SmartPtr regoptions, + const SmartPtr options, + const char* const* argv, + 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 */ + ); + +protected: /** Journalist */ SmartPtr jnlst_; @@ -603,26 +643,26 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP ASL_pfgh* asl_; /** Sign of the objective fn (1 for min, -1 for max) */ - double obj_sign_; + Number 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 @@ -636,7 +676,7 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP bool hesset_called_; /** whether set_active_objective has been called */ bool set_active_objective_called_; - //@} + ///@} /** Pointer to the Oinfo structure */ void* Oinfo_ptr_; @@ -674,14 +714,34 @@ class IPOPTAMPLINTERFACELIB_EXPORT AmplTNLP: public TNLP * * @return a pointer to a char* with the name of the stub */ + char* get_options( + const SmartPtr regoptions, ///< Registered Ipopt options @since 3.14.0 + const SmartPtr& options, ///< Options + SmartPtr& ampl_options_list, ///< AMPL options list + const char* ampl_option_string, ///< AMPL options string + const char* ampl_invokation_string, ///< AMPL invokation string + const char* ampl_banner_string, ///< AMPL banner string + const char* const* argv ///< Program arguments + ); + + /** 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 + * @deprecated Use get_options() with RegisteredOptions argument instead. + */ + IPOPT_DEPRECATED 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, + // cppcheck-suppress constParameter char**& argv - ); + ) + { + return get_options(NULL, options, ampl_options_list, ampl_option_string, ampl_invokation_string, ampl_banner_string, argv); + } /** whether the ampl nerror code is ok */ bool nerror_ok( diff --git a/src/Apps/AmplSolver/Makefile.am b/src/Apps/AmplSolver/Makefile.am index ac6c9059f..2e80afe7e 100644 --- a/src/Apps/AmplSolver/Makefile.am +++ b/src/Apps/AmplSolver/Makefile.am @@ -1,35 +1,32 @@ # Copyright (C) 2004, 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. - +# # Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 lib_LTLIBRARIES = libipoptamplinterface.la bin_PROGRAMS = ipopt -libipoptamplinterface_la_SOURCES = \ - AmplTNLP.cpp +libipoptamplinterface_la_SOURCES = AmplTNLP.cpp -libipoptamplinterface_la_LIBADD = ../../Interfaces/libipopt.la \ - $(IPOPTAMPLINTERFACELIB_LFLAGS) +libipoptamplinterface_la_LIBADD = ../../libipopt.la $(IPOPTAMPLINTERFACELIB_LFLAGS) -ipopt_SOURCES = \ - ampl_ipopt.cpp +ipopt_SOURCES = ampl_ipopt.cpp -ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la +ipopt_LDADD = libipoptamplinterface.la ../../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) + -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 +pkgconfiglib_DATA = ipoptamplinterface.pc diff --git a/src/Apps/AmplSolver/Makefile.in b/src/Apps/AmplSolver/Makefile.in index 487d7f7b9..472fbbc1d 100644 --- a/src/Apps/AmplSolver/Makefile.in +++ b/src/Apps/AmplSolver/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,7 @@ # Copyright (C) 2004, 2006 International Business Machines and others. # All Rights Reserved. # This file is distributed under the Eclipse Public License. - +# # Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 @@ -107,7 +107,7 @@ 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 -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = ipoptamplinterface.pc CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)" @@ -141,7 +141,7 @@ am__uninstall_files_from_dir = { \ } LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = -libipoptamplinterface_la_DEPENDENCIES = ../../Interfaces/libipopt.la \ +libipoptamplinterface_la_DEPENDENCIES = ../../libipopt.la \ $(am__DEPENDENCIES_1) am_libipoptamplinterface_la_OBJECTS = AmplTNLP.lo libipoptamplinterface_la_OBJECTS = \ @@ -152,8 +152,7 @@ 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 +ipopt_DEPENDENCIES = libipoptamplinterface.la ../../libipopt.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -215,8 +214,6 @@ am__define_uniq_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 ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ @@ -236,8 +233,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -253,10 +251,12 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ +FILECMD = @FILECMD@ FLIBS = @FLIBS@ GREP = @GREP@ HSLLIB_CFLAGS = @HSLLIB_CFLAGS@ @@ -269,7 +269,6 @@ 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@ @@ -323,6 +322,8 @@ SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_LFLAGS = @SIPOPTAMPLINTERFACELIB_LFLAGS@ SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_PCFILES = @SIPOPTAMPLINTERFACELIB_PCFILES@ +SIPOPTLIB_CFLAGS_NOPC = @SIPOPTLIB_CFLAGS_NOPC@ +SIPOPTLIB_LFLAGS_NOPC = @SIPOPTLIB_LFLAGS_NOPC@ STRIP = @STRIP@ VERSION = @VERSION@ _ACJNI_JAVAC = @_ACJNI_JAVAC@ @@ -379,6 +380,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -388,29 +390,23 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ lib_LTLIBRARIES = libipoptamplinterface.la -libipoptamplinterface_la_SOURCES = \ - AmplTNLP.cpp - -libipoptamplinterface_la_LIBADD = ../../Interfaces/libipopt.la \ - $(IPOPTAMPLINTERFACELIB_LFLAGS) - -ipopt_SOURCES = \ - ampl_ipopt.cpp - -ipopt_LDADD = libipoptamplinterface.la ../../Interfaces/libipopt.la +libipoptamplinterface_la_SOURCES = AmplTNLP.cpp +libipoptamplinterface_la_LIBADD = ../../libipopt.la $(IPOPTAMPLINTERFACELIB_LFLAGS) +ipopt_SOURCES = ampl_ipopt.cpp +ipopt_LDADD = libipoptamplinterface.la ../../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) + -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 +pkgconfiglib_DATA = ipoptamplinterface.pc all: all-am .SUFFIXES: @@ -444,6 +440,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +ipoptamplinterface.pc: $(top_builddir)/config.status $(srcdir)/ipoptamplinterface.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ diff --git a/src/Apps/AmplSolver/ampl_ipopt.cpp b/src/Apps/AmplSolver/ampl_ipopt.cpp index ae76b7645..b2026a056 100644 --- a/src/Apps/AmplSolver/ampl_ipopt.cpp +++ b/src/Apps/AmplSolver/ampl_ipopt.cpp @@ -48,6 +48,7 @@ int main( { SmartPtr options = app->Options(); options->SetStringValue("print_options_documentation", "yes"); + options->SetStringValue("print_advanced_options", "yes"); options->SetStringValue("print_options_mode", print_options_mode); app->Initialize(""); return 0; @@ -82,7 +83,7 @@ int main( 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->RegOptions(), app->Options(), args, suffix_handler); // Call Initialize again to process output related options retval = app->Initialize(); @@ -95,7 +96,7 @@ int main( const int n_loops = 1; // make larger for profiling for( Index i = 0; i < n_loops; i++ ) { - retval = app->OptimizeTNLP(ampl_tnlp); + app->OptimizeTNLP(ampl_tnlp); } // finalize_solution method in AmplTNLP writes the solution file diff --git a/src/Apps/AmplSolver/ipoptamplinterface.pc.in b/src/Apps/AmplSolver/ipoptamplinterface.pc.in index dd79527ce..da5c46635 100644 --- a/src/Apps/AmplSolver/ipoptamplinterface.pc.in +++ b/src/Apps/AmplSolver/ipoptamplinterface.pc.in @@ -6,10 +6,11 @@ includedir=@includedir@/coin-or Name: IPOPT-AMPL Description: Ampl Interface TNLP to Ipopt -URL: https://github.com/coin-or/Ipopt +URL: @PACKAGE_URL@ Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lipoptamplinterface -Libs.private: @IPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ Cflags: -I${includedir} -Requires: ipopt -Requires.private: @IPOPTAMPLINTERFACELIB_PCFILES@ +@COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lipoptamplinterface +@COIN_STATIC_BUILD_FALSE@Requires: ipopt +@COIN_STATIC_BUILD_FALSE@Requires.private: @IPOPTAMPLINTERFACELIB_PCFILES@ +@COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lipoptamplinterface @IPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ +@COIN_STATIC_BUILD_TRUE@Requires: ipopt @IPOPTAMPLINTERFACELIB_PCFILES@ diff --git a/src/Apps/Makefile.am b/src/Apps/Makefile.am deleted file mode 100644 index 9f3ab7405..000000000 --- a/src/Apps/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (C) 2004, 2006 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -SUBDIRS = - -if COIN_HAS_ASL - SUBDIRS += AmplSolver -endif diff --git a/src/Apps/Makefile.in b/src/Apps/Makefile.in deleted file mode 100644 index f65527f8f..000000000 --- a/src/Apps/Makefile.in +++ /dev/null @@ -1,590 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2004, 2006 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@COIN_HAS_ASL_TRUE@am__append_1 = AmplSolver -subdir = src/Apps -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/src/Common/config.h \ - $(top_builddir)/src/Common/config_ipopt.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -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 = -SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS -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 -DIST_SUBDIRS = AmplSolver -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = $(am__append_1) -all: all-recursive - -.SUFFIXES: -$(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; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Apps/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Apps/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -ctags: ctags-recursive - -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) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -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 -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -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 -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(am__recursive_targets) install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-am clean clean-generic clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-generic distclean-libtool \ - distclean-tags dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# 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/Common/IpCachedResults.hpp b/src/Common/IpCachedResults.hpp index 0ad537100..22dbb4f00 100644 --- a/src/Common/IpCachedResults.hpp +++ b/src/Common/IpCachedResults.hpp @@ -74,18 +74,18 @@ class CachedResults #endif /** @name Constructors and Destructors. */ - //@{ + ///@{ /** Constructor */ CachedResults( - Int max_cache_size /**< maximal number of results that should be cached, negative for infinity */ + int max_cache_size /**< maximal number of results that should be cached, negative for infinity */ ); /** Destructor */ virtual ~CachedResults(); - //@} + ///@} /** @name Generic methods for adding and retrieving cached results. */ - //@{ + ///@{ /** Generic method for adding a result to the cache, given a * std::vector of TaggesObjects and a std::vector of Numbers. */ @@ -116,12 +116,12 @@ class CachedResults T& retResult, const std::vector& dependents ) const; - //@} + ///@} /** @name Pointer-based methods for adding and retrieving cached * results, providing dependencies explicitly. */ - //@{ + ///@{ /** Method for adding a result to the cache, proving one * dependency as a TaggedObject explicitly. */ @@ -177,7 +177,7 @@ class CachedResults ); /** @name Pointer-free version of the Add and Get methods */ - //@{ + ///@{ bool GetCachedResult1Dep( T& retResult, const TaggedObject& dependent1 @@ -230,7 +230,7 @@ class CachedResults { AddCachedResult3Dep(result, &dependent1, &dependent2, &dependent3); } - //@} + ///@} /** Invalidates the result for given dependencies. * @@ -248,7 +248,7 @@ class CachedResults /** Invalidate all cached results and changes max_cache_size */ void Clear( - Int max_cache_size + int max_cache_size ); private: @@ -261,7 +261,7 @@ class CachedResults * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ CachedResults(); @@ -274,10 +274,10 @@ class CachedResults void operator=( const CachedResults& ); - //@} + ///@} /** maximum number of cached results */ - Int max_cache_size_; + int max_cache_size_; /** list of currently cached results. */ mutable std::list*>* cached_results_; @@ -307,7 +307,7 @@ class DependentResult: public Observer #endif /** @name Constructor, Destructors */ - //@{ + ///@{ /** Constructor, given all information about the result. */ DependentResult( const T& result, @@ -317,10 +317,10 @@ class DependentResult: public Observer /** Destructor. */ ~DependentResult(); - //@} + ///@} /** @name Accessor method. */ - //@{ + ///@{ /** Indicates, whether the DependentResult is no longer valid. */ bool IsStale() const; @@ -329,7 +329,7 @@ class DependentResult: public Observer /** Returns the cached result. */ const T& GetResult() const; - //@} + ///@} /** This method returns true if the dependencies provided to this * function are identical to the ones stored with the @@ -369,7 +369,7 @@ class DependentResult: public Observer * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ DependentResult(); @@ -382,7 +382,7 @@ class DependentResult: public Observer void operator=( const DependentResult& ); - //@} + ///@} /** Flag indicating, if the cached result is still valid. * @@ -547,7 +547,7 @@ void DependentResult::DebugPrint() const template CachedResults::CachedResults( - Int max_cache_size + int max_cache_size ) : max_cache_size_(max_cache_size), cached_results_(NULL) @@ -567,7 +567,7 @@ CachedResults::~CachedResults() if( cached_results_ ) { - for( typename std::list*>::iterator iter = cached_results_->begin(); iter != cached_results_->end(); iter++ ) + for( typename std::list*>::iterator iter = cached_results_->begin(); iter != cached_results_->end(); ++iter ) { delete *iter; } @@ -610,8 +610,8 @@ void CachedResults::AddCachedResult( { // if negative, allow infinite cache // non-negative - limit size of list to max_cache_size - DBG_ASSERT((Int)cached_results_->size() <= max_cache_size_ + 1); - if( (Int) cached_results_->size() > max_cache_size_ ) + DBG_ASSERT(cached_results_->size() <= (size_t)max_cache_size_ + 1); + if( cached_results_->size() > (size_t)max_cache_size_ ) { delete cached_results_->back(); cached_results_->pop_back(); @@ -653,8 +653,7 @@ bool CachedResults::GetCachedResult( CleanupInvalidatedResults(); bool retValue = false; - typename std::list*>::const_iterator iter; - for( iter = cached_results_->begin(); iter != cached_results_->end(); iter++ ) + for( typename std::list*>::const_iterator iter = cached_results_->begin(); iter != cached_results_->end(); ++iter ) if( (*iter)->DependentsIdentical(dependents, scalar_dependents) ) { retResult = (*iter)->GetResult(); @@ -802,8 +801,7 @@ bool CachedResults::InvalidateResult( CleanupInvalidatedResults(); bool retValue = false; - typename std::list*>::const_iterator iter; - for( iter = cached_results_->begin(); iter != cached_results_->end(); iter++ ) + for( typename std::list*>::const_iterator iter = cached_results_->begin(); iter != cached_results_->end(); ++iter ) if( (*iter)->DependentsIdentical(dependents, scalar_dependents) ) { (*iter)->Invalidate(); @@ -822,8 +820,7 @@ void CachedResults::Clear() return; } - typename std::list*>::const_iterator iter; - for( iter = cached_results_->begin(); iter != cached_results_->end(); iter++ ) + for( typename std::list*>::const_iterator iter = cached_results_->begin(); iter != cached_results_->end(); ++iter ) { (*iter)->Invalidate(); } @@ -833,7 +830,7 @@ void CachedResults::Clear() template void CachedResults::Clear( - Int max_cache_size + int max_cache_size ) { Clear(); @@ -858,15 +855,14 @@ void CachedResults::CleanupInvalidatedResults() const { if( (*iter)->IsStale() ) { - typename std::list*>::iterator iter_to_remove = iter; - iter++; + typename std::list*>::iterator iter_to_remove = iter++; DependentResult* result_to_delete = (*iter_to_remove); cached_results_->erase(iter_to_remove); delete result_to_delete; } else { - iter++; + ++iter; } } } @@ -886,9 +882,9 @@ void CachedResults::DebugPrintCachedResults() const { typename std::list< DependentResult* >::const_iterator iter; DBG_PRINT((2, "Current set of cached results:\n")); - for (iter = cached_results_->begin(); iter != cached_results_->end(); iter++) + for (iter = cached_results_->begin(); iter != cached_results_->end(); ++iter) { - DBG_PRINT((2, " DependentResult:0x%x\n", (*iter))); + DBG_PRINT((2, " DependentResult: %p\n", (void*)*iter)); } } } diff --git a/src/Common/IpDebug.cpp b/src/Common/IpDebug.cpp index dc5997cfb..adfef88f8 100644 --- a/src/Common/IpDebug.cpp +++ b/src/Common/IpDebug.cpp @@ -18,8 +18,8 @@ Index DebugJournalistWrapper::indentation_level_ = 0; Journalist* DebugJournalistWrapper::jrnl_ = NULL; DebugJournalistWrapper::DebugJournalistWrapper( - std::string func_name, - Index verbose_level + const std::string& func_name, + Index verbose_level ) : func_name_(func_name), verbose_level_(verbose_level), @@ -38,9 +38,9 @@ DebugJournalistWrapper::DebugJournalistWrapper( } DebugJournalistWrapper::DebugJournalistWrapper( - std::string func_name, - Index verbose_level, - const void* const method_owner + const std::string& func_name, + Index verbose_level, + const void* const method_owner ) : func_name_(func_name), verbose_level_(verbose_level), @@ -51,7 +51,7 @@ DebugJournalistWrapper::DebugJournalistWrapper( verbose_level_ = 0; return; } - DebugPrintf(1, "-> Calling to: %s in obj: 0x%x\n", func_name_.c_str(), + DebugPrintf(1, "-> Calling to: %s in obj: %p\n", func_name_.c_str(), method_owner_); if (verbose_level_ > 0) { @@ -73,7 +73,7 @@ DebugJournalistWrapper::~DebugJournalistWrapper() } else { - DebugPrintf(1, "<- Returning from : %s in obj: 0x%x\n", + DebugPrintf(1, "<- Returning from : %s in obj: %p\n", func_name_.c_str(), method_owner_); } } diff --git a/src/Common/IpDebug.hpp b/src/Common/IpDebug.hpp index 979add90e..b237385a2 100644 --- a/src/Common/IpDebug.hpp +++ b/src/Common/IpDebug.hpp @@ -60,22 +60,22 @@ class IPOPTLIB_EXPORT DebugJournalistWrapper { public: /** @name Constructors/Destructors. */ - //@{ + ///@{ DebugJournalistWrapper( - std::string func_name, - Index verbose_level + const std::string& func_name, + Index verbose_level ); DebugJournalistWrapper( - std::string func_name, - Index verbose_level, - const void* const method_owner + const std::string& func_name, + Index verbose_level, + const void* const method_owner ); ~DebugJournalistWrapper(); - //@} + ///@} /** @name accessor methods */ - //@{ + ///@{ Index Verbosity() { return verbose_level_; @@ -88,25 +88,30 @@ class IPOPTLIB_EXPORT DebugJournalistWrapper { return indentation_level_; } - //@} + ///@} /** Printing */ +#ifdef __GNUC__ + __attribute__((format(printf, 3, 4))) +#endif void DebugPrintf( Index verbosity, const char* pformat, ... ); +private: + friend class IpoptApplication; /* Method for initialization of the static GLOBAL journalist, * through with all debug printout is to be written. * * This needs to be set before any debug printout can be done. + * It is expected that this is only called by the IpoptApplication constructor. */ static void SetJournalist( Journalist* jrnl ); -private: /**@name Default Compiler Generated Methods * (Hidden to avoid implicit creation/calling). * @@ -116,7 +121,7 @@ class IPOPTLIB_EXPORT DebugJournalistWrapper * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** default constructor */ DebugJournalistWrapper(); @@ -129,7 +134,7 @@ class IPOPTLIB_EXPORT DebugJournalistWrapper DebugJournalistWrapper& operator=( const DebugJournalistWrapper& ); - //@} + ///@} static Index indentation_level_; std::string func_name_; diff --git a/src/Common/IpException.hpp b/src/Common/IpException.hpp index 18a8c09a0..59bc037de 100644 --- a/src/Common/IpException.hpp +++ b/src/Common/IpException.hpp @@ -58,13 +58,13 @@ class IPOPTLIB_EXPORT IpoptException { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ IpoptException( - std::string msg, - std::string file_name, - Index line_number, - std::string type = "IpoptException" + const std::string& msg, + const std::string& file_name, + Index line_number, + const std::string& type = "IpoptException" ) : msg_(msg), file_name_(file_name), @@ -85,7 +85,7 @@ class IPOPTLIB_EXPORT IpoptException /** Default destructor */ virtual ~IpoptException() { } - //@} + ///@} /** Method to report the exception to a journalist */ void ReportException( @@ -94,7 +94,7 @@ class IPOPTLIB_EXPORT IpoptException ) const { jnlst.Printf(level, J_MAIN, - "Exception of type: %s in file \"%s\" at line %d:\n Exception message: %s\n", type_.c_str(), file_name_.c_str(), line_number_, msg_.c_str()); + "Exception of type: %s in file \"%s\" at line %" IPOPT_INDEX_FORMAT ":\n Exception message: %s\n", type_.c_str(), file_name_.c_str(), line_number_, msg_.c_str()); } const std::string& Message() const @@ -111,7 +111,7 @@ class IPOPTLIB_EXPORT IpoptException * 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 */ IpoptException(); @@ -119,7 +119,7 @@ class IPOPTLIB_EXPORT IpoptException void operator=( const IpoptException& ); - //@} + ///@} std::string msg_; std::string file_name_; @@ -144,7 +144,7 @@ class IPOPTLIB_EXPORT IpoptException class IPOPTLIB_EXPORT __except_type : public Ipopt::IpoptException \ { \ public: \ - __except_type(std::string msg, std::string fname, Ipopt::Index line) \ + __except_type(const std::string& msg, const std::string& fname, Ipopt::Index line) \ : Ipopt::IpoptException(msg,fname,line, #__except_type) {} \ __except_type(const __except_type& copy) \ : Ipopt::IpoptException(copy) {} \ diff --git a/src/Common/IpJournalist.cpp b/src/Common/IpJournalist.cpp index 093e8e435..eab931a28 100644 --- a/src/Common/IpJournalist.cpp +++ b/src/Common/IpJournalist.cpp @@ -264,14 +264,15 @@ bool Journalist::AddJournal( SmartPtr Journalist::AddFileJournal( const std::string& journal_name, const std::string& fname, - EJournalLevel default_level + EJournalLevel default_level, + bool file_append ) { SmartPtr temp = new FileJournal(journal_name, default_level); // Open the file (Note:, a fname of "stdout" is handled by the // Journal class to mean stdout, etc. - if( temp->Open(fname.c_str()) && AddJournal(GetRawPtr(temp)) ) + if( temp->Open(fname.c_str(), file_append) && AddJournal(GetRawPtr(temp)) ) { return GetRawPtr(temp); } @@ -392,7 +393,10 @@ FileJournal::~FileJournal() file_ = NULL; } -bool FileJournal::Open(const char* fname) +bool FileJournal::Open( + const char* fname, + bool fappend +) { if( file_ && file_ != stdout && file_ != stderr ) { @@ -414,7 +418,7 @@ bool FileJournal::Open(const char* fname) else { // open the file on disk - file_ = fopen(fname, "w+"); + file_ = fopen(fname, fappend ? "a+" : "w+"); if( file_ ) { return true; diff --git a/src/Common/IpJournalist.hpp b/src/Common/IpJournalist.hpp index d7f3d6d07..97f647ffc 100644 --- a/src/Common/IpJournalist.hpp +++ b/src/Common/IpJournalist.hpp @@ -26,7 +26,7 @@ class Journal; class FileJournal; /**@name Journalist Enumerations. */ -//@{ +///@{ /** Print Level Enum. */ enum EJournalLevel { @@ -84,7 +84,7 @@ enum EJournalCategory J_USER17, /**< This can be used by the user's application*/ J_LAST_CATEGORY }; -//@} +///@} /** Class responsible for all message output. * @@ -117,20 +117,23 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject { public: /**@name Constructor / Desructor. */ - //@{ + ///@{ /** Constructor. */ Journalist(); /** Destructor... */ virtual ~Journalist(); - //@} + ///@} /**@name Author Methods. * These methods are used by authoring code, or code that wants * to report some information. */ - //@{ + ///@{ /** Method to print a formatted string */ +#ifdef __GNUC__ + __attribute__((format(printf, 4, 5))) +#endif virtual void Printf( EJournalLevel level, EJournalCategory category, @@ -156,6 +159,9 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject ) const; /** Method to print a formatted string with indentation */ +#ifdef __GNUC__ + __attribute__((format(printf, 5, 6))) +#endif virtual void PrintfIndented( EJournalLevel level, EJournalCategory category, @@ -169,7 +175,7 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject EJournalLevel level, EJournalCategory category, const char* pformat, - va_list ap + va_list ap ) const; /** Method to print a formatted string with indentation, using the va_list argument. */ @@ -178,7 +184,7 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject EJournalCategory category, Index indent_level, const char* pformat, - va_list ap + va_list ap ) const; /** Method that returns true if there is a Journal that would @@ -200,7 +206,7 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject * program (e.g. written in Fortran) */ virtual void FlushBuffer() const; - //@} + ///@} /**@name Reader Methods. * These methods are used by the reader. The reader will setup the @@ -212,7 +218,7 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject * for each category. Then use the internal Journal objects to * set specific print levels for each category (or keep defaults). */ - //@{ + ///@{ /** Add a new journal. */ virtual bool AddJournal( const SmartPtr jrnl @@ -225,7 +231,8 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject virtual SmartPtr AddFileJournal( const std::string& location_name, /**< string identifier, which can be used to obtain the pointer to the new Journal at a later point using the GetJournal method */ const std::string& fname, /**< name of the file to which this Journal corresponds; use "stdout" for stdout and use "stderr" for stderr */ - EJournalLevel default_level = J_WARNING /**< default journal level used to initialize the printing level for all categories */ + EJournalLevel default_level = J_WARNING,/**< default journal level used to initialize the printing level for all categories */ + bool file_append = false /**< whether to append to file or truncate it (since 3.14.13) */ ); /** Get an existing journal. @@ -238,7 +245,7 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject /** Delete all journals currently known by the journalist. */ virtual void DeleteAllJournals(); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -250,7 +257,7 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ Journalist( const Journalist& @@ -260,12 +267,12 @@ class IPOPTLIB_EXPORT Journalist: public ReferencedObject void operator=( const Journalist& ); - //@} + ///@} //** Private Data Members. */ - //@{ + ///@{ std::vector > journals_; - //@} + ///@} }; /** Journal class (part of the Journalist implementation.). This @@ -308,7 +315,7 @@ class IPOPTLIB_EXPORT Journal: public ReferencedObject * Journalist will output the message regardless of print level * and category. You should use the Journalist to print & flush instead */ - //@{ + ///@{ /** Ask if a particular print level/category is accepted by the journal. */ virtual bool IsAccepted( EJournalCategory category, @@ -341,14 +348,14 @@ class IPOPTLIB_EXPORT Journal: public ReferencedObject { FlushBufferImpl(); } - //@} + ///@} protected: /**@name Implementation version of Print methods. * * Derived classes should overload the Impl methods. */ - //@{ + ///@{ /** Print to the designated output location */ virtual void PrintImpl( EJournalCategory category, @@ -366,7 +373,7 @@ class IPOPTLIB_EXPORT Journal: public ReferencedObject /** Flush output buffer.*/ virtual void FlushBufferImpl() = 0; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -378,7 +385,7 @@ class IPOPTLIB_EXPORT Journal: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ Journal(); @@ -391,7 +398,7 @@ class IPOPTLIB_EXPORT Journal: public ReferencedObject void operator=( const Journal& ); - //@} + ///@} /** Name of the output location */ std::string name_; @@ -426,7 +433,8 @@ class IPOPTLIB_EXPORT FileJournal: public Journal * @return false only if the file with the given name could not be opened */ virtual bool Open( - const char* fname + const char* fname, /**< name of file to open */ + bool fappend = false /**< whether to append or truncate file (since 3.14.13) */ ); protected: @@ -434,7 +442,7 @@ class IPOPTLIB_EXPORT FileJournal: public Journal * * Overloaded from Journal base class. */ - //@{ + ///@{ /** Print to the designated output location */ virtual void PrintImpl( EJournalCategory /*category*/, @@ -452,7 +460,7 @@ class IPOPTLIB_EXPORT FileJournal: public Journal /** Flush output buffer.*/ virtual void FlushBufferImpl(); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -464,7 +472,7 @@ class IPOPTLIB_EXPORT FileJournal: public Journal * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ FileJournal(); @@ -477,7 +485,7 @@ class IPOPTLIB_EXPORT FileJournal: public Journal void operator=( const FileJournal& ); - //@} + ///@} /** FILE pointer for the output destination */ FILE* file_; @@ -510,7 +518,7 @@ class IPOPTLIB_EXPORT StreamJournal: public Journal * * Overloaded from Journal base class. */ - //@{ + ///@{ /** Print to the designated output location */ virtual void PrintImpl( EJournalCategory /*category*/, @@ -528,7 +536,7 @@ class IPOPTLIB_EXPORT StreamJournal: public Journal /** Flush output buffer.*/ virtual void FlushBufferImpl(); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -540,7 +548,7 @@ class IPOPTLIB_EXPORT StreamJournal: public Journal * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ StreamJournal(); @@ -553,7 +561,7 @@ class IPOPTLIB_EXPORT StreamJournal: public Journal void operator=( const StreamJournal& ); - //@} + ///@} /** pointer to output stream for the output destination */ std::ostream* os_; diff --git a/src/Common/IpLibraryLoader.cpp b/src/Common/IpLibraryLoader.cpp new file mode 100644 index 000000000..fb1729e81 --- /dev/null +++ b/src/Common/IpLibraryLoader.cpp @@ -0,0 +1,211 @@ +// Copyright (C) 2021 COIN-OR Foundation +// All Rights Reserved. +// This code is published under the Eclipse Public License. + +#include "IpLibraryLoader.hpp" +#include "IpoptConfig.h" + +#include +#include + +#ifdef HAVE_WINDOWS_H +# include +#elif defined(HAVE_DLFCN_H) +# include +#endif + +namespace Ipopt +{ + +#ifdef IPOPT_HAS_LINEARSOLVERLOADER + +#ifdef HAVE_WINDOWS_H +// add description of last error on windows to string +// see https://stackoverflow.com/questions/455434/how-should-i-use-formatmessage-properly-in-c +static +void addLastError( + std::stringstream& s +) +{ + LPTSTR errorText = NULL; + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, GetLastError(), 0, (LPTSTR)&errorText, 0, NULL); + if( errorText != NULL ) + { + s << errorText; + LocalFree(errorText); + } + else + { + s << "see https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes)"; + } +} +#endif + +void LibraryLoader::loadLibrary() +{ + if( libname.empty() ) + { + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, "No library name given (libname is empty)"); + } + +#ifdef HAVE_WINDOWS_H + libhandle = (void*)LoadLibrary(libname.c_str()); + if( libhandle == NULL ) + { + std::stringstream s; + s << "Error " << GetLastError() << " while loading DLL " << libname << ": "; + addLastError(s); + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, s.str()); + } + +#elif defined(HAVE_DLFCN_H) + // ToDo switch to RTLD_LAZY for performance? + libhandle = dlopen(libname.c_str(), RTLD_NOW); + if( libhandle == NULL ) + { + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, dlerror()); + } + +#else + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, "Do not know how to handle shared libraries on this operating system"); +#endif +} + +void LibraryLoader::unloadLibrary() +{ + if( libhandle == NULL ) + { + return; + } + +#ifdef HAVE_WINDOWS_H + if( FreeLibrary((HMODULE)libhandle) == 0 ) + { + std::stringstream s; + s << "Error " << GetLastError() << " while unloading " << libname << ": "; + addLastError(s); + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, s.str()); + } + +#elif defined(HAVE_DLFCN_H) + if( dlclose(libhandle) != 0 ) + { + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, dlerror()); + } +#endif +} + +/** tries to load symbol from a loaded library */ +void* LibraryLoader::loadSymbol( + const std::string& symbolname /**< base name of symbol */ +) +{ + if( libhandle == NULL ) + { + loadLibrary(); + } + DBG_ASSERT(libhandle != NULL); + + size_t len = symbolname.size(); + char* tripSym = new char[symbolname.size() + 2]; + void* symbol = NULL; + + for( int trip = 1; trip <= 6; trip++ ) + { + switch( trip ) + { + case 1: /* original */ + memcpy((void*)tripSym, (void*)symbolname.c_str(), len + 1); + break; + + case 2: /* original_ */ + tripSym[len] = '_'; + tripSym[len + 1] = '\0'; + break; + + case 3: /* lower_ */ + for( size_t i = 0; i < len; ++i ) + { + tripSym[i] = tolower(tripSym[i]); + } + break; + + case 4: /* lower */ + tripSym[len] = '\0'; + break; + + case 5: /* upper_ */ + for( size_t i = 0; i < len; ++i ) + { + tripSym[i] = toupper(tripSym[i]); + } + tripSym[len] = '_'; + break; + + case 6: /* upper */ + tripSym[len] = '\0'; + break; + + default: + ; + } + +#ifdef HAVE_WINDOWS_H + symbol = (void*)GetProcAddress((HMODULE)libhandle, tripSym); +#elif defined(HAVE_DLFCN_H) + symbol = dlsym(libhandle, tripSym); +#endif + if( symbol != NULL ) + { + break; + } + } + + delete[] tripSym; + + if( symbol == NULL ) + { +#ifdef HAVE_WINDOWS_H + std::stringstream s; + s << "Error " << GetLastError() << " while loading symbol " << symbolname << " from " << libname << ": "; + addLastError(s); + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, s.str()); +#elif defined(HAVE_DLFCN_H) + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, dlerror()); +#endif + } + + return symbol; +} + +#else // IPOPT_HAS_LINEARSOLVERLOADER + +void LibraryLoader::loadLibrary() +{ + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, "Cannot load library at runtime. Ipopt has been build with --disable-linear-solver-loader."); +} + +void LibraryLoader::unloadLibrary() +{ + if( libhandle == NULL ) + { + return; + } + + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, "Cannot load library at runtime. Ipopt has been build with --disable-linear-solver-loader"); +} + +/** tries to load symbol from a loaded library */ +void* LibraryLoader::loadSymbol( + const std::string& +) +{ + THROW_EXCEPTION(DYNAMIC_LIBRARY_FAILURE, "Cannot load library at runtime. Ipopt has been build with --disable-linear-solver-loader"); + + return NULL; +} + +#endif // !IPOPT_HAS_LINEARSOLVERLOADER + +} // namespace Ipopt diff --git a/src/Common/IpLibraryLoader.hpp b/src/Common/IpLibraryLoader.hpp new file mode 100644 index 000000000..fa496f6e5 --- /dev/null +++ b/src/Common/IpLibraryLoader.hpp @@ -0,0 +1,76 @@ +// Copyright (C) 2021 COIN-OR Foundation +// All Rights Reserved. +// This code is published under the Eclipse Public License. + +#ifndef __IPLIBRARYLOADER_HPP__ +#define __IPLIBRARYLOADER_HPP__ + +#include "IpReferenced.hpp" +#include "IpException.hpp" + +#ifdef _WIN32 +# define IPOPT_SHAREDLIBEXT "dll" +#elif defined(__APPLE__) +# define IPOPT_SHAREDLIBEXT "dylib" +#else +# define IPOPT_SHAREDLIBEXT "so" +#endif + +namespace Ipopt +{ + +/** loading of a library at runtime + * + * wrapper around dlopen()/dlsym() and variants + * @since 3.14.0 + */ +class IPOPTLIB_EXPORT LibraryLoader : public ReferencedObject +{ +private: + std::string libname; + void* libhandle; + + /** unimplemented copy constructor */ + LibraryLoader(const LibraryLoader&); + /** unimplemented assigment operator */ + LibraryLoader& operator=(const LibraryLoader&); + +public: + /** constructor */ + LibraryLoader( + const std::string& libname_ /**< full name of library, can include path */ + ) + : libname(libname_), + libhandle(NULL) + { } + + /** destructor */ + ~LibraryLoader() + { + unloadLibrary(); + } + + /** tries to load library */ + void loadLibrary(); + + /** unload library, if loaded */ + void unloadLibrary(); + + /** tries to load symbol + * + * calls loadLibrary() if no library loaded yet + */ + void* loadSymbol( + const std::string& symbolname /**< base name of symbol */ + ); +}; + +/** a problem occurred with a a dynamically loaded library + * + * e.g., library could not be loaded or a symbol could not be found + */ +DECLARE_STD_EXCEPTION(DYNAMIC_LIBRARY_FAILURE); + +} // namespace Ipopt + +#endif /* __IPLIBRARYLOADER_HPP__ */ diff --git a/src/Common/IpObserver.hpp b/src/Common/IpObserver.hpp index b1bd4849a..9bffa9ad6 100644 --- a/src/Common/IpObserver.hpp +++ b/src/Common/IpObserver.hpp @@ -43,7 +43,7 @@ class IPOPTLIB_EXPORT Observer #endif /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ Observer() { } @@ -51,7 +51,7 @@ class IPOPTLIB_EXPORT Observer /** Destructor */ inline virtual ~Observer(); - //@} + ///@} /** Enumeration specifying the type of notification */ enum NotifyType @@ -105,7 +105,7 @@ class IPOPTLIB_EXPORT Observer * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ Observer( const Observer& @@ -115,7 +115,7 @@ class IPOPTLIB_EXPORT Observer void operator=( const Observer& ); - //@} + ///@} /** A list of the subjects currently being observed. */ std::vector subjects_; @@ -154,7 +154,7 @@ class IPOPTLIB_EXPORT Subject #endif /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ Subject() { } @@ -162,7 +162,7 @@ class IPOPTLIB_EXPORT Subject /** Destructor */ inline virtual ~Subject(); - //@} + ///@} /**@name Methods to Add and Remove Observers. * @@ -176,7 +176,7 @@ class IPOPTLIB_EXPORT Subject * depending on type could be implemented later if * necessary. */ - //@{ + ///@{ /** Attach the specified observer * (i.e., begin receiving notifications). */ inline @@ -192,7 +192,7 @@ class IPOPTLIB_EXPORT Subject Observer::NotifyType notify_type, Observer* observer ) const; - //@} + ///@} protected: @@ -211,7 +211,7 @@ class IPOPTLIB_EXPORT Subject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ Subject( const Subject& @@ -221,7 +221,7 @@ class IPOPTLIB_EXPORT Subject void operator=( const Subject& ); - //@} + ///@} mutable std::vector observers_; }; @@ -233,20 +233,20 @@ inline Observer::~Observer() DBG_START_METH("Observer::~Observer", dbg_verbosity); if (DBG_VERBOSITY() >= 1) { - for (Index i = 0; i < (Index)subjects_.size(); i++) + for( size_t i = 0; i < subjects_.size(); ++i ) { - DBG_PRINT((1, "subjects_[%d] = 0x%x\n", i, subjects_[i])); + DBG_PRINT((1, "subjects_[%zd] = %p\n", i, (const void*)subjects_[i])); } } #endif // Detach all subjects - for( Int i = (Int) (subjects_.size() - 1); i >= 0; i-- ) + for( size_t i = subjects_.size(); i > 0; --i ) { #ifdef IP_DEBUG_OBSERVER - DBG_PRINT((1, "About to detach subjects_[%d] = 0x%x\n", i, subjects_[i])); + DBG_PRINT((1, "About to detach subjects_[%zd] = %p\n", i, (const void*)subjects_[i - 1])); #endif - RequestDetach(NT_All, subjects_[i]); + RequestDetach(NT_All, subjects_[i - 1]); } } @@ -280,7 +280,7 @@ void Observer::RequestDetach( { #ifdef IP_DEBUG_OBSERVER DBG_START_METH("Observer::RequestDetach", dbg_verbosity); - DBG_PRINT((1, "Requesting detach of subject: 0x%x\n", subject)); + DBG_PRINT((1, "Requesting detach of subject: %p\n", (const void*)subject)); DBG_ASSERT(subject); #endif @@ -296,7 +296,7 @@ void Observer::RequestDetach( if( attached_subject != subjects_.end() ) { #ifdef IP_DEBUG_OBSERVER - DBG_PRINT((1, "Removing subject: 0x%x from the list\n", subject)); + DBG_PRINT((1, "Removing subject: %p from the list\n", (const void*)subject)); #endif subjects_.erase(attached_subject); @@ -346,8 +346,7 @@ inline Subject::~Subject() DBG_START_METH("Subject::~Subject", dbg_verbosity); #endif - std::vector::iterator iter; - for( iter = observers_.begin(); iter != observers_.end(); iter++ ) + for( std::vector::iterator iter = observers_.begin(); iter != observers_.end(); ++iter ) { (*iter)->ProcessNotification(Observer::NT_BeingDestroyed, this); } @@ -412,8 +411,7 @@ void Subject::Notify( DBG_START_METH("Subject::Notify", dbg_verbosity); #endif - std::vector::iterator iter; - for( iter = observers_.begin(); iter != observers_.end(); iter++ ) + for( std::vector::iterator iter = observers_.begin(); iter != observers_.end(); ++iter ) { (*iter)->ProcessNotification(notify_type, this); } diff --git a/src/Common/IpOptionsList.cpp b/src/Common/IpOptionsList.cpp index 8a2defad4..7aafa0487 100644 --- a/src/Common/IpOptionsList.cpp +++ b/src/Common/IpOptionsList.cpp @@ -30,9 +30,8 @@ bool OptionsList::SetStringValue( { if( IsValid(jnlst_) ) { - std::string msg = "Tried to set Option: " + tag; - msg += ". It is not a valid option. Please check the list of available options.\n"; - jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + jnlst_->Printf(J_ERROR, J_MAIN, + "Tried to set Option: %s. It is not a valid option. Please check the list of available options.\n", tag.c_str()); } //THROW_EXCEPTION(OPTION_INVALID, msg); return false; @@ -57,7 +56,7 @@ bool OptionsList::SetStringValue( msg += " Unknown"; } msg += ", not of type String. Please check the documentation for options.\n"; - jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + jnlst_->Printf(J_ERROR, J_MAIN, "%s", msg.c_str()); option->OutputDescription(*jnlst_); } //THROW_EXCEPTION(OPTION_INVALID, msg); @@ -68,11 +67,9 @@ bool OptionsList::SetStringValue( { if( IsValid(jnlst_) ) { - std::string msg = "Setting: \"" + value; - msg += "\" is not a valid setting for Option: "; - msg += tag; - msg += ". Check the option documentation.\n"; - jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + jnlst_->Printf(J_ERROR, J_MAIN, + "Setting: \"%s\" is not a valid setting for Option: %s. Check the option documentation.\n", + value.c_str(), tag.c_str()); option->OutputDescription(*jnlst_); } //THROW_EXCEPTION(OPTION_INVALID, msg); @@ -90,7 +87,7 @@ bool OptionsList::SetStringValue( msg += " The setting will remain as: \"" + tag; msg += " " + options_[lowercase(tag)].GetValue(); msg += "\"\n"; - jnlst_->Printf(J_WARNING, J_MAIN, msg.c_str()); + jnlst_->Printf(J_WARNING, J_MAIN, "%s", msg.c_str()); } } else @@ -107,7 +104,7 @@ bool OptionsList::SetStringValue( // msg += "\" not taken because a value of \n\"" ; // msg += options_[lowercase(tag)].GetValue(); // msg += "\" already exists and is set to disallow clobbering.\n\n"; - // jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + // jnlst_->Printf(J_ERROR, J_MAIN, "%s", msg.c_str()); // return false; } @@ -129,9 +126,8 @@ bool OptionsList::SetNumericValue( { if( IsValid(jnlst_) ) { - std::string msg = "Tried to set Option: " + tag; - msg += ". It is not a valid option. Please check the list of available options.\n"; - jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + jnlst_->Printf(J_ERROR, J_MAIN, + "Tried to set Option: %s. It is not a valid option. Please check the list of available options.\n", tag.c_str()); } //THROW_EXCEPTION(OPTION_INVALID, msg); return false; @@ -156,7 +152,7 @@ bool OptionsList::SetNumericValue( msg += " Unknown"; } msg += ", not of type Number. Please check the documentation for options.\n"; - jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + jnlst_->Printf(J_ERROR, J_MAIN, "%s", msg.c_str()); option->OutputDescription(*jnlst_); } //THROW_EXCEPTION(OPTION_INVALID, msg); @@ -167,12 +163,9 @@ bool OptionsList::SetNumericValue( { if( IsValid(jnlst_) ) { - std::string msg = "Setting: \""; - msg += buffer; - msg += "\" is not a valid setting for Option: "; - msg += tag; - msg += ". Check the option documentation.\n"; - jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + jnlst_->Printf(J_ERROR, J_MAIN, + "Setting: \"%s\" is not a valid setting for Option: %s. Check the option documentation.\n", + buffer, tag.c_str()); option->OutputDescription(*jnlst_); } //THROW_EXCEPTION(OPTION_INVALID, msg); @@ -191,7 +184,7 @@ bool OptionsList::SetNumericValue( msg += " The setting will remain as: \"" + tag; msg += " " + options_[lowercase(tag)].GetValue(); msg += "\"\n"; - jnlst_->Printf(J_WARNING, J_MAIN, msg.c_str()); + jnlst_->Printf(J_WARNING, J_MAIN, "%s", msg.c_str()); } } else @@ -210,7 +203,7 @@ bool OptionsList::SetIntegerValue( ) { char buffer[256]; - Snprintf(buffer, 255, "%d", value); + Snprintf(buffer, 255, "%" IPOPT_INDEX_FORMAT, value); if( IsValid(reg_options_) ) { @@ -218,11 +211,10 @@ bool OptionsList::SetIntegerValue( if( IsNull(option) ) { - std::string msg = "Tried to set Option: " + tag; - msg += ". It is not a valid option. Please check the list of available options.\n"; if( IsValid(jnlst_) ) { - jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + jnlst_->Printf(J_ERROR, J_MAIN, + "Tried to set Option: %s. It is not a valid option. Please check the list of available options.\n", tag.c_str()); } //THROW_EXCEPTION(OPTION_INVALID, msg); return false; @@ -247,7 +239,7 @@ bool OptionsList::SetIntegerValue( msg += " Unknown"; } msg += ", not of type Integer. Please check the documentation for options.\n"; - jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + jnlst_->Printf(J_ERROR, J_MAIN, "%s", msg.c_str()); option->OutputDescription(*jnlst_); } //THROW_EXCEPTION(OPTION_INVALID, msg); @@ -258,12 +250,9 @@ bool OptionsList::SetIntegerValue( { if( IsValid(jnlst_) ) { - std::string msg = "Setting: \""; - msg += buffer; - msg += "\" is not a valid setting for Option: "; - msg += tag; - msg += ". Check the option documentation.\n"; - jnlst_->Printf(J_ERROR, J_MAIN, msg.c_str()); + jnlst_->Printf(J_ERROR, J_MAIN, + "Setting: \"%s\" is not a valid setting for Option: %s. Check the option documentation.\n", + buffer, tag.c_str()); option->OutputDescription(*jnlst_); } //THROW_EXCEPTION(OPTION_INVALID, msg); @@ -282,7 +271,7 @@ bool OptionsList::SetIntegerValue( msg += " The setting will remain as: \"" + tag; msg += " " + options_[lowercase(tag)].GetValue(); msg += "\"\n"; - jnlst_->Printf(J_WARNING, J_MAIN, msg.c_str()); + jnlst_->Printf(J_WARNING, J_MAIN, "%s", msg.c_str()); } } else @@ -294,6 +283,27 @@ bool OptionsList::SetIntegerValue( return true; } +bool OptionsList::UnsetValue( + const std::string& tag +) +{ + if( !will_allow_clobber(tag) ) + { + if( IsValid(jnlst_) ) + { + std::string msg = "WARNING: Tried to unset option \"" + tag; + msg += "\",\n but the current value is set to disallow clobbering.\n"; + msg += " The setting will remain as: \"" + tag; + msg += " " + options_[lowercase(tag)].GetValue(); + msg += "\"\n"; + jnlst_->Printf(J_WARNING, J_MAIN, "%s", msg.c_str()); + } + return false; + } + + return options_.erase(lowercase(tag)) > 0; +} + bool OptionsList::SetStringValueIfUnset( const std::string& tag, const std::string& value, @@ -531,7 +541,7 @@ bool OptionsList::GetNumericValue( // numbers. Therefore, we change a 'd' to an 'e' char* buffer = new char[strvalue.length() + 1]; strcpy(buffer, strvalue.c_str()); - for( int i = 0; i < (int) strvalue.length(); ++i ) + for( size_t i = 0; i < strvalue.length(); ++i ) { if( buffer[i] == 'd' || buffer[i] == 'D' ) { @@ -626,7 +636,7 @@ bool OptionsList::GetIntegerValue( } const std::string& OptionsList::lowercase( - const std::string tag + const std::string& tag ) const { lowercase_buffer_ = tag; @@ -645,9 +655,9 @@ void OptionsList::PrintList( char buffer[256]; Snprintf(buffer, 255, "%40s %-20s %s\n", "Name", "Value", "# times used"); list += buffer; - for( std::map::const_iterator p = options_.begin(); p != options_.end(); p++ ) + for( std::map::const_iterator p = options_.begin(); p != options_.end(); ++p ) { - Snprintf(buffer, 255, "%40s = %-20s %6d\n", p->first.c_str(), p->second.Value().c_str(), p->second.Counter()); + Snprintf(buffer, 255, "%40s = %-20s %6" IPOPT_INDEX_FORMAT "\n", p->first.c_str(), p->second.Value().c_str(), p->second.Counter()); list += buffer; } } @@ -660,7 +670,7 @@ void OptionsList::PrintUserOptions( char buffer[256]; Snprintf(buffer, 255, "%40s %-20s %s\n", "Name", "Value", "used"); list += buffer; - for( std::map::const_iterator p = options_.begin(); p != options_.end(); p++ ) + for( std::map::const_iterator p = options_.begin(); p != options_.end(); ++p ) { if( !p->second.DontPrint() ) { @@ -738,7 +748,7 @@ bool OptionsList::ReadFromStream( // point numbers. Therefore, we change a 'd' to an 'e' char* buffer = new char[value.length() + 1]; strcpy(buffer, value.c_str()); - for( int i = 0; i < (int) value.length(); ++i ) + for( size_t i = 0; i < value.length(); ++i ) { if( buffer[i] == 'd' || buffer[i] == 'D' ) { @@ -848,7 +858,7 @@ bool OptionsList::readnexttoken( ) { token.erase(); - int c = is.get(); + char c = is.get(); // First get rid of all comments and white spaces while( !is.eof() && (isspace(c) || c == '#') ) diff --git a/src/Common/IpOptionsList.hpp b/src/Common/IpOptionsList.hpp index c7111fd18..560c321eb 100644 --- a/src/Common/IpOptionsList.hpp +++ b/src/Common/IpOptionsList.hpp @@ -36,7 +36,7 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default constructor */ OptionValue() : initialized_(false) @@ -44,9 +44,9 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject /** Constructor given the value */ OptionValue( - std::string value, - bool allow_clobber, - bool dont_print + const std::string& value, + bool allow_clobber, + bool dont_print ) : value_(value), counter_(0), @@ -69,7 +69,7 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject } /** Equals operator */ - void operator=( + OptionValue& operator=( const OptionValue& copy ) { @@ -78,12 +78,13 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject initialized_ = copy.initialized_; allow_clobber_ = copy.allow_clobber_; dont_print_ = copy.dont_print_; + return *this; } /** Default Destructor */ ~OptionValue() { } - //@} + ///@} /** Method for retrieving the value of an option. * @@ -146,7 +147,7 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject public: /**@name Constructors/Destructors */ - //@{ + ///@{ OptionsList( SmartPtr reg_options, SmartPtr jnlst @@ -162,27 +163,25 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject OptionsList( const OptionsList& copy ) - { - // copy all the option strings and values - options_ = copy.options_; - // copy the registered options pointer - reg_options_ = copy.reg_options_; - } + : options_(copy.options_), // copy all the option strings and values + reg_options_(copy.reg_options_) // copy the registered options pointer + { } /** Destructor */ virtual ~OptionsList() { } /** Default Assignment Operator */ - virtual void operator=( + virtual OptionsList& operator=( const OptionsList& source ) { options_ = source.options_; reg_options_ = source.reg_options_; jnlst_ = source.jnlst_; + return *this; } - //@} + ///@} /** Method for clearing all previously set options */ virtual void clear() @@ -191,7 +190,7 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject } /** @name Get / Set Methods */ - //@{ + ///@{ virtual void SetRegisteredOptions( const SmartPtr reg_options ) @@ -206,9 +205,9 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject jnlst_ = jnlst; } - //@} + ///@} /** @name Methods for setting options */ - //@{ + ///@{ virtual bool SetStringValue( const std::string& tag, const std::string& value, @@ -229,11 +228,29 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject bool allow_clobber = true, bool dont_print = false ); - //@} - /** @name Methods for setting options only if they have not been - * set before*/ - //@{ + /// @since 3.14.1 + virtual bool SetBoolValue( + const std::string& tag, + bool value, + bool allow_clobber = true, + bool dont_print = false + ) + { + return SetStringValue(tag, value ? "yes" : "no", allow_clobber, dont_print); + } + + /// Resets an option to its default value, if clobber is allowed. + /// + /// @return Whether value has been unset, i.e., value was set before and clobber was allowed. + /// @since 3.14.2 + virtual bool UnsetValue( + const std::string& tag + ); + ///@} + + /** @name Methods for setting options only if they have not been set before */ + ///@{ virtual bool SetStringValueIfUnset( const std::string& tag, const std::string& value, @@ -254,12 +271,24 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject bool allow_clobber = true, bool dont_print = false ); - //@} - /** @name Methods for retrieving values from the options list. If - * a tag is not found, the methods return false, and value is set + /// @since 3.14.1 + virtual bool SetBoolValueIfUnset( + const std::string& tag, + bool value, + bool allow_clobber = true, + bool dont_print = false + ) + { + return SetStringValueIfUnset(tag, value ? "yes" : "no", allow_clobber, dont_print); + } + ///@} + + /** @name Methods for retrieving values from the options list. + * + * If a tag is not found, the methods return false, and value is set * to the default value defined in the registered options. */ - //@{ + ///@{ virtual bool GetStringValue( const std::string& tag, std::string& value, @@ -289,7 +318,7 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject Index& value, const std::string& prefix ) const; - //@} + ///@} /** Get a string with the list of all options (tag, value, counter) */ virtual void PrintList( @@ -325,10 +354,10 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ // OptionsList(); - //@} + ///@} /** map for storing the options */ std::map options_; @@ -340,7 +369,7 @@ class IPOPTLIB_EXPORT OptionsList: public ReferencedObject /** auxiliary method for converting sting to all lower-case letters */ const std::string& lowercase( - const std::string tag + const std::string& tag ) const; /** auxiliary method for finding the value for a tag in the options list diff --git a/src/Common/IpReferenced.hpp b/src/Common/IpReferenced.hpp index a28b7d151..96dd6aa95 100644 --- a/src/Common/IpReferenced.hpp +++ b/src/Common/IpReferenced.hpp @@ -203,7 +203,7 @@ class IPOPTLIB_EXPORT ReferencedObject inline Index ReferencedObject::ReferenceCount() const { // DBG_START_METH("ReferencedObject::ReferenceCount()", 0); - // DBG_PRINT((1,"Returning reference_count_ = %d\n", reference_count_)); + // DBG_PRINT((1,"Returning reference_count_ = %" IPOPT_INDEX_FORMAT "\n", reference_count_)); return reference_count_; } @@ -214,7 +214,7 @@ void ReferencedObject::AddRef( { // DBG_START_METH("ReferencedObject::AddRef(const Referencer* referencer)", 0); reference_count_++; - // DBG_PRINT((1, "New reference_count_ = %d\n", reference_count_)); + // DBG_PRINT((1, "New reference_count_ = %" IPOPT_INDEX_FORMAT "\n", reference_count_)); # ifdef IP_DEBUG_REFERENCED referencers_.push_back(referencer); # else @@ -230,13 +230,13 @@ void ReferencedObject::ReleaseRef( // DBG_START_METH("ReferencedObject::ReleaseRef(const Referencer* referencer)", // 0); reference_count_--; - // DBG_PRINT((1, "New reference_count_ = %d\n", reference_count_)); + // DBG_PRINT((1, "New reference_count_ = %" IPOPT_INDEX_FORMAT "\n", reference_count_)); # ifdef IP_DEBUG_REFERENCED bool found = false; std::list::iterator iter; - for (iter = referencers_.begin(); iter != referencers_.end(); iter++) + for( iter = referencers_.begin(); iter != referencers_.end(); ++iter ) { if ((*iter) == referencer) { diff --git a/src/Common/IpRegOptions.cpp b/src/Common/IpRegOptions.cpp index 8febb4ffb..b513b1e04 100644 --- a/src/Common/IpRegOptions.cpp +++ b/src/Common/IpRegOptions.cpp @@ -6,8 +6,8 @@ #include "IpoptConfig.h" #include "IpRegOptions.hpp" +#include "IpOptionsList.hpp" -#include #include #include @@ -33,7 +33,9 @@ void RegisteredOption::OutputDescription( } jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "\n### %s (%s) ###\nCategory: %s\nDescription: %s\n", name_.c_str(), type_str.c_str(), registering_category_.c_str(), short_description_.c_str()); + "\n### %s (%s) %s ###\nCategory: %s\nDescription: %s\n", name_.c_str(), type_str.c_str(), + advanced_ ? "(advanced)" : "", + IsValid(registering_category_) ? registering_category_->Name().c_str() : "n/a", short_description_.c_str()); if( type_ == OT_Number ) { @@ -89,7 +91,7 @@ void RegisteredOption::OutputDescription( if( has_lower_ ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "%d", (Index) lower_); + "%" IPOPT_INDEX_FORMAT, (Index) lower_); } else { @@ -98,12 +100,12 @@ void RegisteredOption::OutputDescription( } jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - " <= (%d) <= ", (Index) default_number_); + " <= (%" IPOPT_INDEX_FORMAT ") <= ", (Index) default_number_); if( has_upper_ ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "%d\n", (Index) upper_); + "%" IPOPT_INDEX_FORMAT "\n", (Index) upper_); } else { @@ -113,10 +115,9 @@ void RegisteredOption::OutputDescription( } else if( type_ == OT_String ) { - std::vector::const_iterator i; jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "Valid Settings:\n"); - for( i = valid_strings_.begin(); i != valid_strings_.end(); i++ ) + for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); ++i ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\t%s (%s)\n", (*i).value_.c_str(), (*i).description_.c_str()); @@ -136,6 +137,10 @@ void RegisteredOption::OutputLatexDescription( MakeValidLatexString(short_description_, latex_desc); jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\\paragraph{%s:}\\label{opt:%s} ", latex_name.c_str(), name_.c_str()); + if( advanced_ ) + { + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "(advanced) "); + } if( short_description_.length() == 0 ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, @@ -143,7 +148,7 @@ void RegisteredOption::OutputLatexDescription( } else { - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "%s", latex_desc.c_str()); } jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, @@ -160,9 +165,7 @@ void RegisteredOption::OutputLatexDescription( MakeValidLatexString(long_description_, latex_desc); jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - " "); - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - latex_desc.c_str()); + " %s", latex_desc.c_str()); } if( type_ == OT_Number ) @@ -179,7 +182,7 @@ void RegisteredOption::OutputLatexDescription( else { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "%s", "{\\tt -inf}"); + "{\\tt -inf}"); } if( has_lower_ && !lower_strict_ ) @@ -216,7 +219,7 @@ void RegisteredOption::OutputLatexDescription( else { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "%s", "{\\tt +inf}"); + "{\\tt +inf}"); } buff = MakeValidLatexNumber(default_number_); @@ -231,7 +234,7 @@ void RegisteredOption::OutputLatexDescription( if( has_lower_ ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "%d \\le ", (Index) lower_); + "%" IPOPT_INDEX_FORMAT " \\le ", (Index) lower_); } else { @@ -245,7 +248,7 @@ void RegisteredOption::OutputLatexDescription( if( has_upper_ ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - " \\le %d", (Index) upper_); + " \\le %" IPOPT_INDEX_FORMAT "", (Index) upper_); } else { @@ -254,7 +257,7 @@ void RegisteredOption::OutputLatexDescription( } jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "$\nand its default value is $%d$.\n\n", (Index) default_number_); + "$\nand its default value is $%" IPOPT_INDEX_FORMAT "$.\n\n", (Index) default_number_); } else if( type_ == OT_String ) { @@ -267,7 +270,7 @@ void RegisteredOption::OutputLatexDescription( "\\\\ \nPossible values:\n"); jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\\begin{itemize}\n"); - for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); i++ ) + for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); ++i ) { std::string latex_value; MakeValidLatexString((*i).value_, latex_value); @@ -276,12 +279,9 @@ void RegisteredOption::OutputLatexDescription( if( (*i).description_.length() > 0 ) { - std::string latex_desc; MakeValidLatexString((*i).description_, latex_desc); jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - ": "); - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - latex_desc.c_str()); + ": %s", latex_desc.c_str()); } jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n"); @@ -294,12 +294,11 @@ void RegisteredOption::OutputLatexDescription( } void RegisteredOption::MakeValidLatexString( - std::string source, - std::string& dest + const std::string& source, + std::string& dest ) const { - std::string::iterator c; - for( c = source.begin(); c != source.end(); c++ ) + for( std::string::const_iterator c = source.begin(); c != source.end(); ++c ) { if( *c == '_' ) { @@ -325,9 +324,8 @@ std::string RegisteredOption::MakeValidLatexNumber( std::string source = buffer; std::string dest; - std::string::iterator c; bool found_e = false; - for( c = source.begin(); c != source.end(); c++ ) + for( std::string::iterator c = source.begin(); c != source.end(); ++c ) { if( *c == 'e' ) { @@ -352,7 +350,12 @@ void RegisteredOption::OutputDoxygenDescription( ) const { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "\\anchor OPT_%s\n %s", name_.c_str(), name_.c_str()); + "\\anchor OPT_%s\n%s", name_.c_str(), name_.c_str()); + if( advanced_ ) + { + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, " (advanced)"); + } + if( short_description_.length() > 0 ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, @@ -377,7 +380,7 @@ void RegisteredOption::OutputDoxygenDescription( if( has_lower_ ) { buff = MakeValidHTMLNumber(lower_); - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "%s", buff.c_str()); if( !lower_strict_ ) @@ -397,8 +400,7 @@ void RegisteredOption::OutputDoxygenDescription( // "-∞ < "); //} - - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "%s", name_.c_str()); if( has_upper_ ) @@ -415,7 +417,7 @@ void RegisteredOption::OutputDoxygenDescription( } buff = MakeValidHTMLNumber(upper_); - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "%s", buff.c_str()); } // else @@ -432,7 +434,7 @@ void RegisteredOption::OutputDoxygenDescription( buff = MakeValidHTMLNumber(default_number_); jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - " and its default value is %s.\n\n", buff.c_str()); + " and its default value is %s.\n", buff.c_str()); } else if( type_ == OT_Integer ) @@ -444,7 +446,7 @@ void RegisteredOption::OutputDoxygenDescription( if( has_lower_ ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "%d ≤ ", (Index) lower_); + "%" IPOPT_INDEX_FORMAT " ≤ ", (Index) lower_); } //else //{ @@ -452,13 +454,13 @@ void RegisteredOption::OutputDoxygenDescription( // "-∞ < "); //} - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "%s", name_.c_str()); if( has_upper_ ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - " ≤ %d", (Index) upper_); + " ≤ %" IPOPT_INDEX_FORMAT "", (Index) upper_); } //else //{ @@ -473,7 +475,7 @@ void RegisteredOption::OutputDoxygenDescription( } jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - " and its default value is %d.\n\n", (Index) default_number_); + " and its default value is %" IPOPT_INDEX_FORMAT ".\n", (Index) default_number_); } else if( type_ == OT_String ) { @@ -481,19 +483,39 @@ void RegisteredOption::OutputDoxygenDescription( " The default value for this string option is \"%s\".\n", default_string_.c_str()); jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "\nPossible values:\n"); - for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); i++ ) - { - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - " - %s", i->value_.c_str()); + "\nPossible values:"); + bool havedescr = false; + for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end() && !havedescr; ++i ) if( (*i).description_.length() > 0 ) { - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - ": %s", i->description_.c_str()); + havedescr = true; + } + + if( havedescr ) + { + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n"); + for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); ++i ) + { + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, " - %s", i->value_.c_str()); + if( (*i).description_.length() > 0 ) + { + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, ": %s", i->description_.c_str()); + } + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n"); } - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "\n"); + } + else + { + for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); ++i ) + { + if( i != valid_strings_.begin() ) + { + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, ","); + } + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, " %s", i->value_.c_str()); + } + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n"); } /* @@ -523,9 +545,8 @@ std::string RegisteredOption::MakeValidHTMLNumber( std::string source = buffer; std::string dest; - std::string::iterator c; bool found_e = false; - for( c = source.begin(); c != source.end(); c++ ) + for( std::string::iterator c = source.begin(); c != source.end(); ++c ) { if( *c == 'e' ) { @@ -618,7 +639,7 @@ void RegisteredOption::OutputShortDescription( if( has_lower_ ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "%10d <= ", (Index) lower_); + "%10" IPOPT_INDEX_FORMAT " <= ", (Index) lower_); } else { @@ -627,12 +648,12 @@ void RegisteredOption::OutputShortDescription( } jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "(%11d)", (Index) default_number_); + "(%11" IPOPT_INDEX_FORMAT ")", (Index) default_number_); if( has_upper_ ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - " <= %-10d\n", (Index) upper_); + " <= %-10" IPOPT_INDEX_FORMAT "\n", (Index) upper_); } else { @@ -645,20 +666,24 @@ void RegisteredOption::OutputShortDescription( jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "(\"%s\")\n", default_string_.c_str()); } + if( advanced_ ) + { + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, " Advanced option for expert users.\n"); + } jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, " "); - jnlst.PrintStringOverLines(J_SUMMARY, J_DOCUMENTATION, 3, 76, short_description_.c_str()); + jnlst.PrintStringOverLines(J_SUMMARY, J_DOCUMENTATION, 3, 76, short_description_); if( long_description_ != "" ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n "); - jnlst.PrintStringOverLines(J_SUMMARY, J_DOCUMENTATION, 5, 74, long_description_.c_str()); + jnlst.PrintStringOverLines(J_SUMMARY, J_DOCUMENTATION, 5, 74, long_description_); } if( type_ == OT_String ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n Possible values:\n"); - for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); i++ ) + for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); ++i ) { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, " - %-23s", (*i).value_.c_str()); @@ -667,7 +692,7 @@ void RegisteredOption::OutputShortDescription( { jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, " ["); - jnlst.PrintStringOverLines(J_SUMMARY, J_DOCUMENTATION, 31, 48, (*i).description_.c_str()); + jnlst.PrintStringOverLines(J_SUMMARY, J_DOCUMENTATION, 31, 48, (*i).description_); jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "]"); } @@ -690,8 +715,7 @@ bool RegisteredOption::IsValidStringSetting( { DBG_ASSERT(type_ == OT_String); - std::vector::const_iterator i; - for( i = valid_strings_.begin(); i != valid_strings_.end(); i++ ) + for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); ++i ) { if( i->value_ == "*" || string_equal_insensitive(i->value_, value) ) { @@ -709,8 +733,7 @@ std::string RegisteredOption::MapStringSetting( std::string matched_setting = ""; - std::vector::const_iterator i; - for( i = valid_strings_.begin(); i != valid_strings_.end(); i++ ) + for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); ++i ) { if( i->value_ == "*" ) { @@ -733,8 +756,7 @@ Index RegisteredOption::MapStringSettingToEnum( Index matched_setting = -1; Index cnt = 0; - std::vector::const_iterator i; - for( i = valid_strings_.begin(); i != valid_strings_.end(); i++ ) + for( std::vector::const_iterator i = valid_strings_.begin(); i != valid_strings_.end(); ++i ) { ASSERT_EXCEPTION(i->value_ != "*", IpoptException, "Cannot map a wildcard setting to an enumeration"); if( string_equal_insensitive(i->value_, value) ) @@ -771,26 +793,80 @@ bool RegisteredOption::string_equal_insensitive( { return false; } - i1++; - i2++; + ++i1; + ++i2; } return true; } +void RegisteredOptions::SetRegisteringCategory( + const std::string& registering_category, + int priority +) +{ + if( registering_category.empty() ) + { + current_registering_category_ = NULL; + return; + } + + SmartPtr& reg_categ = registered_categories_[registering_category]; + if( !IsValid(reg_categ) ) + { + reg_categ = new RegisteredCategory(registering_category, priority); + } + current_registering_category_ = reg_categ; +} + +void RegisteredOptions::SetRegisteringCategory( + SmartPtr registering_category +) +{ + current_registering_category_ = registering_category; + if( !IsValid(registering_category) ) + { + return; + } + + SmartPtr& reg_categ = registered_categories_[registering_category->Name()]; + if( !IsValid(reg_categ) ) + { + reg_categ = registering_category; + } + else + { + // if we already had a category under this name, then it should be the same as the given one + DBG_ASSERT(reg_categ == registering_category); + } +} + +void RegisteredOptions::AddOption( + const SmartPtr& option +) +{ + ASSERT_EXCEPTION(registered_options_.find(option->Name()) == registered_options_.end(), OPTION_ALREADY_REGISTERED, + std::string("The option: ") + option->Name() + " has already been registered by someone else"); + registered_options_[option->Name()] = option; + + if( IsValid(option->registering_category_) ) + { + option->registering_category_->regoptions_.push_back(option); + } +} + void RegisteredOptions::AddNumberOption( const std::string& name, const std::string& short_description, Number default_value, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_Number); option->SetDefaultNumber(default_value); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddLowerBoundedNumberOption( @@ -799,17 +875,16 @@ void RegisteredOptions::AddLowerBoundedNumberOption( Number lower, bool strict, Number default_value, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_Number); option->SetDefaultNumber(default_value); option->SetLowerNumber(lower, strict); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddUpperBoundedNumberOption( @@ -818,17 +893,16 @@ void RegisteredOptions::AddUpperBoundedNumberOption( Number upper, bool strict, Number default_value, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_Number); option->SetDefaultNumber(default_value); option->SetUpperNumber(upper, strict); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddBoundedNumberOption( @@ -839,34 +913,32 @@ void RegisteredOptions::AddBoundedNumberOption( Number upper, bool upper_strict, Number default_value, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_Number); option->SetDefaultNumber(default_value); option->SetLowerNumber(lower, lower_strict); option->SetUpperNumber(upper, upper_strict); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddIntegerOption( const std::string& name, const std::string& short_description, Index default_value, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_Integer); option->SetDefaultInteger(default_value); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddLowerBoundedIntegerOption( @@ -874,17 +946,16 @@ void RegisteredOptions::AddLowerBoundedIntegerOption( const std::string& short_description, Index lower, Index default_value, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_Integer); option->SetDefaultInteger(default_value); option->SetLowerInteger(lower); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddUpperBoundedIntegerOption( @@ -892,17 +963,16 @@ void RegisteredOptions::AddUpperBoundedIntegerOption( const std::string& short_description, Index upper, Index default_value, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_Integer); option->SetDefaultInteger(default_value); option->SetUpperInteger(upper); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddBoundedIntegerOption( @@ -911,18 +981,17 @@ void RegisteredOptions::AddBoundedIntegerOption( Index lower, Index upper, Index default_value, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_Integer); option->SetDefaultInteger(default_value); option->SetLowerInteger(lower); option->SetUpperInteger(upper); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption( @@ -931,21 +1000,20 @@ void RegisteredOptions::AddStringOption( const std::string& default_value, const std::vector& settings, const std::vector& descriptions, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); DBG_ASSERT(settings.size() == descriptions.size()); - for( int i = 0; i < (int) settings.size(); i++ ) + for( size_t i = 0; i < settings.size(); i++ ) { option->AddValidStringSetting(settings[i], descriptions[i]); } - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption1( @@ -954,17 +1022,16 @@ void RegisteredOptions::AddStringOption1( const std::string& default_value, const std::string& setting1, const std::string& description1, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption2( @@ -975,18 +1042,17 @@ void RegisteredOptions::AddStringOption2( const std::string& description1, const std::string& setting2, const std::string& description2, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); option->AddValidStringSetting(setting2, description2); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption3( @@ -999,19 +1065,18 @@ void RegisteredOptions::AddStringOption3( const std::string& description2, const std::string& setting3, const std::string& description3, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); option->AddValidStringSetting(setting2, description2); option->AddValidStringSetting(setting3, description3); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption4( @@ -1026,20 +1091,19 @@ void RegisteredOptions::AddStringOption4( const std::string& description3, const std::string& setting4, const std::string& description4, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); option->AddValidStringSetting(setting2, description2); option->AddValidStringSetting(setting3, description3); option->AddValidStringSetting(setting4, description4); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption5( @@ -1056,11 +1120,12 @@ void RegisteredOptions::AddStringOption5( const std::string& description4, const std::string& setting5, const std::string& description5, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); @@ -1068,9 +1133,7 @@ void RegisteredOptions::AddStringOption5( option->AddValidStringSetting(setting3, description3); option->AddValidStringSetting(setting4, description4); option->AddValidStringSetting(setting5, description5); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption6( @@ -1089,11 +1152,12 @@ void RegisteredOptions::AddStringOption6( const std::string& description5, const std::string& setting6, const std::string& description6, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); @@ -1102,9 +1166,7 @@ void RegisteredOptions::AddStringOption6( option->AddValidStringSetting(setting4, description4); option->AddValidStringSetting(setting5, description5); option->AddValidStringSetting(setting6, description6); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption7( @@ -1125,11 +1187,12 @@ void RegisteredOptions::AddStringOption7( const std::string& description6, const std::string& setting7, const std::string& description7, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); @@ -1139,9 +1202,7 @@ void RegisteredOptions::AddStringOption7( option->AddValidStringSetting(setting5, description5); option->AddValidStringSetting(setting6, description6); option->AddValidStringSetting(setting7, description7); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption8( @@ -1164,11 +1225,12 @@ void RegisteredOptions::AddStringOption8( const std::string& description7, const std::string& setting8, const std::string& description8, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); @@ -1179,9 +1241,7 @@ void RegisteredOptions::AddStringOption8( option->AddValidStringSetting(setting6, description6); option->AddValidStringSetting(setting7, description7); option->AddValidStringSetting(setting8, description8); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption9( @@ -1206,11 +1266,12 @@ void RegisteredOptions::AddStringOption9( const std::string& description8, const std::string& setting9, const std::string& description9, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); @@ -1222,9 +1283,7 @@ void RegisteredOptions::AddStringOption9( option->AddValidStringSetting(setting7, description7); option->AddValidStringSetting(setting8, description8); option->AddValidStringSetting(setting9, description9); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); } void RegisteredOptions::AddStringOption10( @@ -1251,11 +1310,12 @@ void RegisteredOptions::AddStringOption10( const std::string& description9, const std::string& setting10, const std::string& description10, - const std::string& long_description + const std::string& long_description, + bool advanced ) { SmartPtr option = new RegisteredOption(name, short_description, long_description, - current_registering_category_, next_counter_++); + current_registering_category_, next_counter_++, advanced); option->SetType(OT_String); option->SetDefaultString(default_value); option->AddValidStringSetting(setting1, description1); @@ -1268,9 +1328,25 @@ void RegisteredOptions::AddStringOption10( option->AddValidStringSetting(setting8, description8); option->AddValidStringSetting(setting9, description9); option->AddValidStringSetting(setting10, description10); - ASSERT_EXCEPTION(registered_options_.find(name) == registered_options_.end(), OPTION_ALREADY_REGISTERED, - std::string("The option: ") + option->Name() + " has already been registered by someone else"); - registered_options_[name] = option; + AddOption(option); +} + +/** Create a string value with two possible settings: yes and no */ +void RegisteredOptions::AddBoolOption( + const std::string& name, + const std::string& short_description, + bool default_value, + const std::string& long_description, + bool advanced +) +{ + SmartPtr option = new RegisteredOption(name, short_description, long_description, + current_registering_category_, next_counter_++, advanced); + option->SetType(OT_String); + option->SetDefaultString(default_value ? "yes" : "no"); + option->AddValidStringSetting("yes", ""); + option->AddValidStringSetting("no", ""); + AddOption(option); } SmartPtr RegisteredOptions::GetOption( @@ -1297,118 +1373,283 @@ SmartPtr RegisteredOptions::GetOption( return option; } +/** Giving access to registered categories ordered by priority (decreasing) */ +void RegisteredOptions::RegisteredCategoriesByPriority( + RegCategoriesByPriority& categories +) const +{ + for( RegCategoriesList::const_iterator it = registered_categories_.begin(); it != registered_categories_.end(); ++it ) + { + categories.insert(it->second); + } +} + +/** Output documentation + * + * Format is decided according to print_options_mode parameter. + */ void RegisteredOptions::OutputOptionDocumentation( - const Journalist& jnlst, - std::list& categories -) + const Journalist& jnlst, + SmartPtr options, + int minpriority +) const { - // create a set to print sorted output - // std::set - // classes; - // std::map >::iterator option; - // for (option = registered_options_.begin(); option != registered_options_.end(); option++) { - // classes.insert(option->second->RegisteringCategory()); - // } - - std::list::iterator i; - for( i = categories.begin(); i != categories.end(); i++ ) + OutputMode printmode; + Index enum_int; + options->GetEnumValue("print_options_mode", enum_int, ""); + printmode = OutputMode(enum_int); + + bool printadvanced; + options->GetBoolValue("print_advanced_options", printadvanced, ""); + + RegCategoriesByPriority cats; + RegisteredCategoriesByPriority(cats); + for( RegCategoriesByPriority::const_iterator cat_it = cats.begin(); cat_it != cats.end(); ++cat_it ) { - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "\n### %s ###\n\n", (*i).c_str()); - std::map > class_options; - std::map >::iterator option; - for( option = registered_options_.begin(); option != registered_options_.end(); option++ ) + if( (*cat_it)->Priority() < minpriority ) { - if( option->second->RegisteringCategory() == (*i) ) + break; + } + + bool firstopt = true; + for( std::list >::const_iterator opt_it = (*cat_it)->RegisteredOptions().begin(); opt_it != (*cat_it)->RegisteredOptions().end(); ++opt_it ) + { + if( !printadvanced && (*opt_it)->Advanced() ) + { + continue; + } + + if( firstopt ) + { + const std::string& catname = (*cat_it)->Name(); + switch( printmode ) + { + case OUTPUTTEXT : + { + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n### %s ###\n\n", catname.c_str()); + break; + } + + case OUTPUTLATEX: + { + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\\subsection{%s}\n\n", catname.c_str()); + break; + } + + case OUTPUTDOXYGEN: + { + std::string anchorname = catname; + for( std::string::iterator it = anchorname.begin(); it != anchorname.end(); ++it ) + if( !isalnum(*it) ) + { + *it = '_'; + } + + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\\subsection OPT_%s %s\n\n", anchorname.c_str(), catname.c_str()); + } + } + + firstopt = false; + } + + switch( printmode ) { + case OUTPUTTEXT : + (*opt_it)->OutputShortDescription(jnlst); + break; - class_options[option->second->Counter()] = option->second; + case OUTPUTLATEX: + (*opt_it)->OutputLatexDescription(jnlst); + break; + + case OUTPUTDOXYGEN: + (*opt_it)->OutputDoxygenDescription(jnlst); + break; } } - std::map >::const_iterator co; - for( co = class_options.begin(); co != class_options.end(); co++ ) + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n"); + } +} + +void RegisteredOptions::OutputOptionDocumentation( + const Journalist& jnlst, + const std::list& categories +) const +{ + if( !categories.empty() ) + { + for( std::list::const_iterator i = categories.begin(); i != categories.end(); ++i ) { - co->second->OutputShortDescription(jnlst); + RegCategoriesList::const_iterator cat_it = registered_categories_.find(*i); + // skip nonexisting category + if( cat_it == registered_categories_.end() ) + { + continue; + } + + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n### %s ###\n\n", i->c_str()); + + for( std::list >::const_iterator opt_it = cat_it->second->RegisteredOptions().begin(); opt_it != cat_it->second->RegisteredOptions().end(); ++opt_it ) + { + (*opt_it)->OutputShortDescription(jnlst); + } + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n"); + } + } + else + { + for( RegCategoriesList::const_iterator cat_it = registered_categories_.begin(); cat_it != registered_categories_.end(); ++cat_it ) + { + if( cat_it->second->Priority() < 0 ) + { + continue; + } + + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n### %s ###\n\n", cat_it->first.c_str()); + + for( std::list >::const_iterator opt_it = cat_it->second->RegisteredOptions().begin(); opt_it != cat_it->second->RegisteredOptions().end(); ++opt_it ) + { + if( (*opt_it)->Advanced() ) + { + continue; + } + + (*opt_it)->OutputShortDescription(jnlst); + } + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\n"); } - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "\n"); } } void RegisteredOptions::OutputLatexOptionDocumentation( - const Journalist& jnlst, - std::list& options_to_print -) + const Journalist& jnlst, + const std::list& options_to_print +) const { - if( !options_to_print.empty() ) { - std::list::iterator coption; - for( coption = options_to_print.begin(); coption != options_to_print.end(); coption++ ) + for( std::list::const_iterator coption = options_to_print.begin(); coption != options_to_print.end(); ++coption ) { - // std::map >::iterator option; if( coption->c_str()[0] == '#' ) { - jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, - "\\subsection{%s}\n\n", &coption->c_str()[1]); - } - else - { - SmartPtr option = registered_options_[*coption]; - DBG_ASSERT(IsValid(option)); - option->OutputLatexDescription(jnlst); + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\\subsection{%s}\n\n", &coption->c_str()[1]); + continue; } + + SmartPtr option = registered_options_.at(*coption); + DBG_ASSERT(IsValid(option)); + + option->OutputLatexDescription(jnlst); } } else { - std::map >::iterator option; - for( option = registered_options_.begin(); option != registered_options_.end(); option++ ) + RegCategoriesByPriority cats; + RegisteredCategoriesByPriority(cats); + for( RegCategoriesByPriority::const_iterator cat_it = cats.begin(); cat_it != cats.end(); ++cat_it ) { - option->second->OutputLatexDescription(jnlst); + if( (*cat_it)->Priority() < 0 ) + { + break; + } + + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\\subsection{%s}\n\n", (*cat_it)->Name().c_str()); + + for( std::list >::const_iterator opt_it = (*cat_it)->RegisteredOptions().begin(); opt_it != (*cat_it)->RegisteredOptions().end(); ++opt_it ) + { + if( (*opt_it)->Advanced() ) + { + continue; + } + + (*opt_it)->OutputLatexDescription(jnlst); + } } } } void RegisteredOptions::OutputDoxygenOptionDocumentation( - const Journalist& jnlst, - std::list& options_to_print -) + const Journalist& jnlst, + const std::list& options_to_print +) const { - if( !options_to_print.empty() ) { - std::list::iterator coption; - for( coption = options_to_print.begin(); coption != options_to_print.end(); coption++ ) + for( std::list::const_iterator coption = options_to_print.begin(); coption != options_to_print.end(); ++coption ) { - // std::map >::iterator option; if( (*coption)[0] == '#' ) { std::string anchorname = &coption->c_str()[1]; for( std::string::iterator it = anchorname.begin(); it != anchorname.end(); ++it ) - if( *it == ' ' ) + if( !isalnum(*it) ) { *it = '_'; } jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\\subsection OPT_%s %s\n\n", anchorname.c_str(), &coption->c_str()[1]); + + continue; } - else - { - SmartPtr option = registered_options_[*coption]; - DBG_ASSERT(IsValid(option)); - option->OutputDoxygenDescription(jnlst); - } + + SmartPtr option = registered_options_.at(*coption); + DBG_ASSERT(IsValid(option)); + + option->OutputDoxygenDescription(jnlst); } } else { - std::map >::iterator option; - for( option = registered_options_.begin(); option != registered_options_.end(); option++ ) + RegCategoriesByPriority cats; + RegisteredCategoriesByPriority(cats); + for( RegCategoriesByPriority::const_iterator cat_it = cats.begin(); cat_it != cats.end(); ++cat_it ) { - option->second->OutputDoxygenDescription(jnlst); + if( (*cat_it)->Priority() < 0 ) + { + break; + } + + std::string anchorname = (*cat_it)->Name(); + for( std::string::iterator it = anchorname.begin(); it != anchorname.end(); ++it ) + if( !isalnum(*it) ) + { + *it = '_'; + } + + jnlst.Printf(J_SUMMARY, J_DOCUMENTATION, "\\subsection OPT_%s %s\n\n", anchorname.c_str(), (*cat_it)->Name().c_str()); + + for( std::list >::const_iterator opt_it = (*cat_it)->RegisteredOptions().begin(); opt_it != (*cat_it)->RegisteredOptions().end(); ++opt_it ) + { + if( (*opt_it)->Advanced() ) + { + continue; + } + + (*opt_it)->OutputDoxygenDescription(jnlst); + } } } } +void RegisteredOptions::RegisterOptions( + SmartPtr roptions +) +{ + roptions->SetRegisteringCategory("Output"); + roptions->AddStringOption3( + "print_options_mode", + "format in which to print options documentation", + "text", + "text", "Ordinary text", + "latex", "LaTeX formatted", + "doxygen", "Doxygen (markdown) formatted"); + + roptions->AddBoolOption( + "print_advanced_options", + "whether to print also advanced options", + false, + "", + true); + +} + } // namespace Ipopt diff --git a/src/Common/IpRegOptions.hpp b/src/Common/IpRegOptions.hpp index e69514e13..38ad02666 100644 --- a/src/Common/IpRegOptions.hpp +++ b/src/Common/IpRegOptions.hpp @@ -13,6 +13,8 @@ #include "IpSmartPtr.hpp" #include +#include +#include namespace Ipopt { @@ -25,13 +27,128 @@ enum RegisteredOptionType OT_Unknown }; -/** Base class for registered options. - * - * The derived types are more - * specific to a string option or a Number (real) option, etc. +class OptionsList; +class RegisteredOption; + +/** A category of registered options. + * @since 3.14.0 */ +class IPOPTLIB_EXPORT RegisteredCategory: public ReferencedObject +{ + friend class RegisteredOptions; +public: + /// Constructor + /// + /// Use negative value for priority to suppress it being included in documentation. + RegisteredCategory( + const std::string& name, + int priority + ) + : name_(name), + priority_(priority) + { } + + /// name of category + const std::string& Name() const + { + return name_; + } + + /// name of category + /// + /// This one is for backward-compatibility with previous Ipopt versions where RegisteredCategory was a string. + /// @deprecated Use Name() instead. + IPOPT_DEPRECATED + operator const std::string& () const + { + return name_; + } + + /// compare with string + /// + /// This one is for backward-compatibility with previous Ipopt versions where RegisteredCategory was a string. + /// @deprecated Use Name() and string comparison instead. + IPOPT_DEPRECATED + bool operator!=( + const std::string& other + ) const + { + return name_ != other; + } + + /// compare with string + /// + /// This one is for backward-compatibility with previous Ipopt versions where RegisteredCategory was a string. + /// @deprecated Use Name() and string comparison instead. + IPOPT_DEPRECATED + bool operator==( + const std::string& other + ) const + { + return name_ == other; + } + + /// compare two categories + /// + /// This one is for backward-compatibility with previous Ipopt versions where RegisteredCategory was a string. + /// @deprecated Use Name() and string comparison on them instead. + IPOPT_DEPRECATED + bool operator<( + const RegisteredCategory& other + ) const + { + return name_ < other.name_; + } + + /// priority of category + int Priority() const + { + return priority_; + } + + /// gives list of options in this category + const std::list >& RegisteredOptions() const + { + return regoptions_; + } + + // class comparing two categories by priority + class ComparePriority + { + public: + bool operator()( + const SmartPtr& lhs, + const SmartPtr& rhs + ) const + { + DBG_ASSERT(IsValid(lhs)); + DBG_ASSERT(IsValid(rhs)); + return lhs->priority_ > rhs->priority_; + } + }; + +private: + /// unimplemented default constructor + RegisteredCategory(); + /// unimplemented copy constructor + RegisteredCategory(const RegisteredCategory&); + /// unimplemented assignment operator + RegisteredCategory& operator=(const RegisteredCategory&); + + /// name of category + std::string name_; + + /// priority of category (used to decide whether to print and printing order) + int priority_; + + /// options of this category + std::list > regoptions_; +}; + +/** Option that has been registered. */ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject { + friend class RegisteredOptions; public: /** class to hold the valid string settings for a string option */ class string_entry @@ -50,34 +167,35 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject }; /** Constructors / Destructors */ - //@{ + ///@{ RegisteredOption( Index counter ) : type_(OT_Unknown), + advanced_(false), has_lower_(false), has_upper_(false), counter_(counter) - { - } + { } RegisteredOption( - const std::string& name, - const std::string& short_description, - const std::string& long_description, - const std::string& registering_category, - Index counter + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& long_description, ///< long description + const SmartPtr& registering_category, ///< option category @since 3.14.0 + Index counter, ///< option counter + bool advanced = false ///< whether option is advanced @since 3.14.0 ) : name_(name), short_description_(short_description), long_description_(long_description), registering_category_(registering_category), type_(OT_Unknown), + advanced_(advanced), has_lower_(false), has_upper_(false), counter_(counter) - { - } + { } RegisteredOption( const RegisteredOption& copy @@ -87,24 +205,23 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject long_description_(copy.long_description_), registering_category_(copy.registering_category_), type_(copy.type_), + advanced_(copy.advanced_), has_lower_(copy.has_lower_), lower_(copy.lower_), has_upper_(copy.has_upper_), upper_(copy.upper_), valid_strings_(copy.valid_strings_), counter_(copy.counter_) - { - } + { } virtual ~RegisteredOption() { } - //@} + ///@} - DECLARE_STD_EXCEPTION(ERROR_CONVERTING_STRING_TO_ENUM) - ; + DECLARE_STD_EXCEPTION(ERROR_CONVERTING_STRING_TO_ENUM); /** Standard Get / Set Methods */ - //@{ + ///@{ /** Get the option's name (tag in the input file) */ virtual const std::string& Name() const { @@ -145,18 +262,12 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject long_description_ = long_description; } - /** Get the registering class */ - virtual const std::string& RegisteringCategory() const - { - return registering_category_; - } - - /** Set the registering class */ - virtual void SetRegisteringCategory( - const std::string& registering_category - ) + /** Get the registering class + * @since 3.14.0 + */ + virtual const RegisteredCategory& RegisteringCategory() const { - registering_category_ = registering_category; + return *registering_category_; } /** Get the Option's type */ @@ -165,7 +276,7 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject return type_; } - /** Get the Option's type */ + /** Set the Option's type */ virtual void SetType( const RegisteredOptionType& type ) @@ -173,18 +284,35 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject type_ = type; } + /** Get the advanced flag + * @since 3.14.0 + */ + virtual bool Advanced() const + { + return advanced_; + } + /** Set the advanced flag + * @since 3.14.0 + */ + virtual void SetAdvanced( + bool advanced = true + ) + { + advanced_ = advanced; + } + /** Counter */ virtual Index Counter() const { return counter_; } - //@} + ///@} /** @name Get / Set methods valid for specific types * * @note The Type must be set before calling these methods. */ - //@{ + ///@{ /** check if the option has a lower bound * * can be called for OT_Number & OT_Integer @@ -325,8 +453,8 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject * can be called for OT_String */ virtual void AddValidStringSetting( - const std::string value, - const std::string description) + const std::string& value, + const std::string& description) { DBG_ASSERT(type_ == OT_String); valid_strings_.push_back(string_entry(value, description)); @@ -483,7 +611,7 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject virtual Index MapStringSettingToEnum( const std::string& value ) const; - //@} + ///@} /** output a description of the option */ virtual void OutputDescription( @@ -509,8 +637,9 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject std::string name_; std::string short_description_; std::string long_description_; - std::string registering_category_; + SmartPtr registering_category_; RegisteredOptionType type_; + bool advanced_; bool has_lower_; bool lower_strict_; @@ -520,9 +649,16 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject Number upper_; Number default_number_; + std::vector valid_strings_; + std::string default_string_; + + /** Has the information as how many-th option this one was + * registered. */ + const Index counter_; + void MakeValidLatexString( - std::string source, - std::string& dest + const std::string& source, + std::string& dest ) const; std::string MakeValidLatexNumber( @@ -538,13 +674,6 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject const std::string& s1, const std::string& s2 ) const; - - std::vector valid_strings_; - std::string default_string_; - - /** Has the information as how many-th option this one was - * registered. */ - const Index counter_; }; /** Class for storing registered options. @@ -554,306 +683,369 @@ class IPOPTLIB_EXPORT RegisteredOption: public ReferencedObject class IPOPTLIB_EXPORT RegisteredOptions: public ReferencedObject { public: + /// @since 3.14.0 + typedef std::map > RegOptionsList; + /// @since 3.14.0 + typedef std::map > RegCategoriesList; + /// @since 3.14.0 + typedef std::set, RegisteredCategory::ComparePriority> RegCategoriesByPriority; + + /** output modes + * @since 3.14.0 + */ + enum OutputMode + { + OUTPUTTEXT = 0, + OUTPUTLATEX, + OUTPUTDOXYGEN + }; + /** Constructors / Destructors */ - //@{ + ///@{ /** Default Constructor */ RegisteredOptions() - : next_counter_(0), - current_registering_category_("Uncategorized") + : next_counter_(0) { } /** Destructor */ virtual ~RegisteredOptions() - { } - //@} + { + // break circular reference between registered options and registered categories + for( RegCategoriesList::iterator it(registered_categories_.begin()); it != registered_categories_.end(); ++it ) + { + it->second->regoptions_.clear(); + } + } + ///@} - DECLARE_STD_EXCEPTION(OPTION_ALREADY_REGISTERED) - ; + DECLARE_STD_EXCEPTION(OPTION_ALREADY_REGISTERED); - /** Methods to interact with registered options */ - //@{ /** set the registering class * - * All subsequent options will be added with the registered class + * If nonempty name, then all subsequent options will be added with the registered category. + * If empty name, then all subsequent options will not be added to any registered category. + * + * If the category doesn't exist yet, it will be created with given data. + * If it exists already, given priority and undocumented flag are ignored. */ virtual void SetRegisteringCategory( - const std::string& registering_category - ) - { - current_registering_category_ = registering_category; - } + const std::string& registering_category, ///< category name + int priority = 0 ///< category priority @since 3.14.0 + ); + + /** set the registering class + * + * If not NULL, then all subsequent options will be added with the registered category. + * If NULL, then all subsequent options will not be added to any registered category. + * @since 3.14.0 + */ + virtual void SetRegisteringCategory( + SmartPtr registering_category + ); - /** retrieve the value of the current registering category */ - virtual std::string RegisteringCategory() + /** retrieve the value of the current registering category + * @since 3.14.0 + */ + virtual SmartPtr RegisteringCategory() { return current_registering_category_; } /** Add a Number option (with no restrictions) */ virtual void AddNumberOption( - const std::string& name, - const std::string& short_description, - Number default_value, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + Number default_value, ///< default value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Add a Number option (with a lower bound) */ virtual void AddLowerBoundedNumberOption( - const std::string& name, - const std::string& short_description, - Number lower, - bool strict, - Number default_value, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + Number lower, ///< lower bound + bool strict, ///< whether lower bound is strict + Number default_value, ///< default value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Add a Number option (with a upper bound) */ virtual void AddUpperBoundedNumberOption( - const std::string& name, - const std::string& short_description, - Number upper, - bool strict, - Number default_value, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + Number upper, ///< upper bound + bool strict, ///< whether upper bound is strict + Number default_value, ///< default value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Add a Number option (with a both bounds) */ virtual void AddBoundedNumberOption( - const std::string& name, - const std::string& short_description, - Number lower, - bool lower_strict, - Number upper, - bool upper_strict, - Number default_value, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + Number lower, ///< lower bound + bool lower_strict, ///< whether lower bound is strict + Number upper, ///< upper bound + bool upper_strict, ///< whether upper bound is strict + Number default_value, ///< default value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Add a Integer option (with no restrictions) */ virtual void AddIntegerOption( - const std::string& name, - const std::string& short_description, - Index default_value, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + Index default_value, ///< default value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Add a Integer option (with a lower bound) */ virtual void AddLowerBoundedIntegerOption( - const std::string& name, - const std::string& short_description, - Index lower, - Index default_value, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + Index lower, ///< lower bound + Index default_value, ///< default value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Add a Integer option (with a upper bound) */ virtual void AddUpperBoundedIntegerOption( - const std::string& name, - const std::string& short_description, - Index upper, - Index default_value, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + Index upper, ///< upper bound + Index default_value, ///< default value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Add a Integer option (with a both bounds) */ virtual void AddBoundedIntegerOption( - const std::string& name, - const std::string& short_description, - Index lower, - Index upper, - Index default_value, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + Index lower, ///< lower bound + Index upper, ///< upper bound + Index default_value, ///< default value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Add a String option (with no restrictions) */ virtual void AddStringOption( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::vector& settings, - const std::vector& descriptions, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::vector& settings, ///< possible values + const std::vector& descriptions, ///< description of possible values + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Methods that make adding string options with only a few entries easier */ virtual void AddStringOption1( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); virtual void AddStringOption2( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& setting2, ///< second possible value + const std::string& description2, ///< description of second possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); virtual void AddStringOption3( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& setting2, ///< second possible value + const std::string& description2, ///< description of second possible value + const std::string& setting3, ///< third possible value + const std::string& description3, ///< description of third possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); virtual void AddStringOption4( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& setting2, ///< second possible value + const std::string& description2, ///< description of second possible value + const std::string& setting3, ///< third possible value + const std::string& description3, ///< description of third possible value + const std::string& setting4, ///< fourth possible value + const std::string& description4, ///< description of fourth possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); virtual void AddStringOption5( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& setting2, ///< second possible value + const std::string& description2, ///< description of second possible value + const std::string& setting3, ///< third possible value + const std::string& description3, ///< description of third possible value + const std::string& setting4, ///< fourth possible value + const std::string& description4, ///< description of fourth possible value + const std::string& setting5, ///< fifth possible value + const std::string& description5, ///< description of fifth possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); virtual void AddStringOption6( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& setting2, ///< second possible value + const std::string& description2, ///< description of second possible value + const std::string& setting3, ///< third possible value + const std::string& description3, ///< description of third possible value + const std::string& setting4, ///< fourth possible value + const std::string& description4, ///< description of fourth possible value + const std::string& setting5, ///< fifth possible value + const std::string& description5, ///< description of fifth possible value + const std::string& setting6, ///< sixth possible value + const std::string& description6, ///< description of sixth possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); virtual void AddStringOption7( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& setting7, - const std::string& description7, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& setting2, ///< second possible value + const std::string& description2, ///< description of second possible value + const std::string& setting3, ///< third possible value + const std::string& description3, ///< description of third possible value + const std::string& setting4, ///< fourth possible value + const std::string& description4, ///< description of fourth possible value + const std::string& setting5, ///< fifth possible value + const std::string& description5, ///< description of fifth possible value + const std::string& setting6, ///< sixth possible value + const std::string& description6, ///< description of sixth possible value + const std::string& setting7, ///< seventh possible value + const std::string& description7, ///< description of seventh possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); virtual void AddStringOption8( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& setting7, - const std::string& description7, - const std::string& setting8, - const std::string& description8, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& setting2, ///< second possible value + const std::string& description2, ///< description of second possible value + const std::string& setting3, ///< third possible value + const std::string& description3, ///< description of third possible value + const std::string& setting4, ///< fourth possible value + const std::string& description4, ///< description of fourth possible value + const std::string& setting5, ///< fifth possible value + const std::string& description5, ///< description of fifth possible value + const std::string& setting6, ///< sixth possible value + const std::string& description6, ///< description of sixth possible value + const std::string& setting7, ///< seventh possible value + const std::string& description7, ///< description of seventh possible value + const std::string& setting8, ///< eighth possible value + const std::string& description8, ///< description of eighth possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); virtual void AddStringOption9( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& setting7, - const std::string& description7, - const std::string& setting8, - const std::string& description8, - const std::string& setting9, - const std::string& description9, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& setting2, ///< second possible value + const std::string& description2, ///< description of second possible value + const std::string& setting3, ///< third possible value + const std::string& description3, ///< description of third possible value + const std::string& setting4, ///< fourth possible value + const std::string& description4, ///< description of fourth possible value + const std::string& setting5, ///< fifth possible value + const std::string& description5, ///< description of fifth possible value + const std::string& setting6, ///< sixth possible value + const std::string& description6, ///< description of sixth possible value + const std::string& setting7, ///< seventh possible value + const std::string& description7, ///< description of seventh possible value + const std::string& setting8, ///< eighth possible value + const std::string& description8, ///< description of eighth possible value + const std::string& setting9, ///< ninth possible value + const std::string& description9, ///< description of ninth possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); virtual void AddStringOption10( - const std::string& name, - const std::string& short_description, - const std::string& default_value, - const std::string& setting1, - const std::string& description1, - const std::string& setting2, - const std::string& description2, - const std::string& setting3, - const std::string& description3, - const std::string& setting4, - const std::string& description4, - const std::string& setting5, - const std::string& description5, - const std::string& setting6, - const std::string& description6, - const std::string& setting7, - const std::string& description7, - const std::string& setting8, - const std::string& description8, - const std::string& setting9, - const std::string& description9, - const std::string& setting10, - const std::string& description10, - const std::string& long_description = "" + const std::string& name, ///< option name + const std::string& short_description, ///< short description + const std::string& default_value, ///< default value + const std::string& setting1, ///< first possible value + const std::string& description1, ///< description of first possible value + const std::string& setting2, ///< second possible value + const std::string& description2, ///< description of second possible value + const std::string& setting3, ///< third possible value + const std::string& description3, ///< description of third possible value + const std::string& setting4, ///< fourth possible value + const std::string& description4, ///< description of fourth possible value + const std::string& setting5, ///< fifth possible value + const std::string& description5, ///< description of fifth possible value + const std::string& setting6, ///< sixth possible value + const std::string& description6, ///< description of sixth possible value + const std::string& setting7, ///< seventh possible value + const std::string& description7, ///< description of seventh possible value + const std::string& setting8, ///< eighth possible value + const std::string& description8, ///< description of eighth possible value + const std::string& setting9, ///< ninth possible value + const std::string& description9, ///< description of ninth possible value + const std::string& setting10, ///< tenth possible value + const std::string& description10, ///< description of tenth possible value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 + ); + + /** Create a string value with two possible settings: yes and no + * @since 3.14.0 + */ + virtual void AddBoolOption( + const std::string& name, ///< option name + const std::string& short_description, ///< short description + bool default_value, ///< default value + const std::string& long_description = "", ///< long description + bool advanced = false ///< whether option is for advanced users @since 3.14.0 ); /** Get a registered option @@ -864,37 +1056,95 @@ class IPOPTLIB_EXPORT RegisteredOptions: public ReferencedObject const std::string& name ); - /** Output documentation for the options - gives a description, etc. */ + /** Giving access to iteratable representation of the registered options */ + const RegOptionsList& RegisteredOptionsList() const + { + return registered_options_; + } + + /** Giving access to registered categories + * @since 3.14.0 + */ + const RegCategoriesList& RegisteredCategories() const + { + return registered_categories_; + } + + /** Giving access to registered categories ordered by (decreasing) priority + * + * Result is stored in given set. + * @since 3.14.0 + */ + void RegisteredCategoriesByPriority( + RegCategoriesByPriority& categories + ) const; + + /** Output documentation + * + * Format is decided according to print_options_mode option. + * Whether to print advanced options is decided according to print_advanced_options option. + * All categories with priority equal or greater minpriority are printed. + * @since 3.14.0 + */ virtual void OutputOptionDocumentation( - const Journalist& jnlst, - std::list& categories - ); + const Journalist& jnlst, + SmartPtr options, + int minpriority = 0 + ) const; - /** Output documentation in Latex format to include in a latex file */ + /** Output documentation in text format + * + * If categories is empty, then all options are printed. + * + * @deprecated Use other OutputOptionDocumentation() instead. + */ + IPOPT_DEPRECATED + virtual void OutputOptionDocumentation( + const Journalist& jnlst, + const std::list& categories = std::list() + ) const; + + /** Output documentation in Latex format to include in a latex file + * + * If options_to_print is empty, then all options are printed. + * + * @deprecated Use OutputOptionDocumentation() instead. + */ + IPOPT_DEPRECATED virtual void OutputLatexOptionDocumentation( - const Journalist& jnlst, - std::list& categories - ); + const Journalist& jnlst, + const std::list& options_to_print = std::list() + ) const; - /** Output documentation in Doxygen format to include in doxygen documentation */ + /** Output documentation in Doxygen format to include in doxygen documentation + * + * If options_to_print is empty, then all options are printed. + * + * @deprecated Use OutputOptionDocumentation() instead. + */ + IPOPT_DEPRECATED virtual void OutputDoxygenOptionDocumentation( - const Journalist& jnlst, - std::list& categories + const Journalist& jnlst, + const std::list& options_to_print = std::list() + ) const; + + /** register options of RegisteredOptions class + * @since 3.14.0 + */ + static void RegisterOptions( + SmartPtr roptions ); - //@} - typedef std::map > RegOptionsList; +private: + void AddOption( + const SmartPtr& option + ); - /** Giving access to iteratable representation of the registered options */ - virtual const RegOptionsList& RegisteredOptionsList() const - { - return registered_options_; - } + RegOptionsList registered_options_; + RegCategoriesList registered_categories_; -private: Index next_counter_; - std::string current_registering_category_; - std::map > registered_options_; + SmartPtr current_registering_category_; }; } // namespace Ipopt diff --git a/src/Common/IpSmartPtr.hpp b/src/Common/IpSmartPtr.hpp index 5cd50ded8..d9da52a4f 100644 --- a/src/Common/IpSmartPtr.hpp +++ b/src/Common/IpSmartPtr.hpp @@ -13,13 +13,6 @@ #if IPOPT_CHECKLEVEL > 2 # define IP_DEBUG_SMARTPTR #endif -#ifndef IPOPT_UNUSED -# if defined(__GNUC__) -# define IPOPT_UNUSED __attribute__((unused)) -# else -# define IPOPT_UNUSED -# endif -#endif namespace Ipopt { @@ -174,7 +167,7 @@ class SmartPtr: public Referencer #define ipopt_dbg_smartptr_verbosity 0 /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default constructor, initialized to NULL */ SmartPtr(); @@ -199,10 +192,10 @@ class SmartPtr: public Referencer * necessary. */ ~SmartPtr(); - //@} + ///@} /**@name Overloaded operators. */ - //@{ + ///@{ /** Overloaded arrow operator, allows the user to call * methods using the contained pointer. */ @@ -233,6 +226,7 @@ class SmartPtr: public Referencer * SmartPtr of a different type */ template + // cppcheck-suppress operatorEq ; wrong cppcheck suggestion SmartPtr& operator=( const SmartPtr& rhs); @@ -305,10 +299,10 @@ class SmartPtr: public Referencer const SmartPtr& lhs, const SmartPtr& rhs ); - //@} + ///@} /**@name friend method declarations */ - //@{ + ///@{ /** Returns the raw pointer contained. * * Use to get the value of @@ -352,11 +346,11 @@ class SmartPtr: public Referencer bool IsNull( const SmartPtr& smart_ptr ); - //@} + ///@} private: /**@name Private Data/Methods */ - //@{ + ///@{ /** Actual raw pointer to the object. */ T* ptr_; @@ -378,11 +372,11 @@ class SmartPtr: public Referencer /** Release the currently referenced object. */ void ReleasePointer_(); - //@} + ///@} }; -/**@name SmartPtr friend function declarations.*/ -//@{ +/**@name SmartPtr friend function declarations */ +///@{ template U* GetRawPtr( const SmartPtr& smart_ptr @@ -438,7 +432,7 @@ bool operator!=( const SmartPtr& raw_rhs ); -//@} +///@} template SmartPtr::SmartPtr() @@ -449,6 +443,7 @@ SmartPtr::SmartPtr() #endif #ifndef NDEBUG + // cppcheck-suppress unreadVariable const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = ptr_; #endif } @@ -464,6 +459,7 @@ SmartPtr::SmartPtr( #endif #ifndef NDEBUG + // cppcheck-suppress unreadVariable const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = ptr_; #endif @@ -483,6 +479,7 @@ SmartPtr::SmartPtr( #endif #ifndef NDEBUG + // cppcheck-suppress unreadVariable const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = ptr_; #endif @@ -501,6 +498,7 @@ SmartPtr::SmartPtr( #endif #ifndef NDEBUG + // cppcheck-suppress unreadVariable const ReferencedObject* IPOPT_UNUSED trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = ptr_; #endif diff --git a/src/Common/IpTaggedObject.hpp b/src/Common/IpTaggedObject.hpp index 42d0d1847..3ed2961cb 100644 --- a/src/Common/IpTaggedObject.hpp +++ b/src/Common/IpTaggedObject.hpp @@ -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 #ifndef __IPTAGGEDOBJECT_HPP__ @@ -104,13 +102,13 @@ class IPOPTLIB_EXPORT TaggedObject : public ReferencedObject, public Subject * 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. */ - //@{ + ///@{ /** Copy Constructor */ TaggedObject(const TaggedObject&); /** Default Assignment Operator */ void operator=(const TaggedObject&); - //@} + ///@} /** The tag indicating the current state of the object. * We use this to compare against the comparison_tag diff --git a/src/Common/IpTimedTask.hpp b/src/Common/IpTimedTask.hpp index 4df793b5c..f6cab5994 100644 --- a/src/Common/IpTimedTask.hpp +++ b/src/Common/IpTimedTask.hpp @@ -2,8 +2,6 @@ // All Rights Reserved. // This code is published under the Eclipse Public License. // -// $Id$ -// // Authors: Andreas Waechter IBM 2005-09-19 #ifndef __IPTIMEDTASK_HPP__ @@ -13,19 +11,19 @@ namespace Ipopt { -/** This class is used to collect timing information for a - * particular task. */ +/** This class is used to collect timing information for a particular task. */ class IPOPTLIB_EXPORT TimedTask { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default constructor. */ TimedTask() : total_cputime_(0.), total_systime_(0.), total_walltime_(0.), + enabled_(true), start_called_(false), end_called_(true) {} @@ -33,7 +31,23 @@ class IPOPTLIB_EXPORT TimedTask /** Default destructor */ ~TimedTask() {} - //@} + ///@} + + /// enable the timer + /// @since 3.14.0 + void Enable() + { + enabled_ = true; + } + + /// disable the timer + /// + /// following calls to Start(), End(), and EndIfStarted() have no effect + /// @since 3.14.0 + void Disable() + { + enabled_ = false; + } /** Method for resetting time to zero. */ void Reset() @@ -48,6 +62,11 @@ class IPOPTLIB_EXPORT TimedTask /** Method that is called before execution of the task. */ void Start() { + if( !enabled_ ) + { + return; + } + DBG_ASSERT(end_called_); DBG_ASSERT(!start_called_); end_called_ = false; @@ -60,6 +79,11 @@ class IPOPTLIB_EXPORT TimedTask /** Method that is called after execution of the task. */ void End() { + if( !enabled_ ) + { + return; + } + DBG_ASSERT(!end_called_); DBG_ASSERT(start_called_); end_called_ = true; @@ -75,7 +99,11 @@ class IPOPTLIB_EXPORT TimedTask * stop timing after catching exceptions. */ void EndIfStarted() { - if (start_called_) + if( !enabled_ ) + { + return; + } + if( start_called_ ) { end_called_ = true; start_called_ = false; @@ -107,6 +135,48 @@ class IPOPTLIB_EXPORT TimedTask return total_walltime_; } + /** Method returning start CPU time for started task. + * @since 3.14.0 + */ + Number StartCpuTime() const + { + DBG_ASSERT(start_called_); + DBG_ASSERT(!end_called_); + return start_cputime_; + } + + /** Method returning start system time for started task. + * @since 3.14.0 + */ + Number StartSysTime() const + { + DBG_ASSERT(start_called_); + DBG_ASSERT(!end_called_); + return start_systime_; + } + + /** Method returning start wall clock time for started task. + * @since 3.14.0 + */ + Number StartWallclockTime() const + { + DBG_ASSERT(start_called_); + DBG_ASSERT(!end_called_); + return start_walltime_; + } + + /// @since 3.14.0 + bool IsEnabled() const + { + return enabled_; + } + + /// @since 3.14.0 + bool IsStarted() const + { + return start_called_; + } + private: /**@name Default Compiler Generated Methods (Hidden to avoid * implicit creation/calling). These methods are not @@ -114,13 +184,13 @@ class IPOPTLIB_EXPORT TimedTask * for us, so we declare them private and do not define * them. This ensures that they will not be implicitly * created/called. */ - //@{ + ///@{ /** Copy Constructor */ TimedTask(const TimedTask&); /** Default Assignment Operator */ void operator=(const TimedTask&); - //@} + ///@} /** CPU time at beginning of task. */ Number start_cputime_; @@ -135,11 +205,12 @@ class IPOPTLIB_EXPORT TimedTask /** Total wall clock time for task measured so far. */ Number total_walltime_; - /** @name fields for debugging */ - //@{ + /** @name status fields */ + ///@{ + bool enabled_; bool start_called_; bool end_called_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Common/IpTypes.h b/src/Common/IpTypes.h new file mode 100644 index 000000000..116057651 --- /dev/null +++ b/src/Common/IpTypes.h @@ -0,0 +1,81 @@ +// Copyright (C) 2020 COIN-OR Foundation +// All Rights Reserved. +// This code is published under the Eclipse Public License. + +#ifndef __IPTYPES_H__ +#define __IPTYPES_H__ + +#include "IpoptConfig.h" + +#ifndef IPOPT_DEPRECATED +#if defined(_MSC_VER) +/** macro to declare symbols as deprecated + * @since Ipopt 3.14.0 + */ +# define IPOPT_DEPRECATED __declspec(deprecated) +#elif defined(__GNUC__) +/** macro to declare symbols as deprecated + * @since Ipopt 3.14.0 + */ +# define IPOPT_DEPRECATED __attribute__ ((deprecated)) +#else +/** macro to declare symbols as deprecated + * @since Ipopt 3.14.0 + */ +# define IPOPT_DEPRECATED +#endif +#endif + +#ifdef __GNUC__ +# define IPOPT_UNUSED __attribute__((unused)) +#else +# define IPOPT_UNUSED +#endif + +#ifndef IPOPT_CALLCONV +#ifdef _MSC_VER +/** @since Ipopt 3.14.0 */ +#define IPOPT_CALLCONV __cdecl +#else +/** @since Ipopt 3.14.0 */ +#define IPOPT_CALLCONV +#endif +#endif + +/** Type for floating-point numbers + * @since 3.14.0 + */ +#ifdef IPOPT_SINGLE +typedef float ipnumber; +#else +typedef double ipnumber; +#endif + +#ifdef IPOPT_INT64 +#include +/** Type of all indices of vectors, matrices etc + * @since 3.14.0 + */ +typedef int64_t ipindex; +/** Format specifier to use for ipindex in printf-format strings + * @since 3.14.0 + */ +#define IPOPT_INDEX_FORMAT PRId64 +#else +/** Type of all indices of vectors, matrices etc + * @since 3.14.0 + */ +typedef int ipindex; +/** Format specifier to use for ipindex in printf-format strings + * @since 3.14.0 + */ +#define IPOPT_INDEX_FORMAT "d" +#endif + +/** Type of Fortran integer translated into C + * @deprecated Use ipindex instead. + */ +IPOPT_DEPRECATED +typedef ipindex ipfint; + +#endif diff --git a/src/Common/IpTypes.hpp b/src/Common/IpTypes.hpp index 558b0ddcd..cdab6edd7 100644 --- a/src/Common/IpTypes.hpp +++ b/src/Common/IpTypes.hpp @@ -8,19 +8,23 @@ #define __IPTYPES_HPP__ #include "IpoptConfig.h" +#include "IpTypes.h" namespace Ipopt { + /** Type of all numbers */ -typedef double Number; +typedef ipnumber Number; + /** Type of all indices of vectors, matrices etc */ -typedef int Index; -/** Type of default integer */ +typedef ipindex Index; + +/** Type of default integer + * @deprecated Use int instead. + */ +IPOPT_DEPRECATED typedef int Int; } // namespace Ipopt -/* Type of Fortran integer translated into C */ -typedef IPOPT_FORTRAN_INTEGER_TYPE ipfint; - #endif diff --git a/src/Common/IpUtils.cpp b/src/Common/IpUtils.cpp index dd4fe8526..644e67b26 100644 --- a/src/Common/IpUtils.cpp +++ b/src/Common/IpUtils.cpp @@ -18,7 +18,7 @@ #include #include -// The special treatment of vsnprintf on SUN has been suggsted by Lou Hafer 2010/07/04 +// The special treatment of vsnprintf on SUN has been suggested by Lou Hafer 2010/07/04 #if defined(HAVE_VSNPRINTF) && defined(__SUNPRO_CC) namespace std { @@ -142,7 +142,6 @@ void IpResetRandom01() #endif } - static double Wallclock_firstCall_ = -1.; // The following function were taken from CoinTime.hpp in COIN/Coin @@ -200,7 +199,7 @@ bool Compare_le( ) { Number mach_eps = std::numeric_limits::epsilon(); - return (lhs - rhs <= 10.*mach_eps * fabs(BasVal)); + return (lhs - rhs <= 10.*mach_eps * std::abs(BasVal)); } int Snprintf( @@ -233,8 +232,8 @@ int Snprintf( ret = vsprintf(str, format, apcopy); (void) size; # endif - va_end(apcopy); # endif + va_end(apcopy); #else # ifdef HAVE_VSNPRINTF # ifdef __SUNPRO_CC diff --git a/src/Common/IpUtils.hpp b/src/Common/IpUtils.hpp index 174b1373f..3043c8a11 100644 --- a/src/Common/IpUtils.hpp +++ b/src/Common/IpUtils.hpp @@ -11,133 +11,72 @@ #include "IpTypes.hpp" #include "IpDebug.hpp" -namespace Ipopt -{ - -inline Index Max( - Index a, - Index b -) -{ - return ((a) > (b) ? (a) : (b)); -} - -inline Index Max( - Index a, - Index b, - Index c -) -{ - Index max = Max(a, b); - max = Max(max, c); - return max; -} - -inline Index Max( - Index a, - Index b, - Index c, - Index d -) -{ - Index max = Max(a, b, c); - max = Max(max, d); - return max; -} - -inline Index Min( - Index a, - Index b -) -{ - return ((a) < (b) ? (a) : (b)); -} - -inline Index Min( - Index a, - Index b, - Index c -) -{ - Index min = Min(a, b); - min = Min(min, c); - return min; -} +#include +#include +#include +#include -inline Index Min( - Index a, - Index b, - Index c, - Index d -) +namespace Ipopt { - Index min = Min(a, b, c); - min = Min(min, d); - return min; -} - -/////////////////////////////////////////// -inline Number Max( - Number a, - Number b +template +inline T Max( + T a, + T b ) { - return ((a) > (b) ? (a) : (b)); + return std::max(a, b); } -inline Number Max( - Number a, - Number b, - Number c +template +inline T Max( + T a, + T b, + T c ) { - Number max = Max(a, b); - max = Max(max, c); - return max; + return std::max(std::max(a, b), c); } -inline Number Max( - Number a, - Number b, - Number c, - Number d +template +inline T Max( + T a, + T b, + T c, + T d ) { - Number max = Max(a, b, c); - max = Max(max, d); - return max; + return std::max(std::max(a, b), std::max(c, d)); } -inline Number Min( - Number a, - Number b +template +inline T Min( + T a, + T b ) { - return ((a) < (b) ? (a) : (b)); + return std::min(a, b); } -inline Number Min( - Number a, - Number b, - Number c +template +inline T Min( + T a, + T b, + T c ) { - Number min = Min(a, b); - min = Min(min, c); - return min; + return std::min(std::min(a, b), c); } -inline Number Min( - Number a, - Number b, - Number c, - Number d +template +inline T Min( + T a, + T b, + T c, + T d ) { - Number min = Min(a, b, c); - min = Min(min, d); - return min; + return std::min(std::min(a, b), std::min(c, d)); } /** Function returning true iff the argument is a valid double number @@ -174,6 +113,9 @@ IPOPTLIB_EXPORT bool Compare_le( ); /** Method for printing a formatted output to a string with given size. */ +#ifdef __GNUC__ +__attribute__((format(printf, 3, 4))) +#endif IPOPTLIB_EXPORT int Snprintf( char* str, long size, @@ -181,6 +123,44 @@ IPOPTLIB_EXPORT int Snprintf( ... ); +/** Method to calculate new length for a memory increase based on a recommendation and limits in integer type. + * + * Checks whether recommended can be represented by T. + * If so, sets len to min of recommendation and min. + * If not, sets len to maximal value available for T, if this is larger than current value for len. + * If not, throws a std::overflow_error exception. + * + * @since 3.14.0 + */ +template +inline void ComputeMemIncrease( + T& len, ///< current length on input, new length on output + double recommended, ///< recommended size + T min, ///< minimal size that should ensured + const char* context ///< context from where this function is called - used to setup message for exception +) +{ + if( recommended >= std::numeric_limits::max() ) + { + // increase len to the maximum possible, if that is still an increase + if( len < std::numeric_limits::max() ) + { + len = std::numeric_limits::max(); + } + else + { + DBG_ASSERT(context != NULL); + std::stringstream what; + what << "Cannot allocate more than " << std::numeric_limits::max()*sizeof(T) << " bytes for " << context << " due to limitation on integer type"; + throw std::overflow_error(what.str()); + } + } + else + { + len = Max(min, (T) recommended); + } +} + } //namespace Ipopt #endif diff --git a/src/Common/IpoptConfig.h b/src/Common/IpoptConfig.h index 4a1620113..80c0b434f 100644 --- a/src/Common/IpoptConfig.h +++ b/src/Common/IpoptConfig.h @@ -40,44 +40,39 @@ #endif /* HAVE_CONFIG_H */ - /* overwrite XYZ_EXPORT from config.h when building XYZ * we want it to be __declspec(dllexport) when building a DLL on Windows * we want it to be __attribute__((__visibility__("default"))) when building with GCC, * so user can compile with -fvisibility=hidden */ #ifdef IPOPTLIB_BUILD -#ifdef DLL_EXPORT -#undef IPOPTLIB_EXPORT -#define IPOPTLIB_EXPORT __declspec(dllexport) -#elif defined(__GNUC__) && __GNUC__ >= 4 -#undef IPOPTLIB_EXPORT -#define IPOPTLIB_EXPORT __attribute__((__visibility__("default"))) -#endif +# ifdef DLL_EXPORT +# undef IPOPTLIB_EXPORT +# define IPOPTLIB_EXPORT __declspec(dllexport) +# elif defined(__GNUC__) && __GNUC__ >= 4 +# undef IPOPTLIB_EXPORT +# define IPOPTLIB_EXPORT __attribute__((__visibility__("default"))) +# endif #endif #ifdef IPOPTAMPLINTERFACELIB_BUILD -#ifdef DLL_EXPORT -#undef IPOPTAMPLINTERFACELIB_EXPORT -#define IPOPTAMPLINTERFACELIB_EXPORT __declspec(dllexport) -#elif defined(__GNUC__) && __GNUC__ >= 4 -#undef IPOPTAMPLINTERFACELIB_EXPORT -#define IPOPTAMPLINTERFACELIB_EXPORT __attribute__((__visibility__("default"))) -#endif +# ifdef DLL_EXPORT +# undef IPOPTAMPLINTERFACELIB_EXPORT +# define IPOPTAMPLINTERFACELIB_EXPORT __declspec(dllexport) +# elif defined(__GNUC__) && __GNUC__ >= 4 +# undef IPOPTAMPLINTERFACELIB_EXPORT +# define IPOPTAMPLINTERFACELIB_EXPORT __attribute__((__visibility__("default"))) +# endif #endif #ifdef SIPOPTLIB_BUILD # ifdef DLL_EXPORT +# undef SIPOPTLIB_EXPORT # define SIPOPTLIB_EXPORT __declspec(dllexport) # elif defined(__GNUC__) && __GNUC__ >= 4 +# undef SIPOPTLIB_EXPORT # define SIPOPTLIB_EXPORT __attribute__((__visibility__("default"))) # endif -#else -# ifdef DLL_EXPORT -# define SIPOPTLIB_EXPORT __declspec(dllimport) -# else -# define SIPOPTLIB_EXPORT -# endif #endif #endif /*__IPOPTCONFIG_H__*/ diff --git a/src/Common/Makefile.am b/src/Common/Makefile.am deleted file mode 100644 index 44a11a203..000000000 --- a/src/Common/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (C) 2004, 2006 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpCachedResults.hpp \ - IpDebug.hpp \ - IpException.hpp \ - IpJournalist.hpp \ - IpObserver.hpp \ - IpOptionsList.hpp \ - IpReferenced.hpp \ - IpRegOptions.hpp \ - IpSmartPtr.hpp \ - IpTaggedObject.hpp \ - IpTimedTask.hpp \ - IpTypes.hpp \ - IpUtils.hpp - -noinst_LTLIBRARIES = libcommon.la - -libcommon_la_SOURCES = \ - IpDebug.cpp \ - IpJournalist.cpp \ - IpObserver.cpp \ - IpOptionsList.cpp \ - IpRegOptions.cpp \ - IpTaggedObject.cpp \ - IpUtils.cpp - -#libcommon_la_LDFLAGS = $(LT_LDFLAGS) - -AM_CPPFLAGS = -DIPOPTLIB_BUILD - -install-exec-local: - $(install_sh_DATA) config_ipopt.h $(DESTDIR)$(includeipoptdir)/IpoptConfig.h - -uninstall-local: - rm -f $(DESTDIR)$(includeipoptdir)/IpoptConfig.h diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in deleted file mode 100644 index 508da98f3..000000000 --- a/src/Common/Makefile.in +++ /dev/null @@ -1,752 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2004, 2006 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - - -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/Common -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -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 = config.h config_ipopt.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libcommon_la_LIBADD = -am_libcommon_la_OBJECTS = IpDebug.lo IpJournalist.lo IpObserver.lo \ - IpOptionsList.lo IpRegOptions.lo IpTaggedObject.lo IpUtils.lo -libcommon_la_OBJECTS = $(am_libcommon_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 = -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@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/IpDebug.Plo \ - ./$(DEPDIR)/IpJournalist.Plo ./$(DEPDIR)/IpObserver.Plo \ - ./$(DEPDIR)/IpOptionsList.Plo ./$(DEPDIR)/IpRegOptions.Plo \ - ./$(DEPDIR)/IpTaggedObject.Plo ./$(DEPDIR)/IpUtils.Plo -am__mv = mv -f -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) \ - $(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) \ - $(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 = -SOURCES = $(libcommon_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -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__installdirs = "$(DESTDIR)$(includeipoptdir)" -HEADERS = $(includeipopt_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in config_ipopt.h.in -# 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 -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpCachedResults.hpp \ - IpDebug.hpp \ - IpException.hpp \ - IpJournalist.hpp \ - IpObserver.hpp \ - IpOptionsList.hpp \ - IpReferenced.hpp \ - IpRegOptions.hpp \ - IpSmartPtr.hpp \ - IpTaggedObject.hpp \ - IpTimedTask.hpp \ - IpTypes.hpp \ - IpUtils.hpp - -noinst_LTLIBRARIES = libcommon.la -libcommon_la_SOURCES = \ - IpDebug.cpp \ - IpJournalist.cpp \ - IpObserver.cpp \ - IpOptionsList.cpp \ - IpRegOptions.cpp \ - IpTaggedObject.cpp \ - IpUtils.cpp - - -#libcommon_la_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS = -DIPOPTLIB_BUILD -all: config.h config_ipopt.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.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 ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Common/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Common/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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): - -config.h: stamp-h1 - @test -f $@ || rm -f stamp-h1 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status src/Common/config.h -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -config_ipopt.h: stamp-h2 - @test -f $@ || rm -f stamp-h2 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h2 - -stamp-h2: $(srcdir)/config_ipopt.h.in $(top_builddir)/config.status - @rm -f stamp-h2 - cd $(top_builddir) && $(SHELL) ./config.status src/Common/config_ipopt.h - -distclean-hdr: - -rm -f config.h stamp-h1 config_ipopt.h stamp-h2 - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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}; \ - } - -libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES) $(EXTRA_libcommon_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpDebug.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpJournalist.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpObserver.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpOptionsList.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRegOptions.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTaggedObject.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpUtils.Plo@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@ $(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@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -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 \ - 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 $$?; \ - 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 - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -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) \ - $$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 - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h config_ipopt.h -installdirs: - for dir in "$(DESTDIR)$(includeipoptdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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 -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/IpDebug.Plo - -rm -f ./$(DEPDIR)/IpJournalist.Plo - -rm -f ./$(DEPDIR)/IpObserver.Plo - -rm -f ./$(DEPDIR)/IpOptionsList.Plo - -rm -f ./$(DEPDIR)/IpRegOptions.Plo - -rm -f ./$(DEPDIR)/IpTaggedObject.Plo - -rm -f ./$(DEPDIR)/IpUtils.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-includeipoptHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-exec-local - -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 -f ./$(DEPDIR)/IpDebug.Plo - -rm -f ./$(DEPDIR)/IpJournalist.Plo - -rm -f ./$(DEPDIR)/IpObserver.Plo - -rm -f ./$(DEPDIR)/IpOptionsList.Plo - -rm -f ./$(DEPDIR)/IpRegOptions.Plo - -rm -f ./$(DEPDIR)/IpTaggedObject.Plo - -rm -f ./$(DEPDIR)/IpUtils.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-includeipoptHEADERS uninstall-local - -.MAKE: all install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-exec-local \ - install-html install-html-am install-includeipoptHEADERS \ - install-info install-info-am install-man install-pdf \ - install-pdf-am 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-includeipoptHEADERS uninstall-local - -.PRECIOUS: Makefile - - -install-exec-local: - $(install_sh_DATA) config_ipopt.h $(DESTDIR)$(includeipoptdir)/IpoptConfig.h - -uninstall-local: - rm -f $(DESTDIR)$(includeipoptdir)/IpoptConfig.h - -# 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/Common/config.h.in b/src/Common/config.h.in index acb0d722d..4e7158b7d 100644 --- a/src/Common/config.h.in +++ b/src/Common/config.h.in @@ -47,18 +47,15 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the `MPI_Initialized' function. */ #undef HAVE_MPI_INITIALIZED -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -80,8 +77,8 @@ /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF -/* Define to 1 if you have the `_snprintf' function. */ -#undef HAVE__SNPRINTF +/* Define to 1 if windows.h is available. */ +#undef HAVE_WINDOWS_H /* Define to 1 if you have the `_vsnprintf' function. */ #undef HAVE__VSNPRINTF @@ -101,40 +98,37 @@ /* Define to be the name of C-function for Inf check */ #undef IPOPT_C_FINITE -/* Define to the C type corresponding to Fortran INTEGER */ -#undef IPOPT_FORTRAN_INTEGER_TYPE - /* Define to 1 if ASL is available. */ #undef IPOPT_HAS_ASL /* Define to 1 if function drand48 is available */ #undef IPOPT_HAS_DRAND48 +/* Define to 1 if function feenableexcept is available */ +#undef IPOPT_HAS_FEENABLEEXCEPT + /* Define to 1 if HSL is available. */ #undef IPOPT_HAS_HSL /* Define to 1 if the LAPACK package is available */ #undef IPOPT_HAS_LAPACK -/* Define to 1 if the linear solver loader should be compiled to allow dynamic - loading of shared libraries with linear solvers */ +/* Define to 1 if the linear solver loader should be used to load libraries + with linear solvers at runtime */ #undef IPOPT_HAS_LINEARSOLVERLOADER /* Define to 1 if Mumps is available. */ #undef IPOPT_HAS_MUMPS -/* Define to 1 if Pardiso is available */ -#undef IPOPT_HAS_PARDISO - -/* Define to 1 if you are using Pardiso from MKL */ +/* Define to 1 if Pardiso from MKL is available */ #undef IPOPT_HAS_PARDISO_MKL -/* Define to 1 if you are using the parallel version of Pardiso */ -#undef IPOPT_HAS_PARDISO_PARALLEL - /* Define to 1 if function rand is available */ #undef IPOPT_HAS_RAND +/* Define to 1 if the Spral package is available */ +#undef IPOPT_HAS_SPRAL + /* Define to 1 if function std::rand is available */ #undef IPOPT_HAS_STD__RAND @@ -151,6 +145,9 @@ /* As IPOPT_HSL_FUNC, but for C identifiers containing underscores. */ #undef IPOPT_HSL_FUNC_ +/* Define to 1 if Ipopt index type is int64_t */ +#undef IPOPT_INT64 + /* Define to a macro mangling the given C identifier (in lower and upper case). */ #undef IPOPT_LAPACK_FUNC @@ -158,12 +155,12 @@ /* As IPOPT_LAPACK_FUNC, but for C identifiers containing underscores. */ #undef IPOPT_LAPACK_FUNC_ -/* Define to a macro mangling the given C identifier (in lower and upper - case). */ -#undef IPOPT_PARDISO_FUNC +/* Define to 1 if MPI should be initialized (finalized) when Ipopt library is + (un)loaded. */ +#undef IPOPT_MPIINIT -/* As IPOPT_PARDISO_FUNC, but for C identifiers containing underscores. */ -#undef IPOPT_PARDISO_FUNC_ +/* Define to 1 if using single precision floating point */ +#undef IPOPT_SINGLE /* Define to the debug verbosity level (0 is no output) */ #undef IPOPT_VERBOSITY @@ -208,11 +205,19 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Name of Pardiso library from pardiso-project.org */ +#undef PARDISO_LIB + /* Library Visibility Attribute */ #undef SIPOPTAMPLINTERFACELIB_EXPORT +/* Library Visibility Attribute */ +#undef SIPOPTLIB_EXPORT + /* The size of `int *', as computed by sizeof. */ #undef SIZEOF_INT_P -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS diff --git a/src/Common/config_default.h b/src/Common/config_default.h index ef431a3be..80d334d54 100644 --- a/src/Common/config_default.h +++ b/src/Common/config_default.h @@ -20,10 +20,10 @@ /***************************************************************************/ /* Define to the debug sanity check level (0 is no test) */ -#define IPOPT_CHECKLEVEL 0 +/* #define IPOPT_CHECKLEVEL 0 */ /* Define to the debug verbosity level (0 is no output) */ -#define IPOPT_VERBOSITY 0 +/* #define IPOPT_VERBOSITY 0 */ /* If defined, the Ampl Solver Library is available. */ /* #undef IPOPT_HAS_ASL 1 */ @@ -41,23 +41,15 @@ loading of shared libraries with linear solvers */ /* #undef IPOPT_HAS_LINEARSOLVERLOADER */ -/* Define to 1 if Pardiso is available */ -/* #undef IPOPT_HAS_PARDISO */ - /* Define to 1 if you are using Pardiso from MKL */ /* #undef IPOPT_HAS_PARDISO_MKL */ -/* Define to 1 if you are using the parallel version of Pardiso */ -/* #undef IPOPT_HAS_PARDISO_PARALLEL */ +/* Define to 1 if SPRAL is available */ +/* #undef IPOPT_HAS_SPRAL */ /* Define to 1 if WSMP is available */ /* #undef IPOPT_HAS_WSMP */ -/* Define to the C type corresponding to Fortran INTEGER */ -#ifndef FORTRAN_INTEGER_TYPE -#define FORTRAN_INTEGER_TYPE int -#endif - /* Define to be the name of C-function for Inf check */ #ifdef _MSC_VER #define IPOPT_C_FINITE _finite diff --git a/src/Common/config_ipopt.h.in b/src/Common/config_ipopt.h.in index e45188a56..56cb1d09b 100644 --- a/src/Common/config_ipopt.h.in +++ b/src/Common/config_ipopt.h.in @@ -21,8 +21,11 @@ /* Define to the debug verbosity level (0 is no output) */ #undef IPOPT_VERBOSITY -/* Define to the C type corresponding to Fortran INTEGER */ -#undef IPOPT_FORTRAN_INTEGER_TYPE +/* Define to 1 if using single precision floating point */ +#undef IPOPT_SINGLE + +/* Define to 1 if Ipopt index type is int64_t */ +#undef IPOPT_INT64 /* Library Visibility Attribute */ #undef IPOPTAMPLINTERFACELIB_EXPORT @@ -30,9 +33,12 @@ /* Library Visibility Attribute */ #undef IPOPTLIB_EXPORT -/* for backward compatibility: will be removed in Ipopt 3.14 */ -#define FORTRAN_INTEGER_TYPE IPOPT_FORTRAN_INTEGER_TYPE -#define COIN_IPOPT_CHECKLEVEL IPOPT_CHECKLEVEL -#define COIN_IPOPT_VERBOSITY IPOPT_VERBOSITY +/* Library Visibility Attribute */ +#undef SIPOPTLIB_EXPORT + +/** type corresponding to integers in Fortran + * @deprecated Use ipindex instead. + */ +#define IPOPT_FORTRAN_INTEGER_TYPE ipindex #endif diff --git a/src/Common/config_ipopt_default.h b/src/Common/config_ipopt_default.h index 21ef4b6a3..c0956335c 100644 --- a/src/Common/config_ipopt_default.h +++ b/src/Common/config_ipopt_default.h @@ -5,20 +5,22 @@ /***************************************************************************/ /* Version number of project */ -#define IPOPT_VERSION "3.13.1" +#define IPOPT_VERSION "3.14.13" /* Major Version number of project */ -#define IPOPT_VERSION_MAJOR 3 +#define IPOPT_VERSION_MAJOR 3 /* Minor Version number of project */ -#define IPOPT_VERSION_MINOR 13 +#define IPOPT_VERSION_MINOR 14 /* Release Version number of project */ -#define IPOPT_VERSION_RELEASE 2 +#define IPOPT_VERSION_RELEASE 13 -/* Define to the C type corresponding to Fortran INTEGER */ +/* Define to the C type corresponding to Fortran INTEGER + * @deprecated Use ipindex instead. + */ #ifndef IPOPT_FORTRAN_INTEGER_TYPE -#define IPOPT_FORTRAN_INTEGER_TYPE int +#define IPOPT_FORTRAN_INTEGER_TYPE ipindex #endif #ifndef IPOPTLIB_EXPORT @@ -28,3 +30,11 @@ #define IPOPTLIB_EXPORT #endif #endif + +#ifndef SIPOPTLIB_EXPORT +#if defined(_WIN32) && defined(DLL_EXPORT) +#define DIPOPTLIB_EXPORT __declspec(dllimport) +#else +#define DIPOPTLIB_EXPORT +#endif +#endif diff --git a/src/Common/configall_system_msc.h b/src/Common/configall_system_msc.h index 11e0559ca..cd0eae1cf 100644 --- a/src/Common/configall_system_msc.h +++ b/src/Common/configall_system_msc.h @@ -136,7 +136,7 @@ #define SIZEOF_INT 4 /* The size of a `int *', as computed by sizeof. */ -#define SIZEOF_INT_P 4 +#define SIZEOF_INT_P 8 /* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4 diff --git a/src/Interfaces/IpAlgTypes.hpp b/src/Interfaces/IpAlgTypes.hpp index e8e7da6ea..557161741 100644 --- a/src/Interfaces/IpAlgTypes.hpp +++ b/src/Interfaces/IpAlgTypes.hpp @@ -14,13 +14,14 @@ namespace Ipopt { /**@name Enumerations */ -//@{ +///@{ /** enum for the return from the optimize algorithm */ enum SolverReturn { SUCCESS, MAXITER_EXCEEDED, CPUTIME_EXCEEDED, + WALLTIME_EXCEEDED, ///< @since 3.14.0 STOP_AT_TINY_STEP, STOP_AT_ACCEPTABLE_POINT, LOCAL_INFEASIBILITY, @@ -36,19 +37,18 @@ enum SolverReturn INTERNAL_ERROR, UNASSIGNED }; -//@} +///@} /** @name Some exceptions used in multiple places */ -//@{ +///@{ DECLARE_STD_EXCEPTION(LOCALLY_INFEASIBLE); DECLARE_STD_EXCEPTION(TOO_FEW_DOF); DECLARE_STD_EXCEPTION(TINY_STEP_DETECTED); +DECLARE_STD_EXCEPTION(STEP_COMPUTATION_FAILED); DECLARE_STD_EXCEPTION(ACCEPTABLE_POINT_REACHED); DECLARE_STD_EXCEPTION(FEASIBILITY_PROBLEM_SOLVED); DECLARE_STD_EXCEPTION(INVALID_WARMSTART); DECLARE_STD_EXCEPTION(INTERNAL_ABORT); -DECLARE_STD_EXCEPTION(NO_FREE_VARIABLES_BUT_FEASIBLE); -DECLARE_STD_EXCEPTION(NO_FREE_VARIABLES_AND_INFEASIBLE); DECLARE_STD_EXCEPTION(INCONSISTENT_BOUNDS); /** Exception FAILED_INITIALIZATION for problem during * initialization of a strategy object (or other problems). @@ -57,7 +57,7 @@ DECLARE_STD_EXCEPTION(INCONSISTENT_BOUNDS); * initialization, such as a value out of a feasible range. */ DECLARE_STD_EXCEPTION(FAILED_INITIALIZATION); -//@} +///@} } diff --git a/src/Interfaces/IpInterfacesRegOp.cpp b/src/Interfaces/IpInterfacesRegOp.cpp index b7cc000a8..d1f1456fa 100644 --- a/src/Interfaces/IpInterfacesRegOp.cpp +++ b/src/Interfaces/IpInterfacesRegOp.cpp @@ -16,11 +16,9 @@ void RegisterOptions_Interfaces( const SmartPtr& roptions ) { - roptions->SetRegisteringCategory("Uncategorized"); IpoptApplication::RegisterOptions(roptions); - roptions->SetRegisteringCategory("Uncategorized"); + RegisteredOptions::RegisterOptions(roptions); TNLPAdapter::RegisterOptions(roptions); - roptions->SetRegisteringCategory("Uncategorized"); } } // namespace Ipopt diff --git a/src/Interfaces/IpIpoptApplication.cpp b/src/Interfaces/IpIpoptApplication.cpp index 7e7a14f80..44525aea5 100644 --- a/src/Interfaces/IpIpoptApplication.cpp +++ b/src/Interfaces/IpIpoptApplication.cpp @@ -18,16 +18,15 @@ #include "IpAlgorithmRegOp.hpp" #include "IpCGPenaltyRegOp.hpp" #include "IpNLPBoundsRemover.hpp" - -#ifdef IPOPT_HAS_HSL -#include "CoinHslConfig.h" -#endif +#include "IpLibraryLoader.hpp" +#include "IpLinearSolvers.h" #ifdef BUILD_INEXACT # include "IpInexactRegOp.hpp" # include "IpInexactAlgBuilder.hpp" #endif +#include #include #include @@ -42,6 +41,8 @@ namespace Ipopt { #if IPOPT_VERBOSITY > 0 static const Index dbg_verbosity = 0; +// Kluge: Add reference counter for DebugJournalistWrapper::jrnl +static SmartPtr smart_jnlst(NULL); #endif IpoptApplication::IpoptApplication( @@ -50,10 +51,10 @@ IpoptApplication::IpoptApplication( ) : read_params_dat_(true), rethrow_nonipoptexception_(false), + options_(new OptionsList()), inexact_algorithm_(false), replace_bounds_(false) { - options_ = new OptionsList(); if( create_empty ) { return; @@ -63,9 +64,16 @@ IpoptApplication::IpoptApplication( try { # if IPOPT_VERBOSITY > 0 - DebugJournalistWrapper::SetJournalist(GetRawPtr(jnlst_)); - SmartPtr debug_jrnl = jnlst_->AddFileJournal("Debug", "debug.out", J_ITERSUMMARY); - debug_jrnl->SetPrintLevel(J_DBG, J_ALL); + // Kludge: If this is the first IpoptApplication, then store jnlst_ in smart_jnlst, too, so that it doesn't + // get freed when the IpoptApplication is freed and DebugJournalistWrapper::jrnl becomes a dangling pointer. + // Also add the Debug journal that writes to debug.out. + if( IsNull(smart_jnlst) ) + { + smart_jnlst = jnlst_; + DebugJournalistWrapper::SetJournalist(GetRawPtr(jnlst_)); + SmartPtr debug_jrnl = jnlst_->AddFileJournal("Debug", "debug.out", J_ITERSUMMARY); + debug_jrnl->SetPrintLevel(J_DBG, J_ALL); + } # endif DBG_START_METH("IpoptApplication::IpoptApplication()", @@ -94,6 +102,11 @@ IpoptApplication::IpoptApplication( jnlst_->Printf(J_ERROR, J_MAIN, "\nEXIT: Not enough memory.\n"); THROW_EXCEPTION(IPOPT_APPLICATION_ERROR, "Not enough memory"); } + catch( std::overflow_error& ) + { + jnlst_->Printf(J_ERROR, J_MAIN, "\nEXIT: Integer type too small for required memory.\n"); + THROW_EXCEPTION(IPOPT_APPLICATION_ERROR, "Not enough memory"); + } catch( ... ) { IpoptException exc("Unknown Exception caught in ipopt", "Unknown File", -1); @@ -114,7 +127,20 @@ IpoptApplication::IpoptApplication( options_(options), inexact_algorithm_(false), replace_bounds_(false) -{ } +{ +#if IPOPT_VERBOSITY > 0 + // Kludge: If this is the first IpoptApplication, then store jnlst_ in smart_jnlst, too, so that it doesn't + // get freed when the IpoptApplication is freed and DebugJournalistWrapper::jrnl becomes a dangling pointer. + // Also add the Debug journal that writes to debug.out. + if( IsNull(smart_jnlst) ) + { + smart_jnlst = jnlst_; + DebugJournalistWrapper::SetJournalist(GetRawPtr(jnlst_)); + SmartPtr debug_jrnl = jnlst_->AddFileJournal("Debug", "debug.out", J_ITERSUMMARY); + debug_jrnl->SetPrintLevel(J_DBG, J_ALL); + } +#endif +} SmartPtr IpoptApplication::clone() { @@ -165,14 +191,10 @@ ApplicationReturnStatus IpoptApplication::Initialize( stdout_jrnl->SetPrintLevel(J_DBG, J_NONE); } - bool option_set; - #if IPOPT_VERBOSITY > 0 // Set printlevel for debug - option_set = options_->GetIntegerValue("debug_print_level", - ivalue, ""); EJournalLevel debug_print_level; - if (option_set) + if( options_->GetIntegerValue("debug_print_level", ivalue, "") ) { debug_print_level = (EJournalLevel)ivalue; } @@ -180,13 +202,15 @@ ApplicationReturnStatus IpoptApplication::Initialize( { debug_print_level = print_level; } - SmartPtr debug_jrnl = jnlst_->GetJournal("Debug"); - if (IsNull(debug_jrnl)) - { - debug_jrnl = jnlst_->AddFileJournal("Debug", "debug.out", J_ITERSUMMARY); - } + assert(IsValid(smart_jnlst)); /* should have been created in constructor */ + SmartPtr debug_jrnl = smart_jnlst->GetJournal("Debug"); + assert(IsValid(debug_jrnl)); /* should have been added in constructor */ debug_jrnl->SetAllPrintLevels(debug_print_level); debug_jrnl->SetPrintLevel(J_DBG, J_ALL); + if( IsNull(jnlst_->GetJournal("Debug")) ) + { + jnlst_->AddJournal(debug_jrnl); + } #endif // Open an output file if required @@ -195,8 +219,7 @@ ApplicationReturnStatus IpoptApplication::Initialize( if( output_filename != "" ) { EJournalLevel file_print_level; - option_set = options_->GetIntegerValue("file_print_level", ivalue, ""); - if( option_set ) + if( options_->GetIntegerValue("file_print_level", ivalue, "") ) { file_print_level = (EJournalLevel) ivalue; } @@ -204,7 +227,9 @@ ApplicationReturnStatus IpoptApplication::Initialize( { file_print_level = print_level; } - bool openend = OpenOutputFile(output_filename, file_print_level); + bool file_append; + options_->GetBoolValue("file_append", file_append, ""); + bool openend = OpenOutputFile(output_filename, file_print_level, file_append); if( !openend ) { jnlst_->Printf(J_ERROR, J_INITIALIZATION, "Error opening output file \"%s\"\n", output_filename.c_str()); @@ -218,299 +243,7 @@ ApplicationReturnStatus IpoptApplication::Initialize( options_->GetBoolValue("print_options_documentation", print_options_documentation, ""); if( print_options_documentation ) { - std::string printmode; - options_->GetStringValue("print_options_mode", printmode, ""); - if( printmode != "text" ) - { - std::list options_to_print; - options_to_print.push_back("#Output"); - options_to_print.push_back("print_level"); - options_to_print.push_back("print_user_options"); - options_to_print.push_back("print_options_documentation"); - options_to_print.push_back("print_frequency_iter"); - options_to_print.push_back("print_frequency_time"); - options_to_print.push_back("output_file"); - options_to_print.push_back("file_print_level"); - options_to_print.push_back("option_file_name"); - options_to_print.push_back("print_info_string"); - options_to_print.push_back("inf_pr_output"); - options_to_print.push_back("print_timing_statistics"); - - options_to_print.push_back("#Termination"); - options_to_print.push_back("tol"); - options_to_print.push_back("max_iter"); - options_to_print.push_back("max_cpu_time"); - options_to_print.push_back("dual_inf_tol"); - options_to_print.push_back("constr_viol_tol"); - options_to_print.push_back("compl_inf_tol"); - options_to_print.push_back("acceptable_tol"); - options_to_print.push_back("acceptable_iter"); - options_to_print.push_back("acceptable_constr_viol_tol"); - options_to_print.push_back("acceptable_dual_inf_tol"); - options_to_print.push_back("acceptable_compl_inf_tol"); - options_to_print.push_back("acceptable_obj_change_tol"); - options_to_print.push_back("diverging_iterates_tol"); - - options_to_print.push_back("#NLP Scaling"); - options_to_print.push_back("obj_scaling_factor"); - options_to_print.push_back("nlp_scaling_method"); - options_to_print.push_back("nlp_scaling_max_gradient"); - options_to_print.push_back("nlp_scaling_min_value"); - - options_to_print.push_back("#NLP"); - options_to_print.push_back("bound_relax_factor"); - options_to_print.push_back("honor_original_bounds"); - options_to_print.push_back("check_derivatives_for_naninf"); - options_to_print.push_back("nlp_lower_bound_inf"); - options_to_print.push_back("nlp_upper_bound_inf"); - options_to_print.push_back("fixed_variable_treatment"); - options_to_print.push_back("jac_c_constant"); - options_to_print.push_back("jac_d_constant"); - options_to_print.push_back("hessian_constant"); - - options_to_print.push_back("#Initialization"); - options_to_print.push_back("bound_frac"); - options_to_print.push_back("bound_push"); - options_to_print.push_back("slack_bound_frac"); - options_to_print.push_back("slack_bound_push"); - options_to_print.push_back("bound_mult_init_val"); - options_to_print.push_back("constr_mult_init_max"); - options_to_print.push_back("bound_mult_init_method"); - - options_to_print.push_back("#Barrier Parameter"); - options_to_print.push_back("mehrotra_algorithm"); - options_to_print.push_back("mu_strategy"); - options_to_print.push_back("mu_oracle"); - options_to_print.push_back("quality_function_max_section_steps"); - options_to_print.push_back("fixed_mu_oracle"); - options_to_print.push_back("adaptive_mu_globalization"); - options_to_print.push_back("mu_init"); - options_to_print.push_back("mu_max_fact"); - options_to_print.push_back("mu_max"); - options_to_print.push_back("mu_min"); - options_to_print.push_back("mu_target"); - options_to_print.push_back("barrier_tol_factor"); - options_to_print.push_back("mu_linear_decrease_factor"); - options_to_print.push_back("mu_superlinear_decrease_power"); - - options_to_print.push_back("#Multiplier Updates"); - options_to_print.push_back("alpha_for_y"); - options_to_print.push_back("alpha_for_y_tol"); - options_to_print.push_back("recalc_y"); - options_to_print.push_back("recalc_y_feas_tol"); - - options_to_print.push_back("#Line Search"); - options_to_print.push_back("max_soc"); - options_to_print.push_back("watchdog_shortened_iter_trigger"); - options_to_print.push_back("watchdog_trial_iter_max"); - options_to_print.push_back("accept_every_trial_step"); - options_to_print.push_back("corrector_type"); - options_to_print.push_back("soc_method"); - - options_to_print.push_back("#Warm Start"); - options_to_print.push_back("warm_start_init_point"); - options_to_print.push_back("warm_start_bound_push"); - options_to_print.push_back("warm_start_bound_frac"); - options_to_print.push_back("warm_start_slack_bound_frac"); - options_to_print.push_back("warm_start_slack_bound_push"); - options_to_print.push_back("warm_start_mult_bound_push"); - options_to_print.push_back("warm_start_mult_init_max"); - - options_to_print.push_back("#Restoration Phase"); - options_to_print.push_back("expect_infeasible_problem"); - options_to_print.push_back("expect_infeasible_problem_ctol"); - options_to_print.push_back("expect_infeasible_problem_ytol"); - options_to_print.push_back("start_with_resto"); - options_to_print.push_back("soft_resto_pderror_reduction_factor"); - options_to_print.push_back("required_infeasibility_reduction"); - options_to_print.push_back("bound_mult_reset_threshold"); - options_to_print.push_back("constr_mult_reset_threshold"); - options_to_print.push_back("evaluate_orig_obj_at_resto_trial"); - - options_to_print.push_back("#Linear Solver"); - options_to_print.push_back("linear_solver"); - options_to_print.push_back("linear_system_scaling"); - options_to_print.push_back("linear_scaling_on_demand"); - options_to_print.push_back("max_refinement_steps"); - options_to_print.push_back("min_refinement_steps"); - options_to_print.push_back("neg_curv_test_reg"); - options_to_print.push_back("neg_curv_test_tol"); - - options_to_print.push_back("#Hessian Perturbation"); - options_to_print.push_back("max_hessian_perturbation"); - options_to_print.push_back("min_hessian_perturbation"); - options_to_print.push_back("first_hessian_perturbation"); - options_to_print.push_back("perturb_inc_fact_first"); - options_to_print.push_back("perturb_inc_fact"); - options_to_print.push_back("perturb_dec_fact"); - options_to_print.push_back("jacobian_regularization_value"); - - options_to_print.push_back("#Quasi-Newton"); - options_to_print.push_back("hessian_approximation"); - options_to_print.push_back("limited_memory_update_type"); - options_to_print.push_back("limited_memory_max_history"); - options_to_print.push_back("limited_memory_max_skipping"); - options_to_print.push_back("limited_memory_initialization"); - options_to_print.push_back("limited_memory_init_val"); - options_to_print.push_back("limited_memory_init_val_max"); - options_to_print.push_back("limited_memory_init_val_min"); - options_to_print.push_back("limited_memory_special_for_resto"); - - options_to_print.push_back("#Derivative Test"); - options_to_print.push_back("derivative_test"); - options_to_print.push_back("derivative_test_perturbation"); - options_to_print.push_back("derivative_test_tol"); - options_to_print.push_back("derivative_test_print_all"); - options_to_print.push_back("derivative_test_first_index"); - options_to_print.push_back("point_perturbation_radius"); - - // Special linear solver -#if defined(COINHSL_HAS_MA27) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - - options_to_print.push_back("#MA27 Linear Solver"); - options_to_print.push_back("ma27_pivtol"); - options_to_print.push_back("ma27_pivtolmax"); - options_to_print.push_back("ma27_liw_init_factor"); - options_to_print.push_back("ma27_la_init_factor"); - options_to_print.push_back("ma27_meminc_factor"); -#endif - -#if defined(COINHSL_HAS_MA57) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - - options_to_print.push_back("#MA57 Linear Solver"); - options_to_print.push_back("ma57_pivtol"); - options_to_print.push_back("ma57_pivtolmax"); - options_to_print.push_back("ma57_pre_alloc"); - options_to_print.push_back("ma57_pivot_order"); - options_to_print.push_back("ma57_automatic_scaling"); - options_to_print.push_back("ma57_block_size"); - options_to_print.push_back("ma57_node_amalgamation"); - options_to_print.push_back("ma57_small_pivot_flag"); -#endif - -#if defined(COINHSL_HAS_MA77) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - - options_to_print.push_back("#MA77 Linear Solver"); - options_to_print.push_back("ma77_print_level"); - options_to_print.push_back("ma77_buffer_lpage"); - options_to_print.push_back("ma77_buffer_npage"); - options_to_print.push_back("ma77_file_size"); - options_to_print.push_back("ma77_maxstore"); - options_to_print.push_back("ma77_nemin"); - options_to_print.push_back("ma77_order"); - options_to_print.push_back("ma77_small"); - options_to_print.push_back("ma77_static"); - options_to_print.push_back("ma77_u"); - options_to_print.push_back("ma77_umax"); -#endif - -#if defined(COINHSL_HAS_MA86) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - - options_to_print.push_back("#MA86 Linear Solver"); - options_to_print.push_back("ma86_print_level"); - options_to_print.push_back("ma86_nemin"); - options_to_print.push_back("ma86_order"); - options_to_print.push_back("ma86_scaling"); - options_to_print.push_back("ma86_small"); - options_to_print.push_back("ma86_static"); - options_to_print.push_back("ma86_u"); - options_to_print.push_back("ma86_umax"); -#endif - -#if defined(COINHSL_HAS_MA97) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - - options_to_print.push_back("#MA97 Linear Solver"); - options_to_print.push_back("ma97_print_level"); - options_to_print.push_back("ma97_nemin"); - options_to_print.push_back("ma97_order"); - options_to_print.push_back("ma97_scaling"); - options_to_print.push_back("ma97_scaling1"); - options_to_print.push_back("ma97_scaling2"); - options_to_print.push_back("ma97_scaling3"); - options_to_print.push_back("ma97_small"); - options_to_print.push_back("ma97_solve_blas3"); - options_to_print.push_back("ma97_switch1"); - options_to_print.push_back("ma97_switch2"); - options_to_print.push_back("ma97_switch3"); - options_to_print.push_back("ma97_u"); - options_to_print.push_back("ma97_umax"); -#endif - -#ifdef IPOPT_HAS_MUMPS - - options_to_print.push_back("#MUMPS Linear Solver"); - options_to_print.push_back("mumps_pivtol"); - options_to_print.push_back("mumps_pivtolmax"); - options_to_print.push_back("mumps_mem_percent"); - options_to_print.push_back("mumps_permuting_scaling"); - options_to_print.push_back("mumps_pivot_order"); - options_to_print.push_back("mumps_scaling"); -#endif - -#if defined(IPOPT_HAS_PARDISO) || defined(IPOPT_HAS_LINEARSOLVERLOADER) - - options_to_print.push_back("#Pardiso Linear Solver"); - options_to_print.push_back("pardiso_matching_strategy"); - options_to_print.push_back("pardiso_max_iterative_refinement_steps"); - options_to_print.push_back("pardiso_msglvl"); - options_to_print.push_back("pardiso_order"); - //options_to_print.push_back("pardiso_out_of_core_power"); -#endif - -#ifdef HAVE_WSMP - - options_to_print.push_back("#WSMP Linear Solver"); - options_to_print.push_back("wsmp_num_threads"); - options_to_print.push_back("wsmp_ordering_option"); - options_to_print.push_back("wsmp_pivtol"); - options_to_print.push_back("wsmp_pivtolmax"); - options_to_print.push_back("wsmp_scaling"); - options_to_print.push_back("wsmp_singularity_threshold"); -#endif - - if( printmode == "latex" ) - { - reg_options_->OutputLatexOptionDocumentation(*jnlst_, options_to_print); - } - else - { - reg_options_->OutputDoxygenOptionDocumentation(*jnlst_, options_to_print); - } - } - else - { - std::list categories; - categories.push_back("Output"); - /*categories.push_back("Main Algorithm");*/ - categories.push_back("Convergence"); - categories.push_back("NLP Scaling"); - categories.push_back("NLP"); - categories.push_back("Initialization"); - categories.push_back("Barrier Parameter Update"); - categories.push_back("Line Search"); - categories.push_back("Warm Start"); - categories.push_back("Linear Solver"); - categories.push_back("Step Calculation"); - categories.push_back("Restoration Phase"); - categories.push_back("Derivative Checker"); - categories.push_back("Hessian Approximation"); - categories.push_back("MA27 Linear Solver"); - categories.push_back("MA57 Linear Solver"); - categories.push_back("Pardiso Linear Solver"); -#ifdef HAVE_WSMP - - categories.push_back("WSMP Linear Solver"); -#endif -#ifdef IPOPT_HAS_MUMPS - - categories.push_back("Mumps Linear Solver"); -#endif - categories.push_back("MA28 Linear Solver"); - - categories.push_back("Uncategorized"); - //categories.push_back("Undocumented Options"); - reg_options_->OutputOptionDocumentation(*jnlst_, categories); - } + reg_options_->OutputOptionDocumentation(*jnlst_, options_); } #ifdef BUILD_INEXACT @@ -540,6 +273,11 @@ ApplicationReturnStatus IpoptApplication::Initialize( jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Not enough memory.\n"); return Insufficient_Memory; } + catch( std::overflow_error& ) + { + jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Integer type too small for required memory.\n"); + return Insufficient_Memory; + } catch( ... ) { if( !rethrow_nonipoptexception_ ) @@ -573,6 +311,11 @@ ApplicationReturnStatus IpoptApplication::Initialize( jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Not enough memory.\n"); return Insufficient_Memory; } + catch( std::overflow_error& ) + { + jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Integer type too small for required memory.\n"); + return Insufficient_Memory; + } catch( ... ) { if( !rethrow_nonipoptexception_ ) @@ -645,43 +388,41 @@ void IpoptApplication::RegisterOptions( "NOTE: This option only works when read from the ipopt.opt options file! " "Determines the verbosity level for the file specified by \"output_file\". " "By default it is the same as \"print_level\"."); - roptions->AddStringOption2( + roptions->AddBoolOption( + "file_append", + "Whether to append to output file, if set, instead of truncating.", + false, + "NOTE: This option only works when read from the ipopt.opt options file!"); + roptions->AddBoolOption( "print_user_options", "Print all options set by the user.", - "no", - "no", "don't print options", - "yes", "print options", + false, "If selected, the algorithm will print the list of all options set by the user including their values and whether they have been used. " "In some cases this information might be incorrect, due to the internal program flow."); - roptions->AddStringOption2( + roptions->AddBoolOption( "print_options_documentation", - "Switch to print all algorithmic options.", - "no", - "no", "don't print list", - "yes", "print list", - "If selected, the algorithm will print the list of all available algorithmic options with some documentation " - "before solving the optimization problem."); + "Switch to print all algorithmic options with some documentation before solving the optimization problem.", + false); #if IPOPT_VERBOSITY > 0 - roptions->AddBoundedIntegerOption( "debug_print_level", "Verbosity level for debug file.", 0, J_LAST_LEVEL - 1, J_ITERSUMMARY, - "This Ipopt library has been compiled in debug mode, and a file \"debug.out\" is produced for every run." + "This Ipopt library has been compiled in debug mode, and a file \"debug.out\" is produced for every run. " "This option determines the verbosity level for this file. " "By default it is the same as \"print_level\"."); #endif - roptions->AddStringOption2( + roptions->AddBoolOption( "print_timing_statistics", "Switch to print timing statistics.", - "no", - "no", "don't print statistics", - "yes", "print all timing statistics", - "If selected, the program will print the CPU usage (user time) for selected tasks."); + false, + "If selected, the program will print the time spend for selected tasks. " + "This implies timing_statistics=yes."); + roptions->SetRegisteringCategory("Miscellaneous"); roptions->AddStringOption1( "option_file_name", "File name of options file.", @@ -693,44 +434,34 @@ void IpoptApplication::RegisterOptions( "It does not make any sense to specify this option within the options file. " "Setting this option to an empty string disables reading of an options file."); - roptions->AddStringOption2( + roptions->AddBoolOption( "replace_bounds", - "Indicates if all variable bounds should be replaced by inequality constraints", - "no", - "no", "leave bounds on variables", - "yes", "replace variable bounds by inequality constraints", - "This option must be set for the inexact algorithm"); - roptions->AddStringOption2( + "Whether all variable bounds should be replaced by inequality constraints", + false, + "This option must be set for the inexact algorithm.", + true); + roptions->AddBoolOption( "skip_finalize_solution_call", - "Indicates if call to NLP::FinalizeSolution after optimization should be suppressed", - "no", - "no", "call FinalizeSolution", - "yes", "do not call FinalizeSolution", + "Whether a call to NLP::FinalizeSolution after optimization should be suppressed", + false, "In some Ipopt applications, the user might want to call the FinalizeSolution method separately. " - "Setting this option to \"yes\" will cause the IpoptApplication object to suppress the default call to that method."); + "Setting this option to \"yes\" will cause the IpoptApplication object to suppress the default call to that method.", + true); roptions->SetRegisteringCategory("Undocumented"); - roptions->AddStringOption3( - "print_options_mode", - "Undocumented", - "text", - "text", "Ordinary text", - "latex", "LaTeX formatted", - "doxygen", "Doxygen (markdown) formatted"); - roptions->AddStringOption2( + roptions->AddBoolOption( "suppress_all_output", - "Undocumented", - "no", - "no", "Undocumented", - "yes", "Undocumented", - "Undocumented"); + "", + false, + "", + true); #ifdef BUILD_INEXACT - roptions->AddStringOption2( + roptions->AddBoolOption( "inexact_algorithm", - "Activate the version of Ipopt that allows iterative linear solvers.", - "no", - "no", "use default algorithm with direct linear solvers", - "yes", "use the EXPERIMENTAL iterative linear solver option"); + "Whether to activate the version of Ipopt that allows iterative linear solvers.", + false, + "EXPERIMENTAL", + true); #endif } @@ -822,6 +553,11 @@ ApplicationReturnStatus IpoptApplication::OptimizeNLP( retValue = Insufficient_Memory; jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Not enough memory.\n"); } + catch( std::overflow_error& ) + { + retValue = Insufficient_Memory; + jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Integer type too small for required memory.\n"); + } catch( ... ) { if( !rethrow_nonipoptexception_ ) @@ -883,23 +619,23 @@ ApplicationReturnStatus IpoptApplication::call_optimize() // Reset Timing statistics ip_data_->TimingStats().ResetTimes(); - p2ip_nlp->ResetTimes(); ApplicationReturnStatus retValue = Internal_Error; SolverReturn status = INTERNAL_ERROR; - /** Flag indicating if the NLP:FinalizeSolution method should not - * be called after optimization. */ - bool skip_finalize_solution_call = false; try { + // check whether timing statistics need to be printed + bool print_timing_statistics; + options_->GetBoolValue("print_timing_statistics", print_timing_statistics, ""); + // enable collecting timing statistics if they need to be printed later + if( print_timing_statistics ) + { + options_->SetStringValue("timing_statistics", "yes", true, true); + } // Set up the algorithm p2alg->Initialize(*jnlst_, *p2ip_nlp, *p2ip_data, *p2ip_cq, *options_, ""); - // Process the options used below - bool print_timing_statistics; - options_->GetBoolValue("print_timing_statistics", print_timing_statistics, ""); - // If selected, print the user options bool print_user_options; options_->GetBoolValue("print_user_options", print_user_options, ""); @@ -907,7 +643,7 @@ ApplicationReturnStatus IpoptApplication::call_optimize() { std::string liststr; options_->PrintUserOptions(liststr); - jnlst_->Printf(J_ERROR, J_MAIN, "\nList of user-set options:\n\n%s", liststr.c_str()); + jnlst_->Printf(J_SUMMARY, J_MAIN, "\nList of user-set options:\n\n%s", liststr.c_str()); } if( jnlst_->ProduceOutput(J_DETAILED, J_MAIN) ) @@ -925,7 +661,7 @@ ApplicationReturnStatus IpoptApplication::call_optimize() // case, we rethrow the TOO_FEW_DOF exception here ASSERT_EXCEPTION(status != TOO_FEW_DEGREES_OF_FREEDOM, TOO_FEW_DOF, "Too few degrees of freedom (rethrown)!"); - jnlst_->Printf(J_SUMMARY, J_SOLUTION, "\nNumber of Iterations....: %d\n", p2ip_data->iter_count()); + jnlst_->Printf(J_SUMMARY, J_SOLUTION, "\nNumber of Iterations....: %" IPOPT_INDEX_FORMAT "\n", p2ip_data->iter_count()); if( status != INVALID_NUMBER_DETECTED ) { @@ -940,6 +676,9 @@ ApplicationReturnStatus IpoptApplication::call_optimize() jnlst_->Printf(J_SUMMARY, J_SOLUTION, "Constraint violation....: %24.16e %24.16e\n", p2ip_cq->curr_nlp_constraint_violation(NORM_MAX), p2ip_cq->unscaled_curr_nlp_constraint_violation(NORM_MAX)); + jnlst_->Printf(J_SUMMARY, J_SOLUTION, "Variable bound violation: %24.16e %24.16e\n", + p2ip_cq->curr_orig_bounds_violation(NORM_MAX), + p2ip_cq->unscaled_curr_orig_bounds_violation(NORM_MAX)); jnlst_->Printf(J_SUMMARY, J_SOLUTION, "Complementarity.........: %24.16e %24.16e\n", p2ip_cq->curr_complementarity(0., NORM_MAX), p2ip_cq->unscaled_curr_complementarity(0., NORM_MAX)); jnlst_->Printf(J_SUMMARY, J_SOLUTION, "Overall NLP error.......: %24.16e %24.16e\n\n", @@ -947,8 +686,10 @@ ApplicationReturnStatus IpoptApplication::call_optimize() } catch( IpoptNLP::Eval_Error& exc ) { + // this can happen if the final point was accepted because functions can be evaluated, + // but functions are not differentiable, so dual infeasibility cannot be computed status = INVALID_NUMBER_DETECTED; - exc.ReportException(*jnlst_, J_ERROR); + exc.ReportException(*jnlst_, J_STRONGWARNING); } } @@ -966,33 +707,40 @@ ApplicationReturnStatus IpoptApplication::call_optimize() p2ip_cq->curr_d_minus_s()->Print(*jnlst_, J_VECTOR, J_SOLUTION, "curr_d_minus_s"); } - jnlst_->Printf(J_SUMMARY, J_STATISTICS, "\nNumber of objective function evaluations = %d\n", + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "\nNumber of objective function evaluations = %" IPOPT_INDEX_FORMAT "\n", p2ip_nlp->f_evals()); - jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of objective gradient evaluations = %d\n", + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of objective gradient evaluations = %" IPOPT_INDEX_FORMAT "\n", p2ip_nlp->grad_f_evals()); - jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of equality constraint evaluations = %d\n", + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of equality constraint evaluations = %" IPOPT_INDEX_FORMAT "\n", p2ip_nlp->c_evals()); - jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of inequality constraint evaluations = %d\n", + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of inequality constraint evaluations = %" IPOPT_INDEX_FORMAT "\n", p2ip_nlp->d_evals()); - jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of equality constraint Jacobian evaluations = %d\n", + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of equality constraint Jacobian evaluations = %" IPOPT_INDEX_FORMAT "\n", p2ip_nlp->jac_c_evals()); - jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of inequality constraint Jacobian evaluations = %d\n", + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of inequality constraint Jacobian evaluations = %" IPOPT_INDEX_FORMAT "\n", p2ip_nlp->jac_d_evals()); - jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of Lagrangian Hessian evaluations = %d\n", + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Number of Lagrangian Hessian evaluations = %" IPOPT_INDEX_FORMAT "\n", p2ip_nlp->h_evals()); - Number cpu_time_overall_alg = p2ip_data->TimingStats().OverallAlgorithm().TotalCpuTime(); - Number cpu_time_funcs = p2ip_nlp->TotalFunctionEvaluationCpuTime(); - jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Total CPU secs in IPOPT (w/o function evaluations) = %10.3f\n", - cpu_time_overall_alg - cpu_time_funcs); - jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Total CPU secs in NLP function evaluations = %10.3f\n", - cpu_time_funcs); + Number wall_time_overall_alg = p2ip_data->TimingStats().OverallAlgorithm().TotalWallclockTime(); + if( p2ip_data->TimingStats().IsFunctionEvaluationTimeEnabled() ) + { + Number wall_time_funcs = p2ip_data->TimingStats().TotalFunctionEvaluationWallclockTime(); + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Total seconds in IPOPT (w/o function evaluations) = %10.3f\n", + wall_time_overall_alg - wall_time_funcs); + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Total seconds in NLP function evaluations = %10.3f\n", + wall_time_funcs); + } + else + { + jnlst_->Printf(J_SUMMARY, J_STATISTICS, "Total seconds in IPOPT = %.3f\n", + wall_time_overall_alg); + } // Write timing statistics information if( print_timing_statistics ) { jnlst_->Printf(J_SUMMARY, J_TIMING_STATISTICS, "\n\nTiming Statistics:\n\n"); p2ip_data->TimingStats().PrintAllTimingStatistics(*jnlst_, J_SUMMARY, J_TIMING_STATISTICS); - p2ip_nlp->PrintTimingStatistics(*jnlst_, J_SUMMARY, J_TIMING_STATISTICS); } // Write EXIT message @@ -1011,6 +759,11 @@ ApplicationReturnStatus IpoptApplication::call_optimize() retValue = Maximum_CpuTime_Exceeded; jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Maximum CPU time exceeded.\n"); } + else if( status == WALLTIME_EXCEEDED ) + { + retValue = Maximum_WallTime_Exceeded; + jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Maximum wallclock time exceeded.\n"); + } else if( status == STOP_AT_TINY_STEP ) { retValue = Search_Direction_Becomes_Too_Small; @@ -1039,7 +792,7 @@ ApplicationReturnStatus IpoptApplication::call_optimize() else if( status == ERROR_IN_STEP_COMPUTATION ) { retValue = Error_In_Step_Computation; - jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Error in step computation (regularization becomes too large?)!\n"); + jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Error in step computation!\n"); } else if( status == LOCAL_INFEASIBILITY ) { @@ -1085,29 +838,18 @@ ApplicationReturnStatus IpoptApplication::call_optimize() retValue = Invalid_Option; status = INVALID_OPTION; } - catch( NO_FREE_VARIABLES_BUT_FEASIBLE& exc ) - { - exc.ReportException(*jnlst_, J_MOREDETAILED); - jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Optimal Solution Found.\n"); - retValue = Solve_Succeeded; - status = SUCCESS; - skip_finalize_solution_call = true; /* has already been called by TNLPAdapter (and we don't know the correct primal solution) */ - } - catch( NO_FREE_VARIABLES_AND_INFEASIBLE& exc ) + catch( DYNAMIC_LIBRARY_FAILURE& exc ) { - exc.ReportException(*jnlst_, J_MOREDETAILED); - jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Problem has only fixed variables and constraints are infeasible.\n"); - retValue = Infeasible_Problem_Detected; - status = LOCAL_INFEASIBILITY; - skip_finalize_solution_call = true; /* has already been called by TNLPAdapter (and we don't know the correct primal solution) */ + exc.ReportException(*jnlst_, J_ERROR); + jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Library loading failure.\n"); + retValue = Invalid_Option; } catch( INCONSISTENT_BOUNDS& exc ) { exc.ReportException(*jnlst_, J_MOREDETAILED); jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Problem has inconsistent variable bounds or constraint sides.\n"); - retValue = Infeasible_Problem_Detected; + retValue = Invalid_Problem_Definition; status = LOCAL_INFEASIBILITY; - skip_finalize_solution_call = true; /* has already been called by TNLPAdapter (and we don't know the correct primal solution) */ } catch( IpoptException& exc ) { @@ -1121,6 +863,12 @@ ApplicationReturnStatus IpoptApplication::call_optimize() jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Not enough memory.\n"); status = OUT_OF_MEMORY; } + catch( std::overflow_error& ) + { + retValue = Insufficient_Memory; + jnlst_->Printf(J_SUMMARY, J_MAIN, "\nEXIT: Integer type too small for required memory.\n"); + status = OUT_OF_MEMORY; + } catch( ... ) { if( !rethrow_nonipoptexception_ ) @@ -1136,10 +884,10 @@ ApplicationReturnStatus IpoptApplication::call_optimize() } } - if( !skip_finalize_solution_call ) - { - options_->GetBoolValue("skip_finalize_solution_call", skip_finalize_solution_call, ""); - } + /** Flag indicating if the NLP:FinalizeSolution method should not + * be called after optimization. */ + bool skip_finalize_solution_call; + options_->GetBoolValue("skip_finalize_solution_call", skip_finalize_solution_call, ""); if( !skip_finalize_solution_call && IsValid(p2ip_data->curr()) && IsValid(p2ip_data->curr()->x()) ) { @@ -1155,6 +903,8 @@ ApplicationReturnStatus IpoptApplication::call_optimize() { case SUCCESS: case MAXITER_EXCEEDED: + case CPUTIME_EXCEEDED: + case WALLTIME_EXCEEDED: case STOP_AT_TINY_STEP: case STOP_AT_ACCEPTABLE_POINT: case LOCAL_INFEASIBILITY: @@ -1200,14 +950,15 @@ ApplicationReturnStatus IpoptApplication::call_optimize() bool IpoptApplication::OpenOutputFile( std::string file_name, - EJournalLevel print_level + EJournalLevel print_level, + bool file_append ) { SmartPtr file_jrnl = jnlst_->GetJournal("OutputFile:" + file_name); if( IsNull(file_jrnl) ) { - file_jrnl = jnlst_->AddFileJournal("OutputFile:" + file_name, file_name.c_str(), print_level); + file_jrnl = jnlst_->AddFileJournal("OutputFile:" + file_name, file_name.c_str(), print_level, file_append); } // Check, if the output file could be created properly @@ -1225,6 +976,37 @@ void IpoptApplication::RegisterAllIpoptOptions( const SmartPtr& roptions ) { + // create Ipopt categories here to have place where to specify its priorities + roptions->SetRegisteringCategory("Termination", 600000); + roptions->SetRegisteringCategory("Output", 500000); + roptions->SetRegisteringCategory("NLP", 480000); + roptions->SetRegisteringCategory("NLP Scaling", 470000); + roptions->SetRegisteringCategory("Initialization", 460000); + roptions->SetRegisteringCategory("Warm Start", 450000); + roptions->SetRegisteringCategory("Miscellaneous", 400000); + roptions->SetRegisteringCategory("Barrier Parameter Update", 390000); + roptions->SetRegisteringCategory("Line Search", 380000); + roptions->SetRegisteringCategory("Linear Solver", 360000); + roptions->SetRegisteringCategory("Step Calculation", 350000); + roptions->SetRegisteringCategory("Restoration Phase", 340000); + roptions->SetRegisteringCategory("Hessian Approximation", 290000); + roptions->SetRegisteringCategory("Derivative Checker", 280000); + roptions->SetRegisteringCategory("MA27 Linear Solver", 199000); + roptions->SetRegisteringCategory("MA57 Linear Solver", 198000); + roptions->SetRegisteringCategory("MA77 Linear Solver", 197000); + roptions->SetRegisteringCategory("MA86 Linear Solver", 196000); + roptions->SetRegisteringCategory("MA97 Linear Solver", 195000); + roptions->SetRegisteringCategory("Pardiso (pardiso-project.org) Linear Solver", 190000); + roptions->SetRegisteringCategory("Pardiso (MKL) Linear Solver", 189000); + roptions->SetRegisteringCategory("SPRAL Linear Solver", 180000); + roptions->SetRegisteringCategory("WSMP Linear Solver", 170000); + roptions->SetRegisteringCategory("Mumps Linear Solver", 160000); + roptions->SetRegisteringCategory("MA28 Linear Solver", 150000); + + roptions->SetRegisteringCategory("CG Penalty", -400000); + roptions->SetRegisteringCategory("Inexact Step Computation", -900000); + roptions->SetRegisteringCategory("Undocumented", -1000000); + RegisterOptions_Interfaces(roptions); RegisterOptions_Algorithm(roptions); RegisterOptions_CGPenalty(roptions); @@ -1232,6 +1014,7 @@ void IpoptApplication::RegisterAllIpoptOptions( #ifdef BUILD_INEXACT RegisterOptions_Inexact(roptions); #endif + roptions->SetRegisteringCategory(""); } SmartPtr IpoptApplication::Statistics() diff --git a/src/Interfaces/IpIpoptApplication.hpp b/src/Interfaces/IpIpoptApplication.hpp index abff4ba2c..31de64e8c 100644 --- a/src/Interfaces/IpIpoptApplication.hpp +++ b/src/Interfaces/IpIpoptApplication.hpp @@ -7,20 +7,11 @@ #ifndef __IPIPOPTAPPLICATION_HPP__ #define __IPIPOPTAPPLICATION_HPP__ -#ifndef IPOPT_EXPORT -#ifdef _MSC_VER -#define IPOPT_EXPORT(type) type __cdecl -#else -#define IPOPT_EXPORT(type) type -#endif -#endif - #include #include "IpJournalist.hpp" #include "IpTNLP.hpp" #include "IpNLP.hpp" -/* Return codes for the Optimize call for an application */ #include "IpReturnCodes.hpp" namespace Ipopt @@ -146,7 +137,7 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject ); /**@name Solve methods */ - //@{ + ///@{ /** Solve a problem that inherits from TNLP */ virtual ApplicationReturnStatus OptimizeTNLP( const SmartPtr& tnlp @@ -166,9 +157,8 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject /** Solve a problem (that inherits from TNLP) for a repeated time. * * The OptimizeTNLP method must have been called before. The - * TNLP must be the same object, and the structure (number of - * variables and constraints and position of nonzeros in Jacobian - * and Hessian must be the same). + * TNLP must be the same object. The IpoptAlgorithm object from the + * previous solve will be reused. */ virtual ApplicationReturnStatus ReOptimizeTNLP( const SmartPtr& tnlp @@ -177,26 +167,26 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject /** Solve a problem (that inherits from NLP) for a repeated time. * * The OptimizeNLP method must have been called before. The - * NLP must be the same object, and the structure (number of - * variables and constraints and position of nonzeros in Jacobian - * and Hessian must be the same). + * NLP must be the same object. The IpoptAlgorithm object from the + * previous solve will be reused. */ virtual ApplicationReturnStatus ReOptimizeNLP( const SmartPtr& nlp ); - //@} + ///@} /** Method for opening an output file with given print_level. * * @return false if there was a problem */ virtual bool OpenOutputFile( - std::string file_name, - EJournalLevel print_level + std::string file_name, /**< name of file to open */ + EJournalLevel print_level, /**< print level to be used */ + bool file_append = false /**< whether to append to file or truncate (since 3.14.13) */ ); /**@name Accessor methods */ - //@{ + ///@{ /** Get the Journalist for printing output */ virtual SmartPtr Jnlst() { @@ -223,6 +213,10 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject /** Get the object with the statistics about the most recent * optimization run. + * + * @note Statistics are not available if optimization terminated + * with a serious problem, that is, an ApplicationReturnStatus of + * Not_Enough_Degrees_Of_Freedom or lower. */ virtual SmartPtr Statistics(); @@ -237,7 +231,7 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject /** Get the Algorithm Object */ SmartPtr AlgorithmObject(); - //@} + ///@} /** Method for printing Ipopt copyright message now instead of * just before the optimization. @@ -247,10 +241,10 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject */ void PrintCopyrightMessage(); - /** Method to set whether non-ipopt non-bad_alloc exceptions + /** Method to set whether non-ipopt non-bad_alloc non-overflow_error exceptions * are rethrown by Ipopt. * - * By default, non-Ipopt and non-bad_alloc exceptions are + * By default, non-Ipopt and non-bad_alloc and non-overflow_error exceptions are * caught by Ipopts initialization and optimization methods * and the status NonIpopt_Exception_Thrown is returned. * This function allows to enable rethrowing of such exceptions. @@ -284,7 +278,7 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject * them for us, so we declare them private * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ IpoptApplication( const IpoptApplication& @@ -294,7 +288,7 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject void operator=( const IpoptApplication& ); - //@} + ///@} /** Method for the actual optimize call of the Ipopt algorithm. * @@ -303,13 +297,13 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject ApplicationReturnStatus call_optimize(); /**@name Variables that customize the application behavior */ - //@{ + ///@{ /** Decide whether or not the ipopt.opt file should be read */ bool read_params_dat_; - /** Decide whether non-ipopt non-bad_alloc exceptions should be rethrown */ + /** Decide whether non-ipopt non-bad_alloc non-overflow_error exceptions should be rethrown */ bool rethrow_nonipoptexception_; - //@} + ///@} /** Journalist for reporting output */ SmartPtr jnlst_; @@ -354,7 +348,7 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject SmartPtr nlp_adapter_; /** @name Algorithmic parameters */ - //@{ + ///@{ /** Flag indicating if we are to use the inexact linear solver option */ bool inexact_algorithm_; @@ -364,11 +358,11 @@ class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject * This is necessary for the inexact algorithm. */ bool replace_bounds_; - //@} + ///@} }; } // namespace Ipopt -extern "C" IPOPTLIB_EXPORT IPOPT_EXPORT(class Ipopt::IpoptApplication*) IpoptApplicationFactory(); +extern "C" IPOPTLIB_EXPORT class Ipopt::IpoptApplication* IPOPT_CALLCONV IpoptApplicationFactory(); #endif diff --git a/src/Interfaces/IpNLP.hpp b/src/Interfaces/IpNLP.hpp index 353868a81..57dc06733 100644 --- a/src/Interfaces/IpNLP.hpp +++ b/src/Interfaces/IpNLP.hpp @@ -23,11 +23,26 @@ class IpoptData; class IpoptCalculatedQuantities; class IteratesVector; +/** Traditional %NLP. + * + * Represents NLPs of the form + * \f{eqnarray*} + * \mathrm{min} && f(x), \\ + * \mathrm{s.t.} && c(x) = 0, &\qquad y_c\\ + * && d_L \leq d(x) \leq d_U, &\qquad y_d \\ + * && x_L \leq x \leq x_U, &\qquad z_L, z_U + * \f} + * where \f$y_c\f$, \f$y_d\f$, \f$z_L\f$, \f$z_U\f$ name the dual variables of the corresponding constraints. + * + * A prominent implementation of a NLP is TNLPAdapter. + * + * A traditional %NLP is wrapper into a IpoptNLP, e.g., OrigIpoptNLP. + */ class IPOPTLIB_EXPORT NLP: public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default constructor */ NLP() { } @@ -35,16 +50,16 @@ class IPOPTLIB_EXPORT NLP: public ReferencedObject /** Default destructor */ virtual ~NLP() { } - //@} + ///@} /** Exceptions */ - //@{ + ///@{ DECLARE_STD_EXCEPTION(USER_SCALING_NOT_IMPLEMENTED); DECLARE_STD_EXCEPTION(INVALID_NLP); - //@} + ///@} /** @name NLP Initialization (overload in derived classes).*/ - //@{ + ///@{ /** Overload if you want the chance to process options or parameters that may be specific to the NLP */ virtual bool ProcessOptions( const OptionsList& /*options*/, @@ -87,10 +102,8 @@ class IPOPTLIB_EXPORT NLP: public ReferencedObject Vector& d_U ) = 0; - /** Method for obtaining the starting point for all the iterates. - * - * @todo it might not make sense to ask for initial values for v_L and v_U? - */ + /** Method for obtaining the starting point for all the iterates. */ + // ToDo it might not make sense to ask for initial values for v_L and v_U? virtual bool GetStartingPoint( SmartPtr x, bool need_x, @@ -115,10 +128,10 @@ class IPOPTLIB_EXPORT NLP: public ReferencedObject { return false; } - //@} + ///@} - /** @name NLP evaluation routines (overload in derived classes. */ - //@{ + /** @name NLP evaluation routines (overload in derived classes). */ + ///@{ virtual bool Eval_f( const Vector& x, Number& f @@ -156,12 +169,12 @@ class IPOPTLIB_EXPORT NLP: public ReferencedObject const Vector& yd, SymMatrix& h ) = 0; - //@} + ///@} /** @name NLP solution routines. * Have default dummy implementations that can be overloaded. */ - //@{ + ///@{ /** This method is called at the very end of the optimization. * * It provides the final iterate to the user, so that it can be @@ -219,13 +232,13 @@ class IPOPTLIB_EXPORT NLP: public ReferencedObject { return true; } - //@} + ///@} /** Routines to get the scaling parameters. * * These do not need to be overloaded unless the options are set for user scaling. */ - //@{ + ///@{ virtual void GetScalingParameters( const SmartPtr /*x_space*/, const SmartPtr /*c_space*/, @@ -239,7 +252,7 @@ class IPOPTLIB_EXPORT NLP: public ReferencedObject THROW_EXCEPTION(USER_SCALING_NOT_IMPLEMENTED, "You have set options for user provided scaling, but have not implemented GetScalingParameters in the NLP interface"); } - //@} + ///@} /** Method for obtaining the subspace in which the limited-memory * Hessian approximation should be done. @@ -275,7 +288,7 @@ class IPOPTLIB_EXPORT NLP: public ReferencedObject * them for us, so we declare them private * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ NLP( const NLP& @@ -285,7 +298,7 @@ class IPOPTLIB_EXPORT NLP: public ReferencedObject void operator=( const NLP& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Interfaces/IpReturnCodes.h b/src/Interfaces/IpReturnCodes.h index a621ffd17..fd618ffef 100644 --- a/src/Interfaces/IpReturnCodes.h +++ b/src/Interfaces/IpReturnCodes.h @@ -9,7 +9,15 @@ #define __IPRETURNCODES_H__ /* include from a common include file */ +#ifdef __cplusplus +extern "C" +{ +#endif #include "IpReturnCodes_inc.h" +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/Interfaces/IpReturnCodes.inc b/src/Interfaces/IpReturnCodes.inc index 857c039ca..894ca758e 100644 --- a/src/Interfaces/IpReturnCodes.inc +++ b/src/Interfaces/IpReturnCodes.inc @@ -37,6 +37,9 @@ C INTEGER IP_CPUTIME_EXCEEDED PARAMETER( IP_CPUTIME_EXCEEDED = -4 ) + INTEGER IP_WALLTIME_EXCEEDED + PARAMETER( IP_WALLTIME_EXCEEDED = -5 ) + INTEGER IP_NOT_ENOUGH_DEGREES_OF_FRE PARAMETER( IP_NOT_ENOUGH_DEGREES_OF_FRE = -10 ) diff --git a/src/Interfaces/IpReturnCodes_inc.h b/src/Interfaces/IpReturnCodes_inc.h index 068a64e44..41da10b7e 100644 --- a/src/Interfaces/IpReturnCodes_inc.h +++ b/src/Interfaces/IpReturnCodes_inc.h @@ -24,6 +24,7 @@ enum ApplicationReturnStatus Restoration_Failed = -2, Error_In_Step_Computation = -3, Maximum_CpuTime_Exceeded = -4, + Maximum_WallTime_Exceeded = -5, ///< @since 3.14.0 Not_Enough_Degrees_Of_Freedom = -10, Invalid_Problem_Definition = -11, diff --git a/src/Interfaces/IpSolveStatistics.cpp b/src/Interfaces/IpSolveStatistics.cpp index cf4de0ca3..bcb18b603 100644 --- a/src/Interfaces/IpSolveStatistics.cpp +++ b/src/Interfaces/IpSolveStatistics.cpp @@ -32,6 +32,8 @@ SolveStatistics::SolveStatistics( dual_inf_(ip_cq->unscaled_curr_dual_infeasibility(NORM_MAX)), scaled_constr_viol_(ip_cq->curr_nlp_constraint_violation(NORM_MAX)), constr_viol_(ip_cq->unscaled_curr_nlp_constraint_violation(NORM_MAX)), + scaled_bound_viol_(ip_cq->curr_orig_bounds_violation(NORM_MAX)), + bound_viol_(ip_cq->unscaled_curr_orig_bounds_violation(NORM_MAX)), scaled_compl_(ip_cq->curr_complementarity(0., NORM_MAX)), compl_(ip_cq->unscaled_curr_complementarity(0., NORM_MAX)), scaled_kkt_error_(ip_cq->curr_nlp_error()), @@ -86,15 +88,45 @@ void SolveStatistics::Infeasibilities( kkt_error = kkt_error_; } +void SolveStatistics::Infeasibilities( + Number& dual_inf, + Number& constr_viol, + Number& varbounds_viol, + Number& complementarity, + Number& kkt_error +) const +{ + dual_inf = dual_inf_; + constr_viol = constr_viol_; + varbounds_viol = bound_viol_; + complementarity = compl_; + kkt_error = kkt_error_; +} + +void SolveStatistics::ScaledInfeasibilities( + Number& scaled_dual_inf, + Number& scaled_constr_viol, + Number& scaled_complementarity, + Number& scaled_kkt_error +) const +{ + scaled_dual_inf = scaled_dual_inf_; + scaled_constr_viol = scaled_constr_viol_; + scaled_complementarity = scaled_compl_; + scaled_kkt_error = scaled_kkt_error_; +} + void SolveStatistics::ScaledInfeasibilities( Number& scaled_dual_inf, Number& scaled_constr_viol, + Number& scaled_varbound_viol, Number& scaled_complementarity, Number& scaled_kkt_error ) const { scaled_dual_inf = scaled_dual_inf_; scaled_constr_viol = scaled_constr_viol_; + scaled_varbound_viol = scaled_bound_viol_; scaled_complementarity = scaled_compl_; scaled_kkt_error = scaled_kkt_error_; } diff --git a/src/Interfaces/IpSolveStatistics.hpp b/src/Interfaces/IpSolveStatistics.hpp index e6db6cd49..ad228962f 100644 --- a/src/Interfaces/IpSolveStatistics.hpp +++ b/src/Interfaces/IpSolveStatistics.hpp @@ -9,6 +9,7 @@ #include "IpReferenced.hpp" #include "IpSmartPtr.hpp" +#include "IpUtils.hpp" namespace Ipopt { @@ -27,7 +28,7 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default constructor. * * It takes in those collecting Ipopt @@ -44,10 +45,10 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject /** Default destructor */ virtual ~SolveStatistics() { } - //@} + ///@} /** @name Accessor methods for retrieving different kind of solver statistics information */ - //@{ + ///@{ /** Iteration counts. */ virtual Index IterationCount() const; @@ -56,8 +57,9 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject /** Total CPU time, including function evaluations. * - * Included for backward compatibility. + * @deprecated Use TotalCpuTime() instead. */ + IPOPT_DEPRECATED Number TotalCPUTime() const { return TotalCpuTime(); @@ -78,7 +80,11 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject Index& num_hess_evals ) const; - /** Unscaled solution infeasibilities. */ + /** Unscaled solution infeasibilities. + * + * @deprecated Use Infeasibilities() with 5 arguments instead. + */ + IPOPT_DEPRECATED virtual void Infeasibilities( Number& dual_inf, Number& constr_viol, @@ -86,7 +92,20 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject Number& kkt_error ) const; - /** Scaled solution infeasibilities. */ + /** Unscaled solution infeasibilities. */ + virtual void Infeasibilities( + Number& dual_inf, ///< dual infeasibility (Gradient of Lagrangian not zero) + Number& constr_viol, ///< violation of constraints + Number& varbounds_viol, ///< violation of variable bounds @since 3.14.0 + Number& complementarity, ///< violation of complementarity + Number& kkt_error ///< KKT error + ) const; + + /** Scaled solution infeasibilities. + * + * @deprecated Use ScaledInfeasibilities() with 5 arguments instead. + */ + IPOPT_DEPRECATED virtual void ScaledInfeasibilities( Number& scaled_dual_inf, Number& scaled_constr_viol, @@ -94,12 +113,24 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject Number& scaled_kkt_error ) const; + /** Scaled solution infeasibilities. + * + * @deprecated Use ScaledInfeasibilities() with 5 arguments instead. + */ + virtual void ScaledInfeasibilities( + Number& scaled_dual_inf, ///< scaled dual infeasibility (Gradient of Lagrangian not zero) + Number& scaled_constr_viol, ///< violation of scaled constraints + Number& scaled_varbounds_viol, ///< violation of scaled variable bounds @since 3.14.0 + Number& scaled_complementarity, ///< violation of scaled complementarity + Number& scaled_kkt_error ///< scaled KKT error + ) const; + /** Final value of objective function */ virtual Number FinalObjective() const; /** Final scaled value of objective function */ virtual Number FinalScaledObjective() const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -111,7 +142,7 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ SolveStatistics(); @@ -124,10 +155,10 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject void operator=( const SolveStatistics& ); - //@} + ///@} /** @name Fields for storing the statistics data */ - //@{ + ///@{ /** Number of iterations. */ Index num_iters_; /* Total CPU time */ @@ -159,6 +190,10 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject Number scaled_constr_viol_; /** Final unscaled constraint violation (max-norm) */ Number constr_viol_; + /** Final scaled variable bound violation (max-norm) */ + Number scaled_bound_viol_; + /** Final unscaled variable bound violation (max-norm) */ + Number bound_viol_; /** Final scaled complementarity error (max-norm) */ Number scaled_compl_; /** Final unscaled complementarity error (max-norm) */ @@ -167,7 +202,7 @@ class IPOPTLIB_EXPORT SolveStatistics : public ReferencedObject Number scaled_kkt_error_; /** Final overall unscaled KKT error (max-norm) */ Number kkt_error_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Interfaces/IpStdCInterface.cpp b/src/Interfaces/IpStdCInterface.cpp index 1ef2bd458..66969b9ae 100644 --- a/src/Interfaces/IpStdCInterface.cpp +++ b/src/Interfaces/IpStdCInterface.cpp @@ -4,46 +4,47 @@ // // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 -/// @todo use memcpy for various for-loop-copies - #include "IpStdCInterface.h" #include "IpStdInterfaceTNLP.hpp" #include "IpOptionsList.hpp" #include "IpIpoptApplication.hpp" +#include "IpBlas.hpp" +#include "IpSmartPtr.hpp" struct IpoptProblemInfo { Ipopt::SmartPtr app; - Index n; - Number* x_L; - Number* x_U; - Index m; - Number* g_L; - Number* g_U; - Index nele_jac; - Index nele_hess; - Index index_style; + Ipopt::SmartPtr tnlp; + ipindex n; + ipnumber* x_L; + ipnumber* x_U; + ipindex m; + ipnumber* g_L; + ipnumber* g_U; + ipindex nele_jac; + ipindex nele_hess; + ipindex index_style; Eval_F_CB eval_f; Eval_G_CB eval_g; Eval_Grad_F_CB eval_grad_f; Eval_Jac_G_CB eval_jac_g; Eval_H_CB eval_h; Intermediate_CB intermediate_cb; - Number obj_scaling; - Number* x_scaling; - Number* g_scaling; + ipnumber obj_scaling; + ipnumber* x_scaling; + ipnumber* g_scaling; }; IpoptProblem CreateIpoptProblem( - Index n, - Number* x_L, - Number* x_U, - Index m, - Number* g_L, - Number* g_U, - Index nele_jac, - Index nele_hess, - Index index_style, + ipindex n, + ipnumber* x_L, + ipnumber* x_U, + ipindex m, + ipnumber* g_L, + ipnumber* g_U, + ipindex nele_jac, + ipindex nele_hess, + ipindex index_style, Eval_F_CB eval_f, Eval_G_CB eval_g, Eval_Grad_F_CB eval_grad_f, @@ -60,33 +61,23 @@ IpoptProblem CreateIpoptProblem( IpoptProblem retval = new IpoptProblemInfo; + retval->tnlp = NULL; + retval->n = n; - retval->x_L = new Number[n]; - for( Index i = 0; i < n; i++ ) - { - retval->x_L[i] = x_L[i]; - } + retval->x_L = new ipnumber[n]; + Ipopt::IpBlasCopy(n, x_L, 1, retval->x_L, 1); - retval->x_U = new Number[n]; - for( Index i = 0; i < n; i++ ) - { - retval->x_U[i] = x_U[i]; - } + retval->x_U = new ipnumber[n]; + Ipopt::IpBlasCopy(n, x_U, 1, retval->x_U, 1); retval->m = m; if( m > 0 ) { - retval->g_L = new Number[m]; - for( Index i = 0; i < m; i++ ) - { - retval->g_L[i] = g_L[i]; - } + retval->g_L = new ipnumber[m]; + Ipopt::IpBlasCopy(m, g_L, 1, retval->g_L, 1); - retval->g_U = new Number[m]; - for( Index i = 0; i < m; i++ ) - { - retval->g_U[i] = g_U[i]; - } + retval->g_U = new ipnumber[m]; + Ipopt::IpBlasCopy(m, g_U, 1, retval->g_U, 1); } else { @@ -130,47 +121,47 @@ void FreeIpoptProblem( delete ipopt_problem; } -Bool AddIpoptStrOption( +bool AddIpoptStrOption( IpoptProblem ipopt_problem, char* keyword, char* val ) { - return (Bool) ipopt_problem->app->Options()->SetStringValue(keyword, val); + return ipopt_problem->app->Options()->SetStringValue(keyword, val); } -Bool AddIpoptNumOption( +bool AddIpoptNumOption( IpoptProblem ipopt_problem, char* keyword, - Number val + ipnumber val ) { - return (Bool) ipopt_problem->app->Options()->SetNumericValue(keyword, val); + return ipopt_problem->app->Options()->SetNumericValue(keyword, val); } -Bool AddIpoptIntOption( +bool AddIpoptIntOption( IpoptProblem ipopt_problem, char* keyword, - Int val + ipindex val ) { - return (Bool) ipopt_problem->app->Options()->SetIntegerValue(keyword, val); + return ipopt_problem->app->Options()->SetIntegerValue(keyword, val); } -Bool OpenIpoptOutputFile( +bool OpenIpoptOutputFile( IpoptProblem ipopt_problem, char* file_name, - Int print_level + int print_level ) { - return (Bool) ipopt_problem->app->OpenOutputFile(file_name, Ipopt::EJournalLevel(print_level)); + return ipopt_problem->app->OpenOutputFile(file_name, Ipopt::EJournalLevel(print_level)); } -Bool SetIpoptProblemScaling( +bool SetIpoptProblemScaling( IpoptProblem ipopt_problem, - Number obj_scaling, - Number* x_scaling, - Number* g_scaling + ipnumber obj_scaling, + ipnumber* x_scaling, + ipnumber* g_scaling ) { ipopt_problem->obj_scaling = obj_scaling; @@ -179,12 +170,9 @@ Bool SetIpoptProblemScaling( { if( !ipopt_problem->x_scaling ) { - ipopt_problem->x_scaling = new Number[ipopt_problem->n]; - } - for( ::Index i = 0; i < ipopt_problem->n; i++ ) - { - ipopt_problem->x_scaling[i] = x_scaling[i]; + ipopt_problem->x_scaling = new ipnumber[ipopt_problem->n]; } + Ipopt::IpBlasCopy(ipopt_problem->n, x_scaling, 1, ipopt_problem->x_scaling, 1); } else { @@ -196,12 +184,9 @@ Bool SetIpoptProblemScaling( { if( !ipopt_problem->g_scaling ) { - ipopt_problem->g_scaling = new Number[ipopt_problem->m]; - } - for( ::Index i = 0; i < ipopt_problem->m; i++ ) - { - ipopt_problem->g_scaling[i] = g_scaling[i]; + ipopt_problem->g_scaling = new ipnumber[ipopt_problem->m]; } + Ipopt::IpBlasCopy(ipopt_problem->m, g_scaling, 1, ipopt_problem->g_scaling, 1); } else { @@ -209,27 +194,27 @@ Bool SetIpoptProblemScaling( ipopt_problem->g_scaling = NULL; } - return (Bool) true; + return true; } -Bool SetIntermediateCallback( +bool SetIntermediateCallback( IpoptProblem ipopt_problem, Intermediate_CB intermediate_cb ) { ipopt_problem->intermediate_cb = intermediate_cb; - return (Bool) true; + return true; } enum ApplicationReturnStatus IpoptSolve( IpoptProblem ipopt_problem, - Number* x, - Number* g, - Number* obj_val, - Number* mult_g, - Number* mult_x_L, - Number* mult_x_U, + ipnumber* x, + ipnumber* g, + ipnumber* obj_val, + ipnumber* mult_g, + ipnumber* mult_x_L, + ipnumber* mult_x_U, UserDataPtr user_data ) { @@ -247,57 +232,43 @@ enum ApplicationReturnStatus IpoptSolve( } // Copy the starting point information - Number* start_x = new Number[ipopt_problem->n]; - for( Index i = 0; i < ipopt_problem->n; ++i ) - { - start_x[i] = x[i]; - } + ipnumber* start_x = new ipnumber[ipopt_problem->n]; + Ipopt::IpBlasCopy(ipopt_problem->n, x, 1, start_x, 1); - Number* start_lam = NULL; + ipnumber* start_lam = NULL; if( mult_g ) { - start_lam = new Number[ipopt_problem->m]; - for( Index i = 0; i < ipopt_problem->m; ++i ) - { - start_lam[i] = mult_g[i]; - } + start_lam = new ipnumber[ipopt_problem->m]; + Ipopt::IpBlasCopy(ipopt_problem->m, mult_g, 1, start_lam, 1); } - Number* start_z_L = NULL; + ipnumber* start_z_L = NULL; if( mult_x_L ) { - start_z_L = new Number[ipopt_problem->n]; - for( Index i = 0; i < ipopt_problem->n; ++i ) - { - start_z_L[i] = mult_x_L[i]; - } + start_z_L = new ipnumber[ipopt_problem->n]; + Ipopt::IpBlasCopy(ipopt_problem->n, mult_x_L, 1, start_z_L, 1); } - Number* start_z_U = NULL; + ipnumber* start_z_U = NULL; if( mult_x_U ) { - start_z_U = new Number[ipopt_problem->n]; - for( Index i = 0; i < ipopt_problem->n; ++i ) - { - start_z_U[i] = mult_x_U[i]; - } + start_z_U = new ipnumber[ipopt_problem->n]; + Ipopt::IpBlasCopy(ipopt_problem->n, mult_x_U, 1, start_z_U, 1); } - // Create the original nlp - Ipopt::SmartPtr tnlp; - Ipopt::ApplicationReturnStatus status; try { - tnlp = new Ipopt::StdInterfaceTNLP(ipopt_problem->n, ipopt_problem->x_L, ipopt_problem->x_U, - ipopt_problem->m, ipopt_problem->g_L, ipopt_problem->g_U, - ipopt_problem->nele_jac, ipopt_problem->nele_hess, ipopt_problem->index_style, - start_x, start_lam, start_z_L, start_z_U, - ipopt_problem->eval_f, ipopt_problem->eval_g, ipopt_problem->eval_grad_f, ipopt_problem->eval_jac_g, ipopt_problem->eval_h, - ipopt_problem->intermediate_cb, - x, mult_x_L, mult_x_U, g, mult_g, obj_val, user_data, - ipopt_problem->obj_scaling, ipopt_problem->x_scaling, ipopt_problem->g_scaling); - status = ipopt_problem->app->OptimizeTNLP(tnlp); + // Create the original nlp + ipopt_problem->tnlp = new Ipopt::StdInterfaceTNLP(ipopt_problem->n, ipopt_problem->x_L, ipopt_problem->x_U, + ipopt_problem->m, ipopt_problem->g_L, ipopt_problem->g_U, + ipopt_problem->nele_jac, ipopt_problem->nele_hess, ipopt_problem->index_style, + start_x, start_lam, start_z_L, start_z_U, + ipopt_problem->eval_f, ipopt_problem->eval_g, ipopt_problem->eval_grad_f, ipopt_problem->eval_jac_g, ipopt_problem->eval_h, + ipopt_problem->intermediate_cb, + x, mult_x_L, mult_x_U, g, mult_g, obj_val, user_data, + ipopt_problem->obj_scaling, ipopt_problem->x_scaling, ipopt_problem->g_scaling); + status = ipopt_problem->app->OptimizeTNLP(ipopt_problem->tnlp); } catch( Ipopt::INVALID_STDINTERFACE_NLP& exc ) { @@ -309,6 +280,7 @@ enum ApplicationReturnStatus IpoptSolve( exc.ReportException(*ipopt_problem->app->Jnlst(), Ipopt::J_ERROR); status = Ipopt::Unrecoverable_Exception; } + ipopt_problem->tnlp = NULL; delete[] start_x; delete[] start_lam; @@ -317,3 +289,45 @@ enum ApplicationReturnStatus IpoptSolve( return ApplicationReturnStatus(status); } + +bool GetIpoptCurrentIterate( + IpoptProblem ipopt_problem, + bool scaled, + ipindex n, + ipnumber* x, + ipnumber* z_L, + ipnumber* z_U, + ipindex m, + ipnumber* g, + ipnumber* lambda +) +{ + if( IsNull(ipopt_problem->tnlp) ) + { + return false; + } + + return ipopt_problem->tnlp->get_curr_iterate(scaled, n, x, z_L, z_U, m, g, lambda); +} + +bool GetIpoptCurrentViolations( + IpoptProblem ipopt_problem, + bool scaled, + ipindex n, + ipnumber* x_L_violation, + ipnumber* x_U_violation, + ipnumber* compl_x_L, + ipnumber* compl_x_U, + ipnumber* grad_lag_x, + ipindex m, + ipnumber* nlp_constraint_violation, + ipnumber* compl_g +) +{ + if( IsNull(ipopt_problem->tnlp) ) + { + return false; + } + + return ipopt_problem->tnlp->get_curr_violations(scaled != 0, n, x_L_violation, x_U_violation, compl_x_L, compl_x_U, grad_lag_x, m, nlp_constraint_violation, compl_g); +} diff --git a/src/Interfaces/IpStdCInterface.h b/src/Interfaces/IpStdCInterface.h index 3789bbf49..ab2bf66b4 100644 --- a/src/Interfaces/IpStdCInterface.h +++ b/src/Interfaces/IpStdCInterface.h @@ -8,14 +8,15 @@ #ifndef __IPSTDCINTERFACE_H__ #define __IPSTDCINTERFACE_H__ +#include + #include "IpoptConfig.h" +#include "IpTypes.h" +#include "IpReturnCodes.h" #ifndef IPOPT_EXPORT -#ifdef _MSC_VER -#define IPOPT_EXPORT(type) type __cdecl -#else -#define IPOPT_EXPORT(type) type -#endif +/** @deprecated Use IPOPT_CALLCONV instead. */ +#define IPOPT_EXPORT(type) type IPOPT_CALLCONV #endif #ifdef __cplusplus @@ -24,37 +25,38 @@ extern "C" #endif /** Type for all number. - * - * We need to make sure that this is identical with what is defined in Common/IpTypes.hpp + * @deprecated Use ipnumber instead. */ -typedef double Number; +IPOPT_DEPRECATED +typedef ipnumber Number; /** Type for all indices. - * - * We need to make sure that this is identical with what is defined in Common/IpTypes.hpp + * @deprecated Use ipindex instead. */ +IPOPT_DEPRECATED typedef int Index; /** Type for all integers. - * - * We need to make sure that this is identical with what is defined in Common/IpTypes.hpp + * @deprecated Use int instead. */ +IPOPT_DEPRECATED typedef int Int; -/* This includes the SolverReturn enum type */ -#include "IpReturnCodes.h" - /** Structure collecting all information about the problem definition and solve statistics etc. */ struct IpoptProblemInfo; /** Pointer to an Ipopt Problem. */ typedef struct IpoptProblemInfo* IpoptProblem; -/** define a boolean type for C */ -typedef int Bool; +/** define a boolean type for C + * @deprecated Use bool instead. + */ +typedef bool Bool; #ifndef TRUE +/* @deprecated Use true instead. */ # define TRUE (1) #endif +/* @deprecated Use false instead. */ #ifndef FALSE # define FALSE (0) #endif @@ -68,11 +70,11 @@ typedef void* UserDataPtr; * * See also Ipopt::TNLP::eval_f. */ -typedef Bool (*Eval_F_CB)( - Index n, - Number* x, - Bool new_x, - Number* obj_value, +typedef bool (*Eval_F_CB)( + ipindex n, + ipnumber* x, + bool new_x, + ipnumber* obj_value, UserDataPtr user_data ); @@ -82,11 +84,11 @@ typedef Bool (*Eval_F_CB)( * * See also Ipopt::TNLP::eval_grad_f. */ -typedef Bool (*Eval_Grad_F_CB)( - Index n, - Number* x, - Bool new_x, - Number* grad_f, +typedef bool (*Eval_Grad_F_CB)( + ipindex n, + ipnumber* x, + bool new_x, + ipnumber* grad_f, UserDataPtr user_data ); @@ -96,12 +98,12 @@ typedef Bool (*Eval_Grad_F_CB)( * * See also Ipopt::TNLP::eval_g. */ -typedef Bool (*Eval_G_CB)( - Index n, - Number* x, - Bool new_x, - Index m, - Number* g, +typedef bool (*Eval_G_CB)( + ipindex n, + ipnumber* x, + bool new_x, + ipindex m, + ipnumber* g, UserDataPtr user_data ); @@ -111,15 +113,15 @@ typedef Bool (*Eval_G_CB)( * * See also Ipopt::TNLP::eval_jac_g. */ -typedef Bool (*Eval_Jac_G_CB)( - Index n, - Number* x, - Bool new_x, - Index m, - Index nele_jac, - Index* iRow, - Index* jCol, - Number* values, +typedef bool (*Eval_Jac_G_CB)( + ipindex n, + ipnumber* x, + bool new_x, + ipindex m, + ipindex nele_jac, + ipindex* iRow, + ipindex* jCol, + ipnumber* values, UserDataPtr user_data ); @@ -129,18 +131,18 @@ typedef Bool (*Eval_Jac_G_CB)( * * See also Ipopt::TNLP::eval_h. */ -typedef Bool (*Eval_H_CB)( - Index n, - Number* x, - Bool new_x, - Number obj_factor, - Index m, - Number* lambda, - Bool new_lambda, - Index nele_hess, - Index* iRow, - Index* jCol, - Number* values, +typedef bool (*Eval_H_CB)( + ipindex n, + ipnumber* x, + bool new_x, + ipnumber obj_factor, + ipindex m, + ipnumber* lambda, + bool new_lambda, + ipindex nele_hess, + ipindex* iRow, + ipindex* jCol, + ipnumber* values, UserDataPtr user_data ); @@ -154,19 +156,19 @@ typedef Bool (*Eval_H_CB)( * * See also Ipopt::TNLP::intermediate_callback. */ -typedef Bool (*Intermediate_CB)( - Index alg_mod, /**< algorithm mode: 0 is regular, 1 is restoration */ - Index iter_count, - Number obj_value, - Number inf_pr, - Number inf_du, - Number mu, - Number d_norm, - Number regularization_size, - Number alpha_du, - Number alpha_pr, - Index ls_trials, - UserDataPtr user_data +typedef bool (*Intermediate_CB)( + ipindex alg_mod, /**< algorithm mode: 0 is regular, 1 is restoration */ + ipindex iter_count,/**< iteration number */ + ipnumber obj_value, /**< objective function value */ + ipnumber inf_pr, /**< primal infeasibility */ + ipnumber inf_du, /**< dual infeasibility */ + ipnumber mu, /**< barrier parameter */ + ipnumber d_norm, /**< infinity-norm of primal step */ + ipnumber regularization_size, /**< size of regularization of Hessian of Lagrangian */ + ipnumber alpha_du, /**< step length for dual variables */ + ipnumber alpha_pr, /**< step length for primal variables */ + ipindex ls_trials, /**< number of backtracking line search steps */ + UserDataPtr user_data /**< user data */ ); /** Function for creating a new Ipopt Problem object. @@ -184,9 +186,9 @@ typedef Bool (*Intermediate_CB)( * * See also Ipopt::TNLP::get_nlp_info and Ipopt::TNLP::get_bounds_info. */ -IPOPTLIB_EXPORT IPOPT_EXPORT(IpoptProblem) CreateIpoptProblem( - Index n, /**< Number of optimization variables */ - Number* x_L, /**< Lower bounds on variables +IPOPTLIB_EXPORT IpoptProblem IPOPT_CALLCONV CreateIpoptProblem( + ipindex n, /**< Number of optimization variables */ + ipnumber* x_L, /**< Lower bounds on variables * * This array of size n is copied internally, so that the * caller can change the incoming data after @@ -194,7 +196,7 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(IpoptProblem) CreateIpoptProblem( * Any value less or equal than the number specified by option * 'nlp_lower_bound_inf' is interpreted to be minus infinity. */ - Number* x_U, /**< Upper bounds on variables + ipnumber* x_U, /**< Upper bounds on variables * * This array of size n is copied internally, * so that the caller can change the incoming data after @@ -202,8 +204,8 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(IpoptProblem) CreateIpoptProblem( * Any value greater or equal than the number specified by option * 'nlp_upper_bound_inf' is interpreted to be plus infinity. */ - Index m, /**< Number of constraints */ - Number* g_L, /**< Lower bounds on constraints + ipindex m, /**< Number of constraints */ + ipnumber* g_L, /**< Lower bounds on constraints * * This array of size m is copied internally, * so that the caller can change the incoming data after @@ -211,7 +213,7 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(IpoptProblem) CreateIpoptProblem( * Any value less or equal than the number specified by option * 'nlp_lower_bound_inf' is interpreted to be minus infinity. */ - Number* g_U, /**< Upper bounds on constraints + ipnumber* g_U, /**< Upper bounds on constraints * * This array of size m is copied internally, * so that the caller can change the incoming data after @@ -219,9 +221,9 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(IpoptProblem) CreateIpoptProblem( * Any value greater or equal than the number specified by option * 'nlp_upper_bound_inf' is interpreted to be plus infinity. */ - Index nele_jac, /**< Number of non-zero elements in constraint Jacobian */ - Index nele_hess, /**< Number of non-zero elements in Hessian of Lagrangian */ - Index index_style, /**< Indexing style for iRow & jCol, 0 for C style, 1 for Fortran style */ + ipindex nele_jac, /**< Number of non-zero elements in constraint Jacobian */ + ipindex nele_hess, /**< Number of non-zero elements in Hessian of Lagrangian */ + ipindex index_style, /**< Indexing style for iRow & jCol, 0 for C style, 1 for Fortran style */ Eval_F_CB eval_f, /**< Callback function for evaluating objective function */ Eval_G_CB eval_g, /**< Callback function for evaluating constraint functions */ Eval_Grad_F_CB eval_grad_f, /**< Callback function for evaluating gradient of objective function */ @@ -233,15 +235,15 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(IpoptProblem) CreateIpoptProblem( * * After freeing an IpoptProblem, it cannot be used anymore. */ -IPOPTLIB_EXPORT IPOPT_EXPORT(void) FreeIpoptProblem( +IPOPTLIB_EXPORT void IPOPT_CALLCONV FreeIpoptProblem( IpoptProblem ipopt_problem ); /** Function for adding a string option. * - * @return FALSE, if the option could not be set (e.g., if keyword is unknown) + * @return false, if the option could not be set (e.g., if keyword is unknown) */ -IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) AddIpoptStrOption( +IPOPTLIB_EXPORT bool IPOPT_CALLCONV AddIpoptStrOption( IpoptProblem ipopt_problem, char* keyword, char* val @@ -249,32 +251,32 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) AddIpoptStrOption( /** Function for adding a Number option. * - * @return FALSE, if the option could not be set (e.g., if keyword is unknown) + * @return false, if the option could not be set (e.g., if keyword is unknown) */ -IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) AddIpoptNumOption( +IPOPTLIB_EXPORT bool IPOPT_CALLCONV AddIpoptNumOption( IpoptProblem ipopt_problem, char* keyword, - Number val + ipnumber val ); -/** Function for adding an Int option. +/** Function for adding an Integer option. * - * @return FALSE, if the option could not be set (e.g., if keyword is unknown) + * @return false, if the option could not be set (e.g., if keyword is unknown) @*/ -IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) AddIpoptIntOption( +IPOPTLIB_EXPORT bool IPOPT_CALLCONV AddIpoptIntOption( IpoptProblem ipopt_problem, char* keyword, - Int val + ipindex val ); /** Function for opening an output file for a given name with given printlevel. * - * @return FALSE, if there was a problem opening the file. + * @return false, if there was a problem opening the file. */ -IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) OpenIpoptOutputFile( +IPOPTLIB_EXPORT bool IPOPT_CALLCONV OpenIpoptOutputFile( IpoptProblem ipopt_problem, char* file_name, - Int print_level + int print_level ); /** Optional function for setting scaling parameter for the NLP. @@ -283,11 +285,11 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) OpenIpoptOutputFile( * If the pointers x_scaling or g_scaling are NULL, then no scaling * for x resp. g is done. */ -IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) SetIpoptProblemScaling( +IPOPTLIB_EXPORT bool IPOPT_CALLCONV SetIpoptProblemScaling( IpoptProblem ipopt_problem, - Number obj_scaling, - Number* x_scaling, - Number* g_scaling + ipnumber obj_scaling, + ipnumber* x_scaling, + ipnumber* g_scaling ); /** Setting a callback function for the "intermediate callback" method in the TNLP. @@ -300,7 +302,7 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) SetIpoptProblemScaling( * method returns false, Ipopt will terminate the optimization. * Calling this set method to set the CB pointer to NULL disables * the intermediate callback functionality. */ -IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) SetIntermediateCallback( +IPOPTLIB_EXPORT bool IPOPT_CALLCONV SetIntermediateCallback( IpoptProblem ipopt_problem, Intermediate_CB intermediate_cb ); @@ -310,22 +312,22 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(Bool) SetIntermediateCallback( * * @return outcome of the optimization procedure (e.g., success, failure etc). */ -IPOPTLIB_EXPORT IPOPT_EXPORT(enum ApplicationReturnStatus) IpoptSolve( +IPOPTLIB_EXPORT enum ApplicationReturnStatus IPOPT_CALLCONV IpoptSolve( IpoptProblem ipopt_problem, /**< Problem that is to be optimized. * * Ipopt will use the options previously specified with * AddIpoptOption (etc) for this problem. */ - Number* x, /**< Input: Starting point; Output: Optimal solution */ - Number* g, /**< Values of constraint at final point (output only; ignored if set to NULL) */ - Number* obj_val, /**< Final value of objective function (output only; ignored if set to NULL) */ - Number* mult_g, /**< Input: Initial values for the constraint multipliers (only if warm start option is chosen); + ipnumber* x, /**< Input: Starting point; Output: Optimal solution */ + ipnumber* g, /**< Values of constraint at final point (output only; ignored if set to NULL) */ + ipnumber* obj_val, /**< Final value of objective function (output only; ignored if set to NULL) */ + ipnumber* mult_g, /**< Input: Initial values for the constraint multipliers (only if warm start option is chosen); * Output: Final multipliers for constraints (ignored if set to NULL) */ - Number* mult_x_L, /**< Input: Initial values for the multipliers for lower variable bounds (only if warm start option is chosen); + ipnumber* mult_x_L, /**< Input: Initial values for the multipliers for lower variable bounds (only if warm start option is chosen); * Output: Final multipliers for lower variable bounds (ignored if set to NULL) */ - Number* mult_x_U, /**< Input: Initial values for the multipliers for upper variable bounds (only if warm start option is chosen); + ipnumber* mult_x_U, /**< Input: Initial values for the multipliers for upper variable bounds (only if warm start option is chosen); * Output: Final multipliers for upper variable bounds (ignored if set to NULL) */ UserDataPtr user_data /**< Pointer to user data. @@ -334,6 +336,91 @@ IPOPTLIB_EXPORT IPOPT_EXPORT(enum ApplicationReturnStatus) IpoptSolve( */ ); +/** Get primal and dual variable values of the current iterate. + * + * This method can be used to get the values of the current iterate during the intermediate callback set by SetIntermediateCallback(). + * The method expects the number of variables (dimension of x), number of constraints (dimension of g(x)), + * and allocated arrays of appropriate lengths as input. + * + * The method translates the x(), c(), d(), y_c(), y_d(), z_L(), and z_U() vectors from Ipopt::IpoptData::curr() + * of the internal NLP representation into the form used by the TNLP. + * For the correspondence between scaled and unscaled solutions, see the detailed description of Ipopt::OrigIpoptNLP. + * If %Ipopt is in restoration mode, it maps the current iterate of restoration %NLP (see Ipopt::RestoIpoptNLP) back to the original TNLP. + * + * If there are fixed variables and fixed_variable_treatment=make_parameter, then requesting z_L and z_U can trigger a reevaluation of + * the Gradient of the objective function and the Jacobian of the constraint functions. + * + * @param ipopt_problem (in) Problem that is currently optimized. + * @param n (in) the number of variables \f$x\f$ in the problem; can be arbitrary if skipping x, z_L, and z_U + * @param scaled (in) whether to retrieve scaled or unscaled iterate + * @param x (out) buffer to store value of primal variables \f$x\f$, must have length at least n; pass NULL to skip retrieving x + * @param z_L (out) buffer to store the lower bound multipliers \f$z_L\f$, must have length at least n; pass NULL to skip retrieving z_L and Z_U + * @param z_U (out) buffer to store the upper bound multipliers \f$z_U\f$, must have length at least n; pass NULL to skip retrieving z_L and Z_U + * @param m (in) the number of constraints \f$g(x)\f$; can be arbitrary if skipping g and lambda + * @param g (out) buffer to store the constraint values \f$g(x)\f$, must have length at least m; pass NULL to skip retrieving g + * @param lambda (out) buffer to store the constraint multipliers \f$\lambda\f$, must have length at least m; pass NULL to skip retrieving lambda + * + * @return Whether Ipopt has successfully filled the given arrays + * @since 3.14.0 + */ +IPOPTLIB_EXPORT bool IPOPT_CALLCONV GetIpoptCurrentIterate( + IpoptProblem ipopt_problem, + bool scaled, + ipindex n, + ipnumber* x, + ipnumber* z_L, + ipnumber* z_U, + ipindex m, + ipnumber* g, + ipnumber* lambda +); + +/** Get primal and dual infeasibility of the current iterate. + * + * This method can be used to get the violations of constraints and optimality conditions + * at the current iterate during the intermediate callback set by SetIntermediateCallback(). + * The method expects the number of variables (dimension of x), number of constraints (dimension of g(x)), + * and allocated arrays of appropriate lengths as input. + * + * The method makes the vectors behind (unscaled_)curr_orig_bounds_violation(), (unscaled_)curr_nlp_constraint_violation(), (unscaled_)curr_dual_infeasibility(), + * (unscaled_)curr_complementarity() from Ipopt::IpoptCalculatedQuantities of the internal NLP representation available into the form used by the TNLP. + * If %Ipopt is in restoration mode, it maps the current iterate of restoration %NLP (see Ipopt::RestoIpoptNLP) back to the original TNLP. + * + * @note If in restoration phase, then requesting grad_lag_x can trigger a call to Eval_F_CB. + * + * @note Ipopt by default relaxes variable bounds (option bound_relax_factor > 0.0). + * x_L_violation and x_U_violation report the violation of a solution w.r.t. the original unrelaxed bounds. + * However, compl_x_L and compl_x_U use the relaxed variable bounds to calculate the complementarity. + * + * @param ipopt_problem (in) Problem that is currently optimized. + * @param scaled (in) whether to retrieve scaled or unscaled violations + * @param n (in) the number of variables \f$x\f$ in the problem; can be arbitrary if skipping compl_x_L, compl_x_U, and grad_lag_x + * @param x_L_violation (out) buffer to store violation of original lower bounds on variables (max(orig_x_L-x,0)), must have length at least n; pass NULL to skip retrieving orig_x_L + * @param x_U_violation (out) buffer to store violation of original upper bounds on variables (max(x-orig_x_U,0)), must have length at least n; pass NULL to skip retrieving orig_x_U + * @param compl_x_L (out) buffer to store violation of complementarity for lower bounds on variables (\f$(x-x_L)z_L\f$), must have length at least n; pass NULL to skip retrieving compl_x_L + * @param compl_x_U (out) buffer to store violation of complementarity for upper bounds on variables (\f$(x_U-x)z_U\f$), must have length at least n; pass NULL to skip retrieving compl_x_U + * @param grad_lag_x (out) buffer to store gradient of Lagrangian w.r.t. variables \f$x\f$, must have length at least n; pass NULL to skip retrieving grad_lag_x + * @param m (in) the number of constraints \f$g(x)\f$; can be arbitrary if skipping lambda + * @param nlp_constraint_violation (out) buffer to store violation of constraints \f$max(g_l-g(x),g(x)-g_u,0)\f$, must have length at least m; pass NULL to skip retrieving constraint_violation + * @param compl_g (out) buffer to store violation of complementarity of constraint (\f$(g(x)-g_l)*\lambda^+ + (g_l-g(x))*\lambda^-\f$, where \f$\lambda^+=max(0,\lambda)\f$ and \f$\lambda^-=max(0,-\lambda)\f$ (componentwise)), must have length at least m; pass NULL to skip retrieving compl_g + * + * @return Whether Ipopt has successfully filled the given arrays + * @since 3.14.0 + */ +IPOPTLIB_EXPORT bool IPOPT_CALLCONV GetIpoptCurrentViolations( + IpoptProblem ipopt_problem, + bool scaled, + ipindex n, + ipnumber* x_L_violation, + ipnumber* x_U_violation, + ipnumber* compl_x_L, + ipnumber* compl_x_U, + ipnumber* grad_lag_x, + ipindex m, + ipnumber* nlp_constraint_violation, + ipnumber* compl_g +); + #ifdef __cplusplus } /* extern "C" { */ #endif diff --git a/src/Interfaces/IpStdFInterface.c b/src/Interfaces/IpStdFInterface.c index 58c5c4139..65d3a48ee 100644 --- a/src/Interfaces/IpStdFInterface.c +++ b/src/Interfaces/IpStdFInterface.c @@ -7,6 +7,7 @@ #include "IpStdCInterface.h" #include "IpoptConfig.h" +#include "IpTypes.h" #include #include #include @@ -16,9 +17,6 @@ #define F77_FUNC(name,NAME) name ## _ #endif -/* ToDo: The following needs to be adapted based on configuration */ -typedef IPOPT_FORTRAN_INTEGER_TYPE fint; -typedef double fdouble; /* in configure, we checked whether an int* is 32 or 64bit long to decide how much space * is needed to store a pointer * thus, we can use a void* here to represent a pointer for Fortran @@ -26,96 +24,96 @@ typedef double fdouble; typedef void* fptr; /** Return value for indicating that evaluation could be done without problem. */ -static const fint OKRetVal = 0; +static const ipindex OKRetVal = 0; /** Return value for indicating that evaluation could not be done without problem. */ -static const fint NotOKRetVal = 1; +static const ipindex NotOKRetVal = 1; /* Function pointer types for the Fortran callback functions */ typedef void (*FEval_F_CB)( - fint* N, - fdouble* X, - fint* NEW_X, - fdouble* OBJVAL, - fint* IDAT, - fdouble* DDAT, - fint* IERR + ipindex* N, + ipnumber* X, + ipindex* NEW_X, + ipnumber* OBJVAL, + ipindex* IDAT, + ipnumber* DDAT, + ipindex* IERR ); typedef void (*FEval_G_CB)( - fint* N, - fdouble* X, - fint* NEW_X, - fint* M, - fdouble* G, - fint* IDAT, - fdouble* DDAT, - fint* IERR + ipindex* N, + ipnumber* X, + ipindex* NEW_X, + ipindex* M, + ipnumber* G, + ipindex* IDAT, + ipnumber* DDAT, + ipindex* IERR ); typedef void (*FEval_Grad_F_CB)( - fint* N, - fdouble* X, - fint* NEW_X, - fdouble* GRAD, - fint* IDAT, - fdouble* DDAT, - fint* IERR + ipindex* N, + ipnumber* X, + ipindex* NEW_X, + ipnumber* GRAD, + ipindex* IDAT, + ipnumber* DDAT, + ipindex* IERR ); typedef void (*FEval_Jac_G_CB)( - fint* TASK, - fint* N, - fdouble* X, - fint* NEW_X, - fint* M, - fint* NNZJAC, - fint* IROW, - fint* JCOL, - fdouble* VALUES, - fint* IDAT, - fdouble* DDAT, - fint* IERR + ipindex* TASK, + ipindex* N, + ipnumber* X, + ipindex* NEW_X, + ipindex* M, + ipindex* NNZJAC, + ipindex* IROW, + ipindex* JCOL, + ipnumber* VALUES, + ipindex* IDAT, + ipnumber* DDAT, + ipindex* IERR ); typedef void (*FEval_Hess_CB)( - fint* TASK, - fint* N, - fdouble* X, - fint* NEW_X, - fdouble* OBJFACT, - fint* M, - fdouble* LAMBDA, - fint* NEW_LAM, - fint* NNZHESS, - fint* IROW, - fint* JCOL, - fdouble* VALUES, - fint* IDAT, - fdouble* DDAT, - fint* IERR + ipindex* TASK, + ipindex* N, + ipnumber* X, + ipindex* NEW_X, + ipnumber* OBJFACT, + ipindex* M, + ipnumber* LAMBDA, + ipindex* NEW_LAM, + ipindex* NNZHESS, + ipindex* IROW, + ipindex* JCOL, + ipnumber* VALUES, + ipindex* IDAT, + ipnumber* DDAT, + ipindex* IERR ); typedef void (*FIntermediate_CB)( - fint* ALG_MODE, - fint* ITER_COUNT, - fdouble* OBJVAL, - fdouble* INF_PR, - fdouble* INF_DU, - fdouble* MU, - fdouble* DNORM, - fdouble* REGU_SIZE, - fdouble* ALPHA_DU, - fdouble* ALPHA_PR, - fint* LS_TRIAL, - fint* IDAT, - fdouble* DDAT, - fint* ISTOP + ipindex* ALG_MODE, + ipindex* ITER_COUNT, + ipnumber* OBJVAL, + ipnumber* INF_PR, + ipnumber* INF_DU, + ipnumber* MU, + ipnumber* DNORM, + ipnumber* REGU_SIZE, + ipnumber* ALPHA_DU, + ipnumber* ALPHA_PR, + ipindex* LS_TRIAL, + ipindex* IDAT, + ipnumber* DDAT, + ipindex* ISTOP ); struct _FUserData { - fint* IDAT; - fdouble* DDAT; + ipindex* IDAT; + ipnumber* DDAT; FEval_F_CB EVAL_F; FEval_G_CB EVAL_G; FEval_Grad_F_CB EVAL_GRAD_F; @@ -124,92 +122,91 @@ struct _FUserData FIntermediate_CB INTERMEDIATE_CB; IpoptProblem Problem; }; - typedef struct _FUserData FUserData; -static Bool eval_f( - Index n, - Number* x, - Bool new_x, - Number* obj_value, +static bool eval_f( + ipindex n, + ipnumber* x, + bool new_x, + ipnumber* obj_value, UserDataPtr user_data ) { - fint N = n; - fint NEW_X = new_x; + ipindex N = n; + ipindex NEW_X = new_x; FUserData* fuser_data = (FUserData*) user_data; - fint* IDAT = fuser_data->IDAT; - fdouble* DDAT = fuser_data->DDAT; - fint IERR = 0; + ipindex* IDAT = fuser_data->IDAT; + ipnumber* DDAT = fuser_data->DDAT; + ipindex IERR = 0; fuser_data->EVAL_F(&N, x, &NEW_X, obj_value, IDAT, DDAT, &IERR); - return (Bool) (IERR == OKRetVal); + return IERR == OKRetVal; } -static Bool eval_grad_f( - Index n, - Number* x, - Bool new_x, - Number* grad_f, +static bool eval_grad_f( + ipindex n, + ipnumber* x, + bool new_x, + ipnumber* grad_f, UserDataPtr user_data ) { - fint N = n; - fint NEW_X = new_x; + ipindex N = n; + ipindex NEW_X = new_x; FUserData* fuser_data = (FUserData*) user_data; - fint* IDAT = fuser_data->IDAT; - fdouble* DDAT = fuser_data->DDAT; - fint IERR = 0; + ipindex* IDAT = fuser_data->IDAT; + ipnumber* DDAT = fuser_data->DDAT; + ipindex IERR = 0; fuser_data->EVAL_GRAD_F(&N, x, &NEW_X, grad_f, IDAT, DDAT, &IERR); - return (Bool) (IERR == OKRetVal); + return IERR == OKRetVal; } -static Bool eval_g( - Index n, - Number* x, - Bool new_x, - Index m, - Number* g, +static bool eval_g( + ipindex n, + ipnumber* x, + bool new_x, + ipindex m, + ipnumber* g, UserDataPtr user_data ) { - fint N = n; - fint NEW_X = new_x; - fint M = m; + ipindex N = n; + ipindex NEW_X = new_x; + ipindex M = m; FUserData* fuser_data = (FUserData*) user_data; - fint* IDAT = fuser_data->IDAT; - fdouble* DDAT = fuser_data->DDAT; - fint IERR = 0; + ipindex* IDAT = fuser_data->IDAT; + ipnumber* DDAT = fuser_data->DDAT; + ipindex IERR = 0; fuser_data->EVAL_G(&N, x, &NEW_X, &M, g, IDAT, DDAT, &IERR); - return (Bool) (IERR == OKRetVal); + return IERR == OKRetVal; } -static Bool eval_jac_g( - Index n, - Number* x, - Bool new_x, - Index m, - Index nele_jac, - Index* iRow, - Index* jCol, - Number* values, +static bool eval_jac_g( + ipindex n, + ipnumber* x, + bool new_x, + ipindex m, + ipindex nele_jac, + ipindex* iRow, + ipindex* jCol, + ipnumber* values, UserDataPtr user_data ) { - fint N = n; - fint NEW_X = new_x; - fint M = m; - fint NNZJAC = nele_jac; - fint TASK; + ipindex N = n; + ipindex NEW_X = new_x; + ipindex M = m; + ipindex NNZJAC = nele_jac; + ipindex TASK; FUserData* fuser_data = (FUserData*) user_data; - fint* IDAT = fuser_data->IDAT; - fdouble* DDAT = fuser_data->DDAT; - fint IERR = 0; + ipindex* IDAT = fuser_data->IDAT; + ipnumber* DDAT = fuser_data->DDAT; + ipindex IERR = 0; if( iRow != NULL && jCol != NULL && values == NULL ) { @@ -224,39 +221,39 @@ static Bool eval_jac_g( else { printf("Error in IpStdFInterface eval_jac_g!\n"); - return (Bool) 0; + return false; } fuser_data->EVAL_JAC_G(&TASK, &N, x, &NEW_X, &M, &NNZJAC, iRow, jCol, values, IDAT, DDAT, &IERR); - return (Bool) (IERR == OKRetVal); + return IERR == OKRetVal; } -static Bool eval_h( - Index n, - Number* x, - Bool new_x, - Number obj_factor, - Index m, - Number* lambda, - Bool new_lambda, - Index nele_hess, - Index* iRow, - Index* jCol, - Number* values, +static bool eval_h( + ipindex n, + ipnumber* x, + bool new_x, + ipnumber obj_factor, + ipindex m, + ipnumber* lambda, + bool new_lambda, + ipindex nele_hess, + ipindex* iRow, + ipindex* jCol, + ipnumber* values, UserDataPtr user_data ) { - fint N = n; - fint NEW_X = new_x; - fint M = m; - fint NEW_LAM = new_lambda; - fint NNZHESS = nele_hess; - fint TASK; + ipindex N = n; + ipindex NEW_X = new_x; + ipindex M = m; + ipindex NEW_LAM = new_lambda; + ipindex NNZHESS = nele_hess; + ipindex TASK; FUserData* fuser_data = (FUserData*) user_data; - fint* IDAT = fuser_data->IDAT; - fdouble* DDAT = fuser_data->DDAT; - fint IERR = 0; + ipindex* IDAT = fuser_data->IDAT; + ipnumber* DDAT = fuser_data->DDAT; + ipindex IERR = 0; if( iRow != NULL && jCol != NULL && values == NULL ) { @@ -271,66 +268,66 @@ static Bool eval_h( else { printf("Error in IpStdFInterface eval_hess!\n"); - return (Bool) 0; + return false; } fuser_data->EVAL_HESS(&TASK, &N, x, &NEW_X, &obj_factor, &M, lambda, &NEW_LAM, &NNZHESS, iRow, jCol, values, IDAT, DDAT, &IERR); - return (Bool) (IERR == OKRetVal); + return IERR == OKRetVal; } -static Bool intermediate_cb( - Index alg_mod, - Index iter_count, - Number obj_value, - Number inf_pr, - Number inf_du, - Number mu, - Number d_norm, - Number regularization_size, - Number alpha_du, - Number alpha_pr, - Index ls_trials, +static bool intermediate_cb( + ipindex alg_mod, + ipindex iter_count, + ipnumber obj_value, + ipnumber inf_pr, + ipnumber inf_du, + ipnumber mu, + ipnumber d_norm, + ipnumber regularization_size, + ipnumber alpha_du, + ipnumber alpha_pr, + ipindex ls_trials, UserDataPtr user_data ) { FUserData* fuser_data = (FUserData*) user_data; - fint ALG_MODE = alg_mod; - fint ITER_COUNT = iter_count; - fdouble OBJVAL = obj_value; - fdouble INF_PR = inf_pr; - fdouble INF_DU = inf_du; - fdouble MU = mu; - fdouble DNORM = d_norm; - fdouble REGU_SIZE = regularization_size; - fdouble ALPHA_DU = alpha_du; - fdouble ALPHA_PR = alpha_pr; - fint LS_TRIAL = ls_trials; - fint* IDAT = fuser_data->IDAT; - fdouble* DDAT = fuser_data->DDAT; - fint ISTOP = 0; + ipindex ALG_MODE = alg_mod; + ipindex ITER_COUNT = iter_count; + ipnumber OBJVAL = obj_value; + ipnumber INF_PR = inf_pr; + ipnumber INF_DU = inf_du; + ipnumber MU = mu; + ipnumber DNORM = d_norm; + ipnumber REGU_SIZE = regularization_size; + ipnumber ALPHA_DU = alpha_du; + ipnumber ALPHA_PR = alpha_pr; + ipindex LS_TRIAL = ls_trials; + ipindex* IDAT = fuser_data->IDAT; + ipnumber* DDAT = fuser_data->DDAT; + ipindex ISTOP = 0; if( !fuser_data->INTERMEDIATE_CB ) { - return (Bool) TRUE; + return true; } fuser_data->INTERMEDIATE_CB(&ALG_MODE, &ITER_COUNT, &OBJVAL, &INF_PR, &INF_DU, &MU, &DNORM, ®U_SIZE, &ALPHA_DU, &ALPHA_PR, &LS_TRIAL, IDAT, DDAT, &ISTOP); - return (Bool) (ISTOP == OKRetVal); + return ISTOP == OKRetVal; } IPOPTLIB_EXPORT fptr F77_FUNC(ipcreate, IPCREATE)( - fint* N, - fdouble* X_L, - fdouble* X_U, - fint* M, - fdouble* G_L, - fdouble* G_U, - fint* NELE_JAC, - fint* NELE_HESS, - fint* IDX_STY, + ipindex* N, + ipnumber* X_L, + ipnumber* X_U, + ipindex* M, + ipnumber* G_L, + ipnumber* G_U, + ipindex* NELE_JAC, + ipindex* NELE_HESS, + ipindex* IDX_STY, FEval_F_CB EVAL_F, FEval_G_CB EVAL_G, FEval_Grad_F_CB EVAL_GRAD_F, @@ -338,11 +335,11 @@ IPOPTLIB_EXPORT fptr F77_FUNC(ipcreate, IPCREATE)( FEval_Hess_CB EVAL_HESS ) { - Index n = *N; - Index m = *M; - Index nele_jac = *NELE_JAC; - Index nele_hess = *NELE_HESS; - Index index_style = *IDX_STY; + ipindex n = *N; + ipindex m = *M; + ipindex nele_jac = *NELE_JAC; + ipindex nele_hess = *NELE_HESS; + ipindex index_style = *IDX_STY; FUserData* fuser_data; @@ -380,16 +377,16 @@ IPOPTLIB_EXPORT void F77_FUNC(ipfree, IPFREE)( *FProblem = (fptr)NULL; } -IPOPTLIB_EXPORT fint F77_FUNC(ipsolve, IPSOLVE)( - fptr* FProblem, - fdouble* X, - fdouble* G, - fdouble* OBJ_VAL, - fdouble* MULT_G, - fdouble* MULT_X_L, - fdouble* MULT_X_U, - fint* IDAT, - fdouble* DDAT +IPOPTLIB_EXPORT ipindex F77_FUNC(ipsolve, IPSOLVE)( + fptr* FProblem, + ipnumber* X, + ipnumber* G, + ipnumber* OBJ_VAL, + ipnumber* MULT_G, + ipnumber* MULT_X_L, + ipnumber* MULT_X_U, + ipindex* IDAT, + ipnumber* DDAT ) { FUserData* fuser_data = (FUserData*) *FProblem; @@ -399,7 +396,7 @@ IPOPTLIB_EXPORT fint F77_FUNC(ipsolve, IPSOLVE)( fuser_data->DDAT = DDAT; user_data = (UserDataPtr) fuser_data; - return (fint)IpoptSolve(fuser_data->Problem, X, G, OBJ_VAL, MULT_G, MULT_X_L, MULT_X_U, user_data); + return IpoptSolve(fuser_data->Problem, X, G, OBJ_VAL, MULT_G, MULT_X_L, MULT_X_U, user_data); } static char* f2cstr( @@ -417,14 +414,17 @@ static char* f2cstr( } } cstr = (char*) malloc(sizeof(char) * (len + 1)); - strncpy(cstr, FSTR, len); - cstr[len] = '\0'; + if( cstr != NULL ) + { + strncpy(cstr, FSTR, len); + cstr[len] = '\0'; + } return cstr; } /* ToDo make sure position of vlen and klen are at the right place */ -IPOPTLIB_EXPORT fint F77_FUNC(ipaddstroption, IPADDSTROPTION)( +IPOPTLIB_EXPORT ipindex F77_FUNC(ipaddstroption, IPADDSTROPTION)( fptr* FProblem, char* KEYWORD, char* VALUE, @@ -435,7 +435,7 @@ IPOPTLIB_EXPORT fint F77_FUNC(ipaddstroption, IPADDSTROPTION)( char* keyword; char* val; FUserData* fuser_data = (FUserData*) *FProblem; - fint retval; + ipindex retval; keyword = f2cstr(KEYWORD, klen); val = f2cstr(VALUE, vlen); @@ -448,16 +448,16 @@ IPOPTLIB_EXPORT fint F77_FUNC(ipaddstroption, IPADDSTROPTION)( return retval ? OKRetVal : NotOKRetVal; } -IPOPTLIB_EXPORT fint F77_FUNC(ipaddnumoption, IPADDNUMOPTION)( - fptr* FProblem, - char* KEYWORD, - fdouble* VALUE, - int klen +IPOPTLIB_EXPORT ipindex F77_FUNC(ipaddnumoption, IPADDNUMOPTION)( + fptr* FProblem, + char* KEYWORD, + ipnumber* VALUE, + int klen ) { char* keyword; FUserData* fuser_data = (FUserData*) *FProblem; - fint retval; + ipindex retval; keyword = f2cstr(KEYWORD, klen); @@ -468,17 +468,17 @@ IPOPTLIB_EXPORT fint F77_FUNC(ipaddnumoption, IPADDNUMOPTION)( return retval ? OKRetVal : NotOKRetVal; } -IPOPTLIB_EXPORT fint F77_FUNC(ipaddintoption, IPADDINTOPTION)( - fptr* FProblem, - char* KEYWORD, - fint* VALUE, - int klen +IPOPTLIB_EXPORT ipindex F77_FUNC(ipaddintoption, IPADDINTOPTION)( + fptr* FProblem, + char* KEYWORD, + ipindex* VALUE, + int klen ) { char* keyword; FUserData* fuser_data = (FUserData*) *FProblem; - Int value = *VALUE; - fint retval; + ipindex value = *VALUE; + ipindex retval; keyword = f2cstr(KEYWORD, klen); @@ -489,17 +489,17 @@ IPOPTLIB_EXPORT fint F77_FUNC(ipaddintoption, IPADDINTOPTION)( return retval ? OKRetVal : NotOKRetVal; } -IPOPTLIB_EXPORT fint F77_FUNC(ipopenoutputfile, IPOPENOUTPUTFILE)( - fptr* FProblem, - char* FILENAME, - fint* PRINTLEVEL, - int flen +IPOPTLIB_EXPORT ipindex F77_FUNC(ipopenoutputfile, IPOPENOUTPUTFILE)( + fptr* FProblem, + char* FILENAME, + ipindex* PRINTLEVEL, + int flen ) { char* filename; FUserData* fuser_data = (FUserData*) *FProblem; - Int printlevel = *PRINTLEVEL; - fint retval; + int printlevel = *PRINTLEVEL; + ipindex retval; filename = f2cstr(FILENAME, flen); @@ -511,7 +511,7 @@ IPOPTLIB_EXPORT fint F77_FUNC(ipopenoutputfile, IPOPENOUTPUTFILE)( } IPOPTLIB_EXPORT void F77_FUNC(ipsetcallback, IPSETCALLBACK)( - fptr* FProblem, + fptr* FProblem, FIntermediate_CB inter_cb ) { @@ -528,3 +528,69 @@ IPOPTLIB_EXPORT void F77_FUNC(ipunsetcallback, IPUNSETCALLBACK)( fuser_data->INTERMEDIATE_CB = NULL; SetIntermediateCallback(fuser_data->Problem, NULL); } + +/// @since 3.14.0 +IPOPTLIB_EXPORT ipindex F77_FUNC(ipgetcurriterate, IPGETCURRITERATE)( + fptr* FProblem, + ipindex* scaled, + ipindex* get_X, + ipindex* get_Z, + ipindex* get_G, + ipindex* get_LAMBDA, + ipindex* n, + ipnumber* X, + ipnumber* Z_L, + ipnumber* Z_U, + ipindex* m, + ipnumber* G, + ipnumber* LAMBDA +) +{ + FUserData* fuser_data = (FUserData*) *FProblem; + return GetIpoptCurrentIterate(fuser_data->Problem, *scaled != 0, + *n, *get_X ? X : NULL, *get_Z ? Z_L : NULL, *get_Z ? Z_U : NULL, + *m, *get_G ? G : NULL, *get_LAMBDA ? LAMBDA : NULL) ? OKRetVal : NotOKRetVal; +} + +/// @since 3.14.0 +IPOPTLIB_EXPORT ipindex F77_FUNC(ipgetcurrviolations, IPGETCURRVIOLATIONS)( + fptr* FProblem, + ipindex* scaled, + ipindex* get_bound_violation, + ipindex* get_compl, + ipindex* get_grad_lag_x, + ipindex* get_nlp_constraint_violation, + ipindex* n, + ipnumber* X_L_VIOLATION, + ipnumber* X_U_VIOLATION, + ipnumber* COMPL_X_L, + ipnumber* COMPL_X_U, + ipnumber* GRAD_LAG_X, + ipindex* m, + ipnumber* NLP_CONSTRAINT_VIOLATION, + ipnumber* COMPL_G +) +{ + FUserData* fuser_data = (FUserData*) *FProblem; + return GetIpoptCurrentViolations(fuser_data->Problem, *scaled != 0, + *n, + *get_bound_violation ? X_L_VIOLATION : NULL, *get_bound_violation ? X_U_VIOLATION : NULL, + *get_compl ? COMPL_X_L : NULL, *get_compl ? COMPL_X_U : NULL, + *get_grad_lag_x ? GRAD_LAG_X : NULL, + *m, + *get_nlp_constraint_violation ? NLP_CONSTRAINT_VIOLATION : NULL, + *get_compl ? COMPL_G : NULL) + ? OKRetVal : NotOKRetVal; +} + +/// @since 3.14.7 +IPOPTLIB_EXPORT ipindex F77_FUNC(ipsetproblemscaling, IPSETPROBLEMSCALING)( + fptr* FProblem, + ipnumber* obj_scaling, + ipnumber* X_SCALING, + ipnumber* G_SCALING +) +{ + FUserData* fuser_data = (FUserData*) *FProblem; + return SetIpoptProblemScaling(fuser_data->Problem, *obj_scaling, X_SCALING, G_SCALING) ? OKRetVal : NotOKRetVal; +} diff --git a/src/Interfaces/IpStdInterfaceTNLP.cpp b/src/Interfaces/IpStdInterfaceTNLP.cpp index 2f9f0bac3..c503246ed 100644 --- a/src/Interfaces/IpStdInterfaceTNLP.cpp +++ b/src/Interfaces/IpStdInterfaceTNLP.cpp @@ -7,8 +7,6 @@ #include "IpStdInterfaceTNLP.hpp" #include "IpBlas.hpp" -/// @todo use more memcpy - namespace Ipopt { @@ -73,7 +71,9 @@ StdInterfaceTNLP::StdInterfaceTNLP( z_U_sol_(z_U_sol), g_sol_(g_sol), lambda_sol_(lam_sol), - obj_sol_(obj_sol) + obj_sol_(obj_sol), + ip_data_(NULL), + ip_cq_(NULL) { ASSERT_EXCEPTION(n_var_ > 0, INVALID_STDINTERFACE_NLP, "The number of variables must be at least 1."); ASSERT_EXCEPTION(n_con_ >= 0, INVALID_STDINTERFACE_NLP, "The number of constrains must be non-negative."); @@ -94,19 +94,13 @@ StdInterfaceTNLP::StdInterfaceTNLP( if( x_scaling != NULL ) { Number* tmp = new Number[n_var_]; - for( Index i = 0; i < n_var_; i++ ) - { - tmp[i] = x_scaling[i]; - } + Ipopt::IpBlasCopy(n_var_, x_scaling, 1, tmp, 1); x_scaling_ = tmp; } if( g_scaling ) { Number* tmp = new Number[n_con_]; - for( Index i = 0; i < n_con_; i++ ) - { - tmp[i] = g_scaling[i]; - } + Ipopt::IpBlasCopy(n_con_, g_scaling, 1, tmp, 1); g_scaling_ = tmp; } } @@ -148,17 +142,11 @@ bool StdInterfaceTNLP::get_bounds_info( DBG_ASSERT(n == n_var_); DBG_ASSERT(m == n_con_); - for( Index i = 0; i < n; i++ ) - { - x_l[i] = x_L_[i]; - x_u[i] = x_U_[i]; - } + Ipopt::IpBlasCopy(n, x_L_, 1, x_l, 1); + Ipopt::IpBlasCopy(n, x_U_, 1, x_u, 1); - for( Index i = 0; i < m; i++ ) - { - g_l[i] = g_L_[i]; - g_u[i] = g_U_[i]; - } + Ipopt::IpBlasCopy(m, g_L_, 1, g_l, 1); + Ipopt::IpBlasCopy(m, g_U_, 1, g_u, 1); return true; } @@ -182,10 +170,7 @@ bool StdInterfaceTNLP::get_scaling_parameters( if( x_scaling_ != NULL ) { use_x_scaling = true; - for( Index i = 0; i < n_var_; i++ ) - { - x_scaling[i] = x_scaling_[i]; - } + Ipopt::IpBlasCopy(n_var_, x_scaling_, 1, x_scaling, 1); } else { @@ -195,10 +180,7 @@ bool StdInterfaceTNLP::get_scaling_parameters( if( g_scaling_ != NULL ) { use_g_scaling = true; - for( Index i = 0; i < n_con_; i++ ) - { - g_scaling[i] = g_scaling_[i]; - } + Ipopt::IpBlasCopy(n_con_, g_scaling_, 1, g_scaling, 1); } else { @@ -226,10 +208,9 @@ bool StdInterfaceTNLP::get_starting_point( DBG_ASSERT(m == n_con_); if( init_x ) - for( Index i = 0; i < n; ++i ) - { - x[i] = start_x_[i]; - } + { + Ipopt::IpBlasCopy(n, start_x_, 1, x, 1); + } if( init_z ) { @@ -238,20 +219,18 @@ bool StdInterfaceTNLP::get_starting_point( retval = false; } else - for( Index i = 0; i < n; i++ ) - { - z_L[i] = start_z_L_[i]; - } + { + Ipopt::IpBlasCopy(n, start_z_L_, 1, z_L, 1); + } if( start_z_U_ == NULL ) { retval = false; } else - for( Index i = 0; i < n; i++ ) - { - z_U[i] = start_z_U_[i]; - } + { + Ipopt::IpBlasCopy(n, start_z_U_, 1, z_U, 1); + } } if( init_lambda ) @@ -261,10 +240,9 @@ bool StdInterfaceTNLP::get_starting_point( retval = false; } else - for( Index i = 0; i < m; i++ ) - { - lambda[i] = start_lam_[i]; - } + { + Ipopt::IpBlasCopy(m, start_lam_, 1, lambda, 1); + } } return retval; @@ -365,10 +343,9 @@ bool StdInterfaceTNLP::eval_h( Number* non_const_lambda = new Number[m]; if( lambda ) - for( Index i = 0; i < m; i++ ) - { - non_const_lambda[i] = lambda[i]; - } + { + Ipopt::IpBlasCopy(m, lambda, 1, non_const_lambda, 1); + } Bool retval = (*eval_h_)(n, non_const_x_, (Bool) new_x, obj_factor, m, non_const_lambda, (Bool) new_lambda, nele_hess, iRow, jCol, values, user_data_); @@ -389,15 +366,25 @@ bool StdInterfaceTNLP::intermediate_callback( Number alpha_du, Number alpha_pr, Index ls_trials, - const IpoptData* /*ip_data*/, - IpoptCalculatedQuantities* /*ip_cq*/ + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq ) { - Bool retval = 1; + if( !intermediate_cb_ ) + { + return true; + } - if( intermediate_cb_ ) - retval = (*intermediate_cb_)((Index) mode, iter, obj_value, inf_pr, inf_du, mu, d_norm, regularization_size, - alpha_du, alpha_pr, ls_trials, user_data_); + ip_data_ = ip_data; + ip_cq_ = ip_cq; + + Bool retval = (*intermediate_cb_)((Index) mode, iter, obj_value, inf_pr, inf_du, mu, d_norm, regularization_size, + alpha_du, alpha_pr, ls_trials, user_data_); + + // cppcheck-suppress redundantAssignment + ip_data_ = NULL; + // cppcheck-suppress redundantAssignment + ip_cq_ = NULL; return (retval != 0); } @@ -418,27 +405,27 @@ void StdInterfaceTNLP::finalize_solution( { if( x_sol_ != NULL ) { - IpBlasDcopy(n, x, 1, x_sol_, 1); + IpBlasCopy(n, x, 1, x_sol_, 1); } if( z_L_sol_ != NULL ) { - IpBlasDcopy(n, z_L, 1, z_L_sol_, 1); + IpBlasCopy(n, z_L, 1, z_L_sol_, 1); } if( z_U_sol_ != NULL ) { - IpBlasDcopy(n, z_U, 1, z_U_sol_, 1); + IpBlasCopy(n, z_U, 1, z_U_sol_, 1); } if( g_sol_ != NULL ) { - IpBlasDcopy(m, g, 1, g_sol_, 1); + IpBlasCopy(m, g, 1, g_sol_, 1); } if( lambda_sol_ != NULL ) { - IpBlasDcopy(m, lambda, 1, lambda_sol_, 1); + IpBlasCopy(m, lambda, 1, lambda_sol_, 1); } if( obj_sol_ != NULL ) @@ -460,15 +447,12 @@ void StdInterfaceTNLP::apply_new_x( DBG_ASSERT(x != NULL); //copy the data to the non_const_x_ - if( !non_const_x_ ) + if( non_const_x_ == NULL ) { non_const_x_ = new Number[n]; } - for( Index i = 0; i < n; i++ ) - { - non_const_x_[i] = x[i]; - } + Ipopt::IpBlasCopy(n, x, 1, non_const_x_, 1); } } diff --git a/src/Interfaces/IpStdInterfaceTNLP.hpp b/src/Interfaces/IpStdInterfaceTNLP.hpp index c8a70b36a..7acd334e2 100644 --- a/src/Interfaces/IpStdInterfaceTNLP.hpp +++ b/src/Interfaces/IpStdInterfaceTNLP.hpp @@ -29,7 +29,7 @@ class StdInterfaceTNLP : public TNLP { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor, given dimensions of problem, function pointers * for evaluation callback functions, and starting points. * @@ -70,13 +70,13 @@ class StdInterfaceTNLP : public TNLP /** Default destructor */ virtual ~StdInterfaceTNLP(); - //@} + ///@} /**@name Methods to gather information about the NLP. * * These methods are overloaded from TNLP. See TNLP for their more detailed documentation. */ - //@{ + ///@{ virtual bool get_nlp_info( Index& n, Index& m, @@ -178,10 +178,10 @@ class StdInterfaceTNLP : public TNLP const IpoptData* ip_data, IpoptCalculatedQuantities* ip_cq ); - //@} + ///@} /** @name Solution Methods */ - //@{ + ///@{ virtual void finalize_solution( SolverReturn status, Index n, @@ -195,14 +195,48 @@ class StdInterfaceTNLP : public TNLP const IpoptData* ip_data, IpoptCalculatedQuantities* ip_cq ); - //@} + ///@} + + /// get_curr_iterate() to be called by GetIpoptCurrentIterate() + /// @since 3.14.0 + bool get_curr_iterate( + Bool scaled, + Index n, + Number* x, + Number* z_L, + Number* z_U, + Index m, + Number* g, + Number* lambda + ) const + { + return TNLP::get_curr_iterate(ip_data_, ip_cq_, scaled, n, x, z_L, z_U, m, g, lambda); + } + + /// get_curr_violations() to be called by GetIpoptCurrentViolations() + /// @since 3.14.0 + bool get_curr_violations( + bool scaled, + Index n, + Number* x_L_violation, + Number* x_U_violation, + Number* compl_x_L, + Number* compl_x_U, + Number* grad_lag_x, + Index m, + Number* nlp_constraint_violation, + Number* compl_g + ) const + { + return TNLP::get_curr_violations(ip_data_, ip_cq_, scaled, n, x_L_violation, x_U_violation, compl_x_L, compl_x_U, grad_lag_x, m, nlp_constraint_violation, compl_g); + } private: /** Journalist */ SmartPtr jnlst_; /** @name Information about the problem */ - //@{ + ///@{ /** Number of variables */ const Index n_var_; /** Number of constraints */ @@ -249,20 +283,27 @@ class StdInterfaceTNLP : public TNLP const Number* x_scaling_; /** Scaling factors for constraints (if not NULL) */ const Number* g_scaling_; - //@} + ///@} /** A non-const copy of x - this is kept up-to-date in apply_new_x */ Number* non_const_x_; /** @name Pointers to the user provided vectors for solution */ - //@{ + ///@{ Number* x_sol_; Number* z_L_sol_; Number* z_U_sol_; Number* g_sol_; Number* lambda_sol_; Number* obj_sol_; - //@} + ///@} + + /** @name Temporary pointers to IpoptData and IpoptCalculatedQuantities + * + * For implementation of GetIpoptCurrentIterate() and GetIpoptCurrentViolations() (without API change). + */ + const IpoptData* ip_data_; + IpoptCalculatedQuantities* ip_cq_; /** Update the internal state if the x value changes */ void apply_new_x( @@ -278,7 +319,7 @@ class StdInterfaceTNLP : public TNLP * 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 */ StdInterfaceTNLP(); @@ -291,7 +332,7 @@ class StdInterfaceTNLP : public TNLP void operator=( const StdInterfaceTNLP& ); - //@} + ///@} }; diff --git a/src/Interfaces/IpStdJInterface.cpp b/src/Interfaces/IpStdJInterface.cpp index c849ce1a7..acb93e678 100644 --- a/src/Interfaces/IpStdJInterface.cpp +++ b/src/Interfaces/IpStdJInterface.cpp @@ -13,6 +13,20 @@ using namespace std; using namespace Ipopt; +#ifdef IPOPT_SINGLE +typedef jfloat jnumber; +typedef jfloatArray jnumberArray; +#define NewNumberArray NewFloatArray +#define GetNumberArrayRegion GetFloatArrayRegion +#define SetNumberArrayRegion SetFloatArrayRegion +#else +typedef jdouble jnumber; +typedef jdoubleArray jnumberArray; +#define NewNumberArray NewDoubleArray +#define GetNumberArrayRegion GetDoubleArrayRegion +#define SetNumberArrayRegion SetDoubleArrayRegion +#endif + /** Main structure for Ipopt JNI implementation. * * All functions will receive a pointer to this structure as @@ -38,7 +52,7 @@ class Jipopt: public TNLP } /**@name Overloaded from TNLP */ - //@{ + ///@{ /* Method to return some info about the NLP */ virtual bool get_nlp_info( Index& n, @@ -144,6 +158,23 @@ class Jipopt: public TNLP IpoptCalculatedQuantities* ip_cq ); + /* Intermediate Callback method for the user. */ + virtual bool intermediate_callback( + AlgorithmMode mode, + Index iter, + Number obj_value, + Number inf_pr, + Number inf_du, + Number mu, + Number d_norm, + Number regularization_size, + Number alpha_du, + Number alpha_pr, + Index ls_trials, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq + ); + /* Method to return scaling parameters. */ virtual bool get_scaling_parameters( Number& obj_scaling, @@ -162,7 +193,7 @@ class Jipopt: public TNLP Index num_nonlin_vars, Index* pos_nonlin_vars ); - //@} + ///@} public: /// The JNI Environment @@ -176,17 +207,17 @@ class Jipopt: public TNLP jint index_style; // some cached arguments - jdoubleArray mult_gj; - jdoubleArray mult_x_Lj; - jdoubleArray mult_x_Uj; + jnumberArray mult_gj; + jnumberArray mult_x_Lj; + jnumberArray mult_x_Uj; // the callback arguments - jdoubleArray xj; - jdoubleArray fj; - jdoubleArray grad_fj; - jdoubleArray gj; - jdoubleArray jac_gj; - jdoubleArray hessj; + jnumberArray xj; + jnumberArray fj; + jnumberArray grad_fj; + jnumberArray gj; + jnumberArray jac_gj; + jnumberArray hessj; jboolean using_scaling_parameters; jboolean using_LBFGS; @@ -202,6 +233,7 @@ class Jipopt: public TNLP jmethodID eval_jac_g_; jmethodID eval_h_; + jmethodID intermediate_callback_; jmethodID get_scaling_parameters_; jmethodID get_number_of_nonlinear_variables_; jmethodID get_list_of_nonlinear_variables_; @@ -223,15 +255,16 @@ Jipopt::Jipopt( : env(env_), solver(solver_), n(n_), m(m_), nele_jac(nele_jac_), nele_hess(nele_hess_), index_style(index_style_), mult_gj(NULL), mult_x_Lj(NULL), mult_x_Uj(NULL), xj(NULL), fj(NULL), grad_fj(NULL), gj(NULL), jac_gj(NULL), hessj(NULL), - using_scaling_parameters(false), using_LBFGS(false) + using_scaling_parameters(false), using_LBFGS(false), + application(new IpoptApplication()) { - application = new IpoptApplication(); application->RethrowNonIpoptException(false); // the solver class jclass solverCls = env->GetObjectClass(solver); // get the methods +#ifndef IPOPT_SINGLE get_bounds_info_ = env->GetMethodID(solverCls, "get_bounds_info", "(I[D[DI[D[D)Z"); get_starting_point_ = env->GetMethodID(solverCls, "get_starting_point", "(IZ[DZ[D[DIZ[D)Z"); eval_f_ = env->GetMethodID(solverCls, "eval_f", "(I[DZ[D)Z"); @@ -239,7 +272,19 @@ Jipopt::Jipopt( eval_g_ = env->GetMethodID(solverCls, "eval_g", "(I[DZI[D)Z"); eval_jac_g_ = env->GetMethodID(solverCls, "eval_jac_g", "(I[DZII[I[I[D)Z"); eval_h_ = env->GetMethodID(solverCls, "eval_h", "(I[DZDI[DZI[I[I[D)Z"); - get_scaling_parameters_ = env->GetMethodID(solverCls, "get_scaling_parameters", "([DI[DI[D[Z)Z"); + get_scaling_parameters_ = env->GetMethodID(solverCls, "get_scaling_parameters", "([DI[DI[D[Z)Z"); + intermediate_callback_ = env->GetMethodID(solverCls, "intermediate_callback", "(IIDDDDDDDDIJJ)Z"); +#else + get_bounds_info_ = env->GetMethodID(solverCls, "get_bounds_info", "(I[F[FI[F[F)Z"); + get_starting_point_ = env->GetMethodID(solverCls, "get_starting_point", "(IZ[FZ[F[FIZ[F)Z"); + eval_f_ = env->GetMethodID(solverCls, "eval_f", "(I[FZ[F)Z"); + eval_grad_f_ = env->GetMethodID(solverCls, "eval_grad_f", "(I[FZ[F)Z"); + eval_g_ = env->GetMethodID(solverCls, "eval_g", "(I[FZI[F)Z"); + eval_jac_g_ = env->GetMethodID(solverCls, "eval_jac_g", "(I[FZII[I[I[F)Z"); + eval_h_ = env->GetMethodID(solverCls, "eval_h", "(I[FZFI[FZI[I[I[F)Z"); + get_scaling_parameters_ = env->GetMethodID(solverCls, "get_scaling_parameters", "([FI[FI[F[Z)Z"); + intermediate_callback_ = env->GetMethodID(solverCls, "intermediate_callback", "(IIFFFFFFFFIJJ)Z"); +#endif get_number_of_nonlinear_variables_ = env->GetMethodID(solverCls, "get_number_of_nonlinear_variables", "()I"); get_list_of_nonlinear_variables_ = env->GetMethodID(solverCls, "get_list_of_nonlinear_variables", "(I[I)Z"); @@ -288,20 +333,20 @@ bool Jipopt::get_bounds_info( Number* g_l, Number* g_u) { - jdoubleArray x_lj = NULL; - jdoubleArray x_uj = NULL; - jdoubleArray g_lj = NULL; - jdoubleArray g_uj = NULL; + jnumberArray x_lj = NULL; + jnumberArray x_uj = NULL; + jnumberArray g_lj = NULL; + jnumberArray g_uj = NULL; assert(x_l != NULL); assert(x_u != NULL); assert(g_l != NULL); assert(g_u != NULL); - x_lj = env->NewDoubleArray(n); - x_uj = env->NewDoubleArray(n); - g_lj = env->NewDoubleArray(m); - g_uj = env->NewDoubleArray(m); + x_lj = env->NewNumberArray(n); + x_uj = env->NewNumberArray(n); + g_lj = env->NewNumberArray(m); + g_uj = env->NewNumberArray(m); if( !env->CallBooleanMethod(solver, get_bounds_info_, n, x_lj, x_uj, m, g_lj, g_uj) ) { @@ -309,10 +354,10 @@ bool Jipopt::get_bounds_info( } // Copy from Java to native value - env->GetDoubleArrayRegion(x_lj, 0, n, x_l); - env->GetDoubleArrayRegion(x_uj, 0, n, x_u); - env->GetDoubleArrayRegion(g_lj, 0, m, g_l); - env->GetDoubleArrayRegion(g_uj, 0, m, g_u); + env->GetNumberArrayRegion(x_lj, 0, n, x_l); + env->GetNumberArrayRegion(x_uj, 0, n, x_u); + env->GetNumberArrayRegion(g_lj, 0, m, g_l); + env->GetNumberArrayRegion(g_uj, 0, m, g_u); return true; } @@ -328,10 +373,10 @@ bool Jipopt::get_starting_point( bool init_lambda, Number* lambda) { - jdoubleArray xj = this->xj; - jdoubleArray z_lj = this->mult_x_Lj; - jdoubleArray z_uj = this->mult_x_Uj; - jdoubleArray lambdaj = this->mult_gj; + jnumberArray xj = this->xj; + jnumberArray z_lj = this->mult_x_Lj; + jnumberArray z_uj = this->mult_x_Uj; + jnumberArray lambdaj = this->mult_gj; if( !env->CallBooleanMethod(solver, get_starting_point_, n, init_x, xj, init_z, z_lj, z_uj, m, init_lambda, lambdaj) ) { @@ -341,18 +386,18 @@ bool Jipopt::get_starting_point( /* Copy from Java to native value */ if( init_x ) { - env->GetDoubleArrayRegion(xj, 0, n, x); + env->GetNumberArrayRegion(xj, 0, n, x); } if( init_z ) { - env->GetDoubleArrayRegion(z_lj, 0, n, z_L); - env->GetDoubleArrayRegion(z_uj, 0, n, z_U); + env->GetNumberArrayRegion(z_lj, 0, n, z_L); + env->GetNumberArrayRegion(z_uj, 0, n, z_U); } if( init_lambda ) { - env->GetDoubleArrayRegion(lambdaj, 0, m, lambda); + env->GetNumberArrayRegion(lambdaj, 0, m, lambda); } return true; @@ -367,7 +412,7 @@ bool Jipopt::eval_f( /* Copy the native double x to the Java double array xj, if new values */ if( new_x ) { - env->SetDoubleArrayRegion(xj, 0, n, const_cast(x)); + env->SetNumberArrayRegion(xj, 0, n, const_cast(x)); } /* Call the java method */ @@ -378,7 +423,7 @@ bool Jipopt::eval_f( } /* Copy from Java to native value */ - env->GetDoubleArrayRegion(fj, 0, 1, &obj_value); + env->GetNumberArrayRegion(fj, 0, 1, &obj_value); return true; } @@ -392,7 +437,7 @@ bool Jipopt::eval_grad_f( /* Copy the native double x to the Java double array xj, if new values */ if( new_x ) { - env->SetDoubleArrayRegion(xj, 0, n, const_cast(x)); + env->SetNumberArrayRegion(xj, 0, n, const_cast(x)); } /* Call the java method */ @@ -402,7 +447,7 @@ bool Jipopt::eval_grad_f( return false; } - env->GetDoubleArrayRegion(grad_fj, 0, n, grad_f); + env->GetNumberArrayRegion(grad_fj, 0, n, grad_f); return true; } @@ -417,7 +462,7 @@ bool Jipopt::eval_g( /* Copy the native double x to the Java double array xj, if new values */ if( new_x ) { - env->SetDoubleArrayRegion(xj, 0, n, const_cast(x)); + env->SetNumberArrayRegion(xj, 0, n, const_cast(x)); } /* Call the java method */ @@ -428,7 +473,7 @@ bool Jipopt::eval_g( } /* Copy from Java to native value */ - env->GetDoubleArrayRegion(gj, 0, m, g); + env->GetNumberArrayRegion(gj, 0, m, g); return true; } @@ -446,7 +491,7 @@ bool Jipopt::eval_jac_g( // Copy the native double x to the Java double array xj, if new values if( new_x && x != NULL ) { - env->SetDoubleArrayRegion(xj, 0, n, const_cast(x)); + env->SetNumberArrayRegion(xj, 0, n, const_cast(x)); } /// Create the index arrays if needed @@ -468,7 +513,7 @@ bool Jipopt::eval_jac_g( /* Copy from Java to native value */ if( jac_g != NULL ) { - env->GetDoubleArrayRegion(jac_gj, 0, nele_jac, jac_g); + env->GetNumberArrayRegion(jac_gj, 0, nele_jac, jac_g); } if( iRow != NULL && jCol != NULL ) @@ -483,13 +528,13 @@ bool Jipopt::eval_jac_g( jint* tmp = new jint[nele_jac]; env->GetIntArrayRegion(iRowj, 0, nele_jac, tmp); - for( int i = 0; i < nele_jac; ++i ) + for( Index i = 0; i < nele_jac; ++i ) { iRow[i] = (Index) tmp[i]; } env->GetIntArrayRegion(jColj, 0, nele_jac, tmp); - for( int i = 0; i < nele_jac; ++i ) + for( Index i = 0; i < nele_jac; ++i ) { jCol[i] = (Index) tmp[i]; } @@ -517,13 +562,13 @@ bool Jipopt::eval_h( /* Copy the native double x to the Java double array xj, if new values */ if( new_x && x != NULL ) { - env->SetDoubleArrayRegion(xj, 0, n, const_cast(x)); + env->SetNumberArrayRegion(xj, 0, n, const_cast(x)); } /* Copy the native double lambda to the Java double array lambdaj, if new values */ if( new_lambda && lambda != NULL ) { - env->SetDoubleArrayRegion(mult_gj, 0, m, const_cast(lambda)); + env->SetNumberArrayRegion(mult_gj, 0, m, const_cast(lambda)); } /* Create the index arrays if needed */ @@ -546,7 +591,7 @@ bool Jipopt::eval_h( /* Copy from Java to native value */ if( hess != NULL ) { - env->GetDoubleArrayRegion(hessj, 0, nele_hess, hess); + env->GetNumberArrayRegion(hessj, 0, nele_hess, hess); } if( iRow != NULL && jCol != NULL ) @@ -561,13 +606,13 @@ bool Jipopt::eval_h( jint* tmp = new jint[nele_hess]; env->GetIntArrayRegion(iRowj, 0, nele_hess, tmp); - for( int i = 0; i < nele_hess; ++i ) + for( Index i = 0; i < nele_hess; ++i ) { iRow[i] = (Index) tmp[i]; } env->GetIntArrayRegion(jColj, 0, nele_hess, tmp); - for( int i = 0; i < nele_hess; ++i ) + for( Index i = 0; i < nele_hess; ++i ) { jCol[i] = (Index) tmp[i]; } @@ -597,30 +642,50 @@ void Jipopt::finalize_solution( if( x != NULL ) { - env->SetDoubleArrayRegion(xj, 0, n, const_cast(x)); + env->SetNumberArrayRegion(xj, 0, n, const_cast(x)); } if( z_L != NULL ) { - env->SetDoubleArrayRegion(mult_x_Lj, 0, n, const_cast(z_L)); + env->SetNumberArrayRegion(mult_x_Lj, 0, n, const_cast(z_L)); } if( z_U != NULL ) { - env->SetDoubleArrayRegion(mult_x_Uj, 0, n, const_cast(z_U)); + env->SetNumberArrayRegion(mult_x_Uj, 0, n, const_cast(z_U)); } if( g != NULL ) { - env->SetDoubleArrayRegion(gj, 0, m, const_cast(g)); + env->SetNumberArrayRegion(gj, 0, m, const_cast(g)); } if( lambda != NULL ) { - env->SetDoubleArrayRegion(mult_gj, 0, m, const_cast(lambda)); + env->SetNumberArrayRegion(mult_gj, 0, m, const_cast(lambda)); } - env->GetDoubleArrayRegion(fj, 0, 1, &obj_value); + env->GetNumberArrayRegion(fj, 0, 1, &obj_value); +} + +/* Intermediate Callback method for the user. */ +bool Jipopt::intermediate_callback( + AlgorithmMode mode, + Index iter, + Number obj_value, + Number inf_pr, + Number inf_du, + Number mu, + Number d_norm, + Number regularization_size, + Number alpha_du, + Number alpha_pr, + Index ls_trials, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq +) +{ + return env->CallBooleanMethod(solver, intermediate_callback_, (int)mode, iter, obj_value, inf_pr, inf_du, mu, d_norm, regularization_size, alpha_du, alpha_pr, ls_trials, ip_data, ip_cq); } bool Jipopt::get_scaling_parameters( @@ -637,9 +702,9 @@ bool Jipopt::get_scaling_parameters( return false; } - jdoubleArray obj_scaling_j = env->NewDoubleArray(1); - jdoubleArray x_scaling_j = env->NewDoubleArray(n); - jdoubleArray g_scaling_j = env->NewDoubleArray(m); + jnumberArray obj_scaling_j = env->NewNumberArray(1); + jnumberArray x_scaling_j = env->NewNumberArray(n); + jnumberArray g_scaling_j = env->NewNumberArray(m); jbooleanArray use_x_g_scaling_j = env->NewBooleanArray(2); @@ -648,12 +713,12 @@ bool Jipopt::get_scaling_parameters( jboolean* use_x_g_scaling = env->GetBooleanArrayElements(use_x_g_scaling_j, 0); /* Copy from Java to native value */ - env->GetDoubleArrayRegion(obj_scaling_j, 0, 1, &obj_scaling); + env->GetNumberArrayRegion(obj_scaling_j, 0, 1, &obj_scaling); /* Copy from Java to native value */ if( use_x_g_scaling[0] ) { - env->GetDoubleArrayRegion(x_scaling_j, 0, n, x_scaling); + env->GetNumberArrayRegion(x_scaling_j, 0, n, x_scaling); use_x_scaling = true; } else @@ -664,7 +729,7 @@ bool Jipopt::get_scaling_parameters( /* Copy from Java to native value */ if( use_x_g_scaling[1] ) { - env->GetDoubleArrayRegion(g_scaling_j, 0, n, g_scaling); + env->GetNumberArrayRegion(g_scaling_j, 0, n, g_scaling); use_g_scaling = true; } else @@ -714,7 +779,7 @@ bool Jipopt::get_list_of_nonlinear_variables( jint* tmp = new jint[num_nonlin_vars]; env->GetIntArrayRegion(pos_nonlin_vars_j, 0, num_nonlin_vars, tmp); - for( int i = 0; i < num_nonlin_vars; ++i ) + for( Index i = 0; i < num_nonlin_vars; ++i ) { pos_nonlin_vars[i] = (Index) tmp[i]; } @@ -752,15 +817,15 @@ extern "C" JNIEnv* env, jobject obj_this, jlong pipopt, - jdoubleArray xj, - jdoubleArray gj, - jdoubleArray obj_valj, - jdoubleArray mult_gj, - jdoubleArray mult_x_Lj, - jdoubleArray mult_x_Uj, - jdoubleArray callback_grad_f, - jdoubleArray callback_jac_g, - jdoubleArray callback_hess) + jnumberArray xj, + jnumberArray gj, + jnumberArray obj_valj, + jnumberArray mult_gj, + jnumberArray mult_x_Lj, + jnumberArray mult_x_Uj, + jnumberArray callback_grad_f, + jnumberArray callback_jac_g, + jnumberArray callback_hess) { Jipopt* problem = GetRawPtr(*(SmartPtr*) pipopt); @@ -794,6 +859,194 @@ extern "C" return (jint) status; } + JNIEXPORT jboolean JNICALL Java_org_coinor_Ipopt_GetCurrIterate( + JNIEnv* env, + jobject /* obj_this */, + jlong pipopt, + jlong jip_data, + jlong jip_cq, + jboolean jscaled, + jint jn, + jnumberArray jx, + jnumberArray jz_L, + jnumberArray jz_U, + jint jm, + jnumberArray jg, + jnumberArray jlambda) + { + Jipopt* problem = GetRawPtr(*(SmartPtr*) pipopt); + IpoptData* ip_data = (IpoptData*)jip_data; + IpoptCalculatedQuantities* ip_cq = (IpoptCalculatedQuantities*)jip_cq; + + Index n = jn; + Index m = jm; + + Number* x = NULL; + Number* z_L = NULL; + Number* z_U = NULL; + Number* g = NULL; + Number* lambda = NULL; + + if( jx != NULL ) + { + x = new Number[n]; + } + if( jz_L != NULL ) + { + z_L = new Number[n]; + } + if( jz_U != NULL ) + { + z_U = new Number[n]; + } + if( jg != NULL ) + { + g = new Number[m]; + } + if( jlambda != NULL ) + { + lambda = new Number[m]; + } + + bool ok = problem->get_curr_iterate(ip_data, ip_cq, jscaled, n, x, z_L, z_U, m, g, lambda); + if( ok ) + { + if( jx != NULL ) + { + env->SetNumberArrayRegion(jx, 0, n, const_cast(x)); + } + if( jz_L != NULL ) + { + env->SetNumberArrayRegion(jz_L, 0, n, const_cast(z_L)); + } + if( jz_U != NULL ) + { + env->SetNumberArrayRegion(jz_U, 0, n, const_cast(z_U)); + } + if( jg != NULL ) + { + env->SetNumberArrayRegion(jg, 0, m, const_cast(g)); + } + if( jlambda != NULL ) + { + env->SetNumberArrayRegion(jlambda, 0, m, const_cast(lambda)); + } + } + + delete[] lambda; + delete[] g; + delete[] z_U; + delete[] z_L; + delete[] x; + + return ok; + } + + JNIEXPORT jboolean JNICALL Java_org_coinor_Ipopt_GetCurrViolations( + JNIEnv* env, + jobject /* obj_this */, + jlong pipopt, + jlong jip_data, + jlong jip_cq, + jboolean jscaled, + jint jn, + jnumberArray jx_L_violation, + jnumberArray jx_U_violation, + jnumberArray jcompl_x_L, + jnumberArray jcompl_x_U, + jnumberArray jgrad_lag_x, + jint jm, + jnumberArray jnlp_constraint_violation, + jnumberArray jcompl_g) + { + Jipopt* problem = GetRawPtr(*(SmartPtr*) pipopt); + IpoptData* ip_data = (IpoptData*)jip_data; + IpoptCalculatedQuantities* ip_cq = (IpoptCalculatedQuantities*)jip_cq; + + Index n = jn; + Index m = jm; + + Number* x_L_violation = NULL; + Number* x_U_violation = NULL; + Number* compl_x_L = NULL; + Number* compl_x_U = NULL; + Number* grad_lag_x = NULL; + Number* nlp_constraint_violation = NULL; + Number* compl_g = NULL; + + if( jx_L_violation != NULL ) + { + x_L_violation = new Number[n]; + } + if( jx_U_violation != NULL ) + { + x_U_violation = new Number[n]; + } + if( jcompl_x_L != NULL ) + { + compl_x_L = new Number[n]; + } + if( jcompl_x_U != NULL ) + { + compl_x_U = new Number[n]; + } + if( jgrad_lag_x != NULL ) + { + grad_lag_x = new Number[n]; + } + if( jnlp_constraint_violation != NULL ) + { + nlp_constraint_violation = new Number[m]; + } + if( jcompl_g != NULL ) + { + compl_g = new Number[m]; + } + + bool ok = problem->get_curr_violations(ip_data, ip_cq, jscaled, n, x_L_violation, x_U_violation, compl_x_L, compl_x_U, grad_lag_x, m, nlp_constraint_violation, compl_g); + if( ok ) + { + if( jx_L_violation != NULL ) + { + env->SetNumberArrayRegion(jx_L_violation, 0, n, const_cast(x_L_violation)); + } + if( jx_U_violation != NULL ) + { + env->SetNumberArrayRegion(jx_U_violation, 0, n, const_cast(x_U_violation)); + } + if( jcompl_x_L != NULL ) + { + env->SetNumberArrayRegion(jcompl_x_L, 0, n, const_cast(compl_x_L)); + } + if( jcompl_x_U != NULL ) + { + env->SetNumberArrayRegion(jcompl_x_U, 0, n, const_cast(compl_x_U)); + } + if( jgrad_lag_x != NULL ) + { + env->SetNumberArrayRegion(jgrad_lag_x, 0, n, const_cast(grad_lag_x)); + } + if( jnlp_constraint_violation != NULL ) + { + env->SetNumberArrayRegion(jnlp_constraint_violation, 0, m, const_cast(nlp_constraint_violation)); + } + if( jcompl_g != NULL ) + { + env->SetNumberArrayRegion(jcompl_g, 0, m, const_cast(compl_g)); + } + } + + delete[] compl_g; + delete[] nlp_constraint_violation; + delete[] grad_lag_x; + delete[] compl_x_U; + delete[] compl_x_L; + delete[] x_U_violation; + delete[] x_L_violation; + + return ok; + } + JNIEXPORT void JNICALL Java_org_coinor_Ipopt_FreeIpoptProblem( JNIEnv* /*env*/, jobject /*obj_this*/, @@ -840,7 +1093,7 @@ extern "C" jobject /*obj_this*/, jlong pipopt, jstring jparname, - jdouble jparvalue + jnumber jparvalue ) { Jipopt* problem = GetRawPtr(*(SmartPtr*) pipopt); diff --git a/src/Interfaces/IpTNLP.cpp b/src/Interfaces/IpTNLP.cpp new file mode 100644 index 000000000..66b606785 --- /dev/null +++ b/src/Interfaces/IpTNLP.cpp @@ -0,0 +1,1042 @@ +// Copyright (C) 2021 COIN-OR Foundation +// All Rights Reserved. +// This code is published under the Eclipse Public License. + +#include "IpoptConfig.h" +#include "IpTNLP.hpp" +#include "IpIpoptData.hpp" +#include "IpIpoptCalculatedQuantities.hpp" +#include "IpOrigIpoptNLP.hpp" +#include "IpRestoIpoptNLP.hpp" +#include "IpTNLPAdapter.hpp" +#include "IpDenseVector.hpp" +#include "IpBlas.hpp" + +namespace Ipopt +{ + +static +SmartPtr curr_x( + const IpoptData* ip_data, + IpoptCalculatedQuantities* /* ip_cq */, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr x; + + if( restonlp == NULL ) + { + x = ip_data->curr()->x(); + } + else + { + // get x from the compound vector (x,p,n) + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->x())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->x())); + x = c_vec->GetComp(0); + } + DBG_ASSERT(IsValid(x)); + + if( !scaled && orignlp->NLP_scaling()->have_x_scaling() ) + { + x = orignlp->NLP_scaling()->unapply_vector_scaling_x(x); + } + + DBG_ASSERT(dynamic_cast(GetRawPtr(x)) != NULL); + return static_cast(GetRawPtr(x)); +} + +static +SmartPtr curr_z_L( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr z_L; + + if( restonlp == NULL ) + { + z_L = ip_data->curr()->z_L(); + } + else + { + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->z_L())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->z_L())); + z_L = c_vec->GetComp(0); + } + DBG_ASSERT(IsValid(z_L)); + + if( !scaled ) + { + Number obj_unscale_factor = orignlp->NLP_scaling()->unapply_obj_scaling(1.); + if( orignlp->NLP_scaling()->have_x_scaling() ) + { + // get copy with x scaling unapplied + Index x_dim = curr_x(ip_data, ip_cq, orignlp, restonlp, true)->Dim(); + SmartPtr tmp = orignlp->NLP_scaling()->apply_vector_scaling_x_LU_NonConst(*orignlp->Px_L(), z_L, *new DenseVectorSpace(x_dim)); + // unapply obj scaling + tmp->Scal(obj_unscale_factor); + z_L = ConstPtr(tmp); + } + else if( obj_unscale_factor != 1. ) + { + // make copy and unapply obj scaling + SmartPtr tmp = z_L->MakeNewCopy(); + tmp->Scal(obj_unscale_factor); + z_L = ConstPtr(tmp); + } + } + + DBG_ASSERT(dynamic_cast(GetRawPtr(z_L)) != NULL); + return static_cast(GetRawPtr(z_L)); +} + +static +SmartPtr curr_z_U( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr z_U; + + if( restonlp == NULL ) + { + z_U = ip_data->curr()->z_U(); + } + else + { + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->z_U())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->z_U())); + z_U = c_vec->GetComp(0); + } + DBG_ASSERT(IsValid(z_U)); + + if( !scaled ) + { + Number obj_unscale_factor = orignlp->NLP_scaling()->unapply_obj_scaling(1.); + if( orignlp->NLP_scaling()->have_x_scaling() ) + { + // get copy with x scaling unapplied + Index x_dim = curr_x(ip_data, ip_cq, orignlp, restonlp, true)->Dim(); + SmartPtr tmp = orignlp->NLP_scaling()->apply_vector_scaling_x_LU_NonConst(*orignlp->Px_U(), z_U, *new DenseVectorSpace(x_dim)); + // unapply obj scaling + tmp->Scal(obj_unscale_factor); + z_U = ConstPtr(tmp); + } + else if( obj_unscale_factor != 1. ) + { + // make copy and unapply obj scaling + SmartPtr tmp = z_U->MakeNewCopy(); + tmp->Scal(obj_unscale_factor); + z_U = ConstPtr(tmp); + } + } + + DBG_ASSERT(dynamic_cast(GetRawPtr(z_U)) != NULL); + return static_cast(GetRawPtr(z_U)); +} + +static +SmartPtr curr_c( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr c; + + if( restonlp == NULL ) + { + c = ip_cq->curr_c(); + } + else + { + // get nc, pc from the compound vector (x,nc,pc,nd,pd,...) + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->x())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->x())); + SmartPtr nc_only = c_vec->GetComp(1); + SmartPtr pc_only = c_vec->GetComp(2); + DBG_ASSERT(IsValid(nc_only)); + DBG_ASSERT(IsValid(pc_only)); + + // get scaled c from restonlp + c_vec = static_cast(GetRawPtr(ip_cq->curr_c())); + // cppcheck-suppress assertWithSideEffect + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_cq->curr_c())) != NULL); + SmartPtr c_resto = c_vec->GetComp(0)->MakeNewCopy(); + + // undo addition of slacks nc-pc + c_resto->Axpy(-1.0, *nc_only); + c_resto->Axpy(1.0, *pc_only); + + c = c_resto; + } + DBG_ASSERT(IsValid(c)); + + if( !scaled ) + { + c = orignlp->NLP_scaling()->unapply_vector_scaling_c(c); + } + + DBG_ASSERT(dynamic_cast(GetRawPtr(c)) != NULL); + return static_cast(GetRawPtr(c)); +} + +static +SmartPtr curr_y_c( + const IpoptData* ip_data, + IpoptCalculatedQuantities* /* ip_cq */, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr y_c; + + if( restonlp == NULL ) + { + y_c = ip_data->curr()->y_c(); + } + else + { + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->y_c())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->y_c())); + DBG_ASSERT(c_vec->NComps() == 1); + y_c = c_vec->GetComp(0); + } + DBG_ASSERT(IsValid(y_c)); + + if( !scaled ) + { + Number obj_unscale_factor = orignlp->NLP_scaling()->unapply_obj_scaling(1.); + + if( orignlp->NLP_scaling()->have_c_scaling() ) + { + SmartPtr tmp = orignlp->NLP_scaling()->apply_vector_scaling_c_NonConst(y_c); + tmp->Scal(obj_unscale_factor); + y_c = ConstPtr(tmp); + } + else if( obj_unscale_factor != 1. ) + { + // make copy and unapply obj scaling + SmartPtr tmp = y_c->MakeNewCopy(); + tmp->Scal(obj_unscale_factor); + y_c = ConstPtr(tmp); + } + } + + DBG_ASSERT(dynamic_cast(GetRawPtr(y_c)) != NULL); + return static_cast(GetRawPtr(y_c)); +} + +static +SmartPtr curr_d( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr d; + + if( restonlp == NULL ) + { + d = ip_cq->curr_d(); + } + else + { + // get nd, pd from the compound vector (x,nc,pc,nd,pd,...) + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->x())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->x())); + SmartPtr nd_only = c_vec->GetComp(3); + SmartPtr pd_only = c_vec->GetComp(4); + DBG_ASSERT(IsValid(nd_only)); + DBG_ASSERT(IsValid(pd_only)); + + // get scaled d from restonlp + c_vec = static_cast(GetRawPtr(ip_cq->curr_d())); + // cppcheck-suppress assertWithSideEffect + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_cq->curr_d())) != NULL); + SmartPtr d_resto = c_vec->GetComp(0)->MakeNewCopy(); + + // undo addition of slacks nc-pc + d_resto->Axpy(-1.0, *nd_only); + d_resto->Axpy(1.0, *pd_only); + + d = d_resto; + } + DBG_ASSERT(IsValid(d)); + + if( !scaled ) + { + d = orignlp->NLP_scaling()->unapply_vector_scaling_d(d); + } + + DBG_ASSERT(dynamic_cast(GetRawPtr(d)) != NULL); + return static_cast(GetRawPtr(d)); +} + +static +SmartPtr curr_y_d( + const IpoptData* ip_data, + IpoptCalculatedQuantities* /* ip_cq */, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr y_d; + + if( restonlp == NULL ) + { + y_d = ip_data->curr()->y_d(); + } + else + { + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->y_d())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->y_d())); + DBG_ASSERT(c_vec->NComps() == 1); + y_d = c_vec->GetComp(0); + } + DBG_ASSERT(IsValid(y_d)); + + if( !scaled ) + { + Number obj_unscale_factor = orignlp->NLP_scaling()->unapply_obj_scaling(1.); + + if( orignlp->NLP_scaling()->have_d_scaling() ) + { + SmartPtr tmp = orignlp->NLP_scaling()->apply_vector_scaling_d_NonConst(y_d); + tmp->Scal(obj_unscale_factor); + y_d = ConstPtr(tmp); + } + else if( obj_unscale_factor != 1. ) + { + // make copy and unapply obj scaling + SmartPtr tmp = y_d->MakeNewCopy(); + tmp->Scal(obj_unscale_factor); + y_d = ConstPtr(tmp); + } + } + + DBG_ASSERT(dynamic_cast(GetRawPtr(y_d)) != NULL); + return static_cast(GetRawPtr(y_d)); +} + +static +SmartPtr curr_x_L_viol( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr x_L_viol; + + if( restonlp == NULL ) + { + if( scaled ) + { + x_L_viol = ip_cq->curr_orig_x_L_violation(); + } + else + { + x_L_viol = ip_cq->unscaled_curr_orig_x_L_violation(); + } + } + else + { + // get x from the compound vector (x,p,n) + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->x())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->x())); + SmartPtr x = c_vec->GetComp(0); + + if( scaled ) + { + x_L_viol = restonlp->OrigIpCq().orig_x_L_violation(*x); + } + else + { + x = orignlp->NLP_scaling()->unapply_vector_scaling_x(x); + x_L_viol = restonlp->OrigIpCq().unscaled_orig_x_L_violation(*x); + } + } + DBG_ASSERT(IsValid(x_L_viol)); + + DBG_ASSERT(dynamic_cast(GetRawPtr(x_L_viol)) != NULL); + return static_cast(GetRawPtr(x_L_viol)); +} + +static +SmartPtr curr_x_U_viol( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr x_U_viol; + + if( restonlp == NULL ) + { + if( scaled ) + { + x_U_viol = ip_cq->curr_orig_x_U_violation(); + } + else + { + x_U_viol = ip_cq->unscaled_curr_orig_x_U_violation(); + } + } + else + { + // get x from the compound vector (x,p,n) + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->x())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->x())); + SmartPtr x = c_vec->GetComp(0); + + if( scaled ) + { + x_U_viol = restonlp->OrigIpCq().orig_x_U_violation(*x); + } + else + { + x = orignlp->NLP_scaling()->unapply_vector_scaling_x(x); + x_U_viol = restonlp->OrigIpCq().unscaled_orig_x_U_violation(*x); + } + } + DBG_ASSERT(IsValid(x_U_viol)); + + DBG_ASSERT(dynamic_cast(GetRawPtr(x_U_viol)) != NULL); + return static_cast(GetRawPtr(x_U_viol)); +} + +static +SmartPtr curr_compl_x_L( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr compl_x_L; + + Number obj_unscal = scaled ? 1.0 : orignlp->NLP_scaling()->unapply_obj_scaling(1.0); + + if( restonlp == NULL ) + { + compl_x_L = ip_cq->curr_compl_x_L(); + if( obj_unscal != 1.0 ) + { + SmartPtr tmp = compl_x_L->MakeNewCopy(); + tmp->Scal(obj_unscal); + compl_x_L = tmp; + } + } + else + { + // get duals z_L for x from the compound vector for the duals of (x,nc,pc,nd,pd,...) + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->z_L())) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->z_L())); + SmartPtr z_L_only = c_vec->GetComp(0); + DBG_ASSERT(IsValid(z_L_only)); + + // get slacks for x w.r.t. x_L + c_vec = static_cast(GetRawPtr(ip_cq->curr_slack_x_L())); + // cppcheck-suppress assertWithSideEffect + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_cq->curr_slack_x_L())) != NULL); + SmartPtr slack_x_L = c_vec->GetComp(0); + DBG_ASSERT(IsValid(slack_x_L)); + + // calculate complementarity for x_L + SmartPtr compl_x_L_v = slack_x_L->MakeNewCopy(); + compl_x_L_v->ElementWiseMultiply(*z_L_only); + + // unscale, if desired + compl_x_L_v->Scal(obj_unscal); + + compl_x_L = compl_x_L_v; + } + DBG_ASSERT(IsValid(compl_x_L)); + + DBG_ASSERT(dynamic_cast(GetRawPtr(compl_x_L)) != NULL); + return static_cast(GetRawPtr(compl_x_L)); +} + +static +SmartPtr curr_compl_x_U( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr compl_x_U; + + Number obj_unscal = scaled ? 1.0 : orignlp->NLP_scaling()->unapply_obj_scaling(1.0); + + if( restonlp == NULL ) + { + compl_x_U = ip_cq->curr_compl_x_U(); + if( obj_unscal != 1.0 ) + { + SmartPtr tmp = compl_x_U->MakeNewCopy(); + tmp->Scal(obj_unscal); + compl_x_U = tmp; + } + } + else + { + // get duals z_U for x from the compound vector for the duals of (x,nc,pc,nd,pd,...) + const CompoundVector* c_vec = static_cast(GetRawPtr(ip_data->curr()->z_U())); + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_data->curr()->z_U())) != NULL); + SmartPtr z_U_only = c_vec->GetComp(0); + DBG_ASSERT(IsValid(z_U_only)); + + // get slacks for x w.r.t. x_U + c_vec = static_cast(GetRawPtr(ip_cq->curr_slack_x_U())); + // cppcheck-suppress assertWithSideEffect + DBG_ASSERT(dynamic_cast(GetRawPtr(ip_cq->curr_slack_x_U())) != NULL); + SmartPtr slack_x_U = c_vec->GetComp(0); + DBG_ASSERT(IsValid(slack_x_U)); + + // calculate complementarity for x_U + SmartPtr compl_x_U_v = slack_x_U->MakeNewCopy(); + compl_x_U_v->ElementWiseMultiply(*z_U_only); + + // unscale, if desired + compl_x_U_v->Scal(obj_unscal); + + compl_x_U = compl_x_U_v; + } + DBG_ASSERT(IsValid(compl_x_U)); + + DBG_ASSERT(dynamic_cast(GetRawPtr(compl_x_U)) != NULL); + return static_cast(GetRawPtr(compl_x_U)); +} + +static +SmartPtr curr_grad_lag_x( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + OrigIpoptNLP* orignlp, + RestoIpoptNLP* restonlp, + bool scaled +) +{ + SmartPtr grad; + + if( restonlp == NULL ) + { + grad = ip_cq->curr_grad_lag_x(); + } + else + { + // get grad f(x), this is likely going to reevaluate + SmartPtr tmp = orignlp->grad_f(*curr_x(ip_data, ip_cq, orignlp, restonlp, true))->MakeNewCopy(); + + // add y_c^T jac_c + SmartPtr resto_c_part = ip_cq->curr_jac_cT_times_curr_y_c(); + DBG_ASSERT(dynamic_cast(GetRawPtr(resto_c_part)) != NULL); + const CompoundVector* c_vec = static_cast(GetRawPtr(resto_c_part)); + tmp->Axpy(1.0, *c_vec->GetComp(0)); + + // add y_d^T jac_d + SmartPtr resto_d_part = ip_cq->curr_jac_dT_times_curr_y_d(); + DBG_ASSERT(dynamic_cast(GetRawPtr(resto_d_part)) != NULL); + c_vec = static_cast(GetRawPtr(resto_d_part)); + tmp->Axpy(1.0, *c_vec->GetComp(0)); + + // add -z_L + SmartPtr z_L = curr_z_L(ip_data, ip_cq, orignlp, restonlp, true); + orignlp->Px_L()->MultVector(-1., *z_L, 1., *tmp); + + // add z_U + SmartPtr z_U = curr_z_U(ip_data, ip_cq, orignlp, restonlp, true); + orignlp->Px_U()->MultVector(1., *z_U, 1., *tmp); + + grad = ConstPtr(tmp); + } + DBG_ASSERT(IsValid(grad)); + + if( !scaled ) + { + // adapted from IpoptCalculatedQuantities::unscaled_curr_dual_infeasibility() + grad = orignlp->NLP_scaling()->unapply_grad_obj_scaling(grad); + } + + DBG_ASSERT(dynamic_cast(GetRawPtr(grad)) != NULL); + return static_cast(GetRawPtr(grad)); +} + +bool TNLP::get_curr_iterate( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + bool scaled, + Index n, + Number* x, + Number* z_L, + Number* z_U, + Index m, + Number* g, + Number* lambda +) const +{ + if( ip_data == NULL || !IsValid(ip_data->curr()) ) + { + return false; + } + if( ip_cq == NULL ) + { + return false; + } + + Ipopt::OrigIpoptNLP* orignlp; + Ipopt::RestoIpoptNLP* restonlp = NULL; + TNLPAdapter* tnlp_adapter; + Index n_full; + Index m_full; + + // check whether we use a OrigIpoptNLP + orignlp = dynamic_cast(GetRawPtr(ip_cq->GetIpoptNLP())); + if( orignlp == NULL ) + { + // check whether we are in restoration phase, so get a RestoIpoptNLP + restonlp = dynamic_cast(GetRawPtr(ip_cq->GetIpoptNLP())); + + if( restonlp == NULL ) + // if it is neither OrigIpoptNLP nor RestoIpoptNLP, then we don't know how to retrieve x + { + return false; + } + + if( (orignlp = dynamic_cast(&restonlp->OrigIpNLP())) == NULL ) + { + return false; + } + } + + tnlp_adapter = dynamic_cast(GetRawPtr(orignlp->nlp())); + if( tnlp_adapter == NULL ) + { + return false; + } + + tnlp_adapter->GetFullDimensions(n_full, m_full); + if( n != n_full && (x != NULL || (z_L != NULL && z_U != NULL)) ) + { + THROW_EXCEPTION(IpoptException, "Incorrect dimension of x given to TNLP::get_curr_iterate().\n"); + } + if( m != m_full && (lambda != NULL || g != NULL) ) + { + THROW_EXCEPTION(IpoptException, "Incorrect dimension of g(x) given to TNLP::get_curr_iterate().\n"); + } + + SmartPtr intern_x; + SmartPtr intern_y_c; + SmartPtr intern_y_d; + + if( x != NULL || (z_L != NULL && z_U != NULL) ) + { + intern_x = curr_x(ip_data, ip_cq, orignlp, restonlp, scaled); + } + + if( (z_L != NULL && z_U != NULL) || lambda != NULL ) + { + intern_y_c = curr_y_c(ip_data, ip_cq, orignlp, restonlp, scaled); + intern_y_d = curr_y_d(ip_data, ip_cq, orignlp, restonlp, scaled); + } + + // resort Ipopt-internal x to TNLP-version of x, i.e., reinsert fixed variables + if( x != NULL ) + { + tnlp_adapter->ResortX(*intern_x, x); + } + + // resort Ipopt-internal variable duals to TNLP-version + if( z_L != NULL && z_U != NULL ) + { + Index n_x_fixed; + Index* x_fixed_map; + TNLPAdapter::FixedVariableTreatmentEnum fixed_variable_treatment; + tnlp_adapter->GetFixedVariables(n_x_fixed, x_fixed_map, fixed_variable_treatment); + + if( !scaled || n_x_fixed == 0 || fixed_variable_treatment != TNLPAdapter::MAKE_PARAMETER ) + tnlp_adapter->ResortBoundMultipliers( + *intern_x, *intern_y_c, *intern_y_d, + *curr_z_L(ip_data, ip_cq, orignlp, restonlp, scaled), z_L, + *curr_z_U(ip_data, ip_cq, orignlp, restonlp, scaled), z_U); + else + { + // ResortBoundMultipliers() doesn't work for scaled input on x, y_c, and y_d in this case + // so we pass on unscaled values of x, y_c, and y_d and then scale entries of z_L and z_U for fixed vars manually + tnlp_adapter->ResortBoundMultipliers( + *curr_x(ip_data, ip_cq, orignlp, restonlp, false), + *curr_y_c(ip_data, ip_cq, orignlp, restonlp, false), + *curr_y_d(ip_data, ip_cq, orignlp, restonlp, false), + *curr_z_L(ip_data, ip_cq, orignlp, restonlp, true), z_L, + *curr_z_U(ip_data, ip_cq, orignlp, restonlp, true), z_U); + Number obj_scal = orignlp->NLP_scaling()->apply_obj_scaling(1.0); + if( obj_scal != 1.0 ) + for( Index i = 0; i < n_x_fixed; ++i ) + { + if( obj_scal > 0.0 ) + { + z_L[x_fixed_map[i]] *= obj_scal; + z_U[x_fixed_map[i]] *= obj_scal; + } + else + { + // need to swap between z_L and z_U in this case + Number tmp = -z_L[x_fixed_map[i]] * obj_scal; + z_L[x_fixed_map[i]] = -z_U[x_fixed_map[i]] * obj_scal; + z_U[x_fixed_map[i]] = tmp; + } + } + } + } + + // resort Ipopt-interval constraint activity to TNLP-version + if( g != NULL ) + { + if( !scaled || !orignlp->NLP_scaling()->have_c_scaling() ) + { + tnlp_adapter->ResortG(*curr_c(ip_data, ip_cq, orignlp, restonlp, scaled), *curr_d(ip_data, ip_cq, orignlp, restonlp, scaled), g, true); + } + else + { + // scaled: add c(x) + c_rhs here, so we can scale c_rhs first + SmartPtr c_scaled = curr_c(ip_data, ip_cq, orignlp, restonlp, true); + + SmartPtr c_rhs = new DenseVector(new DenseVectorSpace(c_scaled->Dim())); + c_rhs->SetValues(tnlp_adapter->GetC_Rhs()); + SmartPtr c_rhs_scaled = orignlp->NLP_scaling()->apply_vector_scaling_c_NonConst(c_rhs); + + c_rhs_scaled->Axpy(1.0, *c_scaled); // c(x) + c_rhs = g(x) (scaled) + + tnlp_adapter->ResortG(*c_rhs_scaled, *curr_d(ip_data, ip_cq, orignlp, restonlp, scaled), g); + } + } + + // resort Ipopt-internal constraint duals to TNLP-version + if( lambda != NULL ) + { + tnlp_adapter->ResortG(*intern_y_c, *intern_y_d, lambda); + } + + return true; +} + +bool TNLP::get_curr_violations( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + bool scaled, + Index n, + Number* x_L_violation, + Number* x_U_violation, + Number* compl_x_L, + Number* compl_x_U, + Number* grad_lag_x, + Index m, + Number* nlp_constraint_violation, + Number* compl_g +) const +{ + if( ip_data == NULL || !IsValid(ip_data->curr()) ) + { + return false; + } + if( ip_cq == NULL ) + { + return false; + } + + Ipopt::OrigIpoptNLP* orignlp; + Ipopt::RestoIpoptNLP* restonlp = NULL; + TNLPAdapter* tnlp_adapter; + Index n_full; + Index m_full; + + // check whether we use a OrigIpoptNLP + orignlp = dynamic_cast(GetRawPtr(ip_cq->GetIpoptNLP())); + if( orignlp == NULL ) + { + // check whether we are in restoration phase, so get a RestoIpoptNLP + restonlp = dynamic_cast(GetRawPtr(ip_cq->GetIpoptNLP())); + + if( restonlp == NULL ) + // if it is neither OrigIpoptNLP nor RestoIpoptNLP, then we don't know how to retrieve x + { + return false; + } + + if( (orignlp = dynamic_cast(&restonlp->OrigIpNLP())) == NULL ) + { + return false; + } + } + + tnlp_adapter = dynamic_cast(GetRawPtr(orignlp->nlp())); + if( tnlp_adapter == NULL ) + { + return false; + } + + tnlp_adapter->GetFullDimensions(n_full, m_full); + if( n != n_full && (x_L_violation != NULL || x_U_violation != NULL || compl_x_L != NULL || compl_x_U != NULL || grad_lag_x != NULL) ) + { + THROW_EXCEPTION(IpoptException, "Incorrect dimension of x given to TNLP::get_curr_violations().\n"); + } + if( m != m_full && (nlp_constraint_violation != NULL || compl_g != NULL) ) + { + THROW_EXCEPTION(IpoptException, "Incorrect dimension of g(x) given to TNLP::get_curr_violations().\n"); + } + + Index n_x_fixed; + Index* x_fixed_map; + TNLPAdapter::FixedVariableTreatmentEnum fixed_variable_treatment; + tnlp_adapter->GetFixedVariables(n_x_fixed, x_fixed_map, fixed_variable_treatment); + + if( x_L_violation != NULL || x_U_violation != NULL ) + { + tnlp_adapter->ResortBounds(*curr_x_L_viol(ip_data, ip_cq, orignlp, restonlp, scaled), x_L_violation, + *curr_x_U_viol(ip_data, ip_cq, orignlp, restonlp, scaled), x_U_violation); + + if( n_x_fixed > 0 && fixed_variable_treatment == TNLPAdapter::MAKE_CONSTRAINT ) + { + // if fixed vars are treated as parameters, then they have no bounds in the OrigIpoptNLP + // but bound violations should correspond to violation at end of c(x)=0 + SmartPtr c = curr_c(ip_data, ip_cq, orignlp, restonlp, scaled); + for( Index i = 0; i < n_x_fixed; ++i ) + { + Number viol; + if( c->IsHomogeneous() ) + { + viol = c->Scalar(); + } + else + { + viol = c->Values()[c->Dim() - n_x_fixed + i]; + } + if( x_L_violation != NULL ) + { + x_L_violation[x_fixed_map[i]] = Max(Number(0.), -viol); // x - xfix < 0 + } + if( x_U_violation != NULL ) + { + x_U_violation[x_fixed_map[i]] = Max(Number(0.), viol); // x - xfix > 0 + } + } + } + } + + if( compl_x_L != NULL || compl_x_U != NULL ) + { + // this should give XZe from (5) + tnlp_adapter->ResortBounds(*curr_compl_x_L(ip_data, ip_cq, orignlp, restonlp, scaled), compl_x_L, + *curr_compl_x_U(ip_data, ip_cq, orignlp, restonlp, scaled), compl_x_U); + + if( n_x_fixed > 0 && fixed_variable_treatment == TNLPAdapter::MAKE_CONSTRAINT ) + { + // compl_x_L = z_L * c(x) = y_c^- * c(x) + // compl_x_U = z_U * (-c(x)) = -y_c^+ * c(x) + + SmartPtr y_c = curr_y_c(ip_data, ip_cq, orignlp, restonlp, scaled); + SmartPtr yc_pos = y_c->MakeNewCopy(); + SmartPtr yc_neg = y_c->MakeNewCopy(); + SmartPtr zero = yc_pos->MakeNew(); + zero->Set(0.); + yc_pos->ElementWiseMax(*zero); // y_c^+ + yc_neg->ElementWiseMin(*zero); // -y_c^- + + SmartPtr c = curr_c(ip_data, ip_cq, orignlp, restonlp, scaled); + yc_pos->ElementWiseMultiply(*c); // y_c^+ * c(x) + yc_neg->ElementWiseMultiply(*c); // -y_c^- * c(x) + + DBG_ASSERT(dynamic_cast(GetRawPtr(yc_pos)) != NULL); + DBG_ASSERT(dynamic_cast(GetRawPtr(yc_neg)) != NULL); + Number* yc_pos_val = static_cast(GetRawPtr(yc_pos))->ExpandedValues(); + Number* yc_neg_val = static_cast(GetRawPtr(yc_neg))->ExpandedValues(); + for( Index i = 0; i < n_x_fixed; ++i ) + { + if( compl_x_L != NULL ) + { + compl_x_L[x_fixed_map[i]] = -yc_neg_val[yc_neg->Dim() - n_x_fixed + i]; + } + if( compl_x_U != NULL ) + { + compl_x_U[x_fixed_map[i]] = -yc_pos_val[yc_pos->Dim() - n_x_fixed + i]; + } + } + } + } + + if( grad_lag_x != NULL ) + { + // this will set the derivative of the Lagrangian w.r.t. fixed variables to 0 if fixed_variable_treatment is make_parameter(_nodual) + // since the actual values are not computed within Ipopt + // but for fixed_variable_treatment=make_parameter, the bound multipliers (z_L and z_U) are computed by TNLP::ResortBoundMultipliers() + // such that the Gradient of the Lagrangian will be zero, so leaving them at 0 is correct here + tnlp_adapter->ResortX(*curr_grad_lag_x(ip_data, ip_cq, orignlp, restonlp, scaled), grad_lag_x, false); + + // if fixed_variable_treatment is make_constraint, then fixed variable contribute y_c*x to the Lagrangian + // however, we want to get -z_L + z_U + // using z_L = -y_c^-, z_U = y_c^+, this means to add -z_L + z_U - y_c x = y_c - y_c x = y_c (1-x) + if( n_x_fixed > 0 && fixed_variable_treatment == TNLPAdapter::MAKE_CONSTRAINT ) + { + SmartPtr y_c = curr_y_c(ip_data, ip_cq, orignlp, restonlp, scaled); + const Number* c_rhs = tnlp_adapter->GetC_Rhs(); + DBG_ASSERT(y_c->Dim() >= n_x_fixed); + if( y_c->IsHomogeneous() ) + for( Index i = 0; i < n_x_fixed; ++i ) + { + grad_lag_x[x_fixed_map[i]] += y_c->Scalar() * (1.0 - c_rhs[y_c->Dim() - n_x_fixed + i]); + } + else + for( Index i = 0; i < n_x_fixed; ++i ) + { + grad_lag_x[x_fixed_map[i]] += y_c->Values()[y_c->Dim() - n_x_fixed + i] * (1.0 - c_rhs[y_c->Dim() - n_x_fixed + i]); + } + } + } + + if( nlp_constraint_violation != NULL || compl_g != NULL ) + { + // adapted from IpoptCalculatedQuantities::curr_(unscaled_)nlp_constraint_violation + + SmartPtr c = curr_c(ip_data, ip_cq, orignlp, restonlp, scaled); + SmartPtr d = curr_d(ip_data, ip_cq, orignlp, restonlp, true); + + // violation of d_L <= d(x) -> compute d_L - d first + SmartPtr d_viol_L; + SmartPtr d_L; + d_L = orignlp->orig_d_L(); + if( IsValid(d_L) ) + { + // orig_d_L is unscaled, but we need the scaled one below (because d is scaled) + if( orignlp->NLP_scaling()->have_d_scaling() ) + { + d_L = orignlp->NLP_scaling()->apply_vector_scaling_d_NonConst(d_L); + } + } + else // if no relaxation, then orig_d_L() returns NULL, use d_L instead + { + d_L = orignlp->d_L(); + } + if( d_L->Dim() > 0 ) + { + SmartPtr tmp = d_L->MakeNewCopy(); + d_viol_L = d->MakeNew(); + d_viol_L->Set(0.); + + orignlp->Pd_L()->TransMultVector(-1., *d, 1., *tmp); // tmp := -P^Td + d_L, scaled + orignlp->Pd_L()->MultVector(1., *tmp, 0., *d_viol_L); // d_viol_L := P(d_L - P^Td), scaled + if( !scaled && orignlp->NLP_scaling()->have_d_scaling() ) + { + d_viol_L = orignlp->NLP_scaling()->unapply_vector_scaling_d_NonConst(ConstPtr(d_viol_L)); + } + } + else + { + d_viol_L = d->MakeNew(); + d_viol_L->Set(0.); + } + + // violation of d(x) <= d_U -> compute d - d_U first + SmartPtr d_viol_U; + SmartPtr d_U; + d_U = orignlp->orig_d_U(); + if( IsValid(d_U) ) + { + // orig_d_U is unscaled, but we need the scaled one below (because d is scaled) + if( orignlp->NLP_scaling()->have_d_scaling() ) + { + d_U = orignlp->NLP_scaling()->apply_vector_scaling_d_NonConst(d_U); + } + } + else // if no relaxation, then orig_d_U() returns NULL, use d_U instead + { + d_U = orignlp->d_U(); + } + if( d_U->Dim() > 0 ) + { + SmartPtr tmp = d_U->MakeNewCopy(); + d_viol_U = d->MakeNew(); + d_viol_U->Set(0.); + orignlp->Pd_U()->TransMultVector(1., *d, -1., *tmp); // tmp := P^Td - d_U, scaled + orignlp->Pd_U()->MultVector(1., *tmp, 0., *d_viol_U); // d_viol_U := P(P^Td - d_U), scaled + if( !scaled && orignlp->NLP_scaling()->have_d_scaling() ) + { + d_viol_U = orignlp->NLP_scaling()->unapply_vector_scaling_d_NonConst(ConstPtr(d_viol_U)); + } + } + else + { + d_viol_U = d->MakeNew(); + d_viol_U->Set(0.); + } + + // c(x) = 0, d_L <= d(x) <= d_U should result in complementarities + // y_c*c(x), (d(x)-d_L)*y_d^-, (d_U-d(x))*y_d^+, where y_d^+ = max(0,y_d), y_d^- = max(0,-y_d) (I took the signs from TNLPAdapter::ResortBoundMultipliers) + // we will merge the latter two into one vector, taking the nonzero entries, i.e., (d(x)-d_L)*y_d^- + (d_U-d(x))*y_d^+ + // to be consistent, it looks like we need to negate for 0 <= c(x) <= 0, since c(x)*y_c^- + (-c(x))*y_c^+ = c(x)*(y_c^- - y_c^+) = -c(x)*y_c + if( compl_g != NULL ) + { + SmartPtr y_d = curr_y_d(ip_data, ip_cq, orignlp, restonlp, scaled); + + SmartPtr yd_pos = y_d->MakeNewCopy(); + SmartPtr yd_neg = y_d->MakeNewCopy(); + SmartPtr zero = yd_pos->MakeNew(); + zero->Set(0.); + yd_pos->ElementWiseMax(*zero); + yd_neg->ElementWiseMin(*zero); // -y_d^- + + yd_pos->ElementWiseMultiply(*d_viol_U); // (d(x)-d_U) * y_d^+ + yd_neg->ElementWiseMultiply(*d_viol_L); // (d_L-d(x)) * (-y_d^-) + + yd_neg->Axpy(-1.0, *yd_pos); // (d(x)-d_L) * y_d^- + (d_U-d(x)) * y_d^+ + + SmartPtr y_c = curr_y_c(ip_data, ip_cq, orignlp, restonlp, scaled); + + SmartPtr c_compl = c->MakeNewCopy(); + c_compl->ElementWiseMultiply(*y_c); // c(x)*y_c + c_compl->Scal(-1.0); // -c(x)*y_c + + tnlp_adapter->ResortG(*c_compl, *yd_neg, compl_g); + } + + if( nlp_constraint_violation != NULL ) + { + // violation of c(x) = 0 + SmartPtr c_viol = c->MakeNewCopy(); + c_viol->ElementWiseAbs(); // |c(x)| + + // violation of d_L <= d(x) <= d_U: d_viol_L := max(d_viol_L, d_viol_U, 0) + d_viol_L->ElementWiseMax(*d_viol_U); + SmartPtr tmp = d_viol_L->MakeNew(); + tmp->Set(0.); + d_viol_L->ElementWiseMax(*tmp); + + tnlp_adapter->ResortG(*c_viol, *d_viol_L, nlp_constraint_violation); + } + } + + return true; +} + +} // namespace Ipopt diff --git a/src/Interfaces/IpTNLP.hpp b/src/Interfaces/IpTNLP.hpp index d493adff6..36302ff52 100644 --- a/src/Interfaces/IpTNLP.hpp +++ b/src/Interfaces/IpTNLP.hpp @@ -7,6 +7,7 @@ #ifndef __IPTNLP_HPP__ #define __IPTNLP_HPP__ +#include "IpoptConfig.h" #include "IpUtils.hpp" #include "IpReferenced.hpp" #include "IpException.hpp" @@ -27,20 +28,19 @@ class IteratesVector; * This is the standard base class for all NLP's that use the standard triplet matrix * form and dense vectors. * The class TNLPAdapter then converts this interface to an interface that can be used - * directly by \Ipopt. + * directly by %Ipopt. * * This interface presents the problem form: - * - * min f(x) - * - * s.t. gL <= g(x) <= gU - * - * xL <= x <= xU - * - * In order to specify an equality constraint, set gL_i = gU_i = rhs. + * \f{eqnarray*} + * \mathrm{min} && f(x) \\ + * \mathrm{s.t.} && g_L \leq g(x) \leq g_U \\ + * && x_L \leq x \leq x_U + * \f} + * In order to specify an equality constraint, set \f$g_{L,i} = g_{U,i}\f$. * The value that indicates "infinity" for the bounds * (i.e. the variable or constraint has no lower bound (-infinity) or upper bound (+infinity)) - * is set through the option nlp_lower_bound_inf and nlp_upper_bound_inf, respectively. + * is set through the option \ref OPT_nlp_lower_bound_inf "nlp_lower_bound_inf" and + * \ref OPT_nlp_upper_bound_inf "nlp_upper_bound_inf", respectively. * To indicate that a variable has no upper or lower bound, set the bound to * -ipopt_inf or +ipopt_inf, respectively. */ @@ -56,19 +56,20 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject }; /**@name Constructors/Destructors */ - //@{ + ///@{ TNLP() { } /** Default destructor */ virtual ~TNLP() { } - //@} + ///@} DECLARE_STD_EXCEPTION(INVALID_TNLP); - /**@name methods to gather information about the NLP */ - //@{ + typedef std::map > StringMetaDataMapType; + typedef std::map > IntegerMetaDataMapType; + typedef std::map > NumericMetaDataMapType; enum IndexStyleEnum { @@ -76,9 +77,12 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject FORTRAN_STYLE = 1 }; + /**@name Methods to gather information about the NLP */ + ///@{ + /** Method to request the initial information about the problem. * - * \Ipopt uses this information when allocating the arrays + * %Ipopt uses this information when allocating the arrays * that it will later ask you to fill with values. Be careful in this * method since incorrect values will cause memory bugs which may be very * difficult to find. @@ -101,22 +105,18 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject ) = 0; // [TNLP_get_nlp_info] - typedef std::map > StringMetaDataMapType; - typedef std::map > IntegerMetaDataMapType; - typedef std::map > NumericMetaDataMapType; - /** Method to request meta data for the variables and the constraints. * * This method is used to pass meta data about variables or constraints to - * \Ipopt. The data can be either of integer, numeric, or string type. - * \Ipopt passes this data on to its internal problem representation. + * %Ipopt. The data can be either of integer, numeric, or string type. + * %Ipopt passes this data on to its internal problem representation. * The meta data type is a std::map with std::string as key type and - * a std::vector as value type. So far, \Ipopt itself makes only use of + * a std::vector as value type. So far, %Ipopt itself makes only use of * string meta data under the key idx_names. With this key, variable - * and constraint names can be passed to \Ipopt, which are shown when - * printing internal vector or matrix data structures if \Ipopt is run + * and constraint names can be passed to %Ipopt, which are shown when + * printing internal vector or matrix data structures if %Ipopt is run * with a high value for the option. This allows a user to identify - * the original variables and constraints corresponding to \Ipopt's + * the original variables and constraints corresponding to %Ipopt's * internal problem representation. * * If this method is not overloaded, the default implementation does @@ -160,9 +160,9 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject * The values of `n` and `m` that were specified in TNLP::get_nlp_info are passed * here for debug checking. Setting a lower bound to a value less than or * equal to the value of the option \ref OPT_nlp_lower_bound_inf "nlp_lower_bound_inf" - * will cause \Ipopt to assume no lower bound. Likewise, specifying the upper bound above or + * will cause %Ipopt to assume no lower bound. Likewise, specifying the upper bound above or * equal to the value of the option \ref OPT_nlp_upper_bound_inf "nlp_upper_bound_inf" - * will cause \Ipopt to assume no upper bound. These options are set to -1019 and + * will cause %Ipopt to assume no upper bound. These options are set to -1019 and * 1019, respectively, by default, but may be modified by changing these * options. */ @@ -186,18 +186,18 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject * The return value should be true, unless an error occurred, and the * program is to be aborted. * - * The value returned in obj_scaling determines, how \Ipopt + * The value returned in obj_scaling determines, how %Ipopt * should internally scale the objective function. For example, if this - * number is chosen to be 10, then \Ipopt solves internally an + * number is chosen to be 10, then %Ipopt solves internally an * optimization problem that has 10 times the value of the original * objective function provided by the TNLP. In particular, if this value - * is negative, then \Ipopt will maximize the objective function instead + * is negative, then %Ipopt will maximize the objective function instead * of minimizing it. * * The scaling factors for the variables can be returned in x_scaling, * which has the same length as x in the other TNLP methods, and the * factors are ordered like x. use_x_scaling needs to be set to true, - * if \Ipopt should scale the variables. If it is false, no internal + * if %Ipopt should scale the variables. If it is false, no internal * scaling of the variables is done. Similarly, the scaling factors * for the constraints can be returned in g_scaling, and this * scaling is activated by setting use_g_scaling to true. @@ -231,9 +231,9 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject /** Method to request the variables linearity. * - * This method is never called by \Ipopt, but is used by Bonmin + * This method is never called by %Ipopt, but is used by Bonmin * to get information about which variables occur only in linear terms. - * \Ipopt passes the array var_types of length at least n, which should + * %Ipopt passes the array var_types of length at least n, which should * be filled with the appropriate linearity type of the variables * (TNLP::LINEAR or TNLP::NON_LINEAR). * @@ -253,9 +253,9 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject /** Method to request the constraints linearity. * - * This method is never called by \Ipopt, but is used by Bonmin + * This method is never called by %Ipopt, but is used by Bonmin * to get information about which constraints are linear. - * \Ipopt passes the array const_types of size m, which should be filled + * %Ipopt passes the array const_types of size m, which should be filled * with the appropriate linearity type of the constraints * (TNLP::LINEAR or TNLP::NON_LINEAR). * @@ -290,7 +290,7 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject * The boolean variables indicate whether the algorithm requires to * have x, z_L/z_u, and lambda initialized, respectively. If, for some * reason, the algorithm requires initializations that cannot be - * provided, false should be returned and \Ipopt will stop. + * provided, false should be returned and %Ipopt will stop. * The default options only require initial values for the primal * variables \f$x\f$. * @@ -311,8 +311,8 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject ) = 0; // [TNLP_get_starting_point] - /** Method to provide an \Ipopt warm start iterate which is already in the - * form \Ipopt requires it internally for warm starts. + /** Method to provide an %Ipopt warm start iterate which is already in the + * form %Ipopt requires it internally for warm starts. * * This method is only for expert users. * The default implementation does not provide a warm start iterate @@ -320,7 +320,7 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject */ // [TNLP_get_warm_start_iterate] virtual bool get_warm_start_iterate( - IteratesVector& warm_start_iterate /**< storage for warm start iterate in the form \Ipopt requires it internally */ + IteratesVector& warm_start_iterate /**< storage for warm start iterate in the form %Ipopt requires it internally */ ) { (void) warm_start_iterate; @@ -334,7 +334,7 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject * @param x (in) the values for the primal variables \f$x\f$ at which the objective function \f$f(x)\f$ is to be evaluated * @param new_x (in) false if any evaluation method (`eval_*`) was previously called with the same values in x, true otherwise. * This can be helpful when users have efficient implementations that calculate multiple outputs at once. - * \Ipopt internally caches results from the TNLP and generally, this flag can be ignored. + * %Ipopt internally caches results from the TNLP and generally, this flag can be ignored. * @param obj_value (out) storage for the value of the objective function \f$f(x)\f$ * * @return true if success, false otherwise. @@ -408,10 +408,10 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject * * @note The arrays iRow and jCol only need to be filled once. * If the iRow and jCol arguments are not NULL (first call to this function), - * then \Ipopt expects that the sparsity structure of the Jacobian + * then %Ipopt expects that the sparsity structure of the Jacobian * (the row and column indices only) are written into iRow and jCol. * At this call, the arguments `x` and `values` will be NULL. - * If the arguments `x` and `values` are not NULL, then \Ipopt + * If the arguments `x` and `values` are not NULL, then %Ipopt * expects that the value of the Jacobian as calculated from array `x` * is stored in array `values` (using the same order as used when * specifying the sparsity structure). @@ -432,7 +432,7 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject /** Method to request either the sparsity structure or the values of the Hessian of the Lagrangian. * - * The Hessian matrix that \Ipopt uses is + * The Hessian matrix that %Ipopt uses is * \f[ \sigma_f \nabla^2 f(x_k) + \sum_{i=1}^m\lambda_i\nabla^2 g_i(x_k) \f] * for the given values for \f$x\f$, \f$\sigma_f\f$, and \f$\lambda\f$. * See \ref TRIPLET for a discussion of the sparse matrix format used in this method. @@ -453,16 +453,16 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject * * @note The arrays iRow and jCol only need to be filled once. * If the iRow and jCol arguments are not NULL (first call to this function), - * then \Ipopt expects that the sparsity structure of the Hessian + * then %Ipopt expects that the sparsity structure of the Hessian * (the row and column indices only) are written into iRow and jCol. * At this call, the arguments `x`, `lambda`, and `values` will be NULL. - * If the arguments `x`, `lambda`, and `values` are not NULL, then \Ipopt + * If the arguments `x`, `lambda`, and `values` are not NULL, then %Ipopt * expects that the value of the Hessian as calculated from arrays `x` * and `lambda` are stored in array `values` (using the same order as * used when specifying the sparsity structure). * At this call, the arguments `iRow` and `jCol` will be NULL. * - * @attention As this matrix is symmetric, \Ipopt expects that only the lower diagonal entries are specified. + * @attention As this matrix is symmetric, %Ipopt expects that only the lower diagonal entries are specified. * * A default implementation is provided, in case the user * wants to set quasi-Newton approximations to estimate the second @@ -497,10 +497,64 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject (void) values; return false; } - //@} + + /** @name Methods for quasi-Newton approximation. + * + * If the second derivatives are approximated by %Ipopt, it is better + * to do this only in the space of nonlinear variables. The following + * methods are call by %Ipopt if the \ref QUASI_NEWTON "quasi-Newton approximation" + * is selected. + * + * @{ + */ + + /** Return the number of variables that appear nonlinearly in the objective function or in at least one constraint function + * + * If -1 is returned as number of nonlinear variables, + * %Ipopt assumes that all variables are nonlinear. Otherwise, it + * calls get_list_of_nonlinear_variables with an array into which + * the indices of the nonlinear variables should be written - the + * array has the length num_nonlin_vars, which is identical with + * the return value of get_number_of_nonlinear_variables(). It + * is assumed that the indices are counted starting with 1 in the + * FORTRAN_STYLE, and 0 for the C_STYLE. + * + * The default implementation returns -1, i.e., + * all variables are assumed to be nonlinear. + */ + // [TNLP_get_number_of_nonlinear_variables] + virtual Index get_number_of_nonlinear_variables() + // [TNLP_get_number_of_nonlinear_variables] + { + return -1; + } + + /** Return the indices of all nonlinear variables. + * + * This method is called only if limited-memory quasi-Newton option + * is used and get_number_of_nonlinear_variables() returned a positive + * number. This number is provided in parameter num_nonlin_var. + * + * The method must store the indices of all nonlinear variables in + * pos_nonlin_vars, where the numbering starts with 0 order 1, + * depending on the numbering style determined in get_nlp_info. + */ + // [TNLP_get_list_of_nonlinear_variables] + virtual bool get_list_of_nonlinear_variables( + Index num_nonlin_vars, + Index* pos_nonlin_vars + ) + // [TNLP_get_list_of_nonlinear_variables] + { + (void) num_nonlin_vars; + (void) pos_nonlin_vars; + return false; + } + ///@} + ///@} /** @name Solution Methods */ - //@{ + ///@{ /** This method is called when the algorithm has finished (successfully or not) so the TNLP can digest the outcome, e.g., store/write the solution, if any. * * @param status @parblock (in) gives the status of the algorithm @@ -515,7 +569,7 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject * - USER_REQUESTED_STOP: The user call-back function TNLP::intermediate_callback returned false, i.e., the user code requested a premature termination of the optimization. * - DIVERGING_ITERATES: It seems that the iterates diverge. * - RESTORATION_FAILURE: Restoration phase failed, algorithm doesn't know how to proceed. - * - ERROR_IN_STEP_COMPUTATION: An unrecoverable error occurred while \Ipopt tried to compute the search direction. + * - ERROR_IN_STEP_COMPUTATION: An unrecoverable error occurred while %Ipopt tried to compute the search direction. * - INVALID_NUMBER_DETECTED: Algorithm received an invalid number (such as NaN or Inf) from the NLP; see also option check_derivatives_for_nan_inf). * - INTERNAL_ERROR: An unknown internal error occurred. * @endparblock @@ -588,71 +642,24 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject * * This method is called once per iteration (during the convergence check), * and can be used to obtain information about the optimization status while - * \Ipopt solves the problem, and also to request a premature termination. + * %Ipopt solves the problem, and also to request a premature termination. * * The information provided by the entities in the argument list correspond - * to what \Ipopt prints in the iteration summary (see also \ref OUTPUT). + * to what %Ipopt prints in the iteration summary (see also \ref OUTPUT), + * except for inf_pr, which by default corresponds to the original problem + * in the log but to the scaled internal problem in this callback. * Further information can be obtained from the ip_data and ip_cq objects. + * The current iterate and violations of feasibility and optimality can be + * accessed via the methods Ipopt::TNLP::get_curr_iterate() and + * Ipopt::TNLP::get_curr_violations(). + * These methods translate values for the *internal representation* of + * the problem from `ip_data` and `ip_cq` objects into the TNLP representation. * - * @return If this method returns false, \Ipopt will terminate with the + * @return If this method returns false, %Ipopt will terminate with the * User_Requested_Stop status. * * It is not required to implement (overload) this method. * The default implementation always returns true. - * - * A frequently asked question is how to access the values of the primal - * and dual variables in this callback. The values are stored in the `ip_cq` - * object for the *internal representation* of the problem. To access the - * values in a form that corresponds to those used in the evaluation - * routines, the user has to request \Ipopt's TNLPAdapter - * object to "resort" the data vectors and to fill in information about - * possibly filtered out fixed variables. The TNLPAdapter can be accessed - * as follows. First, add the following includes to your TNLP - * implementation: - * \code - * #include "IpIpoptCalculatedQuantities.hpp" - * #include "IpIpoptData.hpp" - * #include "IpTNLPAdapter.hpp" - * #include "IpOrigIpoptNLP.hpp" - * \endcode - * Next, add the following code to your implementation of this function: - * \code - * Ipopt::TNLPAdapter* tnlp_adapter = NULL; - * if( ip_cq != NULL ) - * { - * Ipopt::OrigIpoptNLP* orignlp; - * orignlp = dynamic_cast(GetRawPtr(ip_cq->GetIpoptNLP())); - * if( orignlp != NULL ) - * tnlp_adapter = dynamic_cast(GetRawPtr(orignlp->nlp())); - * } - * \endcode - * Note, that retrieving the TNLPAdapter will fail (i.e., `orignlp` will be NULL) - * if \Ipopt is currently in restoration mode. If, however, - * `tnlp_adapter` is not NULL, then it can be used to obtain primal variable - * values \f$x\f$ and the dual values for the constraints and the variable - * bounds as follows: - * \code - * double* primals = new double[n]; - * double* dualeqs = new double[m]; - * double* duallbs = new double[n]; - * double* dualubs = new double[n]; - * tnlp_adapter->ResortX(*ip_data->curr()->x(), primals); - * tnlp_adapter->ResortG(*ip_data->curr()->y_c(), *ip_data->curr()->y_d(), dualeqs); - * tnlp_adapter->ResortBnds(*ip_data->curr()->z_L(), duallbs, - * *ip_data->curr()->z_U(), dualubs); - * \endcode - * \note ResortBnds does not provide dual multipliers for fixed variables, even if the - * fixed-variable treatment has been set to handle them as constraints. - * - * Additionally, information about scaled violation of constraint - * and violation of complementarity constraints can be obtained via - * \code - * tnlp_adapter->ResortG(*ip_cq->curr_c(), *ip_cq->curr_d_minus_s(), ...) - * tnlp_adapter->ResortBnds(*ip_cq->curr_compl_x_L(), ..., - * *ip_cq->curr_compl_x_U(), ...) - * tnlp_adapter->ResortG(*ip_cq->curr_compl_s_L(), ...) - * tnlp_adapter->ResortG(*ip_cq->curr_compl_s_U(), ...) - * \endcode */ // [TNLP_intermediate_callback] virtual bool intermediate_callback( @@ -687,61 +694,104 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject (void) ip_cq; return true; } - //@} + ///@} - /** @name Methods for quasi-Newton approximation. - * - * If the second derivatives are approximated by \Ipopt, it is better - * to do this only in the space of nonlinear variables. The following - * methods are call by \Ipopt if the \ref QUASI_NEWTON "quasi-Newton approximation" - * is selected. - * - * @{ - */ - - /** Return the number of variables that appear nonlinearly in the objective function or in at least one constraint function - * - * If -1 is returned as number of nonlinear variables, - * \Ipopt assumes that all variables are nonlinear. Otherwise, it - * calls get_list_of_nonlinear_variables with an array into which - * the indices of the nonlinear variables should be written - the - * array has the length num_nonlin_vars, which is identical with - * the return value of get_number_of_nonlinear_variables(). It - * is assumed that the indices are counted starting with 1 in the - * FORTRAN_STYLE, and 0 for the C_STYLE. - * - * The default implementation returns -1, i.e., - * all variables are assumed to be nonlinear. + /** @name Solution Methods */ + ///@{ + /** Get primal and dual variable values of the current iterate. + * + * This method can be used to get the values of the current iterate, + * e.g., during intermediate_callback(). + * The method expects the number of variables (dimension of x), number of constraints (dimension of g(x)), + * and allocated arrays of appropriate lengths as input. + * + * The method translates the x(), c(), d(), y_c(), y_d(), z_L(), and z_U() vectors from IpoptData::curr() + * of the internal %NLP representation into the form used by the TNLP. + * For the correspondence between scaled and unscaled solutions, see the detailed description of OrigIpoptNLP. + * If %Ipopt is in restoration mode, it maps the current iterate of restoration %NLP (see RestoIpoptNLP) back to the original TNLP. + * + * If there are fixed variables and fixed_variable_treatment=make_parameter, then requesting z_L and z_U can trigger a reevaluation of + * the Gradient of the objective function and the Jacobian of the constraint functions. + * + * @param ip_data (in) Ipopt Data + * @param ip_cq (in) Ipopt Calculated Quantities + * @param scaled (in) whether to retrieve scaled or unscaled iterate + * @param n (in) the number of variables \f$x\f$ in the problem; can be arbitrary if skipping x, z_L, and z_U + * @param x (out) buffer to store value of primal variables \f$x\f$, must have length at least n; pass NULL to skip retrieving x + * @param z_L (out) buffer to store the lower bound multipliers \f$z_L\f$, must have length at least n; pass NULL to skip retrieving z_L and z_U + * @param z_U (out) buffer to store the upper bound multipliers \f$z_U\f$, must have length at least n; pass NULL to skip retrieving z_U and z_U + * @param m (in) the number of constraints \f$g(x)\f$; can be arbitrary if skipping g and lambda + * @param g (out) buffer to store the constraint values \f$g(x)\f$, must have length at least m; pass NULL to skip retrieving g + * @param lambda (out) buffer to store the constraint multipliers \f$\lambda\f$, must have length at least m; pass NULL to skip retrieving lambda + * + * @return Whether Ipopt has successfully filled the given arrays + * @since 3.14.0 */ - // [TNLP_get_number_of_nonlinear_variables] - virtual Index get_number_of_nonlinear_variables() - // [TNLP_get_number_of_nonlinear_variables] - { - return -1; - } - - /** Return the indices of all nonlinear variables. - * - * This method is called only if limited-memory quasi-Newton option - * is used and get_number_of_nonlinear_variables() returned a positive - * number. This number is provided in parameter num_nonlin_var. - * - * The method must store the indices of all nonlinear variables in - * pos_nonlin_vars, where the numbering starts with 0 order 1, - * depending on the numbering style determined in get_nlp_info. + // [TNLP_get_curr_iterate] + bool get_curr_iterate( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + bool scaled, + Index n, + Number* x, + Number* z_L, + Number* z_U, + Index m, + Number* g, + Number* lambda + ) const; + // [TNLP_get_curr_iterate] + + /** Get primal and dual infeasibility of the current iterate. + * + * This method can be used to get the violations of constraints and optimality conditions + * at the current iterate, e.g., during intermediate_callback(). + * The method expects the number of variables (dimension of x), number of constraints (dimension of g(x)), + * and allocated arrays of appropriate lengths as input. + * + * The method makes the vectors behind (unscaled_)curr_orig_bounds_violation(), (unscaled_)curr_nlp_constraint_violation(), (unscaled_)curr_dual_infeasibility(), + * (unscaled_)curr_complementarity() from IpoptCalculatedQuantities of the internal %NLP representation available into the form used by the TNLP. + * If %Ipopt is in restoration mode, it maps the current iterate of restoration %NLP (see RestoIpoptNLP) back to the original TNLP. + * + * @note If in restoration phase, then requesting grad_lag_x can trigger a call to eval_grad_f(). + * + * @note Ipopt by default relaxes variable bounds (option bound_relax_factor > 0.0). + * x_L_violation and x_U_violation report the violation of a solution w.r.t. the original unrelaxed bounds. + * However, compl_x_L and compl_x_U use the relaxed variable bounds to calculate the complementarity. + * + * @param ip_data (in) Ipopt Data + * @param ip_cq (in) Ipopt Calculated Quantities + * @param scaled (in) whether to retrieve scaled or unscaled violations + * @param n (in) the number of variables \f$x\f$ in the problem; can be arbitrary if skipping compl_x_L, compl_x_U, and grad_lag_x + * @param x_L_violation (out) buffer to store violation of original lower bounds on variables (max(orig_x_L-x,0)), must have length at least n; pass NULL to skip retrieving orig_x_L + * @param x_U_violation (out) buffer to store violation of original upper bounds on variables (max(x-orig_x_U,0)), must have length at least n; pass NULL to skip retrieving orig_x_U + * @param compl_x_L (out) buffer to store violation of complementarity for lower bounds on variables (\f$(x-x_L)z_L\f$), must have length at least n; pass NULL to skip retrieving compl_x_L + * @param compl_x_U (out) buffer to store violation of complementarity for upper bounds on variables (\f$(x_U-x)z_U\f$), must have length at least n; pass NULL to skip retrieving compl_x_U + * @param grad_lag_x (out) buffer to store gradient of Lagrangian w.r.t. variables \f$x\f$, must have length at least n; pass NULL to skip retrieving grad_lag_x + * @param m (in) the number of constraints \f$g(x)\f$; can be arbitrary if skipping lambda + * @param nlp_constraint_violation (out) buffer to store violation of constraints \f$max(g_l-g(x),g(x)-g_u,0)\f$, must have length at least m; pass NULL to skip retrieving constraint_violation + * @param compl_g (out) buffer to store violation of complementarity of constraint (\f$(g(x)-g_l)*\lambda^+ + (g_l-g(x))*\lambda^-\f$, where \f$\lambda^+=max(0,\lambda)\f$ and \f$\lambda^-=max(0,-\lambda)\f$ (componentwise)), must have length at least m; pass NULL to skip retrieving compl_g + * + * @return Whether Ipopt has successfully filled the given arrays + * @since 3.14.0 */ - // [TNLP_get_list_of_nonlinear_variables] - virtual bool get_list_of_nonlinear_variables( - Index num_nonlin_vars, - Index* pos_nonlin_vars - ) - // [TNLP_get_list_of_nonlinear_variables] - { - (void) num_nonlin_vars; - (void) pos_nonlin_vars; - return false; - } - //@} + // [TNLP_get_curr_violations] + bool get_curr_violations( + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq, + bool scaled, + Index n, + Number* x_L_violation, + Number* x_U_violation, + Number* compl_x_L, + Number* compl_x_U, + Number* grad_lag_x, + Index m, + Number* nlp_constraint_violation, + Number* compl_g + ) const; + // [TNLP_get_curr_violations] + ///@} private: /**@name Default Compiler Generated Methods @@ -752,7 +802,7 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ TNLP( const TNLP& @@ -762,7 +812,7 @@ class IPOPTLIB_EXPORT TNLP : public ReferencedObject void operator=( const TNLP& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Interfaces/IpTNLPAdapter.cpp b/src/Interfaces/IpTNLPAdapter.cpp index 72dec6fa2..ac610c2ad 100644 --- a/src/Interfaces/IpTNLPAdapter.cpp +++ b/src/Interfaces/IpTNLPAdapter.cpp @@ -25,14 +25,10 @@ #ifdef IPOPT_HAS_MUMPS # include "IpMumpsSolverInterface.hpp" #endif -#ifdef HAVE_WSMP +#ifdef IPOPT_HAS_WSMP # include "IpWsmpSolverInterface.hpp" #endif -#ifdef IPOPT_HAS_LINEARSOLVERLOADER -# include "HSLLoader.h" -#endif - #include #include #include @@ -101,34 +97,50 @@ void TNLPAdapter::RegisterOptions( "nlp_upper_bound_inf", "any bound greater or this value will be considered +inf (i.e. not upper bounded).", 1e19); - roptions->AddStringOption3( + roptions->AddStringOption4( "fixed_variable_treatment", "Determines how fixed variables should be handled.", "make_parameter", "make_parameter", "Remove fixed variable from optimization variables", + "make_parameter_nodual", "Remove fixed variable from optimization variables and do not compute bound multipliers for fixed variables", "make_constraint", "Add equality constraints fixing variables", "relax_bounds", "Relax fixing bound constraints", "The main difference between those options is that the starting point in the \"make_constraint\" case still " - "has the fixed variables at their given values, whereas in the case \"make_parameter\" the functions are always " + "has the fixed variables at their given values, whereas in the case \"make_parameter(_nodual)\" the functions are always " "evaluated with the fixed values for those variables. " "Also, for \"relax_bounds\", the fixing bound constraints are relaxed (according to\" bound_relax_factor\"). " - "For both \"make_constraints\" and \"relax_bounds\", bound multipliers are computed for the fixed variables."); - roptions->AddStringOption4( + "For all but \"make_parameter_nodual\", bound multipliers are computed for the fixed variables."); + + std::vector options; + std::vector descrs; + options.push_back("none"); + descrs.push_back("don't check; no extra work at beginning"); +#ifdef IPOPT_HAS_MUMPS + options.push_back("mumps"); + descrs.push_back("use MUMPS"); +#endif +#ifdef IPOPT_HAS_WSMP + options.push_back("wsmp"); + descrs.push_back("use WSMP"); +#endif +#if ((defined(COINHSL_HAS_MA28) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA28S) && defined(IPOPT_SINGLE))) && defined(F77_FUNC) && !defined(IPOPT_INT64) + options.push_back("ma28"); + descrs.push_back("use MA28"); +#endif + roptions->AddStringOption( "dependency_detector", "Indicates which linear solver should be used to detect linearly dependent equality constraints.", "none", - "none", "don't check; no extra work at beginning", - "mumps", "use MUMPS", - "wsmp", "use WSMP", - "ma28", "use MA28", - "The default and available choices depend on how Ipopt has been compiled. " - "This is experimental and does not work well."); - roptions->AddStringOption2( + options, + descrs, + "This is experimental and does not work well.", + true); + roptions->AddBoolOption( "dependency_detection_with_rhs", - "Indicates if the right hand sides of the constraints should be considered during dependency detection", - "no", - "no", "only look at gradients", - "yes", "also consider right hand side"); + "Indicates if the right hand sides of the constraints should be considered in addition to gradients during dependency detection", + false, + "", + true); roptions->AddLowerBoundedIntegerOption( "num_linear_variables", "Number of linear variables", @@ -136,7 +148,31 @@ void TNLPAdapter::RegisterOptions( 0, "When the Hessian is approximated, it is assumed that the first num_linear_variables variables are linear. " "The Hessian is then not approximated in this space. " - "If the get_number_of_nonlinear_variables method in the TNLP is implemented, this option is ignored."); + "If the get_number_of_nonlinear_variables method in the TNLP is implemented, this option is ignored.", + true); + roptions->AddStringOption2( + "jacobian_approximation", + "Specifies technique to compute constraint Jacobian", + "exact", + "exact", "user-provided derivatives", + "finite-difference-values", "user-provided structure, values by finite differences", + "", + true); + roptions->AddStringOption2( + "gradient_approximation", + "Specifies technique to compute objective Gradient", + "exact", + "exact", "user-provided gradient", + "finite-difference-values", "values by finite differences", + "", + true); + roptions->AddLowerBoundedNumberOption( + "findiff_perturbation", + "Size of the finite difference perturbation for derivative approximation.", + 0., true, + 1e-7, + "This determines the relative perturbation of the variable entries.", + true); roptions->SetRegisteringCategory("Derivative Checker"); roptions->AddStringOption4( @@ -171,25 +207,11 @@ void TNLPAdapter::RegisterOptions( 1e-4, "If the relative deviation of the estimated derivative from the given one is larger than this value, " "the corresponding derivative is marked as wrong."); - roptions->AddStringOption2( + roptions->AddBoolOption( "derivative_test_print_all", "Indicates whether information for all estimated derivatives should be printed.", - "no", - "no", "Print only suspect derivatives", - "yes", "Print all derivatives", + false, "Determines verbosity of derivative checker."); - roptions->AddStringOption2( - "jacobian_approximation", - "Specifies technique to compute constraint Jacobian", - "exact", - "exact", "user-provided derivatives", - "finite-difference-values", "user-provided structure, values by finite differences"); - roptions->AddLowerBoundedNumberOption( - "findiff_perturbation", - "Size of the finite difference perturbation for derivative approximation.", - 0., true, - 1e-7, - "This determines the relative perturbation of the variable entries."); roptions->AddLowerBoundedNumberOption( "point_perturbation_radius", "Maximal perturbation of an evaluation point.", @@ -233,6 +255,8 @@ bool TNLPAdapter::ProcessOptions( options.GetEnumValue("jacobian_approximation", enum_int, prefix); jacobian_approximation_ = JacobianApproxEnum(enum_int); + options.GetEnumValue("gradient_approximation", enum_int, prefix); + gradient_approximation_ = GradientApproxEnum(enum_int); options.GetNumericValue("findiff_perturbation", findiff_perturbation_, prefix); options.GetNumericValue("point_perturbation_radius", point_perturbation_radius_, prefix); @@ -242,55 +266,46 @@ bool TNLPAdapter::ProcessOptions( options.GetBoolValue("dependency_detection_with_rhs", dependency_detection_with_rhs_, prefix); std::string dependency_detector; options.GetStringValue("dependency_detector", dependency_detector, prefix); - if( dependency_detector != "none" ) - { - if( dependency_detector == "mumps" ) - { #ifdef IPOPT_HAS_MUMPS - SmartPtr SolverInterface; - SolverInterface = new MumpsSolverInterface(); - SmartPtr ScaledSolver = - new TSymLinearSolver(SolverInterface, NULL); - dependency_detector_ = new TSymDependencyDetector(*ScaledSolver); -#else - - THROW_EXCEPTION(OPTION_INVALID, - "Ipopt has not been compiled with MUMPS. You cannot choose \"mumps\" for \"dependency_detector\"."); + if( dependency_detector == "mumps" ) + { + SmartPtr SolverInterface; + SolverInterface = new MumpsSolverInterface(); + SmartPtr ScaledSolver = + new TSymLinearSolver(SolverInterface, NULL); + dependency_detector_ = new TSymDependencyDetector(*ScaledSolver); + } #endif - } - else if( dependency_detector == "wsmp" ) - { -#ifdef HAVE_WSMP - SmartPtr SolverInterface; - SolverInterface = new WsmpSolverInterface(); - SmartPtr ScaledSolver = - new TSymLinearSolver(SolverInterface, NULL); - dependency_detector_ = new TSymDependencyDetector(*ScaledSolver); +#ifdef IPOPT_HAS_WSMP + if( dependency_detector == "wsmp" ) + { + SmartPtr SolverInterface; +#ifdef PARDISO_MATCHING_PREPROCESS + std::string libname; + options.GetStringValue("pardisolib", libname, prefix); + SolverInterface = new WsmpSolverInterface(new LibraryLoader(libname)); #else - - THROW_EXCEPTION(OPTION_INVALID, - "Ipopt has not been compiled with WSMP. You cannot choose \"wsmp\" for \"dependency_detector\"."); + SolverInterface = new WsmpSolverInterface(); +#endif + SmartPtr ScaledSolver = + new TSymLinearSolver(SolverInterface, NULL); + dependency_detector_ = new TSymDependencyDetector(*ScaledSolver); + } #endif - } - else if( dependency_detector == "ma28" ) - { -#if defined(COINHSL_HAS_MA28) && defined(F77_FUNC) - dependency_detector_ = new Ma28TDependencyDetector(); -#else - THROW_EXCEPTION(OPTION_INVALID, "Ipopt has not been compiled with MA28. You cannot choose \"ma28\" for \"dependency_detector\"."); +#if ((defined(COINHSL_HAS_MA28) && !defined(IPOPT_SINGLE)) || (defined(COINHSL_HAS_MA28S) && defined(IPOPT_SINGLE))) && defined(F77_FUNC) && !defined(IPOPT_INT64) + if( dependency_detector == "ma28" ) + { + dependency_detector_ = new Ma28TDependencyDetector(); + } #endif - } - else - { - THROW_EXCEPTION(OPTION_INVALID, "Something internally wrong for \"dependency_detector\"."); - } + + if( IsValid(dependency_detector_) ) if( !dependency_detector_->ReducedInitialize(*jnlst_, options, prefix) ) { return false; } - } return true; } @@ -354,12 +369,24 @@ bool TNLPAdapter::GetSpaces( h_idx_map_ = NULL; delete[] x_fixed_map_; x_fixed_map_ = NULL; + jac_fixed_idx_map_.clear(); + jac_fixed_iRow_.clear(); + jac_fixed_jCol_.clear(); +#if __cplusplus >= 201103L + jac_fixed_idx_map_.shrink_to_fit(); + jac_fixed_iRow_.shrink_to_fit(); + jac_fixed_jCol_.shrink_to_fit(); +#endif } // Get the full dimensions of the problem Index n_full_x, n_full_g, nz_full_jac_g, nz_full_h; bool retval = tnlp_->get_nlp_info(n_full_x, n_full_g, nz_full_jac_g, nz_full_h, index_style_); ASSERT_EXCEPTION(retval, INVALID_TNLP, "get_nlp_info returned false"); + ASSERT_EXCEPTION(n_full_x >= 0, INVALID_TNLP, "number of variables negative"); + ASSERT_EXCEPTION(n_full_g >= 0, INVALID_TNLP, "number of constraints negative"); + ASSERT_EXCEPTION(nz_full_jac_g >= 0, INVALID_TNLP, "number of nonzeros in Jacobian negative"); + ASSERT_EXCEPTION(nz_full_h >= 0, INVALID_TNLP, "number of nonzeros in Hessian negative"); ASSERT_EXCEPTION( !warm_start_same_structure_ || (n_full_x == n_full_x_ && n_full_g == n_full_g_ && nz_full_jac_g == nz_full_jac_g_ @@ -407,7 +434,7 @@ bool TNLPAdapter::GetSpaces( Number* x_u = new Number[n_full_x_]; Number* g_l = new Number[n_full_g_]; Number* g_u = new Number[n_full_g_]; - bool retval = tnlp_->get_bounds_info(n_full_x_, x_l, x_u, n_full_g_, g_l, g_u); + retval = tnlp_->get_bounds_info(n_full_x_, x_l, x_u, n_full_g_, g_l, g_u); ASSERT_EXCEPTION(retval, INVALID_TNLP, "get_bounds_info returned false in GetSpaces"); //********************************************************* @@ -432,7 +459,7 @@ bool TNLPAdapter::GetSpaces( bool done = false; // We might have to do the following twice: If we detect that we - // don't have enought degrees of freedom, we simply redo + // don't have enough degrees of freedom, we simply redo // everything with fixed_variable_treatment to set RELAX_BOUNDS while( !done ) { @@ -451,6 +478,7 @@ bool TNLPAdapter::GetSpaces( switch( fixed_variable_treatment_ ) { case MAKE_PARAMETER: + case MAKE_PARAMETER_NODUAL: // Variable is fixed, remove it from the problem full_x_[i] = lower_bound; x_fixed_map_tmp[n_x_fixed_] = i; @@ -478,7 +506,7 @@ bool TNLPAdapter::GetSpaces( { char string[128]; Snprintf(string, 127, - "There are inconsistent bounds on variable %d: lower = %25.16e and upper = %25.16e.", i, lower_bound, + "There are inconsistent bounds on variable %" IPOPT_INDEX_FORMAT ": lower = %25.16e and upper = %25.16e.", i, lower_bound, upper_bound); delete[] x_l; delete[] x_u; @@ -570,7 +598,7 @@ bool TNLPAdapter::GetSpaces( delete[] d_u_map; char string[128]; Snprintf(string, 127, - "There are inconsistent bounds on constraint function %d: lower = %25.16e and upper = %25.16e.", i, + "There are inconsistent bounds on constraint function %" IPOPT_INDEX_FORMAT ": lower = %25.16e and upper = %25.16e.", i, lower_bound, upper_bound); THROW_EXCEPTION(INCONSISTENT_BOUNDS, string); } @@ -600,93 +628,11 @@ bool TNLPAdapter::GetSpaces( { fixed_variable_treatment_ = RELAX_BOUNDS; jnlst_->Printf(J_WARNING, J_INITIALIZATION, - "Too few degrees of freedom (n_x = %d, n_c = %d).\n Trying fixed_variable_treatment = RELAX_BOUNDS\n\n", + "Too few degrees of freedom (n_x = %" IPOPT_INDEX_FORMAT ", n_c = %" IPOPT_INDEX_FORMAT ").\n Trying fixed_variable_treatment = RELAX_BOUNDS\n\n", n_x_var, n_c); } } // while (!done) - if( n_x_var == 0 ) - { - // Check of all constraints are satisfied: - for( Index i = 0; i < n_full_x_; i++ ) - { - DBG_ASSERT(x_l[i] == x_u[i]); - full_x_[i] = x_l[i]; - } - bool retval = tnlp_->eval_g(n_full_x_, full_x_, true, n_full_g_, full_g_); - ASSERT_EXCEPTION(retval, IpoptNLP::Eval_Error, - "All variables are fixed, but constraints cannot be evaluated at fixed point."); - Number max_viol = 0.; - for( Index i = 0; i < n_full_g_; i++ ) - { - //printf("%d %23.16e %23.16e %23.16e\n",i,full_g_[i], g_l[i], g_u[i]); - max_viol = Max(max_viol, full_g_[i] - g_u[i], g_l[i] - full_g_[i]); - } - - SolverReturn status; - if( max_viol <= tol_ ) //ToDo: base also on (acceptable) (constraint violation) tolerance - { - status = SUCCESS; - } - else - { - status = LOCAL_INFEASIBILITY; - } - - Number obj_value; - retval = tnlp_->eval_f(n_full_x_, full_x_, false, obj_value); - ASSERT_EXCEPTION(retval, IpoptNLP::Eval_Error, - "All variables are fixed, but objective cannot be evaluated at fixed point."); - // Call finalize_solution so that user has required information - Number* full_z_L = new Number[n_full_x_]; - Number* full_z_U = new Number[n_full_x_]; - Number* full_lambda = new Number[n_full_g_]; - // For now, we return zeros as multipliers... (ToDo?) - const Number zero = 0.; - IpBlasDcopy(n_full_x_, &zero, 0, full_z_L, 1); - IpBlasDcopy(n_full_x_, &zero, 0, full_z_U, 1); - IpBlasDcopy(n_full_g_, &zero, 0, full_lambda, 1); - tnlp_->finalize_solution(status, n_full_x_, full_x_, full_z_L, full_z_U, n_full_g_, full_g_, full_lambda, - obj_value, NULL, NULL); - delete[] full_z_L; - delete[] full_z_U; - delete[] full_lambda; - - // Free memory - delete[] x_not_fixed_map; - delete[] x_l_map; - delete[] x_u_map; - delete[] c_map; - delete[] d_map; - delete[] d_l_map; - delete[] d_u_map; - delete[] x_l; - delete[] x_u; - delete[] g_l; - delete[] g_u; - - // NOTE: we have passed the primal solution to the user, but not to Ipopt - // that is, Ipopt's data object still holds none or another solution - // However, since IpoptApplication will not call finalize_solution with this point if - // it gets a NO_FREE_VARIABLES_* exception, this should be good enough. - char string[128]; - Snprintf(string, 127, "All variables are fixed, and constraint violation is %e", max_viol); - if( status == SUCCESS ) - { - jnlst_->Printf(J_WARNING, J_INITIALIZATION, - "All variables are fixed and constraint violation %e\n is below tolerance %e. Declaring success.\n", - max_viol, tol_); - THROW_EXCEPTION(NO_FREE_VARIABLES_BUT_FEASIBLE, string); - } - else - { - jnlst_->Printf(J_WARNING, J_INITIALIZATION, - "All variables are fixed and constraint violation %e\n is above tolerance %e. Declaring that problem is infeasible.\n", - max_viol, tol_); - THROW_EXCEPTION(NO_FREE_VARIABLES_AND_INFEASIBLE, string); - } - } - // If requested, check if there are linearly dependent equality // constraints if( n_c > 0 && IsValid(dependency_detector_) ) @@ -698,10 +644,10 @@ bool TNLPAdapter::GetSpaces( "Dependent constraint detector had a problem, assume full rank.\n"); } c_deps.sort(); - if( c_deps.size() > 0 ) + if( !c_deps.empty() ) { jnlst_->Printf(J_WARNING, J_INITIALIZATION, - "\nDetected %d linearly dependent equality constraints; taking those out.\n\n", c_deps.size()); + "\nDetected %zd linearly dependent equality constraints; taking those out.\n\n", c_deps.size()); } else { @@ -710,14 +656,14 @@ bool TNLPAdapter::GetSpaces( if( jnlst_->ProduceOutput(J_DETAILED, J_INITIALIZATION) ) { jnlst_->Printf(J_DETAILED, J_INITIALIZATION, "\nList of indices of dependent constraints:\n"); - int count = 0; - for( std::list::iterator i = c_deps.begin(); i != c_deps.end(); i++ ) + Index count = 0; + for( std::list::iterator i = c_deps.begin(); i != c_deps.end(); ++i ) { - jnlst_->Printf(J_DETAILED, J_INITIALIZATION, "c_dep[%d] = %d\n", count++, *i); + jnlst_->Printf(J_DETAILED, J_INITIALIZATION, "c_dep[%" IPOPT_INDEX_FORMAT "] = %" IPOPT_INDEX_FORMAT "\n", count++, *i); } jnlst_->Printf(J_DETAILED, J_INITIALIZATION, "\n"); } - if( c_deps.size() > 0 ) + if( !c_deps.empty() ) { // Take the dependent constraints out. // We assume that the list in c_dep is sorted @@ -727,7 +673,7 @@ bool TNLPAdapter::GetSpaces( { if( i == *idep ) { - idep++; + ++idep; } else { @@ -749,7 +695,7 @@ bool TNLPAdapter::GetSpaces( // to zero (could do only for dependent ones... was too lazy // right now) const Number zero = 0.; - IpBlasDcopy(n_full_g_, &zero, 0, full_lambda_, 1); + IpBlasCopy(n_full_g_, &zero, 0, full_lambda_, 1); } } delete[] x_l; @@ -765,7 +711,7 @@ bool TNLPAdapter::GetSpaces( SmartPtr dv_x_u_space = new DenseVectorSpace(n_x_u); x_u_space_ = GetRawPtr(dv_x_u_space); - if( n_x_fixed_ > 0 && fixed_variable_treatment_ == MAKE_PARAMETER ) + if( n_x_fixed_ > 0 && (fixed_variable_treatment_ == MAKE_PARAMETER || fixed_variable_treatment_ == MAKE_PARAMETER_NODUAL) ) { P_x_full_x_space_ = new ExpansionMatrixSpace(n_full_x_, n_x_var, x_not_fixed_map); P_x_full_x_ = P_x_full_x_space_->MakeNewExpansionMatrix(); @@ -786,8 +732,7 @@ bool TNLPAdapter::GetSpaces( // setup the variable meta data if present if( var_string_md.size() > 0 ) { - StringMetaDataMapType::iterator iter; - for( iter = var_string_md.begin(); iter != var_string_md.end(); iter++ ) + for( StringMetaDataMapType::iterator iter = var_string_md.begin(); iter != var_string_md.end(); ++iter ) { std::vector string_md(n_x_var); const Index* pos_idx = NULL; @@ -810,19 +755,33 @@ bool TNLPAdapter::GetSpaces( string_md.clear(); string_md.resize(n_x_l); - pos_idx = P_x_x_L_space_->ExpandedPosIndices(); + const Index* pos_idxL = P_x_x_L_space_->ExpandedPosIndices(); for( Index i = 0; i < n_x_l; i++ ) { - string_md[i] = iter->second[pos_idx[i]]; + if( pos_idx != NULL ) + { + string_md[i] = iter->second[pos_idx[pos_idxL[i]]]; + } + else + { + string_md[i] = iter->second[pos_idxL[i]]; + } } dv_x_l_space->SetStringMetaData(iter->first, string_md); string_md.clear(); string_md.resize(n_x_u); - pos_idx = P_x_x_U_space_->ExpandedPosIndices(); + const Index* pos_idxU = P_x_x_U_space_->ExpandedPosIndices(); for( Index i = 0; i < n_x_u; i++ ) { - string_md[i] = iter->second[pos_idx[i]]; + if( pos_idx != NULL ) + { + string_md[i] = iter->second[pos_idx[pos_idxU[i]]]; + } + else + { + string_md[i] = iter->second[pos_idxU[i]]; + } } dv_x_u_space->SetStringMetaData(iter->first, string_md); } @@ -830,8 +789,7 @@ bool TNLPAdapter::GetSpaces( if( var_integer_md.size() > 0 ) { - IntegerMetaDataMapType::iterator iter; - for( iter = var_integer_md.begin(); iter != var_integer_md.end(); iter++ ) + for( IntegerMetaDataMapType::iterator iter = var_integer_md.begin(); iter != var_integer_md.end(); ++iter ) { std::vector integer_md(n_x_var); const Index* pos_idx = NULL; @@ -854,19 +812,33 @@ bool TNLPAdapter::GetSpaces( integer_md.clear(); integer_md.resize(n_x_l); - pos_idx = P_x_x_L_space_->ExpandedPosIndices(); + const Index* pos_idxL = P_x_x_L_space_->ExpandedPosIndices(); for( Index i = 0; i < n_x_l; i++ ) { - integer_md[i] = iter->second[pos_idx[i]]; + if( pos_idx != NULL ) + { + integer_md[i] = iter->second[pos_idx[pos_idxL[i]]]; + } + else + { + integer_md[i] = iter->second[pos_idxL[i]]; + } } dv_x_l_space->SetIntegerMetaData(iter->first, integer_md); integer_md.clear(); integer_md.resize(n_x_u); - pos_idx = P_x_x_U_space_->ExpandedPosIndices(); + const Index* pos_idxU = P_x_x_U_space_->ExpandedPosIndices(); for( Index i = 0; i < n_x_u; i++ ) { - integer_md[i] = iter->second[pos_idx[i]]; + if( pos_idx != NULL ) + { + integer_md[i] = iter->second[pos_idx[pos_idxU[i]]]; + } + else + { + integer_md[i] = iter->second[pos_idxU[i]]; + } } dv_x_u_space->SetIntegerMetaData(iter->first, integer_md); } @@ -874,8 +846,7 @@ bool TNLPAdapter::GetSpaces( if( var_numeric_md.size() > 0 ) { - NumericMetaDataMapType::iterator iter; - for( iter = var_numeric_md.begin(); iter != var_numeric_md.end(); iter++ ) + for( NumericMetaDataMapType::iterator iter = var_numeric_md.begin(); iter != var_numeric_md.end(); ++iter ) { std::vector numeric_md(n_x_var); const Index* pos_idx = NULL; @@ -898,19 +869,33 @@ bool TNLPAdapter::GetSpaces( numeric_md.clear(); numeric_md.resize(n_x_l); - pos_idx = P_x_x_L_space_->ExpandedPosIndices(); + const Index* pos_idxL = P_x_x_L_space_->ExpandedPosIndices(); for( Index i = 0; i < n_x_l; i++ ) { - numeric_md[i] = iter->second[pos_idx[i]]; + if( pos_idx != NULL ) + { + numeric_md[i] = iter->second[pos_idx[pos_idxL[i]]]; + } + else + { + numeric_md[i] = iter->second[pos_idxL[i]]; + } } dv_x_l_space->SetNumericMetaData(iter->first, numeric_md); numeric_md.clear(); numeric_md.resize(n_x_u); - pos_idx = P_x_x_U_space_->ExpandedPosIndices(); + const Index* pos_idxU = P_x_x_U_space_->ExpandedPosIndices(); for( Index i = 0; i < n_x_u; i++ ) { - numeric_md[i] = iter->second[pos_idx[i]]; + if( pos_idx != NULL ) + { + numeric_md[i] = iter->second[pos_idx[pos_idxU[i]]]; + } + else + { + numeric_md[i] = iter->second[pos_idxU[i]]; + } } dv_x_u_space->SetNumericMetaData(iter->first, numeric_md); } @@ -926,7 +911,7 @@ bool TNLPAdapter::GetSpaces( // create the required c_space SmartPtr dc_space; - if( n_x_fixed_ == 0 || fixed_variable_treatment_ == MAKE_PARAMETER ) + if( n_x_fixed_ == 0 || fixed_variable_treatment_ == MAKE_PARAMETER || fixed_variable_treatment_ == MAKE_PARAMETER_NODUAL ) { dc_space = new DenseVectorSpace(n_c); } @@ -978,8 +963,7 @@ bool TNLPAdapter::GetSpaces( // set the constraint meta data if present if( con_string_md.size() > 0 ) { - StringMetaDataMapType::iterator iter; - for( iter = con_string_md.begin(); iter != con_string_md.end(); iter++ ) + for( StringMetaDataMapType::iterator iter = con_string_md.begin(); iter != con_string_md.end(); ++iter ) { std::vector string_md(n_c); const Index* pos_idx = P_c_g_space_->ExpandedPosIndices(); @@ -1000,19 +984,19 @@ bool TNLPAdapter::GetSpaces( string_md.clear(); string_md.resize(n_d_l); - pos_idx = P_d_l_space->ExpandedPosIndices(); + const Index* d_pos_idx = P_d_l_space->ExpandedPosIndices(); for( Index i = 0; i < n_d_l; i++ ) { - string_md[i] = iter->second[pos_idx[i]]; + string_md[i] = iter->second[pos_idx[d_pos_idx[i]]]; } dv_d_l_space->SetStringMetaData(iter->first, string_md); string_md.clear(); string_md.resize(n_d_u); - pos_idx = P_d_u_space->ExpandedPosIndices(); + d_pos_idx = P_d_u_space->ExpandedPosIndices(); for( Index i = 0; i < n_d_u; i++ ) { - string_md[i] = iter->second[pos_idx[i]]; + string_md[i] = iter->second[pos_idx[d_pos_idx[i]]]; } dv_d_u_space->SetStringMetaData(iter->first, string_md); } @@ -1020,8 +1004,7 @@ bool TNLPAdapter::GetSpaces( if( con_integer_md.size() > 0 ) { - IntegerMetaDataMapType::iterator iter; - for( iter = con_integer_md.begin(); iter != con_integer_md.end(); iter++ ) + for( IntegerMetaDataMapType::iterator iter = con_integer_md.begin(); iter != con_integer_md.end(); ++iter ) { std::vector integer_md(n_c); const Index* pos_idx = P_c_g_space_->ExpandedPosIndices(); @@ -1042,19 +1025,19 @@ bool TNLPAdapter::GetSpaces( integer_md.clear(); integer_md.resize(n_d_l); - pos_idx = P_d_l_space->ExpandedPosIndices(); + const Index* d_pos_idx = P_d_l_space->ExpandedPosIndices(); for( Index i = 0; i < n_d_l; i++ ) { - integer_md[i] = iter->second[pos_idx[i]]; + integer_md[i] = iter->second[pos_idx[d_pos_idx[i]]]; } dv_d_l_space->SetIntegerMetaData(iter->first, integer_md); integer_md.clear(); integer_md.resize(n_d_u); - pos_idx = P_d_u_space->ExpandedPosIndices(); + d_pos_idx = P_d_u_space->ExpandedPosIndices(); for( Index i = 0; i < n_d_u; i++ ) { - integer_md[i] = iter->second[pos_idx[i]]; + integer_md[i] = iter->second[pos_idx[d_pos_idx[i]]]; } dv_d_u_space->SetIntegerMetaData(iter->first, integer_md); } @@ -1062,8 +1045,7 @@ bool TNLPAdapter::GetSpaces( if( con_numeric_md.size() > 0 ) { - NumericMetaDataMapType::iterator iter; - for( iter = con_numeric_md.begin(); iter != con_numeric_md.end(); iter++ ) + for( NumericMetaDataMapType::iterator iter = con_numeric_md.begin(); iter != con_numeric_md.end(); ++iter ) { std::vector numeric_md(n_c); const Index* pos_idx = P_c_g_space_->ExpandedPosIndices(); @@ -1084,19 +1066,19 @@ bool TNLPAdapter::GetSpaces( numeric_md.clear(); numeric_md.resize(n_d_l); - pos_idx = P_d_l_space->ExpandedPosIndices(); + const Index* d_pos_idx = P_d_l_space->ExpandedPosIndices(); for( Index i = 0; i < n_d_l; i++ ) { - numeric_md[i] = iter->second[pos_idx[i]]; + numeric_md[i] = iter->second[pos_idx[d_pos_idx[i]]]; } dv_d_l_space->SetNumericMetaData(iter->first, numeric_md); numeric_md.clear(); numeric_md.resize(n_d_u); - pos_idx = P_d_u_space->ExpandedPosIndices(); + d_pos_idx = P_d_u_space->ExpandedPosIndices(); for( Index i = 0; i < n_d_u; i++ ) { - numeric_md[i] = iter->second[pos_idx[i]]; + numeric_md[i] = iter->second[pos_idx[d_pos_idx[i]]]; } dv_d_u_space->SetNumericMetaData(iter->first, numeric_md); } @@ -1107,7 +1089,16 @@ bool TNLPAdapter::GetSpaces( // Get the non zero structure Index* g_iRow = new Index[nz_full_jac_g_]; Index* g_jCol = new Index[nz_full_jac_g_]; - tnlp_->eval_jac_g(n_full_x_, NULL, false, n_full_g_, nz_full_jac_g_, g_iRow, g_jCol, NULL); + + bool retval = tnlp_->eval_jac_g(n_full_x_, NULL, false, n_full_g_, nz_full_jac_g_, g_iRow, g_jCol, NULL); + + if( !retval ) + { + delete[] g_iRow; + delete[] g_jCol; + + THROW_EXCEPTION(INVALID_TNLP, "eval_jac_g returned false in GetSpaces"); + } if( index_style_ != TNLP::FORTRAN_STYLE ) { @@ -1134,7 +1125,7 @@ bool TNLPAdapter::GetSpaces( } #endif - if( nz_full_jac_g_ > 0 && jacobian_approximation_ == JAC_FINDIFF_VALUES ) + if( jacobian_approximation_ == JAC_FINDIFF_VALUES ) { initialize_findiff_jac(g_iRow, g_jCol); } @@ -1143,7 +1134,7 @@ bool TNLPAdapter::GetSpaces( // ... (the permutation from rows in jac_g to jac_c is // ... the same as P_c_g_) Index nz_jac_all; - if( fixed_variable_treatment_ == MAKE_PARAMETER ) + if( fixed_variable_treatment_ == MAKE_PARAMETER || fixed_variable_treatment_ == MAKE_PARAMETER_NODUAL ) { nz_jac_all = nz_full_jac_g_; } @@ -1155,6 +1146,7 @@ bool TNLPAdapter::GetSpaces( Index* jac_c_iRow = new Index[nz_jac_all]; Index* jac_c_jCol = new Index[nz_jac_all]; Index current_nz = 0; + const Index* c_row_pos = P_c_g_->CompressedPosIndices(); if( IsValid(P_x_full_x_) ) { @@ -1171,6 +1163,14 @@ bool TNLPAdapter::GetSpaces( jac_c_jCol[current_nz] = c_col + 1; current_nz++; } + else if( c_col == -1 && fixed_variable_treatment_ == MAKE_PARAMETER ) + { + // c_col == -1 should mean a fixed variables + // c_row == -1 should mean a row in d(x) (but the distinction into c(x) and d(x) isn't relevant for us here) + jac_fixed_idx_map_.push_back(i); + jac_fixed_iRow_.push_back(g_iRow[i]); + jac_fixed_jCol_.push_back(g_jCol[i]); + } } } else @@ -1190,7 +1190,7 @@ bool TNLPAdapter::GetSpaces( } nz_jac_c_no_extra_ = current_nz; Index n_added_constr; - if( fixed_variable_treatment_ == MAKE_PARAMETER ) + if( fixed_variable_treatment_ == MAKE_PARAMETER || fixed_variable_treatment_ == MAKE_PARAMETER_NODUAL ) { nz_jac_c_ = nz_jac_c_no_extra_; n_added_constr = 0; @@ -1214,7 +1214,7 @@ bool TNLPAdapter::GetSpaces( jac_c_jCol = NULL; // ... build the nonzero structure for jac_d - // ... (the permuation from rows in jac_g to jac_c is the + // ... (the permutation from rows in jac_g to jac_c is the // ... the same as P_d_g_) Index* jac_d_iRow = new Index[nz_full_jac_g_]; Index* jac_d_jCol = new Index[nz_full_jac_g_]; @@ -1270,8 +1270,8 @@ bool TNLPAdapter::GetSpaces( Index* full_h_jCol = new Index[nz_full_h_]; Index* h_iRow = new Index[nz_full_h_]; Index* h_jCol = new Index[nz_full_h_]; - bool retval = tnlp_->eval_h(n_full_x_, NULL, false, 0, n_full_g_, - NULL, false, nz_full_h_, full_h_iRow, full_h_jCol, NULL); + retval = tnlp_->eval_h(n_full_x_, NULL, false, 0, n_full_g_, + NULL, false, nz_full_h_, full_h_iRow, full_h_jCol, NULL); if( !retval ) { delete[] full_h_iRow; @@ -1375,11 +1375,11 @@ bool TNLPAdapter::GetSpaces( if( IsValid(jnlst_) ) { - jnlst_->Printf(J_ITERSUMMARY, J_STATISTICS, "Number of nonzeros in equality constraint Jacobian...:%9d\n", + jnlst_->Printf(J_ITERSUMMARY, J_STATISTICS, "Number of nonzeros in equality constraint Jacobian...:%9" IPOPT_INDEX_FORMAT "\n", nz_jac_c_); - jnlst_->Printf(J_ITERSUMMARY, J_STATISTICS, "Number of nonzeros in inequality constraint Jacobian.:%9d\n", + jnlst_->Printf(J_ITERSUMMARY, J_STATISTICS, "Number of nonzeros in inequality constraint Jacobian.:%9" IPOPT_INDEX_FORMAT "\n", nz_jac_d_); - jnlst_->Printf(J_ITERSUMMARY, J_STATISTICS, "Number of nonzeros in Lagrangian Hessian.............:%9d\n\n", + jnlst_->Printf(J_ITERSUMMARY, J_STATISTICS, "Number of nonzeros in Lagrangian Hessian.............:%9" IPOPT_INDEX_FORMAT "\n\n", nz_h_); } @@ -1408,7 +1408,7 @@ bool TNLPAdapter::GetBoundsInformation( bool retval = tnlp_->get_bounds_info(n_full_x_, x_l, x_u, n_full_g_, g_l, g_u); ASSERT_EXCEPTION(retval, INVALID_TNLP, "get_bounds_info returned false in GetBoundsInformation"); - if( fixed_variable_treatment_ == MAKE_PARAMETER ) + if( fixed_variable_treatment_ == MAKE_PARAMETER || fixed_variable_treatment_ == MAKE_PARAMETER_NODUAL ) { // Set the values of fixed variables for( Index i = 0; i < n_x_fixed_; i++ ) @@ -1420,13 +1420,13 @@ bool TNLPAdapter::GetBoundsInformation( else if( fixed_variable_treatment_ == RELAX_BOUNDS ) { // Relax the bounds for fixed variables - const Number bound_relax = Max(1e-8, bound_relax_factor_); + const Number bound_relax = Max(Number(1e-8), bound_relax_factor_); for( Index i = 0; i < n_x_fixed_; i++ ) { if( x_l[i] == x_u[i] ) { - x_l[i] -= bound_relax * Max(1., fabs(x_l[i])); - x_u[i] += bound_relax * Max(1., fabs(x_u[i])); + x_l[i] -= bound_relax * Max(Number(1.), std::abs(x_l[i])); + x_u[i] += bound_relax * Max(Number(1.), std::abs(x_u[i])); } } } @@ -1530,7 +1530,7 @@ bool TNLPAdapter::GetBoundsInformation( } // In case we are doing finite differences, keep a copy of the bounds - if( jacobian_approximation_ != JAC_EXACT ) + if( jacobian_approximation_ != JAC_EXACT || gradient_approximation_ != OBJGRAD_EXACT ) { delete[] findiff_x_l_; delete[] findiff_x_u_; @@ -1601,7 +1601,7 @@ bool TNLPAdapter::GetStartingPoint( } else { - IpBlasDcopy(n_x_var, full_x, 1, values, 1); + IpBlasCopy(n_x_var, full_x, 1, values, 1); } } @@ -1619,7 +1619,7 @@ bool TNLPAdapter::GetStartingPoint( { // ToDo maybe use info from z_L and Z_U here? const Number zero = 0.; - IpBlasDcopy(n_x_fixed_, &zero, 0, &values[P_c_g_->NCols()], 1); + IpBlasCopy(n_x_fixed_, &zero, 0, &values[P_c_g_->NCols()], 1); } } @@ -1735,23 +1735,73 @@ bool TNLPAdapter::Eval_grad_f( DenseVector* dg_f = static_cast(&g_f); DBG_ASSERT(dynamic_cast(&g_f)); Number* values = dg_f->Values(); - if( IsValid(P_x_full_x_) ) + + if( gradient_approximation_ == OBJGRAD_EXACT ) { - Number* full_grad_f = new Number[n_full_x_]; - if( tnlp_->eval_grad_f(n_full_x_, full_x_, new_x, full_grad_f) ) + if( IsValid(P_x_full_x_) ) { - const Index* x_pos = P_x_full_x_->ExpandedPosIndices(); - for( Index i = 0; i < g_f.Dim(); i++ ) + Number* full_grad_f = new Number[n_full_x_]; + if( tnlp_->eval_grad_f(n_full_x_, full_x_, new_x, full_grad_f) ) { - values[i] = full_grad_f[x_pos[i]]; + const Index* x_pos = P_x_full_x_->ExpandedPosIndices(); + for( Index i = 0; i < g_f.Dim(); i++ ) + { + values[i] = full_grad_f[x_pos[i]]; + } + retvalue = true; } - retvalue = true; + delete[] full_grad_f; + } + else + { + retvalue = tnlp_->eval_grad_f(n_full_x_, full_x_, new_x, values); } - delete[] full_grad_f; } else { - retvalue = tnlp_->eval_grad_f(n_full_x_, full_x_, new_x, values); + // make sure we have the value of the objective at the point + Number f; + retvalue = tnlp_->eval_f(n_full_x_, full_x_, new_x, f); + if( retvalue ) + { + Number* full_x_pert = new Number[n_full_x_]; + IpBlasCopy(n_full_x_, full_x_, 1, full_x_pert, 1); + const Index* x_pos = NULL; + if( IsValid(P_x_full_x_) ) + { + x_pos = P_x_full_x_->ExpandedPosIndices(); + } + + // Compute the finite difference objective + for( Index i = 0; i < g_f.Dim(); i++ ) + { + Index ivar = x_pos != NULL ? x_pos[i] : i; + if( findiff_x_l_[ivar] < findiff_x_u_[ivar] ) + { + const Number xorig = full_x_pert[ivar]; + Number this_perturbation = findiff_perturbation_ * Max(Number(1.), std::abs(full_x_[ivar])); + full_x_pert[ivar] += this_perturbation; + if( full_x_pert[ivar] > findiff_x_u_[ivar] ) + { + // if at upper bound, then change direction towards lower bound + this_perturbation = -this_perturbation; + full_x_pert[ivar] = xorig + this_perturbation; + } + Number f_pert; + retvalue = tnlp_->eval_f(n_full_x_, full_x_pert, true, f_pert); + if( !retvalue ) + { + break; + } + + values[i] = (f_pert - f) / this_perturbation; + + full_x_pert[ivar] = xorig; + } + } + + delete[] full_x_pert; + } } return retvalue; @@ -1818,7 +1868,7 @@ bool TNLPAdapter::Eval_jac_c( if( fixed_variable_treatment_ == MAKE_CONSTRAINT ) { const Number one = 1.; - IpBlasDcopy(n_x_fixed_, &one, 0, &values[nz_jac_c_no_extra_], 1); + IpBlasCopy(n_x_fixed_, &one, 0, &values[nz_jac_c_no_extra_], 1); } return true; } @@ -1956,7 +2006,7 @@ void TNLPAdapter::GetScalingParameters( x_scaling = x_space->MakeNew(); c_scaling = c_space->MakeNew(); d_scaling = d_space->MakeNew(); - DBG_ASSERT((c_scaling->Dim() + d_scaling->Dim()) == n_full_g_); + DBG_ASSERT(c_scaling->Dim() + d_scaling->Dim() == n_full_g_ + (fixed_variable_treatment_ == MAKE_CONSTRAINT ? n_x_fixed_ : 0)); DenseVector* dx = static_cast(GetRawPtr(x_scaling)); DBG_ASSERT(dynamic_cast(GetRawPtr(x_scaling))); @@ -2022,7 +2072,7 @@ void TNLPAdapter::GetScalingParameters( if( fixed_variable_treatment_ == MAKE_CONSTRAINT ) { const Number one = 1.; - IpBlasDcopy(n_x_fixed_, &one, 0, &dc_values[P_c_g_->NCols()], 1); + IpBlasCopy(n_x_fixed_, &one, 0, &dc_values[P_c_g_->NCols()], 1); } const Index* d_pos = P_d_g_->ExpandedPosIndices(); @@ -2119,21 +2169,35 @@ void TNLPAdapter::FinalizeSolution( if( c.Dim() + d.Dim() < n_full_g_ ) { const Number zero = 0.; - IpBlasDcopy(n_full_g_, &zero, 0, full_g, 1); - } - ResortG(c, d, full_g); - // To Ipopt, the equality constraints are presented with right - // hand side zero, so we correct for the original right hand side. - const Index* c_pos = P_c_g_->ExpandedPosIndices(); - Index n_c_no_fixed = P_c_g_->NCols(); - for( Index i = 0; i < n_c_no_fixed; i++ ) - { - full_g[c_pos[i]] += c_rhs_[i]; + IpBlasCopy(n_full_g_, &zero, 0, full_g, 1); } + ResortG(c, d, full_g, true); Number* full_z_L = new Number[n_full_x_]; Number* full_z_U = new Number[n_full_x_]; - ResortBnds(z_L, full_z_L, z_U, full_z_U); + switch( status ) + { + case SUCCESS: + case MAXITER_EXCEEDED: + case STOP_AT_TINY_STEP: + case STOP_AT_ACCEPTABLE_POINT: + case LOCAL_INFEASIBILITY: + case USER_REQUESTED_STOP: + case FEASIBLE_POINT_FOUND: + case DIVERGING_ITERATES: + case RESTORATION_FAILURE: + case ERROR_IN_STEP_COMPUTATION: + // only for these status codes, IpoptApplication calls without all vectors 0 + if( !ResortBoundMultipliers(x, y_c, y_d, z_L, full_z_L, z_U, full_z_U) ) + { + jnlst_->Printf(J_WARNING, J_INITIALIZATION, "Failed to evaluate gradient of objective or constraints when computing bound multipliers for fixed variables.\n"); + } + break; + default: + // if IpoptApplication doesn't provide an actual solution, do not bother to setup good multipliers for fixed variables + ResortBounds(z_L, full_z_L, z_U, full_z_U); + break; + } SmartPtr z_L_space = dynamic_cast(GetRawPtr(z_L.OwnerSpace())); SmartPtr z_U_space = dynamic_cast(GetRawPtr(z_U.OwnerSpace())); @@ -2157,7 +2221,7 @@ void TNLPAdapter::FinalizeSolution( } std::vector new_z_L_meta_data(n_full_x_, 0.0); std::vector new_z_U_meta_data(n_full_x_, 0.0); - ResortBnds(*z_L_meta_vector, &new_z_L_meta_data[0], *z_U_meta_vector, &new_z_U_meta_data[0], false); + ResortBounds(*z_L_meta_vector, &new_z_L_meta_data[0], *z_U_meta_vector, &new_z_U_meta_data[0]); std::string z_L_meta_data_tag = z_L_meta_iter->first; std::string z_U_meta_data_tag = z_L_meta_iter->first; z_L_meta_data_tag += "_z_L"; @@ -2168,33 +2232,6 @@ void TNLPAdapter::FinalizeSolution( } } - // Hopefully the following is correct to recover the bound - // multipliers for fixed variables (sign ok?) - if( fixed_variable_treatment_ == MAKE_CONSTRAINT && n_x_fixed_ > 0 ) - { - const DenseVector* dy_c = static_cast(&y_c); - DBG_ASSERT(dynamic_cast(&y_c)); - Index n_c_no_fixed = y_c.Dim() - n_x_fixed_; - if( !dy_c->IsHomogeneous() ) - { - const Number* values = dy_c->Values(); - for( Index i = 0; i < n_x_fixed_; i++ ) - { - full_z_L[x_fixed_map_[i]] = Max(0., -values[n_c_no_fixed + i]); - full_z_U[x_fixed_map_[i]] = Max(0., values[n_c_no_fixed + i]); - } - } - else - { - double value = dy_c->Scalar(); - for( Index i = 0; i < n_x_fixed_; i++ ) - { - full_z_L[x_fixed_map_[i]] = Max(0., -value); - full_z_U[x_fixed_map_[i]] = Max(0., value); - } - } - } - tnlp_->finalize_metadata(n_full_x_, var_string_md, var_integer_md, var_numeric_md, n_full_g_, con_string_md, con_integer_md, con_numeric_md); @@ -2361,7 +2398,8 @@ void TNLPAdapter::GetQuasiNewtonApproximationSpaces( void TNLPAdapter::ResortX( const Vector& x, - Number* x_orig + Number* x_orig, + bool usefixedvals ) { const DenseVector* dx = static_cast(&x); @@ -2381,10 +2419,14 @@ void TNLPAdapter::ResortX( { x_orig[i] = scalar; } - else + else if( usefixedvals ) { x_orig[i] = full_x_[i]; } + else + { + x_orig[i] = 0.0; + } } } else @@ -2397,10 +2439,14 @@ void TNLPAdapter::ResortX( { x_orig[i] = x_values[idx]; } - else + else if( usefixedvals ) { x_orig[i] = full_x_[i]; } + else + { + x_orig[i] = 0.0; + } } } } @@ -2409,11 +2455,11 @@ void TNLPAdapter::ResortX( if( dx->IsHomogeneous() ) { const Number& scalar = dx->Scalar(); - IpBlasDcopy(n_full_x_, &scalar, 0, x_orig, 1); + IpBlasCopy(n_full_x_, &scalar, 0, x_orig, 1); } else { - IpBlasDcopy(n_full_x_, dx->Values(), 1, x_orig, 1); + IpBlasCopy(n_full_x_, dx->Values(), 1, x_orig, 1); } } } @@ -2421,7 +2467,8 @@ void TNLPAdapter::ResortX( void TNLPAdapter::ResortG( const Vector& c, const Vector& d, - Number* g_orig + Number* g_orig, + bool correctrhs ) { const DenseVector* dc = static_cast(&c); @@ -2434,6 +2481,10 @@ void TNLPAdapter::ResortG( for( Index i = 0; i < P_c_g_->NCols(); i++ ) { g_orig[c_pos[i]] = scalar; + if( correctrhs ) + { + g_orig[c_pos[i]] += c_rhs_[i]; + } } } else @@ -2442,6 +2493,10 @@ void TNLPAdapter::ResortG( for( Index i = 0; i < P_c_g_->NCols(); i++ ) { g_orig[c_pos[i]] = c_values[i]; + if( correctrhs ) + { + g_orig[c_pos[i]] += c_rhs_[i]; + } } } @@ -2467,25 +2522,26 @@ void TNLPAdapter::ResortG( } } -void TNLPAdapter::ResortBnds( +void TNLPAdapter::ResortBounds( const Vector& x_L, Number* x_L_orig, const Vector& x_U, - Number* x_U_orig, - bool clearorig + Number* x_U_orig ) { if( x_L_orig ) { - if( clearorig ) - memset(x_L_orig, 0, n_full_x_*sizeof(Number)); - const DenseVector* dx_L = static_cast(&x_L); DBG_ASSERT(dynamic_cast(&x_L)); const Index* bnds_pos_not_fixed = P_x_x_L_->ExpandedPosIndices(); const Index& n_xL = x_L.Dim(); + if( n_xL < n_full_x_ ) + { + memset(x_L_orig, 0, n_full_x_ * sizeof(Number)); + } + if( IsValid(P_x_full_x_) ) { const Index* bnds_pos_full = P_x_full_x_->ExpandedPosIndices(); @@ -2494,7 +2550,7 @@ void TNLPAdapter::ResortBnds( Number scalar = dx_L->Scalar(); for( Index i = 0; i < n_xL; i++ ) { - int idx = bnds_pos_not_fixed[i]; + Index idx = bnds_pos_not_fixed[i]; idx = bnds_pos_full[idx]; x_L_orig[idx] = scalar; } @@ -2504,7 +2560,7 @@ void TNLPAdapter::ResortBnds( const Number* x_L_values = dx_L->Values(); for( Index i = 0; i < n_xL; i++ ) { - int idx = bnds_pos_not_fixed[i]; + Index idx = bnds_pos_not_fixed[i]; idx = bnds_pos_full[idx]; x_L_orig[idx] = x_L_values[i]; } @@ -2517,7 +2573,7 @@ void TNLPAdapter::ResortBnds( Number scalar = dx_L->Scalar(); for( Index i = 0; i < n_xL; i++ ) { - int idx = bnds_pos_not_fixed[i]; + Index idx = bnds_pos_not_fixed[i]; x_L_orig[idx] = scalar; } } @@ -2526,7 +2582,7 @@ void TNLPAdapter::ResortBnds( const Number* x_L_values = dx_L->Values(); for( Index i = 0; i < n_xL; i++ ) { - int idx = bnds_pos_not_fixed[i]; + Index idx = bnds_pos_not_fixed[i]; x_L_orig[idx] = x_L_values[i]; } } @@ -2535,12 +2591,14 @@ void TNLPAdapter::ResortBnds( if( x_U_orig ) { - if( clearorig ) - memset(x_U_orig, 0, n_full_x_*sizeof(Number)); - const DenseVector* dx_U = static_cast(&x_U); DBG_ASSERT(dynamic_cast(&x_U)); + if( x_U.Dim() < n_full_x_ ) + { + memset(x_U_orig, 0, n_full_x_ * sizeof(Number)); + } + const Index* bnds_pos_not_fixed = P_x_x_U_->ExpandedPosIndices(); if( IsValid(P_x_full_x_) ) @@ -2551,7 +2609,7 @@ void TNLPAdapter::ResortBnds( Number scalar = dx_U->Scalar(); for( Index i = 0; i < x_U.Dim(); i++ ) { - int idx = bnds_pos_not_fixed[i]; + Index idx = bnds_pos_not_fixed[i]; idx = bnds_pos_full[idx]; x_U_orig[idx] = scalar; } @@ -2561,7 +2619,7 @@ void TNLPAdapter::ResortBnds( const Number* x_U_values = dx_U->Values(); for( Index i = 0; i < x_U.Dim(); i++ ) { - int idx = bnds_pos_not_fixed[i]; + Index idx = bnds_pos_not_fixed[i]; idx = bnds_pos_full[idx]; x_U_orig[idx] = x_U_values[i]; } @@ -2574,7 +2632,7 @@ void TNLPAdapter::ResortBnds( Number scalar = dx_U->Scalar(); for( Index i = 0; i < x_U.Dim(); i++ ) { - int idx = bnds_pos_not_fixed[i]; + Index idx = bnds_pos_not_fixed[i]; x_U_orig[idx] = scalar; } } @@ -2583,7 +2641,7 @@ void TNLPAdapter::ResortBnds( const Number* x_U_values = dx_U->Values(); for( Index i = 0; i < x_U.Dim(); i++ ) { - int idx = bnds_pos_not_fixed[i]; + Index idx = bnds_pos_not_fixed[i]; x_U_orig[idx] = x_U_values[i]; } } @@ -2591,6 +2649,151 @@ void TNLPAdapter::ResortBnds( } } +bool TNLPAdapter::ResortBoundMultipliers( + const Vector& x, + const Vector& y_c, + const Vector& y_d, + const Vector& z_L, + Number* z_L_orig, + const Vector& z_U, + Number* z_U_orig +) +{ + ResortBounds(z_L, z_L_orig, z_U, z_U_orig); + + if( n_x_fixed_ == 0 ) + { + return true; + } + + // recover the bound multipliers for fixed variables + if( fixed_variable_treatment_ == MAKE_CONSTRAINT ) + { + const DenseVector* dy_c = static_cast(&y_c); + DBG_ASSERT(dynamic_cast(&y_c)); + Index n_c_no_fixed = y_c.Dim() - n_x_fixed_; + if( !dy_c->IsHomogeneous() ) + { + const Number* values = dy_c->Values(); + for( Index i = 0; i < n_x_fixed_; i++ ) + { + if( z_L_orig != NULL ) + { + z_L_orig[x_fixed_map_[i]] = Max(Number(0.), -values[n_c_no_fixed + i]); + } + if( z_U_orig != NULL ) + { + z_U_orig[x_fixed_map_[i]] = Max(Number(0.), values[n_c_no_fixed + i]); + } + } + } + else + { + Number value = dy_c->Scalar(); + for( Index i = 0; i < n_x_fixed_; i++ ) + { + if( z_L_orig != NULL ) + { + z_L_orig[x_fixed_map_[i]] = Max(Number(0.), -value); + } + if( z_U_orig != NULL ) + { + z_U_orig[x_fixed_map_[i]] = Max(Number(0.), value); + } + } + } + } + + if( fixed_variable_treatment_ == MAKE_PARAMETER ) + { + // Lagrangian should be grad_f + lambda jac - z_L + z_U == 0 + // so fixed variables get z_L - z_U = grad_f + lambda_jac + Number* mult = new Number[n_full_x_]; + memset(mult, 0, sizeof(Number) * n_full_x_); + + bool new_x = update_local_x(x); + if( !tnlp_->eval_grad_f(n_full_x_, full_x_, new_x, mult) ) + { + delete[] mult; + return false; + } + + if( !jac_fixed_idx_map_.empty() ) + { + if( !internal_eval_jac_g(false) ) + { + delete[] mult; + return false; + } + DBG_ASSERT(dynamic_cast(&y_c)); + DBG_ASSERT(dynamic_cast(&y_d)); + const DenseVector* dy_c = static_cast(&y_c); + const DenseVector* dy_d = static_cast(&y_d); + // mappings from full g() indices to index in c() and d() + const Index* c_row_pos = P_c_g_->CompressedPosIndices(); + const Index* d_row_pos = P_d_g_->CompressedPosIndices(); + for( size_t i = 0; i < jac_fixed_idx_map_.size(); i++ ) + { + // Assume the same structure as initially given + // correct for 1-based indexing in jac_fixed_iRow_ and jac_fixed_jCol_ + Index row = jac_fixed_iRow_[i] - 1; + Index col = jac_fixed_jCol_[i] - 1; + Number val = jac_g_[jac_fixed_idx_map_[i]]; + DBG_ASSERT(row >= 0); + DBG_ASSERT(row < n_full_g_); + DBG_ASSERT(col >= 0); + DBG_ASSERT(col < n_full_x_); + + Number lambda = 0.0; + if( c_row_pos[row] != -1 ) + { + if( dy_c->IsHomogeneous() ) + { + lambda = dy_c->Scalar(); + } + else + { + lambda = dy_c->Values()[c_row_pos[row]]; + } + } + else if( d_row_pos[row] != -1 ) + { + if( dy_d->IsHomogeneous() ) + { + lambda = dy_d->Scalar(); + } + else + { + lambda = dy_d->Values()[d_row_pos[row]]; + } + } + // else: a constraint that is neither in c() nor d(), so assuming lambda=0 seems ok + + // add lambda*jac part + mult[col] += lambda * val; + } + } + + // set z_L = max(0,mult), z_U = max(0,-mult) + for( Index i = 0; i < n_x_fixed_; ++i ) + { + Index xidx = x_fixed_map_[i]; + if( z_L_orig != NULL ) + { + z_L_orig[xidx] = Max(Number(0.0), mult[xidx]); + } + if( z_U_orig != NULL ) + { + z_U_orig[xidx] = Max(Number(0.0), -mult[xidx]); + } + } + + delete[] mult; + } + + return true; +} + bool TNLPAdapter::update_local_x( const Vector& x ) @@ -2672,14 +2875,14 @@ bool TNLPAdapter::internal_eval_jac_g( { Number* full_g_pert = new Number[n_full_g_]; Number* full_x_pert = new Number[n_full_x_]; - IpBlasDcopy(n_full_x_, full_x_, 1, full_x_pert, 1); + IpBlasCopy(n_full_x_, full_x_, 1, full_x_pert, 1); // Compute the finite difference Jacobian for( Index ivar = 0; ivar < n_full_x_; ivar++ ) { if( findiff_x_l_[ivar] < findiff_x_u_[ivar] ) { const Number xorig = full_x_pert[ivar]; - Number this_perturbation = findiff_perturbation_ * Max(1., fabs(full_x_[ivar])); + Number this_perturbation = findiff_perturbation_ * Max(Number(1.), std::abs(full_x_[ivar])); full_x_pert[ivar] += this_perturbation; if( full_x_pert[ivar] > findiff_x_u_[ivar] ) { @@ -2752,9 +2955,16 @@ void TNLPAdapter::initialize_findiff_jac( findiff_jac_ja_ = new Index[findiff_jac_nnz_]; findiff_jac_postriplet_ = new Index[findiff_jac_nnz_]; const Index* ia = findiff_jac_converter->IA(); - for( Index i = 0; i < n_full_x_ + 1; i++ ) + if( ia != NULL ) { - findiff_jac_ia_[i] = ia[i]; + for( Index i = 0; i < n_full_x_ + 1; i++ ) + { + findiff_jac_ia_[i] = ia[i]; + } + } + else + { + memset(findiff_jac_ia_, 0, n_full_x_ * sizeof(Index)); } const Index* ja = findiff_jac_converter->JA(); for( Index i = 0; i < findiff_jac_nnz_; i++ ) @@ -2797,6 +3007,10 @@ bool TNLPAdapter::CheckDerivatives( TNLP::IndexStyleEnum index_style; retval = tnlp_->get_nlp_info(nx, ng, nz_jac_g, nz_hess_lag, index_style); ASSERT_EXCEPTION(retval, INVALID_TNLP, "get_nlp_info returned false for derivative checker"); + ASSERT_EXCEPTION(nx >= 0, INVALID_TNLP, "number of variables negative"); + ASSERT_EXCEPTION(ng >= 0, INVALID_TNLP, "number of constraints negative"); + ASSERT_EXCEPTION(nz_jac_g >= 0, INVALID_TNLP, "number of nonzeros in Jacobian negative"); + ASSERT_EXCEPTION(nz_hess_lag >= 0, INVALID_TNLP, "number of nonzeros in Hessian negative"); // Obtain starting point as reference point at which derivative // test should be performed @@ -2844,7 +3058,7 @@ bool TNLPAdapter::CheckDerivatives( "In TNLP derivative test: g could not be evaluated at reference point."); } - // Obtain gradient of objective function at reference pont + // Obtain gradient of objective function at reference point Number* grad_f = new Number[nx]; retval = tnlp_->eval_grad_f(nx, xref, true, grad_f); ASSERT_EXCEPTION(retval, ERROR_IN_TNLP_DERIVATIVE_TEST, @@ -2886,7 +3100,7 @@ bool TNLPAdapter::CheckDerivatives( } } #endif - // Obtain values at reference pont + // Obtain values at reference point jac_g = new Number[nz_jac_g]; retval = tnlp_->eval_jac_g(nx, xref, new_x, ng, nz_jac_g, NULL, NULL, jac_g); ASSERT_EXCEPTION(retval, ERROR_IN_TNLP_DERIVATIVE_TEST, @@ -2895,7 +3109,7 @@ bool TNLPAdapter::CheckDerivatives( // Space for the perturbed point Number* xpert = new Number[nx]; - IpBlasDcopy(nx, xref, 1, xpert, 1); + IpBlasCopy(nx, xref, 1, xpert, 1); // Space for constraints at perturbed point Number* gpert = NULL; @@ -2915,10 +3129,10 @@ bool TNLPAdapter::CheckDerivatives( jnlst_->Printf(J_SUMMARY, J_NLP, "Starting derivative checker for first derivatives.\n\n"); // Now go through all variables and check the partial derivatives - const Index ivar_first = Max(0, deriv_test_start_index); + const Index ivar_first = Max(Index(0), deriv_test_start_index); for( Index ivar = ivar_first; ivar < nx; ivar++ ) { - Number this_perturbation = derivative_test_perturbation_ * Max(1., fabs(xref[ivar])); + Number this_perturbation = derivative_test_perturbation_ * Max(Number(1.), std::abs(xref[ivar])); xpert[ivar] = xref[ivar] + this_perturbation; Number fpert; @@ -2930,7 +3144,7 @@ bool TNLPAdapter::CheckDerivatives( Number deriv_approx = (fpert - fref) / this_perturbation; Number deriv_exact = grad_f[ivar]; - Number rel_error = fabs(deriv_approx - deriv_exact) / Max(fabs(deriv_approx), 1.); + Number rel_error = std::abs(deriv_approx - deriv_exact) / Max(std::abs(deriv_approx), derivative_test_tol_); char cflag = ' '; if( rel_error >= derivative_test_tol_ ) { @@ -2939,7 +3153,7 @@ bool TNLPAdapter::CheckDerivatives( } if( cflag != ' ' || derivative_test_print_all_ ) { - jnlst_->Printf(J_WARNING, J_NLP, "%c grad_f[ %5d] = %23.16e ~ %23.16e [%10.3e]\n", cflag, + jnlst_->Printf(J_WARNING, J_NLP, "%c grad_f[ %5" IPOPT_INDEX_FORMAT "] = %23.16e ~ %23.16e [%10.3e]\n", cflag, ivar + index_correction, deriv_exact, deriv_approx, rel_error); } @@ -2961,8 +3175,7 @@ bool TNLPAdapter::CheckDerivatives( deriv_exact += jac_g[i]; } } - - rel_error = fabs(deriv_approx - deriv_exact) / Max(fabs(deriv_approx), 1.); + rel_error = std::abs(deriv_approx - deriv_exact) / Max(std::abs(deriv_approx), derivative_test_tol_); cflag = ' '; if( rel_error >= derivative_test_tol_ ) { @@ -2976,7 +3189,7 @@ bool TNLPAdapter::CheckDerivatives( } if( cflag != ' ' || derivative_test_print_all_ ) { - jnlst_->Printf(J_WARNING, J_NLP, "%c jac_g [%5d,%5d] = %23.16e %c ~ %23.16e [%10.3e]\n", cflag, + jnlst_->Printf(J_WARNING, J_NLP, "%c jac_g [%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "] = %23.16e %c ~ %23.16e [%10.3e]\n", cflag, icon + index_correction, ivar + index_correction, deriv_exact, sflag, deriv_approx, rel_error); } } @@ -2989,7 +3202,7 @@ bool TNLPAdapter::CheckDerivatives( const Number zero = 0.; if( deriv_test == SECOND_ORDER_TEST || deriv_test == ONLY_SECOND_ORDER_TEST ) { - jnlst_->Printf(J_SUMMARY, J_NLP, "Starting derivative checker for second derivatives.\n\n"); + jnlst_->Printf(J_SUMMARY, J_NLP, "Starting derivative checker for second derivatives with obj_factor or lambda[i] set to 1.5.\n\n"); // Get sparsity structure of Hessian Index* h_iRow = new Index[nz_hess_lag]; @@ -3028,26 +3241,27 @@ bool TNLPAdapter::CheckDerivatives( if( ng > 0 ) { lambda = new Number[ng]; - IpBlasDcopy(ng, &zero, 0, lambda, 1); + IpBlasCopy(ng, &zero, 0, lambda, 1); } Number* gradref = new Number[nx]; // gradient of objective or constraint at reference point Number* gradpert = new Number[nx]; // gradient of objective or constraint at perturbed point Number* jacpert = new Number[nz_jac_g]; // Check all Hessians - const Index icon_first = Max(-1, deriv_test_start_index); + const Index icon_first = Max(Index(-1), deriv_test_start_index); for( Index icon = icon_first; icon < ng; icon++ ) { Number objfact = 0.; if( icon == -1 ) { - objfact = 1.; - IpBlasDcopy(nx, grad_f, 1, gradref, 1); + objfact = 1.5; + IpBlasCopy(nx, grad_f, 1, gradref, 1); } else { - lambda[icon] = 1.; - IpBlasDcopy(nx, &zero, 0, gradref, 1); + DBG_ASSERT(lambda != NULL); + lambda[icon] = 1.5; + IpBlasCopy(nx, &zero, 0, gradref, 1); for( Index i = 0; i < nz_jac_g; i++ ) { if( g_iRow[i] == icon ) @@ -3060,14 +3274,12 @@ bool TNLPAdapter::CheckDerivatives( new_x = true; bool new_y = true; retval = tnlp_->eval_h(nx, xref, new_x, objfact, ng, lambda, new_y, nz_hess_lag, NULL, NULL, h_values); - new_x = false; - new_y = false; ASSERT_EXCEPTION(retval, ERROR_IN_TNLP_DERIVATIVE_TEST, "In TNLP derivative test: Hessian could not be evaluated at reference point."); for( Index ivar = 0; ivar < nx; ivar++ ) { - Number this_perturbation = derivative_test_perturbation_ * Max(1., fabs(xref[ivar])); + Number this_perturbation = derivative_test_perturbation_ * Max(Number(1.), std::abs(xref[ivar])); xpert[ivar] = xref[ivar] + this_perturbation; new_x = true; @@ -3085,8 +3297,8 @@ bool TNLPAdapter::CheckDerivatives( ASSERT_EXCEPTION(retval, ERROR_IN_TNLP_DERIVATIVE_TEST, "In TNLP derivative test: Jacobian values could not be evaluated at reference point."); // ok, now we need to filter the gradient of the icon-th constraint - IpBlasDcopy(nx, &zero, 0, gradpert, 1); - IpBlasDcopy(nx, &zero, 0, gradref, 1); + IpBlasCopy(nx, &zero, 0, gradpert, 1); + IpBlasCopy(nx, &zero, 0, gradref, 1); for( Index i = 0; i < nz_jac_g; i++ ) { if( g_iRow[i] == icon ) @@ -3096,11 +3308,10 @@ bool TNLPAdapter::CheckDerivatives( } } } - new_x = false; for( Index ivar2 = 0; ivar2 < nx; ivar2++ ) { - Number deriv_approx = (gradpert[ivar2] - gradref[ivar2]) / this_perturbation; + Number deriv_approx = 1.5 * (gradpert[ivar2] - gradref[ivar2]) / this_perturbation; Number deriv_exact = 0.; bool found = false; for( Index i = 0; i < nz_hess_lag; i++ ) @@ -3111,7 +3322,7 @@ bool TNLPAdapter::CheckDerivatives( found = true; } } - Number rel_error = fabs(deriv_approx - deriv_exact) / Max(fabs(deriv_approx), 1.); + Number rel_error = std::abs(deriv_approx - deriv_exact) / Max(std::abs(deriv_approx), derivative_test_tol_); char cflag = ' '; if( rel_error >= derivative_test_tol_ ) { @@ -3128,13 +3339,13 @@ bool TNLPAdapter::CheckDerivatives( if( icon == -1 ) { jnlst_->Printf(J_WARNING, J_NLP, - "%c obj_hess[%5d,%5d] = %23.16e %c ~ %23.16e [%10.3e]\n", cflag, + "%c obj_hess[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "] = %23.16e %c ~ %23.16e [%10.3e]\n", cflag, ivar + index_correction, ivar2 + index_correction, deriv_exact, sflag, deriv_approx, rel_error); } else { jnlst_->Printf(J_WARNING, J_NLP, - "%c %5d-th constr_hess[%5d,%5d] = %23.16e %c ~ %23.16e [%10.3e]\n", cflag, + "%c %5" IPOPT_INDEX_FORMAT "-th constr_hess[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "] = %23.16e %c ~ %23.16e [%10.3e]\n", cflag, icon + index_correction, ivar + index_correction, ivar2 + index_correction, deriv_exact, sflag, deriv_approx, rel_error); } @@ -3175,7 +3386,7 @@ bool TNLPAdapter::CheckDerivatives( } else { - jnlst_->Printf(J_WARNING, J_NLP, "\nDerivative checker detected %d error(s).\n\n", nerrors); + jnlst_->Printf(J_WARNING, J_NLP, "\nDerivative checker detected %" IPOPT_INDEX_FORMAT " error(s).\n\n", nerrors); } return retval; @@ -3236,8 +3447,8 @@ bool TNLPAdapter::DetermineDependentConstraints( // fixed_variable_treatment_==MAKE_PARAMETER correctly (yet?) // Include space for the RHS Index* jac_c_map = new Index[nz_full_jac_g_]; - ipfint* jac_c_iRow = new ipfint[nz_full_jac_g_ + n_c]; - ipfint* jac_c_jCol = new ipfint[nz_full_jac_g_ + n_c]; + Index* jac_c_iRow = new Index[nz_full_jac_g_ + n_c]; + Index* jac_c_jCol = new Index[nz_full_jac_g_ + n_c]; Index nz_jac_c = 0; const Index* c_row_pos = P_c_g->CompressedPosIndices(); Index n_fixed = n_full_x_ - n_x_var; @@ -3329,7 +3540,7 @@ bool TNLPAdapter::DetermineDependentConstraints( } // Get the equality constraint Jacobian out - double* jac_c_vals = new double[nz_jac_c + n_c]; + Number* jac_c_vals = new Number[nz_jac_c + n_c]; for( Index i = 0; i < nz_jac_c; i++ ) { jac_c_vals[i] = jac_g_[jac_c_map[i]]; diff --git a/src/Interfaces/IpTNLPAdapter.hpp b/src/Interfaces/IpTNLPAdapter.hpp index ac1948e46..c92faf757 100644 --- a/src/Interfaces/IpTNLPAdapter.hpp +++ b/src/Interfaces/IpTNLPAdapter.hpp @@ -10,13 +10,13 @@ #include "IpNLP.hpp" #include "IpTNLP.hpp" #include "IpOrigIpoptNLP.hpp" +#include "IpExpansionMatrix.hpp" #include namespace Ipopt { // forward declarations -class ExpansionMatrix; class ExpansionMatrixSpace; class IteratesVector; class TDependencyDetector; @@ -25,12 +25,48 @@ class TDependencyDetector; * * This is an Adapter class (Design Patterns) that converts a TNLP to an NLP. * This allows users to write to the "more convenient" TNLP interface. + * + * Given a TNLP + * \f{eqnarray*} + * \mathrm{min} && f(x), \\ + * \mathrm{s.t.} && g_L \leq g(x) \leq g_U, &\qquad \lambda\\ + * && x_L \leq x \leq x_U, &\qquad z_L, z_U + * \f} + * let \f$E = \{i : g_{L,i} = g_{U,i}\}\f$ and \f$I = \{i : g_{L,i} \neq g_{U,i}\}\f$ + * be the indices of equality and inequality constraints, respectively. + * The dual variables for the constraints are \f$\lambda\f$. + * The dual variables for the variable bounds are \f$z_L\f$ and \f$z_U\f$. + * + * A TNLPAdapter represents the problem + * \f{eqnarray*} + * \mathrm{min} && f(x), \\ + * \mathrm{s.t.} && c(x) = 0, &\qquad y_c\\ + * && d_L \leq d(x) \leq d_U, &\qquad y_d \\ + * && x_L \leq x \leq x_U, &\qquad z_L, z_U + * \f} + * where \f$c(x) = g_E(x) - g_{L,E}\f$, i.e., corresponding to equality constraints of TNLP, and + * \f$d(x) = g_I(x)\f$, \f$d_L = g_{L,I}\f$, \f$d_U = g_{U,I}\f$, i.e., corresponding to inequality constraints of TNLP. + * + * The dual variables for the constraints are \f$y_c\f$ and \f$y_d\f$. + * The dual variables for the bounds on slack and original variables are \f$s_L\f$, \f$s_U\f$, \f$z_L\f$, \f$z_U\f$. + * + * Internally, %Ipopt reformulates \f$d_L \leq d(x) \leq d_U\f$ as + * \f{eqnarray*} + * && d(x) - s = 0 &\qquad y_d\\ + * && d_L \leq s \leq d_U &\qquad v_L, v_U \\ + * \f} + * + * If fixed variables are present (\f$x_{L,i} = x_{U,i}\f$) in the TNLP and + * fixed_variable_treatment is set to make_parameter, then these variables are not made visible + * to Ipopt internally. + * If fixed_variable_treatment is set to make_constraint, then their bounds relaxed and equality + * constraints \f$x_i - x_{L,i} = 0\f$ are added to the end of \f$c(x) = 0\f$. */ class IPOPTLIB_EXPORT TNLPAdapter : public NLP { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default constructor */ TNLPAdapter( const SmartPtr tnlp, @@ -39,16 +75,16 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP /** Default destructor */ virtual ~TNLPAdapter(); - //@} + ///@} /**@name Exceptions */ - //@{ + ///@{ DECLARE_STD_EXCEPTION(INVALID_TNLP); DECLARE_STD_EXCEPTION(ERROR_IN_TNLP_DERIVATIVE_TEST); - //@} + ///@} /** @name TNLPAdapter Initialization. */ - //@{ + ///@{ virtual bool ProcessOptions( const OptionsList& options, const std::string& prefix @@ -108,10 +144,10 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP virtual bool GetWarmStartIterate( IteratesVector& warm_start_iterate ); - //@} + ///@} /** @name TNLPAdapter evaluation routines. */ - //@{ + ///@{ virtual bool Eval_f( const Vector& x, Number& f @@ -159,10 +195,10 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP SmartPtr& c_scaling, SmartPtr& d_scaling ) const; - //@} + ///@} /** @name Solution Reporting Methods */ - //@{ + ///@{ virtual void FinalizeSolution( SolverReturn status, const Vector& x, @@ -192,7 +228,7 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP const IpoptData* ip_data, IpoptCalculatedQuantities* ip_cq ); - //@} + ///@} /** Method returning information on quasi-Newton approximation. */ virtual void GetQuasiNewtonApproximationSpaces( @@ -204,6 +240,7 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP enum FixedVariableTreatmentEnum { MAKE_PARAMETER = 0, + MAKE_PARAMETER_NODUAL, ///< @since 3.14.0 MAKE_CONSTRAINT, RELAX_BOUNDS }; @@ -224,6 +261,13 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP JAC_FINDIFF_VALUES }; + /** Enum for specifying technique for computing objective Gradient */ + enum GradientApproxEnum + { + OBJGRAD_EXACT = 0, + OBJGRAD_FINDIFF_VALUES + }; + /** Method for performing the derivative test */ bool CheckDerivatives( DerivativeTestEnum deriv_test, @@ -245,31 +289,136 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP * These methods are used to obtain the current (or final) * data for the TNLP formulation from the IpoptNLP structure. */ - //@{ - /** Sort the primal variables, and add the fixed values in x */ + ///@{ + /** Sort the primal variables, and add the fixed values in x_orig */ void ResortX( - const Vector& x, - Number* x_orig + const Vector& x, /**< internal values for primal variables x */ + Number* x_orig, /**< vector to fill with values from x */ + bool usefixedvals = true /**< whether to use stored variable fixings for fixed variables (true), or zero (false) @since 3.14.0 */ ); + /** Sort constraint values + * + * To Ipopt, the equality constraints are presented with right hand side zero. + * Specifying correctrhs=true corrects for the original right hand side. + */ void ResortG( - const Vector& c, - const Vector& d, - Number* g_orig + const Vector& c, /**< internal activity for equality constraints */ + const Vector& d, /**< internal activity for inequality constraints */ + Number* g_orig, /**< vector to fill with values from c and d */ + bool correctrhs = false /**< whether to add unscaled rhs-values for constraints that internally correspond to c(x)=0 @since 3.14.0 */ + ); + + /** Provides values for lower and upper bounds on variables for given Ipopt-internal vectors. + * + * Similar to ResortX, but does so for two arrays and does not set any values for fixed variables. + * @since 3.14.0 + */ + void ResortBounds( + const Vector& x_L, /**< internal values for lower bounds on x */ + Number* x_L_orig, /**< vector to fill with values from x_L */ + const Vector& x_U, /**< internal values for upper bounds on x */ + Number* x_U_orig /**< vector to fill with values from x_U */ ); /** Provides values for lower and upper bounds on variables for given Ipopt-internal vectors. * * Similar to ResortX, but does so for two arrays and does not set any values for fixed variables. + * + * @deprecated Use ResortBounds() instead. */ + IPOPT_DEPRECATED void ResortBnds( const Vector& x_L, /**< internal values for lower bounds on x */ Number* x_L_orig, /**< vector to fill with values from x_L */ const Vector& x_U, /**< internal values for upper bounds on x */ Number* x_U_orig, /**< vector to fill with values from x_U */ - bool clearorig = true /**< whether to initialize complete x_L_orig and x_U_orig to 0.0 before setting values for non-fixed variables */ + bool clearorig = true /**< whether to initialize complete x_L_orig and x_U_orig to 0.0 before setting values for non-fixed variables - ignored */ + ) + { + ResortBounds(x_L, x_L_orig, x_U, x_U_orig); + (void) clearorig; + } + + /** Provides values for dual multipliers on lower and upper bounds on variables for given Ipopt-internal vectors. + * + * Similar to ResortBounds, but also provides dual values for fixed variables if fixed_variable_treatment is set to make_constraint or make_parameter. + * + * @attention If there are fixed variables and fixed_variable_treatment is make_parameter (the default), + * then the Gradient of f(x) and the Jacobian of g(x) may be reevaluated here (that's why the function needs x). + * Further, in this setting, this function only provides correct bound multipliers for fixed variables + * if x, y_c, and y_d correspond to the unscaled problem. + * + * @return True, if bound multipliers could be assigned. False if there was an evaluation error when calculating bound multipliers for fixed variables. + * @since 3.14.0 + */ + bool ResortBoundMultipliers( + const Vector& x, /**< internal values for primal variables x */ + const Vector& y_c, /**< internal values for equality constraint multipliers */ + const Vector& y_d, /**< internal values for inequality constraint multipliers */ + const Vector& z_L, /**< internal values for lower bound multipliers */ + Number* z_L_orig, /**< vector to fill with values from z_L */ + const Vector& z_U, /**< internal values for upper bound multipliers */ + Number* z_U_orig /**< vector to fill with values from z_U */ ); - //@} + + /** Get number of variables and number of constraints in TNLP + * @since 3.14.0 + */ + void GetFullDimensions( + Index& n, /**< storage for full dimension of x (fixed + non-fixed) */ + Index& m /**< storage for full dimension of g (c + d) */ + ) const + { + n = n_full_x_; + m = n_full_g_; + } + + /** Get number and indices of fixed variables + * @since 3.14.0 + */ + void GetFixedVariables( + Index& n_x_fixed, /**< storage for number of fixed variables in TNLP */ + Index*& x_fixed_map, /**< storage for pointer to array that holds indices of fixed variables (has length n_fixed_x, can be NULL if n_fixed_x=0) */ + FixedVariableTreatmentEnum& fixed_variable_treatment /**< treatment for fixed variables as used by TNLP */ + ) const + { + n_x_fixed = n_x_fixed_; + x_fixed_map = x_fixed_map_; + fixed_variable_treatment = fixed_variable_treatment_; + } + + /** Get mappings between TNLP indices and Ipopt internal indices for variables and constraints. + * + * See the various ResortXyz functions on usage. + * + * \attention P_x_full_x is set to NULL if there are no fixed variables or fixed_variable_treatment is not make_parameter + * @since 3.14.0 + */ + void GetPermutationMatrices( + SmartPtr& P_x_full_x, /**< map from TNLP variable indices to Ipopt internal indices, filtered variables get mapped to -1 */ + SmartPtr& P_x_x_L, /**< map from indices on lower bounds on x to Ipopt internal indices for x */ + SmartPtr& P_x_x_U, /**< map from indices on upper bounds on x to Ipopt internal indices for x */ + SmartPtr& P_c_g, /**< map from indices on equality constraints (c(x)=0) into TNLP constraint indices (g_l <= g(x) <= g_u) */ + SmartPtr& P_d_g /**< map from indices on inequality constraints (d(x)-s=0) into TNLP constraint indices (g_l <= g(x) <= g_u) */ + ) const + { + P_x_full_x = ConstPtr(P_x_full_x_); + P_x_x_L = ConstPtr(P_x_x_L_); + P_x_x_U = ConstPtr(P_x_x_U_); + P_c_g = ConstPtr(P_c_g_); + P_d_g = ConstPtr(P_d_g_); + } + + /** Get right-hand-sides that are added into c(x) + * @since 3.14.0 + */ + const Number* GetC_Rhs() const + { + return c_rhs_; + } + + ///@} private: /**@name Default Compiler Generated Methods @@ -281,7 +430,7 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ TNLPAdapter( const TNLPAdapter& @@ -291,7 +440,7 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP void operator=( const TNLPAdapter& ); - //@} + ///@} /** @name Method implementing the detection of linearly dependent equality constraints */ bool DetermineDependentConstraints( @@ -315,7 +464,7 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP SmartPtr dependency_detector_; /**@name Algorithmic parameters */ - //@{ + ///@{ /** Value for a lower bound that denotes -infinity */ Number nlp_lower_bound_inf_; /** Value for a upper bound that denotes infinity */ @@ -347,6 +496,8 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP Index num_linear_variables_; /** Flag indicating how Jacobian is computed. */ JacobianApproxEnum jacobian_approximation_; + /** Flag indicating how objective Gradient is computed. */ + GradientApproxEnum gradient_approximation_; /** Size of the perturbation for the derivative approximation */ Number findiff_perturbation_; /** Maximal perturbation of the initial point */ @@ -356,10 +507,10 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP /** Overall convergence tolerance */ Number tol_; - //@} + ///@} /**@name Problem Size Data */ - //@{ + ///@{ /** full dimension of x (fixed + non-fixed) */ Index n_full_x_; /** full dimension of g (c + d) */ @@ -378,13 +529,13 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP Index nz_h_; /** Number of fixed variables */ Index n_x_fixed_; - //@} + ///@} /** Numbering style of variables and constraints */ TNLP::IndexStyleEnum index_style_; /** @name Local copy of spaces (for warm start) */ - //@{ + ///@{ SmartPtr x_space_; SmartPtr c_space_; SmartPtr d_space_; @@ -399,50 +550,50 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP SmartPtr Jac_c_space_; SmartPtr Jac_d_space_; SmartPtr Hess_lagrangian_space_; - //@} + ///@} /**@name Local Copy of the Data */ - //@{ + ///@{ Number* full_x_; /** copy of the full x vector (fixed & non-fixed) */ Number* full_lambda_; /** copy of lambda (yc & yd) */ Number* full_g_; /** copy of g (c & d) */ Number* jac_g_; /** the values for the full jacobian of g */ Number* c_rhs_; /** the rhs values of c */ - //@} + ///@} /**@name Tags for deciding when to update internal copies of vectors */ - //@{ + ///@{ TaggedObject::Tag x_tag_for_iterates_; TaggedObject::Tag y_c_tag_for_iterates_; TaggedObject::Tag y_d_tag_for_iterates_; TaggedObject::Tag x_tag_for_g_; TaggedObject::Tag x_tag_for_jac_g_; - //@} + ///@} /**@name Methods to update the values in the local copies of vectors */ - //@{ + ///@{ bool update_local_x(const Vector& x); bool update_local_lambda(const Vector& y_c, const Vector& y_d); - //@} + ///@} /**@name Internal routines for evaluating g and jac_g. * * Values stored since they are used in both c and d routines. */ - //@{ + ///@{ bool internal_eval_g(bool new_x); bool internal_eval_jac_g(bool new_x); - //@} + ///@} /** @name Internal methods for dealing with finite difference approximation */ - //@{ + ///@{ /** Initialize sparsity structure for finite difference Jacobian */ void initialize_findiff_jac(const Index* iRow, const Index* jCol); - //@} + ///@} /**@name Internal Permutation Spaces and matrices */ - //@{ + ///@{ /** Expansion from fixed x (ipopt) to full x */ SmartPtr P_x_full_x_; SmartPtr P_x_full_x_space_; @@ -468,10 +619,15 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP /** Position of fixed variables. This is required for a warm start */ Index* x_fixed_map_; - //@} + + /** Index mapping of Jacobian w.r.t. fixed variables. */ + std::vector jac_fixed_idx_map_; + std::vector jac_fixed_iRow_; + std::vector jac_fixed_jCol_; + ///@} /** @name Data for finite difference approximations of derivatives */ - //@{ + ///@{ /** Number of unique nonzeros in constraint Jacobian */ Index findiff_jac_nnz_; /** Start position for nonzero indices in ja for each column of Jacobian */ @@ -484,7 +640,7 @@ class IPOPTLIB_EXPORT TNLPAdapter : public NLP Number* findiff_x_l_; /** Copy of the upper bounds */ Number* findiff_x_u_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/Interfaces/IpTNLPReducer.cpp b/src/Interfaces/IpTNLPReducer.cpp index 9824ca2ee..b6a603baf 100644 --- a/src/Interfaces/IpTNLPReducer.cpp +++ b/src/Interfaces/IpTNLPReducer.cpp @@ -137,6 +137,7 @@ bool TNLPReducer::get_nlp_info( { delete[] iRow; delete[] jCol; + return false; } nnz_jac_g_reduced_ = 0; nnz_jac_g_skipped_ = 0; @@ -212,6 +213,7 @@ bool TNLPReducer::get_bounds_info( } if( index_x_fix_[count_x] == i ) { + DBG_ASSERT(x_start != NULL); x_l[i] = x_start[i]; x_u[i] = x_start[i]; count_x++; diff --git a/src/Interfaces/IpTNLPReducer.hpp b/src/Interfaces/IpTNLPReducer.hpp index e10a7647b..a49ce975d 100644 --- a/src/Interfaces/IpTNLPReducer.hpp +++ b/src/Interfaces/IpTNLPReducer.hpp @@ -24,7 +24,7 @@ class IPOPTLIB_EXPORT TNLPReducer: public TNLP { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor is given the indices of the constraints that * should be taken out of the problem statement, as well as the * original TNLP. @@ -43,9 +43,10 @@ class IPOPTLIB_EXPORT TNLPReducer: public TNLP /** Default destructor */ virtual ~TNLPReducer(); - //@} + ///@} /** @name Overloaded methods from TNLP */ + ///@{ virtual bool get_nlp_info( Index& n, Index& m, @@ -182,7 +183,7 @@ class IPOPTLIB_EXPORT TNLPReducer: public TNLP Index num_nonlin_vars, Index* pos_nonlin_vars ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -194,7 +195,7 @@ class IPOPTLIB_EXPORT TNLPReducer: public TNLP * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ TNLPReducer(); @@ -207,14 +208,14 @@ class IPOPTLIB_EXPORT TNLPReducer: public TNLP void operator=( const TNLPReducer& ); - //@} + ///@} /** @name original TNLP */ - //@{ + ///@{ SmartPtr tnlp_; Index m_orig_; Index nnz_jac_g_orig_; - //@} + ///@} /** Number of constraints to be skipped */ Index n_g_skip_; diff --git a/src/Interfaces/Ipopt.java b/src/Interfaces/Ipopt.java index 8067cece8..e89a35e56 100644 --- a/src/Interfaces/Ipopt.java +++ b/src/Interfaces/Ipopt.java @@ -92,13 +92,45 @@ private native int OptimizeTNLP( double callback_hess[] ); + /* Native function should not be used directly */ + private native boolean GetCurrIterate( + long ipopt, + long ip_data, + long ip_cq, + boolean scaled, + int n, + double x[], + double z_L[], + double z_U[], + int m, + double g[], + double lambda[] + ); + + /* Native function should not be used directly */ + private native boolean GetCurrViolations( + long ipopt, + long ip_data, + long ip_cq, + boolean scaled, + int n, + double x_L_violation[], + double x_U_violation[], + double compl_x_L[], + double compl_x_U[], + double grad_lag_x[], + int m, + double nlp_constraint_violation[], + double compl_g[] + ); + /** Use C index style for iRow and jCol vectors */ public final static int C_STYLE = 0; /** Use FORTRAN index style for iRow and jCol vectors */ public final static int FORTRAN_STYLE = 1; - /** The possible Ipopt status return codes: should be kept in sync with Ipopt return codes */ + /* The possible Ipopt status return codes: should be kept in sync with Ipopt return codes */ public final static int SOLVE_SUCCEEDED = 0; public final static int ACCEPTABLE_LEVEL = 1; public final static int INFEASIBLE_PROBLEM = 2; @@ -109,6 +141,7 @@ private native int OptimizeTNLP( public final static int RESTORATION_FAILED = -2; public final static int ERROR_IN_STEP_COMPUTATION = -3; public final static int CPUTIME_EXCEEDED = -4; + public final static int WALLTIME_EXCEEDED = -5; ///< @since 3.14.0 public final static int NOT_ENOUGH_DEGREES_OF_FRE = -10; public final static int INVALID_PROBLEM_DEFINITION = -11; public final static int INVALID_OPTION = -12; @@ -118,6 +151,10 @@ private native int OptimizeTNLP( public final static int INSUFFICIENT_MEMORY = -102; public final static int INTERNAL_ERROR = -199; + /* The possible algorithm modes (passed to intermediate_callback) */ + public final static int REGULARMODE = 0; ///< @since 3.14.0 + public final static int RESTORATIONPHASEMODE = 1; ///< @since 3.14.0 + /** Pointer to the native optimization object */ private long ipopt; @@ -130,7 +167,7 @@ private native int OptimizeTNLP( private double x[]; /** Final value of objective function */ - private double obj_val[] = {0.0}; + private double obj_val[] = {0}; /** Values of constraint at final point */ private double g[]; @@ -152,8 +189,6 @@ private native int OptimizeTNLP( * This expects the the Ipopt DLL can somehow be found * and that it has the canoncial name "ipopt" (on Unix, et.al.) * or "ipopt-3" or "ipopt-0" (on Windows). - * - * @see #Ipopt() */ public Ipopt() { @@ -170,6 +205,13 @@ public Ipopt() { try { + /* This loads the Ipopt library with RTLD_LOCAL, which means that symbols loaded are not made available for future dlopen() calls. + * This causes a problem when using MKL, which loads an additional library at runtime, e.g., libmkl_avx2, because this lib references + * to symbols that could be resolved in previously load MKL libraries - but are not because of RTLD_LOCAL. + * TODO should one add some kind of workaround to load the Ipopt lib with RTLD_GLOBAL?, e.g., + * https://stackoverflow.com/questions/5425034/java-load-shared-libraries-with-dependencies + * https://github.com/victor-paltz/global-load-library + */ System.loadLibrary(c); loadedlib = true; break; @@ -193,8 +235,6 @@ public Ipopt() * The given file must be located in some library search path. * * @param DLL the name of the DLL (without the extension or any platform dependent prefix). - * - * @see #Ipopt() */ public Ipopt( String DLL) @@ -208,8 +248,6 @@ public Ipopt( * * @param path the path where the DLL is found. * @param DLL the name of the DLL (without the extension or any platform dependent prefix). - * - * @see #Ipopt() */ public Ipopt( String path, @@ -220,7 +258,6 @@ public Ipopt( System.load(file.getAbsolutePath()); } - /** Method to request bounds on the variables and constraints. * * The values of n and m that were specified in create() and are passed @@ -379,7 +416,6 @@ abstract protected boolean eval_jac_g( double[] values ); - /** Method to request either the sparsity structure or the values of the Hessian of the Lagrangian. * * The Hessian matrix that Ipopt uses is the sum of the Hessian matrices of objective function (multiplied by obj_factor) @@ -562,7 +598,7 @@ public boolean setStringOption( * * @return the solve status * - * @see #getStatus() + * @see getStatus() */ public int OptimizeNLP() { @@ -573,6 +609,101 @@ public int OptimizeNLP() return this.status; } + /** Get primal and dual variable values of the current iterate. + * + * This method can be used to get the values of the current iterate during intermediate_callback(). + * The method expects the number of variables (dimension of x), number of constraints (dimension of g(x)), + * and allocated arrays of appropriate lengths as input. + * + * The method translates the x(), c(), d(), y_c(), y_d(), z_L(), and z_U() vectors from Ipopt::IpoptData::curr() + * of the internal NLP representation into the form used by the TNLP. + * For the correspondence between scaled and unscaled solutions, see the detailed description of Ipopt::OrigIpoptNLP. + * If %Ipopt is in restoration mode, it maps the current iterate of restoration %NLP (see Ipopt::RestoIpoptNLP) back to the original TNLP. + * + * If there are fixed variables and fixed_variable_treatment=make_parameter, then requesting z_L and z_U can trigger a reevaluation of + * the Gradient of the objective function and the Jacobian of the constraint functions. + * + * @param ip_data (in) Ipopt Data (pass on value given to intermediate_callback) + * @param ip_cq (in) Ipopt Calculated Quantities (pass on value given to intermediate_callback) + * @param scaled (in) whether to retrieve scaled or unscaled iterate + * @param n (in) the number of variables \f$x\f$ in the problem; can be arbitrary if skipping x, z_L, and z_U + * @param x (out) buffer to store value of primal variables \f$x\f$, must have length at least n; pass null to skip retrieving x + * @param z_L (out) buffer to store the lower bound multipliers \f$z_L\f$, must have length at least n; pass null to skip retrieving z_L and z_U + * @param z_U (out) buffer to store the upper bound multipliers \f$z_U\f$, must have length at least n; pass null to skip retrieving z_L and z_U + * @param m (in) the number of constraints \f$g(x)\f$; can be arbitrary if skipping g and lambda + * @param g (out) buffer to store the constraint values \f$g(x)\f$, must have length at least m; pass null to skip retrieving g + * @param lambda (out) buffer to store the constraint multipliers \f$\lambda\f$, must have length at least m; pass null to skip retrieving lambda + * + * @return Whether Ipopt has successfully filled the given arrays + * @since 3.14.0 + */ + public boolean get_curr_iterate( + long ip_data, + long ip_cq, + boolean scaled, + int n, + double x[], + double z_L[], + double z_U[], + int m, + double g[], + double lambda[] + ) + { + return this.GetCurrIterate(ipopt, ip_data, ip_cq, scaled, n, x, z_L, z_U, m, g, lambda); + } + + /** Get primal and dual infeasibility of the current iterate. + * + * This method can be used to get the violations of constraints and optimality conditions + * at the current iterate, e.g., during intermediate_callback(). + * The method expects the number of variables (dimension of x), number of constraints (dimension of g(x)), + * and allocated arrays of appropriate lengths as input. + * + * The method makes the vectors behind (unscaled_)curr_nlp_constraint_violation(), (unscaled_)curr_dual_infeasibility(), (unscaled_)curr_complementarity() + * from Ipopt::IpoptCalculatedQuantities of the internal NLP representation available into the form used by the TNLP. + * If %Ipopt is in restoration mode, it maps the current iterate of restoration %NLP (see Ipopt::RestoIpoptNLP) back to the original TNLP. + * + * @note If in restoration phase, then requesting grad_lag_x can trigger a call to eval_grad_f(). + * + * @note Ipopt by default relaxes variable bounds (option bound_relax_factor > 0.0). + * x_L_violation and x_U_violation report the violation of a solution w.r.t. the original unrelaxed bounds. + * However, compl_x_L and compl_x_U use the relaxed variable bounds to calculate the complementarity. + * + * @param ip_data (in) Ipopt Data (pass on value given to intermediate_callback) + * @param ip_cq (in) Ipopt Calculated Quantities (pass on value given to intermediate_callback) + * @param scaled (in) whether to retrieve scaled or unscaled violations + * @param n (in) the number of variables \f$x\f$ in the problem; can be arbitrary if skipping compl_x_L, compl_x_U, and grad_lag_x + * @param x_L_violation (out) buffer to store violation of original lower bounds on variables (max(orig_x_L-x,0)), must have length at least n; pass NULL to skip retrieving orig_x_L + * @param x_U_violation (out) buffer to store violation of original upper bounds on variables (max(x-orig_x_U,0)), must have length at least n; pass NULL to skip retrieving orig_x_U + * @param compl_x_L (out) buffer to store violation of complementarity for lower bounds on variables (\f$(x-x_L)z_L\f$), must have length at least n; pass null to skip retrieving compl_x_L + * @param compl_x_U (out) buffer to store violation of complementarity for upper bounds on variables (\f$(x_U-x)z_U\f$), must have length at least n; pass null to skip retrieving compl_x_U + * @param grad_lag_x (out) buffer to store gradient of Lagrangian w.r.t. variables \f$x\f$, must have length at least n; pass null to skip retrieving grad_lag_x + * @param m (in) the number of constraints \f$g(x)\f$; can be arbitrary if skipping lambda + * @param nlp_constraint_violation (out) buffer to store violation of constraints \f$max(g_l-g(x),g(x)-g_u,0)\f$, must have length at least m; pass null to skip retrieving constraint_violation + * @param compl_g (out) buffer to store violation of complementarity of constraint (\f$(g(x)-g_l)*\lambda^+ + (g_l-g(x))*\lambda^-\f$, where \f$\lambda^+=max(0,\lambda)\f$ and \f$\lambda^-=max(0,-\lambda)\f$ (componentwise)), must have length at least m; pass null to skip retrieving compl_g + * + * @return Whether Ipopt has successfully filled the given arrays + * @since 3.14.0 + */ + public boolean get_curr_violations( + long ip_data, + long ip_cq, + boolean scaled, + int n, + double x_L_violation[], + double x_U_violation[], + double compl_x_L[], + double compl_x_U[], + double grad_lag_x[], + int m, + double nlp_constraint_violation[], + double compl_g[] + ) + { + return this.GetCurrViolations(ipopt, ip_data, ip_cq, scaled, n, x_L_violation, x_U_violation, compl_x_L, compl_x_U, grad_lag_x, m, nlp_constraint_violation, compl_g); + } + /** Gives primal variable values at final point. * @return the primal variable values at the final point. */ @@ -592,7 +723,7 @@ public double getObjectiveValue() /** Gives Ipopt status of last OptimizeNLP call. * @return the status of the solver. * - * @see #OptimizeNLP() + * @see OptimizeNLP() */ public int getStatus() { @@ -631,6 +762,48 @@ public double[] getUpperBoundMultipliers() return mult_x_U; } + /** Intermediate Callback method for the user. + * + * This method is called once per iteration (during the convergence check), + * and can be used to obtain information about the optimization status while + * %Ipopt solves the problem, and also to request a premature termination. + * + * The information provided by the entities in the argument list correspond + * to what %Ipopt prints in the iteration summary (see also \ref OUTPUT), + * except for inf_pr, which by default corresponds to the original problem + * in the log but to the scaled internal problem in this callback. + * The value of algorithmmode is either REGULARMODE or RESTORATIONPHASEMODE. + * + * The current iterate and violations of feasibility and optimality can be + * accessed via the methods get_curr_iterate() and get_curr_violations(). + * These methods translate values for the *internal representation* of + * the problem from `ip_data` and `ip_cq` objects. + * + * @return If this method returns false, %Ipopt will terminate with the + * User_Requested_Stop status. + * + * It is not required to implement (overload) this method. + * The default implementation always returns true. + * @since 3.14.0 + */ + public boolean intermediate_callback( + int algorithmmode, + int iter, + double obj_value, + double inf_pr, + double inf_du, + double mu, + double d_norm, + double regularization_size, + double alpha_du, + double alpha_pr, + int ls_trials, + long ip_data, + long ip_cq) + { + return true; + } + /** If you using_scaling_parameters = true, this method should be overloaded. * * To instruct IPOPT to use scaling values for variables, the first element of use_x_g_scaling should be set. diff --git a/src/Interfaces/Makefile.am b/src/Interfaces/Makefile.am deleted file mode 100644 index 2c526fe26..000000000 --- a/src/Interfaces/Makefile.am +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (C) 2004, 2008 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpAlgTypes.hpp \ - IpIpoptApplication.hpp \ - IpNLP.hpp \ - IpReturnCodes.h \ - IpReturnCodes.hpp \ - IpReturnCodes_inc.h \ - IpReturnCodes.inc \ - IpSolveStatistics.hpp \ - IpStdCInterface.h \ - IpTNLP.hpp \ - IpTNLPAdapter.hpp \ - IpTNLPReducer.hpp - -lib_LTLIBRARIES = libipopt.la - -libipopt_la_SOURCES = \ - IpInterfacesRegOp.cpp \ - IpIpoptApplication.cpp \ - IpSolveStatistics.cpp \ - IpStdCInterface.cpp \ - IpStdInterfaceTNLP.cpp \ - IpStdFInterface.c \ - IpTNLPAdapter.cpp \ - IpTNLPReducer.cpp - -if BUILD_JAVA -libipopt_la_SOURCES += IpStdJInterface.cpp org_coinor_Ipopt.h -BUILT_SOURCES = org_coinor_Ipopt.h - -org.coinor.ipopt.jar : org/coinor/Ipopt.class - $(JAR) cf $@ $< - -# had -target 1.8 -source 1.8, but that produces a warning if Java 8 RT is not setup -org/coinor/Ipopt.class org_coinor_Ipopt.h : $(srcdir)/Ipopt.java - $(JAVAC) $< -d $(PWD) -h $(PWD) - -all-local : org.coinor.ipopt.jar - -CLEANFILES = org.coinor.ipopt.jar org/coinor/Ipopt.class org_coinor_Ipopt.h - -install-exec-local : - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) org.coinor.ipopt.jar "$(DESTDIR)$(libdir)" -uninstall-local : - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/org.coinor.ipopt.jar" - -endif - -libipopt_la_LIBADD = $(IPALLLIBS) $(IPOPTLIB_LFLAGS) -# probably we need to make this explicit because we set use a variable $(IPALLLIBS) in LIBADD -libipopt_la_DEPENDENCIES = $(IPALLLIBS) - -libipopt_la_LDFLAGS = $(LT_LDFLAGS) - -AM_CPPFLAGS = \ - -I$(srcdir)/../Common \ - -I$(srcdir)/../LinAlg \ - -I$(srcdir)/../Algorithm/LinearSolvers \ - -I$(srcdir)/../LinAlg/TMatrices \ - -I$(srcdir)/../Algorithm \ - -I$(srcdir)/../Algorithm/Inexact \ - -I$(srcdir)/../contrib/CGPenalty \ - -I$(srcdir)/../contrib/LinearSolverLoader \ - $(IPOPTLIB_CFLAGS) diff --git a/src/Interfaces/Makefile.in b/src/Interfaces/Makefile.in deleted file mode 100644 index ed965305b..000000000 --- a/src/Interfaces/Makefile.in +++ /dev/null @@ -1,837 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2004, 2008 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - - -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@BUILD_JAVA_TRUE@am__append_1 = IpStdJInterface.cpp org_coinor_Ipopt.h -subdir = src/Interfaces -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -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 -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -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__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includeipoptdir)" -LTLIBRARIES = $(lib_LTLIBRARIES) -am__DEPENDENCIES_1 = -@BUILD_JAVA_TRUE@am__objects_1 = IpStdJInterface.lo -am_libipopt_la_OBJECTS = IpInterfacesRegOp.lo IpIpoptApplication.lo \ - IpSolveStatistics.lo IpStdCInterface.lo IpStdInterfaceTNLP.lo \ - IpStdFInterface.lo IpTNLPAdapter.lo IpTNLPReducer.lo \ - $(am__objects_1) -libipopt_la_OBJECTS = $(am_libipopt_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 = -libipopt_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(libipopt_la_LDFLAGS) $(LDFLAGS) -o $@ -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)/IpInterfacesRegOp.Plo \ - ./$(DEPDIR)/IpIpoptApplication.Plo \ - ./$(DEPDIR)/IpSolveStatistics.Plo \ - ./$(DEPDIR)/IpStdCInterface.Plo \ - ./$(DEPDIR)/IpStdFInterface.Plo \ - ./$(DEPDIR)/IpStdInterfaceTNLP.Plo \ - ./$(DEPDIR)/IpStdJInterface.Plo ./$(DEPDIR)/IpTNLPAdapter.Plo \ - ./$(DEPDIR)/IpTNLPReducer.Plo -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -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) \ - $(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) \ - $(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 = -SOURCES = $(libipopt_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -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 -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpAlgTypes.hpp \ - IpIpoptApplication.hpp \ - IpNLP.hpp \ - IpReturnCodes.h \ - IpReturnCodes.hpp \ - IpReturnCodes_inc.h \ - IpReturnCodes.inc \ - IpSolveStatistics.hpp \ - IpStdCInterface.h \ - IpTNLP.hpp \ - IpTNLPAdapter.hpp \ - IpTNLPReducer.hpp - -lib_LTLIBRARIES = libipopt.la -libipopt_la_SOURCES = IpInterfacesRegOp.cpp IpIpoptApplication.cpp \ - IpSolveStatistics.cpp IpStdCInterface.cpp \ - IpStdInterfaceTNLP.cpp IpStdFInterface.c IpTNLPAdapter.cpp \ - IpTNLPReducer.cpp $(am__append_1) -@BUILD_JAVA_TRUE@BUILT_SOURCES = org_coinor_Ipopt.h -@BUILD_JAVA_TRUE@CLEANFILES = org.coinor.ipopt.jar org/coinor/Ipopt.class org_coinor_Ipopt.h -libipopt_la_LIBADD = $(IPALLLIBS) $(IPOPTLIB_LFLAGS) -# probably we need to make this explicit because we set use a variable $(IPALLLIBS) in LIBADD -libipopt_la_DEPENDENCIES = $(IPALLLIBS) -libipopt_la_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir)/../Common \ - -I$(srcdir)/../LinAlg \ - -I$(srcdir)/../Algorithm/LinearSolvers \ - -I$(srcdir)/../LinAlg/TMatrices \ - -I$(srcdir)/../Algorithm \ - -I$(srcdir)/../Algorithm/Inexact \ - -I$(srcdir)/../contrib/CGPenalty \ - -I$(srcdir)/../contrib/LinearSolverLoader \ - $(IPOPTLIB_CFLAGS) - -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .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 ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Interfaces/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Interfaces/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - 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)"; \ - } - -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"; \ - 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}; \ - } - -libipopt.la: $(libipopt_la_OBJECTS) $(libipopt_la_DEPENDENCIES) $(EXTRA_libipopt_la_DEPENDENCIES) - $(AM_V_CXXLD)$(libipopt_la_LINK) -rpath $(libdir) $(libipopt_la_OBJECTS) $(libipopt_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpInterfacesRegOp.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpIpoptApplication.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpSolveStatistics.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpStdCInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpStdFInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpStdInterfaceTNLP.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpStdJInterface.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTNLPAdapter.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTNLPReducer.Plo@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -.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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -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 \ - 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 $$?; \ - 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 - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -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) \ - $$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 - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -@BUILD_JAVA_FALSE@all-local: -all-am: Makefile $(LTLIBRARIES) $(HEADERS) all-local -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includeipoptdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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 -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -@BUILD_JAVA_FALSE@uninstall-local: -@BUILD_JAVA_FALSE@install-exec-local: -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/IpInterfacesRegOp.Plo - -rm -f ./$(DEPDIR)/IpIpoptApplication.Plo - -rm -f ./$(DEPDIR)/IpSolveStatistics.Plo - -rm -f ./$(DEPDIR)/IpStdCInterface.Plo - -rm -f ./$(DEPDIR)/IpStdFInterface.Plo - -rm -f ./$(DEPDIR)/IpStdInterfaceTNLP.Plo - -rm -f ./$(DEPDIR)/IpStdJInterface.Plo - -rm -f ./$(DEPDIR)/IpTNLPAdapter.Plo - -rm -f ./$(DEPDIR)/IpTNLPReducer.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-includeipoptHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-exec-local install-libLTLIBRARIES - -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 -f ./$(DEPDIR)/IpInterfacesRegOp.Plo - -rm -f ./$(DEPDIR)/IpIpoptApplication.Plo - -rm -f ./$(DEPDIR)/IpSolveStatistics.Plo - -rm -f ./$(DEPDIR)/IpStdCInterface.Plo - -rm -f ./$(DEPDIR)/IpStdFInterface.Plo - -rm -f ./$(DEPDIR)/IpStdInterfaceTNLP.Plo - -rm -f ./$(DEPDIR)/IpStdJInterface.Plo - -rm -f ./$(DEPDIR)/IpTNLPAdapter.Plo - -rm -f ./$(DEPDIR)/IpTNLPReducer.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-includeipoptHEADERS uninstall-libLTLIBRARIES \ - uninstall-local - -.MAKE: all check install install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am all-local am--depfiles check \ - check-am clean 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-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-exec-local \ - install-html install-html-am install-includeipoptHEADERS \ - install-info install-info-am install-libLTLIBRARIES \ - install-man install-pdf install-pdf-am 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-includeipoptHEADERS \ - uninstall-libLTLIBRARIES uninstall-local - -.PRECIOUS: Makefile - - -@BUILD_JAVA_TRUE@org.coinor.ipopt.jar : org/coinor/Ipopt.class -@BUILD_JAVA_TRUE@ $(JAR) cf $@ $< - -# had -target 1.8 -source 1.8, but that produces a warning if Java 8 RT is not setup -@BUILD_JAVA_TRUE@org/coinor/Ipopt.class org_coinor_Ipopt.h : $(srcdir)/Ipopt.java -@BUILD_JAVA_TRUE@ $(JAVAC) $< -d $(PWD) -h $(PWD) - -@BUILD_JAVA_TRUE@all-local : org.coinor.ipopt.jar - -@BUILD_JAVA_TRUE@install-exec-local : -@BUILD_JAVA_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) org.coinor.ipopt.jar "$(DESTDIR)$(libdir)" -@BUILD_JAVA_TRUE@uninstall-local : -@BUILD_JAVA_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/org.coinor.ipopt.jar" - -# 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/LinAlg/IpBlas.cpp b/src/LinAlg/IpBlas.cpp index c736a934f..735e5e27d 100644 --- a/src/LinAlg/IpBlas.cpp +++ b/src/LinAlg/IpBlas.cpp @@ -6,6 +6,7 @@ #include "IpoptConfig.h" #include "IpBlas.hpp" +#include "IpTypes.h" /* we currently have no separate check for Blas, but assume that Blas comes with Lapack * thus, we use the nameing convention of Lapack for Blas, too @@ -14,157 +15,168 @@ #define IPOPT_BLAS_FUNC(name,NAME) IPOPT_LAPACK_FUNC(name,NAME) #endif +#ifdef IPOPT_SINGLE +#define IPOPT_BLAS_FUNCP(name,NAME) IPOPT_BLAS_FUNC(s ## name,S ## NAME) +#else +#define IPOPT_BLAS_FUNCP(name,NAME) IPOPT_BLAS_FUNC(d ## name,D ## NAME) +#endif + #include // Prototypes for the BLAS routines extern "C" { - /** BLAS Fortran function DDOT */ - double IPOPT_BLAS_FUNC(ddot, DDOT)( - ipfint* n, - const double* x, - ipfint* incX, - const double* y, - ipfint* incY + /** BLAS Fortran function XDOT */ + ipnumber IPOPT_BLAS_FUNCP(dot, DOT)( + ipindex* n, + const ipnumber* x, + ipindex* incX, + const ipnumber* y, + ipindex* incY ); - /** BLAS Fortran function DNRM2 */ - double IPOPT_BLAS_FUNC(dnrm2, DNRM2)( - ipfint* n, - const double* x, - ipfint* incX + /** BLAS Fortran function XNRM2 */ + ipnumber IPOPT_BLAS_FUNCP(nrm2, NRM2)( + ipindex* n, + const ipnumber* x, + ipindex* incX ); - /** BLAS Fortran function DASUM */ - double IPOPT_BLAS_FUNC(dasum, DASUM)( - ipfint* n, - const double* x, - ipfint* incX + /** BLAS Fortran function XASUM */ + ipnumber IPOPT_BLAS_FUNCP(asum, ASUM)( + ipindex* n, + const ipnumber* x, + ipindex* incX ); +#ifdef IPOPT_SINGLE + /** BLAS Fortran function ISAMAX */ + ipindex IPOPT_BLAS_FUNC(isamax, ISAMAX)( +#else /** BLAS Fortran function IDAMAX */ - ipfint IPOPT_BLAS_FUNC(idamax, IDAMAX)( - ipfint* n, - const double* x, - ipfint* incX + ipindex IPOPT_BLAS_FUNC(idamax, IDAMAX)( +#endif + ipindex* n, + const ipnumber* x, + ipindex* incX ); - /** BLAS Fortran subroutine DCOPY */ - void IPOPT_BLAS_FUNC(dcopy, DCOPY)( - ipfint* n, - const double* x, - ipfint* incX, - double* y, - ipfint* incY + /** BLAS Fortran subroutine XCOPY */ + void IPOPT_BLAS_FUNCP(copy, COPY)( + ipindex* n, + const ipnumber* x, + ipindex* incX, + ipnumber* y, + ipindex* incY ); - /** BLAS Fortran subroutine DAXPY */ - void IPOPT_BLAS_FUNC(daxpy, DAXPY)( - ipfint* n, - const double* alpha, - const double* x, - ipfint* incX, - double* y, - ipfint* incY + /** BLAS Fortran subroutine XAXPY */ + void IPOPT_BLAS_FUNCP(axpy, AXPY)( + ipindex* n, + const ipnumber* alpha, + const ipnumber* x, + ipindex* incX, + ipnumber* y, + ipindex* incY ); - /** BLAS Fortran subroutine DSCAL */ - void IPOPT_BLAS_FUNC(dscal, DSCAL)( - ipfint* n, - const double* alpha, - const double* x, - ipfint* incX + /** BLAS Fortran subroutine XSCAL */ + void IPOPT_BLAS_FUNCP(scal, SCAL)( + ipindex* n, + const ipnumber* alpha, + const ipnumber* x, + ipindex* incX ); - /** BLAS Fortran subroutine DGEMV */ - void IPOPT_BLAS_FUNC(dgemv, DGEMV)( - char* trans, - ipfint* m, - ipfint* n, - const double* alpha, - const double* a, - ipfint* lda, - const double* x, - ipfint* incX, - const double* beta, - double* y, - ipfint* incY, - int trans_len + /** BLAS Fortran subroutine XGEMV */ + void IPOPT_BLAS_FUNCP(gemv, GEMV)( + char* trans, + ipindex* m, + ipindex* n, + const ipnumber* alpha, + const ipnumber* a, + ipindex* lda, + const ipnumber* x, + ipindex* incX, + const ipnumber* beta, + ipnumber* y, + ipindex* incY, + int trans_len ); - /** BLAS Fortran subroutine DSYMV */ - void IPOPT_BLAS_FUNC(dsymv, DSYMV)( - char* uplo, - ipfint* n, - const double* alpha, - const double* a, - ipfint* lda, - const double* x, - ipfint* incX, - const double* beta, - double* y, - ipfint* incY, - int uplo_len + /** BLAS Fortran subroutine XSYMV */ + void IPOPT_BLAS_FUNCP(symv, SYMV)( + char* uplo, + ipindex* n, + const ipnumber* alpha, + const ipnumber* a, + ipindex* lda, + const ipnumber* x, + ipindex* incX, + const ipnumber* beta, + ipnumber* y, + ipindex* incY, + int uplo_len ); - /** BLAS Fortran subroutine DGEMM */ - void IPOPT_BLAS_FUNC(dgemm, DGEMM)( - char* transa, - char* transb, - ipfint* m, - ipfint* n, - ipfint* k, - const double* alpha, - const double* a, - ipfint* lda, - const double* b, - ipfint* ldb, - const double* beta, - double* c, - ipfint* ldc, - int transa_len, - int transb_len + /** BLAS Fortran subroutine XGEMM */ + void IPOPT_BLAS_FUNCP(gemm, GEMM)( + char* transa, + char* transb, + ipindex* m, + ipindex* n, + ipindex* k, + const ipnumber* alpha, + const ipnumber* a, + ipindex* lda, + const ipnumber* b, + ipindex* ldb, + const ipnumber* beta, + ipnumber* c, + ipindex* ldc, + int transa_len, + int transb_len ); - /** BLAS Fortran subroutine DSYRK */ - void IPOPT_BLAS_FUNC(dsyrk, DSYRK)( - char* uplo, - char* trans, - ipfint* n, - ipfint* k, - const double* alpha, - const double* a, - ipfint* lda, - const double* beta, - double* c, - ipfint* ldc, - int uplo_len, - int trans_len + /** BLAS Fortran subroutine XSYRK */ + void IPOPT_BLAS_FUNCP(syrk, SYRK)( + char* uplo, + char* trans, + ipindex* n, + ipindex* k, + const ipnumber* alpha, + const ipnumber* a, + ipindex* lda, + const ipnumber* beta, + ipnumber* c, + ipindex* ldc, + int uplo_len, + int trans_len ); - /** BLAS Fortran subroutine DTRSM */ - void IPOPT_BLAS_FUNC(dtrsm, DTRSM)( - char* side, - char* uplo, - char* transa, - char* diag, - ipfint* m, - ipfint* n, - const double* alpha, - const double* a, - ipfint* lda, - const double* b, - ipfint* ldb, - int side_len, - int uplo_len, - int transa_len, - int diag_len + /** BLAS Fortran subroutine XTRSM */ + void IPOPT_BLAS_FUNCP(trsm, TRSM)( + char* side, + char* uplo, + char* transa, + char* diag, + ipindex* m, + ipindex* n, + const ipnumber* alpha, + const ipnumber* a, + ipindex* lda, + const ipnumber* b, + ipindex* ldb, + int side_len, + int uplo_len, + int transa_len, + int diag_len ); } namespace Ipopt { -Number IpBlasDdot( +Number IpBlasDot( Index size, const Number* x, Index incX, @@ -174,9 +186,8 @@ Number IpBlasDdot( { if( incX > 0 && incY > 0 ) { - ipfint n = size, INCX = incX, INCY = incY; - - return IPOPT_BLAS_FUNC(ddot, DDOT)(&n, x, &INCX, y, &INCY); + ipindex n = size, INCX = incX, INCY = incY; + return IPOPT_BLAS_FUNCP(dot, DOT)(&n, x, &INCX, y, &INCY); } else { @@ -191,42 +202,43 @@ Number IpBlasDdot( } } -Number IpBlasDnrm2( +Number IpBlasNrm2( Index size, const Number* x, Index incX ) { - ipfint n = size, INCX = incX; - - return IPOPT_BLAS_FUNC(dnrm2, DNRM2)(&n, x, &INCX); + ipindex n = size, INCX = incX; + return IPOPT_BLAS_FUNCP(nrm2, NRM2)(&n, x, &INCX); } -Number IpBlasDasum( +Number IpBlasAsum( Index size, const Number* x, Index incX ) { - ipfint n = size, INCX = incX; - - return IPOPT_BLAS_FUNC(dasum, DASUM)(&n, x, &INCX); + ipindex n = size, INCX = incX; + return IPOPT_BLAS_FUNCP(asum, ASUM)(&n, x, &INCX); } -/** interface to FORTRAN routine IDAMAX */ -Index IpBlasIdamax( +/** interface to FORTRAN routine IXAMAX */ +Index IpBlasIamax( Index size, const Number* x, Index incX ) { - ipfint n = size, INCX = incX; - - return (Index) IPOPT_BLAS_FUNC(idamax, IDAMAX)(&n, x, &INCX); + ipindex n = size, INCX = incX; +#ifdef IPOPT_SINGLE + return IPOPT_BLAS_FUNC(isamax, ISAMAX)(&n, x, &INCX); +#else + return IPOPT_BLAS_FUNC(idamax, IDAMAX)(&n, x, &INCX); +#endif } -/** interface to FORTRAN routine DCOPY */ -void IpBlasDcopy( +/** interface to FORTRAN routine XCOPY */ +void IpBlasCopy( Index size, const Number* x, Index incX, @@ -236,9 +248,8 @@ void IpBlasDcopy( { if( incX > 0 ) { - ipfint N = size, INCX = incX, INCY = incY; - - IPOPT_BLAS_FUNC(dcopy, DCOPY)(&N, x, &INCX, y, &INCY); + ipindex N = size, INCX = incX, INCY = incY; + IPOPT_BLAS_FUNCP(copy, COPY)(&N, x, &INCX, y, &INCY); } else if( incY == 1 ) { @@ -256,7 +267,7 @@ void IpBlasDcopy( } } -void IpBlasDaxpy( +void IpBlasAxpy( Index size, Number alpha, const Number* x, @@ -267,9 +278,8 @@ void IpBlasDaxpy( { if( incX > 0 ) { - ipfint N = size, INCX = incX, INCY = incY; - - IPOPT_BLAS_FUNC(daxpy, DAXPY)(&N, &alpha, x, &INCX, y, &INCY); + ipindex N = size, INCX = incX, INCY = incY; + IPOPT_BLAS_FUNCP(axpy, AXPY)(&N, &alpha, x, &INCX, y, &INCY); } else if( incY == 1 ) { @@ -287,19 +297,18 @@ void IpBlasDaxpy( } } -void IpBlasDscal( +void IpBlasScal( Index size, Number alpha, Number* x, Index incX ) { - ipfint N = size, INCX = incX; - - IPOPT_BLAS_FUNC(dscal, DSCAL)(&N, &alpha, x, &INCX); + ipindex N = size, INCX = incX; + IPOPT_BLAS_FUNCP(scal, SCAL)(&N, &alpha, x, &INCX); } -void IpBlasDgemv( +void IpBlasGemv( bool trans, Index nRows, Index nCols, @@ -313,7 +322,7 @@ void IpBlasDgemv( Index incY ) { - ipfint M = nCols, N = nRows, LDA = ldA, INCX = incX, INCY = incY; + ipindex M = nCols, N = nRows, LDA = ldA, INCX = incX, INCY = incY; char TRANS; if( trans ) @@ -324,11 +333,10 @@ void IpBlasDgemv( { TRANS = 'N'; } - - IPOPT_BLAS_FUNC(dgemv, DGEMV)(&TRANS, &M, &N, &alpha, A, &LDA, x, &INCX, &beta, y, &INCY, 1); + IPOPT_BLAS_FUNCP(gemv, GEMV)(&TRANS, &M, &N, &alpha, A, &LDA, x, &INCX, &beta, y, &INCY, 1); } -void IpBlasDsymv( +void IpBlasSymv( Index n, Number alpha, const Number* A, @@ -340,14 +348,13 @@ void IpBlasDsymv( Index incY ) { - ipfint N = n, LDA = ldA, INCX = incX, INCY = incY; + ipindex N = n, LDA = ldA, INCX = incX, INCY = incY; char UPLO = 'L'; - - IPOPT_BLAS_FUNC(dsymv, DSYMV)(&UPLO, &N, &alpha, A, &LDA, x, &INCX, &beta, y, &INCY, 1); + IPOPT_BLAS_FUNCP(symv, SYMV)(&UPLO, &N, &alpha, A, &LDA, x, &INCX, &beta, y, &INCY, 1); } -void IpBlasDgemm( +void IpBlasGemm( bool transa, bool transb, Index m, @@ -363,7 +370,7 @@ void IpBlasDgemm( Index ldC ) { - ipfint M = m, N = n, K = k, LDA = ldA, LDB = ldB, LDC = ldC; + ipindex M = m, N = n, K = k, LDA = ldA, LDB = ldB, LDC = ldC; char TRANSA; if( transa ) @@ -383,11 +390,10 @@ void IpBlasDgemm( { TRANSB = 'N'; } - - IPOPT_BLAS_FUNC(dgemm, DGEMM)(&TRANSA, &TRANSB, &M, &N, &K, &alpha, A, &LDA, B, &LDB, &beta, C, &LDC, 1, 1); + IPOPT_BLAS_FUNCP(gemm, GEMM)(&TRANSA, &TRANSB, &M, &N, &K, &alpha, A, &LDA, B, &LDB, &beta, C, &LDC, 1, 1); } -void IpBlasDsyrk( +void IpBlasSyrk( bool trans, Index ndim, Index nrank, @@ -399,7 +405,7 @@ void IpBlasDsyrk( Index ldC ) { - ipfint N = ndim, K = nrank, LDA = ldA, LDC = ldC; + ipindex N = ndim, K = nrank, LDA = ldA, LDC = ldC; char UPLO = 'L'; char TRANS; @@ -411,11 +417,10 @@ void IpBlasDsyrk( { TRANS = 'N'; } - - IPOPT_BLAS_FUNC(dsyrk, DSYRK)(&UPLO, &TRANS, &N, &K, &alpha, A, &LDA, &beta, C, &LDC, 1, 1); + IPOPT_BLAS_FUNCP(syrk, SYRK)(&UPLO, &TRANS, &N, &K, &alpha, A, &LDA, &beta, C, &LDC, 1, 1); } -void IpBlasDtrsm( +void IpBlasTrsm( bool trans, Index ndim, Index nrhs, @@ -426,7 +431,7 @@ void IpBlasDtrsm( Index ldB ) { - ipfint M = ndim, N = nrhs, LDA = ldA, LDB = ldB; + ipindex M = ndim, N = nrhs, LDA = ldA, LDB = ldB; char SIDE = 'L'; char UPLO = 'L'; @@ -440,8 +445,7 @@ void IpBlasDtrsm( TRANSA = 'N'; } char DIAG = 'N'; - - IPOPT_BLAS_FUNC(dtrsm, DTRSM)(&SIDE, &UPLO, &TRANSA, &DIAG, &M, &N, &alpha, A, &LDA, B, &LDB, 1, 1, 1, 1); + IPOPT_BLAS_FUNCP(trsm, TRSM)(&SIDE, &UPLO, &TRANSA, &DIAG, &M, &N, &alpha, A, &LDA, B, &LDB, 1, 1, 1, 1); } } // namespace Ipopt diff --git a/src/LinAlg/IpBlas.hpp b/src/LinAlg/IpBlas.hpp index 380cc3120..3a7d062f7 100644 --- a/src/LinAlg/IpBlas.hpp +++ b/src/LinAlg/IpBlas.hpp @@ -11,23 +11,70 @@ namespace Ipopt { +/** Wrapper for BLAS function XDOT. + * + * Compute dot product of vector x and vector y. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT Number IpBlasDot( + Index size, + const Number* x, + Index incX, + const Number* y, + Index incY +); + /** Wrapper for BLAS function DDOT. * * Compute dot product of vector x and vector y. + * + * @deprecated Use IpBlasDot() instead. */ -IPOPTLIB_EXPORT Number IpBlasDdot( +IPOPT_DEPRECATED +inline Number IpBlasDdot( Index size, const Number* x, Index incX, const Number* y, Index incY +) +{ + return IpBlasDot(size, x, incX, y, incY); +} + +/** Wrapper for BLAS function XNRM2. + * + * Compute 2-norm of vector x. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT Number IpBlasNrm2( + Index size, + const Number* x, + Index incX ); /** Wrapper for BLAS function DNRM2. * * Compute 2-norm of vector x. + * + * @deprecated Use IpBlasNrm2() instead. */ -IPOPTLIB_EXPORT Number IpBlasDnrm2( +IPOPT_DEPRECATED +inline Number IpBlasDnrm2( + Index size, + const Number* x, + Index incX +) +{ + return IpBlasNrm2(size, x, incX); +} + +/** Wrapper for BLAS function XASUM. + * + * Compute 1-norm of vector x. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT Number IpBlasAsum( Index size, const Number* x, Index incX @@ -36,8 +83,25 @@ IPOPTLIB_EXPORT Number IpBlasDnrm2( /** Wrapper for BLAS function DASUM. * * Compute 1-norm of vector x. + * + * @deprecated Use IpBlasAsum() instead. */ -IPOPTLIB_EXPORT Number IpBlasDasum( +IPOPT_DEPRECATED +inline Number IpBlasDasum( + Index size, + const Number* x, + Index incX +) +{ + return IpBlasAsum(size, x, incX); +} + +/** Wrapper for BLAS function IXAMAX. + * + * Compute index for largest absolute element of vector x. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT Index IpBlasIamax( Index size, const Number* x, Index incX @@ -46,19 +110,58 @@ IPOPTLIB_EXPORT Number IpBlasDasum( /** Wrapper for BLAS function IDAMAX. * * Compute index for largest absolute element of vector x. + * + * @deprecated Use IpBlasIamax() instead. */ -IPOPTLIB_EXPORT int IpBlasIdamax( +IPOPT_DEPRECATED +inline int IpBlasIdamax( Index size, const Number* x, Index incX +) +{ + return (int)IpBlasIamax(size, x, incX); +} + +/** Wrapper for BLAS subroutine XCOPY. + * + * Copying vector x into vector y. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpBlasCopy( + Index size, + const Number* x, + Index incX, + Number* y, + Index incY ); /** Wrapper for BLAS subroutine DCOPY. * * Copying vector x into vector y. + * + * @deprecated Use IpBlasCopy() instead. + */ +IPOPT_DEPRECATED +inline void IpBlasDcopy( + Index size, + const Number* x, + Index incX, + Number* y, + Index incY +) +{ + IpBlasCopy(size, x, incX, y, incY); +} + +/** Wrapper for BLAS subroutine XAXPY. + * + * Adding the alpha multiple of vector x to vector y. + * @since 3.14.0 */ -IPOPTLIB_EXPORT void IpBlasDcopy( +IPOPTLIB_EXPORT void IpBlasAxpy( Index size, + Number alpha, const Number* x, Index incX, Number* y, @@ -68,32 +171,78 @@ IPOPTLIB_EXPORT void IpBlasDcopy( /** Wrapper for BLAS subroutine DAXPY. * * Adding the alpha multiple of vector x to vector y. + * + * @deprecated Use IpBlasAxpy() instead. */ -IPOPTLIB_EXPORT void IpBlasDaxpy( +IPOPT_DEPRECATED +inline void IpBlasDaxpy( Index size, Number alpha, const Number* x, Index incX, Number* y, Index incY +) +{ + IpBlasAxpy(size, alpha, x, incX, y, incY); +} + +/** Wrapper for BLAS subroutine XSCAL. + * + * Scaling vector x by scalar alpha. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpBlasScal( + Index size, + Number alpha, + Number* x, + Index incX ); /** Wrapper for BLAS subroutine DSCAL. * * Scaling vector x by scalar alpha. + * + * @deprecated Use IpBlasScal() instead. */ -IPOPTLIB_EXPORT void IpBlasDscal( +IPOPT_DEPRECATED +inline void IpBlasDscal( Index size, Number alpha, Number* x, Index incX +) +{ + IpBlasScal(size, alpha, x, incX); +} + +/** Wrapper for BLAS subroutine XGEMV. + * + * Multiplying a matrix with a vector. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpBlasGemv( + bool trans, + Index nRows, + Index nCols, + Number alpha, + const Number* A, + Index ldA, + const Number* x, + Index incX, + Number beta, + Number* y, + Index incY ); /** Wrapper for BLAS subroutine DGEMV. * * Multiplying a matrix with a vector. + * + * @deprecated Use IpBlasGemv() instead. */ -IPOPTLIB_EXPORT void IpBlasDgemv( +IPOPT_DEPRECATED +inline void IpBlasDgemv( bool trans, Index nRows, Index nCols, @@ -105,13 +254,36 @@ IPOPTLIB_EXPORT void IpBlasDgemv( Number beta, Number* y, Index incY +) +{ + IpBlasGemv(trans, nRows, nCols, alpha, A, ldA, x, incX, beta, y, incY); +} + +/** Wrapper for BLAS subroutine XSYMV. + * + * Multiplying a symmetric matrix with a vector. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpBlasSymv( + Index n, + Number alpha, + const Number* A, + Index ldA, + const Number* x, + Index incX, + Number beta, + Number* y, + Index incY ); /** Wrapper for BLAS subroutine DSYMV. * * Multiplying a symmetric matrix with a vector. + * + * @deprecated Use IpBlasSymv() instead. */ -IPOPTLIB_EXPORT void IpBlasDsymv( +IPOPT_DEPRECATED +inline void IpBlasDsymv( Index n, Number alpha, const Number* A, @@ -121,13 +293,40 @@ IPOPTLIB_EXPORT void IpBlasDsymv( Number beta, Number* y, Index incY +) +{ + IpBlasSymv(n, alpha, A, ldA, x, incX, beta, y, incY); +} + +/** Wrapper for BLAS subroutine XGEMM. + * + * Multiplying two matrices. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpBlasGemm( + bool transa, + bool transb, + Index m, + Index n, + Index k, + Number alpha, + const Number* A, + Index ldA, + const Number* B, + Index ldB, + Number beta, + Number* C, + Index ldC ); /** Wrapper for BLAS subroutine DGEMM. * * Multiplying two matrices. + * + * @deprecated Use IpBlasGemm() instead. */ -IPOPTLIB_EXPORT void IpBlasDgemm( +IPOPT_DEPRECATED +inline void IpBlasDgemm( bool transa, bool transb, Index m, @@ -141,13 +340,36 @@ IPOPTLIB_EXPORT void IpBlasDgemm( Number beta, Number* C, Index ldC +) +{ + IpBlasGemm(transa, transb, m, n, k, alpha, A, ldA, B, ldB, beta, C, ldC); +} + +/** Wrapper for BLAS subroutine XSYRK. + * + * Adding a high-rank update to a matrix. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpBlasSyrk( + bool trans, + Index ndim, + Index nrank, + Number alpha, + const Number* A, + Index ldA, + Number beta, + Number* C, + Index ldC ); /** Wrapper for BLAS subroutine DSYRK. * * Adding a high-rank update to a matrix. + * + * @deprecated Use IpBlasSyrk() instead. */ -IPOPTLIB_EXPORT void IpBlasDsyrk( +IPOPT_DEPRECATED +inline void IpBlasDsyrk( bool trans, Index ndim, Index nrank, @@ -157,13 +379,35 @@ IPOPTLIB_EXPORT void IpBlasDsyrk( Number beta, Number* C, Index ldC +) +{ + IpBlasSyrk(trans, ndim, nrank, alpha, A, ldA, beta, C, ldC); +} + +/** Wrapper for BLAS subroutine XTRSM. + * + * Backsolve for a lower triangular matrix. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpBlasTrsm( + bool trans, + Index ndim, + Index nrhs, + Number alpha, + const Number* A, + Index ldA, + Number* B, + Index ldB ); /** Wrapper for BLAS subroutine DTRSM. * * Backsolve for a lower triangular matrix. + * + * @deprecated Use IpBlasTrsm() instead. */ -IPOPTLIB_EXPORT void IpBlasDtrsm( +IPOPT_DEPRECATED +inline void IpBlasDtrsm( bool trans, Index ndim, Index nrhs, @@ -172,7 +416,10 @@ IPOPTLIB_EXPORT void IpBlasDtrsm( Index ldA, Number* B, Index ldB -); +) +{ + IpBlasTrsm(trans, ndim, nrhs, alpha, A, ldA, B, ldB); +} } // namespace Ipopt diff --git a/src/LinAlg/IpCompoundMatrix.cpp b/src/LinAlg/IpCompoundMatrix.cpp index c48aa4fea..c994c78b8 100644 --- a/src/LinAlg/IpCompoundMatrix.cpp +++ b/src/LinAlg/IpCompoundMatrix.cpp @@ -727,18 +727,18 @@ void CompoundMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sCompoundMatrix \"%s\" with %d row and %d columns components:\n", prefix.c_str(), name.c_str(), NComps_Rows(), NComps_Cols()); + "%sCompoundMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " row and %" IPOPT_INDEX_FORMAT " columns components:\n", prefix.c_str(), name.c_str(), NComps_Rows(), NComps_Cols()); for( Index irow = 0; irow < NComps_Rows(); irow++ ) { for( Index jcol = 0; jcol < NComps_Cols(); jcol++ ) { jnlst.PrintfIndented(level, category, indent, - "%sComponent for row %d and column %d:\n", prefix.c_str(), irow, jcol); + "%sComponent for row %" IPOPT_INDEX_FORMAT " and column %" IPOPT_INDEX_FORMAT ":\n", prefix.c_str(), irow, jcol); if( ConstComp(irow, jcol) ) { DBG_ASSERT(name.size() < 200); char buffer[256]; - Snprintf(buffer, 255, "%s[%2d][%2d]", name.c_str(), irow, jcol); + Snprintf(buffer, 255, "%s[%2" IPOPT_INDEX_FORMAT "][%2" IPOPT_INDEX_FORMAT "]", name.c_str(), irow, jcol); std::string term_name = buffer; ConstComp(irow, jcol)->Print(&jnlst, level, category, term_name, indent + 1, prefix); } @@ -792,7 +792,7 @@ CompoundMatrixSpace::CompoundMatrixSpace( std::vector allocate_row(ncomps_cols_, false); for( Index i = 0; i < ncomps_rows_; i++ ) { - DBG_PRINT((1, "block_rows_[%d] = %d\n", i, block_rows_[i])); + DBG_PRINT((1, "block_rows_[%" IPOPT_INDEX_FORMAT "] = %" IPOPT_INDEX_FORMAT "\n", i, block_rows_[i])); comp_spaces_.push_back(row); allocate_block_.push_back(allocate_row); } @@ -899,8 +899,8 @@ CompoundMatrix* CompoundMatrixSpace::MakeNewCompoundMatrix() const bool CompoundMatrixSpace::DimensionsSet() const { DBG_START_METH("CompoundMatrixSpace::DimensionsSet", 0); - Index total_nrows = 0; - Index total_ncols = 0; + DBG_DO(Index total_nrows = 0); + DBG_DO(Index total_ncols = 0); bool valid = true; for( Index i = 0; i < ncomps_rows_; i++ ) { @@ -909,7 +909,7 @@ bool CompoundMatrixSpace::DimensionsSet() const valid = false; break; } - total_nrows += block_rows_[i]; + DBG_DO(total_nrows += block_rows_[i]); } if( valid ) { @@ -920,7 +920,7 @@ bool CompoundMatrixSpace::DimensionsSet() const valid = false; break; } - total_ncols += block_cols_[j]; + DBG_DO(total_ncols += block_cols_[j]); } } diff --git a/src/LinAlg/IpCompoundMatrix.hpp b/src/LinAlg/IpCompoundMatrix.hpp index 4baa79723..821942559 100644 --- a/src/LinAlg/IpCompoundMatrix.hpp +++ b/src/LinAlg/IpCompoundMatrix.hpp @@ -36,7 +36,7 @@ class IPOPTLIB_EXPORT CompoundMatrix: public Matrix public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. * * The owner_space has to @@ -51,7 +51,7 @@ class IPOPTLIB_EXPORT CompoundMatrix: public Matrix /** Destructor */ virtual ~CompoundMatrix(); - //@} + ///@} /** Method for setting an individual component at position (irow, * icol) in the compound matrix. @@ -112,7 +112,7 @@ class IPOPTLIB_EXPORT CompoundMatrix: public Matrix protected: /**@name Methods overloaded from Matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -163,7 +163,7 @@ class IPOPTLIB_EXPORT CompoundMatrix: public Matrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -173,7 +173,7 @@ class IPOPTLIB_EXPORT CompoundMatrix: public Matrix * 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 */ CompoundMatrix(); @@ -184,7 +184,7 @@ class IPOPTLIB_EXPORT CompoundMatrix: public Matrix /** Default Assignment Operator */ void operator=( const CompoundMatrix&); - //@} + ///@} /** Matrix of matrix's containing the components */ std::vector > > comps_; @@ -223,7 +223,7 @@ class IPOPTLIB_EXPORT CompoundMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of row and columns blocks, as * well as the totel number of rows and columns. */ @@ -237,10 +237,10 @@ class IPOPTLIB_EXPORT CompoundMatrixSpace: public MatrixSpace /** Destructor */ ~CompoundMatrixSpace() { } - //@} + ///@} /** @name Methods for setting information about the components. */ - //@{ + ///@{ /** Set the number nrows of rows in row-block number irow. */ void SetBlockRows( Index irow, @@ -277,7 +277,7 @@ class IPOPTLIB_EXPORT CompoundMatrixSpace: public MatrixSpace const MatrixSpace& mat_space, bool auto_allocate = false ); - //@} + ///@} /** Obtain the component MatrixSpace in block row irow and block * column jcol. @@ -293,7 +293,7 @@ class IPOPTLIB_EXPORT CompoundMatrixSpace: public MatrixSpace } /** @name Accessor methods */ - //@{ + ///@{ /** Number of block rows */ Index NComps_Rows() const { @@ -311,7 +311,7 @@ class IPOPTLIB_EXPORT CompoundMatrixSpace: public MatrixSpace { return diagonal_; } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ CompoundMatrix* MakeNewCompoundMatrix() const; @@ -329,7 +329,7 @@ class IPOPTLIB_EXPORT CompoundMatrixSpace: public MatrixSpace * 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 */ CompoundMatrixSpace(); @@ -341,7 +341,7 @@ class IPOPTLIB_EXPORT CompoundMatrixSpace: public MatrixSpace CompoundMatrixSpace& operator=( const CompoundMatrixSpace& ); - //@} + ///@} /** Number of block rows */ Index ncomps_rows_; diff --git a/src/LinAlg/IpCompoundSymMatrix.cpp b/src/LinAlg/IpCompoundSymMatrix.cpp index 1c89c590e..0c190a43c 100644 --- a/src/LinAlg/IpCompoundSymMatrix.cpp +++ b/src/LinAlg/IpCompoundSymMatrix.cpp @@ -249,18 +249,18 @@ void CompoundSymMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sCompoundSymMatrix \"%s\" with %d rows and columns components:\n", prefix.c_str(), name.c_str(), NComps_Dim()); + "%sCompoundSymMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " rows and columns components:\n", prefix.c_str(), name.c_str(), NComps_Dim()); for( Index irow = 0; irow < NComps_Dim(); irow++ ) { for( Index jcol = 0; jcol <= irow; jcol++ ) { jnlst.PrintfIndented(level, category, indent, - "%sComponent for row %d and column %d:\n", prefix.c_str(), irow, jcol); + "%sComponent for row %" IPOPT_INDEX_FORMAT " and column %" IPOPT_INDEX_FORMAT ":\n", prefix.c_str(), irow, jcol); if( ConstComp(irow, jcol) ) { DBG_ASSERT(name.size() < 200); char buffer[256]; - Snprintf(buffer, 255, "%s[%d][%d]", name.c_str(), irow, jcol); + Snprintf(buffer, 255, "%s[%" IPOPT_INDEX_FORMAT "][%" IPOPT_INDEX_FORMAT "]", name.c_str(), irow, jcol); std::string term_name = buffer; ConstComp(irow, jcol)->Print(&jnlst, level, category, term_name, indent + 1, prefix); } @@ -381,7 +381,7 @@ CompoundSymMatrix* CompoundSymMatrixSpace::MakeNewCompoundSymMatrix() const bool CompoundSymMatrixSpace::DimensionsSet() const { - Index total_dim = 0; + DBG_DO(Index total_dim = 0); bool valid = true; for( Index i = 0; i < ncomp_spaces_; i++ ) { @@ -390,7 +390,7 @@ bool CompoundSymMatrixSpace::DimensionsSet() const valid = false; break; } - total_dim += block_dim_[i]; + DBG_DO(total_dim += block_dim_[i]); } if( valid ) diff --git a/src/LinAlg/IpCompoundSymMatrix.hpp b/src/LinAlg/IpCompoundSymMatrix.hpp index a5ee47ab0..c1571b03b 100644 --- a/src/LinAlg/IpCompoundSymMatrix.hpp +++ b/src/LinAlg/IpCompoundSymMatrix.hpp @@ -25,7 +25,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrix: public SymMatrix public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking only the number for block components into the * row and column direction. * @@ -38,7 +38,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrix: public SymMatrix /** Destructor */ ~CompoundSymMatrix(); - //@} + ///@} /** Method for setting an individual component at position (irow, icol) * in the compound matrix. @@ -102,7 +102,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrix: public SymMatrix protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -125,7 +125,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrix: public SymMatrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -135,7 +135,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrix: public SymMatrix * 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 */ CompoundSymMatrix(); @@ -148,7 +148,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrix: public SymMatrix void operator=( const CompoundSymMatrix& ); - //@} + ///@} /** Vector of vectors containing the components */ std::vector > > comps_; @@ -215,7 +215,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrixSpace: public SymMatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of blocks (same for rows and * columns), as well as the total dimension of the matrix. */ @@ -227,10 +227,10 @@ class IPOPTLIB_EXPORT CompoundSymMatrixSpace: public SymMatrixSpace /** Destructor */ ~CompoundSymMatrixSpace() { } - //@} + ///@} /** @name Methods for setting information about the components. */ - //@{ + ///@{ /** Set the dimension dim for block row (or column) irow_jcol */ void SetBlockDim( Index irow_jcol, @@ -256,7 +256,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrixSpace: public SymMatrixSpace const MatrixSpace& mat_space, bool auto_allocate = false ); - //@} + ///@} /** Obtain the component MatrixSpace in block row irow and block * column jcol. @@ -272,12 +272,12 @@ class IPOPTLIB_EXPORT CompoundSymMatrixSpace: public SymMatrixSpace } /** @name Accessor methods */ - //@{ + ///@{ Index NComps_Dim() const { return ncomp_spaces_; } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ CompoundSymMatrix* MakeNewCompoundSymMatrix() const; @@ -295,7 +295,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrixSpace: public SymMatrixSpace * 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 */ CompoundSymMatrixSpace(); @@ -308,7 +308,7 @@ class IPOPTLIB_EXPORT CompoundSymMatrixSpace: public SymMatrixSpace CompoundSymMatrixSpace& operator=( const CompoundSymMatrixSpace& ); - //@} + ///@} /** Number of components per row and column */ Index ncomp_spaces_; diff --git a/src/LinAlg/IpCompoundVector.cpp b/src/LinAlg/IpCompoundVector.cpp index d7c917be2..ed73645fe 100644 --- a/src/LinAlg/IpCompoundVector.cpp +++ b/src/LinAlg/IpCompoundVector.cpp @@ -28,12 +28,12 @@ CompoundVector::CompoundVector( owner_space_(owner_space), vectors_valid_(false) { - Index dim_check = 0; + DBG_DO(Index dim_check = 0); for( Index i = 0; i < NComps(); i++ ) { SmartPtr space = owner_space_->GetCompSpace(i); DBG_ASSERT(IsValid(space)); - dim_check += space->Dim(); + DBG_DO(dim_check += space->Dim()); if( create_new ) { @@ -49,11 +49,6 @@ CompoundVector::CompoundVector( } } -CompoundVector::~CompoundVector() -{ - // ToDo: Do we need an empty here? -} - void CompoundVector::SetComp( Index icomp, const Vector& vec @@ -104,6 +99,7 @@ void CompoundVector::ScalImpl( DBG_ASSERT(vectors_valid_); for( Index i = 0; i < NComps(); i++ ) { + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(Comp(i)); Comp(i)->Scal(alpha); } @@ -122,6 +118,7 @@ void CompoundVector::AxpyImpl( DBG_ASSERT(NComps() == comp_x->NComps()); for( Index i = 0; i < NComps(); i++ ) { + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(Comp(i)); Comp(i)->Axpy(alpha, *comp_x->GetComp(i)); } @@ -155,7 +152,7 @@ Number CompoundVector::Nrm2Impl() const Number nrm2 = ConstComp(i)->Nrm2(); sum += nrm2 * nrm2; } - return sqrt(sum); + return std::sqrt(sum); } Number CompoundVector::AsumImpl() const @@ -224,6 +221,21 @@ void CompoundVector::ElementWiseMultiplyImpl( } } +void CompoundVector::ElementWiseSelectImpl( + const Vector& x +) +{ + DBG_START_METH("CompoundVector::ElementWiseSelectImpl", dbg_verbosity); + DBG_ASSERT(vectors_valid_); + const CompoundVector* comp_x = static_cast(&x); + DBG_ASSERT(dynamic_cast(&x)); + DBG_ASSERT(NComps() == comp_x->NComps()); + for( Index i = 0; i < NComps(); i++ ) + { + Comp(i)->ElementWiseSelect(*comp_x->GetComp(i)); + } +} + void CompoundVector::ElementWiseMaxImpl( const Vector& x ) @@ -450,25 +462,25 @@ void CompoundVector::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sCompoundVector \"%s\" with %d components:\n", prefix.c_str(), name.c_str(), NComps()); + "%sCompoundVector \"%s\" with %" IPOPT_INDEX_FORMAT " components:\n", prefix.c_str(), name.c_str(), NComps()); for( Index i = 0; i < NComps(); i++ ) { jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sComponent %d:\n", prefix.c_str(), i + 1); + "%sComponent %" IPOPT_INDEX_FORMAT ":\n", prefix.c_str(), i + 1); if( ConstComp(i) ) { DBG_ASSERT(name.size() < 200); char buffer[256]; - Snprintf(buffer, 255, "%s[%2d]", name.c_str(), i); + Snprintf(buffer, 255, "%s[%" IPOPT_INDEX_FORMAT "]", name.c_str(), i); std::string term_name = buffer; ConstComp(i)->Print(&jnlst, level, category, term_name, indent + 1, prefix); } else { jnlst.PrintfIndented(level, category, indent, - "%sComponent %d is not yet set!\n", prefix.c_str(), i + 1); + "%sComponent %" IPOPT_INDEX_FORMAT " is not yet set!\n", prefix.c_str(), i + 1); } } } diff --git a/src/LinAlg/IpCompoundVector.hpp b/src/LinAlg/IpCompoundVector.hpp index 062c5849c..3078950d7 100644 --- a/src/LinAlg/IpCompoundVector.hpp +++ b/src/LinAlg/IpCompoundVector.hpp @@ -31,7 +31,7 @@ class IPOPTLIB_EXPORT CompoundVector: public Vector { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor, given the corresponding CompoundVectorSpace. * * Before this constructor can be called, all components of the @@ -49,8 +49,8 @@ class IPOPTLIB_EXPORT CompoundVector: public Vector ); /** Default destructor */ - virtual ~CompoundVector(); - //@} + virtual ~CompoundVector() { } + ///@} /** Method for setting the pointer for a component that is a const Vector */ void SetComp( @@ -118,7 +118,7 @@ class IPOPTLIB_EXPORT CompoundVector: public Vector protected: /** @name Overloaded methods from Vector base class */ - //@{ + ///@{ virtual void CopyImpl( const Vector& x ); @@ -154,6 +154,10 @@ class IPOPTLIB_EXPORT CompoundVector: public Vector const Vector& x ); + virtual void ElementWiseSelectImpl( + const Vector& x + ); + virtual void ElementWiseMaxImpl( const Vector& x ); @@ -181,10 +185,10 @@ class IPOPTLIB_EXPORT CompoundVector: public Vector virtual Number SumImpl() const; virtual Number SumLogsImpl() const; - //@} + ///@} /** @name Implemented specialized functions */ - //@{ + ///@{ void AddTwoVectorsImpl( Number a, const Vector& v1, @@ -204,13 +208,13 @@ class IPOPTLIB_EXPORT CompoundVector: public Vector const Vector& s, Number c ); - //@} + ///@} /** Method for determining if all stored numbers are valid (i.e., no Inf or Nan). */ virtual bool HasValidNumbersImpl() const; /** @name Output methods */ - //@{ + ///@{ virtual void PrintImpl( const Journalist& jnlst, EJournalLevel level, @@ -219,7 +223,7 @@ class IPOPTLIB_EXPORT CompoundVector: public Vector Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -230,7 +234,7 @@ class IPOPTLIB_EXPORT CompoundVector: public Vector * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ CompoundVector(); @@ -243,7 +247,7 @@ class IPOPTLIB_EXPORT CompoundVector: public Vector void operator=( const CompoundVector& ); - //@} + ///@} /** Components of the compound vector. * @@ -278,7 +282,7 @@ class IPOPTLIB_EXPORT CompoundVectorSpace: public VectorSpace { public: /** @name Constructors/Destructors. */ - //@{ + ///@{ /** Constructor, has to be given the number of components and the * total dimension of all components combined. */ @@ -290,7 +294,7 @@ class IPOPTLIB_EXPORT CompoundVectorSpace: public VectorSpace /** Destructor */ ~CompoundVectorSpace() { } - //@} + ///@} /** Method for setting the individual component VectorSpaces */ virtual void SetCompSpace( @@ -330,7 +334,7 @@ class IPOPTLIB_EXPORT CompoundVectorSpace: public VectorSpace * 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 */ CompoundVectorSpace(); @@ -343,7 +347,7 @@ class IPOPTLIB_EXPORT CompoundVectorSpace: public VectorSpace CompoundVectorSpace& operator=( const CompoundVectorSpace& ); - //@} + ///@} /** Number of components */ const Index ncomp_spaces_; diff --git a/src/LinAlg/IpDenseGenMatrix.cpp b/src/LinAlg/IpDenseGenMatrix.cpp index 842fb9c7b..481f65bf5 100644 --- a/src/LinAlg/IpDenseGenMatrix.cpp +++ b/src/LinAlg/IpDenseGenMatrix.cpp @@ -47,7 +47,7 @@ void DenseGenMatrix::ScaleColumns( for( Index j = 0; j < NCols(); j++ ) { - IpBlasDscal(NRows(), scal_values[j], &values_[j * NRows()], 1); + IpBlasScal(NRows(), scal_values[j], &values_[j * NRows()], 1); } ObjectChanged(); } @@ -59,7 +59,7 @@ void DenseGenMatrix::Copy( DBG_ASSERT(NCols() == M.NCols()); DBG_ASSERT(NRows() == M.NRows()); - IpBlasDcopy(NCols() * NRows(), M.Values(), 1, values_, 1); + IpBlasCopy(NCols() * NRows(), M.Values(), 1, values_, 1); initialized_ = true; ObjectChanged(); } @@ -71,7 +71,7 @@ void DenseGenMatrix::FillIdentity( DBG_ASSERT(NCols() == NRows()); const Number zero = 0.; - IpBlasDcopy(NCols() * NRows(), &zero, 0, values_, 1); + IpBlasCopy(NCols() * NRows(), &zero, 0, values_, 1); if( factor != 0. ) { @@ -109,7 +109,7 @@ void DenseGenMatrix::AddMatrixProduct( DBG_ASSERT((transB && B.NCols() == k) || (!transB && B.NRows() == k)); DBG_ASSERT(beta == 0. || initialized_); - IpBlasDgemm(transA, transB, m, n, k, alpha, A.Values(), A.NRows(), B.Values(), B.NRows(), beta, values_, NRows()); + IpBlasGemm(transA, transB, m, n, k, alpha, A.Values(), A.NRows(), B.Values(), B.NRows(), beta, values_, NRows()); initialized_ = true; ObjectChanged(); } @@ -171,7 +171,7 @@ bool DenseGenMatrix::ComputeCholeskyFactor( // Now call the lapack subroutine to perform the factorization Index info; - IpLapackDpotrf(dim, values_, dim, info); + IpLapackPotrf(dim, values_, dim, info); DBG_ASSERT(info >= 0); if( info != 0 ) @@ -218,7 +218,7 @@ bool DenseGenMatrix::ComputeEigenVectors( bool compute_eigenvectors = true; Number* Evals = Evalues.Values(); Index info; - IpLapackDsyev(compute_eigenvectors, dim, values_, dim, Evals, info); + IpLapackSyev(compute_eigenvectors, dim, values_, dim, Evals, info); initialized_ = (info == 0); ObjectChanged(); @@ -228,6 +228,7 @@ bool DenseGenMatrix::ComputeEigenVectors( void DenseGenMatrix::CholeskyBackSolveMatrix( bool trans, Number alpha, + // cppcheck-suppress constParameter // cannot be const since it is modified in Blas DenseGenMatrix& B ) const { @@ -235,12 +236,11 @@ void DenseGenMatrix::CholeskyBackSolveMatrix( DBG_ASSERT(B.NRows() == NRows()); DBG_ASSERT(initialized_); - Number* Bvalues = B.Values(); - - IpBlasDtrsm(trans, NRows(), B.NCols(), alpha, values_, NRows(), Bvalues, B.NRows()); + IpBlasTrsm(trans, NRows(), B.NCols(), alpha, values_, NRows(), B.Values(), B.NRows()); } void DenseGenMatrix::CholeskySolveVector( + // cppcheck-suppress constParameter // cannot be const since it is modified in Blas DenseVector& b ) const { @@ -249,12 +249,11 @@ void DenseGenMatrix::CholeskySolveVector( DBG_ASSERT(initialized_); DBG_ASSERT(factorization_ == CHOL); - Number* bvalues = b.Values(); - - IpLapackDpotrs(NRows(), 1, values_, NRows(), bvalues, b.Dim()); + IpLapackPotrs(NRows(), 1, values_, NRows(), b.Values(), b.Dim()); } void DenseGenMatrix::CholeskySolveMatrix( + // cppcheck-suppress constParameter // cannot be const since it is modified in Blas DenseGenMatrix& B ) const { @@ -263,9 +262,7 @@ void DenseGenMatrix::CholeskySolveMatrix( DBG_ASSERT(initialized_); DBG_ASSERT(factorization_ == CHOL); - Number* Bvalues = B.Values(); - - IpLapackDpotrs(NRows(), B.NCols(), values_, NRows(), Bvalues, B.NRows()); + IpLapackPotrs(NRows(), B.NCols(), values_, NRows(), B.Values(), B.NRows()); } bool DenseGenMatrix::ComputeLUFactorInPlace() @@ -285,7 +282,7 @@ bool DenseGenMatrix::ComputeLUFactorInPlace() // call the lapack subroutine for the factorization (dgetrf ) Index info; - IpLapackDgetrf(dim, values_, pivot_, dim, info); + IpLapackGetrf(dim, values_, pivot_, dim, info); DBG_ASSERT(info >= 0); if( info != 0 ) @@ -305,6 +302,7 @@ bool DenseGenMatrix::ComputeLUFactorInPlace() } void DenseGenMatrix::LUSolveMatrix( + // cppcheck-suppress constParameter // cannot be const since it is modified in Blas DenseGenMatrix& B ) const { @@ -313,12 +311,11 @@ void DenseGenMatrix::LUSolveMatrix( DBG_ASSERT(initialized_); DBG_ASSERT(factorization_ == LU); - Number* Bvalues = B.Values(); - - IpLapackDgetrs(NRows(), B.NCols(), values_, NRows(), pivot_, Bvalues, B.NRows()); + IpLapackGetrs(NRows(), B.NCols(), values_, NRows(), pivot_, B.Values(), B.NRows()); } void DenseGenMatrix::LUSolveVector( + // cppcheck-suppress constParameter // cannot be const since it is modified in Blas DenseVector& b ) const { @@ -327,9 +324,7 @@ void DenseGenMatrix::LUSolveVector( DBG_ASSERT(initialized_); DBG_ASSERT(factorization_ == LU); - Number* bvalues = b.Values(); - - IpLapackDgetrs(NRows(), 1, values_, NRows(), pivot_, bvalues, b.Dim()); + IpLapackGetrs(NRows(), 1, values_, NRows(), pivot_, b.Values(), b.Dim()); } void DenseGenMatrix::MultVectorImpl( @@ -351,7 +346,7 @@ void DenseGenMatrix::MultVectorImpl( DBG_ASSERT(dynamic_cast(&y)); bool trans = false; - IpBlasDgemv(trans, NRows(), NCols(), alpha, values_, NRows(), dense_x->Values(), 1, beta, dense_y->Values(), 1); + IpBlasGemv(trans, NRows(), NCols(), alpha, values_, NRows(), dense_x->Values(), 1, beta, dense_y->Values(), 1); } void DenseGenMatrix::TransMultVectorImpl( @@ -373,7 +368,7 @@ void DenseGenMatrix::TransMultVectorImpl( DBG_ASSERT(dynamic_cast(&y)); bool trans = true; - IpBlasDgemv(trans, NRows(), NCols(), alpha, values_, NRows(), dense_x->Values(), 1, beta, dense_y->Values(), 1); + IpBlasGemv(trans, NRows(), NCols(), alpha, values_, NRows(), dense_x->Values(), 1, beta, dense_y->Values(), 1); } void DenseGenMatrix::ComputeRowAMaxImpl( @@ -388,12 +383,12 @@ void DenseGenMatrix::ComputeRowAMaxImpl( DBG_ASSERT(dynamic_cast(&rows_norms)); Number* vec_vals = dense_vec->Values(); - const double* vals = values_; + const Number* vals = values_; for( Index irow = 0; irow < NRows(); irow++ ) { for( Index jcol = 0; jcol < NCols(); jcol++ ) { - vec_vals[irow] = Max(vec_vals[irow], fabs(*vals)); + vec_vals[irow] = Max(vec_vals[irow], std::abs(*vals)); vals++; } } @@ -411,11 +406,11 @@ void DenseGenMatrix::ComputeColAMaxImpl( DBG_ASSERT(dynamic_cast(&cols_norms)); Number* vec_vals = dense_vec->Values(); - const double* vals = values_; + const Number* vals = values_; for( Index jcol = 0; jcol < NCols(); jcol++ ) { - Index i = IpBlasIdamax(NRows(), vals, 1); - vec_vals[jcol] = Max(vec_vals[jcol], fabs(vals[i])); + Index i = IpBlasIamax(NRows(), vals, 1); + vec_vals[jcol] = Max(vec_vals[jcol], std::abs(vals[i])); vals += NRows(); } } @@ -423,7 +418,7 @@ void DenseGenMatrix::ComputeColAMaxImpl( bool DenseGenMatrix::HasValidNumbersImpl() const { DBG_ASSERT(initialized_); - Number sum = IpBlasDasum(NRows() * NCols(), values_, 1); + Number sum = IpBlasAsum(NRows() * NCols(), values_, 1); return IsFiniteNumber(sum); } @@ -439,7 +434,7 @@ void DenseGenMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sDenseGenMatrix \"%s\" with %d rows and %d columns:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); + "%sDenseGenMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " rows and %" IPOPT_INDEX_FORMAT " columns:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); if( initialized_ ) { @@ -448,7 +443,7 @@ void DenseGenMatrix::PrintImpl( for( Index i = 0; i < NRows(); i++ ) { jnlst.PrintfIndented(level, category, indent, - "%s%s[%5d,%5d]=%23.16e\n", prefix.c_str(), name.c_str(), i, j, values_[i + NRows() * j]); + "%s%s[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "]=%23.16e\n", prefix.c_str(), name.c_str(), i, j, values_[i + NRows() * j]); } } } diff --git a/src/LinAlg/IpDenseGenMatrix.hpp b/src/LinAlg/IpDenseGenMatrix.hpp index dce42838c..b3bebb10e 100644 --- a/src/LinAlg/IpDenseGenMatrix.hpp +++ b/src/LinAlg/IpDenseGenMatrix.hpp @@ -27,7 +27,7 @@ class IPOPTLIB_EXPORT DenseGenMatrix: public Matrix public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ DenseGenMatrix( const DenseGenMatrixSpace* owner_space @@ -35,7 +35,7 @@ class IPOPTLIB_EXPORT DenseGenMatrix: public Matrix /** Destructor */ ~DenseGenMatrix(); - //@} + ///@} /** Create a new DenseGenMatrix from same MatrixSpace */ SmartPtr MakeNewDenseGenMatrix() const; @@ -190,7 +190,7 @@ class IPOPTLIB_EXPORT DenseGenMatrix: public Matrix protected: /**@name Overloaded methods from Matrix base class*/ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -225,7 +225,7 @@ class IPOPTLIB_EXPORT DenseGenMatrix: public Matrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -235,7 +235,7 @@ class IPOPTLIB_EXPORT DenseGenMatrix: public Matrix * 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 */ DenseGenMatrix(); @@ -248,7 +248,7 @@ class IPOPTLIB_EXPORT DenseGenMatrix: public Matrix void operator=( const DenseGenMatrix& ); - //@} + ///@} const DenseGenMatrixSpace* owner_space_; @@ -279,7 +279,7 @@ class IPOPTLIB_EXPORT DenseGenMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor for matrix space for DenseGenMatrices. * * Takes in dimension of the matrices. @@ -292,7 +292,7 @@ class IPOPTLIB_EXPORT DenseGenMatrixSpace: public MatrixSpace /** Destructor */ ~DenseGenMatrixSpace() { } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ DenseGenMatrix* MakeNewDenseGenMatrix() const diff --git a/src/LinAlg/IpDenseSymMatrix.cpp b/src/LinAlg/IpDenseSymMatrix.cpp index 83a06be04..0761d7845 100644 --- a/src/LinAlg/IpDenseSymMatrix.cpp +++ b/src/LinAlg/IpDenseSymMatrix.cpp @@ -51,7 +51,7 @@ void DenseSymMatrix::MultVectorImpl( DenseVector* dense_y = static_cast(&y); DBG_ASSERT(dynamic_cast(&y)); - IpBlasDsymv(Dim(), alpha, values_, NRows(), dense_x->Values(), 1, beta, dense_y->Values(), 1); + IpBlasSymv(Dim(), alpha, values_, NRows(), dense_x->Values(), 1, beta, dense_y->Values(), 1); } void DenseSymMatrix::FillIdentity( @@ -177,7 +177,7 @@ void DenseSymMatrix::HighRankUpdate( nrank = V.NCols(); } - IpBlasDsyrk(trans, Dim(), nrank, alpha, V.Values(), V.NRows(), beta, values_, NRows()); + IpBlasSyrk(trans, Dim(), nrank, alpha, V.Values(), V.NRows(), beta, values_, NRows()); initialized_ = true; ObjectChanged(); @@ -241,12 +241,12 @@ void DenseSymMatrix::ComputeRowAMaxImpl( DBG_ASSERT(dynamic_cast(&rows_norms)); Number* vec_vals = dense_vec->Values(); - const double* vals = values_; + const Number* vals = values_; for( Index irow = 0; irow < NRows(); irow++ ) { for( Index jcol = 0; jcol <= irow; jcol++ ) { - const double f = fabs(*vals); + const Number f = std::abs(*vals); vec_vals[irow] = Max(vec_vals[irow], f); vec_vals[jcol] = Max(vec_vals[jcol], f); vals++; @@ -266,7 +266,7 @@ void DenseSymMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sDenseSymMatrix \"%s\" of dimension %d (only lower triangular part printed):\n", prefix.c_str(), name.c_str(), + "%sDenseSymMatrix \"%s\" of dimension %" IPOPT_INDEX_FORMAT " (only lower triangular part printed):\n", prefix.c_str(), name.c_str(), Dim()); if( initialized_ ) @@ -276,7 +276,7 @@ void DenseSymMatrix::PrintImpl( for( Index i = j; i < NRows(); i++ ) { jnlst.PrintfIndented(level, category, indent, - "%s%s[%5d,%5d]=%23.16e\n", prefix.c_str(), name.c_str(), i, j, values_[i + NRows() * j]); + "%s%s[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "]=%23.16e\n", prefix.c_str(), name.c_str(), i, j, values_[i + NRows() * j]); } } } diff --git a/src/LinAlg/IpDenseSymMatrix.hpp b/src/LinAlg/IpDenseSymMatrix.hpp index 171991453..506fcd1de 100644 --- a/src/LinAlg/IpDenseSymMatrix.hpp +++ b/src/LinAlg/IpDenseSymMatrix.hpp @@ -28,7 +28,7 @@ class IPOPTLIB_EXPORT DenseSymMatrix: public SymMatrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ DenseSymMatrix( const DenseSymMatrixSpace* owner_space @@ -36,7 +36,7 @@ class IPOPTLIB_EXPORT DenseSymMatrix: public SymMatrix /** Destructor */ ~DenseSymMatrix(); - //@} + ///@} /** Create a new DenseSymMatrix from same MatrixSpace */ SmartPtr MakeNewDenseSymMatrix() const; @@ -118,7 +118,7 @@ class IPOPTLIB_EXPORT DenseSymMatrix: public SymMatrix protected: /**@name Overloaded methods from Matrix base class*/ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -141,7 +141,7 @@ class IPOPTLIB_EXPORT DenseSymMatrix: public SymMatrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -151,7 +151,7 @@ class IPOPTLIB_EXPORT DenseSymMatrix: public SymMatrix * 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 */ DenseSymMatrix(); @@ -164,7 +164,7 @@ class IPOPTLIB_EXPORT DenseSymMatrix: public SymMatrix void operator=( const DenseSymMatrix& ); - //@} + ///@} const DenseSymMatrixSpace* owner_space_; @@ -180,7 +180,7 @@ class IPOPTLIB_EXPORT DenseSymMatrixSpace: public SymMatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor for matrix space for DenseSymMatrices. * * Takes in dimension of the matrices. @@ -192,7 +192,7 @@ class IPOPTLIB_EXPORT DenseSymMatrixSpace: public SymMatrixSpace /** Destructor */ ~DenseSymMatrixSpace() { } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ DenseSymMatrix* MakeNewDenseSymMatrix() const diff --git a/src/LinAlg/IpDenseVector.cpp b/src/LinAlg/IpDenseVector.cpp index b528c3855..5b903132c 100644 --- a/src/LinAlg/IpDenseVector.cpp +++ b/src/LinAlg/IpDenseVector.cpp @@ -33,6 +33,8 @@ DenseVector::DenseVector( if( Dim() == 0 ) { initialized_ = true; + homogeneous_ = true; + scalar_ = 0.; } } @@ -54,7 +56,7 @@ void DenseVector::SetValues( ) { initialized_ = true; - IpBlasDcopy(Dim(), x, 1, values_allocated(), 1); + IpBlasCopy(Dim(), x, 1, values_allocated(), 1); homogeneous_ = false; // This is not an overloaded method from // Vector. Here, we must call ObjectChanged() @@ -70,7 +72,7 @@ const Number* DenseVector::ExpandedValues() const { expanded_values_ = owner_space_->AllocateInternalStorage(); } - IpBlasDcopy(Dim(), &scalar_, 0, expanded_values_, 1); + IpBlasCopy(Dim(), &scalar_, 0, expanded_values_, 1); return expanded_values_; } else @@ -85,7 +87,7 @@ void DenseVector::set_values_from_scalar() initialized_ = true; homogeneous_ = false; Number* vals = values_allocated(); - IpBlasDcopy(Dim(), &scalar_, 0, vals, 1); + IpBlasCopy(Dim(), &scalar_, 0, vals, 1); } void DenseVector::CopyImpl( @@ -105,7 +107,7 @@ void DenseVector::CopyImpl( } else { - IpBlasDcopy(Dim(), dense_x->values_, 1, values_allocated(), 1); + IpBlasCopy(Dim(), dense_x->values_, 1, values_allocated(), 1); } initialized_ = true; } @@ -121,7 +123,7 @@ void DenseVector::ScalImpl( } else { - IpBlasDscal(Dim(), alpha, values_, 1); + IpBlasScal(Dim(), alpha, values_, 1); } } @@ -136,6 +138,12 @@ void DenseVector::AxpyImpl( DBG_ASSERT(dense_x->initialized_); DBG_ASSERT(Dim() == dense_x->Dim()); + + if( Dim() == 0 ) + { + return; + } + if( homogeneous_ ) { if( dense_x->homogeneous_ ) @@ -158,12 +166,12 @@ void DenseVector::AxpyImpl( { if( dense_x->scalar_ != 0. ) { - IpBlasDaxpy(Dim(), alpha, &dense_x->scalar_, 0, values_, 1); + IpBlasAxpy(Dim(), alpha, &dense_x->scalar_, 0, values_, 1); } } else { - IpBlasDaxpy(Dim(), alpha, dense_x->values_, 1, values_, 1); + IpBlasAxpy(Dim(), alpha, dense_x->values_, 1, values_, 1); } } } @@ -179,6 +187,12 @@ Number DenseVector::DotImpl( DBG_ASSERT(dense_x->initialized_); DBG_ASSERT(Dim() == dense_x->Dim()); + + if( Dim() == 0 ) + { + return 0.0; + } + if( homogeneous_ ) { if( dense_x->homogeneous_ ) @@ -187,18 +201,18 @@ Number DenseVector::DotImpl( } else { - retValue = IpBlasDdot(Dim(), dense_x->values_, 1, &scalar_, 0); + retValue = IpBlasDot(Dim(), dense_x->values_, 1, &scalar_, 0); } } else { if( dense_x->homogeneous_ ) { - retValue = IpBlasDdot(Dim(), &dense_x->scalar_, 0, values_, 1); + retValue = IpBlasDot(Dim(), &dense_x->scalar_, 0, values_, 1); } else { - retValue = IpBlasDdot(Dim(), dense_x->values_, 1, values_, 1); + retValue = IpBlasDot(Dim(), dense_x->values_, 1, values_, 1); } } return retValue; @@ -209,11 +223,11 @@ Number DenseVector::Nrm2Impl() const DBG_ASSERT(initialized_); if( homogeneous_ ) { - return sqrt((double) Dim()) * fabs(scalar_); + return std::sqrt((Number) Dim()) * std::abs(scalar_); } else { - return IpBlasDnrm2(Dim(), values_, 1); + return IpBlasNrm2(Dim(), values_, 1); } } @@ -222,11 +236,11 @@ Number DenseVector::AsumImpl() const DBG_ASSERT(initialized_); if( homogeneous_ ) { - return Dim() * fabs(scalar_); + return Dim() * std::abs(scalar_); } else { - return IpBlasDasum(Dim(), values_, 1); + return IpBlasAsum(Dim(), values_, 1); } } @@ -237,17 +251,13 @@ Number DenseVector::AmaxImpl() const { return 0.; } - else + + if( homogeneous_ ) { - if( homogeneous_ ) - { - return fabs(scalar_); - } - else - { - return fabs(values_[IpBlasIdamax(Dim(), values_, 1) - 1]); - } + return std::abs(scalar_); } + + return std::abs(values_[IpBlasIamax(Dim(), values_, 1) - 1]); } void DenseVector::SetImpl( @@ -276,6 +286,12 @@ void DenseVector::ElementWiseDivideImpl( DBG_ASSERT(dense_x->initialized_); const Number* values_x = dense_x->values_; DBG_ASSERT(Dim() == dense_x->Dim()); + + if( Dim() == 0 ) + { + return; + } + if( homogeneous_ ) { if( dense_x->homogeneous_ ) @@ -322,6 +338,12 @@ void DenseVector::ElementWiseMultiplyImpl( DBG_ASSERT(dense_x->initialized_); const Number* values_x = dense_x->values_; DBG_ASSERT(Dim() == dense_x->Dim()); + + if( Dim() == 0 ) + { + return; + } + if( homogeneous_ ) { if( dense_x->homogeneous_ ) @@ -360,6 +382,81 @@ void DenseVector::ElementWiseMultiplyImpl( } } +void DenseVector::ElementWiseSelectImpl( + const Vector& x +) +{ + DBG_ASSERT(initialized_); + const DenseVector* dense_x = static_cast(&x); + DBG_ASSERT(dynamic_cast(&x)); + + DBG_ASSERT(dense_x->initialized_); + const Number* values_x = dense_x->values_; + DBG_ASSERT(Dim() == dense_x->Dim()); + + if( Dim() == 0 ) + { + return; + } + + if( homogeneous_ ) + { + if( scalar_ == 0.0 ) + { + return; + } + if( dense_x->homogeneous_ ) + { + scalar_ *= dense_x->scalar_; + } + else + { + homogeneous_ = false; + Number* vals = values_allocated(); + for( Index i = 0; i < Dim(); i++ ) + { + vals[i] = scalar_ * values_x[i]; + } + } + } + else + { + if( dense_x->homogeneous_ ) + { + if( dense_x->scalar_ != 1.0 ) + { + for( Index i = 0; i < Dim(); i++ ) + { + if( values_[i] > 0.0 ) + { + values_[i] = dense_x->scalar_; + } + else if( values_[i] < 0.0 ) + { + values_[i] = -dense_x->scalar_; + } + // else values_[i] remains at 0.0 + } + } + } + else + { + for( Index i = 0; i < Dim(); i++ ) + { + if( values_[i] > 0.0 ) + { + values_[i] = values_x[i]; + } + else if( values_[i] < 0.0 ) + { + values_[i] = -values_x[i]; + } + // else values_[i] remains at 0.0 + } + } + } +} + void DenseVector::ElementWiseMaxImpl( const Vector& x ) @@ -371,6 +468,12 @@ void DenseVector::ElementWiseMaxImpl( DBG_ASSERT(dense_x->initialized_); const Number* values_x = dense_x->values_; DBG_ASSERT(Dim() == dense_x->Dim()); + + if( Dim() == 0 ) + { + return; + } + if( homogeneous_ ) { if( dense_x->homogeneous_ ) @@ -417,6 +520,12 @@ void DenseVector::ElementWiseMinImpl( DBG_ASSERT(dense_x->initialized_); const Number* values_x = dense_x->values_; DBG_ASSERT(Dim() == dense_x->Dim()); + + if( Dim() == 0 ) + { + return; + } + if( homogeneous_ ) { if( dense_x->homogeneous_ ) @@ -455,6 +564,12 @@ void DenseVector::ElementWiseMinImpl( void DenseVector::ElementWiseReciprocalImpl() { DBG_ASSERT(initialized_); + + if( Dim() == 0 ) + { + return; + } + if( homogeneous_ ) { scalar_ = 1.0 / scalar_; @@ -473,13 +588,13 @@ void DenseVector::ElementWiseAbsImpl() DBG_ASSERT(initialized_); if( homogeneous_ ) { - scalar_ = fabs(scalar_); + scalar_ = std::abs(scalar_); } else { for( Index i = 0; i < Dim(); i++ ) { - values_[i] = fabs(values_[i]); + values_[i] = std::abs(values_[i]); } } } @@ -489,13 +604,13 @@ void DenseVector::ElementWiseSqrtImpl() DBG_ASSERT(initialized_); if( homogeneous_ ) { - scalar_ = sqrt(scalar_); + scalar_ = std::sqrt(scalar_); } else { for( Index i = 0; i < Dim(); i++ ) { - values_[i] = sqrt(values_[i]); + values_[i] = std::sqrt(values_[i]); } } } @@ -511,7 +626,7 @@ void DenseVector::AddScalarImpl( } else { - IpBlasDaxpy(Dim(), 1., &scalar, 0, values_, 1); + IpBlasAxpy(Dim(), 1., &scalar, 0, values_, 1); } } @@ -586,16 +701,20 @@ Number DenseVector::SumLogsImpl() const { DBG_ASSERT(initialized_); Number sum; - if( homogeneous_ ) + if( Dim() == 0 ) + { + sum = 0.0; + } + else if( homogeneous_ ) { - sum = Dim() * log(scalar_); + sum = Dim() * std::log(scalar_); } else { sum = 0.0; for( Index i = 0; i < Dim(); i++ ) { - sum += log(values_[i]); + sum += std::log(values_[i]); } } return sum; @@ -648,6 +767,12 @@ void DenseVector::AddTwoVectorsImpl( Number c ) { + if( Dim() == 0 ) + { + DBG_ASSERT(initialized_); + return; + } + const Number* values_v1 = NULL; bool homogeneous_v1 = false; Number scalar_v1 = 0; @@ -709,16 +834,19 @@ void DenseVector::AddTwoVectorsImpl( Vector::AddTwoVectorsImpl(a, v1, b, v2, c); return; } + DBG_ASSERT(values_v1 != NULL || a == 0.); + DBG_ASSERT(values_v2 != NULL || b == 0.); + DBG_ASSERT(values_ != NULL); // I guess I'm going over board here, but it might be best to // capture all cases for a, b, and c separately... - if( c == 0 ) + if( c == 0. ) { if( a == 1. ) { if( b == 0. ) { - IpBlasDcopy(Dim(), values_v1, 1, values_, 1); + IpBlasCopy(Dim(), values_v1, 1, values_, 1); } else if( b == 1. ) { @@ -778,13 +906,13 @@ void DenseVector::AddTwoVectorsImpl( if( b == 0. ) { Number zero = 0.; - IpBlasDcopy(Dim(), &zero, 0, values_, 1); + IpBlasCopy(Dim(), &zero, 0, values_, 1); } else if( b == 1. ) { for( Index i = 0; i < Dim(); i++ ) { - IpBlasDcopy(Dim(), values_v2, 1, values_, 1); + IpBlasCopy(Dim(), values_v2, 1, values_, 1); } } else if( b == -1. ) @@ -840,7 +968,7 @@ void DenseVector::AddTwoVectorsImpl( { if( b == 0. ) { - IpBlasDaxpy(Dim(), 1., values_v1, 1, values_, 1); + IpBlasAxpy(Dim(), 1., values_v1, 1, values_, 1); } else if( b == 1. ) { @@ -868,7 +996,7 @@ void DenseVector::AddTwoVectorsImpl( { if( b == 0. ) { - IpBlasDaxpy(Dim(), -1., values_v1, 1, values_, 1); + IpBlasAxpy(Dim(), -1., values_v1, 1, values_, 1); } else if( b == 1. ) { @@ -902,23 +1030,23 @@ void DenseVector::AddTwoVectorsImpl( { for( Index i = 0; i < Dim(); i++ ) { - IpBlasDaxpy(Dim(), 1., values_v2, 1, values_, 1); + IpBlasAxpy(Dim(), 1., values_v2, 1, values_, 1); } } else if( b == -1. ) { - IpBlasDaxpy(Dim(), -1., values_v2, 1, values_, 1); + IpBlasAxpy(Dim(), -1., values_v2, 1, values_, 1); } else { - IpBlasDaxpy(Dim(), b, values_v2, 1, values_, 1); + IpBlasAxpy(Dim(), b, values_v2, 1, values_, 1); } } else { if( b == 0. ) { - IpBlasDaxpy(Dim(), a, values_v1, 1, values_, 1); + IpBlasAxpy(Dim(), a, values_v1, 1, values_, 1); } else if( b == 1. ) { @@ -1011,7 +1139,7 @@ void DenseVector::AddTwoVectorsImpl( { if( b == 0. ) { - IpBlasDscal(Dim(), -1., values_, 1); + IpBlasScal(Dim(), -1., values_, 1); } else if( b == 1. ) { @@ -1135,7 +1263,7 @@ void DenseVector::AddTwoVectorsImpl( { if( b == 0. ) { - IpBlasDscal(Dim(), c, values_, 1); + IpBlasScal(Dim(), c, values_, 1); } else if( b == 1. ) { @@ -1204,6 +1332,11 @@ Number DenseVector::FracToBoundImpl( const DenseVector* dense_delta = static_cast(&delta); DBG_ASSERT(dynamic_cast(&delta)); + if( Dim() == 0 ) + { + return 1.0; + } + Number alpha = 1.; Number* values_x = values_; Number* values_delta = dense_delta->values_; @@ -1276,6 +1409,11 @@ void DenseVector::AddVectorQuotientImpl( bool homogeneous_z = dense_z->homogeneous_; bool homogeneous_s = dense_s->homogeneous_; + if( Dim() == 0 ) + { + return; + } + if( (c == 0. || homogeneous_) && homogeneous_z && homogeneous_s ) { if( c == 0. ) @@ -1414,11 +1552,11 @@ void DenseVector::CopyToPos( if( dense_x->homogeneous_ ) { - IpBlasDcopy(dim_x, &scalar_, 0, vals + Pos, 1); + IpBlasCopy(dim_x, &scalar_, 0, vals + Pos, 1); } else { - IpBlasDcopy(dim_x, dense_x->values_, 1, vals + Pos, 1); + IpBlasCopy(dim_x, dense_x->values_, 1, vals + Pos, 1); } initialized_ = true; ObjectChanged(); @@ -1439,7 +1577,7 @@ void DenseVector::CopyFromPos( } else { - IpBlasDcopy(Dim(), dense_x->Values() + Pos, 1, Values(), 1); + IpBlasCopy(Dim(), dense_x->Values() + Pos, 1, Values(), 1); initialized_ = true; ObjectChanged(); } @@ -1456,7 +1594,7 @@ void DenseVector::PrintImplOffset( ) const { jnlst.PrintfIndented(level, category, indent, - "%sDenseVector \"%s\" with %d elements:\n", prefix.c_str(), + "%sDenseVector \"%s\" with %" IPOPT_INDEX_FORMAT " elements:\n", prefix.c_str(), name.c_str(), Dim()); if( initialized_ ) @@ -1475,7 +1613,7 @@ void DenseVector::PrintImplOffset( for( Index i = 0; i < Dim(); i++ ) { jnlst.PrintfIndented(level, category, indent, - "%s%s[%5d]{%s}=%23.16e\n", prefix.c_str(), name.c_str(), + "%s%s[%5" IPOPT_INDEX_FORMAT "]{%s}=%23.16e\n", prefix.c_str(), name.c_str(), i + offset, idx_names[i].c_str(), values_[i]); } } @@ -1484,7 +1622,7 @@ void DenseVector::PrintImplOffset( for( Index i = 0; i < Dim(); i++ ) { jnlst.PrintfIndented(level, category, indent, - "%s%s[%5d]=%23.16e\n", prefix.c_str(), name.c_str(), + "%s%s[%5" IPOPT_INDEX_FORMAT "]=%23.16e\n", prefix.c_str(), name.c_str(), i + offset, values_[i]); } } diff --git a/src/LinAlg/IpDenseVector.hpp b/src/LinAlg/IpDenseVector.hpp index da194f1c4..40bbc51a8 100644 --- a/src/LinAlg/IpDenseVector.hpp +++ b/src/LinAlg/IpDenseVector.hpp @@ -18,9 +18,9 @@ namespace Ipopt class DenseVectorSpace; /** @name Exceptions */ -//@{ +///@{ DECLARE_STD_EXCEPTION(METADATA_ERROR); -//@} +///@} /** Dense Vector Implementation. * @@ -41,7 +41,7 @@ class IPOPTLIB_EXPORT DenseVector: public Vector { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Default Constructor */ DenseVector( @@ -51,10 +51,10 @@ class IPOPTLIB_EXPORT DenseVector: public Vector /** Destructor */ virtual ~DenseVector(); - //@} + ///@} /** @name Additional public methods not in Vector base class. */ - //@{ + ///@{ /** Create a new DenseVector from same VectorSpace */ SmartPtr MakeNewDenseVector() const; @@ -111,10 +111,10 @@ class IPOPTLIB_EXPORT DenseVector: public Vector DBG_ASSERT(homogeneous_); return scalar_; } - //@} + ///@} /** @name Modifying subranges of the vector. */ - //@{ + ///@{ /** Copy the data in x into the subrange of this vector starting * at position Pos in this vector. * @@ -134,11 +134,11 @@ class IPOPTLIB_EXPORT DenseVector: public Vector Index Pos, const Vector& x ); - //@} + ///@} protected: /** @name Overloaded methods from Vector base class */ - //@{ + ///@{ virtual void CopyImpl( const Vector& x ); @@ -174,6 +174,10 @@ class IPOPTLIB_EXPORT DenseVector: public Vector const Vector& x ); + virtual void ElementWiseSelectImpl( + const Vector& x + ); + virtual void ElementWiseMaxImpl( const Vector& x ); @@ -201,10 +205,10 @@ class IPOPTLIB_EXPORT DenseVector: public Vector virtual Number SumImpl() const; virtual Number SumLogsImpl() const; - //@} + ///@} /** @name Implemented specialized functions */ - //@{ + ///@{ /** Add two vectors (a * v1 + b * v2). * * Result is stored in this vector. @@ -230,10 +234,10 @@ class IPOPTLIB_EXPORT DenseVector: public Vector const Vector& s, Number c ); - //@} + ///@} /** @name Output methods */ - //@{ + ///@{ virtual void PrintImpl( const Journalist& jnlst, EJournalLevel level, @@ -256,7 +260,7 @@ class IPOPTLIB_EXPORT DenseVector: public Vector const std::string& prefix, Index offset ) const; - //@} + ///@} friend class ParVector; @@ -268,7 +272,7 @@ class IPOPTLIB_EXPORT DenseVector: public Vector * 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 */ DenseVector(); @@ -281,7 +285,7 @@ class IPOPTLIB_EXPORT DenseVector: public Vector void operator=( const DenseVector& ); - //@} + ///@} /** Copy of the owner_space ptr as a DenseVectorSpace instead of a VectorSpace. */ const DenseVectorSpace* owner_space_; @@ -319,18 +323,18 @@ class IPOPTLIB_EXPORT DenseVector: public Vector }; /** @name typedefs for the map variables that define meta data for the DenseVectorSpace */ -//@{ +///@{ typedef std::map > StringMetaDataMapType; typedef std::map > IntegerMetaDataMapType; typedef std::map > NumericMetaDataMapType; -//@} +///@} /** This vectors space is the vector space for DenseVector. */ class IPOPTLIB_EXPORT DenseVectorSpace: public VectorSpace { public: /** @name Constructors/Destructors. */ - //@{ + ///@{ /** Constructor, requires dimension of all vector for this VectorSpace */ DenseVectorSpace( Index dim @@ -341,7 +345,7 @@ class IPOPTLIB_EXPORT DenseVectorSpace: public VectorSpace /** Destructor */ ~DenseVectorSpace() { } - //@} + ///@} /** Method for creating a new vector of this specific type. */ inline DenseVector* MakeNewDenseVector() const @@ -359,7 +363,7 @@ class IPOPTLIB_EXPORT DenseVectorSpace: public VectorSpace * This could allow to have sophisticated memory management in the * VectorSpace. */ - //@{ + ///@{ /** Allocate internal storage for the DenseVector */ inline Number* AllocateInternalStorage() const; @@ -367,27 +371,27 @@ class IPOPTLIB_EXPORT DenseVectorSpace: public VectorSpace inline void FreeInternalStorage( Number* values ) const; - //@} + ///@} /**@name Methods for dealing with meta data on the vector */ - //@{ + ///@{ /** Check if string meta exists for tag */ inline bool HasStringMetaData( - const std::string tag + const std::string& tag ) const; /** Check if Integer meta exists for tag */ inline bool HasIntegerMetaData( - const std::string tag + const std::string& tag ) const; /** Check if Numeric meta exists for tag */ inline bool HasNumericMetaData( - const std::string tag + const std::string& tag ) const; /** Get meta data of type std::string by tag */ @@ -407,20 +411,20 @@ class IPOPTLIB_EXPORT DenseVectorSpace: public VectorSpace /** Set meta data of type std::string by tag */ inline void SetStringMetaData( - std::string tag, - std::vector meta_data + const std::string& tag, + const std::vector& meta_data ); /** Set meta data of type Index by tag */ inline void SetIntegerMetaData( - std::string tag, - std::vector meta_data + const std::string& tag, + const std::vector& meta_data ); /** Set meta data of type Number by tag */ inline void SetNumericMetaData( - std::string tag, - std::vector meta_data + const std::string& tag, + const std::vector& meta_data ); /** Get map of meta data of type Number */ @@ -431,7 +435,7 @@ class IPOPTLIB_EXPORT DenseVectorSpace: public VectorSpace /** Get map of meta data of type Number */ inline const NumericMetaDataMapType& GetNumericMetaData() const; - //@} + ///@} private: // variables to store vector meta data @@ -456,7 +460,9 @@ inline Number* DenseVector::Values() ObjectChanged(); initialized_ = true; homogeneous_ = false; - return values_allocated(); + values_allocated(); + DBG_ASSERT(Dim() == 0 || values_ != NULL); + return values_; } inline const Number* DenseVector::Values() const @@ -501,7 +507,7 @@ inline SmartPtr DenseVector::MakeNewDenseVector() const inline bool DenseVectorSpace::HasStringMetaData( - const std::string tag + const std::string& tag ) const { StringMetaDataMapType::const_iterator iter; @@ -517,7 +523,7 @@ bool DenseVectorSpace::HasStringMetaData( inline bool DenseVectorSpace::HasIntegerMetaData( - const std::string tag + const std::string& tag ) const { IntegerMetaDataMapType::const_iterator iter; @@ -533,7 +539,7 @@ bool DenseVectorSpace::HasIntegerMetaData( inline bool DenseVectorSpace::HasNumericMetaData( - const std::string tag + const std::string& tag ) const { NumericMetaDataMapType::const_iterator iter; @@ -578,24 +584,24 @@ inline const std::vector& DenseVectorSpace::GetNumericMetaData( } inline void DenseVectorSpace::SetStringMetaData( - std::string tag, - std::vector meta_data + const std::string& tag, + const std::vector& meta_data ) { string_meta_data_[tag] = meta_data; } inline void DenseVectorSpace::SetIntegerMetaData( - std::string tag, - std::vector meta_data + const std::string& tag, + const std::vector& meta_data ) { integer_meta_data_[tag] = meta_data; } inline void DenseVectorSpace::SetNumericMetaData( - std::string tag, - std::vector meta_data + const std::string& tag, + const std::vector& meta_data ) { numeric_meta_data_[tag] = meta_data; diff --git a/src/LinAlg/IpDiagMatrix.cpp b/src/LinAlg/IpDiagMatrix.cpp index d9d1c0fbf..db7d29fee 100644 --- a/src/LinAlg/IpDiagMatrix.cpp +++ b/src/LinAlg/IpDiagMatrix.cpp @@ -83,7 +83,7 @@ void DiagMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sDiagMatrix \"%s\" with %d rows and columns, and with diagonal elements:\n", prefix.c_str(), name.c_str(), + "%sDiagMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " rows and columns, and with diagonal elements:\n", prefix.c_str(), name.c_str(), Dim()); if( IsValid(diag_) ) { diff --git a/src/LinAlg/IpDiagMatrix.hpp b/src/LinAlg/IpDiagMatrix.hpp index 624de85cc..f12f84fd5 100644 --- a/src/LinAlg/IpDiagMatrix.hpp +++ b/src/LinAlg/IpDiagMatrix.hpp @@ -22,7 +22,7 @@ class IPOPTLIB_EXPORT DiagMatrix: public SymMatrix public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the corresponding matrix space. */ DiagMatrix( const SymMatrixSpace* owner_space @@ -30,7 +30,7 @@ class IPOPTLIB_EXPORT DiagMatrix: public SymMatrix /** Destructor */ ~DiagMatrix(); - //@} + ///@} /** Set the diagonal elements (as a Vector). */ void SetDiag( @@ -48,7 +48,7 @@ class IPOPTLIB_EXPORT DiagMatrix: public SymMatrix protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -71,7 +71,7 @@ class IPOPTLIB_EXPORT DiagMatrix: public SymMatrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -81,7 +81,7 @@ class IPOPTLIB_EXPORT DiagMatrix: public SymMatrix * 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 */ DiagMatrix(); @@ -94,7 +94,7 @@ class IPOPTLIB_EXPORT DiagMatrix: public SymMatrix void operator=( const DiagMatrix& ); - //@} + ///@} /** Vector storing the diagonal elements */ SmartPtr diag_; @@ -105,7 +105,7 @@ class IPOPTLIB_EXPORT DiagMatrixSpace: public SymMatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the dimension of the matrix. */ DiagMatrixSpace( Index dim @@ -116,7 +116,7 @@ class IPOPTLIB_EXPORT DiagMatrixSpace: public SymMatrixSpace /** Destructor */ virtual ~DiagMatrixSpace() { } - //@} + ///@} virtual SymMatrix* MakeNewSymMatrix() const { @@ -137,7 +137,7 @@ class IPOPTLIB_EXPORT DiagMatrixSpace: public SymMatrixSpace * 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 */ DiagMatrixSpace(); @@ -150,7 +150,7 @@ class IPOPTLIB_EXPORT DiagMatrixSpace: public SymMatrixSpace void operator=( const DiagMatrixSpace& ); - //@} + ///@} }; diff --git a/src/LinAlg/IpExpandedMultiVectorMatrix.cpp b/src/LinAlg/IpExpandedMultiVectorMatrix.cpp index fce94ff9b..9b45e88c7 100644 --- a/src/LinAlg/IpExpandedMultiVectorMatrix.cpp +++ b/src/LinAlg/IpExpandedMultiVectorMatrix.cpp @@ -204,7 +204,7 @@ void ExpandedMultiVectorMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sExpandedMultiVectorMatrix \"%s\" with %d columns:\n", prefix.c_str(), name.c_str(), NRows()); + "%sExpandedMultiVectorMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " columns:\n", prefix.c_str(), name.c_str(), NRows()); for( Index i = 0; i < NRows(); i++ ) { @@ -212,14 +212,14 @@ void ExpandedMultiVectorMatrix::PrintImpl( { DBG_ASSERT(name.size() < 200); char buffer[256]; - Snprintf(buffer, 255, "%s[%2d]", name.c_str(), i); + Snprintf(buffer, 255, "%s[%2" IPOPT_INDEX_FORMAT "]", name.c_str(), i); std::string term_name = buffer; vecs_[i]->Print(&jnlst, level, category, term_name, indent + 1, prefix); } else { jnlst.PrintfIndented(level, category, indent, - "%sVector in column %d is not yet set!\n", prefix.c_str(), i); + "%sVector in column %" IPOPT_INDEX_FORMAT " is not yet set!\n", prefix.c_str(), i); } } SmartPtr P = GetExpansionMatrix(); diff --git a/src/LinAlg/IpExpandedMultiVectorMatrix.hpp b/src/LinAlg/IpExpandedMultiVectorMatrix.hpp index 06ccc2a81..1bf709249 100644 --- a/src/LinAlg/IpExpandedMultiVectorMatrix.hpp +++ b/src/LinAlg/IpExpandedMultiVectorMatrix.hpp @@ -29,7 +29,7 @@ class ExpandedMultiVectorMatrix: public Matrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ ExpandedMultiVectorMatrix( const ExpandedMultiVectorMatrixSpace* owner_space @@ -38,7 +38,7 @@ class ExpandedMultiVectorMatrix: public Matrix /** Destructor */ virtual ~ExpandedMultiVectorMatrix() { } - //@} + ///@} SmartPtr MakeNewExpandedMultiVectorMatrix() const; @@ -73,7 +73,7 @@ class ExpandedMultiVectorMatrix: public Matrix protected: /**@name Overloaded methods from Matrix base class */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -109,7 +109,7 @@ class ExpandedMultiVectorMatrix: public Matrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -120,7 +120,7 @@ class ExpandedMultiVectorMatrix: public Matrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ ExpandedMultiVectorMatrix(); @@ -133,7 +133,7 @@ class ExpandedMultiVectorMatrix: public Matrix void operator=( const ExpandedMultiVectorMatrix& ); - //@} + ///@} const ExpandedMultiVectorMatrixSpace* owner_space_; @@ -147,7 +147,7 @@ class ExpandedMultiVectorMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of rows (i.e., Vectors to be * stored) and given the VectorSpace for the Vectors. */ @@ -160,7 +160,7 @@ class ExpandedMultiVectorMatrixSpace: public MatrixSpace /** Destructor */ virtual ~ExpandedMultiVectorMatrixSpace() { } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ ExpandedMultiVectorMatrix* MakeNewExpandedMultiVectorMatrix() const diff --git a/src/LinAlg/IpExpansionMatrix.cpp b/src/LinAlg/IpExpansionMatrix.cpp index ceb022baa..47edcb460 100644 --- a/src/LinAlg/IpExpansionMatrix.cpp +++ b/src/LinAlg/IpExpansionMatrix.cpp @@ -295,15 +295,13 @@ void ExpansionMatrix::SinvBlrmZMTdBrImpl( { for( Index i = 0; i < NCols(); i++ ) { - // ToDo could treat val == 0 extra - vals_X[i] = (scalar_R) / vals_S[i]; + vals_X[i] = scalar_R / vals_S[i]; } } else { for( Index i = 0; i < NCols(); i++ ) { - // ToDo could treat val == 0 extra vals_X[i] = (scalar_R + val * vals_D[exp_pos[i]]) / vals_S[i]; } } @@ -386,7 +384,7 @@ void ExpansionMatrix::ComputeRowAMaxImpl( for( Index i = 0; i < NCols(); i++ ) { - vec_vals[exp_pos[i]] = Max(vec_vals[exp_pos[i]], 1.); + vec_vals[exp_pos[i]] = Max(vec_vals[exp_pos[i]], Number(1.)); } } @@ -421,14 +419,14 @@ void ExpansionMatrix::PrintImplOffset( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sExpansionMatrix \"%s\" with %d rows and %d columns:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); + "%sExpansionMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " rows and %" IPOPT_INDEX_FORMAT " columns:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); const Index* exp_pos = ExpandedPosIndices(); for( Index i = 0; i < NCols(); i++ ) { jnlst.PrintfIndented(level, category, indent, - "%s%s[%5d,%5d]=%23.16e (%d)\n", prefix.c_str(), name.c_str(), exp_pos[i] + row_offset, i + col_offset, 1., i); + "%s%s[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "]=%23.16e (%" IPOPT_INDEX_FORMAT ")\n", prefix.c_str(), name.c_str(), exp_pos[i] + row_offset, i + col_offset, 1., i); } } @@ -459,7 +457,10 @@ ExpansionMatrixSpace::ExpansionMatrixSpace( //ToDo decide for offset DBG_ASSERT(ExpPos[i] - offset < NRows() && ExpPos[i] - offset >= 0); expanded_pos_[i] = ExpPos[i] - offset; - compressed_pos_[ExpPos[i] - offset] = i; + if( NRows() > 0 ) + { + compressed_pos_[ExpPos[i] - offset] = i; + } } } diff --git a/src/LinAlg/IpExpansionMatrix.hpp b/src/LinAlg/IpExpansionMatrix.hpp index 02e3f3b9c..e23355db1 100644 --- a/src/LinAlg/IpExpansionMatrix.hpp +++ b/src/LinAlg/IpExpansionMatrix.hpp @@ -28,7 +28,7 @@ class IPOPTLIB_EXPORT ExpansionMatrix: public Matrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ ExpansionMatrix( @@ -37,7 +37,7 @@ class IPOPTLIB_EXPORT ExpansionMatrix: public Matrix /** Destructor */ ~ExpansionMatrix(); - //@} + ///@} /** Return the vector of indices marking the expanded position. * @@ -62,7 +62,7 @@ class IPOPTLIB_EXPORT ExpansionMatrix: public Matrix protected: /**@name Overloaded methods from Matrix base class*/ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -114,7 +114,7 @@ class IPOPTLIB_EXPORT ExpansionMatrix: public Matrix { PrintImplOffset(jnlst, level, category, name, indent, prefix, 1, 1); } - //@} + ///@} void PrintImplOffset( const Journalist& jnlst, @@ -138,7 +138,7 @@ class IPOPTLIB_EXPORT ExpansionMatrix: public Matrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ ExpansionMatrix(); @@ -151,7 +151,7 @@ class IPOPTLIB_EXPORT ExpansionMatrix: public Matrix void operator=( const ExpansionMatrix& ); - //@} + ///@} const ExpansionMatrixSpace* owner_space_; @@ -162,7 +162,7 @@ class IPOPTLIB_EXPORT ExpansionMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the list of elements of the large vector * (of size NLargeVec) to be filtered into the small vector (of * size NSmallVec). @@ -185,7 +185,7 @@ class IPOPTLIB_EXPORT ExpansionMatrixSpace: public MatrixSpace delete[] compressed_pos_; delete[] expanded_pos_; } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ ExpansionMatrix* MakeNewExpansionMatrix() const diff --git a/src/LinAlg/IpIdentityMatrix.cpp b/src/LinAlg/IpIdentityMatrix.cpp index d07bb1e88..10ff48e33 100644 --- a/src/LinAlg/IpIdentityMatrix.cpp +++ b/src/LinAlg/IpIdentityMatrix.cpp @@ -75,7 +75,7 @@ void IdentityMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sIdentityMatrix \"%s\" with %d rows and columns and the factor %23.16e.\n", prefix.c_str(), name.c_str(), + "%sIdentityMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " rows and columns and the factor %23.16e.\n", prefix.c_str(), name.c_str(), NRows(), factor_); } diff --git a/src/LinAlg/IpIdentityMatrix.hpp b/src/LinAlg/IpIdentityMatrix.hpp index bd7ac8945..6f0e4296c 100644 --- a/src/LinAlg/IpIdentityMatrix.hpp +++ b/src/LinAlg/IpIdentityMatrix.hpp @@ -18,7 +18,7 @@ class IPOPTLIB_EXPORT IdentityMatrix: public SymMatrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, initializing with dimensions of the matrix * (true identity matrix). */ @@ -28,7 +28,7 @@ class IPOPTLIB_EXPORT IdentityMatrix: public SymMatrix /** Destructor */ ~IdentityMatrix(); - //@} + ///@} /** Method for setting the factor for the identity matrix. */ void SetFactor( @@ -49,7 +49,7 @@ class IPOPTLIB_EXPORT IdentityMatrix: public SymMatrix protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -79,7 +79,7 @@ class IPOPTLIB_EXPORT IdentityMatrix: public SymMatrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -90,7 +90,7 @@ class IPOPTLIB_EXPORT IdentityMatrix: public SymMatrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ IdentityMatrix(); @@ -103,7 +103,7 @@ class IPOPTLIB_EXPORT IdentityMatrix: public SymMatrix void operator=( const IdentityMatrix& ); - //@} + ///@} /** Scaling factor for this identity matrix */ Number factor_; @@ -114,7 +114,7 @@ class IPOPTLIB_EXPORT IdentityMatrixSpace: public SymMatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the dimension of the matrix. */ IdentityMatrixSpace( Index dim @@ -125,7 +125,7 @@ class IPOPTLIB_EXPORT IdentityMatrixSpace: public SymMatrixSpace /** Destructor */ virtual ~IdentityMatrixSpace() { } - //@} + ///@} virtual SymMatrix* MakeNewSymMatrix() const { @@ -147,7 +147,7 @@ class IPOPTLIB_EXPORT IdentityMatrixSpace: public SymMatrixSpace * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ IdentityMatrixSpace(); @@ -160,7 +160,7 @@ class IPOPTLIB_EXPORT IdentityMatrixSpace: public SymMatrixSpace void operator=( const IdentityMatrixSpace& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/LinAlg/IpLapack.cpp b/src/LinAlg/IpLapack.cpp index f5b4578d5..3202d698c 100644 --- a/src/LinAlg/IpLapack.cpp +++ b/src/LinAlg/IpLapack.cpp @@ -6,96 +6,95 @@ #include "IpoptConfig.h" #include "IpLapack.hpp" +#include "IpTypes.h" -#ifdef FUNNY_LAPACK_FINT -# define ipfint long -# define ipfintarray int +#ifdef IPOPT_SINGLE +#define IPOPT_LAPACK_FUNCP(name,NAME) IPOPT_LAPACK_FUNC(s ## name,S ## NAME) #else -# define ipfintarray ipfint +#define IPOPT_LAPACK_FUNCP(name,NAME) IPOPT_LAPACK_FUNC(d ## name,D ## NAME) #endif #ifdef IPOPT_HAS_LAPACK // Prototypes for the LAPACK routines extern "C" { - /** LAPACK Fortran subroutine DPOTRS. */ - void IPOPT_LAPACK_FUNC(dpotrs, DPOTRS)( - char* uplo, - ipfint* n, - ipfint* nrhs, - const double* A, - ipfint* ldA, - double* B, - ipfint* ldB, - ipfint* info, - int uplo_len + /** LAPACK Fortran subroutine XPOTRS. */ + void IPOPT_LAPACK_FUNCP(potrs, POTRS)( + char* uplo, + ipindex* n, + ipindex* nrhs, + const ipnumber* A, + ipindex* ldA, + ipnumber* B, + ipindex* ldB, + ipindex* info, + int uplo_len ); - /** LAPACK Fortran subroutine DPOTRF. */ - void IPOPT_LAPACK_FUNC(dpotrf, DPOTRF)( - char* uplo, - ipfint* n, - double* A, - ipfint* ldA, - ipfint* info, - int uplo_len + /** LAPACK Fortran subroutine XPOTRF. */ + void IPOPT_LAPACK_FUNCP(potrf, POTRF)( + char* uplo, + ipindex* n, + ipnumber* A, + ipindex* ldA, + ipindex* info, + int uplo_len ); - /** LAPACK Fortran subroutine DSYEV */ - void IPOPT_LAPACK_FUNC(dsyev, DSYEV)( - char* jobz, - char* uplo, - ipfint* n, - double* A, - ipfint* ldA, - double* W, - double* WORK, - ipfint* LWORK, - ipfint* info, - int jobz_len, - int uplo_len + /** LAPACK Fortran subroutine XSYEV */ + void IPOPT_LAPACK_FUNCP(syev, SYEV)( + char* jobz, + char* uplo, + ipindex* n, + ipnumber* A, + ipindex* ldA, + ipnumber* W, + ipnumber* WORK, + ipindex* LWORK, + ipindex* info, + int jobz_len, + int uplo_len ); - /** LAPACK Fortran subroutine DGETRF. */ - void IPOPT_LAPACK_FUNC(dgetrf, DGETRF)( - ipfint* m, - ipfint* n, - double* A, - ipfint* ldA, - ipfintarray* IPIV, - ipfint* info + /** LAPACK Fortran subroutine XGETRF. */ + void IPOPT_LAPACK_FUNCP(getrf, GETRF)( + ipindex* m, + ipindex* n, + ipnumber* A, + ipindex* ldA, + ipindex* IPIV, + ipindex* info ); - /** LAPACK Fortran subroutine DGETRS. */ - void IPOPT_LAPACK_FUNC(dgetrs, DGETRS)( - char* trans, - ipfint* n, - ipfint* nrhs, - const double* A, - ipfint* ldA, - ipfintarray* IPIV, - double* B, - ipfint* ldB, - ipfint* info, - int trans_len + /** LAPACK Fortran subroutine XGETRS. */ + void IPOPT_LAPACK_FUNCP(getrs, GETRS)( + char* trans, + ipindex* n, + ipindex* nrhs, + const ipnumber* A, + ipindex* ldA, + ipindex* IPIV, + ipnumber* B, + ipindex* ldB, + ipindex* info, + int trans_len ); - /** LAPACK Fortran subroutine DPPSV. */ - void IPOPT_LAPACK_FUNC(dppsv, DPPSV)( - char* uplo, - ipfint* n, - ipfint* nrhs, - const double* A, - double* B, - ipfint* ldB, - ipfint* info + /** LAPACK Fortran subroutine XPPSV. */ + void IPOPT_LAPACK_FUNCP(ppsv, PPSV)( + char* uplo, + ipindex* n, + ipindex* nrhs, + const ipnumber* A, + ipnumber* B, + ipindex* ldB, + ipindex* info ); } -#endif namespace Ipopt { -void IpLapackDpotrs( +void IpLapackPotrs( Index ndim, Index nrhs, const Number* a, @@ -105,10 +104,10 @@ void IpLapackDpotrs( ) { #ifdef IPOPT_HAS_LAPACK - ipfint N = ndim, NRHS = nrhs, LDA = lda, LDB = ldb, INFO; + ipindex N = ndim, NRHS = nrhs, LDA = lda, LDB = ldb, INFO; char uplo = 'L'; - IPOPT_LAPACK_FUNC(dpotrs, DPOTRS)(&uplo, &N, &NRHS, a, &LDA, b, &LDB, &INFO, 1); + IPOPT_LAPACK_FUNCP(potrs, POTRS)(&uplo, &N, &NRHS, a, &LDA, b, &LDB, &INFO, 1); DBG_ASSERT(INFO == 0); #else @@ -118,7 +117,7 @@ void IpLapackDpotrs( #endif } -void IpLapackDpotrf( +void IpLapackPotrf( Index ndim, Number* a, Index lda, @@ -126,11 +125,11 @@ void IpLapackDpotrf( ) { #ifdef IPOPT_HAS_LAPACK - ipfint N = ndim, LDA = lda, INFO; + ipindex N = ndim, LDA = lda, INFO; char UPLO = 'L'; - IPOPT_LAPACK_FUNC(dpotrf, DPOTRF)(&UPLO, &N, a, &LDA, &INFO, 1); + IPOPT_LAPACK_FUNCP(potrf, POTRF)(&UPLO, &N, a, &LDA, &INFO, 1); info = INFO; #else @@ -142,7 +141,7 @@ void IpLapackDpotrf( } -void IpLapackDsyev( +void IpLapackSyev( bool compute_eigenvectors, Index ndim, Number* a, @@ -152,7 +151,7 @@ void IpLapackDsyev( ) { #ifdef IPOPT_HAS_LAPACK - ipfint N = ndim, LDA = lda, INFO; + ipindex N = ndim, LDA = lda, INFO; char JOBZ; if (compute_eigenvectors) @@ -166,21 +165,21 @@ void IpLapackDsyev( char UPLO = 'L'; // First we find out how large LWORK should be - ipfint LWORK = -1; - double WORK_PROBE; - IPOPT_LAPACK_FUNC(dsyev, DSYEV)(&JOBZ, &UPLO, &N, a, &LDA, w, + ipindex LWORK = -1; + Number WORK_PROBE; + IPOPT_LAPACK_FUNCP(syev, SYEV)(&JOBZ, &UPLO, &N, a, &LDA, w, &WORK_PROBE, &LWORK, &INFO, 1, 1); DBG_ASSERT(INFO == 0); - LWORK = (ipfint) WORK_PROBE; + LWORK = (ipindex) WORK_PROBE; DBG_ASSERT(LWORK > 0); - double* WORK = new double[LWORK]; + Number* WORK = new Number[LWORK]; for (Index i = 0; i < LWORK; i++) { WORK[i] = i; } - IPOPT_LAPACK_FUNC(dsyev, DSYEV)(&JOBZ, &UPLO, &N, a, &LDA, w, + IPOPT_LAPACK_FUNCP(syev, SYEV)(&JOBZ, &UPLO, &N, a, &LDA, w, WORK, &LWORK, &INFO, 1, 1); DBG_ASSERT(INFO >= 0); @@ -196,7 +195,7 @@ void IpLapackDsyev( } -void IpLapackDgetrf( +void IpLapackGetrf( Index ndim, Number* a, Index* ipiv, @@ -205,21 +204,21 @@ void IpLapackDgetrf( ) { #ifdef IPOPT_HAS_LAPACK - ipfint M = ndim, N = ndim, LDA = lda, INFO; + ipindex M = ndim, N = ndim, LDA = lda, INFO; - IPOPT_LAPACK_FUNC(dgetrf, DGETRF)(&M, &N, a, &LDA, ipiv, &INFO); + IPOPT_LAPACK_FUNCP(getrf, GETRF)(&M, &N, a, &LDA, ipiv, &INFO); info = INFO; #else std::string msg = - "Ipopt has been compiled without LAPACK routine DPOTRF, but options are chosen that require this dependency. Abort."; + "Ipopt has been compiled without LAPACK routine DGETRF, but options are chosen that require this dependency. Abort."; THROW_EXCEPTION(LAPACK_NOT_INCLUDED, msg); #endif } -void IpLapackDgetrs( +void IpLapackGetrs( Index ndim, Index nrhs, const Number* a, @@ -230,22 +229,23 @@ void IpLapackDgetrs( ) { #ifdef IPOPT_HAS_LAPACK - ipfint N = ndim, NRHS = nrhs, LDA = lda, LDB = ldb, INFO; + ipindex N = ndim, NRHS = nrhs, LDA = lda, LDB = ldb, INFO; char trans = 'N'; - IPOPT_LAPACK_FUNC(dgetrs, DGETRS)(&trans, &N, &NRHS, a, &LDA, ipiv, b, &LDB, + IPOPT_LAPACK_FUNCP(getrs, GETRS)(&trans, &N, &NRHS, a, &LDA, ipiv, b, &LDB, &INFO, 1); + DBG_ASSERT(INFO == 0); #else std::string msg = - "Ipopt has been compiled without LAPACK routine DPOTRS, but options are chosen that require this dependency. Abort."; + "Ipopt has been compiled without LAPACK routine DGETRS, but options are chosen that require this dependency. Abort."; THROW_EXCEPTION(LAPACK_NOT_INCLUDED, msg); #endif } -void IpLapackDppsv( +void IpLapackPpsv( Index ndim, Index nrhs, const Number* a, @@ -255,10 +255,10 @@ void IpLapackDppsv( ) { #ifdef IPOPT_HAS_LAPACK - ipfint N = ndim, NRHS = nrhs, LDB = ldb, INFO; + ipindex N = ndim, NRHS = nrhs, LDB = ldb, INFO; char uplo = 'U'; - IPOPT_LAPACK_FUNC(dppsv, DPPSV)(&uplo, &N, &NRHS, a, b, &LDB, &INFO); + IPOPT_LAPACK_FUNCP(ppsv, PPSV)(&uplo, &N, &NRHS, a, b, &LDB, &INFO); info = INFO; #else @@ -270,3 +270,4 @@ void IpLapackDppsv( } } // namespace Ipopt +#endif /* ifdef IPOPT_HAS_LAPACK */ diff --git a/src/LinAlg/IpLapack.hpp b/src/LinAlg/IpLapack.hpp index 28220f59e..d7ca9c236 100644 --- a/src/LinAlg/IpLapack.hpp +++ b/src/LinAlg/IpLapack.hpp @@ -14,29 +14,85 @@ namespace Ipopt { DECLARE_STD_EXCEPTION(LAPACK_NOT_INCLUDED); +/** Wrapper for LAPACK subroutine XPOTRS. + * + * Solving a linear system given a Cholesky factorization. + * We assume that the Cholesky factor is lower traiangular. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpLapackPotrs( + Index ndim, + Index nrhs, + const Number* a, + Index lda, + Number* b, + Index ldb +); + /** Wrapper for LAPACK subroutine DPOTRS. * * Solving a linear system given a Cholesky factorization. * We assume that the Cholesky factor is lower traiangular. + * + * @deprecated Use IpLapackPotrs() instead. */ -IPOPTLIB_EXPORT void IpLapackDpotrs( +IPOPT_DEPRECATED +inline void IpLapackDpotrs( Index ndim, Index nrhs, const Number* a, Index lda, Number* b, Index ldb +) +{ + IpLapackPotrs(ndim, nrhs, a, lda, b, ldb); +} + +/** Wrapper for LAPACK subroutine XPOTRF. + * + * Compute Cholesky factorization (lower triangular factor). + * info is the return value from the LAPACK routine. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpLapackPotrf( + Index ndim, + Number* a, + Index lda, + Index& info ); /** Wrapper for LAPACK subroutine DPOTRF. * * Compute Cholesky factorization (lower triangular factor). * info is the return value from the LAPACK routine. + * + * @deprecated Use IpLapackPotrf() instead. + */ +IPOPT_DEPRECATED +inline void IpLapackDpotrf( + Index ndim, + Number* a, + Index lda, + Index& info +) +{ + IpLapackPotrf(ndim, a, lda, info); +} + +/** Wrapper for LAPACK subroutine XSYEV. + * + * Compute the Eigenvalue decomposition for a given matrix. + * If compute_eigenvectors is true, a will contain the eigenvectors + * in its columns on return. + * @since 3.14.0 */ -IPOPTLIB_EXPORT void IpLapackDpotrf( +IPOPTLIB_EXPORT void IpLapackSyev( + bool compute_eigenvectors, Index ndim, Number* a, Index lda, + Number* w, Index& info ); @@ -45,34 +101,78 @@ IPOPTLIB_EXPORT void IpLapackDpotrf( * Compute the Eigenvalue decomposition for a given matrix. * If compute_eigenvectors is true, a will contain the eigenvectors * in its columns on return. + * + * @deprecated Use IpLapackSyev() instead */ -IPOPTLIB_EXPORT void IpLapackDsyev( +IPOPT_DEPRECATED +inline void IpLapackDsyev( bool compute_eigenvectors, Index ndim, Number* a, Index lda, Number* w, Index& info +) +{ + IpLapackSyev(compute_eigenvectors, ndim, a, lda, w, info); +} + +/** Wrapper for LAPACK subroutine XGETRF. + * + * Compute LU factorization. + * info is the return value from the LAPACK routine. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpLapackGetrf( + Index ndim, + Number* a, + Index* ipiv, + Index lda, + Index& info ); /** Wrapper for LAPACK subroutine DGETRF. * * Compute LU factorization. * info is the return value from the LAPACK routine. + * + * @deprecated Use IpLapackGetrf() instead. */ -IPOPTLIB_EXPORT void IpLapackDgetrf( +IPOPT_DEPRECATED +inline void IpLapackDgetrf( Index ndim, Number* a, Index* ipiv, Index lda, Index& info +) +{ + IpLapackGetrf(ndim, a, ipiv, lda, info); +} + +/** Wrapper for LAPACK subroutine XGETRS. + * + * Solving a linear system given a LU factorization. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpLapackGetrs( + Index ndim, + Index nrhs, + const Number* a, + Index lda, + Index* ipiv, + Number* b, + Index ldb ); /** Wrapper for LAPACK subroutine DGETRS. * * Solving a linear system given a LU factorization. + * + * @deprecated Use IpLapackGetrs() instead. */ -IPOPTLIB_EXPORT void IpLapackDgetrs( +IPOPT_DEPRECATED +inline void IpLapackDgetrs( Index ndim, Index nrhs, const Number* a, @@ -80,6 +180,25 @@ IPOPTLIB_EXPORT void IpLapackDgetrs( Index* ipiv, Number* b, Index ldb +) +{ + IpLapackGetrs(ndim, nrhs, a, lda, ipiv, b, ldb); +} + +/** Wrapper for LAPACK subroutine XPPSV. + * + * Solves a symmetric positive + * definite linear system in packed storage format (upper triangular). + * info is the return value from the LAPACK routine. + * @since 3.14.0 + */ +IPOPTLIB_EXPORT void IpLapackPpsv( + Index ndim, + Index nrhs, + const Number* a, + Number* b, + Index ldb, + Index& info ); /** Wrapper for LAPACK subroutine DPPSV. @@ -87,15 +206,21 @@ IPOPTLIB_EXPORT void IpLapackDgetrs( * Solves a symmetric positive * definite linear system in packed storage format (upper triangular). * info is the return value from the LAPACK routine. + * + * @deprecated Use IpLapackPpsv() instead. */ -IPOPTLIB_EXPORT void IpLapackDppsv( +IPOPT_DEPRECATED +inline void IpLapackDppsv( Index ndim, Index nrhs, const Number* a, Number* b, Index ldb, Index& info -); +) +{ + IpLapackPpsv(ndim, nrhs, a, b, ldb, info); +} } // namespace Ipopt diff --git a/src/LinAlg/IpLowRankUpdateSymMatrix.cpp b/src/LinAlg/IpLowRankUpdateSymMatrix.cpp index a8310f01f..a4128da16 100644 --- a/src/LinAlg/IpLowRankUpdateSymMatrix.cpp +++ b/src/LinAlg/IpLowRankUpdateSymMatrix.cpp @@ -182,7 +182,7 @@ void LowRankUpdateSymMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sLowRankUpdateSymMatrix \"%s\" with %d rows and columns:\n", prefix.c_str(), name.c_str(), Dim()); + "%sLowRankUpdateSymMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " rows and columns:\n", prefix.c_str(), name.c_str(), Dim()); if( ReducedDiag() ) { diff --git a/src/LinAlg/IpLowRankUpdateSymMatrix.hpp b/src/LinAlg/IpLowRankUpdateSymMatrix.hpp index c6bff9b65..c88c8cd66 100644 --- a/src/LinAlg/IpLowRankUpdateSymMatrix.hpp +++ b/src/LinAlg/IpLowRankUpdateSymMatrix.hpp @@ -32,7 +32,7 @@ class LowRankUpdateSymMatrix: public SymMatrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the corresponding matrix space. */ LowRankUpdateSymMatrix( const LowRankUpdateSymMatrixSpace* owner_space @@ -40,7 +40,7 @@ class LowRankUpdateSymMatrix: public SymMatrix /** Destructor */ ~LowRankUpdateSymMatrix(); - //@} + ///@} /** Method for setting the diagonal elements (as a Vector). */ void SetDiag( @@ -102,7 +102,7 @@ class LowRankUpdateSymMatrix: public SymMatrix protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -130,7 +130,7 @@ class LowRankUpdateSymMatrix: public SymMatrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -141,7 +141,7 @@ class LowRankUpdateSymMatrix: public SymMatrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ LowRankUpdateSymMatrix(); @@ -154,7 +154,7 @@ class LowRankUpdateSymMatrix: public SymMatrix void operator=( const LowRankUpdateSymMatrix& ); - //@} + ///@} /** corresponding matrix space */ SmartPtr owner_space_; @@ -174,7 +174,7 @@ class LowRankUpdateSymMatrixSpace: public SymMatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the dimension of the matrix. */ LowRankUpdateSymMatrixSpace( Index dim, @@ -193,7 +193,7 @@ class LowRankUpdateSymMatrixSpace: public SymMatrixSpace /** Destructor */ virtual ~LowRankUpdateSymMatrixSpace() { } - //@} + ///@} virtual SymMatrix* MakeNewSymMatrix() const { @@ -230,7 +230,7 @@ class LowRankUpdateSymMatrixSpace: public SymMatrixSpace * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ LowRankUpdateSymMatrixSpace(); @@ -243,7 +243,7 @@ class LowRankUpdateSymMatrixSpace: public SymMatrixSpace void operator=( const LowRankUpdateSymMatrixSpace& ); - //@} + ///@} /** Expansion matrix to lift the low-rank approximation into a * possibly higher-dimensional space. diff --git a/src/LinAlg/IpMatrix.hpp b/src/LinAlg/IpMatrix.hpp index da550abf2..6b2555004 100644 --- a/src/LinAlg/IpMatrix.hpp +++ b/src/LinAlg/IpMatrix.hpp @@ -28,7 +28,7 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor. * * It has to be given a pointer to the corresponding MatrixSpace. @@ -44,10 +44,10 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject /** Destructor */ virtual ~Matrix() { } - //@} + ///@} /**@name Operations of the Matrix on a Vector */ - //@{ + ///@{ /** Matrix-vector multiply. * * Computes y = alpha * Matrix * x + beta * y. @@ -79,14 +79,14 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject { TransMultVectorImpl(alpha, x, beta, y); } - //@} + ///@} /** @name Methods for specialized operations. * * A prototype implementation is provided, but for efficient implementation * those should be specially implemented. */ - //@{ + ///@{ /** X = X + alpha*(Matrix S^{-1} Z). * * Should be implemented efficiently for the ExpansionMatrix. @@ -110,22 +110,22 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject const Vector& D, Vector& X ) const; - //@} + ///@} /** Method for determining if all stored numbers are valid (i.e., no Inf or Nan). */ bool HasValidNumbers() const; /** @name Information about the size of the matrix */ - //@{ + ///@{ /** Number of rows */ inline Index NRows() const; /** Number of columns */ inline Index NCols() const; - //@} + ///@} /** @name Norms of the individual rows and columns */ - //@{ + ///@{ /** Compute the max-norm of the rows in the matrix. * * The result is stored in rows_norms. @@ -161,13 +161,13 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject } ComputeColAMaxImpl(cols_norms, init); } - //@} + ///@} /** Print detailed information about the matrix. * * @attention Do not overload. Overload PrintImpl instead. */ - //@{ + ///@{ virtual void Print( SmartPtr jnlst, EJournalLevel level, @@ -185,7 +185,7 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject Index indent = 0, const std::string& prefix = "" ) const; - //@} + ///@} /** Return the owner MatrixSpace */ inline SmartPtr OwnerSpace() const; @@ -194,7 +194,7 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject /** @name implementation methods (derived classes MUST * overload these pure virtual protected methods). */ - //@{ + ///@{ /** Matrix-vector multiply. * * Computes y = alpha * Matrix * x + beta * y. @@ -279,7 +279,7 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject Index indent, const std::string& prefix ) const = 0; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -290,7 +290,7 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor */ Matrix(); @@ -303,15 +303,15 @@ class IPOPTLIB_EXPORT Matrix: public TaggedObject Matrix& operator=( const Matrix& ); - //@} + ///@} const SmartPtr owner_space_; /**@name CachedResults data members */ - //@{ + ///@{ mutable TaggedObject::Tag valid_cache_tag_; mutable bool cached_valid_; - //@} + ///@} }; /** MatrixSpace base class, corresponding to the Matrix base class. @@ -327,7 +327,7 @@ class IPOPTLIB_EXPORT MatrixSpace: public ReferencedObject { public: /** @name Constructors/Destructors */ - //@{ + ///@{ /** Constructor, given the number rows and columns of all matrices * generated by this MatrixSpace. */ @@ -341,7 +341,7 @@ class IPOPTLIB_EXPORT MatrixSpace: public ReferencedObject /** Destructor */ virtual ~MatrixSpace() { } - //@} + ///@} /** Pure virtual method for creating a new Matrix of the corresponding type. */ virtual Matrix* MakeNew() const = 0; @@ -375,7 +375,7 @@ class IPOPTLIB_EXPORT MatrixSpace: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor */ MatrixSpace(); @@ -388,7 +388,7 @@ class IPOPTLIB_EXPORT MatrixSpace: public ReferencedObject MatrixSpace& operator=( const MatrixSpace& ); - //@} + ///@} /** Number of rows for all matrices of this type. */ const Index nRows_; diff --git a/src/LinAlg/IpMultiVectorMatrix.cpp b/src/LinAlg/IpMultiVectorMatrix.cpp index cd7db46db..71c764e2c 100644 --- a/src/LinAlg/IpMultiVectorMatrix.cpp +++ b/src/LinAlg/IpMultiVectorMatrix.cpp @@ -313,7 +313,7 @@ void MultiVectorMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sMultiVectorMatrix \"%s\" with %d columns:\n", prefix.c_str(), name.c_str(), NCols()); + "%sMultiVectorMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " columns:\n", prefix.c_str(), name.c_str(), NCols()); for( Index i = 0; i < NCols(); i++ ) { @@ -321,14 +321,14 @@ void MultiVectorMatrix::PrintImpl( { DBG_ASSERT(name.size() < 200); char buffer[256]; - Snprintf(buffer, 255, "%s[%2d]", name.c_str(), i); + Snprintf(buffer, 255, "%s[%2" IPOPT_INDEX_FORMAT "]", name.c_str(), i); std::string term_name = buffer; ConstVec(i)->Print(&jnlst, level, category, term_name, indent + 1, prefix); } else { jnlst.PrintfIndented(level, category, indent, - "%sVector in column %d is not yet set!\n", prefix.c_str(), i); + "%sVector in column %" IPOPT_INDEX_FORMAT " is not yet set!\n", prefix.c_str(), i); } } } diff --git a/src/LinAlg/IpMultiVectorMatrix.hpp b/src/LinAlg/IpMultiVectorMatrix.hpp index 5be3837d9..319ac66d9 100644 --- a/src/LinAlg/IpMultiVectorMatrix.hpp +++ b/src/LinAlg/IpMultiVectorMatrix.hpp @@ -25,7 +25,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ MultiVectorMatrix( @@ -34,7 +34,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix /** Destructor */ ~MultiVectorMatrix(); - //@} + ///@} /** Create a new MultiVectorMatrix from same MatrixSpace */ SmartPtr MakeNewMultiVectorMatrix() const; @@ -44,7 +44,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix * * Depending on whether the Vector is const or not, it is stored * in the const or non-const internal column. */ - //@{ + ///@{ void SetVector( Index i, const Vector& vec @@ -58,7 +58,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix Index i, Vector& vec ); - //@} + ///@} /** Get a Vector in a particular column as a const Vector */ inline SmartPtr GetVector( @@ -138,7 +138,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix protected: /**@name Overloaded methods from Matrix base class */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -173,7 +173,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -184,7 +184,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ MultiVectorMatrix(); @@ -197,7 +197,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix void operator=( const MultiVectorMatrix& ); - //@} + ///@} const MultiVectorMatrixSpace* owner_space_; @@ -208,7 +208,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix std::vector > non_const_vecs_; /** Method for accessing the internal Vectors internally */ - //@{ + ///@{ inline const Vector* ConstVec( Index i ) const @@ -233,7 +233,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrix: public Matrix DBG_ASSERT(IsValid(non_const_vecs_[i])); return GetRawPtr(non_const_vecs_[i]); } - //@} + ///@} }; /** This is the matrix space for MultiVectorMatrix. */ @@ -241,7 +241,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of columns (i.e., Vectors to be * stored) and given the VectorSpace for the Vectors. */ @@ -253,7 +253,7 @@ class IPOPTLIB_EXPORT MultiVectorMatrixSpace: public MatrixSpace /** Destructor */ ~MultiVectorMatrixSpace() { } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ MultiVectorMatrix* MakeNewMultiVectorMatrix() const diff --git a/src/LinAlg/IpScaledMatrix.cpp b/src/LinAlg/IpScaledMatrix.cpp index f28bc0572..c75330184 100644 --- a/src/LinAlg/IpScaledMatrix.cpp +++ b/src/LinAlg/IpScaledMatrix.cpp @@ -129,7 +129,7 @@ void ScaledMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sScaledMatrix \"%s\" of dimension %d x %d:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); + "%sScaledMatrix \"%s\" of dimension %" IPOPT_INDEX_FORMAT " x %" IPOPT_INDEX_FORMAT ":\n", prefix.c_str(), name.c_str(), NRows(), NCols()); if( IsValid(owner_space_->RowScaling()) ) { owner_space_->RowScaling()->Print(&jnlst, level, category, name + "_row_scaling", indent + 1, prefix); diff --git a/src/LinAlg/IpScaledMatrix.hpp b/src/LinAlg/IpScaledMatrix.hpp index 9d22712aa..f75b3a6d7 100644 --- a/src/LinAlg/IpScaledMatrix.hpp +++ b/src/LinAlg/IpScaledMatrix.hpp @@ -27,7 +27,7 @@ class IPOPTLIB_EXPORT ScaledMatrix: public Matrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ ScaledMatrix( @@ -36,7 +36,7 @@ class IPOPTLIB_EXPORT ScaledMatrix: public Matrix /** Destructor */ ~ScaledMatrix(); - //@} + ///@} /** Set the unscaled matrix */ void SetUnscaledMatrix( @@ -62,7 +62,7 @@ class IPOPTLIB_EXPORT ScaledMatrix: public Matrix protected: /**@name Methods overloaded from Matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -98,10 +98,8 @@ class IPOPTLIB_EXPORT ScaledMatrix: public Matrix const std::string& prefix ) const; - /** X = beta*X + alpha*(Matrix S^{-1} Z). - * - * @todo Specialized implementation missing so far! - */ + /** X = beta*X + alpha*(Matrix S^{-1} Z). */ + // ToDo Specialized implementation missing so far! virtual void AddMSinvZImpl( Number alpha, const Vector& S, @@ -109,10 +107,8 @@ class IPOPTLIB_EXPORT ScaledMatrix: public Matrix Vector& X ) const; - /** X = S^{-1} (r + alpha*Z*M^Td). - * - * @todo Specialized implementation missing so far! - */ + /** X = S^{-1} (r + alpha*Z*M^Td). */ + // ToDo Specialized implementation missing so far! virtual void SinvBlrmZMTdBrImpl( Number alpha, const Vector& S, @@ -121,7 +117,7 @@ class IPOPTLIB_EXPORT ScaledMatrix: public Matrix const Vector& D, Vector& X ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -132,7 +128,7 @@ class IPOPTLIB_EXPORT ScaledMatrix: public Matrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ ScaledMatrix(); @@ -145,7 +141,7 @@ class IPOPTLIB_EXPORT ScaledMatrix: public Matrix void operator=( const ScaledMatrix& ); - //@} + ///@} /** const version of the unscaled matrix */ SmartPtr matrix_; @@ -162,7 +158,7 @@ class IPOPTLIB_EXPORT ScaledMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of row and columns blocks, as * well as the totel number of rows and columns. */ @@ -177,7 +173,7 @@ class IPOPTLIB_EXPORT ScaledMatrixSpace: public MatrixSpace /** Destructor */ ~ScaledMatrixSpace() { } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ ScaledMatrix* MakeNewScaledMatrix( @@ -225,7 +221,7 @@ class IPOPTLIB_EXPORT ScaledMatrixSpace: public MatrixSpace * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor */ ScaledMatrixSpace(); @@ -238,7 +234,7 @@ class IPOPTLIB_EXPORT ScaledMatrixSpace: public MatrixSpace ScaledMatrixSpace& operator=( const ScaledMatrixSpace& ); - //@} + ///@} /** Row scaling vector */ SmartPtr row_scaling_; diff --git a/src/LinAlg/IpSumMatrix.cpp b/src/LinAlg/IpSumMatrix.cpp index aef67a29b..c50746f89 100644 --- a/src/LinAlg/IpSumMatrix.cpp +++ b/src/LinAlg/IpSumMatrix.cpp @@ -148,15 +148,14 @@ void SumMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sSumMatrix \"%s\" of dimension %d x %d with %d terms:\n", prefix.c_str(), name.c_str(), NRows(), NCols(), NTerms()); + "%sSumMatrix \"%s\" of dimension %" IPOPT_INDEX_FORMAT " x %" IPOPT_INDEX_FORMAT " with %" IPOPT_INDEX_FORMAT " terms:\n", prefix.c_str(), name.c_str(), NRows(), NCols(), NTerms()); for( Index iterm = 0; iterm < NTerms(); iterm++ ) { jnlst.PrintfIndented(level, category, indent, - "%sTerm %d with factor %23.16e and the following matrix:\n", prefix.c_str(), iterm, factors_[iterm]); + "%sTerm %" IPOPT_INDEX_FORMAT " with factor %23.16e and the following matrix:\n", prefix.c_str(), iterm, factors_[iterm]); char buffer[256]; - Snprintf(buffer, 255, "Term: %d", iterm); - std::string name = buffer; - matrices_[iterm]->Print(&jnlst, level, category, name, indent + 1, prefix); + Snprintf(buffer, 255, "Term: %" IPOPT_INDEX_FORMAT, iterm); + matrices_[iterm]->Print(&jnlst, level, category, buffer, indent + 1, prefix); } } diff --git a/src/LinAlg/IpSumMatrix.hpp b/src/LinAlg/IpSumMatrix.hpp index c4961a86e..48a16d879 100644 --- a/src/LinAlg/IpSumMatrix.hpp +++ b/src/LinAlg/IpSumMatrix.hpp @@ -24,7 +24,7 @@ class SumMatrix: public Matrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ SumMatrix( const SumMatrixSpace* owner_space @@ -32,7 +32,7 @@ class SumMatrix: public Matrix /** Destructor */ virtual ~SumMatrix(); - //@} + ///@} /** Method for setting term iterm for the sum. */ void SetTerm( @@ -56,7 +56,7 @@ class SumMatrix: public Matrix protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -91,7 +91,7 @@ class SumMatrix: public Matrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -102,7 +102,7 @@ class SumMatrix: public Matrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ SumMatrix(); @@ -115,7 +115,7 @@ class SumMatrix: public Matrix void operator=( const SumMatrix& ); - //@} + ///@} /** std::vector storing the factors for each term. */ std::vector factors_; @@ -132,7 +132,7 @@ class SumMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of row and columns, as well as * the number of terms in the sum. */ @@ -148,7 +148,7 @@ class SumMatrixSpace: public MatrixSpace /** Destructor */ virtual ~SumMatrixSpace() { } - //@} + ///@} /** Accessor functions to get the number of terms in the sum. */ Index NTerms() const @@ -184,7 +184,7 @@ class SumMatrixSpace: public MatrixSpace * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor */ SumMatrixSpace(); @@ -197,7 +197,7 @@ class SumMatrixSpace: public MatrixSpace SumMatrixSpace& operator=( const SumMatrixSpace& ); - //@} + ///@} const Index nterms_; diff --git a/src/LinAlg/IpSumSymMatrix.cpp b/src/LinAlg/IpSumSymMatrix.cpp index 71358f863..dfb2fe6d4 100644 --- a/src/LinAlg/IpSumSymMatrix.cpp +++ b/src/LinAlg/IpSumSymMatrix.cpp @@ -120,15 +120,14 @@ void SumSymMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sSumSymMatrix \"%s\" of dimension %d with %d terms:\n", prefix.c_str(), name.c_str(), Dim(), NTerms()); + "%sSumSymMatrix \"%s\" of dimension %" IPOPT_INDEX_FORMAT " with %" IPOPT_INDEX_FORMAT " terms:\n", prefix.c_str(), name.c_str(), Dim(), NTerms()); for( Index iterm = 0; iterm < NTerms(); iterm++ ) { jnlst.PrintfIndented(level, category, indent, - "%sTerm %d with factor %23.16e and the following matrix:\n", prefix.c_str(), iterm, factors_[iterm]); + "%sTerm %" IPOPT_INDEX_FORMAT " with factor %23.16e and the following matrix:\n", prefix.c_str(), iterm, factors_[iterm]); char buffer[256]; - Snprintf(buffer, 255, "Term: %d", iterm); - std::string name = buffer; - matrices_[iterm]->Print(&jnlst, level, category, name, indent + 1, prefix); + Snprintf(buffer, 255, "Term: %" IPOPT_INDEX_FORMAT, iterm); + matrices_[iterm]->Print(&jnlst, level, category, buffer, indent + 1, prefix); } } diff --git a/src/LinAlg/IpSumSymMatrix.hpp b/src/LinAlg/IpSumSymMatrix.hpp index 06fdbdc16..4f1108308 100644 --- a/src/LinAlg/IpSumSymMatrix.hpp +++ b/src/LinAlg/IpSumSymMatrix.hpp @@ -18,13 +18,13 @@ class SumSymMatrixSpace; /** Class for Matrices which are sum of symmetric matrices. * - * For each term in the we store the matrix and a factor. + * For each term in the sum we store the matrix and a factor. */ class IPOPTLIB_EXPORT SumSymMatrix: public SymMatrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, initializing with dimensions of the matrix and * the number of terms in the sum. */ @@ -34,7 +34,7 @@ class IPOPTLIB_EXPORT SumSymMatrix: public SymMatrix /** Destructor */ ~SumSymMatrix(); - //@} + ///@} /** Method for setting term iterm for the sum. * @@ -61,7 +61,7 @@ class IPOPTLIB_EXPORT SumSymMatrix: public SymMatrix protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -89,7 +89,7 @@ class IPOPTLIB_EXPORT SumSymMatrix: public SymMatrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -100,7 +100,7 @@ class IPOPTLIB_EXPORT SumSymMatrix: public SymMatrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ SumSymMatrix(); @@ -113,7 +113,7 @@ class IPOPTLIB_EXPORT SumSymMatrix: public SymMatrix void operator=( const SumSymMatrix& ); - //@} + ///@} /** std::vector storing the factors for each term. */ std::vector factors_; @@ -130,7 +130,7 @@ class IPOPTLIB_EXPORT SumSymMatrixSpace: public SymMatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the dimension of the matrix and the number * of terms in the sum. */ @@ -145,16 +145,16 @@ class IPOPTLIB_EXPORT SumSymMatrixSpace: public SymMatrixSpace /** Destructor */ ~SumSymMatrixSpace() { } - //@} + ///@} /** @name Accessor functions */ - //@{ + ///@{ /** Number of terms in the sum. */ Index NTerms() const { return nterms_; } - //@} + ///@} /** Use this method to set the matrix spaces for the various terms. * diff --git a/src/LinAlg/IpSymMatrix.hpp b/src/LinAlg/IpSymMatrix.hpp index a6ea77061..294b6c1db 100644 --- a/src/LinAlg/IpSymMatrix.hpp +++ b/src/LinAlg/IpSymMatrix.hpp @@ -21,7 +21,7 @@ class IPOPTLIB_EXPORT SymMatrix: public Matrix { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ inline SymMatrix( @@ -31,19 +31,19 @@ class IPOPTLIB_EXPORT SymMatrix: public Matrix /** Destructor */ virtual ~SymMatrix() { } - //@} + ///@} /** @name Information about the size of the matrix */ - //@{ + ///@{ /** Dimension of the matrix (number of rows and columns) */ inline Index Dim() const; - //@} + ///@} inline SmartPtr OwnerSymMatrixSpace() const; protected: /** @name Overloaded methods from Matrix. */ - //@{ + ///@{ /** Implementation of TransMultVectorImpl, which calls MultVectorImpl. * * Since the matrix is symmetric, it is only necessary to implement the @@ -72,7 +72,7 @@ class IPOPTLIB_EXPORT SymMatrix: public Matrix { ComputeRowAMaxImpl(cols_norms, init); } - //@} + ///@} private: /** Copy of the owner space ptr as a SymMatrixSpace instead @@ -86,7 +86,7 @@ class IPOPTLIB_EXPORT SymMatrixSpace: public MatrixSpace { public: /** @name Constructors/Destructors */ - //@{ + ///@{ /** Constructor, given the dimension (identical to the number of * rows and columns). */ @@ -99,7 +99,7 @@ class IPOPTLIB_EXPORT SymMatrixSpace: public MatrixSpace /** Destructor */ virtual ~SymMatrixSpace() { } - //@} + ///@} /** Pure virtual method for creating a new matrix of this specific type. */ virtual SymMatrix* MakeNewSymMatrix() const = 0; @@ -127,7 +127,7 @@ class IPOPTLIB_EXPORT SymMatrixSpace: public MatrixSpace * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor */ SymMatrixSpace(); @@ -140,7 +140,7 @@ class IPOPTLIB_EXPORT SymMatrixSpace: public MatrixSpace SymMatrixSpace& operator=( const SymMatrixSpace& ); - //@} + ///@} }; diff --git a/src/LinAlg/IpSymScaledMatrix.cpp b/src/LinAlg/IpSymScaledMatrix.cpp index ac9bbd6e6..6f967612a 100644 --- a/src/LinAlg/IpSymScaledMatrix.cpp +++ b/src/LinAlg/IpSymScaledMatrix.cpp @@ -82,7 +82,7 @@ void SymScaledMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sSymScaledMatrix \"%s\" of dimension %d x %d:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); + "%sSymScaledMatrix \"%s\" of dimension %" IPOPT_INDEX_FORMAT " x %" IPOPT_INDEX_FORMAT ":\n", prefix.c_str(), name.c_str(), NRows(), NCols()); owner_space_->RowColScaling()->Print(&jnlst, level, category, name + "_row_col_scaling", indent + 1, prefix); if( IsValid(matrix_) ) { diff --git a/src/LinAlg/IpSymScaledMatrix.hpp b/src/LinAlg/IpSymScaledMatrix.hpp index 2af4da7dd..c63c14b26 100644 --- a/src/LinAlg/IpSymScaledMatrix.hpp +++ b/src/LinAlg/IpSymScaledMatrix.hpp @@ -27,7 +27,7 @@ class IPOPTLIB_EXPORT SymScaledMatrix: public SymMatrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ SymScaledMatrix( @@ -36,7 +36,7 @@ class IPOPTLIB_EXPORT SymScaledMatrix: public SymMatrix /** Destructor */ ~SymScaledMatrix(); - //@} + ///@} /** Set the unscaled matrix */ void SetUnscaledMatrix( @@ -59,7 +59,7 @@ class IPOPTLIB_EXPORT SymScaledMatrix: public SymMatrix protected: /**@name Methods overloaded from Matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -82,7 +82,7 @@ class IPOPTLIB_EXPORT SymScaledMatrix: public SymMatrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -93,7 +93,7 @@ class IPOPTLIB_EXPORT SymScaledMatrix: public SymMatrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ SymScaledMatrix(); @@ -106,7 +106,7 @@ class IPOPTLIB_EXPORT SymScaledMatrix: public SymMatrix void operator=( const SymScaledMatrix& ); - //@} + ///@} /** const version of the unscaled matrix */ SmartPtr matrix_; @@ -124,7 +124,7 @@ class IPOPTLIB_EXPORT SymScaledMatrixSpace: public SymMatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of row and columns blocks, as * well as the total number of rows and columns. */ @@ -134,9 +134,9 @@ class IPOPTLIB_EXPORT SymScaledMatrixSpace: public SymMatrixSpace const SmartPtr& unscaled_matrix_space ) : SymMatrixSpace(unscaled_matrix_space->Dim()), + scaling_(row_col_scaling->MakeNewCopy()), unscaled_matrix_space_(unscaled_matrix_space) { - scaling_ = row_col_scaling->MakeNewCopy(); if( row_col_scaling_reciprocal ) { scaling_->ElementWiseReciprocal(); @@ -146,7 +146,7 @@ class IPOPTLIB_EXPORT SymScaledMatrixSpace: public SymMatrixSpace /** Destructor */ ~SymScaledMatrixSpace() { } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ SymScaledMatrix* MakeNewSymScaledMatrix( @@ -193,7 +193,7 @@ class IPOPTLIB_EXPORT SymScaledMatrixSpace: public SymMatrixSpace * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor */ SymScaledMatrixSpace(); @@ -206,7 +206,7 @@ class IPOPTLIB_EXPORT SymScaledMatrixSpace: public SymMatrixSpace SymScaledMatrixSpace& operator=( const SymScaledMatrixSpace& ); - //@} + ///@} /** Row scaling vector */ SmartPtr scaling_; diff --git a/src/LinAlg/IpTransposeMatrix.cpp b/src/LinAlg/IpTransposeMatrix.cpp index d12d311a5..89dc1e9ad 100644 --- a/src/LinAlg/IpTransposeMatrix.cpp +++ b/src/LinAlg/IpTransposeMatrix.cpp @@ -12,10 +12,9 @@ namespace Ipopt TransposeMatrix::TransposeMatrix( const TransposeMatrixSpace* owner_space ) - : Matrix(owner_space) -{ - orig_matrix_ = owner_space->MakeNewOrigMatrix(); -} + : Matrix(owner_space), + orig_matrix_(owner_space->MakeNewOrigMatrix()) +{ } void TransposeMatrix::PrintImpl( const Journalist& jnlst, diff --git a/src/LinAlg/IpTransposeMatrix.hpp b/src/LinAlg/IpTransposeMatrix.hpp index 635fee678..b2efaed72 100644 --- a/src/LinAlg/IpTransposeMatrix.hpp +++ b/src/LinAlg/IpTransposeMatrix.hpp @@ -20,7 +20,7 @@ class TransposeMatrix: public Matrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, initializing with dimensions of the matrix. */ TransposeMatrix( const TransposeMatrixSpace* owner_space @@ -34,11 +34,11 @@ class TransposeMatrix: public Matrix { return ConstPtr(orig_matrix_); } - //@} + ///@} protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -93,7 +93,7 @@ class TransposeMatrix: public Matrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -104,7 +104,7 @@ class TransposeMatrix: public Matrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ TransposeMatrix(); @@ -117,7 +117,7 @@ class TransposeMatrix: public Matrix void operator=( const TransposeMatrix& ); - //@} + ///@} /** Pointer to original matrix */ SmartPtr orig_matrix_; @@ -128,7 +128,7 @@ class TransposeMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the dimension of the matrix. */ TransposeMatrixSpace( const MatrixSpace* orig_matrix_space @@ -140,7 +140,7 @@ class TransposeMatrixSpace: public MatrixSpace /** Destructor */ virtual ~TransposeMatrixSpace() { } - //@} + ///@} virtual Matrix* MakeNew() const { @@ -167,7 +167,7 @@ class TransposeMatrixSpace: public MatrixSpace * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ TransposeMatrixSpace(); @@ -180,7 +180,7 @@ class TransposeMatrixSpace: public MatrixSpace void operator=( const TransposeMatrixSpace& ); - //@} + ///@} /** Matrix space of the original matrix */ SmartPtr orig_matrix_space_; diff --git a/src/LinAlg/IpVector.cpp b/src/LinAlg/IpVector.cpp index ea4b72932..6bf334ba3 100644 --- a/src/LinAlg/IpVector.cpp +++ b/src/LinAlg/IpVector.cpp @@ -131,7 +131,7 @@ Number Vector::FracToBoundImpl( Number alpha = inv_alpha_bar->Max(); if( alpha > 0 ) { - alpha = Ipopt::Min(1.0 / alpha, 1.0); + alpha = Ipopt::Min(Number(1.0) / alpha, Number(1.0)); } else { @@ -155,17 +155,17 @@ void Vector::Scal( if( old_tag == nrm2_cache_tag_ ) { nrm2_cache_tag_ = GetTag(); - cached_nrm2_ *= fabs(alpha); + cached_nrm2_ *= std::abs(alpha); } if( old_tag == asum_cache_tag_ ) { asum_cache_tag_ = GetTag(); - cached_asum_ *= fabs(alpha); + cached_asum_ *= std::abs(alpha); } if( old_tag == amax_cache_tag_ ) { amax_cache_tag_ = GetTag(); - cached_amax_ *= fabs(alpha); + cached_amax_ *= std::abs(alpha); } if( old_tag == max_cache_tag_ ) { @@ -174,7 +174,7 @@ void Vector::Scal( max_cache_tag_ = GetTag(); cached_max_ *= alpha; } - else if( alpha < 0. ) + else // alpha < 0. { min_cache_tag_ = GetTag(); cached_min_ = cached_max_ * alpha; @@ -187,7 +187,7 @@ void Vector::Scal( min_cache_tag_ = GetTag(); cached_min_ *= alpha; } - else if( alpha < 0. ) + else // alpha < 0. { max_cache_tag_ = GetTag(); cached_max_ = cached_min_ * alpha; @@ -201,7 +201,10 @@ void Vector::Scal( if( old_tag == sumlogs_cache_tag_ ) { sumlogs_cache_tag_ = GetTag(); - cached_sumlogs_ += ((Number) Dim()) * log(alpha); + if( Dim() > 0 ) + { + cached_sumlogs_ += ((Number) Dim()) * std::log(alpha); + } } } } diff --git a/src/LinAlg/IpVector.hpp b/src/LinAlg/IpVector.hpp index baf1105eb..67aab420c 100644 --- a/src/LinAlg/IpVector.hpp +++ b/src/LinAlg/IpVector.hpp @@ -48,7 +48,7 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject { public: /** @name Constructor/Destructor */ - //@{ + ///@{ /** Constructor. * * It has to be given a pointer to the corresponding VectorSpace. @@ -59,7 +59,7 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject /** Destructor */ inline virtual ~Vector(); - //@} + ///@} /** Create new Vector of the same type with uninitialized data */ inline Vector* MakeNew() const; @@ -72,7 +72,7 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject * methods, instead, overload the * protected versions of these methods). */ - //@{ + ///@{ /** Copy the data of the vector x into this vector (DCOPY). */ inline void Copy( const Vector& x @@ -102,14 +102,14 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject /** Computes the max-norm of this vector (based on IDAMAX) */ inline Number Amax() const; - //@} + ///@} /** @name Additional (Non-BLAS) Vector Methods * (derived classes do NOT overload these * methods, instead, overload the * protected versions of these methods). */ - //@{ + ///@{ /** Set each element in the vector to the scalar alpha. */ inline void Set( Number alpha @@ -125,6 +125,15 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject const Vector& x ); + /** Element-wise selection \f$y_i \gets sgn(y_i)x_i, if y_i != 0, else 0\f$ + * + * So like ElementWiseSgn().ElementWiseMultiply(x), but with 0*inf = 0. + * @since 3.14.0 + */ + inline void ElementWiseSelect( + const Vector& x + ); + /** Element-wise max against entries in x */ inline void ElementWiseMax( const Vector& x @@ -165,14 +174,14 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject /** Returns the sum of the logs of each vector entry */ inline Number SumLogs() const; - //@} + ///@} /** @name Methods for specialized operations. * * A prototype implementation is provided, but for efficient * implementation those should be specially implemented. */ - //@{ + ///@{ /** Add one vector, y = a * v1 + c * y. * * This is automatically reduced to call AddTwoVectors. @@ -211,26 +220,26 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject const Vector& s, Number c ); - //@} + ///@} /** Method for determining if all stored numbers are valid (i.e., no Inf or Nan). */ inline bool HasValidNumbers() const; /** @name Accessor methods */ - //@{ + ///@{ /** Dimension of the Vector */ inline Index Dim() const; /** Return the owner VectorSpace*/ inline SmartPtr OwnerSpace() const; - //@} + ///@} /** @name Output methods * (derived classes do NOT overload these * methods, instead, overload the * protected versions of these methods). */ - //@{ + ///@{ /** Print the entire vector */ void Print( SmartPtr jnlst, @@ -249,13 +258,13 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject Index indent = 0, const std::string& prefix = "" ) const; - //@} + ///@} protected: /** @name implementation methods (derived classes MUST * overload these pure virtual protected methods.) */ - //@{ + ///@{ /** Copy the data of the vector x into this vector (DCOPY). */ virtual void CopyImpl( const Vector& x @@ -301,6 +310,11 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject const Vector& x ) = 0; + /** Element-wise selection \f$y_i \gets sgn(y_i)x_i, if y_i != 0, else 0\f$ */ + virtual void ElementWiseSelectImpl( + const Vector& x + ) = 0; + /** Element-wise max against entries in x */ virtual void ElementWiseMaxImpl( const Vector& x @@ -380,7 +394,7 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject Index indent, const std::string& prefix ) const = 0; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -391,7 +405,7 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor */ Vector(); @@ -404,13 +418,13 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject Vector& operator=( const Vector& ); - //@} + ///@} /** Vector Space */ const SmartPtr owner_space_; /**@name CachedResults data members */ - //@{ + ///@{ /** Cache for dot products */ mutable CachedResults dot_cache_; @@ -442,7 +456,7 @@ class IPOPTLIB_EXPORT Vector: public TaggedObject // quality function search // /** Cache for FracToBound */ // mutable CachedResults frac_to_bound_cache_; - //@} + ///@} }; @@ -459,7 +473,7 @@ class IPOPTLIB_EXPORT VectorSpace: public ReferencedObject { public: /** @name Constructors/Destructors */ - //@{ + ///@{ /** Constructor, given the dimension of all vectors generated by * this VectorSpace. */ @@ -470,7 +484,7 @@ class IPOPTLIB_EXPORT VectorSpace: public ReferencedObject /** Destructor */ virtual ~VectorSpace() { } - //@} + ///@} /** Pure virtual method for creating a new Vector of the * corresponding type. @@ -492,7 +506,7 @@ class IPOPTLIB_EXPORT VectorSpace: public ReferencedObject * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default constructor */ VectorSpace(); @@ -505,7 +519,7 @@ class IPOPTLIB_EXPORT VectorSpace: public ReferencedObject VectorSpace& operator=( const VectorSpace& ); - //@} + ///@} /** Dimension of the vectors in this vector space. */ const Index dim_; @@ -704,6 +718,14 @@ inline void Vector::ElementWiseMultiply( ObjectChanged(); } +inline void Vector::ElementWiseSelect( + const Vector& x +) +{ + ElementWiseSelectImpl(x); + ObjectChanged(); +} + inline void Vector::ElementWiseReciprocal() { ElementWiseReciprocalImpl(); diff --git a/src/LinAlg/IpZeroMatrix.cpp b/src/LinAlg/IpZeroMatrix.cpp index ec9585102..eda94e5a5 100644 --- a/src/LinAlg/IpZeroMatrix.cpp +++ b/src/LinAlg/IpZeroMatrix.cpp @@ -76,7 +76,7 @@ void ZeroMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sZeroMatrix \"%s\" with %d row and %d column components:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); + "%sZeroMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " row and %" IPOPT_INDEX_FORMAT " column components:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); } } // namespace Ipopt diff --git a/src/LinAlg/IpZeroMatrix.hpp b/src/LinAlg/IpZeroMatrix.hpp index 7d2f70394..48e9b727e 100644 --- a/src/LinAlg/IpZeroMatrix.hpp +++ b/src/LinAlg/IpZeroMatrix.hpp @@ -19,7 +19,7 @@ class ZeroMatrix: public Matrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the corresponding matrix space. */ ZeroMatrix( const MatrixSpace* owner_space @@ -27,11 +27,11 @@ class ZeroMatrix: public Matrix /** Destructor */ ~ZeroMatrix(); - //@} + ///@} protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -66,7 +66,7 @@ class ZeroMatrix: public Matrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -77,7 +77,7 @@ class ZeroMatrix: public Matrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ ZeroMatrix(); @@ -90,7 +90,7 @@ class ZeroMatrix: public Matrix void operator=( const ZeroMatrix& ); - //@} + ///@} }; /** Class for matrix space for ZeroMatrix. */ @@ -98,7 +98,7 @@ class ZeroMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of row and columns. */ ZeroMatrixSpace( Index nrows, @@ -110,7 +110,7 @@ class ZeroMatrixSpace: public MatrixSpace /** Destructor */ virtual ~ZeroMatrixSpace() { } - //@} + ///@} virtual Matrix* MakeNew() const { @@ -132,7 +132,7 @@ class ZeroMatrixSpace: public MatrixSpace * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ ZeroMatrixSpace(); @@ -145,7 +145,7 @@ class ZeroMatrixSpace: public MatrixSpace void operator=( const ZeroMatrixSpace& ); - //@} + ///@} }; } // namespace Ipopt #endif diff --git a/src/LinAlg/IpZeroSymMatrix.cpp b/src/LinAlg/IpZeroSymMatrix.cpp index 3afd5be4a..576bb7460 100644 --- a/src/LinAlg/IpZeroSymMatrix.cpp +++ b/src/LinAlg/IpZeroSymMatrix.cpp @@ -76,7 +76,7 @@ void ZeroSymMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sZeroSymMatrix \"%s\" with %d row and %d column components:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); + "%sZeroSymMatrix \"%s\" with %" IPOPT_INDEX_FORMAT " row and %" IPOPT_INDEX_FORMAT " column components:\n", prefix.c_str(), name.c_str(), NRows(), NCols()); } } // namespace Ipopt diff --git a/src/LinAlg/IpZeroSymMatrix.hpp b/src/LinAlg/IpZeroSymMatrix.hpp index 2cd706774..4d1e67f00 100644 --- a/src/LinAlg/IpZeroSymMatrix.hpp +++ b/src/LinAlg/IpZeroSymMatrix.hpp @@ -18,7 +18,7 @@ class IPOPTLIB_EXPORT ZeroSymMatrix: public SymMatrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the corresponding matrix space. */ ZeroSymMatrix( const SymMatrixSpace* owner_space @@ -26,11 +26,11 @@ class IPOPTLIB_EXPORT ZeroSymMatrix: public SymMatrix /** Destructor */ ~ZeroSymMatrix(); - //@} + ///@} protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -65,7 +65,7 @@ class IPOPTLIB_EXPORT ZeroSymMatrix: public SymMatrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -76,7 +76,7 @@ class IPOPTLIB_EXPORT ZeroSymMatrix: public SymMatrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ ZeroSymMatrix(); @@ -89,7 +89,7 @@ class IPOPTLIB_EXPORT ZeroSymMatrix: public SymMatrix void operator=( const ZeroSymMatrix& ); - //@} + ///@} }; /** Class for matrix space for ZeroSymMatrix. */ @@ -97,7 +97,7 @@ class IPOPTLIB_EXPORT ZeroSymMatrixSpace: public SymMatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of row and columns. */ ZeroSymMatrixSpace( Index dim @@ -108,7 +108,7 @@ class IPOPTLIB_EXPORT ZeroSymMatrixSpace: public SymMatrixSpace /** Destructor */ virtual ~ZeroSymMatrixSpace() { } - //@} + ///@} virtual Matrix* MakeNew() const { @@ -135,7 +135,7 @@ class IPOPTLIB_EXPORT ZeroSymMatrixSpace: public SymMatrixSpace * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ ZeroSymMatrixSpace(); @@ -148,7 +148,7 @@ class IPOPTLIB_EXPORT ZeroSymMatrixSpace: public SymMatrixSpace void operator=( const ZeroSymMatrixSpace& ); - //@} + ///@} }; } // namespace Ipopt diff --git a/src/LinAlg/Makefile.am b/src/LinAlg/Makefile.am deleted file mode 100644 index 901b57a44..000000000 --- a/src/LinAlg/Makefile.am +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (C) 2004, 2010 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -SUBDIRS = TMatrices - -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpBlas.hpp \ - IpCompoundMatrix.hpp \ - IpCompoundSymMatrix.hpp \ - IpCompoundVector.hpp \ - IpDenseVector.hpp \ - IpDiagMatrix.hpp \ - IpExpansionMatrix.hpp \ - IpIdentityMatrix.hpp \ - IpLapack.hpp \ - IpMatrix.hpp \ - IpScaledMatrix.hpp \ - IpSumSymMatrix.hpp \ - IpSymMatrix.hpp \ - IpSymScaledMatrix.hpp \ - IpVector.hpp \ - IpZeroSymMatrix.hpp - -noinst_LTLIBRARIES = liblinalg.la - -liblinalg_la_SOURCES = \ - IpBlas.cpp \ - IpCompoundMatrix.cpp \ - IpCompoundSymMatrix.cpp \ - IpCompoundVector.cpp \ - IpDenseGenMatrix.cpp \ - IpDenseSymMatrix.cpp \ - IpDenseVector.cpp \ - IpDiagMatrix.cpp \ - IpExpandedMultiVectorMatrix.cpp \ - IpExpansionMatrix.cpp \ - IpIdentityMatrix.cpp \ - IpLapack.cpp \ - IpLowRankUpdateSymMatrix.cpp \ - IpMatrix.cpp \ - IpMultiVectorMatrix.cpp \ - IpScaledMatrix.cpp \ - IpSumMatrix.cpp \ - IpSumSymMatrix.cpp \ - IpSymScaledMatrix.cpp \ - IpTransposeMatrix.cpp \ - IpVector.cpp \ - IpZeroMatrix.cpp \ - IpZeroSymMatrix.cpp - -#liblinalg_la_LDFLAGS = $(LT_LDFLAGS) - -AM_CPPFLAGS = \ - -I$(srcdir)/../Common \ - $(IPOPTLIB_CFLAGS) diff --git a/src/LinAlg/Makefile.in b/src/LinAlg/Makefile.in deleted file mode 100644 index 22c24a98b..000000000 --- a/src/LinAlg/Makefile.in +++ /dev/null @@ -1,877 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2004, 2010 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - - -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/LinAlg -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -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 -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -liblinalg_la_LIBADD = -am_liblinalg_la_OBJECTS = IpBlas.lo IpCompoundMatrix.lo \ - IpCompoundSymMatrix.lo IpCompoundVector.lo IpDenseGenMatrix.lo \ - IpDenseSymMatrix.lo IpDenseVector.lo IpDiagMatrix.lo \ - IpExpandedMultiVectorMatrix.lo IpExpansionMatrix.lo \ - IpIdentityMatrix.lo IpLapack.lo IpLowRankUpdateSymMatrix.lo \ - IpMatrix.lo IpMultiVectorMatrix.lo IpScaledMatrix.lo \ - IpSumMatrix.lo IpSumSymMatrix.lo IpSymScaledMatrix.lo \ - IpTransposeMatrix.lo IpVector.lo IpZeroMatrix.lo \ - IpZeroSymMatrix.lo -liblinalg_la_OBJECTS = $(am_liblinalg_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 = -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)/IpBlas.Plo \ - ./$(DEPDIR)/IpCompoundMatrix.Plo \ - ./$(DEPDIR)/IpCompoundSymMatrix.Plo \ - ./$(DEPDIR)/IpCompoundVector.Plo \ - ./$(DEPDIR)/IpDenseGenMatrix.Plo \ - ./$(DEPDIR)/IpDenseSymMatrix.Plo ./$(DEPDIR)/IpDenseVector.Plo \ - ./$(DEPDIR)/IpDiagMatrix.Plo \ - ./$(DEPDIR)/IpExpandedMultiVectorMatrix.Plo \ - ./$(DEPDIR)/IpExpansionMatrix.Plo \ - ./$(DEPDIR)/IpIdentityMatrix.Plo ./$(DEPDIR)/IpLapack.Plo \ - ./$(DEPDIR)/IpLowRankUpdateSymMatrix.Plo \ - ./$(DEPDIR)/IpMatrix.Plo ./$(DEPDIR)/IpMultiVectorMatrix.Plo \ - ./$(DEPDIR)/IpScaledMatrix.Plo ./$(DEPDIR)/IpSumMatrix.Plo \ - ./$(DEPDIR)/IpSumSymMatrix.Plo \ - ./$(DEPDIR)/IpSymScaledMatrix.Plo \ - ./$(DEPDIR)/IpTransposeMatrix.Plo ./$(DEPDIR)/IpVector.Plo \ - ./$(DEPDIR)/IpZeroMatrix.Plo ./$(DEPDIR)/IpZeroSymMatrix.Plo -am__mv = mv -f -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) \ - $(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) \ - $(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 = -SOURCES = $(liblinalg_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -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__installdirs = "$(DESTDIR)$(includeipoptdir)" -HEADERS = $(includeipopt_HEADERS) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS -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 -DIST_SUBDIRS = $(SUBDIRS) -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = TMatrices -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpBlas.hpp \ - IpCompoundMatrix.hpp \ - IpCompoundSymMatrix.hpp \ - IpCompoundVector.hpp \ - IpDenseVector.hpp \ - IpDiagMatrix.hpp \ - IpExpansionMatrix.hpp \ - IpIdentityMatrix.hpp \ - IpLapack.hpp \ - IpMatrix.hpp \ - IpScaledMatrix.hpp \ - IpSumSymMatrix.hpp \ - IpSymMatrix.hpp \ - IpSymScaledMatrix.hpp \ - IpVector.hpp \ - IpZeroSymMatrix.hpp - -noinst_LTLIBRARIES = liblinalg.la -liblinalg_la_SOURCES = \ - IpBlas.cpp \ - IpCompoundMatrix.cpp \ - IpCompoundSymMatrix.cpp \ - IpCompoundVector.cpp \ - IpDenseGenMatrix.cpp \ - IpDenseSymMatrix.cpp \ - IpDenseVector.cpp \ - IpDiagMatrix.cpp \ - IpExpandedMultiVectorMatrix.cpp \ - IpExpansionMatrix.cpp \ - IpIdentityMatrix.cpp \ - IpLapack.cpp \ - IpLowRankUpdateSymMatrix.cpp \ - IpMatrix.cpp \ - IpMultiVectorMatrix.cpp \ - IpScaledMatrix.cpp \ - IpSumMatrix.cpp \ - IpSumSymMatrix.cpp \ - IpSymScaledMatrix.cpp \ - IpTransposeMatrix.cpp \ - IpVector.cpp \ - IpZeroMatrix.cpp \ - IpZeroSymMatrix.cpp - - -#liblinalg_la_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir)/../Common \ - $(IPOPTLIB_CFLAGS) - -all: all-recursive - -.SUFFIXES: -.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 ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/LinAlg/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/LinAlg/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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}; \ - } - -liblinalg.la: $(liblinalg_la_OBJECTS) $(liblinalg_la_DEPENDENCIES) $(EXTRA_liblinalg_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(liblinalg_la_OBJECTS) $(liblinalg_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpBlas.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpCompoundMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpCompoundSymMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpCompoundVector.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpDenseGenMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpDenseSymMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpDenseVector.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpDiagMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpExpandedMultiVectorMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpExpansionMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpIdentityMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpLapack.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpLowRankUpdateSymMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpMultiVectorMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpScaledMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpSumMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpSumSymMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpSymScaledMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTransposeMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpVector.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpZeroMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpZeroSymMatrix.Plo@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@ $(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@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -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 \ - 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 $$?; \ - 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) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -ctags: ctags-recursive - -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) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -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 -check-am: all-am -check: check-recursive -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(includeipoptdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -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 -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-recursive - -rm -f ./$(DEPDIR)/IpBlas.Plo - -rm -f ./$(DEPDIR)/IpCompoundMatrix.Plo - -rm -f ./$(DEPDIR)/IpCompoundSymMatrix.Plo - -rm -f ./$(DEPDIR)/IpCompoundVector.Plo - -rm -f ./$(DEPDIR)/IpDenseGenMatrix.Plo - -rm -f ./$(DEPDIR)/IpDenseSymMatrix.Plo - -rm -f ./$(DEPDIR)/IpDenseVector.Plo - -rm -f ./$(DEPDIR)/IpDiagMatrix.Plo - -rm -f ./$(DEPDIR)/IpExpandedMultiVectorMatrix.Plo - -rm -f ./$(DEPDIR)/IpExpansionMatrix.Plo - -rm -f ./$(DEPDIR)/IpIdentityMatrix.Plo - -rm -f ./$(DEPDIR)/IpLapack.Plo - -rm -f ./$(DEPDIR)/IpLowRankUpdateSymMatrix.Plo - -rm -f ./$(DEPDIR)/IpMatrix.Plo - -rm -f ./$(DEPDIR)/IpMultiVectorMatrix.Plo - -rm -f ./$(DEPDIR)/IpScaledMatrix.Plo - -rm -f ./$(DEPDIR)/IpSumMatrix.Plo - -rm -f ./$(DEPDIR)/IpSumSymMatrix.Plo - -rm -f ./$(DEPDIR)/IpSymScaledMatrix.Plo - -rm -f ./$(DEPDIR)/IpTransposeMatrix.Plo - -rm -f ./$(DEPDIR)/IpVector.Plo - -rm -f ./$(DEPDIR)/IpZeroMatrix.Plo - -rm -f ./$(DEPDIR)/IpZeroSymMatrix.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: install-includeipoptHEADERS - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f ./$(DEPDIR)/IpBlas.Plo - -rm -f ./$(DEPDIR)/IpCompoundMatrix.Plo - -rm -f ./$(DEPDIR)/IpCompoundSymMatrix.Plo - -rm -f ./$(DEPDIR)/IpCompoundVector.Plo - -rm -f ./$(DEPDIR)/IpDenseGenMatrix.Plo - -rm -f ./$(DEPDIR)/IpDenseSymMatrix.Plo - -rm -f ./$(DEPDIR)/IpDenseVector.Plo - -rm -f ./$(DEPDIR)/IpDiagMatrix.Plo - -rm -f ./$(DEPDIR)/IpExpandedMultiVectorMatrix.Plo - -rm -f ./$(DEPDIR)/IpExpansionMatrix.Plo - -rm -f ./$(DEPDIR)/IpIdentityMatrix.Plo - -rm -f ./$(DEPDIR)/IpLapack.Plo - -rm -f ./$(DEPDIR)/IpLowRankUpdateSymMatrix.Plo - -rm -f ./$(DEPDIR)/IpMatrix.Plo - -rm -f ./$(DEPDIR)/IpMultiVectorMatrix.Plo - -rm -f ./$(DEPDIR)/IpScaledMatrix.Plo - -rm -f ./$(DEPDIR)/IpSumMatrix.Plo - -rm -f ./$(DEPDIR)/IpSumSymMatrix.Plo - -rm -f ./$(DEPDIR)/IpSymScaledMatrix.Plo - -rm -f ./$(DEPDIR)/IpTransposeMatrix.Plo - -rm -f ./$(DEPDIR)/IpVector.Plo - -rm -f ./$(DEPDIR)/IpZeroMatrix.Plo - -rm -f ./$(DEPDIR)/IpZeroSymMatrix.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-includeipoptHEADERS - -.MAKE: $(am__recursive_targets) install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--depfiles check check-am clean clean-generic clean-libtool \ - clean-noinstLTLIBRARIES 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-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-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am 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-includeipoptHEADERS - -.PRECIOUS: Makefile - - -# 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/LinAlg/TMatrices/IpGenTMatrix.cpp b/src/LinAlg/TMatrices/IpGenTMatrix.cpp index d6f91cbba..bcfca90e0 100644 --- a/src/LinAlg/TMatrices/IpGenTMatrix.cpp +++ b/src/LinAlg/TMatrices/IpGenTMatrix.cpp @@ -38,7 +38,7 @@ void GenTMatrix::SetValues( const Number* Values ) { - IpBlasDcopy(Nonzeros(), Values, 1, values_, 1); + IpBlasCopy(Nonzeros(), Values, 1, values_, 1); initialized_ = true; ObjectChanged(); } @@ -65,6 +65,11 @@ void GenTMatrix::MultVectorImpl( y.Set(0.0); // In case y hasn't been initialized yet } + if( Nonzeros() == 0 ) + { + return; + } + // See if we can understand the data const DenseVector* dense_x = static_cast(&x); DBG_ASSERT(dynamic_cast(&x)); @@ -77,6 +82,8 @@ void GenTMatrix::MultVectorImpl( const Index* jcols = Jcols(); const Number* val = values_; Number* yvals = dense_y->Values(); + DBG_ASSERT(yvals != NULL); + yvals--; if( dense_x->IsHomogeneous() ) { @@ -125,6 +132,11 @@ void GenTMatrix::TransMultVectorImpl( y.Set(0.0); // In case y hasn't been initialized yet } + if( Nonzeros() == 0 ) + { + return; + } + // See if we can understand the data const DenseVector* dense_x = static_cast(&x); DBG_ASSERT(dynamic_cast(&x)); @@ -137,6 +149,7 @@ void GenTMatrix::TransMultVectorImpl( const Index* jcols = Jcols(); const Number* val = values_; Number* yvals = dense_y->Values(); + DBG_ASSERT(yvals != NULL); yvals--; if( dense_x->IsHomogeneous() ) @@ -167,7 +180,7 @@ void GenTMatrix::TransMultVectorImpl( bool GenTMatrix::HasValidNumbersImpl() const { DBG_ASSERT(initialized_); - Number sum = IpBlasDasum(Nonzeros(), values_, 1); + Number sum = IpBlasAsum(Nonzeros(), values_, 1); return IsFiniteNumber(sum); } @@ -178,17 +191,23 @@ void GenTMatrix::ComputeRowAMaxImpl( { DBG_ASSERT(initialized_); + if( NRows() == 0 ) + { + return; + } + DenseVector* dense_vec = static_cast(&rows_norms); DBG_ASSERT(dynamic_cast(&rows_norms)); const Index* irows = Irows(); const Number* val = values_; Number* vec_vals = dense_vec->Values(); - vec_vals--; + DBG_ASSERT(vec_vals != NULL); + vec_vals--; for( Index i = 0; i < Nonzeros(); i++ ) { - vec_vals[irows[i]] = Max(vec_vals[irows[i]], fabs(val[i])); + vec_vals[irows[i]] = Max(vec_vals[irows[i]], std::abs(val[i])); } } @@ -199,17 +218,23 @@ void GenTMatrix::ComputeColAMaxImpl( { DBG_ASSERT(initialized_); + if( NCols() == 0 ) + { + return; + } + DenseVector* dense_vec = static_cast(&cols_norms); DBG_ASSERT(dynamic_cast(&cols_norms)); const Index* jcols = Jcols(); const Number* val = values_; Number* vec_vals = dense_vec->Values(); - vec_vals--; + DBG_ASSERT(vec_vals != NULL); + vec_vals--; // to deal with 1-based indexing in jcols, I believe for( Index i = 0; i < Nonzeros(); i++ ) { - vec_vals[jcols[i]] = Max(vec_vals[jcols[i]], fabs(val[i])); + vec_vals[jcols[i]] = Max(vec_vals[jcols[i]], std::abs(val[i])); } } @@ -226,14 +251,14 @@ void GenTMatrix::PrintImplOffset( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sGenTMatrix \"%s\" of dimension %d by %d with %d nonzero elements:\n", prefix.c_str(), name.c_str(), NRows(), + "%sGenTMatrix \"%s\" of dimension %" IPOPT_INDEX_FORMAT " by %" IPOPT_INDEX_FORMAT " with %" IPOPT_INDEX_FORMAT " nonzero elements:\n", prefix.c_str(), name.c_str(), NRows(), NCols(), Nonzeros()); if( initialized_ ) { for( Index i = 0; i < Nonzeros(); i++ ) { jnlst.PrintfIndented(level, category, indent, - "%s%s[%5d,%5d]=%23.16e (%d)\n", prefix.c_str(), name.c_str(), Irows()[i] + offset, Jcols()[i], values_[i], i); + "%s%s[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "]=%23.16e (%" IPOPT_INDEX_FORMAT ")\n", prefix.c_str(), name.c_str(), Irows()[i] + offset, Jcols()[i], values_[i], i); } } else diff --git a/src/LinAlg/TMatrices/IpGenTMatrix.hpp b/src/LinAlg/TMatrices/IpGenTMatrix.hpp index fe2ff47be..5a04572bd 100644 --- a/src/LinAlg/TMatrices/IpGenTMatrix.hpp +++ b/src/LinAlg/TMatrices/IpGenTMatrix.hpp @@ -35,7 +35,7 @@ class IPOPTLIB_EXPORT GenTMatrix: public Matrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the owner_space. */ GenTMatrix( const GenTMatrixSpace* owner_space @@ -43,10 +43,10 @@ class IPOPTLIB_EXPORT GenTMatrix: public Matrix /** Destructor */ ~GenTMatrix(); - //@} + ///@} /**@name Changing the Values.*/ - //@{ + ///@{ /** Set values of nonzero elements. * * The values of the nonzero @@ -58,10 +58,10 @@ class IPOPTLIB_EXPORT GenTMatrix: public Matrix void SetValues( const Number* Values ); - //@} + ///@} /** @name Accessor Methods */ - //@{ + ///@{ /** Number of nonzero entries */ Index Nonzeros() const; @@ -88,11 +88,11 @@ class IPOPTLIB_EXPORT GenTMatrix: public Matrix initialized_ = true; return values_; } - //@} + ///@} protected: /**@name Overloaded methods from Matrix base class*/ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -130,7 +130,7 @@ class IPOPTLIB_EXPORT GenTMatrix: public Matrix { PrintImplOffset(jnlst, level, category, name, indent, prefix, 0); } - //@} + ///@} void PrintImplOffset( const Journalist& jnlst, @@ -153,7 +153,7 @@ class IPOPTLIB_EXPORT GenTMatrix: public Matrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ GenTMatrix(); @@ -166,7 +166,7 @@ class IPOPTLIB_EXPORT GenTMatrix: public Matrix void operator=( const GenTMatrix& ); - //@} + ///@} /** Copy of the owner space as a GenTMatrixSpace instead of * a MatrixSpace @@ -189,7 +189,7 @@ class IPOPTLIB_EXPORT GenTMatrixSpace: public MatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of rows and columns, as well as * the number of nonzeros and the position of the nonzero * elements. @@ -213,7 +213,7 @@ class IPOPTLIB_EXPORT GenTMatrixSpace: public MatrixSpace delete[] iRows_; delete[] jCols_; } - //@} + ///@} /** Method for creating a new matrix of this specific type. */ GenTMatrix* MakeNewGenTMatrix() const @@ -227,7 +227,7 @@ class IPOPTLIB_EXPORT GenTMatrixSpace: public MatrixSpace } /**@name Methods describing Matrix structure */ - //@{ + ///@{ /** Number of non-zeros in the sparse matrix */ Index Nonzeros() const { @@ -245,15 +245,15 @@ class IPOPTLIB_EXPORT GenTMatrixSpace: public MatrixSpace { return jCols_; } - //@} + ///@} private: /** @name Sparsity structure of matrices generated by this matrix space. */ - //@{ + ///@{ const Index nonZeros_; Index* jCols_; Index* iRows_; - //@} + ///@} /** This method is only for the GenTMatrix to call in order * to allocate internal storage diff --git a/src/LinAlg/TMatrices/IpSymTMatrix.cpp b/src/LinAlg/TMatrices/IpSymTMatrix.cpp index 829706898..e85681f35 100644 --- a/src/LinAlg/TMatrices/IpSymTMatrix.cpp +++ b/src/LinAlg/TMatrices/IpSymTMatrix.cpp @@ -38,7 +38,7 @@ void SymTMatrix::SetValues( const Number* Values ) { - IpBlasDcopy(Nonzeros(), Values, 1, values_, 1); + IpBlasCopy(Nonzeros(), Values, 1, values_, 1); initialized_ = true; ObjectChanged(); } @@ -134,8 +134,8 @@ const Number* SymTMatrix::Values() const } void SymTMatrix::FillStruct( - ipfint* Irn, - ipfint* Jcn + Index* Irn, + Index* Jcn ) const { DBG_ASSERT(initialized_); @@ -151,13 +151,13 @@ void SymTMatrix::FillValues( ) const { DBG_ASSERT(initialized_); - IpBlasDcopy(Nonzeros(), values_, 1, Values, 1); + IpBlasCopy(Nonzeros(), values_, 1, Values, 1); } bool SymTMatrix::HasValidNumbersImpl() const { DBG_ASSERT(initialized_); - Number sum = IpBlasDasum(Nonzeros(), values_, 1); + Number sum = IpBlasAsum(Nonzeros(), values_, 1); return IsFiniteNumber(sum); } @@ -168,6 +168,11 @@ void SymTMatrix::ComputeRowAMaxImpl( { DBG_ASSERT(initialized_); + if( NRows() == 0 ) + { + return; + } + DenseVector* dense_vec = static_cast(&rows_norms); DBG_ASSERT(dynamic_cast(&rows_norms)); @@ -175,14 +180,15 @@ void SymTMatrix::ComputeRowAMaxImpl( const Index* jcn = Jcols(); const Number* val = values_; Number* vec_vals = dense_vec->Values(); - vec_vals--; + DBG_ASSERT(vec_vals != NULL); const Number zero = 0.; - IpBlasDcopy(NRows(), &zero, 0, vec_vals, 1); + IpBlasCopy(NRows(), &zero, 0, vec_vals, 1); + vec_vals--; // to deal with 1-based indexing in irn and jcn (I believe) for( Index i = 0; i < Nonzeros(); i++ ) { - const double f = fabs(*val); + const Number f = std::abs(*val); vec_vals[*irn] = Max(vec_vals[*irn], f); vec_vals[*jcn] = Max(vec_vals[*jcn], f); val++; @@ -203,13 +209,13 @@ void SymTMatrix::PrintImpl( jnlst.Printf(level, category, "\n"); jnlst.PrintfIndented(level, category, indent, - "%sSymTMatrix \"%s\" of dimension %d with %d nonzero elements:\n", prefix.c_str(), name.c_str(), Dim(), Nonzeros()); + "%sSymTMatrix \"%s\" of dimension %" IPOPT_INDEX_FORMAT " with %" IPOPT_INDEX_FORMAT " nonzero elements:\n", prefix.c_str(), name.c_str(), Dim(), Nonzeros()); if( initialized_ ) { for( Index i = 0; i < Nonzeros(); i++ ) { jnlst.PrintfIndented(level, category, indent, - "%s%s[%5d,%5d]=%23.16e (%d)\n", prefix.c_str(), name.c_str(), Irows()[i], Jcols()[i], values_[i], i); + "%s%s[%5" IPOPT_INDEX_FORMAT ",%5" IPOPT_INDEX_FORMAT "]=%23.16e (%" IPOPT_INDEX_FORMAT ")\n", prefix.c_str(), name.c_str(), Irows()[i], Jcols()[i], values_[i], i); } } else diff --git a/src/LinAlg/TMatrices/IpSymTMatrix.hpp b/src/LinAlg/TMatrices/IpSymTMatrix.hpp index 9de7ec324..98e9330dc 100644 --- a/src/LinAlg/TMatrices/IpSymTMatrix.hpp +++ b/src/LinAlg/TMatrices/IpSymTMatrix.hpp @@ -40,7 +40,7 @@ class IPOPTLIB_EXPORT SymTMatrix: public SymMatrix { public: /**@name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, taking the corresponding matrix space. */ SymTMatrix( const SymTMatrixSpace* owner_space @@ -48,10 +48,10 @@ class IPOPTLIB_EXPORT SymTMatrix: public SymMatrix /** Destructor */ ~SymTMatrix(); - //@} + ///@} /**@name Changing the Values.*/ - //@{ + ///@{ /** Set values of nonzero elements. * * The values of the nonzero @@ -62,10 +62,10 @@ class IPOPTLIB_EXPORT SymTMatrix: public SymMatrix void SetValues( const Number* Values ); - //@} + ///@} /** @name Accessor Methods */ - //@{ + ///@{ /** Number of nonzero entries */ Index Nonzeros() const; @@ -96,25 +96,25 @@ class IPOPTLIB_EXPORT SymTMatrix: public SymMatrix * @attention This does not produce a copy, and lifetime is not guaranteed! */ const Number* Values() const; - //@} + ///@} /**@name Methods for providing copy of the matrix data */ - //@{ + ///@{ /** Copy the nonzero structure into provided space */ void FillStruct( - ipfint* Irn, - ipfint* Jcn + Index* Irn, + Index* Jcn ) const; /** Copy the value data into provided space */ void FillValues( Number* Values ) const; - //@} + ///@} protected: /**@name Methods overloaded from matrix */ - //@{ + ///@{ virtual void MultVectorImpl( Number alpha, const Vector& x, @@ -137,7 +137,7 @@ class IPOPTLIB_EXPORT SymTMatrix: public SymMatrix Index indent, const std::string& prefix ) const; - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -148,7 +148,7 @@ class IPOPTLIB_EXPORT SymTMatrix: public SymMatrix * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ SymTMatrix(); @@ -161,7 +161,7 @@ class IPOPTLIB_EXPORT SymTMatrix: public SymMatrix void operator=( const SymTMatrix& ); - //@} + ///@} /** Copy of the owner_space ptr as a SymTMatrixSpace instead * of a MatrixSpace @@ -184,7 +184,7 @@ class IPOPTLIB_EXPORT SymTMatrixSpace: public SymMatrixSpace { public: /** @name Constructors / Destructors */ - //@{ + ///@{ /** Constructor, given the number of rows and columns (both as * dim), as well as the number of nonzeros and the position of * the nonzero elements. Note that the counting of the nonzeros @@ -202,7 +202,7 @@ class IPOPTLIB_EXPORT SymTMatrixSpace: public SymMatrixSpace /** Destructor */ ~SymTMatrixSpace(); - //@} + ///@} virtual SymMatrix* MakeNewSymMatrix() const { @@ -216,7 +216,7 @@ class IPOPTLIB_EXPORT SymTMatrixSpace: public SymMatrixSpace } /**@name Methods describing Matrix structure */ - //@{ + ///@{ /** Number of non-zeros in the sparse matrix */ Index Nonzeros() const { @@ -234,11 +234,11 @@ class IPOPTLIB_EXPORT SymTMatrixSpace: public SymMatrixSpace { return jCols_; } - //@} + ///@} private: /**@name Methods called by SymTMatrix for memory management */ - //@{ + ///@{ /** Allocate internal storage for the SymTMatrix values */ Number* AllocateInternalStorage() const; @@ -246,7 +246,7 @@ class IPOPTLIB_EXPORT SymTMatrixSpace: public SymMatrixSpace void FreeInternalStorage( Number* values ) const; - //@} + ///@} const Index nonZeros_; Index* iRows_; diff --git a/src/LinAlg/TMatrices/IpTripletHelper.cpp b/src/LinAlg/TMatrices/IpTripletHelper.cpp index 8fc689681..3592d45f1 100644 --- a/src/LinAlg/TMatrices/IpTripletHelper.cpp +++ b/src/LinAlg/TMatrices/IpTripletHelper.cpp @@ -621,7 +621,7 @@ void TripletHelper::FillRowCol_( Index* jCol ) { - Index total_n_entries = 0; + DBG_DO(Index total_n_entries = 0); for( Index i = 0; i < matrix.NTerms(); i++ ) { // Fill the indices for the individual term @@ -629,7 +629,7 @@ void TripletHelper::FillRowCol_( SmartPtr retTerm; matrix.GetTerm(i, retFactor, retTerm); Index term_n_entries = GetNumberEntries(*retTerm); - total_n_entries += term_n_entries; + DBG_DO(total_n_entries += term_n_entries); FillRowCol(term_n_entries, *retTerm, iRow, jCol, row_offset, col_offset); // now shift the iRow, jCol pointers for the next term @@ -646,7 +646,7 @@ void TripletHelper::FillValues_( Number* values ) { - Index total_n_entries = 0; + DBG_DO(Index total_n_entries = 0); for( Index i = 0; i < matrix.NTerms(); i++ ) { // Fill the values for the individual term @@ -654,11 +654,11 @@ void TripletHelper::FillValues_( SmartPtr retTerm; matrix.GetTerm(i, retFactor, retTerm); Index term_n_entries = GetNumberEntries(*retTerm); - total_n_entries += term_n_entries; + DBG_DO(total_n_entries += term_n_entries); FillValues(term_n_entries, *retTerm, values); // Now adjust the values based on the factor - IpBlasDscal(term_n_entries, retFactor, values, 1); + IpBlasScal(term_n_entries, retFactor, values, 1); // now shift the values pointer for the next term values += term_n_entries; @@ -676,7 +676,7 @@ void TripletHelper::FillRowCol_( Index* jCol ) { - Index total_n_entries = 0; + DBG_DO(Index total_n_entries = 0); for( Index i = 0; i < matrix.NTerms(); i++ ) { // Fill the indices for the individual term @@ -684,7 +684,7 @@ void TripletHelper::FillRowCol_( SmartPtr retTerm; matrix.GetTerm(i, retFactor, retTerm); Index term_n_entries = GetNumberEntries(*retTerm); - total_n_entries += term_n_entries; + DBG_DO(total_n_entries += term_n_entries); FillRowCol(term_n_entries, *retTerm, iRow, jCol, row_offset, col_offset); // now shift the iRow, jCol pointers for the next term @@ -701,7 +701,7 @@ void TripletHelper::FillValues_( Number* values ) { - Index total_n_entries = 0; + DBG_DO(Index total_n_entries = 0); for( Index i = 0; i < matrix.NTerms(); i++ ) { // Fill the values for the individual term @@ -709,7 +709,7 @@ void TripletHelper::FillValues_( SmartPtr retTerm; matrix.GetTerm(i, retFactor, retTerm); Index term_n_entries = GetNumberEntries(*retTerm); - total_n_entries += term_n_entries; + DBG_DO(total_n_entries += term_n_entries); if( retFactor != 0.0 ) { FillValues(term_n_entries, *retTerm, values); @@ -717,13 +717,13 @@ void TripletHelper::FillValues_( if( retFactor != 1. ) { // Now adjust the values based on the factor - IpBlasDscal(term_n_entries, retFactor, values, 1); + IpBlasScal(term_n_entries, retFactor, values, 1); } } else { const Number zero = 0.; - IpBlasDcopy(term_n_entries, &zero, 0, values, 1); + IpBlasCopy(term_n_entries, &zero, 0, values, 1); } // now shift the values pointer for the next term @@ -742,7 +742,7 @@ void TripletHelper::FillRowCol_( Index* jCol ) { - Index total_n_entries = 0; + DBG_DO(Index total_n_entries = 0); const CompoundMatrixSpace* owner_space = static_cast(GetRawPtr(matrix.OwnerSpace())); DBG_ASSERT(dynamic_cast(GetRawPtr(matrix.OwnerSpace()))); @@ -758,7 +758,7 @@ void TripletHelper::FillRowCol_( if( IsValid(blk_mat) ) { Index blk_n_entries = GetNumberEntries(*blk_mat); - total_n_entries += blk_n_entries; + DBG_DO(total_n_entries += blk_n_entries); FillRowCol(blk_n_entries, *blk_mat, iRow, jCol, c_row_offset, c_col_offset); // now shift the iRow, jCol pointers for the next term @@ -779,7 +779,7 @@ void TripletHelper::FillValues_( Number* values ) { - Index total_n_entries = 0; + DBG_DO(Index total_n_entries = 0); for( Index i = 0; i < matrix.NComps_Rows(); i++ ) { @@ -790,7 +790,7 @@ void TripletHelper::FillValues_( if( IsValid(blk_mat) ) { Index blk_n_entries = GetNumberEntries(*blk_mat); - total_n_entries += blk_n_entries; + DBG_DO(total_n_entries += blk_n_entries); FillValues(blk_n_entries, *blk_mat, values); // now shift the values pointer for the next term @@ -811,7 +811,7 @@ void TripletHelper::FillRowCol_( Index* jCol ) { - Index total_n_entries = 0; + DBG_DO(Index total_n_entries = 0); const CompoundSymMatrixSpace* owner_space = static_cast(GetRawPtr(matrix.OwnerSpace())); @@ -828,7 +828,7 @@ void TripletHelper::FillRowCol_( if( IsValid(blk_mat) ) { Index blk_n_entries = GetNumberEntries(*blk_mat); - total_n_entries += blk_n_entries; + DBG_DO(total_n_entries += blk_n_entries); FillRowCol(blk_n_entries, *blk_mat, iRow, jCol, c_row_offset, c_col_offset); // now shift the iRow, jCol pointers for the next term @@ -849,7 +849,7 @@ void TripletHelper::FillValues_( Number* values ) { - Index total_n_entries = 0; + DBG_DO(Index total_n_entries = 0); for( Index i = 0; i < matrix.NComps_Dim(); i++ ) { @@ -860,7 +860,7 @@ void TripletHelper::FillValues_( if( IsValid(blk_mat) ) { Index blk_n_entries = GetNumberEntries(*blk_mat); - total_n_entries += blk_n_entries; + DBG_DO(total_n_entries += blk_n_entries); FillValues(blk_n_entries, *blk_mat, values); // now shift the iRow, jCol pointers for the next term @@ -885,12 +885,12 @@ void TripletHelper::FillValuesFromVector( if( dv->IsHomogeneous() ) { Number scalar = dv->Scalar(); - IpBlasDcopy(dim, &scalar, 0, values, 1); + IpBlasCopy(dim, &scalar, 0, values, 1); } else { const Number* dv_vals = dv->Values(); - IpBlasDcopy(dim, dv_vals, 1, values, 1); + IpBlasCopy(dim, dv_vals, 1, values, 1); } return; } @@ -899,14 +899,14 @@ void TripletHelper::FillValuesFromVector( if( cv ) { Index ncomps = cv->NComps(); - Index total_dim = 0; + DBG_DO(Index total_dim = 0); for( Index i = 0; i < ncomps; i++ ) { SmartPtr comp = cv->GetComp(i); Index comp_dim = comp->Dim(); FillValuesFromVector(comp_dim, *comp, values); values += comp_dim; - total_dim += comp_dim; + DBG_DO(total_dim += comp_dim); } DBG_ASSERT(total_dim == dim); return; @@ -1060,7 +1060,7 @@ void TripletHelper::FillRowCol_( { const Index* exppos = P->ExpandedPosIndices(); const Index nExp = P->NCols(); - DBG_ASSERT(n_entries = nRows * nExp); + DBG_ASSERT(n_entries == nRows * nExp); for( Index irow = row_offset; irow < row_offset + nRows; irow++ ) { for( Index j = 0; j < nExp; j++ ) @@ -1073,7 +1073,7 @@ void TripletHelper::FillRowCol_( else { const Index nCols = matrix.NCols(); - DBG_ASSERT(n_entries = nRows * nCols); + DBG_ASSERT(n_entries == nRows * nCols); (void) n_entries; for( Index irow = row_offset; irow < row_offset + nRows; irow++ ) { @@ -1097,7 +1097,7 @@ void TripletHelper::FillValues_( if( IsValid(P) ) { const Index nExp = P->NCols(); - double* vecvals = new double[nExp]; + Number* vecvals = new Number[nExp]; for( Index i = 0; i < nRows; i++ ) { SmartPtr vec = matrix.GetVector(i); @@ -1145,7 +1145,7 @@ void TripletHelper::FillValues_( void TripletHelper::PutValuesInVector( Index dim, - const double* values, + const Number* values, Vector& vector ) { @@ -1154,7 +1154,7 @@ void TripletHelper::PutValuesInVector( if( dv ) { Number* dv_vals = dv->Values(); - IpBlasDcopy(dim, values, 1, dv_vals, 1); + IpBlasCopy(dim, values, 1, dv_vals, 1); return; } @@ -1162,14 +1162,14 @@ void TripletHelper::PutValuesInVector( if( cv ) { Index ncomps = cv->NComps(); - Index total_dim = 0; + DBG_DO(Index total_dim = 0); for( Index i = 0; i < ncomps; i++ ) { SmartPtr comp = cv->GetCompNonConst(i); Index comp_dim = comp->Dim(); PutValuesInVector(comp_dim, values, *comp); values += comp_dim; - total_dim += comp_dim; + DBG_DO(total_dim += comp_dim); } DBG_ASSERT(total_dim == dim); return; diff --git a/src/LinAlg/TMatrices/IpTripletHelper.hpp b/src/LinAlg/TMatrices/IpTripletHelper.hpp index d11a436ce..9ea8a95f6 100644 --- a/src/LinAlg/TMatrices/IpTripletHelper.hpp +++ b/src/LinAlg/TMatrices/IpTripletHelper.hpp @@ -39,7 +39,7 @@ class IPOPTLIB_EXPORT TripletHelper { public: /**@name A set of recursive routines that help with the Triplet format. */ - //@{ + ///@{ /** find the total number of triplet entries of a Matrix */ static Index GetNumberEntries( const Matrix& matrix @@ -72,10 +72,10 @@ class IPOPTLIB_EXPORT TripletHelper /** put the values from the double* back into the vector */ static void PutValuesInVector( Index dim, - const double* values, + const Number* values, Vector& vector ); - //@} + ///@} private: /** find the total number of triplet entries for the SumMatrix */ diff --git a/src/LinAlg/TMatrices/Makefile.am b/src/LinAlg/TMatrices/Makefile.am deleted file mode 100644 index ef89b246c..000000000 --- a/src/LinAlg/TMatrices/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2004, 2006 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpGenTMatrix.hpp \ - IpSymTMatrix.hpp \ - IpTripletHelper.hpp -noinst_LTLIBRARIES = libtmatrices.la - -libtmatrices_la_SOURCES = \ - IpGenTMatrix.cpp \ - IpSymTMatrix.cpp \ - IpTripletHelper.cpp - -#libtmatrices_la_LDFLAGS = $(LT_LDFLAGS) - -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/.. \ - $(IPOPTLIB_CFLAGS) diff --git a/src/LinAlg/TMatrices/Makefile.in b/src/LinAlg/TMatrices/Makefile.in deleted file mode 100644 index 1b20848b5..000000000 --- a/src/LinAlg/TMatrices/Makefile.in +++ /dev/null @@ -1,697 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2004, 2006 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 - - -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/LinAlg/TMatrices -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -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 -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libtmatrices_la_LIBADD = -am_libtmatrices_la_OBJECTS = IpGenTMatrix.lo IpSymTMatrix.lo \ - IpTripletHelper.lo -libtmatrices_la_OBJECTS = $(am_libtmatrices_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 = -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)/IpGenTMatrix.Plo \ - ./$(DEPDIR)/IpSymTMatrix.Plo ./$(DEPDIR)/IpTripletHelper.Plo -am__mv = mv -f -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) \ - $(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) \ - $(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 = -SOURCES = $(libtmatrices_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -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__installdirs = "$(DESTDIR)$(includeipoptdir)" -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 -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = \ - IpGenTMatrix.hpp \ - IpSymTMatrix.hpp \ - IpTripletHelper.hpp - -noinst_LTLIBRARIES = libtmatrices.la -libtmatrices_la_SOURCES = \ - IpGenTMatrix.cpp \ - IpSymTMatrix.cpp \ - IpTripletHelper.cpp - - -#libtmatrices_la_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/.. \ - $(IPOPTLIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.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 ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/LinAlg/TMatrices/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/LinAlg/TMatrices/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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}; \ - } - -libtmatrices.la: $(libtmatrices_la_OBJECTS) $(libtmatrices_la_DEPENDENCIES) $(EXTRA_libtmatrices_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(libtmatrices_la_OBJECTS) $(libtmatrices_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpGenTMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpSymTMatrix.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTripletHelper.Plo@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@ $(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@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -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 \ - 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 $$?; \ - 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 - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -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) \ - $$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 - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(includeipoptdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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 -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/IpGenTMatrix.Plo - -rm -f ./$(DEPDIR)/IpSymTMatrix.Plo - -rm -f ./$(DEPDIR)/IpTripletHelper.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-includeipoptHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -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 -f ./$(DEPDIR)/IpGenTMatrix.Plo - -rm -f ./$(DEPDIR)/IpSymTMatrix.Plo - -rm -f ./$(DEPDIR)/IpTripletHelper.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-includeipoptHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES \ - 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-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-man install-pdf install-pdf-am 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-includeipoptHEADERS - -.PRECIOUS: Makefile - - -# 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/Makefile.am b/src/Makefile.am new file mode 100644 index 000000000..e7950dfc7 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,304 @@ +# Copyright (C) 2021 COIN-OR Foundation +# All Rights Reserved. +# This file is distributed under the Eclipse Public License. +# +# Authors: Stefan Vigerske + +includeipoptdir = $(includedir)/coin-or +includeipopt_HEADERS = \ + Common/IpCachedResults.hpp \ + Common/IpDebug.hpp \ + Common/IpException.hpp \ + Common/IpJournalist.hpp \ + Common/IpLibraryLoader.hpp \ + Common/IpObserver.hpp \ + Common/IpOptionsList.hpp \ + Common/IpReferenced.hpp \ + Common/IpRegOptions.hpp \ + Common/IpSmartPtr.hpp \ + Common/IpTaggedObject.hpp \ + Common/IpTimedTask.hpp \ + Common/IpTypes.hpp \ + Common/IpTypes.h \ + Common/IpUtils.hpp \ + LinAlg/IpBlas.hpp \ + LinAlg/IpCompoundMatrix.hpp \ + LinAlg/IpCompoundSymMatrix.hpp \ + LinAlg/IpCompoundVector.hpp \ + LinAlg/IpDenseVector.hpp \ + LinAlg/IpDiagMatrix.hpp \ + LinAlg/IpExpansionMatrix.hpp \ + LinAlg/IpIdentityMatrix.hpp \ + LinAlg/IpLapack.hpp \ + LinAlg/IpMatrix.hpp \ + LinAlg/IpScaledMatrix.hpp \ + LinAlg/IpSumSymMatrix.hpp \ + LinAlg/IpSymMatrix.hpp \ + LinAlg/IpSymScaledMatrix.hpp \ + LinAlg/IpVector.hpp \ + LinAlg/IpZeroSymMatrix.hpp \ + LinAlg/TMatrices/IpGenTMatrix.hpp \ + LinAlg/TMatrices/IpSymTMatrix.hpp \ + LinAlg/TMatrices/IpTripletHelper.hpp \ + Algorithm/IpAlgBuilder.hpp \ + Algorithm/IpAlgStrategy.hpp \ + Algorithm/IpAugSystemSolver.hpp \ + Algorithm/IpConvCheck.hpp \ + Algorithm/IpEqMultCalculator.hpp \ + Algorithm/IpHessianUpdater.hpp \ + Algorithm/IpIpoptAlg.hpp \ + Algorithm/IpIpoptCalculatedQuantities.hpp \ + Algorithm/IpIpoptData.hpp \ + Algorithm/IpIpoptNLP.hpp \ + Algorithm/IpIterateInitializer.hpp \ + Algorithm/IpIteratesVector.hpp \ + Algorithm/IpIterationOutput.hpp \ + Algorithm/IpOrigIpoptNLP.hpp \ + Algorithm/IpLineSearch.hpp \ + Algorithm/IpMuUpdate.hpp \ + Algorithm/IpNLPScaling.hpp \ + Algorithm/IpPDSystemSolver.hpp \ + Algorithm/IpSearchDirCalculator.hpp \ + Algorithm/IpStdAugSystemSolver.hpp \ + Algorithm/IpTimingStatistics.hpp \ + Algorithm/LinearSolvers/IpLinearSolvers.h \ + Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.hpp \ + Algorithm/LinearSolvers/IpSparseSymLinearSolverInterface.hpp \ + Algorithm/LinearSolvers/IpSymLinearSolver.hpp \ + Algorithm/LinearSolvers/IpTripletToCSRConverter.hpp \ + Algorithm/LinearSolvers/IpTSymLinearSolver.hpp \ + Algorithm/LinearSolvers/IpTSymScalingMethod.hpp \ + Interfaces/IpAlgTypes.hpp \ + Interfaces/IpIpoptApplication.hpp \ + Interfaces/IpNLP.hpp \ + Interfaces/IpReturnCodes.h \ + Interfaces/IpReturnCodes.hpp \ + Interfaces/IpReturnCodes_inc.h \ + Interfaces/IpReturnCodes.inc \ + Interfaces/IpSolveStatistics.hpp \ + Interfaces/IpStdCInterface.h \ + Interfaces/IpTNLP.hpp \ + Interfaces/IpTNLPAdapter.hpp \ + Interfaces/IpTNLPReducer.hpp + +lib_LTLIBRARIES = libipopt.la +libipopt_la_SOURCES = \ + Common/IpDebug.cpp \ + Common/IpJournalist.cpp \ + Common/IpObserver.cpp \ + Common/IpOptionsList.cpp \ + Common/IpRegOptions.cpp \ + Common/IpTaggedObject.cpp \ + Common/IpUtils.cpp \ + Common/IpLibraryLoader.cpp \ + LinAlg/IpBlas.cpp \ + LinAlg/IpCompoundMatrix.cpp \ + LinAlg/IpCompoundSymMatrix.cpp \ + LinAlg/IpCompoundVector.cpp \ + LinAlg/IpDenseGenMatrix.cpp \ + LinAlg/IpDenseSymMatrix.cpp \ + LinAlg/IpDenseVector.cpp \ + LinAlg/IpDiagMatrix.cpp \ + LinAlg/IpExpandedMultiVectorMatrix.cpp \ + LinAlg/IpExpansionMatrix.cpp \ + LinAlg/IpIdentityMatrix.cpp \ + LinAlg/IpLapack.cpp \ + LinAlg/IpLowRankUpdateSymMatrix.cpp \ + LinAlg/IpMatrix.cpp \ + LinAlg/IpMultiVectorMatrix.cpp \ + LinAlg/IpScaledMatrix.cpp \ + LinAlg/IpSumMatrix.cpp \ + LinAlg/IpSumSymMatrix.cpp \ + LinAlg/IpSymScaledMatrix.cpp \ + LinAlg/IpTransposeMatrix.cpp \ + LinAlg/IpVector.cpp \ + LinAlg/IpZeroMatrix.cpp \ + LinAlg/IpZeroSymMatrix.cpp \ + LinAlg/TMatrices/IpGenTMatrix.cpp \ + LinAlg/TMatrices/IpSymTMatrix.cpp \ + LinAlg/TMatrices/IpTripletHelper.cpp \ + Algorithm/IpAdaptiveMuUpdate.cpp \ + Algorithm/IpAlgBuilder.cpp \ + Algorithm/IpAlgorithmRegOp.cpp \ + Algorithm/IpAugRestoSystemSolver.cpp \ + Algorithm/IpBacktrackingLineSearch.cpp \ + Algorithm/IpDefaultIterateInitializer.cpp \ + Algorithm/IpEquilibrationScaling.cpp \ + Algorithm/IpExactHessianUpdater.cpp \ + Algorithm/IpFilter.cpp \ + Algorithm/IpFilterLSAcceptor.cpp \ + Algorithm/IpGenAugSystemSolver.cpp \ + Algorithm/IpGradientScaling.cpp \ + Algorithm/IpIpoptAlg.cpp \ + Algorithm/IpIpoptCalculatedQuantities.cpp \ + Algorithm/IpIpoptData.cpp \ + Algorithm/IpIteratesVector.cpp \ + Algorithm/IpLeastSquareMults.cpp \ + Algorithm/IpLimMemQuasiNewtonUpdater.cpp \ + Algorithm/IpLoqoMuOracle.cpp \ + Algorithm/IpLowRankAugSystemSolver.cpp \ + Algorithm/IpLowRankSSAugSystemSolver.cpp \ + Algorithm/IpMonotoneMuUpdate.cpp \ + Algorithm/IpNLPBoundsRemover.cpp \ + Algorithm/IpNLPScaling.cpp \ + Algorithm/IpOptErrorConvCheck.cpp \ + Algorithm/IpOrigIpoptNLP.cpp \ + Algorithm/IpOrigIterationOutput.cpp \ + Algorithm/IpPDFullSpaceSolver.cpp \ + Algorithm/IpPDPerturbationHandler.cpp \ + Algorithm/IpPDSearchDirCalc.cpp \ + Algorithm/IpPenaltyLSAcceptor.cpp \ + Algorithm/IpProbingMuOracle.cpp \ + Algorithm/IpQualityFunctionMuOracle.cpp \ + Algorithm/IpRestoConvCheck.cpp \ + Algorithm/IpRestoFilterConvCheck.cpp \ + Algorithm/IpRestoIpoptNLP.cpp \ + Algorithm/IpRestoIterateInitializer.cpp \ + Algorithm/IpRestoIterationOutput.cpp \ + Algorithm/IpRestoMinC_1Nrm.cpp \ + Algorithm/IpRestoPenaltyConvCheck.cpp \ + Algorithm/IpRestoRestoPhase.cpp \ + Algorithm/IpStdAugSystemSolver.cpp \ + Algorithm/IpTimingStatistics.cpp \ + Algorithm/IpUserScaling.cpp \ + Algorithm/IpWarmStartIterateInitializer.cpp \ + Algorithm/LinearSolvers/IpLinearSolversRegOp.cpp \ + Algorithm/LinearSolvers/IpLinearSolvers.c \ + Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.cpp \ + Algorithm/LinearSolvers/IpTripletToCSRConverter.cpp \ + Algorithm/LinearSolvers/IpTSymDependencyDetector.cpp \ + Algorithm/LinearSolvers/IpTSymLinearSolver.cpp \ + contrib/CGPenalty/IpCGPenaltyCq.cpp \ + contrib/CGPenalty/IpCGPenaltyData.cpp \ + contrib/CGPenalty/IpCGPenaltyLSAcceptor.cpp \ + contrib/CGPenalty/IpCGPenaltyRegOp.cpp \ + contrib/CGPenalty/IpCGPerturbationHandler.cpp \ + contrib/CGPenalty/IpCGSearchDirCalc.cpp \ + contrib/CGPenalty/IpPiecewisePenalty.cpp \ + Interfaces/IpInterfacesRegOp.cpp \ + Interfaces/IpIpoptApplication.cpp \ + Interfaces/IpSolveStatistics.cpp \ + Interfaces/IpStdCInterface.cpp \ + Interfaces/IpStdInterfaceTNLP.cpp \ + Interfaces/IpStdFInterface.c \ + Interfaces/IpTNLP.cpp \ + Interfaces/IpTNLPAdapter.cpp \ + Interfaces/IpTNLPReducer.cpp + +if HAVE_PARDISO_MKL + libipopt_la_SOURCES += Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.cpp +endif + +if !IPOPT_INT64 +libipopt_la_SOURCES += \ + Algorithm/LinearSolvers/IpMc19TSymScalingMethod.cpp \ + Algorithm/LinearSolvers/IpMa27TSolverInterface.cpp \ + Algorithm/LinearSolvers/IpMa57TSolverInterface.cpp \ + Algorithm/LinearSolvers/IpMa77SolverInterface.cpp \ + Algorithm/LinearSolvers/IpMa86SolverInterface.cpp \ + Algorithm/LinearSolvers/IpMa97SolverInterface.cpp \ + Algorithm/LinearSolvers/IpPardisoSolverInterface.cpp + +if HAVE_MA28 + libipopt_la_SOURCES += Algorithm/LinearSolvers/IpMa28TDependencyDetector.cpp +if IPOPT_SINGLE + libipopt_la_SOURCES += Algorithm/LinearSolvers/IpMa28sPartition.F +else + libipopt_la_SOURCES += Algorithm/LinearSolvers/IpMa28Partition.F +endif # IPOPT_SINGLE +endif # HAVE_MA28 + +endif # IPOPT_INT64 + +if HAVE_WSMP + libipopt_la_SOURCES += Algorithm/LinearSolvers/IpWsmpSolverInterface.cpp Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.cpp +endif + +if COIN_HAS_MUMPS + libipopt_la_SOURCES += Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp +endif + +if COIN_HAS_SPRAL + libipopt_la_SOURCES += Algorithm/LinearSolvers/IpSpralSolverInterface.cpp +endif + +if BUILD_INEXACT +libipopt_la_SOURCES += \ + Algorithm/Inexact/IpInexactAlgBuilder.cpp \ + Algorithm/Inexact/IpInexactCq.cpp \ + Algorithm/Inexact/IpInexactData.cpp \ + Algorithm/Inexact/IpInexactDoglegNormal.cpp \ + Algorithm/Inexact/IpInexactLSAcceptor.cpp \ + Algorithm/Inexact/IpInexactNewtonNormal.cpp \ + Algorithm/Inexact/IpInexactNormalTerminationTester.cpp \ + Algorithm/Inexact/IpInexactPDSolver.cpp \ + Algorithm/Inexact/IpInexactPDTerminationTester.cpp \ + Algorithm/Inexact/IpInexactRegOp.cpp \ + Algorithm/Inexact/IpInexactSearchDirCalc.cpp \ + Algorithm/Inexact/IpInexactTSymScalingMethod.cpp \ + Algorithm/Inexact/IpIterativePardisoSolverInterface.cpp \ + Algorithm/Inexact/IpIterativeSolverTerminationTester.cpp +endif + +if BUILD_JAVA + libipopt_la_SOURCES += Interfaces/IpStdJInterface.cpp org_coinor_Ipopt.h +endif + +AM_CPPFLAGS = \ + -I$(srcdir)/Common \ + -I$(srcdir)/LinAlg \ + -I$(srcdir)/LinAlg/TMatrices \ + -I$(srcdir)/Algorithm \ + -I$(srcdir)/Algorithm/LinearSolvers \ + -I$(srcdir)/Algorithm/Inexact \ + -I$(srcdir)/Interfaces \ + -I$(srcdir)/contrib/CGPenalty \ + $(IPOPTLIB_CFLAGS) + +AM_LDFLAGS = $(LT_LDFLAGS) + +libipopt_la_LIBADD = $(IPOPTLIB_LFLAGS) + +if BUILD_JAVA +BUILT_SOURCES = org_coinor_Ipopt.h + +org.coinor.ipopt.jar : org/coinor/Ipopt.class + $(JAR) cf $@ $< + +if IPOPT_SINGLE +# replace double by float in Ipopt.java; filename needs to be Ipopt.java, so put into subdir +Ipopt.java : $(srcdir)/Interfaces/Ipopt.java + sed -e s/double/float/g $< > $@ + +org/coinor/Ipopt.class org_coinor_Ipopt.h : Ipopt.java + $(JAVAC) $< -d $(PWD) -h $(PWD) +else +# had -target 1.8 -source 1.8, but that produces a warning if Java 8 RT is not setup +org/coinor/Ipopt.class org_coinor_Ipopt.h : Interfaces/Ipopt.java + $(JAVAC) $< -d $(PWD) -h $(PWD) +endif + +all-local : org.coinor.ipopt.jar + +CLEANFILES = org.coinor.ipopt.jar org/coinor/Ipopt.class org_coinor_Ipopt.h +endif + +install-exec-local: + $(install_sh_DATA) Common/config_ipopt.h $(DESTDIR)$(includeipoptdir)/IpoptConfig.h +if BUILD_JAVA + $(MKDIR_P) "$(DESTDIR)$(datadir)/java" + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) org.coinor.ipopt.jar "$(DESTDIR)$(datadir)/java" +endif + +uninstall-local: + rm -f $(DESTDIR)$(includeipoptdir)/IpoptConfig.h +if BUILD_JAVA + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(datadir)/java/org.coinor.ipopt.jar" +endif + +pkgconfiglibdir = $(libdir)/pkgconfig +pkgconfiglib_DATA = ipopt.pc + +if COIN_HAS_ASL + SUBDIRS = . Apps/AmplSolver +endif diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 000000000..c469a39f8 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,2114 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 2021 COIN-OR Foundation +# All Rights Reserved. +# This file is distributed under the Eclipse Public License. +# +# Authors: Stefan Vigerske + + + +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@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAVE_PARDISO_MKL_TRUE@am__append_1 = Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.cpp +@IPOPT_INT64_FALSE@am__append_2 = \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMc19TSymScalingMethod.cpp \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa27TSolverInterface.cpp \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa57TSolverInterface.cpp \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa77SolverInterface.cpp \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa86SolverInterface.cpp \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa97SolverInterface.cpp \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpPardisoSolverInterface.cpp + +@HAVE_MA28_TRUE@@IPOPT_INT64_FALSE@am__append_3 = Algorithm/LinearSolvers/IpMa28TDependencyDetector.cpp +@HAVE_MA28_TRUE@@IPOPT_INT64_FALSE@@IPOPT_SINGLE_TRUE@am__append_4 = Algorithm/LinearSolvers/IpMa28sPartition.F +@HAVE_MA28_TRUE@@IPOPT_INT64_FALSE@@IPOPT_SINGLE_FALSE@am__append_5 = Algorithm/LinearSolvers/IpMa28Partition.F +@HAVE_WSMP_TRUE@am__append_6 = Algorithm/LinearSolvers/IpWsmpSolverInterface.cpp Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.cpp +@COIN_HAS_MUMPS_TRUE@am__append_7 = Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp +@COIN_HAS_SPRAL_TRUE@am__append_8 = Algorithm/LinearSolvers/IpSpralSolverInterface.cpp +@BUILD_INEXACT_TRUE@am__append_9 = \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactAlgBuilder.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactCq.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactData.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactDoglegNormal.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactLSAcceptor.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactNewtonNormal.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactNormalTerminationTester.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactPDSolver.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactPDTerminationTester.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactRegOp.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactSearchDirCalc.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactTSymScalingMethod.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpIterativePardisoSolverInterface.cpp \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpIterativeSolverTerminationTester.cpp + +@BUILD_JAVA_TRUE@am__append_10 = Interfaces/IpStdJInterface.cpp org_coinor_Ipopt.h +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +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 +CONFIG_CLEAN_FILES = ipopt.pc +CONFIG_CLEAN_VPATH_FILES = +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__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfiglibdir)" \ + "$(DESTDIR)$(includeipoptdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libipopt_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__dirstamp = $(am__leading_dot)dirstamp +@HAVE_PARDISO_MKL_TRUE@am__objects_1 = Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.lo +@IPOPT_INT64_FALSE@am__objects_2 = Algorithm/LinearSolvers/IpMc19TSymScalingMethod.lo \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa27TSolverInterface.lo \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa57TSolverInterface.lo \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa77SolverInterface.lo \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa86SolverInterface.lo \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpMa97SolverInterface.lo \ +@IPOPT_INT64_FALSE@ Algorithm/LinearSolvers/IpPardisoSolverInterface.lo +@HAVE_MA28_TRUE@@IPOPT_INT64_FALSE@am__objects_3 = Algorithm/LinearSolvers/IpMa28TDependencyDetector.lo +@HAVE_MA28_TRUE@@IPOPT_INT64_FALSE@@IPOPT_SINGLE_TRUE@am__objects_4 = Algorithm/LinearSolvers/IpMa28sPartition.lo +@HAVE_MA28_TRUE@@IPOPT_INT64_FALSE@@IPOPT_SINGLE_FALSE@am__objects_5 = Algorithm/LinearSolvers/IpMa28Partition.lo +@HAVE_WSMP_TRUE@am__objects_6 = Algorithm/LinearSolvers/IpWsmpSolverInterface.lo \ +@HAVE_WSMP_TRUE@ Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.lo +@COIN_HAS_MUMPS_TRUE@am__objects_7 = Algorithm/LinearSolvers/IpMumpsSolverInterface.lo +@COIN_HAS_SPRAL_TRUE@am__objects_8 = Algorithm/LinearSolvers/IpSpralSolverInterface.lo +@BUILD_INEXACT_TRUE@am__objects_9 = \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactAlgBuilder.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactCq.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactData.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactDoglegNormal.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactLSAcceptor.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactNewtonNormal.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactNormalTerminationTester.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactPDSolver.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactPDTerminationTester.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactRegOp.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactSearchDirCalc.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpInexactTSymScalingMethod.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpIterativePardisoSolverInterface.lo \ +@BUILD_INEXACT_TRUE@ Algorithm/Inexact/IpIterativeSolverTerminationTester.lo +@BUILD_JAVA_TRUE@am__objects_10 = Interfaces/IpStdJInterface.lo +am_libipopt_la_OBJECTS = Common/IpDebug.lo Common/IpJournalist.lo \ + Common/IpObserver.lo Common/IpOptionsList.lo \ + Common/IpRegOptions.lo Common/IpTaggedObject.lo \ + Common/IpUtils.lo Common/IpLibraryLoader.lo LinAlg/IpBlas.lo \ + LinAlg/IpCompoundMatrix.lo LinAlg/IpCompoundSymMatrix.lo \ + LinAlg/IpCompoundVector.lo LinAlg/IpDenseGenMatrix.lo \ + LinAlg/IpDenseSymMatrix.lo LinAlg/IpDenseVector.lo \ + LinAlg/IpDiagMatrix.lo LinAlg/IpExpandedMultiVectorMatrix.lo \ + LinAlg/IpExpansionMatrix.lo LinAlg/IpIdentityMatrix.lo \ + LinAlg/IpLapack.lo LinAlg/IpLowRankUpdateSymMatrix.lo \ + LinAlg/IpMatrix.lo LinAlg/IpMultiVectorMatrix.lo \ + LinAlg/IpScaledMatrix.lo LinAlg/IpSumMatrix.lo \ + LinAlg/IpSumSymMatrix.lo LinAlg/IpSymScaledMatrix.lo \ + LinAlg/IpTransposeMatrix.lo LinAlg/IpVector.lo \ + LinAlg/IpZeroMatrix.lo LinAlg/IpZeroSymMatrix.lo \ + LinAlg/TMatrices/IpGenTMatrix.lo \ + LinAlg/TMatrices/IpSymTMatrix.lo \ + LinAlg/TMatrices/IpTripletHelper.lo \ + Algorithm/IpAdaptiveMuUpdate.lo Algorithm/IpAlgBuilder.lo \ + Algorithm/IpAlgorithmRegOp.lo \ + Algorithm/IpAugRestoSystemSolver.lo \ + Algorithm/IpBacktrackingLineSearch.lo \ + Algorithm/IpDefaultIterateInitializer.lo \ + Algorithm/IpEquilibrationScaling.lo \ + Algorithm/IpExactHessianUpdater.lo Algorithm/IpFilter.lo \ + Algorithm/IpFilterLSAcceptor.lo \ + Algorithm/IpGenAugSystemSolver.lo \ + Algorithm/IpGradientScaling.lo Algorithm/IpIpoptAlg.lo \ + Algorithm/IpIpoptCalculatedQuantities.lo \ + Algorithm/IpIpoptData.lo Algorithm/IpIteratesVector.lo \ + Algorithm/IpLeastSquareMults.lo \ + Algorithm/IpLimMemQuasiNewtonUpdater.lo \ + Algorithm/IpLoqoMuOracle.lo \ + Algorithm/IpLowRankAugSystemSolver.lo \ + Algorithm/IpLowRankSSAugSystemSolver.lo \ + Algorithm/IpMonotoneMuUpdate.lo \ + Algorithm/IpNLPBoundsRemover.lo Algorithm/IpNLPScaling.lo \ + Algorithm/IpOptErrorConvCheck.lo Algorithm/IpOrigIpoptNLP.lo \ + Algorithm/IpOrigIterationOutput.lo \ + Algorithm/IpPDFullSpaceSolver.lo \ + Algorithm/IpPDPerturbationHandler.lo \ + Algorithm/IpPDSearchDirCalc.lo \ + Algorithm/IpPenaltyLSAcceptor.lo \ + Algorithm/IpProbingMuOracle.lo \ + Algorithm/IpQualityFunctionMuOracle.lo \ + Algorithm/IpRestoConvCheck.lo \ + Algorithm/IpRestoFilterConvCheck.lo \ + Algorithm/IpRestoIpoptNLP.lo \ + Algorithm/IpRestoIterateInitializer.lo \ + Algorithm/IpRestoIterationOutput.lo \ + Algorithm/IpRestoMinC_1Nrm.lo \ + Algorithm/IpRestoPenaltyConvCheck.lo \ + Algorithm/IpRestoRestoPhase.lo \ + Algorithm/IpStdAugSystemSolver.lo \ + Algorithm/IpTimingStatistics.lo Algorithm/IpUserScaling.lo \ + Algorithm/IpWarmStartIterateInitializer.lo \ + Algorithm/LinearSolvers/IpLinearSolversRegOp.lo \ + Algorithm/LinearSolvers/IpLinearSolvers.lo \ + Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.lo \ + Algorithm/LinearSolvers/IpTripletToCSRConverter.lo \ + Algorithm/LinearSolvers/IpTSymDependencyDetector.lo \ + Algorithm/LinearSolvers/IpTSymLinearSolver.lo \ + contrib/CGPenalty/IpCGPenaltyCq.lo \ + contrib/CGPenalty/IpCGPenaltyData.lo \ + contrib/CGPenalty/IpCGPenaltyLSAcceptor.lo \ + contrib/CGPenalty/IpCGPenaltyRegOp.lo \ + contrib/CGPenalty/IpCGPerturbationHandler.lo \ + contrib/CGPenalty/IpCGSearchDirCalc.lo \ + contrib/CGPenalty/IpPiecewisePenalty.lo \ + Interfaces/IpInterfacesRegOp.lo \ + Interfaces/IpIpoptApplication.lo \ + Interfaces/IpSolveStatistics.lo Interfaces/IpStdCInterface.lo \ + Interfaces/IpStdInterfaceTNLP.lo Interfaces/IpStdFInterface.lo \ + Interfaces/IpTNLP.lo Interfaces/IpTNLPAdapter.lo \ + Interfaces/IpTNLPReducer.lo $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) $(am__objects_4) $(am__objects_5) \ + $(am__objects_6) $(am__objects_7) $(am__objects_8) \ + $(am__objects_9) $(am__objects_10) +libipopt_la_OBJECTS = $(am_libipopt_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 = +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 = Algorithm/$(DEPDIR)/IpAdaptiveMuUpdate.Plo \ + Algorithm/$(DEPDIR)/IpAlgBuilder.Plo \ + Algorithm/$(DEPDIR)/IpAlgorithmRegOp.Plo \ + Algorithm/$(DEPDIR)/IpAugRestoSystemSolver.Plo \ + Algorithm/$(DEPDIR)/IpBacktrackingLineSearch.Plo \ + Algorithm/$(DEPDIR)/IpDefaultIterateInitializer.Plo \ + Algorithm/$(DEPDIR)/IpEquilibrationScaling.Plo \ + Algorithm/$(DEPDIR)/IpExactHessianUpdater.Plo \ + Algorithm/$(DEPDIR)/IpFilter.Plo \ + Algorithm/$(DEPDIR)/IpFilterLSAcceptor.Plo \ + Algorithm/$(DEPDIR)/IpGenAugSystemSolver.Plo \ + Algorithm/$(DEPDIR)/IpGradientScaling.Plo \ + Algorithm/$(DEPDIR)/IpIpoptAlg.Plo \ + Algorithm/$(DEPDIR)/IpIpoptCalculatedQuantities.Plo \ + Algorithm/$(DEPDIR)/IpIpoptData.Plo \ + Algorithm/$(DEPDIR)/IpIteratesVector.Plo \ + Algorithm/$(DEPDIR)/IpLeastSquareMults.Plo \ + Algorithm/$(DEPDIR)/IpLimMemQuasiNewtonUpdater.Plo \ + Algorithm/$(DEPDIR)/IpLoqoMuOracle.Plo \ + Algorithm/$(DEPDIR)/IpLowRankAugSystemSolver.Plo \ + Algorithm/$(DEPDIR)/IpLowRankSSAugSystemSolver.Plo \ + Algorithm/$(DEPDIR)/IpMonotoneMuUpdate.Plo \ + Algorithm/$(DEPDIR)/IpNLPBoundsRemover.Plo \ + Algorithm/$(DEPDIR)/IpNLPScaling.Plo \ + Algorithm/$(DEPDIR)/IpOptErrorConvCheck.Plo \ + Algorithm/$(DEPDIR)/IpOrigIpoptNLP.Plo \ + Algorithm/$(DEPDIR)/IpOrigIterationOutput.Plo \ + Algorithm/$(DEPDIR)/IpPDFullSpaceSolver.Plo \ + Algorithm/$(DEPDIR)/IpPDPerturbationHandler.Plo \ + Algorithm/$(DEPDIR)/IpPDSearchDirCalc.Plo \ + Algorithm/$(DEPDIR)/IpPenaltyLSAcceptor.Plo \ + Algorithm/$(DEPDIR)/IpProbingMuOracle.Plo \ + Algorithm/$(DEPDIR)/IpQualityFunctionMuOracle.Plo \ + Algorithm/$(DEPDIR)/IpRestoConvCheck.Plo \ + Algorithm/$(DEPDIR)/IpRestoFilterConvCheck.Plo \ + Algorithm/$(DEPDIR)/IpRestoIpoptNLP.Plo \ + Algorithm/$(DEPDIR)/IpRestoIterateInitializer.Plo \ + Algorithm/$(DEPDIR)/IpRestoIterationOutput.Plo \ + Algorithm/$(DEPDIR)/IpRestoMinC_1Nrm.Plo \ + Algorithm/$(DEPDIR)/IpRestoPenaltyConvCheck.Plo \ + Algorithm/$(DEPDIR)/IpRestoRestoPhase.Plo \ + Algorithm/$(DEPDIR)/IpStdAugSystemSolver.Plo \ + Algorithm/$(DEPDIR)/IpTimingStatistics.Plo \ + Algorithm/$(DEPDIR)/IpUserScaling.Plo \ + Algorithm/$(DEPDIR)/IpWarmStartIterateInitializer.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactAlgBuilder.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactCq.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactData.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactDoglegNormal.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactLSAcceptor.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactNewtonNormal.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactNormalTerminationTester.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactPDSolver.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactPDTerminationTester.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactRegOp.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactSearchDirCalc.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpInexactTSymScalingMethod.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpIterativePardisoSolverInterface.Plo \ + Algorithm/Inexact/$(DEPDIR)/IpIterativeSolverTerminationTester.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpIterativeWsmpSolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpLinearSolvers.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpLinearSolversRegOp.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpMa27TSolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpMa28TDependencyDetector.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpMa57TSolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpMa77SolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpMa86SolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpMa97SolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpMc19TSymScalingMethod.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpMumpsSolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpPardisoMKLSolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpPardisoSolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpSlackBasedTSymScalingMethod.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpSpralSolverInterface.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpTSymDependencyDetector.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpTSymLinearSolver.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpTripletToCSRConverter.Plo \ + Algorithm/LinearSolvers/$(DEPDIR)/IpWsmpSolverInterface.Plo \ + Common/$(DEPDIR)/IpDebug.Plo Common/$(DEPDIR)/IpJournalist.Plo \ + Common/$(DEPDIR)/IpLibraryLoader.Plo \ + Common/$(DEPDIR)/IpObserver.Plo \ + Common/$(DEPDIR)/IpOptionsList.Plo \ + Common/$(DEPDIR)/IpRegOptions.Plo \ + Common/$(DEPDIR)/IpTaggedObject.Plo \ + Common/$(DEPDIR)/IpUtils.Plo \ + Interfaces/$(DEPDIR)/IpInterfacesRegOp.Plo \ + Interfaces/$(DEPDIR)/IpIpoptApplication.Plo \ + Interfaces/$(DEPDIR)/IpSolveStatistics.Plo \ + Interfaces/$(DEPDIR)/IpStdCInterface.Plo \ + Interfaces/$(DEPDIR)/IpStdFInterface.Plo \ + Interfaces/$(DEPDIR)/IpStdInterfaceTNLP.Plo \ + Interfaces/$(DEPDIR)/IpStdJInterface.Plo \ + Interfaces/$(DEPDIR)/IpTNLP.Plo \ + Interfaces/$(DEPDIR)/IpTNLPAdapter.Plo \ + Interfaces/$(DEPDIR)/IpTNLPReducer.Plo \ + LinAlg/$(DEPDIR)/IpBlas.Plo \ + LinAlg/$(DEPDIR)/IpCompoundMatrix.Plo \ + LinAlg/$(DEPDIR)/IpCompoundSymMatrix.Plo \ + LinAlg/$(DEPDIR)/IpCompoundVector.Plo \ + LinAlg/$(DEPDIR)/IpDenseGenMatrix.Plo \ + LinAlg/$(DEPDIR)/IpDenseSymMatrix.Plo \ + LinAlg/$(DEPDIR)/IpDenseVector.Plo \ + LinAlg/$(DEPDIR)/IpDiagMatrix.Plo \ + LinAlg/$(DEPDIR)/IpExpandedMultiVectorMatrix.Plo \ + LinAlg/$(DEPDIR)/IpExpansionMatrix.Plo \ + LinAlg/$(DEPDIR)/IpIdentityMatrix.Plo \ + LinAlg/$(DEPDIR)/IpLapack.Plo \ + LinAlg/$(DEPDIR)/IpLowRankUpdateSymMatrix.Plo \ + LinAlg/$(DEPDIR)/IpMatrix.Plo \ + LinAlg/$(DEPDIR)/IpMultiVectorMatrix.Plo \ + LinAlg/$(DEPDIR)/IpScaledMatrix.Plo \ + LinAlg/$(DEPDIR)/IpSumMatrix.Plo \ + LinAlg/$(DEPDIR)/IpSumSymMatrix.Plo \ + LinAlg/$(DEPDIR)/IpSymScaledMatrix.Plo \ + LinAlg/$(DEPDIR)/IpTransposeMatrix.Plo \ + LinAlg/$(DEPDIR)/IpVector.Plo \ + LinAlg/$(DEPDIR)/IpZeroMatrix.Plo \ + LinAlg/$(DEPDIR)/IpZeroSymMatrix.Plo \ + LinAlg/TMatrices/$(DEPDIR)/IpGenTMatrix.Plo \ + LinAlg/TMatrices/$(DEPDIR)/IpSymTMatrix.Plo \ + LinAlg/TMatrices/$(DEPDIR)/IpTripletHelper.Plo \ + contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyCq.Plo \ + contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyData.Plo \ + contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyLSAcceptor.Plo \ + contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyRegOp.Plo \ + contrib/CGPenalty/$(DEPDIR)/IpCGPerturbationHandler.Plo \ + contrib/CGPenalty/$(DEPDIR)/IpCGSearchDirCalc.Plo \ + contrib/CGPenalty/$(DEPDIR)/IpPiecewisePenalty.Plo +am__mv = mv -f +PPF77COMPILE = $(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS) +LTPPF77COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(F77) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_FFLAGS) $(FFLAGS) +AM_V_PPF77 = $(am__v_PPF77_@AM_V@) +am__v_PPF77_ = $(am__v_PPF77_@AM_DEFAULT_V@) +am__v_PPF77_0 = @echo " PPF77 " $@; +am__v_PPF77_1 = +F77LD = $(F77) +F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_F77LD = $(am__v_F77LD_@AM_V@) +am__v_F77LD_ = $(am__v_F77LD_@AM_DEFAULT_V@) +am__v_F77LD_0 = @echo " F77LD " $@; +am__v_F77LD_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +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) \ + $(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) \ + $(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 = +SOURCES = $(libipopt_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +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) +HEADERS = $(includeipopt_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS +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)` +DIST_SUBDIRS = . Apps/AmplSolver +ACLOCAL = @ACLOCAL@ +ADD_CFLAGS = @ADD_CFLAGS@ +ADD_CXXFLAGS = @ADD_CXXFLAGS@ +ADD_FFLAGS = @ADD_FFLAGS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BIT32FCOMMENT = @BIT32FCOMMENT@ +BIT64FCOMMENT = @BIT64FCOMMENT@ +BITS_PER_POINTER = @BITS_PER_POINTER@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CXXLIBS = @CXXLIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +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@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPOPTAMPLINTERFACELIB_CFLAGS = @IPOPTAMPLINTERFACELIB_CFLAGS@ +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_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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_LDFLAGS = @LT_LDFLAGS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +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@ +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@ +SIPOPTLIB_CFLAGS_NOPC = @SIPOPTLIB_CFLAGS_NOPC@ +SIPOPTLIB_LFLAGS_NOPC = @SIPOPTLIB_LFLAGS_NOPC@ +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@ +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@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +coin_doxy_logname = @coin_doxy_logname@ +coin_doxy_tagfiles = @coin_doxy_tagfiles@ +coin_doxy_tagname = @coin_doxy_tagname@ +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@ +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@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +includeipoptdir = $(includedir)/coin-or +includeipopt_HEADERS = \ + Common/IpCachedResults.hpp \ + Common/IpDebug.hpp \ + Common/IpException.hpp \ + Common/IpJournalist.hpp \ + Common/IpLibraryLoader.hpp \ + Common/IpObserver.hpp \ + Common/IpOptionsList.hpp \ + Common/IpReferenced.hpp \ + Common/IpRegOptions.hpp \ + Common/IpSmartPtr.hpp \ + Common/IpTaggedObject.hpp \ + Common/IpTimedTask.hpp \ + Common/IpTypes.hpp \ + Common/IpTypes.h \ + Common/IpUtils.hpp \ + LinAlg/IpBlas.hpp \ + LinAlg/IpCompoundMatrix.hpp \ + LinAlg/IpCompoundSymMatrix.hpp \ + LinAlg/IpCompoundVector.hpp \ + LinAlg/IpDenseVector.hpp \ + LinAlg/IpDiagMatrix.hpp \ + LinAlg/IpExpansionMatrix.hpp \ + LinAlg/IpIdentityMatrix.hpp \ + LinAlg/IpLapack.hpp \ + LinAlg/IpMatrix.hpp \ + LinAlg/IpScaledMatrix.hpp \ + LinAlg/IpSumSymMatrix.hpp \ + LinAlg/IpSymMatrix.hpp \ + LinAlg/IpSymScaledMatrix.hpp \ + LinAlg/IpVector.hpp \ + LinAlg/IpZeroSymMatrix.hpp \ + LinAlg/TMatrices/IpGenTMatrix.hpp \ + LinAlg/TMatrices/IpSymTMatrix.hpp \ + LinAlg/TMatrices/IpTripletHelper.hpp \ + Algorithm/IpAlgBuilder.hpp \ + Algorithm/IpAlgStrategy.hpp \ + Algorithm/IpAugSystemSolver.hpp \ + Algorithm/IpConvCheck.hpp \ + Algorithm/IpEqMultCalculator.hpp \ + Algorithm/IpHessianUpdater.hpp \ + Algorithm/IpIpoptAlg.hpp \ + Algorithm/IpIpoptCalculatedQuantities.hpp \ + Algorithm/IpIpoptData.hpp \ + Algorithm/IpIpoptNLP.hpp \ + Algorithm/IpIterateInitializer.hpp \ + Algorithm/IpIteratesVector.hpp \ + Algorithm/IpIterationOutput.hpp \ + Algorithm/IpOrigIpoptNLP.hpp \ + Algorithm/IpLineSearch.hpp \ + Algorithm/IpMuUpdate.hpp \ + Algorithm/IpNLPScaling.hpp \ + Algorithm/IpPDSystemSolver.hpp \ + Algorithm/IpSearchDirCalculator.hpp \ + Algorithm/IpStdAugSystemSolver.hpp \ + Algorithm/IpTimingStatistics.hpp \ + Algorithm/LinearSolvers/IpLinearSolvers.h \ + Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.hpp \ + Algorithm/LinearSolvers/IpSparseSymLinearSolverInterface.hpp \ + Algorithm/LinearSolvers/IpSymLinearSolver.hpp \ + Algorithm/LinearSolvers/IpTripletToCSRConverter.hpp \ + Algorithm/LinearSolvers/IpTSymLinearSolver.hpp \ + Algorithm/LinearSolvers/IpTSymScalingMethod.hpp \ + Interfaces/IpAlgTypes.hpp \ + Interfaces/IpIpoptApplication.hpp \ + Interfaces/IpNLP.hpp \ + Interfaces/IpReturnCodes.h \ + Interfaces/IpReturnCodes.hpp \ + Interfaces/IpReturnCodes_inc.h \ + Interfaces/IpReturnCodes.inc \ + Interfaces/IpSolveStatistics.hpp \ + Interfaces/IpStdCInterface.h \ + Interfaces/IpTNLP.hpp \ + Interfaces/IpTNLPAdapter.hpp \ + Interfaces/IpTNLPReducer.hpp + +lib_LTLIBRARIES = libipopt.la +libipopt_la_SOURCES = Common/IpDebug.cpp Common/IpJournalist.cpp \ + Common/IpObserver.cpp Common/IpOptionsList.cpp \ + Common/IpRegOptions.cpp Common/IpTaggedObject.cpp \ + Common/IpUtils.cpp Common/IpLibraryLoader.cpp \ + LinAlg/IpBlas.cpp LinAlg/IpCompoundMatrix.cpp \ + LinAlg/IpCompoundSymMatrix.cpp LinAlg/IpCompoundVector.cpp \ + LinAlg/IpDenseGenMatrix.cpp LinAlg/IpDenseSymMatrix.cpp \ + LinAlg/IpDenseVector.cpp LinAlg/IpDiagMatrix.cpp \ + LinAlg/IpExpandedMultiVectorMatrix.cpp \ + LinAlg/IpExpansionMatrix.cpp LinAlg/IpIdentityMatrix.cpp \ + LinAlg/IpLapack.cpp LinAlg/IpLowRankUpdateSymMatrix.cpp \ + LinAlg/IpMatrix.cpp LinAlg/IpMultiVectorMatrix.cpp \ + LinAlg/IpScaledMatrix.cpp LinAlg/IpSumMatrix.cpp \ + LinAlg/IpSumSymMatrix.cpp LinAlg/IpSymScaledMatrix.cpp \ + LinAlg/IpTransposeMatrix.cpp LinAlg/IpVector.cpp \ + LinAlg/IpZeroMatrix.cpp LinAlg/IpZeroSymMatrix.cpp \ + LinAlg/TMatrices/IpGenTMatrix.cpp \ + LinAlg/TMatrices/IpSymTMatrix.cpp \ + LinAlg/TMatrices/IpTripletHelper.cpp \ + Algorithm/IpAdaptiveMuUpdate.cpp Algorithm/IpAlgBuilder.cpp \ + Algorithm/IpAlgorithmRegOp.cpp \ + Algorithm/IpAugRestoSystemSolver.cpp \ + Algorithm/IpBacktrackingLineSearch.cpp \ + Algorithm/IpDefaultIterateInitializer.cpp \ + Algorithm/IpEquilibrationScaling.cpp \ + Algorithm/IpExactHessianUpdater.cpp Algorithm/IpFilter.cpp \ + Algorithm/IpFilterLSAcceptor.cpp \ + Algorithm/IpGenAugSystemSolver.cpp \ + Algorithm/IpGradientScaling.cpp Algorithm/IpIpoptAlg.cpp \ + Algorithm/IpIpoptCalculatedQuantities.cpp \ + Algorithm/IpIpoptData.cpp Algorithm/IpIteratesVector.cpp \ + Algorithm/IpLeastSquareMults.cpp \ + Algorithm/IpLimMemQuasiNewtonUpdater.cpp \ + Algorithm/IpLoqoMuOracle.cpp \ + Algorithm/IpLowRankAugSystemSolver.cpp \ + Algorithm/IpLowRankSSAugSystemSolver.cpp \ + Algorithm/IpMonotoneMuUpdate.cpp \ + Algorithm/IpNLPBoundsRemover.cpp Algorithm/IpNLPScaling.cpp \ + Algorithm/IpOptErrorConvCheck.cpp Algorithm/IpOrigIpoptNLP.cpp \ + Algorithm/IpOrigIterationOutput.cpp \ + Algorithm/IpPDFullSpaceSolver.cpp \ + Algorithm/IpPDPerturbationHandler.cpp \ + Algorithm/IpPDSearchDirCalc.cpp \ + Algorithm/IpPenaltyLSAcceptor.cpp \ + Algorithm/IpProbingMuOracle.cpp \ + Algorithm/IpQualityFunctionMuOracle.cpp \ + Algorithm/IpRestoConvCheck.cpp \ + Algorithm/IpRestoFilterConvCheck.cpp \ + Algorithm/IpRestoIpoptNLP.cpp \ + Algorithm/IpRestoIterateInitializer.cpp \ + Algorithm/IpRestoIterationOutput.cpp \ + Algorithm/IpRestoMinC_1Nrm.cpp \ + Algorithm/IpRestoPenaltyConvCheck.cpp \ + Algorithm/IpRestoRestoPhase.cpp \ + Algorithm/IpStdAugSystemSolver.cpp \ + Algorithm/IpTimingStatistics.cpp Algorithm/IpUserScaling.cpp \ + Algorithm/IpWarmStartIterateInitializer.cpp \ + Algorithm/LinearSolvers/IpLinearSolversRegOp.cpp \ + Algorithm/LinearSolvers/IpLinearSolvers.c \ + Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.cpp \ + Algorithm/LinearSolvers/IpTripletToCSRConverter.cpp \ + Algorithm/LinearSolvers/IpTSymDependencyDetector.cpp \ + Algorithm/LinearSolvers/IpTSymLinearSolver.cpp \ + contrib/CGPenalty/IpCGPenaltyCq.cpp \ + contrib/CGPenalty/IpCGPenaltyData.cpp \ + contrib/CGPenalty/IpCGPenaltyLSAcceptor.cpp \ + contrib/CGPenalty/IpCGPenaltyRegOp.cpp \ + contrib/CGPenalty/IpCGPerturbationHandler.cpp \ + contrib/CGPenalty/IpCGSearchDirCalc.cpp \ + contrib/CGPenalty/IpPiecewisePenalty.cpp \ + Interfaces/IpInterfacesRegOp.cpp \ + Interfaces/IpIpoptApplication.cpp \ + Interfaces/IpSolveStatistics.cpp \ + Interfaces/IpStdCInterface.cpp \ + Interfaces/IpStdInterfaceTNLP.cpp Interfaces/IpStdFInterface.c \ + Interfaces/IpTNLP.cpp Interfaces/IpTNLPAdapter.cpp \ + Interfaces/IpTNLPReducer.cpp $(am__append_1) $(am__append_2) \ + $(am__append_3) $(am__append_4) $(am__append_5) \ + $(am__append_6) $(am__append_7) $(am__append_8) \ + $(am__append_9) $(am__append_10) +AM_CPPFLAGS = \ + -I$(srcdir)/Common \ + -I$(srcdir)/LinAlg \ + -I$(srcdir)/LinAlg/TMatrices \ + -I$(srcdir)/Algorithm \ + -I$(srcdir)/Algorithm/LinearSolvers \ + -I$(srcdir)/Algorithm/Inexact \ + -I$(srcdir)/Interfaces \ + -I$(srcdir)/contrib/CGPenalty \ + $(IPOPTLIB_CFLAGS) + +AM_LDFLAGS = $(LT_LDFLAGS) +libipopt_la_LIBADD = $(IPOPTLIB_LFLAGS) +@BUILD_JAVA_TRUE@BUILT_SOURCES = org_coinor_Ipopt.h +@BUILD_JAVA_TRUE@CLEANFILES = org.coinor.ipopt.jar org/coinor/Ipopt.class org_coinor_Ipopt.h +pkgconfiglibdir = $(libdir)/pkgconfig +pkgconfiglib_DATA = ipopt.pc +@COIN_HAS_ASL_TRUE@SUBDIRS = . Apps/AmplSolver +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .F .c .cpp .f .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; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/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);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(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): +ipopt.pc: $(top_builddir)/config.status $(srcdir)/ipopt.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + 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)"; \ + } + +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"; \ + 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}; \ + } +Common/$(am__dirstamp): + @$(MKDIR_P) Common + @: > Common/$(am__dirstamp) +Common/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) Common/$(DEPDIR) + @: > Common/$(DEPDIR)/$(am__dirstamp) +Common/IpDebug.lo: Common/$(am__dirstamp) \ + Common/$(DEPDIR)/$(am__dirstamp) +Common/IpJournalist.lo: Common/$(am__dirstamp) \ + Common/$(DEPDIR)/$(am__dirstamp) +Common/IpObserver.lo: Common/$(am__dirstamp) \ + Common/$(DEPDIR)/$(am__dirstamp) +Common/IpOptionsList.lo: Common/$(am__dirstamp) \ + Common/$(DEPDIR)/$(am__dirstamp) +Common/IpRegOptions.lo: Common/$(am__dirstamp) \ + Common/$(DEPDIR)/$(am__dirstamp) +Common/IpTaggedObject.lo: Common/$(am__dirstamp) \ + Common/$(DEPDIR)/$(am__dirstamp) +Common/IpUtils.lo: Common/$(am__dirstamp) \ + Common/$(DEPDIR)/$(am__dirstamp) +Common/IpLibraryLoader.lo: Common/$(am__dirstamp) \ + Common/$(DEPDIR)/$(am__dirstamp) +LinAlg/$(am__dirstamp): + @$(MKDIR_P) LinAlg + @: > LinAlg/$(am__dirstamp) +LinAlg/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) LinAlg/$(DEPDIR) + @: > LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpBlas.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpCompoundMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpCompoundSymMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpCompoundVector.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpDenseGenMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpDenseSymMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpDenseVector.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpDiagMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpExpandedMultiVectorMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpExpansionMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpIdentityMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpLapack.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpLowRankUpdateSymMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpMultiVectorMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpScaledMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpSumMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpSumSymMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpSymScaledMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpTransposeMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpVector.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpZeroMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/IpZeroSymMatrix.lo: LinAlg/$(am__dirstamp) \ + LinAlg/$(DEPDIR)/$(am__dirstamp) +LinAlg/TMatrices/$(am__dirstamp): + @$(MKDIR_P) LinAlg/TMatrices + @: > LinAlg/TMatrices/$(am__dirstamp) +LinAlg/TMatrices/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) LinAlg/TMatrices/$(DEPDIR) + @: > LinAlg/TMatrices/$(DEPDIR)/$(am__dirstamp) +LinAlg/TMatrices/IpGenTMatrix.lo: LinAlg/TMatrices/$(am__dirstamp) \ + LinAlg/TMatrices/$(DEPDIR)/$(am__dirstamp) +LinAlg/TMatrices/IpSymTMatrix.lo: LinAlg/TMatrices/$(am__dirstamp) \ + LinAlg/TMatrices/$(DEPDIR)/$(am__dirstamp) +LinAlg/TMatrices/IpTripletHelper.lo: LinAlg/TMatrices/$(am__dirstamp) \ + LinAlg/TMatrices/$(DEPDIR)/$(am__dirstamp) +Algorithm/$(am__dirstamp): + @$(MKDIR_P) Algorithm + @: > Algorithm/$(am__dirstamp) +Algorithm/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) Algorithm/$(DEPDIR) + @: > Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpAdaptiveMuUpdate.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpAlgBuilder.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpAlgorithmRegOp.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpAugRestoSystemSolver.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpBacktrackingLineSearch.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpDefaultIterateInitializer.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpEquilibrationScaling.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpExactHessianUpdater.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpFilter.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpFilterLSAcceptor.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpGenAugSystemSolver.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpGradientScaling.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpIpoptAlg.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpIpoptCalculatedQuantities.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpIpoptData.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpIteratesVector.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpLeastSquareMults.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpLimMemQuasiNewtonUpdater.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpLoqoMuOracle.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpLowRankAugSystemSolver.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpLowRankSSAugSystemSolver.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpMonotoneMuUpdate.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpNLPBoundsRemover.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpNLPScaling.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpOptErrorConvCheck.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpOrigIpoptNLP.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpOrigIterationOutput.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpPDFullSpaceSolver.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpPDPerturbationHandler.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpPDSearchDirCalc.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpPenaltyLSAcceptor.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpProbingMuOracle.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpQualityFunctionMuOracle.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpRestoConvCheck.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpRestoFilterConvCheck.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpRestoIpoptNLP.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpRestoIterateInitializer.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpRestoIterationOutput.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpRestoMinC_1Nrm.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpRestoPenaltyConvCheck.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpRestoRestoPhase.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpStdAugSystemSolver.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpTimingStatistics.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpUserScaling.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/IpWarmStartIterateInitializer.lo: Algorithm/$(am__dirstamp) \ + Algorithm/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/$(am__dirstamp): + @$(MKDIR_P) Algorithm/LinearSolvers + @: > Algorithm/LinearSolvers/$(am__dirstamp) +Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) Algorithm/LinearSolvers/$(DEPDIR) + @: > Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpLinearSolversRegOp.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpLinearSolvers.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpTripletToCSRConverter.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpTSymDependencyDetector.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpTSymLinearSolver.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +contrib/CGPenalty/$(am__dirstamp): + @$(MKDIR_P) contrib/CGPenalty + @: > contrib/CGPenalty/$(am__dirstamp) +contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) contrib/CGPenalty/$(DEPDIR) + @: > contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp) +contrib/CGPenalty/IpCGPenaltyCq.lo: contrib/CGPenalty/$(am__dirstamp) \ + contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp) +contrib/CGPenalty/IpCGPenaltyData.lo: \ + contrib/CGPenalty/$(am__dirstamp) \ + contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp) +contrib/CGPenalty/IpCGPenaltyLSAcceptor.lo: \ + contrib/CGPenalty/$(am__dirstamp) \ + contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp) +contrib/CGPenalty/IpCGPenaltyRegOp.lo: \ + contrib/CGPenalty/$(am__dirstamp) \ + contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp) +contrib/CGPenalty/IpCGPerturbationHandler.lo: \ + contrib/CGPenalty/$(am__dirstamp) \ + contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp) +contrib/CGPenalty/IpCGSearchDirCalc.lo: \ + contrib/CGPenalty/$(am__dirstamp) \ + contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp) +contrib/CGPenalty/IpPiecewisePenalty.lo: \ + contrib/CGPenalty/$(am__dirstamp) \ + contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp) +Interfaces/$(am__dirstamp): + @$(MKDIR_P) Interfaces + @: > Interfaces/$(am__dirstamp) +Interfaces/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) Interfaces/$(DEPDIR) + @: > Interfaces/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpInterfacesRegOp.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpIpoptApplication.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpSolveStatistics.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpStdCInterface.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpStdInterfaceTNLP.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpStdFInterface.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpTNLP.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpTNLPAdapter.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpTNLPReducer.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMc19TSymScalingMethod.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMa27TSolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMa57TSolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMa77SolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMa86SolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMa97SolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpPardisoSolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMa28TDependencyDetector.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMa28sPartition.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMa28Partition.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpWsmpSolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpIterativeWsmpSolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpMumpsSolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/LinearSolvers/IpSpralSolverInterface.lo: \ + Algorithm/LinearSolvers/$(am__dirstamp) \ + Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/$(am__dirstamp): + @$(MKDIR_P) Algorithm/Inexact + @: > Algorithm/Inexact/$(am__dirstamp) +Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) Algorithm/Inexact/$(DEPDIR) + @: > Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactAlgBuilder.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactCq.lo: Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactData.lo: Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactDoglegNormal.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactLSAcceptor.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactNewtonNormal.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactNormalTerminationTester.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactPDSolver.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactPDTerminationTester.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactRegOp.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactSearchDirCalc.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpInexactTSymScalingMethod.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpIterativePardisoSolverInterface.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Algorithm/Inexact/IpIterativeSolverTerminationTester.lo: \ + Algorithm/Inexact/$(am__dirstamp) \ + Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) +Interfaces/IpStdJInterface.lo: Interfaces/$(am__dirstamp) \ + Interfaces/$(DEPDIR)/$(am__dirstamp) + +libipopt.la: $(libipopt_la_OBJECTS) $(libipopt_la_DEPENDENCIES) $(EXTRA_libipopt_la_DEPENDENCIES) + $(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libipopt_la_OBJECTS) $(libipopt_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f Algorithm/*.$(OBJEXT) + -rm -f Algorithm/*.lo + -rm -f Algorithm/Inexact/*.$(OBJEXT) + -rm -f Algorithm/Inexact/*.lo + -rm -f Algorithm/LinearSolvers/*.$(OBJEXT) + -rm -f Algorithm/LinearSolvers/*.lo + -rm -f Common/*.$(OBJEXT) + -rm -f Common/*.lo + -rm -f Interfaces/*.$(OBJEXT) + -rm -f Interfaces/*.lo + -rm -f LinAlg/*.$(OBJEXT) + -rm -f LinAlg/*.lo + -rm -f LinAlg/TMatrices/*.$(OBJEXT) + -rm -f LinAlg/TMatrices/*.lo + -rm -f contrib/CGPenalty/*.$(OBJEXT) + -rm -f contrib/CGPenalty/*.lo + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpAdaptiveMuUpdate.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpAlgBuilder.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpAlgorithmRegOp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpAugRestoSystemSolver.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpBacktrackingLineSearch.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpDefaultIterateInitializer.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpEquilibrationScaling.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpExactHessianUpdater.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpFilter.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpFilterLSAcceptor.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpGenAugSystemSolver.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpGradientScaling.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpIpoptAlg.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpIpoptCalculatedQuantities.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpIpoptData.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpIteratesVector.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpLeastSquareMults.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpLimMemQuasiNewtonUpdater.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpLoqoMuOracle.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpLowRankAugSystemSolver.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpLowRankSSAugSystemSolver.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpMonotoneMuUpdate.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpNLPBoundsRemover.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpNLPScaling.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpOptErrorConvCheck.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpOrigIpoptNLP.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpOrigIterationOutput.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpPDFullSpaceSolver.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpPDPerturbationHandler.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpPDSearchDirCalc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpPenaltyLSAcceptor.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpProbingMuOracle.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpQualityFunctionMuOracle.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpRestoConvCheck.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpRestoFilterConvCheck.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpRestoIpoptNLP.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpRestoIterateInitializer.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpRestoIterationOutput.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpRestoMinC_1Nrm.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpRestoPenaltyConvCheck.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpRestoRestoPhase.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpStdAugSystemSolver.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpTimingStatistics.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpUserScaling.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/$(DEPDIR)/IpWarmStartIterateInitializer.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactAlgBuilder.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactCq.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactData.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactDoglegNormal.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactLSAcceptor.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactNewtonNormal.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactNormalTerminationTester.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactPDSolver.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactPDTerminationTester.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactRegOp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactSearchDirCalc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpInexactTSymScalingMethod.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpIterativePardisoSolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/Inexact/$(DEPDIR)/IpIterativeSolverTerminationTester.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpIterativeWsmpSolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpLinearSolvers.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpLinearSolversRegOp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpMa27TSolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpMa28TDependencyDetector.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpMa57TSolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpMa77SolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpMa86SolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpMa97SolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpMc19TSymScalingMethod.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpMumpsSolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpPardisoMKLSolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpPardisoSolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpSlackBasedTSymScalingMethod.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpSpralSolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpTSymDependencyDetector.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpTSymLinearSolver.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpTripletToCSRConverter.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Algorithm/LinearSolvers/$(DEPDIR)/IpWsmpSolverInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/IpDebug.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/IpJournalist.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/IpLibraryLoader.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/IpObserver.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/IpOptionsList.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/IpRegOptions.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/IpTaggedObject.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/IpUtils.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpInterfacesRegOp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpIpoptApplication.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpSolveStatistics.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpStdCInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpStdFInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpStdInterfaceTNLP.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpStdJInterface.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpTNLP.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpTNLPAdapter.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@Interfaces/$(DEPDIR)/IpTNLPReducer.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpBlas.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpCompoundMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpCompoundSymMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpCompoundVector.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpDenseGenMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpDenseSymMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpDenseVector.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpDiagMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpExpandedMultiVectorMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpExpansionMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpIdentityMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpLapack.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpLowRankUpdateSymMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpMultiVectorMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpScaledMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpSumMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpSumSymMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpSymScaledMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpTransposeMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpVector.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpZeroMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/$(DEPDIR)/IpZeroSymMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/TMatrices/$(DEPDIR)/IpGenTMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/TMatrices/$(DEPDIR)/IpSymTMatrix.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@LinAlg/TMatrices/$(DEPDIR)/IpTripletHelper.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyCq.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyData.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyLSAcceptor.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyRegOp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@contrib/CGPenalty/$(DEPDIR)/IpCGPerturbationHandler.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@contrib/CGPenalty/$(DEPDIR)/IpCGSearchDirCalc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@contrib/CGPenalty/$(DEPDIR)/IpPiecewisePenalty.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.F.o: + $(AM_V_PPF77)$(PPF77COMPILE) -c -o $@ $< + +.F.obj: + $(AM_V_PPF77)$(PPF77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.F.lo: + $(AM_V_PPF77)$(LTPPF77COMPILE) -c -o $@ $< +.F.f: + $(F77COMPILE) -F $< + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +.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@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf Algorithm/.libs Algorithm/_libs + -rm -rf Algorithm/Inexact/.libs Algorithm/Inexact/_libs + -rm -rf Algorithm/LinearSolvers/.libs Algorithm/LinearSolvers/_libs + -rm -rf Common/.libs Common/_libs + -rm -rf Interfaces/.libs Interfaces/_libs + -rm -rf LinAlg/.libs LinAlg/_libs + -rm -rf LinAlg/TMatrices/.libs LinAlg/TMatrices/_libs + -rm -rf contrib/CGPenalty/.libs contrib/CGPenalty/_libs +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 \ + 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 $$?; \ + 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) +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 \ + 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 $$?; \ + 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) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$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; \ + fi +ctags: ctags-recursive + +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) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +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 +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +@BUILD_JAVA_FALSE@all-local: +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) all-local +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfiglibdir)" "$(DESTDIR)$(includeipoptdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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 +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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) + -rm -f Algorithm/$(DEPDIR)/$(am__dirstamp) + -rm -f Algorithm/$(am__dirstamp) + -rm -f Algorithm/Inexact/$(DEPDIR)/$(am__dirstamp) + -rm -f Algorithm/Inexact/$(am__dirstamp) + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/$(am__dirstamp) + -rm -f Algorithm/LinearSolvers/$(am__dirstamp) + -rm -f Common/$(DEPDIR)/$(am__dirstamp) + -rm -f Common/$(am__dirstamp) + -rm -f Interfaces/$(DEPDIR)/$(am__dirstamp) + -rm -f Interfaces/$(am__dirstamp) + -rm -f LinAlg/$(DEPDIR)/$(am__dirstamp) + -rm -f LinAlg/$(am__dirstamp) + -rm -f LinAlg/TMatrices/$(DEPDIR)/$(am__dirstamp) + -rm -f LinAlg/TMatrices/$(am__dirstamp) + -rm -f contrib/CGPenalty/$(DEPDIR)/$(am__dirstamp) + -rm -f contrib/CGPenalty/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f Algorithm/$(DEPDIR)/IpAdaptiveMuUpdate.Plo + -rm -f Algorithm/$(DEPDIR)/IpAlgBuilder.Plo + -rm -f Algorithm/$(DEPDIR)/IpAlgorithmRegOp.Plo + -rm -f Algorithm/$(DEPDIR)/IpAugRestoSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpBacktrackingLineSearch.Plo + -rm -f Algorithm/$(DEPDIR)/IpDefaultIterateInitializer.Plo + -rm -f Algorithm/$(DEPDIR)/IpEquilibrationScaling.Plo + -rm -f Algorithm/$(DEPDIR)/IpExactHessianUpdater.Plo + -rm -f Algorithm/$(DEPDIR)/IpFilter.Plo + -rm -f Algorithm/$(DEPDIR)/IpFilterLSAcceptor.Plo + -rm -f Algorithm/$(DEPDIR)/IpGenAugSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpGradientScaling.Plo + -rm -f Algorithm/$(DEPDIR)/IpIpoptAlg.Plo + -rm -f Algorithm/$(DEPDIR)/IpIpoptCalculatedQuantities.Plo + -rm -f Algorithm/$(DEPDIR)/IpIpoptData.Plo + -rm -f Algorithm/$(DEPDIR)/IpIteratesVector.Plo + -rm -f Algorithm/$(DEPDIR)/IpLeastSquareMults.Plo + -rm -f Algorithm/$(DEPDIR)/IpLimMemQuasiNewtonUpdater.Plo + -rm -f Algorithm/$(DEPDIR)/IpLoqoMuOracle.Plo + -rm -f Algorithm/$(DEPDIR)/IpLowRankAugSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpLowRankSSAugSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpMonotoneMuUpdate.Plo + -rm -f Algorithm/$(DEPDIR)/IpNLPBoundsRemover.Plo + -rm -f Algorithm/$(DEPDIR)/IpNLPScaling.Plo + -rm -f Algorithm/$(DEPDIR)/IpOptErrorConvCheck.Plo + -rm -f Algorithm/$(DEPDIR)/IpOrigIpoptNLP.Plo + -rm -f Algorithm/$(DEPDIR)/IpOrigIterationOutput.Plo + -rm -f Algorithm/$(DEPDIR)/IpPDFullSpaceSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpPDPerturbationHandler.Plo + -rm -f Algorithm/$(DEPDIR)/IpPDSearchDirCalc.Plo + -rm -f Algorithm/$(DEPDIR)/IpPenaltyLSAcceptor.Plo + -rm -f Algorithm/$(DEPDIR)/IpProbingMuOracle.Plo + -rm -f Algorithm/$(DEPDIR)/IpQualityFunctionMuOracle.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoConvCheck.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoFilterConvCheck.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoIpoptNLP.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoIterateInitializer.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoIterationOutput.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoMinC_1Nrm.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoPenaltyConvCheck.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoRestoPhase.Plo + -rm -f Algorithm/$(DEPDIR)/IpStdAugSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpTimingStatistics.Plo + -rm -f Algorithm/$(DEPDIR)/IpUserScaling.Plo + -rm -f Algorithm/$(DEPDIR)/IpWarmStartIterateInitializer.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactAlgBuilder.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactCq.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactData.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactDoglegNormal.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactLSAcceptor.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactNewtonNormal.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactNormalTerminationTester.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactPDSolver.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactPDTerminationTester.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactRegOp.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactSearchDirCalc.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactTSymScalingMethod.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpIterativePardisoSolverInterface.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpIterativeSolverTerminationTester.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpIterativeWsmpSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpLinearSolvers.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpLinearSolversRegOp.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa27TSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa28TDependencyDetector.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa57TSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa77SolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa86SolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa97SolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMc19TSymScalingMethod.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMumpsSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpPardisoMKLSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpPardisoSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpSlackBasedTSymScalingMethod.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpSpralSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpTSymDependencyDetector.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpTSymLinearSolver.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpTripletToCSRConverter.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpWsmpSolverInterface.Plo + -rm -f Common/$(DEPDIR)/IpDebug.Plo + -rm -f Common/$(DEPDIR)/IpJournalist.Plo + -rm -f Common/$(DEPDIR)/IpLibraryLoader.Plo + -rm -f Common/$(DEPDIR)/IpObserver.Plo + -rm -f Common/$(DEPDIR)/IpOptionsList.Plo + -rm -f Common/$(DEPDIR)/IpRegOptions.Plo + -rm -f Common/$(DEPDIR)/IpTaggedObject.Plo + -rm -f Common/$(DEPDIR)/IpUtils.Plo + -rm -f Interfaces/$(DEPDIR)/IpInterfacesRegOp.Plo + -rm -f Interfaces/$(DEPDIR)/IpIpoptApplication.Plo + -rm -f Interfaces/$(DEPDIR)/IpSolveStatistics.Plo + -rm -f Interfaces/$(DEPDIR)/IpStdCInterface.Plo + -rm -f Interfaces/$(DEPDIR)/IpStdFInterface.Plo + -rm -f Interfaces/$(DEPDIR)/IpStdInterfaceTNLP.Plo + -rm -f Interfaces/$(DEPDIR)/IpStdJInterface.Plo + -rm -f Interfaces/$(DEPDIR)/IpTNLP.Plo + -rm -f Interfaces/$(DEPDIR)/IpTNLPAdapter.Plo + -rm -f Interfaces/$(DEPDIR)/IpTNLPReducer.Plo + -rm -f LinAlg/$(DEPDIR)/IpBlas.Plo + -rm -f LinAlg/$(DEPDIR)/IpCompoundMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpCompoundSymMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpCompoundVector.Plo + -rm -f LinAlg/$(DEPDIR)/IpDenseGenMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpDenseSymMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpDenseVector.Plo + -rm -f LinAlg/$(DEPDIR)/IpDiagMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpExpandedMultiVectorMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpExpansionMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpIdentityMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpLapack.Plo + -rm -f LinAlg/$(DEPDIR)/IpLowRankUpdateSymMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpMultiVectorMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpScaledMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpSumMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpSumSymMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpSymScaledMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpTransposeMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpVector.Plo + -rm -f LinAlg/$(DEPDIR)/IpZeroMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpZeroSymMatrix.Plo + -rm -f LinAlg/TMatrices/$(DEPDIR)/IpGenTMatrix.Plo + -rm -f LinAlg/TMatrices/$(DEPDIR)/IpSymTMatrix.Plo + -rm -f LinAlg/TMatrices/$(DEPDIR)/IpTripletHelper.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyCq.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyData.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyLSAcceptor.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyRegOp.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPerturbationHandler.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGSearchDirCalc.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpPiecewisePenalty.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-includeipoptHEADERS install-pkgconfiglibDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-exec-local install-libLTLIBRARIES + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Algorithm/$(DEPDIR)/IpAdaptiveMuUpdate.Plo + -rm -f Algorithm/$(DEPDIR)/IpAlgBuilder.Plo + -rm -f Algorithm/$(DEPDIR)/IpAlgorithmRegOp.Plo + -rm -f Algorithm/$(DEPDIR)/IpAugRestoSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpBacktrackingLineSearch.Plo + -rm -f Algorithm/$(DEPDIR)/IpDefaultIterateInitializer.Plo + -rm -f Algorithm/$(DEPDIR)/IpEquilibrationScaling.Plo + -rm -f Algorithm/$(DEPDIR)/IpExactHessianUpdater.Plo + -rm -f Algorithm/$(DEPDIR)/IpFilter.Plo + -rm -f Algorithm/$(DEPDIR)/IpFilterLSAcceptor.Plo + -rm -f Algorithm/$(DEPDIR)/IpGenAugSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpGradientScaling.Plo + -rm -f Algorithm/$(DEPDIR)/IpIpoptAlg.Plo + -rm -f Algorithm/$(DEPDIR)/IpIpoptCalculatedQuantities.Plo + -rm -f Algorithm/$(DEPDIR)/IpIpoptData.Plo + -rm -f Algorithm/$(DEPDIR)/IpIteratesVector.Plo + -rm -f Algorithm/$(DEPDIR)/IpLeastSquareMults.Plo + -rm -f Algorithm/$(DEPDIR)/IpLimMemQuasiNewtonUpdater.Plo + -rm -f Algorithm/$(DEPDIR)/IpLoqoMuOracle.Plo + -rm -f Algorithm/$(DEPDIR)/IpLowRankAugSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpLowRankSSAugSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpMonotoneMuUpdate.Plo + -rm -f Algorithm/$(DEPDIR)/IpNLPBoundsRemover.Plo + -rm -f Algorithm/$(DEPDIR)/IpNLPScaling.Plo + -rm -f Algorithm/$(DEPDIR)/IpOptErrorConvCheck.Plo + -rm -f Algorithm/$(DEPDIR)/IpOrigIpoptNLP.Plo + -rm -f Algorithm/$(DEPDIR)/IpOrigIterationOutput.Plo + -rm -f Algorithm/$(DEPDIR)/IpPDFullSpaceSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpPDPerturbationHandler.Plo + -rm -f Algorithm/$(DEPDIR)/IpPDSearchDirCalc.Plo + -rm -f Algorithm/$(DEPDIR)/IpPenaltyLSAcceptor.Plo + -rm -f Algorithm/$(DEPDIR)/IpProbingMuOracle.Plo + -rm -f Algorithm/$(DEPDIR)/IpQualityFunctionMuOracle.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoConvCheck.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoFilterConvCheck.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoIpoptNLP.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoIterateInitializer.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoIterationOutput.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoMinC_1Nrm.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoPenaltyConvCheck.Plo + -rm -f Algorithm/$(DEPDIR)/IpRestoRestoPhase.Plo + -rm -f Algorithm/$(DEPDIR)/IpStdAugSystemSolver.Plo + -rm -f Algorithm/$(DEPDIR)/IpTimingStatistics.Plo + -rm -f Algorithm/$(DEPDIR)/IpUserScaling.Plo + -rm -f Algorithm/$(DEPDIR)/IpWarmStartIterateInitializer.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactAlgBuilder.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactCq.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactData.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactDoglegNormal.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactLSAcceptor.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactNewtonNormal.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactNormalTerminationTester.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactPDSolver.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactPDTerminationTester.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactRegOp.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactSearchDirCalc.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpInexactTSymScalingMethod.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpIterativePardisoSolverInterface.Plo + -rm -f Algorithm/Inexact/$(DEPDIR)/IpIterativeSolverTerminationTester.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpIterativeWsmpSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpLinearSolvers.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpLinearSolversRegOp.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa27TSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa28TDependencyDetector.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa57TSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa77SolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa86SolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMa97SolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMc19TSymScalingMethod.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpMumpsSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpPardisoMKLSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpPardisoSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpSlackBasedTSymScalingMethod.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpSpralSolverInterface.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpTSymDependencyDetector.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpTSymLinearSolver.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpTripletToCSRConverter.Plo + -rm -f Algorithm/LinearSolvers/$(DEPDIR)/IpWsmpSolverInterface.Plo + -rm -f Common/$(DEPDIR)/IpDebug.Plo + -rm -f Common/$(DEPDIR)/IpJournalist.Plo + -rm -f Common/$(DEPDIR)/IpLibraryLoader.Plo + -rm -f Common/$(DEPDIR)/IpObserver.Plo + -rm -f Common/$(DEPDIR)/IpOptionsList.Plo + -rm -f Common/$(DEPDIR)/IpRegOptions.Plo + -rm -f Common/$(DEPDIR)/IpTaggedObject.Plo + -rm -f Common/$(DEPDIR)/IpUtils.Plo + -rm -f Interfaces/$(DEPDIR)/IpInterfacesRegOp.Plo + -rm -f Interfaces/$(DEPDIR)/IpIpoptApplication.Plo + -rm -f Interfaces/$(DEPDIR)/IpSolveStatistics.Plo + -rm -f Interfaces/$(DEPDIR)/IpStdCInterface.Plo + -rm -f Interfaces/$(DEPDIR)/IpStdFInterface.Plo + -rm -f Interfaces/$(DEPDIR)/IpStdInterfaceTNLP.Plo + -rm -f Interfaces/$(DEPDIR)/IpStdJInterface.Plo + -rm -f Interfaces/$(DEPDIR)/IpTNLP.Plo + -rm -f Interfaces/$(DEPDIR)/IpTNLPAdapter.Plo + -rm -f Interfaces/$(DEPDIR)/IpTNLPReducer.Plo + -rm -f LinAlg/$(DEPDIR)/IpBlas.Plo + -rm -f LinAlg/$(DEPDIR)/IpCompoundMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpCompoundSymMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpCompoundVector.Plo + -rm -f LinAlg/$(DEPDIR)/IpDenseGenMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpDenseSymMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpDenseVector.Plo + -rm -f LinAlg/$(DEPDIR)/IpDiagMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpExpandedMultiVectorMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpExpansionMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpIdentityMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpLapack.Plo + -rm -f LinAlg/$(DEPDIR)/IpLowRankUpdateSymMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpMultiVectorMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpScaledMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpSumMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpSumSymMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpSymScaledMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpTransposeMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpVector.Plo + -rm -f LinAlg/$(DEPDIR)/IpZeroMatrix.Plo + -rm -f LinAlg/$(DEPDIR)/IpZeroSymMatrix.Plo + -rm -f LinAlg/TMatrices/$(DEPDIR)/IpGenTMatrix.Plo + -rm -f LinAlg/TMatrices/$(DEPDIR)/IpSymTMatrix.Plo + -rm -f LinAlg/TMatrices/$(DEPDIR)/IpTripletHelper.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyCq.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyData.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyLSAcceptor.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPenaltyRegOp.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGPerturbationHandler.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpCGSearchDirCalc.Plo + -rm -f contrib/CGPenalty/$(DEPDIR)/IpPiecewisePenalty.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-includeipoptHEADERS uninstall-libLTLIBRARIES \ + uninstall-local uninstall-pkgconfiglibDATA + +.MAKE: $(am__recursive_targets) all check install install-am \ + install-exec install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \ + am--depfiles check check-am clean 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-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-exec-local 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 \ + installdirs-am 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-includeipoptHEADERS \ + uninstall-libLTLIBRARIES uninstall-local \ + uninstall-pkgconfiglibDATA + +.PRECIOUS: Makefile + + +@BUILD_JAVA_TRUE@org.coinor.ipopt.jar : org/coinor/Ipopt.class +@BUILD_JAVA_TRUE@ $(JAR) cf $@ $< + +# replace double by float in Ipopt.java; filename needs to be Ipopt.java, so put into subdir +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_TRUE@Ipopt.java : $(srcdir)/Interfaces/Ipopt.java +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_TRUE@ sed -e s/double/float/g $< > $@ + +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_TRUE@org/coinor/Ipopt.class org_coinor_Ipopt.h : Ipopt.java +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_TRUE@ $(JAVAC) $< -d $(PWD) -h $(PWD) +# had -target 1.8 -source 1.8, but that produces a warning if Java 8 RT is not setup +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_FALSE@org/coinor/Ipopt.class org_coinor_Ipopt.h : Interfaces/Ipopt.java +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_FALSE@ $(JAVAC) $< -d $(PWD) -h $(PWD) + +@BUILD_JAVA_TRUE@all-local : org.coinor.ipopt.jar + +install-exec-local: + $(install_sh_DATA) Common/config_ipopt.h $(DESTDIR)$(includeipoptdir)/IpoptConfig.h +@BUILD_JAVA_TRUE@ $(MKDIR_P) "$(DESTDIR)$(datadir)/java" +@BUILD_JAVA_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) org.coinor.ipopt.jar "$(DESTDIR)$(datadir)/java" + +uninstall-local: + rm -f $(DESTDIR)$(includeipoptdir)/IpoptConfig.h +@BUILD_JAVA_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(datadir)/java/org.coinor.ipopt.jar" + +# 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/contrib/CGPenalty/IpCGPenaltyCq.cpp b/src/contrib/CGPenalty/IpCGPenaltyCq.cpp index 785991ea3..bb6975622 100644 --- a/src/contrib/CGPenalty/IpCGPenaltyCq.cpp +++ b/src/contrib/CGPenalty/IpCGPenaltyCq.cpp @@ -83,11 +83,11 @@ Number CGPenaltyCq::curr_jac_cd_norm( { if( nrm_type == 3 ) { - result = Max(result, fabs(values[i])); + result = Max(result, std::abs(values[i])); } if( nrm_type == 1 ) { - result += fabs(values[i]); + result += std::abs(values[i]); count++; } } @@ -100,11 +100,11 @@ Number CGPenaltyCq::curr_jac_cd_norm( { if( nrm_type == 3 ) { - result = Max(result, fabs(values[i])); + result = Max(result, std::abs(values[i])); } if( nrm_type == 1 ) { - result += fabs(values[i]); + result += std::abs(values[i]); count++; } } @@ -230,6 +230,7 @@ Number CGPenaltyCq::curr_fast_direct_deriv_penalty_function() Number result; SmartPtr x = ip_data_->curr()->x(); SmartPtr s = ip_data_->curr()->s(); + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(CGPenData().HaveCgPenDeltas()); SmartPtr dy_c = CGPenData().delta_cgfast()->y_c(); SmartPtr dy_d = CGPenData().delta_cgfast()->y_d(); @@ -348,8 +349,8 @@ Number CGPenaltyCq::compute_curr_cg_penalty( Number d_xs_times_damped_Hessian_times_d_xs = -deriv_barrier_dx_ds; d_xs_times_damped_Hessian_times_d_xs += -(tem_jac_cT_times_y_c_plus_dy_c->Dot(*d_x) + tem_jac_dT_times_y_d_plus_dy_d->Dot(*d_x) - y_d->Dot(*d_s) - dy_d->Dot(*d_s)); - Number dxs_nrm = pow(d_x->Nrm2(), 2.) + pow(d_s->Nrm2(), 2.); - d_xs_times_damped_Hessian_times_d_xs = Max(1e-8 * dxs_nrm, d_xs_times_damped_Hessian_times_d_xs); + Number dxs_nrm = std::pow(d_x->Nrm2(), 2.) + std::pow(d_s->Nrm2(), 2.); + d_xs_times_damped_Hessian_times_d_xs = Max(Number(1e-8) * dxs_nrm, d_xs_times_damped_Hessian_times_d_xs); Number infeasibility = ip_cq_->curr_primal_infeasibility(NORM_2); Number penalty = 0.; if( infeasibility > 0. ) @@ -393,7 +394,7 @@ Number CGPenaltyCq::compute_curr_cg_penalty_scale() Number infeasibility = ip_cq_->curr_primal_infeasibility(NORM_2); if( !CGPenData().NeverTryPureNewton() ) { - penalty = Min(1e13, infeasibility * 1e9); + penalty = Min(Number(1e13), infeasibility * Number(1e9)); } else { @@ -403,12 +404,12 @@ Number CGPenaltyCq::compute_curr_cg_penalty_scale() / (ip_data_->curr()->y_c()->Dim() + ip_data_->curr()->y_d()->Dim())) / 2.; if( CGPenData().restor_iter() == ip_data_->iter_count() || ip_data_->iter_count() == 0 ) { - reference_infeasibility_ = Min(1., infeasibility); + reference_infeasibility_ = Min(Number(1.), infeasibility); } Number i = CGPenData().restor_counter(); - Number fac = 4 * 1e-2 * pow(1e1, i); + Number fac = 4. * 1e-2 * std::pow(1e1, i); //Number fac = 1e-2; - penalty = Min(1e4, infeasibility) / (reference * fac * pow(reference_infeasibility_, 1)); + penalty = Min(Number(1e4), infeasibility) / (reference * fac * std::pow(reference_infeasibility_, 1)); } return penalty; @@ -430,7 +431,7 @@ Number CGPenaltyCq::curr_scaled_y_Amax() if( !curr_scaled_y_Amax_cache_.GetCachedResult(result, deps) ) { result = Max(y_c->Amax(), y_d->Amax()); - result /= Max(1., ip_cq_->curr_grad_f()->Amax()); + result /= Max(Number(1.), ip_cq_->curr_grad_f()->Amax()); curr_scaled_y_Amax_cache_.AddCachedResult(result, deps); } return result; @@ -455,7 +456,7 @@ Number CGPenaltyCq::curr_added_y_nrm2() SmartPtr y_d_plus_dy_d = ip_data_->delta()->y_d()->MakeNew(); y_c_plus_dy_c->AddTwoVectors(1., *ip_data_->delta()->y_c(), 1., *ip_data_->curr()->y_c(), 0.); y_d_plus_dy_d->AddTwoVectors(1., *ip_data_->delta()->y_d(), 1., *ip_data_->curr()->y_d(), 0.); - result = sqrt(pow(y_c_plus_dy_c->Nrm2(), 2) + pow(y_d_plus_dy_d->Nrm2(), 2)); + result = std::sqrt(std::pow(y_c_plus_dy_c->Nrm2(), 2) + std::pow(y_d_plus_dy_d->Nrm2(), 2)); curr_added_y_nrm2_cache_.AddCachedResult(result, deps); } return result; diff --git a/src/contrib/CGPenalty/IpCGPenaltyCq.hpp b/src/contrib/CGPenalty/IpCGPenaltyCq.hpp index 6261609c3..34a03a26d 100644 --- a/src/contrib/CGPenalty/IpCGPenaltyCq.hpp +++ b/src/contrib/CGPenalty/IpCGPenaltyCq.hpp @@ -22,7 +22,7 @@ class CGPenaltyCq: public IpoptAdditionalCq public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ CGPenaltyCq( IpoptNLP* ip_nlp, @@ -32,7 +32,7 @@ class CGPenaltyCq: public IpoptAdditionalCq /** Default destructor */ virtual ~CGPenaltyCq(); - //@} + ///@} /** This method must be called to initialize the global * algorithmic parameters. @@ -46,7 +46,7 @@ class CGPenaltyCq: public IpoptAdditionalCq ); /**@name Methods for the Chen-Goldfarb line search */ - //@{ + ///@{ /** Compute ||delta_c, delta_d||_infty */ Number curr_jac_cd_norm( Index nrm_type @@ -82,14 +82,14 @@ class CGPenaltyCq: public IpoptAdditionalCq /** Method for choose penalty parameters for scaling the KKT system */ Number compute_curr_cg_penalty_scale(); - //@} + ///@} /** Methods for IpoptType */ - //@{ + ///@{ static void RegisterOptions( const SmartPtr& roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -101,7 +101,7 @@ class CGPenaltyCq: public IpoptAdditionalCq * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ CGPenaltyCq(); @@ -114,27 +114,28 @@ class CGPenaltyCq: public IpoptAdditionalCq void operator=( const CGPenaltyCq& ); - //@} + ///@} /** @name Pointers for easy access to data and NLP information. To * avoid circular references of Smart Pointers, we use a regular * pointer here. */ - //@{ + ///@{ IpoptNLP* ip_nlp_; IpoptData* ip_data_; IpoptCalculatedQuantities* ip_cq_; - //@} + ///@} /** Method to easily access CGPenalty data */ CGPenaltyData& CGPenData() { CGPenaltyData& cg_pen_data = static_cast(ip_data_->AdditionalData()); + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(dynamic_cast(&ip_data_->AdditionalData())); return cg_pen_data; } /**@name Caches for the Chen-Goldfarb line search */ - //@{ + ///@{ CachedResults curr_fast_direct_deriv_penalty_function_cache_; CachedResults curr_jac_cd_norm_cache_; CachedResults curr_scaled_y_Amax_cache_; @@ -148,12 +149,12 @@ class CGPenaltyCq: public IpoptAdditionalCq CachedResults curr_direct_deriv_penalty_function_cache_; /** Cache for Chen-Goldfarb perturbation factor. */ CachedResults curr_cg_pert_fact_cache_; - //@} + ///@} /** Parameters for penalty method */ - //@{ + ///@{ Number reference_infeasibility_; - //@} + ///@} /** flag indicating if Initialize method has been called (for * debugging) */ diff --git a/src/contrib/CGPenalty/IpCGPenaltyData.cpp b/src/contrib/CGPenalty/IpCGPenaltyData.cpp index 6a69c7e33..9f931628f 100644 --- a/src/contrib/CGPenalty/IpCGPenaltyData.cpp +++ b/src/contrib/CGPenalty/IpCGPenaltyData.cpp @@ -29,8 +29,6 @@ bool CGPenaltyData::Initialize( penalty_initialized_ = false; kkt_penalty_initialized_ = false; - have_cgpen_deltas_ = false; - have_cgfast_deltas_ = false; curr_penalty_pert_ = 0.; max_alpha_x_ = 1.; never_try_pure_Newton_ = false; diff --git a/src/contrib/CGPenalty/IpCGPenaltyData.hpp b/src/contrib/CGPenalty/IpCGPenaltyData.hpp index d52b31d3c..6f3d467d1 100644 --- a/src/contrib/CGPenalty/IpCGPenaltyData.hpp +++ b/src/contrib/CGPenalty/IpCGPenaltyData.hpp @@ -22,13 +22,13 @@ class CGPenaltyData: public IpoptAdditionalData { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ CGPenaltyData(); /** Destructor */ ~CGPenaltyData(); - //@} + ///@} /** This method must be called to initialize the global * algorithmic parameters. @@ -86,7 +86,7 @@ class CGPenaltyData: public IpoptAdditionalData * Those fields can be used to store * directions related to the Chen-Goldfarb algorithm */ - //@{ + ///@{ bool HaveCgPenDeltas() const { return have_cgpen_deltas_; @@ -110,13 +110,13 @@ class CGPenaltyData: public IpoptAdditionalData { have_cgfast_deltas_ = have_cgfast_deltas; } - //@} + ///@} /** @name Public Methods for updating iterates */ - //@{ + ///@{ /** Set the current iterate values from the trial values. */ void AcceptTrialPoint(); - //@} + ///@} Number CurrPenaltyPert() { @@ -233,16 +233,16 @@ class CGPenaltyData: public IpoptAdditionalData * computation of the overall search direction to the line * search. */ - //@{ + ///@{ SmartPtr delta_cgpen_; /** The following flag is set to true, if some other part of the * algorithm has already computed the Chen-Goldfarb step. This * flag is reset when the AcceptTrialPoint method is called. - * @todo we could cue off of a null delta_cgpen_ */ + // ToDo we could cue off of a null delta_cgpen_ bool have_cgpen_deltas_; - //@} + ///@} /** @name Fast Chen-Goldfarb step for the penalty function. * @@ -250,20 +250,20 @@ class CGPenaltyData: public IpoptAdditionalData * computation of the overall search direction to the line * search. */ - //@{ + ///@{ SmartPtr delta_cgfast_; /** The following flag is set to true, if some other part of the * algorithm has already computed the fast Chen-Goldfarb step. * * This flag is reset when the AcceptTrialPoint method is called. - * @todo we could cue off of a null delta_cgfast_ */ + // ToDo we could cue off of a null delta_cgfast_ bool have_cgfast_deltas_; - //@} + ///@} /** @name penalty method **/ - //@{ + ///@{ /** Flag indicating whether the pure Newton method is used */ bool never_try_pure_Newton_; @@ -278,7 +278,7 @@ class CGPenaltyData: public IpoptAdditionalData bool kkt_penalty_initialized_; Number curr_penalty_pert_; Number max_alpha_x_; - //@} + ///@} /** flag indicating if Initialize method has been called (for debugging) */ bool initialize_called_; @@ -292,7 +292,7 @@ class CGPenaltyData: public IpoptAdditionalData * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ CGPenaltyData( const CGPenaltyData& @@ -302,18 +302,18 @@ class CGPenaltyData: public IpoptAdditionalData void operator=( const CGPenaltyData& ); - //@} + ///@} #if IPOPT_CHECKLEVEL > 0 /** Some debug flags to make sure vectors are not changed * behind the CGPenaltyData's back */ - //@{ + ///@{ TaggedObject::Tag debug_delta_cgpen_tag_; TaggedObject::Tag debug_delta_cgfast_tag_; TaggedObject::Tag debug_delta_cgpen_tag_sum_; TaggedObject::Tag debug_delta_cgfast_tag_sum_; - //@} + ///@} #endif }; diff --git a/src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.cpp b/src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.cpp index cbfce6ee2..8975527df 100644 --- a/src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.cpp +++ b/src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.cpp @@ -44,12 +44,10 @@ void CGPenaltyLSAcceptor::RegisterOptions( SmartPtr roptions ) { - roptions->AddStringOption2( + roptions->AddBoolOption( "never_use_piecewise_penalty_ls", "Toggle to switch off the piecewise penalty method", - "no", - "no", "always use the piecewise penalty method", - "yes", "never use the piecewise penalty method"); + false); roptions->AddBoundedNumberOption( "eta_penalty", "Relaxation factor in the Armijo condition for the penalty function.", @@ -64,9 +62,11 @@ void CGPenaltyLSAcceptor::RegisterOptions( "If the new constraint violation is smaller than this tolerance, the penalty parameter is not increased."); roptions->AddLowerBoundedNumberOption( "eta_min", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 1e1); + 1e1, + "", + true); roptions->AddLowerBoundedNumberOption( "pen_theta_max_fact", "Determines upper bound for constraint violation in the filter.", @@ -78,71 +78,96 @@ void CGPenaltyLSAcceptor::RegisterOptions( "(see Eqn. (21) in implementation paper)."); roptions->AddLowerBoundedNumberOption( "penalty_update_compl_tol", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 1e1); + 1e1, + "", + true); roptions->AddLowerBoundedNumberOption( "chi_hat", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 2.); + 2., + "", + true); roptions->AddLowerBoundedNumberOption( "chi_tilde", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 5.); + 5., + "", + true); roptions->AddLowerBoundedNumberOption( "chi_cup", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 1.5); + 1.5, + "", + true); roptions->AddLowerBoundedNumberOption( "gamma_hat", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 0.04); + 0.04, + "", + true); roptions->AddLowerBoundedNumberOption( "gamma_tilde", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 4.); + 4., + "", + true); roptions->AddLowerBoundedNumberOption( "epsilon_c", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 1e-2); + 1e-2, + "", + true); roptions->AddLowerBoundedNumberOption( "piecewisepenalty_gamma_obj", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 1e-13); + 1e-13, + "", + true); roptions->AddLowerBoundedNumberOption( "piecewisepenalty_gamma_infeasi", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 1e-13); + 1e-13, + "", + true); roptions->AddLowerBoundedNumberOption( "min_alpha_primal", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 1e-13); + 1e-13, + "", + true); roptions->AddLowerBoundedNumberOption( "theta_min", - "LIFENG WRITES THIS.", + "", // TODO LIFENG WRITES THIS 0., true, - 1e-6); + 1e-6, + "", + true); roptions->AddLowerBoundedNumberOption( "mult_diverg_feasibility_tol", "tolerance for deciding if the multipliers are diverging", 0., true, - 1e-7); + 1e-7, + "", + true); roptions->AddLowerBoundedNumberOption( "mult_diverg_y_tol", "tolerance for deciding if the multipliers are diverging", 0., true, - 1e8); - + 1e8, + "", + true); } bool CGPenaltyLSAcceptor::InitializeImpl( @@ -257,7 +282,6 @@ bool CGPenaltyLSAcceptor::CheckAcceptabilityOfTrialPoint( Number curr_infeasi = IpCq().curr_constraint_violation(); //Number trial_barr = IpCq().trial_barrier_obj(); Number trial_infeasi = IpCq().trial_constraint_violation(); - bool accept = false; ls_counter_++; if( ls_counter_ == 1 ) { @@ -285,7 +309,7 @@ bool CGPenaltyLSAcceptor::CheckAcceptabilityOfTrialPoint( // Initialize the max infeasibility that's allowed for every iteration, if( pen_theta_max_ < 0. ) { - pen_theta_max_ = pen_theta_max_fact_ * Max(1.0, reference_theta_); + pen_theta_max_ = pen_theta_max_fact_ * Max(Number(1.0), reference_theta_); } // Check if the constraint violation is becoming too large. If the violation // is bigger than pen_theta_max_, the trial point is rejected. @@ -296,10 +320,7 @@ bool CGPenaltyLSAcceptor::CheckAcceptabilityOfTrialPoint( return false; } // Check Armijo conditions. - if( !accept ) - { - accept = ArmijoHolds(alpha_primal_test); - } + bool accept = ArmijoHolds(alpha_primal_test); // Check PLPF criteria. if( !accept && !never_use_piecewise_penalty_ls_ ) { @@ -348,7 +369,7 @@ bool CGPenaltyLSAcceptor::IsAcceptableToPiecewisePenalty( SmartPtr ds = IpData().delta()->s(); Number curr_barr = IpCq().curr_barrier_obj(); Number trial_barr = IpCq().trial_barrier_obj(); - Number nrm_dx_ds = pow(dx->Nrm2(), 2.) + pow(ds->Nrm2(), 2.); + Number nrm_dx_ds = std::pow(dx->Nrm2(), 2.) + std::pow(ds->Nrm2(), 2.); if( infeasibility < theta_min_ ) { Number biggest_barr = PiecewisePenalty_.BiggestBarr(); @@ -403,7 +424,7 @@ bool CGPenaltyLSAcceptor::Compare_le( dbg_verbosity); DBG_PRINT((1, "lhs = %27.16e rhs = %27.16e BasVal = %27.16e\n", lhs, rhs, BasVal)); Number mach_eps = std::numeric_limits::epsilon(); - return (lhs - rhs <= 10. * mach_eps * fabs(BasVal)); + return (lhs - rhs <= 10. * mach_eps * std::abs(BasVal)); } void CGPenaltyLSAcceptor::StartWatchDog() @@ -463,7 +484,7 @@ bool CGPenaltyLSAcceptor::TrySecondOrderCorrection( theta_soc_old = theta_trial; theta_soc_old2 = theta_trial2; Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Trying second order correction number %d\n", count_soc + 1); + "Trying second order correction number %" IPOPT_INDEX_FORMAT "\n", count_soc + 1); // Compute SOC constraint violation /* Number c_over_r = 0.; @@ -513,7 +534,7 @@ bool CGPenaltyLSAcceptor::TrySecondOrderCorrection( if( accept ) { Jnlst().Printf(J_DETAILED, J_LINE_SEARCH, - "Second order correction step accepted with %d corrections.\n", count_soc + 1); + "Second order correction step accepted with %" IPOPT_INDEX_FORMAT " corrections.\n", count_soc + 1); // Accept all SOC quantities alpha_primal = alpha_primal_soc; actual_delta = delta_soc; @@ -694,7 +715,7 @@ char CGPenaltyLSAcceptor::UpdatePenaltyParameter() // We use the new infeasibility here... Number trial_inf = IpCq().trial_primal_infeasibility(NORM_2); Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, - "trial infeasibility = %8.2\n", trial_inf); + "trial infeasibility = %8.2g\n", trial_inf); if( curr_eta_ < 0. ) { // We need to initialize the eta tolerance @@ -712,7 +733,7 @@ char CGPenaltyLSAcceptor::UpdatePenaltyParameter() { Number max_step = Max(CGPenData().delta_cgpen()->x()->Amax(), CGPenData().delta_cgpen()->s()->Amax()); Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, - "Max norm of step = %8.2\n", max_step); + "Max norm of step = %8.2g\n", max_step); increase = (max_step <= curr_eta_); if( !increase ) { @@ -751,9 +772,9 @@ char CGPenaltyLSAcceptor::UpdatePenaltyParameter() max_compl = Max(max_compl, compl_s_U->Max()); } Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, - "Minimal compl = %8.2\n", min_compl); + "Minimal compl = %8.2g\n", min_compl); Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, - "Maximal compl = %8.2\n", max_compl); + "Maximal compl = %8.2g\n", max_compl); increase = (min_compl >= mu * penalty_update_compl_tol_ && max_compl <= mu / penalty_update_compl_tol_); if( !increase ) { @@ -765,20 +786,18 @@ char CGPenaltyLSAcceptor::UpdatePenaltyParameter() if( increase ) { SmartPtr vec = IpData().curr()->y_c()->MakeNewCopy(); - vec->AddTwoVectors(1., *CGPenData().delta_cgpen()->y_c(), -1. / CGPenCq().curr_cg_pert_fact(), *IpCq().curr_c(), - 1.); + vec->AddTwoVectors(1., *CGPenData().delta_cgpen()->y_c(), -1. / CGPenCq().curr_cg_pert_fact(), *IpCq().curr_c(), 1.); Number omega_test = vec->Amax(); Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, - "omega_test for c = %8.2\n", omega_test); + "omega_test for c = %8.2g\n", omega_test); increase = (omega_test < curr_eta_); if( increase ) { - SmartPtr vec = IpData().curr()->y_d()->MakeNewCopy(); - vec->AddTwoVectors(1., *IpData().delta()->y_d(), -1. / CGPenCq().curr_cg_pert_fact(), *IpCq().curr_d_minus_s(), - 1.); + vec = IpData().curr()->y_d()->MakeNewCopy(); + vec->AddTwoVectors(1., *IpData().delta()->y_d(), -1. / CGPenCq().curr_cg_pert_fact(), *IpCq().curr_d_minus_s(), 1.); omega_test = vec->Amax(); Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, - "omega_test for d = %8.2\n", omega_test); + "omega_test for d = %8.2g\n", omega_test); increase = (omega_test < curr_eta_); } if( !increase ) @@ -791,9 +810,9 @@ char CGPenaltyLSAcceptor::UpdatePenaltyParameter() // Ok, now we should increase the penalty parameter counter_first_type_penalty_updates_++; // Update the eta tolerance - curr_eta_ = Max(eta_min_, curr_eta_ / 2.); + curr_eta_ = Max(eta_min_, curr_eta_ / Number(2.)); Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, - "Updating eta to = %8.2\n", curr_eta_); + "Updating eta to = %8.2g\n", curr_eta_); Number penalty = CGPenData().curr_kkt_penalty(); Number y_full_step_max; SmartPtr vec = IpData().curr()->y_c()->MakeNew(); @@ -804,7 +823,7 @@ char CGPenaltyLSAcceptor::UpdatePenaltyParameter() y_full_step_max = Max(y_full_step_max, vec->Amax()); if( IpCq().curr_primal_infeasibility(NORM_2) >= epsilon_c_ ) { - penalty = Max(chi_hat_ * penalty, y_full_step_max + 1.); + penalty = Max(chi_hat_ * penalty, y_full_step_max + Number(1.)); info_alpha_primal_char = 'l'; } else diff --git a/src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.hpp b/src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.hpp index d3f49c63d..8a280cdbd 100644 --- a/src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.hpp +++ b/src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.hpp @@ -22,7 +22,7 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor. * * The PDSystemSolver object only needs to be @@ -35,7 +35,7 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor /** Destructor */ virtual ~CGPenaltyLSAcceptor(); - //@} + ///@} virtual bool InitializeImpl( const OptionsList& options, @@ -152,11 +152,11 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor virtual bool DoFallback(); /** Methods for OptionsList */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -168,7 +168,7 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ CGPenaltyLSAcceptor( const CGPenaltyLSAcceptor& @@ -178,7 +178,7 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor void operator=( const CGPenaltyLSAcceptor& ); - //@} + ///@} /** Method to easily access CGPenalty data */ CGPenaltyData& CGPenData() @@ -206,10 +206,8 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor Number alpha_primal_test ); - /** Check comparison "lhs <= rhs", using machine precision based on BasVal - * - * @todo This should probably not be a static member function if we want to allow for different relaxation parameters values - */ + /** Check comparison "lhs <= rhs", using machine precision based on BasVal */ + // ToDo This should probably not be a static member function if we want to allow for different relaxation parameters values static bool Compare_le( Number lhs, Number rhs, @@ -223,7 +221,7 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor char UpdatePenaltyParameter(); /** @name Parameters for the penalty function algorithm. */ - //@{ + ///@{ /** Relaxation factor in the Armijo condition for the penalty function */ Number eta_penalty_; /** Tolerance for infeasibility part in penalty parameter update @@ -245,11 +243,11 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor /** Parameters for piecewise penalty acceptor */ Number piecewisepenalty_gamma_obj_; Number piecewisepenalty_gamma_infeasi_; - //@{ + ///@{ /** Upper bound on infeasibility */ Number pen_theta_max_; Number pen_theta_max_fact_; - //@} + ///@} // Number used to indicate that mu has been decreased Number pen_curr_mu_; @@ -264,17 +262,17 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor /** Minimal step size that triggers non-monotone method */ Number min_alpha_primal_; - //@{ + ///@{ /** Initial constraint violation */ Number reference_theta_; - //@} + ///@} /** Maximal number of second order correction steps */ Index max_soc_; /** Required reduction in constraint violation before trying * multiple second order correction steps \f$ \kappa_{soc}\f$. */ Number kappa_soc_; - //@} + ///@} /** Counter for increases of penalty parameter. */ Index counter_first_type_penalty_updates_; Index counter_second_type_penalty_updates_; @@ -292,7 +290,7 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor Number mult_diverg_y_tol_; /** @name Information related to watchdog procedure */ - //@{ + ///@{ /** Penalty function at the point with respect to which * progress is to be made */ Number reference_penalty_function_; @@ -309,7 +307,7 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor /** Backup for the Chen-Goldfarb search direction (needed in the * update rule for the penalty parameter */ SmartPtr watchdog_delta_cgpen_; - //@} + ///@} /** Flag for whether or not use piecewise penalty line search */ bool never_use_piecewise_penalty_ls_; /** piecewise penalty list */ @@ -320,9 +318,9 @@ class CGPenaltyLSAcceptor: public BacktrackingLSAcceptor Index jump_for_tiny_step_; /** @name Strategy objective that are used */ - //@{ + ///@{ SmartPtr pd_solver_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/contrib/CGPenalty/IpCGPenaltyRegOp.cpp b/src/contrib/CGPenalty/IpCGPenaltyRegOp.cpp index a60f4126b..2a1cc9f43 100644 --- a/src/contrib/CGPenalty/IpCGPenaltyRegOp.cpp +++ b/src/contrib/CGPenalty/IpCGPenaltyRegOp.cpp @@ -18,7 +18,7 @@ void RegisterOptions_CGPenalty( const SmartPtr& roptions ) { - roptions->SetRegisteringCategory("Undocumented"); + roptions->SetRegisteringCategory("CG Penalty"); CGSearchDirCalculator::RegisterOptions(roptions); CGPenaltyLSAcceptor::RegisterOptions(roptions); CGPenaltyCq::RegisterOptions(roptions); diff --git a/src/contrib/CGPenalty/IpCGPerturbationHandler.cpp b/src/contrib/CGPenalty/IpCGPerturbationHandler.cpp index c4f67f61c..ebea523e9 100644 --- a/src/contrib/CGPenalty/IpCGPerturbationHandler.cpp +++ b/src/contrib/CGPenalty/IpCGPerturbationHandler.cpp @@ -18,9 +18,7 @@ static const Index dbg_verbosity = 0; #endif CGPerturbationHandler::CGPerturbationHandler() - : PDPerturbationHandler(), - reset_last_(false), - degen_iters_max_(3) + : PDPerturbationHandler() { } void CGPerturbationHandler::RegisterOptions( @@ -33,40 +31,10 @@ bool CGPerturbationHandler::InitializeImpl( const std::string& prefix ) { - options.GetNumericValue("max_hessian_perturbation", delta_xs_max_, prefix); - options.GetNumericValue("min_hessian_perturbation", delta_xs_min_, prefix); - options.GetNumericValue("perturb_inc_fact_first", delta_xs_first_inc_fact_, prefix); - options.GetNumericValue("perturb_inc_fact", delta_xs_inc_fact_, prefix); - options.GetNumericValue("perturb_dec_fact", delta_xs_dec_fact_, prefix); - options.GetNumericValue("first_hessian_perturbation", delta_xs_init_, prefix); - options.GetNumericValue("jacobian_regularization_value", delta_cd_val_, prefix); - options.GetNumericValue("jacobian_regularization_exponent", delta_cd_exp_, prefix); - options.GetBoolValue("perturb_always_cd", perturb_always_cd_, prefix); // The following option has been registered from CGSearchDirCalc options.GetNumericValue("penalty_max", penalty_max_, prefix); // The following option has been registered from CGPenaltyLSAccepter options.GetNumericValue("mult_diverg_feasibility_tol", mult_diverg_feasibility_tol_, prefix); - hess_degenerate_ = NOT_YET_DETERMINED; - if( !perturb_always_cd_ ) - { - jac_degenerate_ = NOT_YET_DETERMINED; - } - else - { - jac_degenerate_ = NOT_DEGENERATE; - } - degen_iters_ = 0; - - delta_x_curr_ = 0.; - delta_s_curr_ = 0.; - delta_c_curr_ = 0.; - delta_d_curr_ = 0.; - delta_x_last_ = 0.; - delta_s_last_ = 0.; - delta_c_last_ = 0.; - delta_d_last_ = 0.; - - test_status_ = NO_TEST; return PDPerturbationHandler::InitializeImpl(options, prefix); } @@ -87,8 +55,6 @@ bool CGPerturbationHandler::ConsiderNewSystem( // initialize perturbationhandler data if( CGPenData().restor_iter() == IpData().iter_count() ) { - hess_degenerate_ = NOT_YET_DETERMINED; - jac_degenerate_ = NOT_YET_DETERMINED; degen_iters_ = 0; hess_degenerate_ = NOT_DEGENERATE; jac_degenerate_ = NOT_DEGENERATE; @@ -326,7 +292,7 @@ bool CGPerturbationHandler::PerturbForSingularity( penalty = Min(penalty_max_, Max(penalty, CGPenData().curr_kkt_penalty())); CGPenData().Set_kkt_penalty(penalty); Number mach_pro = std::numeric_limits::epsilon(); - delta_d_curr_ = delta_c_curr_ = Max(1e3 * mach_pro, Max(CGPenCq().curr_cg_pert_fact(), delta_cd())); + delta_d_curr_ = delta_c_curr_ = Max(Number(1e3) * mach_pro, Max(CGPenCq().curr_cg_pert_fact(), delta_cd())); IpData().Append_info_string("u"); } } @@ -342,178 +308,4 @@ bool CGPerturbationHandler::PerturbForSingularity( return true; } -bool CGPerturbationHandler::get_deltas_for_wrong_inertia( - Number& delta_x, - Number& delta_s, - Number& delta_c, - Number& delta_d -) -{ - if( delta_x_curr_ == 0. ) - { - if( delta_x_last_ == 0. ) - { - delta_x_curr_ = delta_xs_init_; - } - else - { - delta_x_curr_ = Max(delta_xs_min_, delta_x_last_ * delta_xs_dec_fact_); - } - } - else - { - if( delta_x_last_ == 0. || 1e5 * delta_x_last_ < delta_x_curr_ ) - { - delta_x_curr_ = delta_xs_first_inc_fact_ * delta_x_curr_; - } - else - { - delta_x_curr_ = delta_xs_inc_fact_ * delta_x_curr_; - } - } - if( delta_x_curr_ > delta_xs_max_ ) - { - Jnlst().Printf(J_DETAILED, J_LINEAR_ALGEBRA, - "delta_x perturbation is becoming too large: %e\n", delta_x_curr_); - delta_x_last_ = 0.; - delta_s_last_ = 0.; - IpData().Append_info_string("dx"); - return false; - } - - delta_s_curr_ = delta_x_curr_; - - delta_x = delta_x_curr_; - delta_s = delta_s_curr_; - delta_c = delta_c_curr_; - delta_d = delta_d_curr_; - - IpData().Set_info_regu_x(delta_x); - - get_deltas_for_wrong_inertia_called_ = true; - - return true; -} - -bool CGPerturbationHandler::PerturbForWrongInertia( - Number& delta_x, - Number& delta_s, - Number& delta_c, - Number& delta_d -) -{ - DBG_START_METH("CGPerturbationHandler::PerturbForWrongInertia", - dbg_verbosity); - - // Check if we can conclude that components of the system are - // structurally degenerate (we only get here if the most recent - // perturbation for a test did not result in a singular system) - finalize_test(); - - bool retval = get_deltas_for_wrong_inertia(delta_x, delta_s, delta_c, delta_d); - if( !retval && delta_c == 0. ) - { - DBG_ASSERT(delta_d == 0.); - delta_c_curr_ = delta_cd(); - delta_d_curr_ = delta_c_curr_; - delta_x_curr_ = 0.; - delta_s_curr_ = 0.; - test_status_ = NO_TEST; - if( hess_degenerate_ == DEGENERATE ) - { - hess_degenerate_ = NOT_YET_DETERMINED; - } - retval = get_deltas_for_wrong_inertia(delta_x, delta_s, delta_c, delta_d); - } - return retval; -} - -void CGPerturbationHandler::CurrentPerturbation( - Number& delta_x, - Number& delta_s, - Number& delta_c, - Number& delta_d -) -{ - delta_x = delta_x_curr_; - delta_s = delta_s_curr_; - delta_c = delta_c_curr_; - delta_d = delta_d_curr_; -} - -Number CGPerturbationHandler::delta_cd() -{ - return delta_cd_val_ * pow(IpData().curr_mu(), delta_cd_exp_); -} - -void CGPerturbationHandler::finalize_test() -{ - switch( test_status_ ) - { - case NO_TEST: - return; - case TEST_DELTA_C_EQ_0_DELTA_X_EQ_0: - if( hess_degenerate_ == NOT_YET_DETERMINED && jac_degenerate_ == NOT_YET_DETERMINED ) - { - hess_degenerate_ = NOT_DEGENERATE; - jac_degenerate_ = NOT_DEGENERATE; - IpData().Append_info_string("Nhj "); - } - else if( hess_degenerate_ == NOT_YET_DETERMINED ) - { - hess_degenerate_ = NOT_DEGENERATE; - IpData().Append_info_string("Nh "); - } - else if( jac_degenerate_ == NOT_YET_DETERMINED ) - { - jac_degenerate_ = NOT_DEGENERATE; - IpData().Append_info_string("Nj "); - } - break; - case TEST_DELTA_C_GT_0_DELTA_X_EQ_0: - if( hess_degenerate_ == NOT_YET_DETERMINED ) - { - hess_degenerate_ = NOT_DEGENERATE; - IpData().Append_info_string("Nh "); - } - if( jac_degenerate_ == NOT_YET_DETERMINED ) - { - degen_iters_++; - if( degen_iters_ >= degen_iters_max_ ) - { - jac_degenerate_ = DEGENERATE; - IpData().Append_info_string("Dj "); - } - IpData().Append_info_string("L"); - } - break; - case TEST_DELTA_C_EQ_0_DELTA_X_GT_0: - if( jac_degenerate_ == NOT_YET_DETERMINED ) - { - jac_degenerate_ = NOT_DEGENERATE; - IpData().Append_info_string("Nj "); - } - if( hess_degenerate_ == NOT_YET_DETERMINED ) - { - degen_iters_++; - if( degen_iters_ >= degen_iters_max_ ) - { - hess_degenerate_ = DEGENERATE; - IpData().Append_info_string("Dh "); - } - } - break; - case TEST_DELTA_C_GT_0_DELTA_X_GT_0: - degen_iters_++; - if( degen_iters_ >= degen_iters_max_ ) - { - hess_degenerate_ = DEGENERATE; - jac_degenerate_ = DEGENERATE; - IpData().Append_info_string("Dhj "); - } - IpData().Append_info_string("L"); - break; - } -} - } // namespace Ipopt diff --git a/src/contrib/CGPenalty/IpCGPerturbationHandler.hpp b/src/contrib/CGPenalty/IpCGPerturbationHandler.hpp index 25338689a..ad10397cc 100644 --- a/src/contrib/CGPenalty/IpCGPerturbationHandler.hpp +++ b/src/contrib/CGPenalty/IpCGPerturbationHandler.hpp @@ -26,14 +26,14 @@ class CGPerturbationHandler: public PDPerturbationHandler { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ CGPerturbationHandler(); /** Destructor */ virtual ~CGPerturbationHandler() { } - //@} + ///@} /* overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -69,29 +69,6 @@ class CGPerturbationHandler: public PDPerturbationHandler Number& delta_d ); - /** This method returns perturbation factors for the case when the - * most recent factorization resulted in a matrix with an - * incorrect number of negative eigenvalues. - * - * @return false, if no suitable perturbation could be found - */ - bool PerturbForWrongInertia( - Number& delta_x, - Number& delta_s, - Number& delta_c, - Number& delta_d - ); - - /** Just return the perturbation values that have been determined - * most recently - */ - void CurrentPerturbation( - Number& delta_x, - Number& delta_s, - Number& delta_c, - Number& delta_d - ); - static void RegisterOptions( SmartPtr roptions ); @@ -106,7 +83,7 @@ class CGPerturbationHandler: public PDPerturbationHandler * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Copy Constructor */ CGPerturbationHandler( const CGPerturbationHandler& @@ -116,7 +93,7 @@ class CGPerturbationHandler: public PDPerturbationHandler void operator=( const CGPerturbationHandler& ); - //@} + ///@} /** Method to easily access CGPenalty data */ CGPenaltyData& CGPenData() @@ -134,137 +111,11 @@ class CGPerturbationHandler: public PDPerturbationHandler return cg_pen_cq; } - /** @name Size of the most recent non-zero perturbation. */ - //@{ - /** The last nonzero value for delta_x */ - Number delta_x_last_; - /** The last nonzero value for delta_s */ - Number delta_s_last_; - /** The last nonzero value for delta_c */ - Number delta_c_last_; - /** The last nonzero value for delta_d */ - Number delta_d_last_; - //@} - - /** @name Size of the most recently suggested perturbation for the - * current matrix. */ - //@{ - /** The current value for delta_x */ - Number delta_x_curr_; - /** The current value for delta_s */ - Number delta_s_curr_; - /** The current value for delta_c */ - Number delta_c_curr_; - /** The current value for delta_d */ - Number delta_d_curr_; - //@} - - /** Flag indicating if for the given matrix the perturbation for wrong - * inertia method has already been called. */ - bool get_deltas_for_wrong_inertia_called_; - - /** @name Handling structural degeneracy */ - //@{ - /** Type for degeneracy flags */ - enum DegenType - { - NOT_YET_DETERMINED, - NOT_DEGENERATE, - DEGENERATE - }; - - /** Flag indicating whether the reduced Hessian matrix is thought - * to be structurally singular. - */ - DegenType hess_degenerate_; - - /** Flag indicating whether the Jacobian of the constraints is - * thought to be structurally rank-deficient. - */ - DegenType jac_degenerate_; - - /** Flag counting matrices in which degeneracy was observed in the - * first successive iterations. - * - * A value of -1 means that there was a - * non-degenerate (unperturbed) matrix at some point. - */ - Index degen_iters_; - - /** Status of current trial configuration */ - enum TrialStatus - { - NO_TEST, - TEST_DELTA_C_EQ_0_DELTA_X_EQ_0, - TEST_DELTA_C_GT_0_DELTA_X_EQ_0, - TEST_DELTA_C_EQ_0_DELTA_X_GT_0, - TEST_DELTA_C_GT_0_DELTA_X_GT_0 - }; - - /** Current status */ - TrialStatus test_status_; - //@} - - /** @name Algorithmic parameters. */ - //@{ - /** Maximal perturbation for x and s. */ - Number delta_xs_max_; - /** Smallest possible perturbation for x and s. */ - Number delta_xs_min_; - /** Increase factor for delta_xs for first required perturbation. */ - Number delta_xs_first_inc_fact_; - /** Increase factor for delta_xs for later perturbations. */ - Number delta_xs_inc_fact_; - /** Decrease factor for delta_xs for later perturbations. */ - Number delta_xs_dec_fact_; - /** Very first trial value for delta_xs perturbation. */ - Number delta_xs_init_; - /** Size of perturbation for c and d blocks. */ - Number delta_cd_val_; - /** Exponent on mu in formula for of perturbation for c and d blocks. */ - Number delta_cd_exp_; - /** Flag indicating whether the new values are based on the - * perturbations in the last iteration or in the more recent - * iteration in which a perturbation was done. - */ - bool reset_last_; - /** Required number of iterations for degeneracy conclusions. */ - Index degen_iters_max_; - /** Flag indicating that the delta_c, delta_d perturbation should - * always be used */ - bool perturb_always_cd_; - //@} - /** The max reference value for scaling the penalty parameter */ Number penalty_max_; /** Feasibility for perturbation in pure Newton method*/ Number mult_diverg_feasibility_tol_; - /** @name Auxiliary methods */ - //@{ - /** Internal version of PerturbForWrongInertia with the - * difference, that finalize_test is not called. - * - * @return false, if the delta_x and delta_s parameters become too large - */ - bool get_deltas_for_wrong_inertia( - Number& delta_x, - Number& delta_s, - Number& delta_c, - Number& delta_d - ); - - /** This method is call whenever a matrix had been factorization - * and is not singular. - * - * In here, we can evaluate the outcome of the degeneracy test heuristics. - */ - void finalize_test(); - - /** Compute perturbation value for constraints */ - Number delta_cd(); - //@} - }; } // namespace Ipopt diff --git a/src/contrib/CGPenalty/IpCGSearchDirCalc.cpp b/src/contrib/CGPenalty/IpCGSearchDirCalc.cpp index e05c6e683..edf873b69 100644 --- a/src/contrib/CGPenalty/IpCGSearchDirCalc.cpp +++ b/src/contrib/CGPenalty/IpCGSearchDirCalc.cpp @@ -59,43 +59,55 @@ void CGSearchDirCalculator::RegisterOptions( "pen_des_fact", "a parameter used in penalty parameter computation (for Chen-Goldfarb line search).", 0., true, - 2e-1); + 2e-1, + "", + true); roptions->AddLowerBoundedNumberOption( "kappa_x_dis", "a parameter used to check if the fast direction can be used as the line search direction (for Chen-Goldfarb line search).", 0., true, - 1e2); + 1e2, + "", + true); roptions->AddLowerBoundedNumberOption( "kappa_y_dis", "a parameter used to check if the fast direction can be used as the line search direction (for Chen-Goldfarb line search).", 0., true, - 1e4); + 1e4, + "", + true); roptions->AddLowerBoundedNumberOption( "vartheta", "a parameter used to check if the fast direction can be used as the line search direction (for Chen-Goldfarb line search).", 0., true, - 0.5); + 0.5, + "", + true); roptions->AddLowerBoundedNumberOption( "delta_y_max", "a parameter used to check if the fast direction can be used as the line search direction (for Chen-Goldfarb line search).", 0., true, - 1e12); + 1e12, + "", + true); roptions->AddLowerBoundedNumberOption( "fast_des_fact", "a parameter used to check if the fast direction can be used as the line search direction (for Chen-Goldfarb line search).", 0., true, - 1e-1); + 1e-1, + "", + true); roptions->AddLowerBoundedNumberOption( "pen_init_fac", "a parameter used to choose initial penalty parameters when the regularized Newton method is used.", 0., true, - 5e1); - roptions->AddStringOption2( + 5e1, + "", + true); + roptions->AddBoolOption( "never_use_fact_cgpen_direction", "Toggle to switch off the fast Chen-Goldfarb direction", - "no", - "no", "always compute the fast direction", - "yes", "never compute the fast direction"); + false); } bool CGSearchDirCalculator::InitializeImpl( @@ -142,8 +154,8 @@ bool CGSearchDirCalculator::ComputeSearchDirection() /** Initialize the penalty parameter */ if( !CGPenData().PenaltyInitialized() || !CGPenData().KKTPenaltyInitialized() ) { - Number penalty_init = penalty_init_min_; - Number kkt_penalty_init = penalty_init_min_; + Number penalty_init; + Number kkt_penalty_init; if( !CGPenData().NeverTryPureNewton() ) { Number y_max = Max(IpData().curr()->y_c()->Amax(), IpData().curr()->y_d()->Amax()); @@ -152,6 +164,7 @@ bool CGSearchDirCalculator::ComputeSearchDirection() Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, "Max(||y_c||_inf,||y_d||_inf = %8.2e\n", y_max); penalty_init = Max(penalty_init_min_, Min(y_max, penalty_init_max_)); + kkt_penalty_init = penalty_init_min_; } else { @@ -159,7 +172,7 @@ bool CGSearchDirCalculator::ComputeSearchDirection() // penalty_init = Max(penalty_init_min_, Min(penalty_init, penalty_init_max_)); // For the moment,let's just not do scale penalty_init = 1e2 * IpCq().curr_primal_infeasibility(NORM_2); - penalty_init = Min(1e5, Max(1e1, penalty_init)); + penalty_init = Min(Number(1e5), Max(Number(1e1), penalty_init)); kkt_penalty_init = penalty_init; } CGPenData().Set_penalty(penalty_init); @@ -195,10 +208,10 @@ bool CGSearchDirCalculator::ComputeSearchDirection() if( CGPenData().restor_iter() == IpData().iter_count() ) { Number i = CGPenData().restor_counter(); - Number fac = pen_init_fac_ * pow(1e-1, i); + Number fac = pen_init_fac_ * std::pow(1e-1, i); //Number restor_penalty_init = fac*IpCq().curr_primal_infeasibility(NORM_2); Number restor_penalty_init = fac; - restor_penalty_init = Min(1e6, Max(1e1, restor_penalty_init)); + restor_penalty_init = Min(Number(1e6), Max(Number(1e1), restor_penalty_init)); CGPenData().Set_penalty(restor_penalty_init); CGPenData().Set_kkt_penalty(restor_penalty_init); } @@ -261,14 +274,14 @@ bool CGSearchDirCalculator::ComputeSearchDirection() SmartPtr delta_fast_s = CGPenData().delta_cgfast()->s(); SmartPtr delta_x = CGPenData().delta_cgpen()->x(); SmartPtr delta_s = CGPenData().delta_cgpen()->s(); - Number tilde_dx_nrm = sqrt(pow(delta_fast_x->Nrm2(), 2.) + pow(delta_fast_s->Nrm2(), 2.)); - Number diff_dx_nrm = sqrt( - pow(delta_fast_x->Nrm2(), 2.) + pow(delta_fast_s->Nrm2(), 2.) - 2. * delta_x->Dot(*delta_fast_x) - - 2. * delta_s->Dot(*delta_fast_s) + pow(delta_x->Nrm2(), 2.) + pow(delta_s->Nrm2(), 2.)); + Number tilde_dx_nrm = std::sqrt(std::pow(delta_fast_x->Nrm2(), 2.) + std::pow(delta_fast_s->Nrm2(), 2.)); + Number diff_dx_nrm = std::sqrt( + std::pow(delta_fast_x->Nrm2(), 2.) + std::pow(delta_fast_s->Nrm2(), 2.) - 2. * delta_x->Dot(*delta_fast_x) + - 2. * delta_s->Dot(*delta_fast_s) + std::pow(delta_x->Nrm2(), 2.) + std::pow(delta_s->Nrm2(), 2.)); Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, "Testing if fast direction can be used.\n" " diff_dx_nrm = %8.2e tilde_dx_norm = %8.2e\n", diff_dx_nrm, tilde_dx_nrm); - tilde_dx_nrm = Max(tilde_dx_nrm, pow(tilde_dx_nrm, vartheta_)); + tilde_dx_nrm = Max(tilde_dx_nrm, std::pow(tilde_dx_nrm, vartheta_)); if( diff_dx_nrm > kappa_x_dis_ * tilde_dx_nrm ) { keep_fast_delta = false; @@ -282,10 +295,10 @@ bool CGSearchDirCalculator::ComputeSearchDirection() SmartPtr delta_fast_y_d = CGPenData().delta_cgfast()->y_d(); SmartPtr delta_y_c = CGPenData().delta_cgpen()->y_c(); SmartPtr delta_y_d = CGPenData().delta_cgpen()->y_d(); - Number tilde_dy_nrm = sqrt(pow(delta_fast_y_c->Nrm2(), 2.) + pow(delta_fast_y_d->Nrm2(), 2.)); - Number bar_y_nrm = sqrt( - pow(y_c->Nrm2(), 2.) + pow(y_d->Nrm2(), 2.) + 2. * y_c->Dot(*delta_y_c) + 2. * y_d->Dot(*delta_y_d) - + pow(delta_y_c->Nrm2(), 2.) + pow(delta_y_d->Nrm2(), 2.)); + Number tilde_dy_nrm = std::sqrt(std::pow(delta_fast_y_c->Nrm2(), 2.) + std::pow(delta_fast_y_d->Nrm2(), 2.)); + Number bar_y_nrm = std::sqrt( + std::pow(y_c->Nrm2(), 2.) + std::pow(y_d->Nrm2(), 2.) + 2. * y_c->Dot(*delta_y_c) + 2. * y_d->Dot(*delta_y_d) + + std::pow(delta_y_c->Nrm2(), 2.) + std::pow(delta_y_d->Nrm2(), 2.)); Jnlst().Printf(J_MOREDETAILED, J_LINE_SEARCH, "Testing if fast direction can be used.\n" " tilde_dy_nrm = %8.2e bar_y_nrm = %8.2e\n", tilde_dy_nrm, bar_y_nrm); @@ -331,7 +344,7 @@ bool CGSearchDirCalculator::ComputeSearchDirection() Number curr_kkt_penalty = CGPenData().curr_kkt_penalty(); if( penalty > curr_penalty ) { - penalty = Max(penalty, curr_penalty + 1.); + penalty = Max(penalty, curr_penalty + Number(1.)); } else { diff --git a/src/contrib/CGPenalty/IpCGSearchDirCalc.hpp b/src/contrib/CGPenalty/IpCGSearchDirCalc.hpp index afb58d854..e1250bd8c 100644 --- a/src/contrib/CGPenalty/IpCGSearchDirCalc.hpp +++ b/src/contrib/CGPenalty/IpCGSearchDirCalc.hpp @@ -24,7 +24,7 @@ class CGSearchDirCalculator: public SearchDirectionCalculator { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Constructor */ CGSearchDirCalculator( const SmartPtr& pd_solver @@ -32,7 +32,7 @@ class CGSearchDirCalculator: public SearchDirectionCalculator /** Destructor */ virtual ~CGSearchDirCalculator(); - //@} + ///@} /** overloaded from AlgorithmStrategyObject */ virtual bool InitializeImpl( @@ -49,11 +49,11 @@ class CGSearchDirCalculator: public SearchDirectionCalculator virtual bool ComputeSearchDirection(); /** Methods for IpoptType */ - //@{ + ///@{ static void RegisterOptions( SmartPtr roptions ); - //@} + ///@} private: /**@name Default Compiler Generated Methods @@ -65,7 +65,7 @@ class CGSearchDirCalculator: public SearchDirectionCalculator * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ CGSearchDirCalculator(); @@ -78,7 +78,7 @@ class CGSearchDirCalculator: public SearchDirectionCalculator void operator=( const CGSearchDirCalculator& ); - //@} + ///@} /** Method to easily access CGPenalty data */ CGPenaltyData& CGPenData() @@ -97,7 +97,7 @@ class CGSearchDirCalculator: public SearchDirectionCalculator } /** @name Algorithmic parameters */ - //@{ + ///@{ /** safeguard factor for bound multipliers. * * If value >= 1, then @@ -135,12 +135,12 @@ class CGSearchDirCalculator: public SearchDirectionCalculator /** Counter for how many times the pen parameter is updated non-monotonically */ Index nonmonotone_pen_update_counter_; - //@} + ///@} /** @name Strategy objects */ - //@{ + ///@{ SmartPtr pd_solver_; - //@} + ///@} }; } // namespace Ipopt diff --git a/src/contrib/CGPenalty/IpPiecewisePenalty.cpp b/src/contrib/CGPenalty/IpPiecewisePenalty.cpp index 712621acb..168694942 100644 --- a/src/contrib/CGPenalty/IpPiecewisePenalty.cpp +++ b/src/contrib/CGPenalty/IpPiecewisePenalty.cpp @@ -20,8 +20,8 @@ PiecewisePenalty::PiecewisePenalty( Index dim ) : dim_(dim), - min_piece_penalty_(0), // @todo make it regular option here or elsewhere? - max_piece_number_(100) // @todo make it regular option here or elsewhere? + min_piece_penalty_(0), // ToDo make it regular option here or elsewhere? + max_piece_number_(100) // ToDo make it regular option here or elsewhere? { } @@ -31,6 +31,7 @@ bool PiecewisePenalty::Acceptable( ) { DBG_START_METH("PiebcewisePenalty::Acceptable", dbg_verbosity); + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(!IsPiecewisePenaltyListEmpty()); bool acceptable = false; std::vector::iterator iter; @@ -47,7 +48,7 @@ bool PiecewisePenalty::Acceptable( Number value = iter->barrier_obj + iter->pen_r * iter->infeasi - trial_barrier - iter->pen_r * trial_inf; if( value >= 0. ) { - iter++; + ++iter; value = iter->barrier_obj + iter->pen_r * iter->infeasi - trial_barrier - iter->pen_r * trial_inf; if( value <= 0. ) { @@ -55,8 +56,7 @@ bool PiecewisePenalty::Acceptable( } } // Then check the ending entry of the list. - iter = PiecewisePenalty_list_.end(); - iter--; + iter = PiecewisePenalty_list_.end()--; value = iter->barrier_obj + iter->pen_r * iter->infeasi - trial_barrier - iter->pen_r * trial_inf; if( value <= 0. && trial_inf <= iter->infeasi ) { @@ -73,15 +73,15 @@ bool PiecewisePenalty::Acceptable( } } // Finally, check the middle entries of the list. - Number value_left, value_mid, value_right; - for( iter = PiecewisePenalty_list_.begin() + 1; iter != PiecewisePenalty_list_.end(); iter++ ) + for( iter = PiecewisePenalty_list_.begin() + 1; iter != PiecewisePenalty_list_.end(); ++iter ) { + Number value_left, value_mid, value_right; value_mid = iter->barrier_obj + iter->pen_r * iter->infeasi - trial_barrier - iter->pen_r * trial_inf; - iter++; + ++iter; value_right = iter->barrier_obj + iter->pen_r * iter->infeasi - trial_barrier - iter->pen_r * trial_inf; iter -= 2; value_left = iter->barrier_obj + iter->pen_r * iter->infeasi - trial_barrier - iter->pen_r * trial_inf; - iter++; + ++iter; if( value_left <= 0. && value_mid >= 0. && value_right <= 0. ) { return false; @@ -89,10 +89,9 @@ bool PiecewisePenalty::Acceptable( } } // Check if the trial point is acceptable to the piecewise list - Number Fz; - for( iter = PiecewisePenalty_list_.begin(); iter != PiecewisePenalty_list_.end(); iter++ ) + for( iter = PiecewisePenalty_list_.begin(); iter != PiecewisePenalty_list_.end(); ++iter ) { - Fz = Fzconst + iter->pen_r * (Fzlin - iter->infeasi) - iter->barrier_obj; + Number Fz = Fzconst + iter->pen_r * (Fzlin - iter->infeasi) - iter->barrier_obj; if( Fz < 0. ) { acceptable = true; @@ -110,14 +109,12 @@ bool PiecewisePenalty::Acceptable( Number PiecewisePenalty::BiggestBarr() { DBG_START_METH("PiecewisePenalty::BiggestBarr", dbg_verbosity); + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(!IsPiecewisePenaltyListEmpty()); Number value = -1e20; - if( PiecewisePenalty_list_.size() > 0 ) + if( !PiecewisePenalty_list_.empty() ) { - std::vector::iterator iter; - iter = PiecewisePenalty_list_.end(); - iter--; - value = iter->barrier_obj; + value = PiecewisePenalty_list_.back().barrier_obj; } return value; } @@ -129,6 +126,7 @@ void PiecewisePenalty::UpdateEntry( { DBG_START_METH("PiecewisePenalty::UpdateEntry", dbg_verbosity); + // cppcheck-suppress assertWithSideEffect DBG_ASSERT(!IsPiecewisePenaltyListEmpty()); Number Gzi1, Gzi2; @@ -140,7 +138,7 @@ void PiecewisePenalty::UpdateEntry( PiecewisePenalty_list_.clear(); std::vector::iterator iter = TmpList.begin(), iter2; Gzi1 = barrier_obj + iter->pen_r * (infeasi - iter->infeasi) - iter->barrier_obj; - for( ; iter <= TmpList.end() - 1; iter++ ) + for( ; iter <= TmpList.end() - 1; ++iter ) { // Be careful about this if( TmpList.size() > 1 && iter <= TmpList.end() - 2 ) @@ -213,18 +211,17 @@ void PiecewisePenalty::Print( { // DBG_START_METH("FilterLineSearch::Filter::Print", dbg_verbosity); jnlst.Printf(J_DETAILED, J_LINE_SEARCH, - "The current piecewise penalty has %d entries.\n", PiecewisePenalty_list_.size()); + "The current piecewise penalty has %zd entries.\n", PiecewisePenalty_list_.size()); jnlst.Printf(J_DETAILED, J_LINE_SEARCH, - "We only allow %d entries.\n", max_piece_number_); + "We only allow %" IPOPT_INDEX_FORMAT " entries.\n", max_piece_number_); jnlst.Printf(J_DETAILED, J_LINE_SEARCH, - "The min piecewise penalty is %d .\n", min_piece_penalty_); + "The min piecewise penalty is %g.\n", min_piece_penalty_); if( !jnlst.ProduceOutput(J_DETAILED, J_LINE_SEARCH) ) { return; } - std::vector::iterator iter; Index count = 0; - for( iter = PiecewisePenalty_list_.begin(); iter != PiecewisePenalty_list_.end(); iter++ ) + for( std::vector::iterator iter = PiecewisePenalty_list_.begin(); iter != PiecewisePenalty_list_.end(); ++iter ) { if( count % 10 == 0 ) { @@ -233,9 +230,9 @@ void PiecewisePenalty::Print( } count++; jnlst.Printf(J_DETAILED, J_LINE_SEARCH, - "%5d ", count); + "%5" IPOPT_INDEX_FORMAT, count); jnlst.Printf(J_DETAILED, J_LINE_SEARCH, - "%23.16e %23.16e %23.16e \n", iter->pen_r, iter->barrier_obj, iter->infeasi); + " %23.16e %23.16e %23.16e \n", iter->pen_r, iter->barrier_obj, iter->infeasi); } } diff --git a/src/contrib/CGPenalty/IpPiecewisePenalty.hpp b/src/contrib/CGPenalty/IpPiecewisePenalty.hpp index 00e467249..9d9c7980f 100644 --- a/src/contrib/CGPenalty/IpPiecewisePenalty.hpp +++ b/src/contrib/CGPenalty/IpPiecewisePenalty.hpp @@ -37,19 +37,19 @@ class PiecewisePenalty { public: /**@name Constructors/Destructors */ - //@{ + ///@{ /** Default Constructor */ PiecewisePenalty( Index dim); /** Destructor */ ~PiecewisePenalty() { - // @todo figure out if that here is necessary + // ToDo figure out if that here is necessary // Clear(); } - //@} + ///@} - //@{ + ///@{ // Initialize Piecewise Penalty list bool IsPiecewisePenaltyListEmpty() { @@ -114,7 +114,7 @@ class PiecewisePenalty AddEntry(pen_r, barrier_obj, infeasi); } - //@} + ///@} /** Delete all Piecewise Penalty entries */ void Clear() @@ -137,7 +137,7 @@ class PiecewisePenalty * and do not define them. This ensures that * they will not be implicitly created/called. */ - //@{ + ///@{ /** Default Constructor */ PiecewisePenalty(); /** Copy Constructor */ @@ -149,7 +149,7 @@ class PiecewisePenalty void operator=( const PiecewisePenalty& ); - //@} + ///@} /** Dimension of the Piecewise Penalty (number of coordinates per entry) */ Index dim_; diff --git a/src/contrib/CGPenalty/Makefile.am b/src/contrib/CGPenalty/Makefile.am deleted file mode 100644 index c95f71db9..000000000 --- a/src/contrib/CGPenalty/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2007 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Andreas Waechter IBM 2007-06-01 - -noinst_LTLIBRARIES = libcgpenalty.la - -libcgpenalty_la_SOURCES = \ - IpCGPenaltyCq.cpp \ - IpCGPenaltyData.cpp \ - IpCGPenaltyLSAcceptor.cpp \ - IpCGPenaltyRegOp.cpp \ - IpCGPerturbationHandler.cpp \ - IpCGSearchDirCalc.cpp \ - IpPiecewisePenalty.cpp - -#libcgpenalty_la_LDFLAGS = $(LT_LDFLAGS) - -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../LinAlg \ - -I$(srcdir)/../../LinAlg/TMatrices \ - -I$(srcdir)/../../Interfaces \ - -I$(srcdir)/../../Algorithm \ - $(IPOPTLIB_CFLAGS) diff --git a/src/contrib/CGPenalty/Makefile.in b/src/contrib/CGPenalty/Makefile.in deleted file mode 100644 index f00e137c5..000000000 --- a/src/contrib/CGPenalty/Makefile.in +++ /dev/null @@ -1,662 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2007 International Business Machines and others. -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. - -# Authors: Andreas Waechter IBM 2007-06-01 - -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/contrib/CGPenalty -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/src/Common/config.h \ - $(top_builddir)/src/Common/config_ipopt.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libcgpenalty_la_LIBADD = -am_libcgpenalty_la_OBJECTS = IpCGPenaltyCq.lo IpCGPenaltyData.lo \ - IpCGPenaltyLSAcceptor.lo IpCGPenaltyRegOp.lo \ - IpCGPerturbationHandler.lo IpCGSearchDirCalc.lo \ - IpPiecewisePenalty.lo -libcgpenalty_la_OBJECTS = $(am_libcgpenalty_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 = -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)/IpCGPenaltyCq.Plo \ - ./$(DEPDIR)/IpCGPenaltyData.Plo \ - ./$(DEPDIR)/IpCGPenaltyLSAcceptor.Plo \ - ./$(DEPDIR)/IpCGPenaltyRegOp.Plo \ - ./$(DEPDIR)/IpCGPerturbationHandler.Plo \ - ./$(DEPDIR)/IpCGSearchDirCalc.Plo \ - ./$(DEPDIR)/IpPiecewisePenalty.Plo -am__mv = mv -f -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) \ - $(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) \ - $(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 = -SOURCES = $(libcgpenalty_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -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 -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = libcgpenalty.la -libcgpenalty_la_SOURCES = \ - IpCGPenaltyCq.cpp \ - IpCGPenaltyData.cpp \ - IpCGPenaltyLSAcceptor.cpp \ - IpCGPenaltyRegOp.cpp \ - IpCGPerturbationHandler.cpp \ - IpCGSearchDirCalc.cpp \ - IpPiecewisePenalty.cpp - - -#libcgpenalty_la_LDFLAGS = $(LT_LDFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../LinAlg \ - -I$(srcdir)/../../LinAlg/TMatrices \ - -I$(srcdir)/../../Interfaces \ - -I$(srcdir)/../../Algorithm \ - $(IPOPTLIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.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 ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/contrib/CGPenalty/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/contrib/CGPenalty/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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}; \ - } - -libcgpenalty.la: $(libcgpenalty_la_OBJECTS) $(libcgpenalty_la_DEPENDENCIES) $(EXTRA_libcgpenalty_la_DEPENDENCIES) - $(AM_V_CXXLD)$(CXXLINK) $(libcgpenalty_la_OBJECTS) $(libcgpenalty_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpCGPenaltyCq.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpCGPenaltyData.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpCGPenaltyLSAcceptor.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpCGPenaltyRegOp.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpCGPerturbationHandler.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpCGSearchDirCalc.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpPiecewisePenalty.Plo@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@ $(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@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(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@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -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) \ - $$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 - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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 -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/IpCGPenaltyCq.Plo - -rm -f ./$(DEPDIR)/IpCGPenaltyData.Plo - -rm -f ./$(DEPDIR)/IpCGPenaltyLSAcceptor.Plo - -rm -f ./$(DEPDIR)/IpCGPenaltyRegOp.Plo - -rm -f ./$(DEPDIR)/IpCGPerturbationHandler.Plo - -rm -f ./$(DEPDIR)/IpCGSearchDirCalc.Plo - -rm -f ./$(DEPDIR)/IpPiecewisePenalty.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -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 -f ./$(DEPDIR)/IpCGPenaltyCq.Plo - -rm -f ./$(DEPDIR)/IpCGPenaltyData.Plo - -rm -f ./$(DEPDIR)/IpCGPenaltyLSAcceptor.Plo - -rm -f ./$(DEPDIR)/IpCGPenaltyRegOp.Plo - -rm -f ./$(DEPDIR)/IpCGPerturbationHandler.Plo - -rm -f ./$(DEPDIR)/IpCGSearchDirCalc.Plo - -rm -f ./$(DEPDIR)/IpPiecewisePenalty.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES \ - 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-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - 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 - -.PRECIOUS: Makefile - - -# 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/contrib/LinearSolverLoader/HSLLoader.c b/src/contrib/LinearSolverLoader/HSLLoader.c deleted file mode 100644 index a0e63599b..000000000 --- a/src/contrib/LinearSolverLoader/HSLLoader.c +++ /dev/null @@ -1,1440 +0,0 @@ -/* Copyright (C) 2008, 2011 GAMS Development and others - * All Rights Reserved. - * This code is published under the Eclipse Public License. - * - * Author: Stefan Vigerske - */ - -#include "IpoptConfig.h" -#include "LibraryHandler.h" -#include "HSLLoader.h" - -#ifdef IPOPT_HAS_HSL -#include "CoinHslConfig.h" -#endif - -#include -#include - -#define HSLLIBNAME "libhsl." SHAREDLIBEXT - -static soHandle_t HSL_handle = NULL; - -void LSL_lateHSLLoad(void); - -typedef void (*voidfun)(void); - -voidfun LSL_loadSym( - soHandle_t h, - const char* symName, - char* msgBuf, - int msgLen -); - -#ifndef COINHSL_HAS_MA27 -static ma27ad_t func_ma27ad = NULL; -static ma27bd_t func_ma27bd = NULL; -static ma27cd_t func_ma27cd = NULL; -static ma27id_t func_ma27id = NULL; - -void ma27ad( - ipfint* N, - ipfint* NZ, - const ipfint* IRN, - const ipfint* ICN, - ipfint* IW, - ipfint* LIW, - ipfint* IKEEP, - ipfint* IW1, - ipfint* NSTEPS, - ipfint* IFLAG, - ipfint* ICNTL, - double* CNTL, - ipfint* INFO, - double* OPS -) -{ - if( func_ma27ad == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma27ad == NULL ) - { - fprintf(stderr, "HSL routine MA27AD not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma27ad(N, NZ, IRN, ICN, IW, LIW, IKEEP, IW1, NSTEPS, IFLAG, ICNTL, CNTL, INFO, OPS); -} - -void ma27bd( - ipfint* N, - ipfint* NZ, - const ipfint* IRN, - const ipfint* ICN, - double* A, - ipfint* LA, - ipfint* IW, - ipfint* LIW, - ipfint* IKEEP, - ipfint* NSTEPS, - ipfint* MAXFRT, - ipfint* IW1, - ipfint* ICNTL, - double* CNTL, - ipfint* INFO -) -{ - if( func_ma27bd == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma27bd == NULL ) - { - fprintf(stderr, "HSL routine MA27BD not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma27bd(N, NZ, IRN, ICN, A, LA, IW, LIW, IKEEP, NSTEPS, MAXFRT, IW1, ICNTL, CNTL, INFO); -} - -void ma27cd( - ipfint* N, - double* A, - ipfint* LA, - ipfint* IW, - ipfint* LIW, - double* W, - ipfint* MAXFRT, - double* RHS, - ipfint* IW1, - ipfint* NSTEPS, - ipfint* ICNTL, - double* CNTL -) -{ - if( func_ma27cd == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma27cd == NULL ) - { - fprintf(stderr, "HSL routine MA27CD not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma27cd(N, A, LA, IW, LIW, W, MAXFRT, RHS, IW1, NSTEPS, ICNTL, CNTL); -} - -void ma27id( - ipfint* ICNTL, - double* CNTL -) -{ - if( func_ma27id == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma27id == NULL ) - { - fprintf(stderr, "HSL routine MA27ID not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma27id(ICNTL, CNTL); -} - -#endif - -#ifndef COINHSL_HAS_MA57 - -static ma57id_t func_ma57id = NULL; -static ma57ad_t func_ma57ad = NULL; -static ma57bd_t func_ma57bd = NULL; -static ma57cd_t func_ma57cd = NULL; -static ma57ed_t func_ma57ed = NULL; - -void ma57id( - double* cntl, - ipfint* icntl -) -{ - if( func_ma57id == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma57id == NULL ) - { - fprintf(stderr, "HSL routine MA57ID not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma57id(cntl, icntl); -} - -void ma57ad( - ipfint* n, /**< Order of matrix. */ - ipfint* ne, /**< Number of entries. */ - const ipfint* irn, /**< Matrix nonzero row structure */ - const ipfint* jcn, /**< Matrix nonzero column structure */ - ipfint* lkeep, /**< Workspace for the pivot order of lenght 3*n */ - ipfint* keep, /**< Workspace for the pivot order of lenght 3*n */ - ipfint* iwork, /**< Integer work space. */ - ipfint* icntl, /**< Integer Control parameter of length 30*/ - ipfint* info, /**< Statistical Information; Integer array of length 20 */ - double* rinfo /**< Double Control parameter of length 5 */ -) -{ - if( func_ma57ad == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma57ad == NULL ) - { - fprintf(stderr, "HSL routine MA57AD not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma57ad(n, ne, irn, jcn, lkeep, keep, iwork, icntl, info, rinfo); -} - -void ma57bd( - ipfint* n, /**< Order of matrix. */ - ipfint* ne, /**< Number of entries. */ - double* a, /**< Numerical values. */ - double* fact, /**< Entries of factors. */ - ipfint* lfact, /**< Length of array `fact'. */ - ipfint* ifact, /**< Indexing info for factors. */ - ipfint* lifact, /**< Length of array `ifact'. */ - ipfint* lkeep, /**< Length of array `keep'. */ - ipfint* keep, /**< Integer array. */ - ipfint* iwork, /**< Workspace of length `n'. */ - ipfint* icntl, /**< Integer Control parameter of length 20. */ - double* cntl, /**< Double Control parameter of length 5. */ - ipfint* info, /**< Statistical Information; Integer array of length 40. */ - double* rinfo /**< Statistical Information; Real array of length 20. */ -) -{ - if( func_ma57bd == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma57bd == NULL ) - { - fprintf(stderr, "HSL routine MA57BD not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma57bd(n, ne, a, fact, lfact, ifact, lifact, lkeep, keep, iwork, icntl, cntl, info, rinfo); -} - -void ma57cd( - ipfint* job, /**< Solution job. Solve for... */ - ipfint* n, /**< Order of matrix. */ - double* fact, /**< Entries of factors. */ - ipfint* lfact, /**< Length of array `fact'. */ - ipfint* ifact, /**< Indexing info for factors. */ - ipfint* lifact, /**< Length of array `ifact'. */ - ipfint* nrhs, /**< Number of right hand sides. */ - double* rhs, /**< Numerical Values. */ - ipfint* lrhs, /**< Leading dimensions of `rhs'. */ - double* work, /**< Real workspace. */ - ipfint* lwork, /**< Length of `work', >= N*NRHS. */ - ipfint* iwork, /**< Integer array of length `n'. */ - ipfint* icntl, /**< Integer Control parameter array of length 20. */ - ipfint* info /**< Statistical Information; Integer array of length 40. */ -) -{ - if( func_ma57cd == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma57cd == NULL ) - { - fprintf(stderr, "HSL routine MA57CD not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma57cd(job, n, fact, lfact, ifact, lifact, nrhs, rhs, lrhs, work, lwork, iwork, icntl, info); -} - -void ma57ed( - ipfint* n, - ipfint* ic, /**< 0: copy real array. >=1: copy integer array. */ - ipfint* keep, - double* fact, - ipfint* lfact, - double* newfac, - ipfint* lnew, - ipfint* ifact, - ipfint* lifact, - ipfint* newifc, - ipfint* linew, - ipfint* info -) -{ - if( func_ma57ed == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma57ed == NULL ) - { - fprintf(stderr, "HSL routine MA57ED not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma57ed(n, ic, keep, fact, lfact, newfac, lnew, ifact, lifact, newifc, linew, info); -} -#endif - -#ifndef COINHSL_HAS_MA77 - -static ma77_default_control_t func_ma77_default_control = NULL; -static ma77_open_nelt_t func_ma77_open_nelt = NULL; -static ma77_open_t func_ma77_open = NULL; -static ma77_input_vars_t func_ma77_input_vars = NULL; -static ma77_input_reals_t func_ma77_input_reals = NULL; -static ma77_analyse_t func_ma77_analyse = NULL; -static ma77_factor_t func_ma77_factor = NULL; -static ma77_factor_solve_t func_ma77_factor_solve = NULL; -static ma77_solve_t func_ma77_solve = NULL; -static ma77_resid_t func_ma77_resid = NULL; -static ma77_scale_t func_ma77_scale = NULL; -static ma77_enquire_posdef_t func_ma77_enquire_posdef = NULL; -static ma77_enquire_indef_t func_ma77_enquire_indef = NULL; -static ma77_alter_t func_ma77_alter = NULL; -static ma77_restart_t func_ma77_restart = NULL; -static ma77_finalise_t func_ma77_finalise = NULL; - -/** Initialize control with default values */ -void ma77_default_control( - struct ma77_control_d* control -) -{ - if( func_ma77_default_control == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_default_control == NULL ) - { - fprintf(stderr, "HSL routine ma77_default_control not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_default_control(control); -} - -void ma77_open_nelt( - const int n, - const char* fname1, - const char* fname2, - const char* fname3, - const char* fname4, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const int nelt -) -{ - if( func_ma77_open_nelt == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_open_nelt == NULL ) - { - fprintf(stderr, "HSL routine ma77_open_nelt not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_open_nelt(n, fname1, fname2, fname3, fname4, keep, control, info, nelt); -} - -void ma77_open( - const int n, - const char* fname1, - const char* fname2, - const char* fname3, - const char* fname4, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -) -{ - if( func_ma77_open == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_open == NULL ) - { - fprintf(stderr, "HSL routine ma77_open not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_open(n, fname1, fname2, fname3, fname4, keep, control, info); -} - -void ma77_input_vars( - const int idx, - const int nvar, - const int list[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -) -{ - if( func_ma77_input_vars == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_input_vars == NULL ) - { - fprintf(stderr, "HSL routine ma77_input_vars not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_input_vars(idx, nvar, list, keep, control, info); -} - -void ma77_input_reals( - const int idx, - const int length, - const ma77pkgtype_d_ reals[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -) -{ - if( func_ma77_input_reals == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_input_reals == NULL ) - { - fprintf(stderr, "HSL routine ma77_input_reals not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_input_reals(idx, length, reals, keep, control, info); -} - -void ma77_analyse( - const int order[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -) -{ - if( func_ma77_analyse == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_analyse == NULL ) - { - fprintf(stderr, "HSL routine ma77_analyse not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_analyse(order, keep, control, info); -} - -void ma77_factor( - const int posdef, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const ma77pkgtype_d_* scale -) -{ - if( func_ma77_factor == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_factor == NULL ) - { - fprintf(stderr, "HSL routine ma77_factor not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_factor(posdef, keep, control, info, scale); -} - -void ma77_factor_solve( - const int posdef, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const ma77pkgtype_d_* scale, - const int nrhs, - const int lx, - ma77pkgtype_d_ rhs[] -) -{ - if( func_ma77_factor_solve == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_factor_solve == NULL ) - { - fprintf(stderr, "HSL routine ma77_factor_solve not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_factor_solve(posdef, keep, control, info, scale, nrhs, lx, rhs); -} - -void ma77_solve( - const int job, - const int nrhs, - const int lx, - ma77pkgtype_d_ x[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const ma77pkgtype_d_* scale -) -{ - if( func_ma77_solve == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_solve == NULL ) - { - fprintf(stderr, "HSL routine ma77_solve not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_solve(job, nrhs, lx, x, keep, control, info, scale); -} - -void ma77_resid( - const int nrhs, - const int lx, - const ma77pkgtype_d_ x[], - const int lresid, - ma77pkgtype_d_ resid[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - ma77pkgtype_d_* anorm_bnd -) -{ - if( func_ma77_resid == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_resid == NULL ) - { - fprintf(stderr, "HSL routine ma77_resid not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_resid(nrhs, lx, x, lresid, resid, keep, control, info, anorm_bnd); -} - -void ma77_scale( - ma77pkgtype_d_ scale[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - ma77pkgtype_d_* anorm -) -{ - if( func_ma77_scale == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_scale == NULL ) - { - fprintf(stderr, "HSL routine ma77_scale not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_scale(scale, keep, control, info, anorm); -} - -void ma77_enquire_posdef( - ma77pkgtype_d_ d[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -) -{ - if( func_ma77_enquire_posdef == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_enquire_posdef == NULL ) - { - fprintf(stderr, "HSL routine ma77_enquire_posdef not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_enquire_posdef(d, keep, control, info); -} - -void ma77_enquire_indef( - int piv_order[], - ma77pkgtype_d_ d[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -) -{ - if( func_ma77_enquire_indef == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_enquire_indef == NULL ) - { - fprintf(stderr, "HSL routine ma77_enquire_indef not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_enquire_indef(piv_order, d, keep, control, info); -} - -void ma77_alter( - const ma77pkgtype_d_ d[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -) -{ - if( func_ma77_alter == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_alter == NULL ) - { - fprintf(stderr, "HSL routine ma77_alter not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_alter(d, keep, control, info); -} - -void ma77_restart( - const char* restart_file, - const char* fname1, - const char* fname2, - const char* fname3, - const char* fname4, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -) -{ - if( func_ma77_restart == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_restart == NULL ) - { - fprintf(stderr, "HSL routine ma77_restart not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_restart(restart_file, fname1, fname2, fname3, fname4, keep, control, info); -} - -void ma77_finalise( - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -) -{ - if( func_ma77_finalise == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma77_finalise == NULL ) - { - fprintf(stderr, "HSL routine ma77_finalise not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma77_finalise(keep, control, info); -} - -#endif - - -#ifndef COINHSL_HAS_MA86 - -static ma86_default_control_t func_ma86_default_control = NULL; -static ma86_analyse_t func_ma86_analyse = NULL; -static ma86_factor_t func_ma86_factor = NULL; -static ma86_factor_solve_t func_ma86_factor_solve = NULL; -static ma86_solve_t func_ma86_solve = NULL; -static ma86_finalise_t func_ma86_finalise = NULL; - -void ma86_default_control( - struct ma86_control* control -) -{ - if( func_ma86_default_control == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma86_default_control == NULL ) - { - fprintf(stderr, "HSL routine ma86_default_control not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma86_default_control(control); -} - -void ma86_analyse( - const int n, - const int ptr[], - const int row[], - int order[], - void** keep, - const struct ma86_control* control, - struct ma86_info* info -) -{ - if( func_ma86_analyse == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma86_analyse == NULL ) - { - fprintf(stderr, "HSL routine ma86_analyse not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma86_analyse(n, ptr, row, order, keep, control, info); -} - -void ma86_factor( - const int n, - const int ptr[], - const int row[], - const ma86pkgtype_d_ val[], - const int order[], - void** keep, - const struct ma86_control* control, - struct ma86_info* info, - const ma86pkgtype_d_ scale[] -) -{ - if( func_ma86_factor == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma86_factor == NULL ) - { - fprintf(stderr, "HSL routine ma86_factor not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma86_factor(n, ptr, row, val, order, keep, control, info, scale); -} - -void ma86_factor_solve( - const int n, - const int ptr[], - const int row[], - const ma86pkgtype_d_ val[], - const int order[], - void** keep, - const struct ma86_control* control, - struct ma86_info* info, - const int nrhs, - const int ldx, - ma86pkgtype_d_ x[], - const ma86pkgtype_d_ scale[] -) -{ - if( func_ma86_factor_solve == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma86_factor_solve == NULL ) - { - fprintf(stderr, "HSL routine ma86_factor_solve not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma86_factor_solve(n, ptr, row, val, order, keep, control, info, nrhs, - ldx, x, scale); -} - -void ma86_solve( - const int job, - const int nrhs, - const int ldx, - ma86pkgtype_d_* x, - const int order[], - void** keep, - const struct ma86_control* control, - struct ma86_info* info, - const ma86pkgtype_d_ scale[] -) -{ - if( func_ma86_solve == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma86_solve == NULL ) - { - fprintf(stderr, "HSL routine ma86_solve not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma86_solve(job, nrhs, ldx, x, order, keep, control, info, scale); -} - -void ma86_finalise( - void** keep, - const struct ma86_control* control -) -{ - if( func_ma86_finalise == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma86_finalise == NULL ) - { - fprintf(stderr, "HSL routine ma86_finalise not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma86_finalise(keep, control); -} -#endif - -#ifndef COINHSL_HAS_MA97 - -static ma97_default_control_t func_ma97_default_control = NULL; -static ma97_analyse_t func_ma97_analyse = NULL; -static ma97_factor_t func_ma97_factor = NULL; -static ma97_factor_solve_t func_ma97_factor_solve = NULL; -static ma97_solve_t func_ma97_solve = NULL; -static ma97_finalise_t func_ma97_finalise = NULL; -static ma97_free_akeep_t func_ma97_free_akeep = NULL; - -void ma97_default_control( - struct ma97_control* control -) -{ - if( func_ma97_default_control == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma97_default_control == NULL ) - { - fprintf(stderr, "HSL routine ma97_default_control not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma97_default_control(control); -} - -void ma97_analyse( - const int check, - const int n, - const int ptr[], - const int row[], - ma97pkgtype_d_ val[], - void** akeep, - const struct ma97_control* control, - struct ma97_info* info, - int order[] -) -{ - if( func_ma97_analyse == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma97_analyse == NULL ) - { - fprintf(stderr, "HSL routine ma97_analyse not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma97_analyse(check, n, ptr, row, val, akeep, control, info, order); -} - -void ma97_factor( - const int matrix_type, - const int ptr[], - const int row[], - const ma97pkgtype_d_ val[], - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info, - const ma97pkgtype_d_ scale[] -) -{ - if( func_ma97_factor == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma97_factor == NULL ) - { - fprintf(stderr, "HSL routine ma97_factor not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma97_factor(matrix_type, ptr, row, val, akeep, fkeep, control, info, - scale); -} - -void ma97_factor_solve( - const int matrix_type, - const int ptr[], - const int row[], - const ma97pkgtype_d_ val[], - const int nrhs, - ma97pkgtype_d_ x[], - const int ldx, - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info, - const ma97pkgtype_d_ scale[] -) -{ - if( func_ma97_factor_solve == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma97_factor_solve == NULL ) - { - fprintf(stderr, "HSL routine ma97_factor_solve not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma97_factor_solve(matrix_type, ptr, row, val, nrhs, x, ldx, akeep, fkeep, control, info, scale); -} - -void ma97_solve( - const int job, - const int nrhs, - ma97pkgtype_d_* x, - const int ldx, - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info -) -{ - if( func_ma97_solve == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma97_solve == NULL ) - { - fprintf(stderr, "HSL routine ma97_solve not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma97_solve(job, nrhs, x, ldx, akeep, fkeep, control, info); -} - -void ma97_finalise( - void** akeep, - void** fkeep -) -{ - if( func_ma97_finalise == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma97_finalise == NULL ) - { - fprintf(stderr, "HSL routine ma97_finalise not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma97_finalise(akeep, fkeep); -} - -void ma97_free_akeep( - void** akeep -) -{ - if( func_ma97_free_akeep == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_ma97_free_akeep == NULL ) - { - fprintf(stderr, "HSL routine ma97_free_akeep not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_ma97_free_akeep(akeep); -} -#endif - -#ifndef COINHSL_HAS_MC19 - -static mc19ad_t func_mc19ad = NULL; - -void mc19ad( - ipfint* N, - ipfint* NZ, - double* A, - ipfint* IRN, - ipfint* ICN, - float* R, - float* C, - float* W -) -{ - if( func_mc19ad == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_mc19ad == NULL ) - { - fprintf(stderr, "HSL routine MC19AD not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_mc19ad(N, NZ, A, IRN, ICN, R, C, W); -} -#endif - -#ifndef COINHSL_HAS_MC68 - -mc68_default_control_t func_mc68_default_control = NULL; -mc68_order_t func_mc68_order = NULL; - -void mc68_default_control_i( - struct mc68_control_i* control -) -{ - if( func_mc68_default_control == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_mc68_default_control == NULL ) - { - fprintf(stderr, "HSL routine mc68_default_control not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_mc68_default_control(control); -} - -void mc68_order_i( - int ord, - int n, - const int ptr[], - const int row[], - int perm[], - const struct mc68_control_i* control, - struct mc68_info_i* info -) -{ - if( func_mc68_order == NULL ) - { - LSL_lateHSLLoad(); - } - if( func_mc68_order == NULL ) - { - fprintf(stderr, "HSL routine mc68_default_control not found in " HSLLIBNAME ".\nAbort...\n"); - exit(EXIT_FAILURE); - } - func_mc68_order(ord, n, ptr, row, perm, control, info); -} - -#endif - -int LSL_loadHSL( - const char* libname, - char* msgbuf, - int msglen -) -{ - /* load HSL library */ - if( libname ) - { - HSL_handle = LSL_loadLib(libname, msgbuf, msglen); - } - else /* try a default library name */ - { - HSL_handle = LSL_loadLib(HSLLIBNAME, msgbuf, msglen); - } - if( HSL_handle == NULL ) - { - return 1; - } - - /* load HSL functions */ -#ifndef COINHSL_HAS_MA27 - func_ma27id = (ma27id_t)LSL_loadSym(HSL_handle, "ma27id", msgbuf, msglen); - func_ma27ad = (ma27ad_t)LSL_loadSym(HSL_handle, "ma27ad", msgbuf, msglen); - func_ma27bd = (ma27bd_t)LSL_loadSym(HSL_handle, "ma27bd", msgbuf, msglen); - func_ma27cd = (ma27cd_t)LSL_loadSym(HSL_handle, "ma27cd", msgbuf, msglen); -#endif - -#ifndef COINHSL_HAS_MA57 - func_ma57id = (ma57id_t)LSL_loadSym(HSL_handle, "ma57id", msgbuf, msglen); - func_ma57ad = (ma57ad_t)LSL_loadSym(HSL_handle, "ma57ad", msgbuf, msglen); - func_ma57bd = (ma57bd_t)LSL_loadSym(HSL_handle, "ma57bd", msgbuf, msglen); - func_ma57cd = (ma57cd_t)LSL_loadSym(HSL_handle, "ma57cd", msgbuf, msglen); - func_ma57ed = (ma57ed_t)LSL_loadSym(HSL_handle, "ma57ed", msgbuf, msglen); -#endif - -#ifndef COINHSL_HAS_MA77 -#define LOADMA77SYM( sym ) \ - func_##sym = (sym##_t)LSL_loadSym(HSL_handle, #sym"_d", msgbuf, msglen); - - LOADMA77SYM(ma77_default_control) - LOADMA77SYM(ma77_open_nelt) - LOADMA77SYM(ma77_open) - LOADMA77SYM(ma77_input_vars) - LOADMA77SYM(ma77_input_reals) - LOADMA77SYM(ma77_analyse) - LOADMA77SYM(ma77_factor) - LOADMA77SYM(ma77_factor_solve) - LOADMA77SYM(ma77_solve) - LOADMA77SYM(ma77_resid) - LOADMA77SYM(ma77_scale) - LOADMA77SYM(ma77_enquire_posdef) - LOADMA77SYM(ma77_enquire_indef) - LOADMA77SYM(ma77_alter) - LOADMA77SYM(ma77_restart) - LOADMA77SYM(ma77_finalise) -#endif - -#ifndef COINHSL_HAS_MA86 - func_ma86_default_control = (ma86_default_control_t)LSL_loadSym(HSL_handle, "ma86_default_control_d", msgbuf, msglen); - func_ma86_analyse = (ma86_analyse_t)LSL_loadSym(HSL_handle, "ma86_analyse_d", msgbuf, msglen); - func_ma86_factor = (ma86_factor_t)LSL_loadSym(HSL_handle, "ma86_factor_d", msgbuf, msglen); - func_ma86_factor_solve = (ma86_factor_solve_t)LSL_loadSym(HSL_handle, "ma86_factor_solve_d", msgbuf, msglen); - func_ma86_solve = (ma86_solve_t)LSL_loadSym(HSL_handle, "ma86_solve_d", msgbuf, msglen); - func_ma86_finalise = (ma86_finalise_t)LSL_loadSym(HSL_handle, "ma86_finalise_d", msgbuf, msglen); -#endif - -#ifndef COINHSL_HAS_MA97 - func_ma97_default_control = (ma97_default_control_t)LSL_loadSym(HSL_handle, "ma97_default_control_d", msgbuf, msglen); - func_ma97_analyse = (ma97_analyse_t)LSL_loadSym(HSL_handle, "ma97_analyse_d", msgbuf, msglen); - func_ma97_factor = (ma97_factor_t)LSL_loadSym(HSL_handle, "ma97_factor_d", msgbuf, msglen); - func_ma97_factor_solve = (ma97_factor_solve_t)LSL_loadSym(HSL_handle, "ma97_factor_solve_d", msgbuf, msglen); - func_ma97_solve = (ma97_solve_t)LSL_loadSym(HSL_handle, "ma97_solve_d", msgbuf, msglen); - func_ma97_finalise = (ma97_finalise_t)LSL_loadSym(HSL_handle, "ma97_finalise_d", msgbuf, msglen); - func_ma97_free_akeep = (ma97_free_akeep_t)LSL_loadSym(HSL_handle, "ma97_free_akeep_d", msgbuf, msglen); -#endif - -#ifndef COINHSL_HAS_MC19 - func_mc19ad = (mc19ad_t)LSL_loadSym(HSL_handle, "mc19ad", msgbuf, msglen); -#endif - -#ifndef COINHSL_HAS_MC68 - func_mc68_default_control = (mc68_default_control_t)LSL_loadSym(HSL_handle, "mc68_default_control_i", msgbuf, msglen); - func_mc68_order = (mc68_order_t)LSL_loadSym(HSL_handle, "mc68_order_i", msgbuf, msglen); -#endif - - return 0; -} - -int LSL_unloadHSL(void) -{ - int rc; - - if( HSL_handle == NULL ) - { - return 0; - } - - rc = LSL_unloadLib(HSL_handle); - HSL_handle = NULL; - -#ifndef COINHSL_HAS_MA27 - func_ma27id = NULL; - func_ma27ad = NULL; - func_ma27bd = NULL; - func_ma27cd = NULL; -#endif - -#ifndef COINHSL_HAS_MA57 - func_ma57id = NULL; - func_ma57ad = NULL; - func_ma57bd = NULL; - func_ma57cd = NULL; - func_ma57ed = NULL; -#endif - -#ifndef COINHSL_HAS_MA77 - func_ma77_default_control = NULL; - func_ma77_open_nelt = NULL; - func_ma77_open = NULL; - func_ma77_input_vars = NULL; - func_ma77_input_reals = NULL; - func_ma77_analyse = NULL; - func_ma77_factor = NULL; - func_ma77_factor_solve = NULL; - func_ma77_solve = NULL; - func_ma77_resid = NULL; - func_ma77_scale = NULL; - func_ma77_enquire_posdef = NULL; - func_ma77_enquire_indef = NULL; - func_ma77_alter = NULL; - func_ma77_restart = NULL; - func_ma77_finalise = NULL; -#endif - -#ifndef COINHSL_HAS_MA86 - func_ma86_default_control = NULL; - func_ma86_analyse = NULL; - func_ma86_factor = NULL; - func_ma86_factor_solve = NULL; - func_ma86_solve = NULL; - func_ma86_finalise = NULL; -#endif - -#ifndef COINHSL_HAS_MA97 - func_ma97_default_control = NULL; - func_ma97_analyse = NULL; - func_ma97_factor = NULL; - func_ma97_factor_solve = NULL; - func_ma97_solve = NULL; - func_ma97_finalise = NULL; -#endif - -#ifndef COINHSL_HAS_MC19 - func_mc19ad = NULL; -#endif - -#ifndef COINHSL_HAS_MC68 - func_mc68_default_control = NULL; - func_mc68_order = NULL; -#endif - - return rc; -} - -int LSL_isHSLLoaded(void) -{ - return HSL_handle != NULL; -} - -int LSL_isMA27available(void) -{ -#ifndef COINHSL_HAS_MA27 - return func_ma27id != NULL && func_ma27ad != NULL && func_ma27bd != NULL && func_ma27cd != NULL; -#else - return 1; -#endif -} - -int LSL_isMA57available(void) -{ -#ifndef COINHSL_HAS_MA57 - return func_ma57id != NULL && func_ma57ad != NULL && func_ma57bd != NULL && func_ma57cd != NULL && func_ma57ed != NULL; -#else - return 1; -#endif -} - -int LSL_isMA77available(void) -{ -#ifndef COINHSL_HAS_MA77 - return func_ma77_default_control != NULL && func_ma77_open_nelt != NULL && func_ma77_open != NULL && func_ma77_input_vars != NULL && func_ma77_input_reals != NULL && func_ma77_analyse != NULL && func_ma77_factor != NULL && func_ma77_factor_solve != NULL && func_ma77_solve != NULL && func_ma77_resid != NULL && func_ma77_scale != NULL && func_ma77_enquire_posdef != NULL && func_ma77_enquire_indef != NULL && func_ma77_alter != NULL && func_ma77_restart != NULL && func_ma77_finalise != NULL; -#else - return 1; -#endif -} - -int LSL_isMA86available(void) -{ -#ifndef COINHSL_HAS_MA86 - return func_ma86_default_control != NULL && func_ma86_analyse != NULL && func_ma86_factor != NULL && func_ma86_factor_solve != NULL && func_ma86_solve != NULL && func_ma86_finalise != NULL; -#else - return 1; -#endif -} - -int LSL_isMA97available(void) -{ -#ifndef COINHSL_HAS_MA97 - return func_ma97_default_control != NULL && func_ma97_analyse != NULL && func_ma97_factor != NULL && func_ma97_factor_solve != NULL && func_ma97_solve != NULL && func_ma97_finalise != NULL && func_ma97_free_akeep != NULL; -#else - return 1; -#endif -} - -int LSL_isMC19available(void) -{ -#ifndef COINHSL_HAS_MC19 - return func_mc19ad != NULL; -#else - return 1; -#endif -} - -int LSL_isMC68available(void) -{ -#ifndef COINHSL_HAS_MC68 - return func_mc68_default_control != NULL && func_mc68_order != NULL; -#else - return 1; -#endif -} - -void LSL_lateHSLLoad(void) -{ - char buffer[512]; - int rc; - - sprintf(buffer, "Error unknown."); - rc = LSL_loadHSL(NULL, buffer, 512); - if( rc != 0 ) - { - fprintf(stderr, "Error loading HSL dynamic library " HSLLIBNAME ": %s\nThis executable was not compiled with the HSL routine you specified.\nYou need to compile the HSL dynamic library to use deferred loading of the linear solver.\nAbort...\n", buffer); - exit(EXIT_FAILURE); - } -} - -char* LSL_HSLLibraryName(void) -{ - static char name[] = HSLLIBNAME; - return name; -} - -void LSL_setMA27( - ma27ad_t ma27ad, - ma27bd_t ma27bd, - ma27cd_t ma27cd, - ma27id_t ma27id -) -{ -#ifndef COINHSL_HAS_MA27 - func_ma27ad = ma27ad; - func_ma27bd = ma27bd; - func_ma27cd = ma27cd; - func_ma27id = ma27id; -#else - (void) ma27ad; - (void) ma27bd; - (void) ma27cd; - (void) ma27id; -#endif -} - -void LSL_setMA57( - ma57ad_t ma57ad, - ma57bd_t ma57bd, - ma57cd_t ma57cd, - ma57ed_t ma57ed, - ma57id_t ma57id -) -{ -#ifndef COINHSL_HAS_MA57 - func_ma57ad = ma57ad; - func_ma57bd = ma57bd; - func_ma57cd = ma57cd; - func_ma57ed = ma57ed; - func_ma57id = ma57id; -#else - (void) ma57ad; - (void) ma57bd; - (void) ma57cd; - (void) ma57ed; - (void) ma57id; -#endif -} - -void LSL_setMA77( - ma77_default_control_t ma77_default_control, - ma77_open_nelt_t ma77_open_nelt, - ma77_open_t ma77_open, - ma77_input_vars_t ma77_input_vars, - ma77_input_reals_t ma77_input_reals, - ma77_analyse_t ma77_analyse, - ma77_factor_t ma77_factor, - ma77_factor_solve_t ma77_factor_solve, - ma77_solve_t ma77_solve, - ma77_resid_t ma77_resid, - ma77_scale_t ma77_scale, - ma77_enquire_posdef_t ma77_enquire_posdef, - ma77_enquire_indef_t ma77_enquire_indef, - ma77_alter_t ma77_alter, - ma77_restart_t ma77_restart, - ma77_finalise_t ma77_finalise -) -{ -#ifndef COINHSL_HAS_MA77 - func_ma77_default_control = ma77_default_control; - func_ma77_open_nelt = ma77_open_nelt; - func_ma77_open = ma77_open; - func_ma77_input_vars = ma77_input_vars; - func_ma77_input_reals = ma77_input_reals; - func_ma77_analyse = ma77_analyse; - func_ma77_factor = ma77_factor; - func_ma77_factor_solve = ma77_factor_solve; - func_ma77_solve = ma77_solve; - func_ma77_resid = ma77_resid; - func_ma77_scale = ma77_scale; - func_ma77_enquire_posdef = ma77_enquire_posdef; - func_ma77_enquire_indef = ma77_enquire_indef; - func_ma77_alter = ma77_alter; - func_ma77_restart = ma77_restart; - func_ma77_finalise = ma77_finalise; -#else - (void) ma77_default_control; - (void) ma77_open_nelt; - (void) ma77_open; - (void) ma77_input_vars; - (void) ma77_input_reals; - (void) ma77_analyse; - (void) ma77_factor; - (void) ma77_factor_solve; - (void) ma77_solve; - (void) ma77_resid; - (void) ma77_scale; - (void) ma77_enquire_posdef; - (void) ma77_enquire_indef; - (void) ma77_alter; - (void) ma77_restart; - (void) ma77_finalise; -#endif -} - -void LSL_setMA86( - ma86_default_control_t ma86_default_control, - ma86_analyse_t ma86_analyse, - ma86_factor_t ma86_factor, - ma86_factor_solve_t ma86_factor_solve, - ma86_solve_t ma86_solve, - ma86_finalise_t ma86_finalise -) -{ -#ifndef COINHSL_HAS_MA86 - func_ma86_default_control = ma86_default_control; - func_ma86_analyse = ma86_analyse; - func_ma86_factor = ma86_factor; - func_ma86_factor_solve = ma86_factor_solve; - func_ma86_solve = ma86_solve; - func_ma86_finalise = ma86_finalise; -#else - (void) ma86_default_control; - (void) ma86_analyse; - (void) ma86_factor; - (void) ma86_factor_solve; - (void) ma86_solve; - (void) ma86_finalise; -#endif -} - -void LSL_setMA97( - ma97_default_control_t ma97_default_control, - ma97_analyse_t ma97_analyse, - ma97_factor_t ma97_factor, - ma97_factor_solve_t ma97_factor_solve, - ma97_solve_t ma97_solve, - ma97_finalise_t ma97_finalise, - ma97_free_akeep_t ma97_free_akeep -) -{ -#ifndef COINHSL_HAS_MA97 - func_ma97_default_control = ma97_default_control; - func_ma97_analyse = ma97_analyse; - func_ma97_factor = ma97_factor; - func_ma97_factor_solve = ma97_factor_solve; - func_ma97_solve = ma97_solve; - func_ma97_finalise = ma97_finalise; - func_ma97_free_akeep = ma97_free_akeep; -#else - (void) ma97_default_control; - (void) ma97_analyse; - (void) ma97_factor; - (void) ma97_factor_solve; - (void) ma97_solve; - (void) ma97_finalise; - (void) ma97_free_akeep; -#endif -} - -void LSL_setMC19( - mc19ad_t mc19ad -) -{ -#ifndef COINHSL_HAS_MC19 - func_mc19ad = mc19ad; -#else - (void) mc19ad; -#endif -} - -void LSL_setMC68( - mc68_default_control_t mc68_default_control, - mc68_order_t mc68_order -) -{ -#ifndef COINHSL_HAS_MC68 - func_mc68_default_control = mc68_default_control; - func_mc68_order = mc68_order; -#else - (void) mc68_default_control; - (void) mc68_order; -#endif -} diff --git a/src/contrib/LinearSolverLoader/HSLLoader.h b/src/contrib/LinearSolverLoader/HSLLoader.h deleted file mode 100644 index db7599424..000000000 --- a/src/contrib/LinearSolverLoader/HSLLoader.h +++ /dev/null @@ -1,645 +0,0 @@ -/* Copyright (C) 2008, 2011 GAMS Development and others - * All Rights Reserved. - * This code is published under the Eclipse Public License. - * - * Author: Stefan Vigerske - */ - -#ifndef HSLLOADER_H_ -#define HSLLOADER_H_ - -#include "IpoptConfig.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifndef ma77_default_control -#define ma77_control ma77_control_d -#define ma77_info ma77_info_d -#define ma77_default_control ma77_default_control_d -#define ma77_open_nelt ma77_open_nelt_d -#define ma77_open ma77_open_d -#define ma77_input_vars ma77_input_vars_d -#define ma77_input_reals ma77_input_reals_d -#define ma77_analyse ma77_analyse_d -#define ma77_factor ma77_factor_d -#define ma77_factor_solve ma77_factor_solve_d -#define ma77_solve ma77_solve_d -#define ma77_resid ma77_resid_d -#define ma77_scale ma77_scale_d -#define ma77_enquire_posdef ma77_enquire_posdef_d -#define ma77_enquire_indef ma77_enquire_indef_d -#define ma77_alter ma77_alter_d -#define ma77_restart ma77_restart_d -#define ma77_finalise ma77_finalise_d -#endif - -struct ma77_control; -struct ma77_info; -typedef double ma77pkgtype_d_; - -#ifndef ma86_default_control -#define ma86_control ma86_control_d -#define ma86_info ma86_info_d -#define ma86_default_control ma86_default_control_d -#define ma86_analyse ma86_analyse_d -#define ma86_factor ma86_factor_d -#define ma86_factor_solve ma86_factor_solve_d -#define ma86_solve ma86_solve_d -#define ma86_finalise ma86_finalise_d -#endif - -struct ma86_control; -struct ma86_info; -typedef double ma86pkgtype_d_; -typedef double ma86realtype_d_; - -#ifndef ma97_default_control -#define ma97_control ma97_control_d -#define ma97_info ma97_info_d -#define ma97_default_control ma97_default_control_d -#define ma97_analyse ma97_analyse_d -#define ma97_factor ma97_factor_d -#define ma97_factor_solve ma97_factor_solve_d -#define ma97_solve ma97_solve_d -#define ma97_finalise ma97_finalise_d -#define ma97_free_akeep ma97_free_akeep_d -#endif - -struct ma97_control; -struct ma97_info; -typedef double ma97pkgtype_d_; -typedef double ma97realtype_d_; - -struct mc68_control_i; -struct mc68_info_i; - -#ifndef __IPTYPES_HPP__ -/* Type of Fortran integer translated into C */ -typedef IPOPT_FORTRAN_INTEGER_TYPE ipfint; -#endif - -typedef void (*ma27ad_t)( - ipfint* N, - ipfint* NZ, - const ipfint* IRN, - const ipfint* ICN, - ipfint* IW, - ipfint* LIW, - ipfint* IKEEP, - ipfint* IW1, - ipfint* NSTEPS, - ipfint* IFLAG, - ipfint* ICNTL, - double* CNTL, - ipfint* INFO, - double* OPS -); - -typedef void (*ma27bd_t)( - ipfint* N, - ipfint* NZ, - const ipfint* IRN, - const ipfint* ICN, - double* A, - ipfint* LA, - ipfint* IW, - ipfint* LIW, - ipfint* IKEEP, - ipfint* NSTEPS, - ipfint* MAXFRT, - ipfint* IW1, - ipfint* ICNTL, - double* CNTL, - ipfint* INFO -); - -typedef void (*ma27cd_t)( - ipfint* N, - double* A, - ipfint* LA, - ipfint* IW, - ipfint* LIW, - double* W, - ipfint* MAXFRT, - double* RHS, - ipfint* IW1, - ipfint* NSTEPS, - ipfint* ICNTL, - double* CNTL -); - -typedef void (*ma27id_t)( - ipfint* ICNTL, - double* CNTL -); - -typedef void (*ma57ad_t)( - ipfint* n, /**< Order of matrix. */ - ipfint* ne, /**< Number of entries. */ - const ipfint* irn, /**< Matrix nonzero row structure */ - const ipfint* jcn, /**< Matrix nonzero column structure */ - ipfint* lkeep, /**< Workspace for the pivot order of lenght 3*n */ - ipfint* keep, /**< Workspace for the pivot order of lenght 3*n */ - /* Automatically iflag = 0; ikeep pivot order iflag = 1 */ - ipfint* iwork, /**< Integer work space. */ - ipfint* icntl, /**< Integer Control parameter of length 30 */ - ipfint* info, /**< Statistical Information; Integer array of length 20 */ - double* rinfo /**< Double Control parameter of length 5 */ -); - -typedef void (*ma57bd_t)( - ipfint* n, /**< Order of matrix. */ - ipfint* ne, /**< Number of entries. */ - double* a, /**< Numerical values. */ - double* fact, /**< Entries of factors. */ - ipfint* lfact, /**< Length of array `fact'. */ - ipfint* ifact, /**< Indexing info for factors. */ - ipfint* lifact, /**< Length of array `ifact'. */ - ipfint* lkeep, /**< Length of array `keep'. */ - ipfint* keep, /**< Integer array. */ - ipfint* iwork, /**< Workspace of length `n'. */ - ipfint* icntl, /**< Integer Control parameter of length 20. */ - double* cntl, /**< Double Control parameter of length 5. */ - ipfint* info, /**< Statistical Information; Integer array of length 40. */ - double* rinfo /**< Statistical Information; Real array of length 20. */ -); - -typedef void (*ma57cd_t)( - ipfint* job, /**< Solution job. Solve for... */ - ipfint* n, /**< Order of matrix. */ - double* fact, /**< Entries of factors. */ - ipfint* lfact, /**< Length of array `fact'. */ - ipfint* ifact, /**< Indexing info for factors. */ - ipfint* lifact, /**< Length of array `ifact'. */ - ipfint* nrhs, /**< Number of right hand sides. */ - double* rhs, /**< Numerical Values. */ - ipfint* lrhs, /**< Leading dimensions of `rhs'. */ - double* work, /**< Real workspace. */ - ipfint* lwork, /**< Length of `work', >= N*NRHS. */ - ipfint* iwork, /**< Integer array of length `n'. */ - ipfint* icntl, /**< Integer Control parameter array of length 20. */ - ipfint* info /**< Statistical Information; Integer array of length 40. */ -); - -typedef void (*ma57ed_t)( - ipfint* n, - ipfint* ic, /**< 0: copy real array. >=1: copy integer array. */ - ipfint* keep, - double* fact, - ipfint* lfact, - double* newfac, - ipfint* lnew, - ipfint* ifact, - ipfint* lifact, - ipfint* newifc, - ipfint* linew, - ipfint* info -); - -typedef void (*ma57id_t)( - double* cntl, - ipfint* icntl -); - -typedef void (*ma77_default_control_t)( - struct ma77_control_d* control -); - -typedef void (*ma77_open_nelt_t)( - const int n, - const char* fname1, - const char* fname2, - const char* fname3, - const char* fname4, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const int nelt -); - -typedef void (*ma77_open_t)( - const int n, - const char* fname1, - const char* fname2, - const char* fname3, - const char* fname4, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -typedef void (*ma77_input_vars_t)( - const int idx, - const int nvar, - const int list[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -typedef void (*ma77_input_reals_t)( - const int idx, - const int length, - const double reals[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -typedef void (*ma77_analyse_t)( - const int order[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -typedef void (*ma77_factor_t)( - const int posdef, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const double* scale -); - -typedef void (*ma77_factor_solve_t)( - const int posdef, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const double* scale, - const int nrhs, - const int lx, - double rhs[] -); - -typedef void (*ma77_solve_t)( - const int job, - const int nrhs, - const int lx, - double x[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - const double* scale -); - -typedef void (*ma77_resid_t)( - const int nrhs, - const int lx, - const double x[], - const int lresid, - double resid[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - double* anorm_bnd -); - -typedef void (*ma77_scale_t)( - double scale[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info, - double* anorm -); - -typedef void (*ma77_enquire_posdef_t)( - double d[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -typedef void (*ma77_enquire_indef_t)( - int piv_order[], - double d[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -typedef void (*ma77_alter_t)( - const double d[], - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -typedef void (*ma77_restart_t)( - const char* restart_file, - const char* fname1, - const char* fname2, - const char* fname3, - const char* fname4, - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -typedef void (*ma77_finalise_t)( - void** keep, - const struct ma77_control_d* control, - struct ma77_info_d* info -); - -typedef void (*ma86_default_control_t)( - struct ma86_control* control -); - -typedef void (*ma86_analyse_t)( - const int n, - const int ptr[], - const int row[], - int order[], - void** keep, - const struct ma86_control* control, - struct ma86_info* info -); - -typedef void (*ma86_factor_t)( - const int n, - const int ptr[], - const int row[], - const ma86pkgtype_d_ val[], - const int order[], - void** keep, - const struct ma86_control* control, - struct ma86_info* info, - const ma86pkgtype_d_ scale[] -); - -typedef void (*ma86_factor_solve_t)( - const int n, - const int ptr[], - const int row[], - const ma86pkgtype_d_ val[], - const int order[], - void** keep, - const struct ma86_control* control, - struct ma86_info* info, - const int nrhs, - const int ldx, - ma86pkgtype_d_ x[], - const ma86pkgtype_d_ scale[] -); - -typedef void (*ma86_solve_t)( - const int job, - const int nrhs, - const int ldx, - ma86pkgtype_d_* x, - const int order[], - void** keep, - const struct ma86_control* control, - struct ma86_info* info, - const ma86pkgtype_d_ scale[] -); - -typedef void (*ma86_finalise_t)( - void** keep, - const struct ma86_control* control -); - -typedef void (*ma97_default_control_t)( - struct ma97_control* control -); - -typedef void (*ma97_analyse_t)( - const int check, - const int n, - const int ptr[], - const int row[], - ma97pkgtype_d_ val[], - void** akeep, - const struct ma97_control* control, - struct ma97_info* info, - int order[] -); - -typedef void (*ma97_factor_t)( - const int matrix_type, - const int ptr[], - const int row[], - const ma97pkgtype_d_ val[], - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info, - const ma97pkgtype_d_ scale[] -); - -typedef void (*ma97_factor_solve_t)( - const int matrix_type, - const int ptr[], - const int row[], - const ma97pkgtype_d_ val[], - const int nrhs, - ma97pkgtype_d_ x[], - const int ldx, - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info, - const ma97pkgtype_d_ scale[] -); - -typedef void (*ma97_solve_t)( - const int job, - const int nrhs, - ma97pkgtype_d_* x, - const int ldx, - void** akeep, - void** fkeep, - const struct ma97_control* control, - struct ma97_info* info -); - -typedef void (*ma97_finalise_t)( - void** akeep, - void** fkeep -); - -typedef void (*ma97_free_akeep_t)( - void** akeep -); - -typedef void (*mc19ad_t)( - ipfint* N, - ipfint* NZ, - double* A, - ipfint* IRN, - ipfint* ICN, - float* R, - float* C, - float* W -); - -typedef void (*mc68_default_control_t)( - struct mc68_control_i* control -); - -typedef void (*mc68_order_t)( - int ord, - int n, - const int ptr[], - const int row[], - int perm[], - const struct mc68_control_i* control, - struct mc68_info_i* info -); - -/** Tries to load a dynamically linked library with HSL routines. - * - * Also tries to load symbols for those HSL routines that are not linked into Ipopt, i.e., HAVE_... is not defined. - * Returns a failure if the library cannot be loaded, but not if a symbol is not found. - * @see LSL_isMA27available - * @see LSL_isMA57available - * @see LSL_isMA77available - * @see LSL_isMA86available - * @see LSL_isMA97available - * @see LSL_isMC19available - * @param libname The name under which the HSL lib can be found, or NULL to use a default name (libhsl.SHAREDLIBEXT). - * @param msgbuf A buffer where we can store a failure message. Assumed to be NOT NULL! - * @param msglen Length of the message buffer. - * @return Zero on success, nonzero on failure. - */ -IPOPTLIB_EXPORT int LSL_loadHSL( - const char* libname, - char* msgbuf, - int msglen -); - -/** Unloads a loaded HSL library. - * - * @return Zero on success, nonzero on failure. - */ -IPOPTLIB_EXPORT int LSL_unloadHSL(void); - -/** Indicates whether a HSL library has been loaded. - * - * @return Zero if not loaded, nonzero if handle is loaded - */ -IPOPTLIB_EXPORT int LSL_isHSLLoaded(void); - -/** Indicates whether a HSL library is loaded and all symbols necessary to use MA27 have been found. - * - * @return Zero if not available, nonzero if MA27 is available in the loaded library. - */ -IPOPTLIB_EXPORT int LSL_isMA27available(void); - -/** Indicates whether a HSL library is loaded and all symbols necessary to use MA57 have been found. - * - * @return Zero if not available, nonzero if MA57 is available in the loaded library. - */ -IPOPTLIB_EXPORT int LSL_isMA57available(void); - -/** Indicates whether a HSL library is loaded and all symbols necessary to use MA77 have been found. - * - * @return Zero if not available, nonzero if HSL_MA77 is available in the loaded library. - */ -IPOPTLIB_EXPORT int LSL_isMA77available(void); - -/** Indicates whether a HSL library is loaded and all symbols necessary to use HSL_MA86 have been found. - * - * @return Zero if not available, nonzero if HSL_MA86 is available in the loaded library. - */ -IPOPTLIB_EXPORT int LSL_isMA86available(void); - -/** Indicates whether a HSL library is loaded and all symbols necessary to use HSL_MA97 have been found. - * - * @return Zero if not available, nonzero if HSL_MA97 is available in the loaded library. - */ -IPOPTLIB_EXPORT int LSL_isMA97available(void); - -/** Indicates whether a HSL library is loaded and all symbols necessary to use MA57 have been found. - * - * @return Zero if not available, nonzero if MC19 is available in the loaded library. - */ -IPOPTLIB_EXPORT int LSL_isMC19available(void); - -/** Indicates whether a HSL library is loaded and all symbols necessary to use HSL_MC68 have been found. - * - * @return Zero if not available, nonzero if MC68 is available in the loaded library. - */ -IPOPTLIB_EXPORT int LSL_isMC68available(void); - -/** Returns name of the shared library that should contain HSL */ -IPOPTLIB_EXPORT char* LSL_HSLLibraryName(void); - -/** sets pointers to MA27 functions */ -IPOPTLIB_EXPORT void LSL_setMA27( - ma27ad_t ma27ad, - ma27bd_t ma27bd, - ma27cd_t ma27cd, - ma27id_t ma27id -); - -/** sets pointers to MA57 functions */ -IPOPTLIB_EXPORT void LSL_setMA57( - ma57ad_t ma57ad, - ma57bd_t ma57bd, - ma57cd_t ma57cd, - ma57ed_t ma57ed, - ma57id_t ma57id -); - -/** sets pointers to MA77 functions */ -IPOPTLIB_EXPORT void LSL_setMA77( - ma77_default_control_t ma77_default_control, - ma77_open_nelt_t ma77_open_nelt, - ma77_open_t ma77_open, - ma77_input_vars_t ma77_input_vars, - ma77_input_reals_t ma77_input_reals, - ma77_analyse_t ma77_analyse, - ma77_factor_t ma77_factor, - ma77_factor_solve_t ma77_factor_solve, - ma77_solve_t ma77_solve, - ma77_resid_t ma77_resid, - ma77_scale_t ma77_scale, - ma77_enquire_posdef_t ma77_enquire_posdef, - ma77_enquire_indef_t ma77_enquire_indef, - ma77_alter_t ma77_alter, - ma77_restart_t ma77_restart, - ma77_finalise_t ma77_finalise -); - -/** sets pointers to MA86 functions */ -IPOPTLIB_EXPORT void LSL_setMA86( - ma86_default_control_t ma86_default_control, - ma86_analyse_t ma86_analyse, - ma86_factor_t ma86_factor, - ma86_factor_solve_t ma86_factor_solve, - ma86_solve_t ma86_solve, - ma86_finalise_t ma86_finalise -); - -/** sets pointers to MA97 functions */ -IPOPTLIB_EXPORT void LSL_setMA97( - ma97_default_control_t ma97_default_control, - ma97_analyse_t ma97_analyse, - ma97_factor_t ma97_factor, - ma97_factor_solve_t ma97_factor_solve, - ma97_solve_t ma97_solve, - ma97_finalise_t ma97_finalise, - ma97_free_akeep_t ma97_free_akeep -); - -/** sets pointer to MC19 function */ -IPOPTLIB_EXPORT void LSL_setMC19( - mc19ad_t mc19ad -); - -/** sets pointers to MC68 functions */ -IPOPTLIB_EXPORT void LSL_setMC68( - mc68_default_control_t mc68_default_control, - mc68_order_t mc68_order -); - -#ifdef __cplusplus -} -#endif - -#endif /* HSLLOADER_H_ */ diff --git a/src/contrib/LinearSolverLoader/LibraryHandler.c b/src/contrib/LinearSolverLoader/LibraryHandler.c deleted file mode 100644 index d68ac1a03..000000000 --- a/src/contrib/LinearSolverLoader/LibraryHandler.c +++ /dev/null @@ -1,202 +0,0 @@ -/* Copyright (C) 2008 GAMS Development and others - * All Rights Reserved. - * This code is published under the Eclipse Public License. - * - * Author: Stefan Vigerske - * - * inspired by optcc.c in GAMS I/O libraries - */ - -#include "LibraryHandler.h" - -#include -#include -#include - -#ifdef HAVE_SNPRINTF -#define mysnprintf snprintf -#else -# ifdef HAVE__SNPRINTF -# define mysnprintf _snprintf -# else -# define mysnprintf snprintf -/*# error "Do not have function for save printing into a C-string (snprintf or _snprintf)" */ -# endif -#endif - -soHandle_t LSL_loadLib( - const char* libName, - char* msgBuf, - int msgLen -) -{ - soHandle_t h = NULL; - -#ifdef ERROR_LOADLIB - mysnprintf(msgBuf, msgLen, "loadLib error: Do not know how to handle shared libraries on this operating system"); - return h; -#else - - if( libName == NULL ) - { - mysnprintf(msgBuf, msgLen, "loadLib error: no library name given (libName is NULL)"); - return NULL; - } - -# ifdef HAVE_WINDOWS_H - h = LoadLibrary(libName); - if( NULL == h ) - { - mysnprintf(msgBuf, msgLen, "Windows error while loading dynamic library %s, error = %d.\n(see http://msdn.microsoft.com/en-us/library/ms681381%%28v=vs.85%%29.aspx)\n", libName, GetLastError()); - } -# else - h = dlopen(libName, RTLD_NOW); - if( NULL == h ) - { - strncpy(msgBuf, dlerror(), msgLen); - msgBuf[msgLen - 1] = 0; - } -# endif - - return h; -#endif -} /* LSL_loadLib */ - -int LSL_unloadLib( - soHandle_t h -) -{ - int rc = 1; - -#ifdef HAVE_WINDOWS_H - rc = FreeLibrary (h); - rc = ! rc; -#else -# ifdef HAVE_DLFCN_H - rc = dlclose (h); -# endif -#endif - return rc; -} /* LSL_unLoadLib */ - -#ifdef HAVE_WINDOWS_H -typedef FARPROC symtype; -#else -typedef void* symtype; -#endif - -/** Loads a symbol from a dynamically linked library. - * - * This function is not defined in the header to allow a workaround for the problem that dlsym returns an object instead of a function pointer. - * However, Windows also needs special care. - * - * The method does six attempts to load the symbol. Next to its given name, it also tries variations of lower case and upper case form and with an extra underscore. - * @param h Handle of dynamicall linkes library. - * @param symName Name of the symbol to load. - * @param msgBuf Buffer for error messages, assumed to be NOT NULL! - * @param msgLen Length of message buffer. - * @return A pointer to the symbol, or NULL if not found. - */ -symtype LSL_loadSym( - soHandle_t h, - const char* symName, - char* msgBuf, - int msgLen -) -{ - symtype s; - const char* from; - char* to; - const char* tripSym; - char* err; - char lcbuf[257]; - char ucbuf[257]; - char ocbuf[257]; - size_t symLen; - int trip; - - s = NULL; - err = NULL; - - /* search in this order: - * 1. original - * 2. lower_ - * 3. upper_ - * 4. original_ - * 5. lower - * 6. upper - */ - - symLen = 0; - for( trip = 1; trip <= 6; trip++ ) - { - switch( trip ) - { - case 1: /* original */ - tripSym = symName; - break; - case 2: /* lower_ */ - for( from = symName, to = lcbuf; *from; from++, to++ ) - { - *to = tolower(*from); - } - symLen = from - symName; - *to++ = '_'; - *to = '\0'; - tripSym = lcbuf; - break; - case 3: /* upper_ */ - for( from = symName, to = ucbuf; *from; from++, to++ ) - { - *to = toupper(*from); - } - *to++ = '_'; - *to = '\0'; - tripSym = ucbuf; - break; - case 4: /* original_ */ - memcpy(ocbuf, symName, symLen); - ocbuf[symLen] = '_'; - ocbuf[symLen + 1] = '\0'; - tripSym = ocbuf; - break; - case 5: /* lower */ - lcbuf[symLen] = '\0'; - tripSym = lcbuf; - break; - case 6: /* upper */ - ucbuf[symLen] = '\0'; - tripSym = ucbuf; - break; - default: - tripSym = symName; - } /* end switch */ -#ifdef HAVE_WINDOWS_H - s = GetProcAddress (h, tripSym); - if (NULL != s) - { - return s; - } - else - { - mysnprintf(msgBuf, msgLen, "Cannot find symbol %s in dynamic library, error = %d.", symName, GetLastError()); - } -#else -# ifdef HAVE_DLFCN_H - s = dlsym (h, tripSym); - err = dlerror(); /* we have only one chance; a successive call to dlerror() returns NULL */ - if (err) - { - strncpy(msgBuf, err, msgLen); - msgBuf[msgLen - 1] = 0; - } - else - { - return s; - } -# endif -#endif - } /* end loop over symbol name variations */ - - return NULL; -} /* LSL_loadSym */ diff --git a/src/contrib/LinearSolverLoader/LibraryHandler.h b/src/contrib/LinearSolverLoader/LibraryHandler.h deleted file mode 100644 index 6af26ec59..000000000 --- a/src/contrib/LinearSolverLoader/LibraryHandler.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (C) 2008 GAMS Development and others - * All Rights Reserved. - * This code is published under the Eclipse Public License. - * - * Author: Stefan Vigerske - * - * inspired by optcc.h in GAMS I/O libraries - */ - -#ifndef LIBRARYHANDLER_H_ -#define LIBRARYHANDLER_H_ - -#include "IpoptConfig.h" - -#ifdef HAVE_WINDOWS_H -# include -typedef HINSTANCE soHandle_t; -#ifdef small -#undef small -#endif -#else -# ifdef HAVE_DLFCN_H -# include -# include -typedef void* soHandle_t; -# else -# define ERROR_LOADLIB -typedef void* soHandle_t; -# endif -#endif - -#ifdef _MSC_VER -# define SHAREDLIBEXT "dll" -#elif defined(__APPLE__) -# define SHAREDLIBEXT "dylib" -#else -# define SHAREDLIBEXT "so" -#endif - -/** Loads a dynamically linked library. - * - * @param libname The name of the library to load. - * @param msgbuf A buffer to store an error message. - * @param msglen Length of the message buffer. - * @return Shared library handle, or NULL if failure. - */ -soHandle_t LSL_loadLib( - const char* libname, - char* msgbuf, - int msglen -); - -/** Unloads a shared library. - * @param libhandle Handle of shared library to unload. - * @return Zero on success, nonzero on failure. - */ -int LSL_unloadLib( - soHandle_t libhandle -); - -#endif /* LIBRARYHANDLER_H_ */ diff --git a/src/contrib/LinearSolverLoader/Makefile.am b/src/contrib/LinearSolverLoader/Makefile.am deleted file mode 100644 index 40d8f7233..000000000 --- a/src/contrib/LinearSolverLoader/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2008, 2011 GAMS Development -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. -# -# Author: Stefan Vigerske - -noinst_LTLIBRARIES = libLinearSolverLoader.la - -libLinearSolverLoader_la_SOURCES = \ - LibraryHandler.c \ - HSLLoader.c - -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = HSLLoader.h - -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../Algorithm/LinearSolvers \ - $(IPOPTLIB_CFLAGS) - -if !HAVE_PARDISO - libLinearSolverLoader_la_SOURCES += PardisoLoader.c - includeipopt_HEADERS += PardisoLoader.h -endif diff --git a/src/contrib/LinearSolverLoader/Makefile.in b/src/contrib/LinearSolverLoader/Makefile.in deleted file mode 100644 index 97b90825d..000000000 --- a/src/contrib/LinearSolverLoader/Makefile.in +++ /dev/null @@ -1,693 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# @configure_input@ - -# 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. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright (C) 2008, 2011 GAMS Development -# All Rights Reserved. -# This file is distributed under the Eclipse Public License. -# -# Author: Stefan Vigerske - - -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@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@HAVE_PARDISO_FALSE@am__append_1 = PardisoLoader.c -@HAVE_PARDISO_FALSE@am__append_2 = PardisoLoader.h -subdir = src/contrib/LinearSolverLoader -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__includeipopt_HEADERS_DIST) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/src/Common/config.h \ - $(top_builddir)/src/Common/config_ipopt.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libLinearSolverLoader_la_LIBADD = -@HAVE_PARDISO_FALSE@am__objects_1 = PardisoLoader.lo -am_libLinearSolverLoader_la_OBJECTS = LibraryHandler.lo HSLLoader.lo \ - $(am__objects_1) -libLinearSolverLoader_la_OBJECTS = \ - $(am_libLinearSolverLoader_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 = -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)/HSLLoader.Plo \ - ./$(DEPDIR)/LibraryHandler.Plo ./$(DEPDIR)/PardisoLoader.Plo -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libLinearSolverLoader_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__includeipopt_HEADERS_DIST = HSLLoader.h PardisoLoader.h -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__installdirs = "$(DESTDIR)$(includeipoptdir)" -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 -ACLOCAL = @ACLOCAL@ -ADD_CFLAGS = @ADD_CFLAGS@ -ADD_CXXFLAGS = @ADD_CXXFLAGS@ -ADD_FFLAGS = @ADD_FFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BIT32FCOMMENT = @BIT32FCOMMENT@ -BIT64FCOMMENT = @BIT64FCOMMENT@ -BITS_PER_POINTER = @BITS_PER_POINTER@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXXLIBS = @CXXLIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -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@ -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@ -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@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_LDFLAGS = @LT_LDFLAGS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -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@ -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@ -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@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -coin_doxy_logname = @coin_doxy_logname@ -coin_doxy_tagfiles = @coin_doxy_tagfiles@ -coin_doxy_tagname = @coin_doxy_tagname@ -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@ -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@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = libLinearSolverLoader.la -libLinearSolverLoader_la_SOURCES = LibraryHandler.c HSLLoader.c \ - $(am__append_1) -includeipoptdir = $(includedir)/coin-or -includeipopt_HEADERS = HSLLoader.h $(am__append_2) -AM_CPPFLAGS = \ - -I$(srcdir)/../../Common \ - -I$(srcdir)/../../Algorithm/LinearSolvers \ - $(IPOPTLIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .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; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/contrib/LinearSolverLoader/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/contrib/LinearSolverLoader/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);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(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): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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}; \ - } - -libLinearSolverLoader.la: $(libLinearSolverLoader_la_OBJECTS) $(libLinearSolverLoader_la_DEPENDENCIES) $(EXTRA_libLinearSolverLoader_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libLinearSolverLoader_la_OBJECTS) $(libLinearSolverLoader_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HSLLoader.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LibraryHandler.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PardisoLoader.Plo@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -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 \ - 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 $$?; \ - 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 - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$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; \ - fi -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) \ - $$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 - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(includeipoptdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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 -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/HSLLoader.Plo - -rm -f ./$(DEPDIR)/LibraryHandler.Plo - -rm -f ./$(DEPDIR)/PardisoLoader.Plo - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-includeipoptHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -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 -f ./$(DEPDIR)/HSLLoader.Plo - -rm -f ./$(DEPDIR)/LibraryHandler.Plo - -rm -f ./$(DEPDIR)/PardisoLoader.Plo - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-includeipoptHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES \ - 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-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-man install-pdf install-pdf-am 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-includeipoptHEADERS - -.PRECIOUS: Makefile - - -# 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/contrib/LinearSolverLoader/PardisoLoader.c b/src/contrib/LinearSolverLoader/PardisoLoader.c deleted file mode 100644 index 30796150c..000000000 --- a/src/contrib/LinearSolverLoader/PardisoLoader.c +++ /dev/null @@ -1,202 +0,0 @@ -/* Copyright (C) 2008 GAMS Development and others - * All Rights Reserved. - * This code is published under the Eclipse Public License. - * - * Author: Stefan Vigerske - */ - -#include "IpoptConfig.h" -#include "LibraryHandler.h" -#include "PardisoLoader.h" - -#include -#include -#include - -/* Type of Fortran integer translated into C */ -typedef IPOPT_FORTRAN_INTEGER_TYPE ipfint; - -static soHandle_t Pardiso_handle = NULL; - -void LSL_lateParadisoLibLoad(void); - -typedef void (*voidfun)(void); - -voidfun LSL_loadSym( - soHandle_t h, - const char* symName, - char* msgBuf, - int msgLen -); - -/* assuming PARDISO 4.0.0 and above */ -typedef void (*pardisoinit_t)( - void* PT, - const ipfint* MTYPE, - const ipfint* SOLVER, - ipfint* IPARM, - double* DPARM, - ipfint* E -); - -typedef void (*pardiso_t)( - void** PT, - const ipfint* MAXFCT, - const ipfint* MNUM, - const ipfint* MTYPE, - const ipfint* PHASE, - const ipfint* N, - const double* A, - const ipfint* IA, - const ipfint* JA, - const ipfint* PERM, - const ipfint* NRHS, - ipfint* IPARM, - const ipfint* MSGLVL, - double* B, - double* X, - ipfint* E, - double* DPARM -); - -static pardisoinit_t func_pardisoinit = NULL; -static pardiso_t func_pardiso = NULL; -static int pardiso_is_parallel = 0; - -void pardisoinit( - void* PT, - const ipfint* MTYPE, - const ipfint* SOLVER, - ipfint* IPARM, - double* DPARM, - ipfint* E -) -{ - if( func_pardisoinit == NULL ) - { - LSL_lateParadisoLibLoad(); - } - assert(func_pardisoinit != NULL); - - func_pardisoinit(PT, MTYPE, SOLVER, IPARM, DPARM, E); -} - -void pardiso( - void** PT, - const ipfint* MAXFCT, - const ipfint* MNUM, - const ipfint* MTYPE, - const ipfint* PHASE, - const ipfint* N, - const double* A, - const ipfint* IA, - const ipfint* JA, - const ipfint* PERM, - const ipfint* NRHS, - ipfint* IPARM, - const ipfint* MSGLVL, - double* B, - double* X, - ipfint* E, - double* DPARM -) -{ - if (func_pardiso == NULL) - { - LSL_lateParadisoLibLoad(); - } - assert(func_pardiso != NULL); - - /* if we do not have a parallel version, ensure that IPARM[2] (#threads) is set to 1 */ - if (!pardiso_is_parallel) - { - IPARM[2] = 1; - } - - func_pardiso(PT, MAXFCT, MNUM, MTYPE, PHASE, N, A, IA, JA, PERM, NRHS, IPARM, MSGLVL, B, X, E, DPARM); -} - -#define PARDISOLIBNAME "libpardiso." SHAREDLIBEXT - -int LSL_loadPardisoLib( - const char* libname, - char* msgbuf, - int msglen -) -{ - /* load Pardiso library */ - if( libname ) - { - Pardiso_handle = LSL_loadLib(libname, msgbuf, msglen); - } - else - { - /* try a default library name */ - Pardiso_handle = LSL_loadLib(PARDISOLIBNAME, msgbuf, msglen); - } - if( Pardiso_handle == NULL ) - { - return 1; - } - - /* load Pardiso functions, we assume the >= 4.0.0 interface */ - func_pardisoinit = (pardisoinit_t) LSL_loadSym(Pardiso_handle, "pardisoinit", msgbuf, msglen); - if( func_pardisoinit == NULL ) - { - return 1; - } - - func_pardiso = (pardiso_t) LSL_loadSym(Pardiso_handle, "pardiso", msgbuf, msglen); - if( func_pardiso == NULL ) - { - return 1; - } - - /* check if we use a parallel version of pardiso */ - pardiso_is_parallel = LSL_loadSym(Pardiso_handle, "pardiso_exist_parallel", msgbuf, msglen) != NULL; - - return 0; -} - -int LSL_unloadPardisoLib(void) -{ - int rc; - - if( Pardiso_handle == NULL ) - { - return 0; - } - - rc = LSL_unloadLib(Pardiso_handle); - Pardiso_handle = NULL; - - func_pardisoinit = NULL; - func_pardiso = NULL; - - return rc; -} - -int LSL_isPardisoLoaded(void) -{ - return Pardiso_handle != NULL; -} - -void LSL_lateParadisoLibLoad(void) -{ - char buffer[512]; - int rc; - - sprintf(buffer, "Error unknown."); - rc = LSL_loadPardisoLib(NULL, buffer, 512); - if( rc != 0 ) - { - fprintf(stderr, "Error loading Pardiso dynamic library " PARDISOLIBNAME ": %s\nAbort...\n", buffer); - exit(EXIT_FAILURE); - } -} - -char* LSL_PardisoLibraryName(void) -{ - static char name[] = PARDISOLIBNAME; - return name; -} diff --git a/src/contrib/LinearSolverLoader/PardisoLoader.h b/src/contrib/LinearSolverLoader/PardisoLoader.h deleted file mode 100644 index 6bdaab7f4..000000000 --- a/src/contrib/LinearSolverLoader/PardisoLoader.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 2008 GAMS Development and others - * All Rights Reserved. - * This code is published under the Eclipse Public License. - * - * Author: Stefan Vigerske - */ - -#ifndef PARDISOLOADER_H_ -#define PARDISOLOADER_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** Tries to load a dynamically linked library with Pardiso. - * - * Return a failure if the library cannot be loaded or not all Pardiso symbols are found. - * @param libname The name under which the Pardiso lib can be found, or NULL to use a default name (libpardiso.SHAREDLIBEXT). - * @param msgbuf A buffer where we can store a failure message. Assumed to be NOT NULL! - * @param msglen Length of the message buffer. - * @return Zero on success, nonzero on failure. - */ -IPOPTLIB_EXPORT int LSL_loadPardisoLib( - const char* libname, - char* msgbuf, - int msglen -); - -/** Unloads a loaded Pardiso library. - * @return Zero on success, nonzero on failure. - */ -IPOPTLIB_EXPORT int LSL_unloadPardisoLib(void); - -/** Indicates whether a Pardiso library has been successfully loaded. - * @return Zero if not loaded, nonzero if handle is loaded - */ -IPOPTLIB_EXPORT int LSL_isPardisoLoaded(void); - -/** Returns name of the shared library that should contain Pardiso */ -IPOPTLIB_EXPORT char* LSL_PardisoLibraryName(void); - -#ifdef __cplusplus -} -#endif - -#endif /* PARADISOLOADER_H_ */ diff --git a/src/ipopt.pc.in b/src/ipopt.pc.in new file mode 100644 index 000000000..15a7305fb --- /dev/null +++ b/src/ipopt.pc.in @@ -0,0 +1,15 @@ +@COIN_RELOCATABLE_FALSE@prefix=@prefix@ +@COIN_RELOCATABLE_TRUE@prefix=${pcfiledir}/../.. +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/coin-or + +Name: @PACKAGE_NAME@ +Description: Interior Point Optimizer +URL: @PACKAGE_URL@ +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir} +@COIN_STATIC_BUILD_FALSE@Libs: -L${libdir} -lipopt +@COIN_STATIC_BUILD_FALSE@Requires.private: @IPOPTLIB_PCFILES@ +@COIN_STATIC_BUILD_TRUE@Libs: -L${libdir} -lipopt @IPOPTLIB_LFLAGS_NOPC@ +@COIN_STATIC_BUILD_TRUE@Requires: @IPOPTLIB_PCFILES@ diff --git a/test/Makefile.am b/test/Makefile.am index 38760f637..58d59f48e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -8,7 +8,7 @@ # unitTest for Ipopt # ######################################################################## -noinst_PROGRAMS = hs071_cpp hs071_c +noinst_PROGRAMS = hs071_cpp hs071_c emptynlp getcurr if COIN_HAS_F77 noinst_PROGRAMS += hs071_f @@ -19,22 +19,37 @@ noinst_PROGRAMS += parametric_cpp redhess_cpp endif nodist_hs071_cpp_SOURCES = hs071_main.cpp hs071_nlp.cpp hs071_nlp.hpp -hs071_cpp_LDADD = ../src/Interfaces/libipopt.la +hs071_cpp_LDADD = ../src/libipopt.la nodist_hs071_c_SOURCES = hs071_c.c -hs071_c_LDADD = ../src/Interfaces/libipopt.la $(CXXLIBS) +hs071_c_LDADD = ../src/libipopt.la $(CXXLIBS) -nodist_hs071_f_SOURCES = hs071_f.f -hs071_f_LDADD = ../src/Interfaces/libipopt.la $(CXXLIBS) +nodist_emptynlp_SOURCES = emptynlp.cpp +emptynlp_LDADD = ../src/libipopt.la + +nodist_getcurr_SOURCES = getcurr.cpp +getcurr_LDADD = ../src/libipopt.la + +if !IPOPT_SINGLE + nodist_hs071_f_SOURCES = hs071_f.f +else + nodist_hs071_f_SOURCES = hs071_fs.f +endif +hs071_f_LDADD = ../src/libipopt.la $(CXXLIBS) if BUILD_JAVA +if !IPOPT_SINGLE + HS071J=HS071 +else + HS071J=HS071s +endif -HS071.class : $(top_srcdir)/examples/hs071_java/HS071.java - $(JAVAC) -classpath ../src/Interfaces/org.coinor.ipopt.jar $< -d $(PWD) +$(HS071J).class : $(top_srcdir)/examples/hs071_java/$(HS071J).java + $(JAVAC) -classpath ../src/org.coinor.ipopt.jar $< -d $(PWD) -all-local : HS071.class +all-local : $(HS071J).class -CLEANFILES = HS071.class +CLEANFILES = $(HS071J).class endif @@ -46,22 +61,22 @@ redhess_cpp_LDADD = ../contrib/sIPOPT/src/libsipopt.la # Here list all include flags, relative to this "srcdir" directory. AM_CPPFLAGS = \ - -I$(srcdir)/../src/Common \ - -I$(srcdir)/../src/LinAlg \ - -I$(srcdir)/../src/LinAlg/TMatrices \ - -I$(srcdir)/../src/Algorithm \ - -I$(srcdir)/../src/Interfaces \ - -I$(srcdir)/../contrib/sIPOPT/src \ - -I$(srcdir)/../contrib/sIPOPT/examples/parametric_cpp \ - -I$(srcdir)/../contrib/sIPOPT/examples/redhess_cpp + -I$(srcdir)/../src/Common \ + -I$(srcdir)/../src/LinAlg \ + -I$(srcdir)/../src/LinAlg/TMatrices \ + -I$(srcdir)/../src/Algorithm \ + -I$(srcdir)/../src/Interfaces \ + -I$(srcdir)/../contrib/sIPOPT/src \ + -I$(srcdir)/../contrib/sIPOPT/examples/parametric_cpp \ + -I$(srcdir)/../contrib/sIPOPT/examples/redhess_cpp AM_FFLAGS = -I$(srcdir)/../src/Interfaces -hs071_f.f: +hs071_f.f hs071_fs.f: $(LN_S) ../examples/hs071_f/$@ $@ if BUILD_JAVA -test: $(noinst_PROGRAMS) HS071.class +test: $(noinst_PROGRAMS) $(HS071J).class else test: $(noinst_PROGRAMS) endif diff --git a/test/Makefile.in b/test/Makefile.in index 0d8b777a0..313927e56 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -98,7 +98,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = hs071_cpp$(EXEEXT) hs071_c$(EXEEXT) $(am__EXEEXT_1) \ +noinst_PROGRAMS = hs071_cpp$(EXEEXT) hs071_c$(EXEEXT) \ + emptynlp$(EXEEXT) getcurr$(EXEEXT) $(am__EXEEXT_1) \ $(am__EXEEXT_2) @COIN_HAS_F77_TRUE@am__append_1 = hs071_f @BUILD_SIPOPT_TRUE@am__append_2 = parametric_cpp redhess_cpp @@ -119,22 +120,27 @@ CONFIG_CLEAN_VPATH_FILES = @BUILD_SIPOPT_TRUE@am__EXEEXT_2 = parametric_cpp$(EXEEXT) \ @BUILD_SIPOPT_TRUE@ redhess_cpp$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) -nodist_hs071_c_OBJECTS = hs071_c.$(OBJEXT) -hs071_c_OBJECTS = $(nodist_hs071_c_OBJECTS) -am__DEPENDENCIES_1 = -hs071_c_DEPENDENCIES = ../src/Interfaces/libipopt.la \ - $(am__DEPENDENCIES_1) +nodist_emptynlp_OBJECTS = emptynlp.$(OBJEXT) +emptynlp_OBJECTS = $(nodist_emptynlp_OBJECTS) +emptynlp_DEPENDENCIES = ../src/libipopt.la 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 = +nodist_getcurr_OBJECTS = getcurr.$(OBJEXT) +getcurr_OBJECTS = $(nodist_getcurr_OBJECTS) +getcurr_DEPENDENCIES = ../src/libipopt.la +nodist_hs071_c_OBJECTS = hs071_c.$(OBJEXT) +hs071_c_OBJECTS = $(nodist_hs071_c_OBJECTS) +am__DEPENDENCIES_1 = +hs071_c_DEPENDENCIES = ../src/libipopt.la $(am__DEPENDENCIES_1) nodist_hs071_cpp_OBJECTS = hs071_main.$(OBJEXT) hs071_nlp.$(OBJEXT) hs071_cpp_OBJECTS = $(nodist_hs071_cpp_OBJECTS) -hs071_cpp_DEPENDENCIES = ../src/Interfaces/libipopt.la -nodist_hs071_f_OBJECTS = hs071_f.$(OBJEXT) +hs071_cpp_DEPENDENCIES = ../src/libipopt.la +@IPOPT_SINGLE_FALSE@nodist_hs071_f_OBJECTS = hs071_f.$(OBJEXT) +@IPOPT_SINGLE_TRUE@nodist_hs071_f_OBJECTS = hs071_fs.$(OBJEXT) hs071_f_OBJECTS = $(nodist_hs071_f_OBJECTS) -hs071_f_DEPENDENCIES = ../src/Interfaces/libipopt.la \ - $(am__DEPENDENCIES_1) +hs071_f_DEPENDENCIES = ../src/libipopt.la $(am__DEPENDENCIES_1) nodist_parametric_cpp_OBJECTS = parametricTNLP.$(OBJEXT) \ parametric_driver.$(OBJEXT) parametric_cpp_OBJECTS = $(nodist_parametric_cpp_OBJECTS) @@ -158,10 +164,11 @@ 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)/MySensTNLP.Po ./$(DEPDIR)/hs071_c.Po \ - ./$(DEPDIR)/hs071_main.Po ./$(DEPDIR)/hs071_nlp.Po \ - ./$(DEPDIR)/parametricTNLP.Po ./$(DEPDIR)/parametric_driver.Po \ - ./$(DEPDIR)/redhess_cpp.Po +am__depfiles_remade = ./$(DEPDIR)/MySensTNLP.Po \ + ./$(DEPDIR)/emptynlp.Po ./$(DEPDIR)/getcurr.Po \ + ./$(DEPDIR)/hs071_c.Po ./$(DEPDIR)/hs071_main.Po \ + ./$(DEPDIR)/hs071_nlp.Po ./$(DEPDIR)/parametricTNLP.Po \ + ./$(DEPDIR)/parametric_driver.Po ./$(DEPDIR)/redhess_cpp.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -214,7 +221,8 @@ AM_V_F77LD = $(am__v_F77LD_@AM_V@) am__v_F77LD_ = $(am__v_F77LD_@AM_DEFAULT_V@) am__v_F77LD_0 = @echo " F77LD " $@; am__v_F77LD_1 = -SOURCES = $(nodist_hs071_c_SOURCES) $(nodist_hs071_cpp_SOURCES) \ +SOURCES = $(nodist_emptynlp_SOURCES) $(nodist_getcurr_SOURCES) \ + $(nodist_hs071_c_SOURCES) $(nodist_hs071_cpp_SOURCES) \ $(nodist_hs071_f_SOURCES) $(nodist_parametric_cpp_SOURCES) \ $(nodist_redhess_cpp_SOURCES) am__can_run_installinfo = \ @@ -239,8 +247,6 @@ am__define_uniq_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 ACLOCAL = @ACLOCAL@ ADD_CFLAGS = @ADD_CFLAGS@ ADD_CXXFLAGS = @ADD_CXXFLAGS@ @@ -260,8 +266,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COIN_PKG_CONFIG_PATH = @COIN_PKG_CONFIG_PATH@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -277,10 +284,12 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ +FILECMD = @FILECMD@ FLIBS = @FLIBS@ GREP = @GREP@ HSLLIB_CFLAGS = @HSLLIB_CFLAGS@ @@ -293,7 +302,6 @@ 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@ @@ -347,6 +355,8 @@ SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_CFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_LFLAGS = @SIPOPTAMPLINTERFACELIB_LFLAGS@ SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC = @SIPOPTAMPLINTERFACELIB_LFLAGS_NOPC@ SIPOPTAMPLINTERFACELIB_PCFILES = @SIPOPTAMPLINTERFACELIB_PCFILES@ +SIPOPTLIB_CFLAGS_NOPC = @SIPOPTLIB_CFLAGS_NOPC@ +SIPOPTLIB_LFLAGS_NOPC = @SIPOPTLIB_LFLAGS_NOPC@ STRIP = @STRIP@ VERSION = @VERSION@ _ACJNI_JAVAC = @_ACJNI_JAVAC@ @@ -403,6 +413,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -412,12 +423,19 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ nodist_hs071_cpp_SOURCES = hs071_main.cpp hs071_nlp.cpp hs071_nlp.hpp -hs071_cpp_LDADD = ../src/Interfaces/libipopt.la +hs071_cpp_LDADD = ../src/libipopt.la nodist_hs071_c_SOURCES = hs071_c.c -hs071_c_LDADD = ../src/Interfaces/libipopt.la $(CXXLIBS) -nodist_hs071_f_SOURCES = hs071_f.f -hs071_f_LDADD = ../src/Interfaces/libipopt.la $(CXXLIBS) -@BUILD_JAVA_TRUE@CLEANFILES = HS071.class +hs071_c_LDADD = ../src/libipopt.la $(CXXLIBS) +nodist_emptynlp_SOURCES = emptynlp.cpp +emptynlp_LDADD = ../src/libipopt.la +nodist_getcurr_SOURCES = getcurr.cpp +getcurr_LDADD = ../src/libipopt.la +@IPOPT_SINGLE_FALSE@nodist_hs071_f_SOURCES = hs071_f.f +@IPOPT_SINGLE_TRUE@nodist_hs071_f_SOURCES = hs071_fs.f +hs071_f_LDADD = ../src/libipopt.la $(CXXLIBS) +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_FALSE@HS071J = HS071 +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_TRUE@HS071J = HS071s +@BUILD_JAVA_TRUE@CLEANFILES = $(HS071J).class nodist_parametric_cpp_SOURCES = parametricTNLP.cpp parametric_driver.cpp parametric_cpp_LDADD = ../contrib/sIPOPT/src/libsipopt.la nodist_redhess_cpp_SOURCES = MySensTNLP.cpp redhess_cpp.cpp @@ -425,14 +443,14 @@ redhess_cpp_LDADD = ../contrib/sIPOPT/src/libsipopt.la # Here list all include flags, relative to this "srcdir" directory. AM_CPPFLAGS = \ - -I$(srcdir)/../src/Common \ - -I$(srcdir)/../src/LinAlg \ - -I$(srcdir)/../src/LinAlg/TMatrices \ - -I$(srcdir)/../src/Algorithm \ - -I$(srcdir)/../src/Interfaces \ - -I$(srcdir)/../contrib/sIPOPT/src \ - -I$(srcdir)/../contrib/sIPOPT/examples/parametric_cpp \ - -I$(srcdir)/../contrib/sIPOPT/examples/redhess_cpp + -I$(srcdir)/../src/Common \ + -I$(srcdir)/../src/LinAlg \ + -I$(srcdir)/../src/LinAlg/TMatrices \ + -I$(srcdir)/../src/Algorithm \ + -I$(srcdir)/../src/Interfaces \ + -I$(srcdir)/../contrib/sIPOPT/src \ + -I$(srcdir)/../contrib/sIPOPT/examples/parametric_cpp \ + -I$(srcdir)/../contrib/sIPOPT/examples/redhess_cpp AM_FFLAGS = -I$(srcdir)/../src/Interfaces all: all-am @@ -480,6 +498,14 @@ clean-noinstPROGRAMS: echo " rm -f" $$list; \ rm -f $$list +emptynlp$(EXEEXT): $(emptynlp_OBJECTS) $(emptynlp_DEPENDENCIES) $(EXTRA_emptynlp_DEPENDENCIES) + @rm -f emptynlp$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(emptynlp_OBJECTS) $(emptynlp_LDADD) $(LIBS) + +getcurr$(EXEEXT): $(getcurr_OBJECTS) $(getcurr_DEPENDENCIES) $(EXTRA_getcurr_DEPENDENCIES) + @rm -f getcurr$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(getcurr_OBJECTS) $(getcurr_LDADD) $(LIBS) + hs071_c$(EXEEXT): $(hs071_c_OBJECTS) $(hs071_c_DEPENDENCIES) $(EXTRA_hs071_c_DEPENDENCIES) @rm -f hs071_c$(EXEEXT) $(AM_V_CCLD)$(LINK) $(hs071_c_OBJECTS) $(hs071_c_LDADD) $(LIBS) @@ -507,6 +533,8 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MySensTNLP.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emptynlp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcurr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hs071_c.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hs071_main.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hs071_nlp.Po@am__quote@ # am--include-marker @@ -677,6 +705,8 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ distclean: distclean-am -rm -f ./$(DEPDIR)/MySensTNLP.Po + -rm -f ./$(DEPDIR)/emptynlp.Po + -rm -f ./$(DEPDIR)/getcurr.Po -rm -f ./$(DEPDIR)/hs071_c.Po -rm -f ./$(DEPDIR)/hs071_main.Po -rm -f ./$(DEPDIR)/hs071_nlp.Po @@ -729,6 +759,8 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/MySensTNLP.Po + -rm -f ./$(DEPDIR)/emptynlp.Po + -rm -f ./$(DEPDIR)/getcurr.Po -rm -f ./$(DEPDIR)/hs071_c.Po -rm -f ./$(DEPDIR)/hs071_main.Po -rm -f ./$(DEPDIR)/hs071_nlp.Po @@ -772,15 +804,15 @@ uninstall-am: .PRECIOUS: Makefile -@BUILD_JAVA_TRUE@HS071.class : $(top_srcdir)/examples/hs071_java/HS071.java -@BUILD_JAVA_TRUE@ $(JAVAC) -classpath ../src/Interfaces/org.coinor.ipopt.jar $< -d $(PWD) +@BUILD_JAVA_TRUE@$(HS071J).class : $(top_srcdir)/examples/hs071_java/$(HS071J).java +@BUILD_JAVA_TRUE@ $(JAVAC) -classpath ../src/org.coinor.ipopt.jar $< -d $(PWD) -@BUILD_JAVA_TRUE@all-local : HS071.class +@BUILD_JAVA_TRUE@all-local : $(HS071J).class -hs071_f.f: +hs071_f.f hs071_fs.f: $(LN_S) ../examples/hs071_f/$@ $@ -@BUILD_JAVA_TRUE@test: $(noinst_PROGRAMS) HS071.class +@BUILD_JAVA_TRUE@test: $(noinst_PROGRAMS) $(HS071J).class @BUILD_JAVA_FALSE@test: $(noinst_PROGRAMS) chmod u+x ./run_unitTests ./run_unitTests diff --git a/test/emptynlp.cpp b/test/emptynlp.cpp new file mode 100644 index 000000000..c4950ca15 --- /dev/null +++ b/test/emptynlp.cpp @@ -0,0 +1,757 @@ +// Copyright (C) 2021 COIN-OR Foundation +// All Rights Reserved. +// This code is published under the Eclipse Public License. + +// get active asserts also if NDEBUG is defined +#ifdef NDEBUG +#undef NDEBUG +#endif + +#include "IpIpoptApplication.hpp" +#include "IpSolveStatistics.hpp" +#include "IpTNLP.hpp" + +#include +#include +#include + +using namespace Ipopt; + +/** Empty NLP to test with Ipopt + * + * min sum_i x_i + * s.t. x = 0 if not infeasbounds + * 1 <= x <= 0 if infeasbounds + * sum_i x_i >= 0 if not infeascons and cons + * sum_i x_i >= 1 if infeascons + */ +class EmptyNLP: public TNLP +{ +private: + int nvars; + bool cons; + bool infeascons; + bool infeasbounds; + +public: + /** constructor */ + EmptyNLP( + int nvars_ = 0, + bool cons_ = true, + bool infeascons_ = false, + bool infeasbounds_ = false + ) + : nvars(nvars_), + cons(cons_), + infeascons(infeascons_), + infeasbounds(infeasbounds_) + { + assert(!infeasbounds || nvars > 0); + assert(!infeascons || cons); + } + + /** destructor */ + ~EmptyNLP() { } + + /** Method to return some info about the nlp */ + bool get_nlp_info( + Index& n, + Index& m, + Index& nnz_jac_g, + Index& nnz_h_lag, + IndexStyleEnum& index_style + ) + { + n = nvars; + m = cons ? 1 : 0; + nnz_jac_g = cons ? n : 0; + nnz_h_lag = 0; + index_style = C_STYLE; + + return true; + } + + /** Method to return the bounds for my problem */ + bool get_bounds_info( + Index n, + Number* x_l, + Number* x_u, + Index m, + Number* g_l, + Number* g_u + ) + { + for( Index i = 0; i < n; ++i ) + { + x_l[i] = infeasbounds ? 1.0 : 0.0; + x_u[i] = 0.0; + } + + assert(m == (cons ? 1 : 0)); + if( cons ) + { + g_l[0] = infeascons ? 1.0 : 0.0; + g_u[0] = 1e300; + } + + return true; + } + + /** Method to return the starting point for the algorithm */ + bool get_starting_point( + Index n, + bool init_x, + Number* x, + bool init_z, + Number*, + Number*, + Index, + bool init_lambda, + Number* + ) + { + if( init_x ) + for( Index i = 0; i < n; ++i ) + { + x[i] = 10.0; + } + + assert(!init_z); + assert(!init_lambda); + + return true; + } + + /** Method to return the objective value */ + bool eval_f( + Index n, + const Number* x, + bool, + Number& obj_value + ) + { + obj_value = 0.0; + for( Index i = 0; i < n; ++i ) + { + obj_value += x[i]; + } + + return true; + } + + /** Method to return the gradient of the objective */ + bool eval_grad_f( + Index n, + const Number*, + bool, + Number* grad_f + ) + { + for( Index i = 0; i < n; ++i ) + { + grad_f[i] = 1.0; + } + + return true; + } + + /** Method to return the constraint residuals */ + bool eval_g( + Index n, + const Number* x, + bool, + Index m, + Number* g + ) + { + if( !cons ) + { + return true; + } + + assert(m == 1); + + g[0] = 0.0; + for( Index i = 0; i < n; ++i ) + { + g[0] += x[i]; + } + + return true; + } + + /** Method to return: + * 1) The structure of the Jacobian (if "values" is NULL) + * 2) The values of the Jacobian (if "values" is not NULL) + */ + bool eval_jac_g( + Index n, + const Number*, + bool, + Index, + Index nele_jac, + Index* iRow, + Index* jCol, + Number* values + ) + { + assert(nele_jac == (cons ? n : 0)); + + if( !cons ) + { + return true; + } + + assert((iRow != NULL) == (jCol != NULL)); + assert((iRow != NULL) == (values == NULL)); + + if( iRow != NULL ) + for( Index i = 0; i < n; ++i ) + { + iRow[i] = 0; + jCol[i] = i; + } + else + for( Index i = 0; i < n; ++i ) + { + values[i] = 1.0; + } + + return true; + } + + /** Method to return: + * 1) The structure of the Hessian of the Lagrangian (if "values" is NULL) + * 2) The values of the Hessian of the Lagrangian (if "values" is not NULL) + */ + bool eval_h( + Index, + const Number*, + bool, + Number, + Index, + const Number*, + bool, + Index, + Index*, + Index*, + Number* + ) + { + return true; + } + + /** This method is called when the algorithm is complete so the TNLP can store/write the solution */ + 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*, + IpoptCalculatedQuantities* + ) + { + std::cout << "Finalize called" << std::endl; + std::cout << "x ="; + for( Index i = 0; i < n; ++i ) + { + std::cout << ' ' << x[i]; + } + std::cout << std::endl; + std::cout << "z_L ="; + for( Index i = 0; i < n; ++i ) + { + std::cout << ' ' << z_L[i]; + } + std::cout << std::endl; + std::cout << "z_U ="; + for( Index i = 0; i < n; ++i ) + { + std::cout << ' ' << z_U[i]; + } + std::cout << std::endl; + std::cout << "lambda ="; + for( Index i = 0; i < m; ++i ) + { + std::cout << ' ' << lambda[i]; + } + std::cout << std::endl; + + if( status != (infeascons ? LOCAL_INFEASIBILITY : SUCCESS) ) + { + std::cout << "*** Unexpected solver status " << status << " for" << (infeascons ? " infeasible" : "") << " NLP" << std::endl; + } + + if( status == SUCCESS ) + { + Number tol = 1e-6; + assert(std::abs(obj_value) < tol); + + for( Index i = 0; i < n; ++i ) + { + assert(std::abs(x[i]) < tol); + } + + for( Index i = 0; i < m; ++i ) + { + assert(std::abs(g[i]) < tol); + } + } + } +}; + +bool runEmpty( + int nvars, + bool cons, + bool infeascons, + bool infeasbounds +) +{ + std::cout << std::endl << "*** Solve for " << nvars << " variables, " + << (cons ? 1 : 0) << ' ' + << (infeascons ? "infeasible" : "feasible") << " constraint, " + << (infeasbounds ? "infeasible" : "feasible") << " bounds" + << std::endl; + + // Create an instance of your nlp... + SmartPtr nlp = new EmptyNLP(nvars, cons, infeascons, infeasbounds); + + // Create an instance of the IpoptApplication + SmartPtr app = new IpoptApplication(); + + // Initialize the IpoptApplication and process the options + ApplicationReturnStatus status; + status = app->Initialize(); + if( status != Solve_Succeeded ) + { + std::cout << std::endl << std::endl << "*** Error during initialization!" << std::endl; + return false; + } + + status = app->OptimizeTNLP(nlp); + + assert((status == Solve_Succeeded) == (!infeasbounds && !infeascons)); + assert((status == Infeasible_Problem_Detected) == infeascons); + assert((status == Invalid_Problem_Definition) == infeasbounds); + + if( status > Not_Enough_Degrees_Of_Freedom ) + { + assert(IsValid(app->Statistics())); + + // Retrieve some statistics about the solve + Index iter_count = app->Statistics()->IterationCount(); + std::cout << std::endl << std::endl << "The problem solved in " << iter_count << " iterations!" << std::endl; + + Number final_obj = app->Statistics()->FinalObjective(); + std::cout << std::endl << std::endl << "The final value of the objective function is " << final_obj << '.' + << std::endl; + + assert(app->Statistics()->IterationCount() == 0); + } + + return true; +} + +/** Mostly empty NLP to test reoptimization with Ipopt + * + * min sum_i x_i + * s.t. 0 <= x + * x_i <= 0 for i <= nfixed + * sum_i x_i = rhs + * x_1 = 0 (as constraint) + */ +class ReOptNLP: public TNLP +{ +private: + Number rhs; +public: + int nvars; + int nfixed; + + /** constructor */ + ReOptNLP( + Number rhs_ = 0.0 + ) + : rhs(rhs_), + nvars(2), + nfixed(0) + { } + + /** Method to return some info about the nlp */ + bool get_nlp_info( + Index& n, + Index& m, + Index& nnz_jac_g, + Index& nnz_h_lag, + IndexStyleEnum& index_style + ) + { + n = nvars; + m = 2; + nnz_jac_g = n + 1; + nnz_h_lag = 0; + index_style = C_STYLE; + + return true; + } + + /** Method to return the bounds for my problem */ + bool get_bounds_info( + Index n, + Number* x_l, + Number* x_u, + Index m, + Number* g_l, + Number* g_u + ) + { + for( Index i = 0; i < n; ++i ) + { + x_l[i] = 0.0; + x_u[i] = i < nfixed ? 0.0 : 1.0; + } + + assert(m == 2); + g_l[0] = rhs; + g_u[0] = rhs; + + g_l[1] = 0.0; + g_u[1] = 0.0; + + return true; + } + + /** Method to return the starting point for the algorithm */ + bool get_starting_point( + Index n, + bool init_x, + Number* x, + bool init_z, + Number*, + Number*, + Index, + bool init_lambda, + Number* + ) + { + if( init_x ) + for( Index i = 0; i < n; ++i ) + { + x[i] = 10.0; + } + + assert(!init_z); + assert(!init_lambda); + + return true; + } + + /** Method to return the objective value */ + bool eval_f( + Index n, + const Number* x, + bool, + Number& obj_value + ) + { + obj_value = 0.0; + for( Index i = 0; i < n; ++i ) + { + obj_value += x[i]; + } + + return true; + } + + /** Method to return the gradient of the objective */ + bool eval_grad_f( + Index n, + const Number*, + bool, + Number* grad_f + ) + { + for( Index i = 0; i < n; ++i ) + { + grad_f[i] = 1.0; + } + + return true; + } + + /** Method to return the constraint residuals */ + bool eval_g( + Index n, + const Number* x, + bool, + Index m, + Number* g + ) + { + assert(m == 2); + + g[0] = 0.0; + for( Index i = 0; i < n; ++i ) + { + g[0] += x[i]; + } + + g[1] = x[0]; + + return true; + } + + /** Method to return: + * 1) The structure of the Jacobian (if "values" is NULL) + * 2) The values of the Jacobian (if "values" is not NULL) + */ + bool eval_jac_g( + Index n, + const Number*, + bool, + Index, + Index nele_jac, + Index* iRow, + Index* jCol, + Number* values + ) + { + assert((iRow != NULL) == (jCol != NULL)); + assert((iRow != NULL) == (values == NULL)); + assert(nele_jac == n + 1); + + if( iRow != NULL ) + { + for( Index i = 0; i < n; ++i ) + { + iRow[i] = 0; + jCol[i] = i; + } + iRow[n] = 1; + jCol[n] = 0; + } + else + for( Index i = 0; i < n + 1; ++i ) + { + values[i] = 1.0; + } + + return true; + } + + /** Method to return: + * 1) The structure of the Hessian of the Lagrangian (if "values" is NULL) + * 2) The values of the Hessian of the Lagrangian (if "values" is not NULL) + */ + bool eval_h( + Index, + const Number*, + bool, + Number, + Index, + const Number*, + bool, + Index, + Index*, + Index*, + Number* + ) + { + return true; + } + + /** This method is called when the algorithm is complete so the TNLP can store/write the solution */ + 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*, + IpoptCalculatedQuantities* + ) + { + std::cout << "Finalize called" << std::endl; + std::cout << "x ="; + for( Index i = 0; i < n; ++i ) + { + std::cout << ' ' << x[i]; + } + std::cout << std::endl; + std::cout << "z_L ="; + for( Index i = 0; i < n; ++i ) + { + std::cout << ' ' << z_L[i]; + } + std::cout << std::endl; + std::cout << "z_U ="; + for( Index i = 0; i < n; ++i ) + { + std::cout << ' ' << z_U[i]; + } + std::cout << std::endl; + std::cout << "lambda ="; + for( Index i = 0; i < m; ++i ) + { + std::cout << ' ' << lambda[i]; + } + std::cout << std::endl; + + if( status == SUCCESS ) + { + Number tol = 1e-5; + assert(std::abs(obj_value - rhs) < tol); + + if( rhs == 0.0 ) + { + for( Index i = 0; i < n; ++i ) + { + assert(std::abs(x[i]) < tol); + } + } + + assert(std::abs(g[0] - rhs) < tol); + assert(std::abs(g[1]) < tol); + } + } +}; + +bool runReOpt( + int nvars1, + int nvars2, + int nfixed, + Number rhs +) +{ + std::cout << std::endl << "*** Solve with " << nvars1 << " variables and rhs=" << rhs << "." << std::endl; + + SmartPtr nlp = new ReOptNLP(rhs); + nlp->nvars = nvars1; + SmartPtr app = new IpoptApplication(); + + ApplicationReturnStatus status; + status = app->Initialize(); + if( status != Solve_Succeeded ) + { + std::cout << std::endl << std::endl << "*** Error during initialization!" << std::endl; + return false; + } + + status = app->OptimizeTNLP(GetRawPtr(nlp)); + + if( nvars1 < 2 ) + { + assert(status == Not_Enough_Degrees_Of_Freedom); + } + else + { + assert((status == Solve_Succeeded) == (rhs <= 1)); + assert((status == Infeasible_Problem_Detected) == (rhs > 1)); + } + + std::cout << std::endl << "*** Resolve with " << nvars2 << " variables, " << nfixed << " variables fixed." << std::endl; + + nlp->nvars = nvars2; + nlp->nfixed = nfixed; + status = app->ReOptimizeTNLP(GetRawPtr(nlp)); + + if( nvars2 < 2 && nfixed < nvars2 ) + { + assert(status == Not_Enough_Degrees_Of_Freedom); + } + else + { + assert((status == Solve_Succeeded) == (rhs <= 1 && (rhs == 0.0 || nfixed < nvars2))); + assert((status == Infeasible_Problem_Detected) == (rhs > 1 || (rhs != 0.0 && nfixed == nvars2))); + } + + return true; +} + +int main( + int, + char** +) +{ + if( !runEmpty(0, false, false, false) ) + { + return EXIT_FAILURE; + } + + if( !runEmpty(0, true, false, false) ) + { + return EXIT_FAILURE; + } + + if( !runEmpty(5, true, false, false) ) + { + return EXIT_FAILURE; + } + + if( !runEmpty(0, true, true, false) ) + { + return EXIT_FAILURE; + } + + if( !runEmpty(5, true, true, false) ) + { + return EXIT_FAILURE; + } + + if( !runEmpty(5, true, false, true) ) + { + return EXIT_FAILURE; + } + + // 2 variables, fix them in resolve, 2 constraints + if( !runReOpt(2, 2, 2, 0.0) ) + { + return EXIT_FAILURE; + } + + if( !runReOpt(2, 2, 2, 1.0) ) + { + return EXIT_FAILURE; + } + + // 1 variable, do not fix in resolve, 2 constraints + // should give a too-few-degree-of-freedom in both solves + if( !runReOpt(1, 1, 0, 0.0) ) + { + return EXIT_FAILURE; + } + + // 2 variables, then 1 variable, do not fix in resolve + // should give a too-few-degree-of-freedom for second solve (this case had a bug) + if( !runReOpt(2, 1, 0, 0.0) ) + { + return EXIT_FAILURE; + } + + // 2 variables, then 1 variable, but fixed in resolve + // should not give a too-few-degree-of-freedom, but feasible + if( !runReOpt(2, 1, 1, 0.0) ) + { + return EXIT_FAILURE; + } + + // 2 variables, then 1 variable, but fixed in resolve + // should not give a too-few-degree-of-freedom, but infeasible + if( !runReOpt(2, 1, 1, 1.0) ) + { + return EXIT_FAILURE; + } + + std::cout << std::endl << "*** All tests passed" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/test/getcurr.cpp b/test/getcurr.cpp new file mode 100644 index 000000000..2880c1d3a --- /dev/null +++ b/test/getcurr.cpp @@ -0,0 +1,688 @@ +// Copyright (C) 2021 COIN-OR Foundation +// All Rights Reserved. +// This code is published under the Eclipse Public License. + +// get active asserts also if NDEBUG is defined +#ifdef NDEBUG +#undef NDEBUG +#endif + +#include "IpIpoptApplication.hpp" +#include "IpSolveStatistics.hpp" +#include "IpTNLP.hpp" + +#include +#include +#include + +using namespace Ipopt; + +#ifdef IPOPT_SINGLE +#define TESTTOL 5e-4 +#else +#define TESTTOL 1e-9 +#endif +#define ASSERTEQ(val1, val2) \ + do if( std::abs((val1)-(val2)) > TESTTOL*std::max(1.0,std::max((double)std::abs(val1),(double)std::abs(val2))) ) \ + { \ + fflush(stdout); \ + fprintf(stderr, "Line %d: Wrong %s = %.12g, expected %s = %.12g\n", __LINE__, #val1, val1, #val2, val2); \ + abort(); \ + } while (false) + +/** NLP to test TNLP::get_current_iterate() and TNLP::get_current_violations() + * + * min x1 + x2 + x3 + * s.t. 1 <= x1^2 + x2^2 + x3^2 <= 2 + * x1^2 - x3^2 = 0.5 + * x1 >= -10 + * x2 = 1 + */ +class TestNLP: public TNLP +{ +private: + /// whether fixed variables are treated as constraints + bool fixedvar_makeconstr_; + bool scaling_; + bool maximize_; + +public: + /** constructor */ + TestNLP( + bool fixedvar_makeconstr, + bool scaling, + bool maximize + ) + : fixedvar_makeconstr_(fixedvar_makeconstr), + scaling_(scaling), + maximize_(maximize) + { } + + /** Method to return some info about the nlp */ + bool get_nlp_info( + Index& n, + Index& m, + Index& nnz_jac_g, + Index& nnz_h_lag, + IndexStyleEnum& index_style + ) + { + n = 3; + m = 2; + nnz_jac_g = 5; + nnz_h_lag = 3; + index_style = C_STYLE; + + return true; + } + + /** Method to return the bounds for my problem */ + bool get_bounds_info( + Index n, + Number* x_l, + Number* x_u, + Index m, + Number* g_l, + Number* g_u + ) + { + assert(n == 3); + assert(m == 2); + + x_l[0] = -10.0; + x_u[0] = 1e300; + + x_l[1] = 1.0; + x_u[1] = 1.0; + + x_l[2] = -1e300; + x_u[2] = 1e300; + + g_l[0] = 1.0; + g_u[0] = 2.0; + + g_l[1] = 0.5; + g_u[1] = 0.5; + + return true; + } + + /** Method to return the starting point for the algorithm */ + bool get_starting_point( + Index n, + bool init_x, + Number* x, + bool init_z, + Number*, + Number*, + Index, + bool init_lambda, + Number* + ) + { + assert(n == 3); + + if( init_x ) + { + x[0] = 1.0; + x[1] = 1.0; + x[2] = -1.0; + } + + assert(!init_z); + assert(!init_lambda); + + return true; + } + + /** Method to request scaling parameters. */ + 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 + ) + { + assert(n == 3); + assert(m == 2); + + obj_scaling = 2.0; + if( maximize_ ) + { + obj_scaling *= -1.0; + } + + use_x_scaling = true; + x_scaling[0] = 3.0; + x_scaling[1] = 1.0; + x_scaling[2] = 5.0; + + use_g_scaling = true; + g_scaling[0] = 7.0; + g_scaling[1] = 11.0; + + return true; + } + + /** Method to return the objective value */ + bool eval_f( + Index n, + const Number* x, + bool, + Number& obj_value + ) + { + assert(n == 3); + + obj_value = x[0] + x[1] + x[2]; + + return true; + } + + /** Method to return the gradient of the objective */ + bool eval_grad_f( + Index n, + const Number*, + bool, + Number* grad_f + ) + { + assert(n == 3); + + grad_f[0] = 1.0; + grad_f[1] = 1.0; + grad_f[2] = 1.0; + + return true; + } + + /** Method to return the constraint residuals */ + bool eval_g( + Index n, + const Number* x, + bool, + Index m, + Number* g + ) + { + assert(n == 3); + assert(m == 2); + + g[0] = x[0] * x[0] + x[1] * x[1] + x[2] * x[2]; + g[1] = x[0] * x[0] - x[2] * x[2]; + + return true; + } + + /** Method to return: + * 1) The structure of the Jacobian (if "values" is NULL) + * 2) The values of the Jacobian (if "values" is not NULL) + */ + bool eval_jac_g( + Index n, + const Number* x, + bool, + Index m, + Index nele_jac, + Index* iRow, + Index* jCol, + Number* values + ) + { + assert(n == 3); + assert(m == 2); + assert(nele_jac == 5); + assert((iRow != NULL) == (jCol != NULL)); + assert((iRow != NULL) == (values == NULL)); + + if( iRow != NULL ) + { + iRow[0] = 0; + jCol[0] = 0; + + iRow[1] = 0; + jCol[1] = 1; + + iRow[2] = 0; + jCol[2] = 2; + + iRow[3] = 1; + jCol[3] = 0; + + iRow[4] = 1; + jCol[4] = 2; + } + else + { + values[0] = 2 * x[0]; + values[1] = 2 * x[1]; + values[2] = 2 * x[2]; + values[3] = 2 * x[0]; + values[4] = -2 * x[2]; + } + + return true; + } + + /** Method to return: + * 1) The structure of the Hessian of the Lagrangian (if "values" is NULL) + * 2) The values of the Hessian of the Lagrangian (if "values" is not NULL) + */ + bool eval_h( + Index n, + const Number*, + bool, + Number, + Index m, + const Number* lambda, + bool, + Index nele_hess, + Index* iRow, + Index* jCol, + Number* values + ) + { + assert(n == 3); + assert(m == 2); + assert(nele_hess == 3); + assert((iRow != NULL) == (jCol != NULL)); + assert((iRow != NULL) == (values == NULL)); + + if( iRow != NULL ) + { + iRow[0] = 0; + jCol[0] = 0; + + iRow[1] = 1; + jCol[1] = 1; + + iRow[2] = 2; + jCol[2] = 2; + } + else + { + values[0] = 2 * lambda[0] + 2 * lambda[1]; + values[1] = 2 * lambda[0]; + values[2] = 2 * lambda[0] - 2 * lambda[1]; + } + + return true; + } + + /** This method is called when the algorithm is complete so the TNLP can store/write the solution */ + void finalize_solution( + SolverReturn, + Index n, + const Number* x, + const Number* z_L, + const Number* z_U, + Index m, + const Number* g, + const Number* lambda, + Number, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq + ) + { + std::cout << "Finalizing:" << std::endl; + std::cout << " x ="; + for( Index i = 0; i < n; ++i ) + { + std::cout << ' ' << x[i]; + } + std::cout << std::endl; + std::cout << " z_L ="; + for( Index i = 0; i < n; ++i ) + { + std::cout << ' ' << z_L[i]; + } + std::cout << std::endl; + std::cout << " z_U ="; + for( Index i = 0; i < n; ++i ) + { + std::cout << ' ' << z_U[i]; + } + std::cout << std::endl; + std::cout << " g ="; + for( Index i = 0; i < m; ++i ) + { + std::cout << ' ' << g[i]; + } + std::cout << std::endl; + std::cout << " lambda ="; + for( Index i = 0; i < m; ++i ) + { + std::cout << ' ' << lambda[i]; + } + std::cout << std::endl; + + // check that get_curr_iterate() returns the same point + Number curr_x[3]; + Number curr_z_L[3]; + Number curr_z_U[3]; + Number curr_g[3]; + Number curr_lambda[3]; + assert(get_curr_iterate(ip_data, ip_cq, false, n, curr_x, curr_z_L, curr_z_U, m, curr_g, curr_lambda)); + + ASSERTEQ(curr_x[0], x[0]); + ASSERTEQ(curr_x[1], x[1]); + ASSERTEQ(curr_x[2], x[2]); + ASSERTEQ(curr_z_L[0], z_L[0]); + ASSERTEQ(curr_z_L[1], z_L[1]); + ASSERTEQ(curr_z_L[2], z_L[2]); + ASSERTEQ(curr_z_U[0], z_U[0]); + ASSERTEQ(curr_z_U[1], z_U[1]); + ASSERTEQ(curr_z_U[2], z_U[2]); + ASSERTEQ(curr_g[0], g[0]); + ASSERTEQ(curr_g[1], g[1]); + ASSERTEQ(curr_lambda[0], lambda[0]); + ASSERTEQ(curr_lambda[1], lambda[1]); + + // run checks on current point and violations + intermediate_callback(RegularMode, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, ip_data, ip_cq); + } + + bool intermediate_callback( + AlgorithmMode mode, + Index, + Number, + Number, + Number, + Number, + Number, + Number, + Number, + Number, + Index, + const IpoptData* ip_data, + IpoptCalculatedQuantities* ip_cq + ) + { + Number x[3]; + Number z_L[3]; + Number z_U[3]; + Number x_L_viol[3]; + Number x_U_viol[3]; + Number compl_x_L[3]; + Number compl_x_U[3]; + Number grad_lag_x[3]; + + Number g[2]; + Number lambda[2]; + Number constraint_violation[2]; + Number compl_g[2]; + + bool have_iter = get_curr_iterate(ip_data, ip_cq, false, 3, x, z_L, z_U, 2, g, lambda); + bool have_viol = get_curr_violations(ip_data, ip_cq, false, 3, x_L_viol, x_U_viol, compl_x_L, compl_x_U, grad_lag_x, 2, constraint_violation, compl_g); + + assert(have_iter); + assert(have_viol); + + printf("Current iterate (%s mode):\n", mode == RegularMode ? "regular" : "restoration"); + printf(" %-12s %-12s %-12s %-12s %-12s %-12s %-12s %-12s\n", "x", "x_L_viol", "x_U_viol", "z_L", "z_U", "compl_x_L", "compl_x_U", "grad_lag_x"); + for( int i = 0; i < 3; ++i ) + { + printf(" %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g\n", x[i], x_L_viol[i], x_U_viol[i], z_L[i], z_U[i], compl_x_L[i], compl_x_U[i], grad_lag_x[i]); + } + + printf(" %-12s %-12s %-12s %-12s\n", "g(x)", "lambda", "constr_viol", "compl_g"); + for( int i = 0; i < 2; ++i ) + { + printf(" %-12g %-12g %-12g %-12g\n", g[i], lambda[i], constraint_violation[i], compl_g[i]); + } + + // check activity + ASSERTEQ(g[0], x[0]*x[0] + x[1]*x[1] + x[2]*x[2]); + ASSERTEQ(g[1], x[0]*x[0] - x[2]*x[2]); + + // check violation of variable bounds + ASSERTEQ(x_L_viol[0], std::max(0.0, -10.0 - x[0])); + ASSERTEQ(x_U_viol[0], 0.0); + ASSERTEQ(x_L_viol[1], std::max(0.0, 1.0 - x[1])); + ASSERTEQ(x_U_viol[1], std::max(0.0, x[1] - 1.0)); + ASSERTEQ(x_L_viol[2], 0.0); + ASSERTEQ(x_U_viol[2], 0.0); + + // check complementarity for variable bounds + ASSERTEQ(compl_x_L[0], z_L[0] * (x[0] + 10.0)); + ASSERTEQ(compl_x_U[0], 0.0); + ASSERTEQ(compl_x_L[1], z_L[1] * (x[1] - 1.0)); + ASSERTEQ(compl_x_U[1], z_U[1] * (1.0 - x[1])); + ASSERTEQ(compl_x_L[2], 0.0); + ASSERTEQ(compl_x_U[2], 0.0); + + // check gradient on Lagrangian + ASSERTEQ(grad_lag_x[0], 1.0 + lambda[0] * 2 * x[0] + lambda[1] * 2 * x[0] - z_L[0]); + ASSERTEQ(grad_lag_x[1], 1.0 + lambda[0] * 2 * x[1] - z_L[1] + z_U[1]); + ASSERTEQ(grad_lag_x[2], 1.0 + lambda[0] * 2 * x[2] - lambda[1] * 2 * x[2]); + + // check constraint violation + ASSERTEQ(constraint_violation[0], std::max(0.0, std::max(1.0 - g[0], g[0] - 2.0))); + ASSERTEQ(constraint_violation[1], std::max(0.0, std::abs(g[1] - 0.5))); + + // check complementarity for constraints + ASSERTEQ(compl_g[0], (g[0] - 1.0) * std::max(Number(0.0), -lambda[0]) + (2.0 - g[0]) * std::max(Number(0.0), lambda[0])); + ASSERTEQ(compl_g[1], -(g[1] - 0.5) * lambda[1]); + + Number s_x[3]; + Number s_x_L_viol[3]; + Number s_x_U_viol[3]; + Number s_z_L[3]; + Number s_z_U[3]; + Number s_compl_x_L[3]; + Number s_compl_x_U[3]; + Number s_grad_lag_x[3]; + + Number s_g[2]; + Number s_lambda[2]; + Number s_constraint_violation[2]; + Number s_compl_g[2]; + + have_iter = get_curr_iterate(ip_data, ip_cq, true, 3, s_x, s_z_L, s_z_U, 2, s_g, s_lambda); + have_viol = get_curr_violations(ip_data, ip_cq, true, 3, s_x_L_viol, s_x_U_viol, s_compl_x_L, s_compl_x_U, s_grad_lag_x, 2, s_constraint_violation, s_compl_g); + + assert(have_iter); + assert(have_viol); + printf("Scaled iterate (%s mode):\n", mode == RegularMode ? "regular" : "restoration"); + printf(" %-12s %-12s %-12s %-12s %-12s %-12s %-12s %-12s\n", "x", "x_L_viol", "x_U_viol", "z_L", "z_U", "compl_x_L", "compl_x_U", "grad_lag_x"); + for( int i = 0; i < 3; ++i ) + { + printf(" %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g\n", s_x[i], s_x_L_viol[i], s_x_U_viol[i], s_z_L[i], s_z_U[i], s_compl_x_L[i], s_compl_x_U[i], s_grad_lag_x[i]); + } + + printf(" %-12s %-12s %-12s %-12s\n", "g(x)", "lambda", "constr_viol", "compl_g"); + for( int i = 0; i < 2; ++i ) + { + printf(" %-12g %-12g %-12g %-12g\n", s_g[i], s_lambda[i], s_constraint_violation[i], s_compl_g[i]); + } + + Number obj_scaling = 1.0; + Number x_scaling[3] = { 1.0, 1.0, 1.0 }; + Number g_scaling[2] = { 1.0, 1.0 }; + if( scaling_ ) + { + bool use_x_scaling; + bool use_g_scaling; + get_scaling_parameters(obj_scaling, use_x_scaling, 3, x_scaling, use_g_scaling, 2, g_scaling); + } + + ASSERTEQ(s_x[0], x[0]*x_scaling[0]); + ASSERTEQ(s_x[1], x[1]*x_scaling[1]); + ASSERTEQ(s_x[2], x[2]*x_scaling[2]); + + ASSERTEQ(s_z_L[0], z_L[0] / x_scaling[0]*obj_scaling); + if( obj_scaling > 0.0 ) + { + ASSERTEQ(s_z_L[1], z_L[1] / x_scaling[1]*obj_scaling); + } + else + { + ASSERTEQ(s_z_L[1], z_U[1] / x_scaling[1] * (-obj_scaling)); + } + ASSERTEQ(s_z_L[2], z_L[2] / x_scaling[2]*obj_scaling); + + ASSERTEQ(s_z_U[0], z_U[0] / x_scaling[0]*obj_scaling); + if( obj_scaling > 0.0 ) + { + ASSERTEQ(s_z_U[1], z_U[1] / x_scaling[1]*obj_scaling); + } + else + { + ASSERTEQ(s_z_U[1], z_L[1] / x_scaling[1] * (-obj_scaling)); + } + ASSERTEQ(s_z_U[2], z_U[2] / x_scaling[2]*obj_scaling); + + ASSERTEQ(s_g[0], g[0]*g_scaling[0]); + ASSERTEQ(s_g[1], g[1]*g_scaling[1]); + + ASSERTEQ(s_lambda[0], lambda[0] / g_scaling[0]*obj_scaling); + ASSERTEQ(s_lambda[1], lambda[1] / g_scaling[1]*obj_scaling); + + // check violation of variable bounds + ASSERTEQ(s_x_L_viol[0], std::max(0.0, -10.0 * x_scaling[0] - s_x[0])); + ASSERTEQ(s_x_U_viol[0], 0.0); + ASSERTEQ(s_x_L_viol[1], std::max(0.0, 1.0 * x_scaling[1] - x[1])); + ASSERTEQ(s_x_U_viol[1], std::max(0.0, x[1] - 1.0 * x_scaling[1])); + ASSERTEQ(s_x_L_viol[2], 0.0); + ASSERTEQ(s_x_U_viol[2], 0.0); + + // check complementarity for variable bounds + ASSERTEQ(s_compl_x_L[0], s_z_L[0] * (x[0] + 10.0)*x_scaling[0]); + ASSERTEQ(s_compl_x_U[0], 0.0); + ASSERTEQ(s_compl_x_L[1], s_z_L[1] * (x[1] - 1.0)*x_scaling[1]); + ASSERTEQ(s_compl_x_U[1], s_z_U[1] * (1.0 - x[1])*x_scaling[1]); + ASSERTEQ(s_compl_x_L[2], 0.0); + ASSERTEQ(s_compl_x_U[2], 0.0); + + ASSERTEQ(s_grad_lag_x[0], (1.0 * obj_scaling + s_lambda[0] * 2 * x[0] * g_scaling[0] + s_lambda[1] * 2 * x[0] * g_scaling[1]) / x_scaling[0] - s_z_L[0]); + ASSERTEQ(s_grad_lag_x[1], (1.0 * obj_scaling + s_lambda[0] * 2 * x[1] * g_scaling[0]) / x_scaling[1] - s_z_L[1] + s_z_U[1]); + ASSERTEQ(s_grad_lag_x[2], (1.0 * obj_scaling + s_lambda[0] * 2 * x[2] * g_scaling[0] - s_lambda[1] * 2 * x[2] * g_scaling[1]) / x_scaling[2]); + + // check constraint violation + ASSERTEQ(s_constraint_violation[0], std::max(0.0, std::max(1.0 - g[0], g[0] - 2.0)*g_scaling[0])); + ASSERTEQ(s_constraint_violation[1], std::max(0.0, std::abs(g[1] - 0.5)*g_scaling[1])); + + // check complementarity for constraints + ASSERTEQ(s_compl_g[0], ((g[0] - 1.0) * std::max(Number(0.0), -s_lambda[0]) + (2.0 - g[0]) * std::max(Number(0.0), s_lambda[0]))*g_scaling[0]); + ASSERTEQ(s_compl_g[1], -(g[1] - 0.5) * s_lambda[1]*g_scaling[1]); + + return true; + } +}; + +bool run( + bool fixedvar_makeconstr, + bool start_resto, + bool scale, + bool maximize +) +{ + printf("\nRun with fixedvar_makeconstr = %d, start_resto = %d, scale = %d, maximize = %d\n", + fixedvar_makeconstr, start_resto, scale, maximize); + + // Create an instance of your nlp... + SmartPtr nlp = new TestNLP(fixedvar_makeconstr, scale, maximize); + + // Create an instance of the IpoptApplication + SmartPtr app = new IpoptApplication(); + + // Initialize the IpoptApplication and process the options + ApplicationReturnStatus status; + status = app->Initialize(); + if( status != Solve_Succeeded ) + { + std::cout << std::endl << std::endl << "*** Error during initialization!" << std::endl; + return false; + } + + app->Options()->SetStringValue("print_user_options", "yes", true, true); + app->Options()->SetIntegerValue("print_level", 2, true, true); + // allow only very little relaxation of variable bounds, since the asserts on compl_x_L/U use the original bounds, not the relaxed one that Ipopt uses + app->Options()->SetNumericValue("constr_viol_tol", 1e-3 * TESTTOL, true, true); + + if( fixedvar_makeconstr ) + { + app->Options()->SetStringValue("fixed_variable_treatment", "make_constraint"); + } + + if( start_resto ) + { + app->Options()->SetStringValue("start_with_resto", "yes"); + } + + if( scale ) + { + app->Options()->SetStringValue("nlp_scaling_method", "user-scaling"); + } + else + { + assert(!maximize); // maximize requires scaling in this test + } + + app->OptimizeTNLP(nlp); + + return EXIT_SUCCESS; +} + +int main( + int, + char** +) +{ + if( run(false, false, false, false) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + if( run(true, false, false, false) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + if( run(false, true, false, false) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + if( run(true, true, false, false) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + if( run(false, false, true, false) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + if( run(true, false, true, false) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + if( run(false, true, true, false) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + if( run(true, true, true, false) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + if( run(false, true, true, true) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + if( run(true, true, true, true) != EXIT_SUCCESS ) + { + return EXIT_FAILURE; + } + + std::cout << std::endl << "*** All tests passed" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/test/run_unitTests.in b/test/run_unitTests.in index fce9729aa..aa860aae8 100644 --- a/test/run_unitTests.in +++ b/test/run_unitTests.in @@ -15,6 +15,8 @@ echo " " echo Running unitTests... echo " " +SKIPGREP=false + function checkrun () { if ! $@ > tmpfile 2>&1 ; then @@ -28,7 +30,7 @@ function checkrun () return 1 fi - if ! grep -q "EXIT: Optimal Solution Found." tmpfile ; then + if ! $SKIPGREP && ! grep -q "EXIT: Optimal Solution Found." tmpfile ; then echo " " echo " ---- 8< ---- Start of test program output ---- 8< ----" cat tmpfile @@ -59,21 +61,26 @@ checkrun ./hs071_cpp || retval=$? # C Example echo "Testing C Example..." -checkrun ./hs071_c || retval=? +checkrun ./hs071_c || retval=$? # Fortran Example if test -e ./hs071_f ; then echo "Testing Fortran Example..." - checkrun ./hs071_f || retval=? + checkrun ./hs071_f || retval=$? else echo "Skip testing Fortran Example (hs071_f not available)" fi # Java Example # libtool magic does not work with Java programs and no rpath on Windows, so add path to find Ipopt DLL dependencies to PATH +@BUILD_JAVA_TRUE@if test -n "@JAVA@" ; then @BUILD_JAVA_TRUE@echo "Testing Java Example..." @BUILD_JAVA_TRUE@case @build_os@ in *mingw* | *msys* ) PATH=@bindir@:$PATH ;; esac -@BUILD_JAVA_TRUE@checkrun java -Djava.library.path=../src/Interfaces/.libs -cp ../src/Interfaces/org.coinor.ipopt.jar:. HS071 || retval=$? +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_FALSE@checkrun @JAVA@ -Djava.library.path=../src/.libs -cp ../src/org.coinor.ipopt.jar:. HS071 || retval=$? +@BUILD_JAVA_TRUE@@IPOPT_SINGLE_TRUE@checkrun @JAVA@ -Djava.library.path=../src/.libs -cp ../src/org.coinor.ipopt.jar:. HS071s || retval=$? +@BUILD_JAVA_TRUE@else +@BUILD_JAVA_TRUE@echo "Skip testing Java Example (Java executable not available)" +@BUILD_JAVA_TRUE@fi @BUILD_JAVA_FALSE@echo "Skip testing Java Example (Java interface not build)" # sIpopt examples @@ -83,6 +90,14 @@ fi @BUILD_SIPOPT_TRUE@checkrun ./redhess_cpp || retval=$? @BUILD_SIPOPT_FALSE@echo "Skip testing sIpopt examples (sIPOPT not build)" +# empty NLP example +echo "Testing EmptyNLP Example..." +SKIPGREP=true checkrun ./emptynlp || retval=$? + +# getcurr example +echo "Testing GetCurr Example..." +SKIPGREP=true checkrun ./getcurr || retval=$? + # clean up rm -rf tmpfile debug.out ipopt.out IPOPT.OUT diff --git a/tutorial/CodingExercise/C/1-skeleton/TutorialC.c b/tutorial/CodingExercise/C/1-skeleton/TutorialC.c index e4ae57f91..2ae6e0e12 100644 --- a/tutorial/CodingExercise/C/1-skeleton/TutorialC.c +++ b/tutorial/CodingExercise/C/1-skeleton/TutorialC.c @@ -190,17 +190,17 @@ int main() printf("\n\nSolution of the primal variables, x\n"); for( i = 0; i < n; i++ ) { - printf("x[%d] = %e\n", i, x[i]); + printf("x[%d] = %e\n", (int)i, x[i]); } printf("\n\nSolution of the bound multipliers, z_L and z_U\n"); for( i = 0; i < n; i++ ) { - printf("z_L[%d] = %e\n", i, mult_x_L[i]); + printf("z_L[%d] = %e\n", (int)i, mult_x_L[i]); } for( i = 0; i < n; i++ ) { - printf("z_U[%d] = %e\n", i, mult_x_U[i]); + printf("z_U[%d] = %e\n", (int)i, mult_x_U[i]); } printf("\n\nObjective value\n"); diff --git a/tutorial/CodingExercise/C/2-mistake/TutorialC.c b/tutorial/CodingExercise/C/2-mistake/TutorialC.c index e4d6ed5bf..b9e042962 100644 --- a/tutorial/CodingExercise/C/2-mistake/TutorialC.c +++ b/tutorial/CodingExercise/C/2-mistake/TutorialC.c @@ -209,17 +209,17 @@ int main() printf("\n\nSolution of the primal variables, x\n"); for( i = 0; i < n; i++ ) { - printf("x[%d] = %e\n", i, x[i]); + printf("x[%d] = %e\n", (int)i, x[i]); } printf("\n\nSolution of the bound multipliers, z_L and z_U\n"); for( i = 0; i < n; i++ ) { - printf("z_L[%d] = %e\n", i, mult_x_L[i]); + printf("z_L[%d] = %e\n", (int)i, mult_x_L[i]); } for( i = 0; i < n; i++ ) { - printf("z_U[%d] = %e\n", i, mult_x_U[i]); + printf("z_U[%d] = %e\n", (int)i, mult_x_U[i]); } printf("\n\nObjective value\n"); diff --git a/tutorial/CodingExercise/C/3-solution/TutorialC.c b/tutorial/CodingExercise/C/3-solution/TutorialC.c index 1ba650688..b799d25a8 100644 --- a/tutorial/CodingExercise/C/3-solution/TutorialC.c +++ b/tutorial/CodingExercise/C/3-solution/TutorialC.c @@ -29,7 +29,6 @@ #include #include - /* Function Declarations */ Bool eval_f( Index n, @@ -208,17 +207,17 @@ int main() printf("\n\nSolution of the primal variables, x\n"); for( i = 0; i < n; i++ ) { - printf("x[%d] = %e\n", i, x[i]); + printf("x[%d] = %e\n", (int)i, x[i]); } printf("\n\nSolution of the bound multipliers, z_L and z_U\n"); for( i = 0; i < n; i++ ) { - printf("z_L[%d] = %e\n", i, mult_x_L[i]); + printf("z_L[%d] = %e\n", (int)i, mult_x_L[i]); } for( i = 0; i < n; i++ ) { - printf("z_U[%d] = %e\n", i, mult_x_U[i]); + printf("z_U[%d] = %e\n", (int)i, mult_x_U[i]); } printf("\n\nObjective value\n"); diff --git a/tutorial/CodingExercise/Cpp/1-skeleton/TutorialCpp_nlp.cpp b/tutorial/CodingExercise/Cpp/1-skeleton/TutorialCpp_nlp.cpp index 726aeb77b..e768d04e7 100644 --- a/tutorial/CodingExercise/Cpp/1-skeleton/TutorialCpp_nlp.cpp +++ b/tutorial/CodingExercise/Cpp/1-skeleton/TutorialCpp_nlp.cpp @@ -257,17 +257,17 @@ void TutorialCpp_NLP::finalize_solution( fprintf(fp, "\n\nSolution of the primal variables, x\n"); for( Index i = 0; i < n; i++ ) { - fprintf(fp, "x[%d] = %e\n", i, x[i]); + fprintf(fp, "x[%d] = %e\n", (int)i, x[i]); } fprintf(fp, "\n\nSolution of the bound multipliers, z_L and z_U\n"); for( Index i = 0; i < n; i++ ) { - fprintf(fp, "z_L[%d] = %e\n", i, z_L[i]); + fprintf(fp, "z_L[%d] = %e\n", (int)i, z_L[i]); } for( Index i = 0; i < n; i++ ) { - fprintf(fp, "z_U[%d] = %e\n", i, z_U[i]); + fprintf(fp, "z_U[%d] = %e\n", (int)i, z_U[i]); } fprintf(fp, "\n\nObjective value\n"); diff --git a/tutorial/CodingExercise/Cpp/2-mistake/TutorialCpp_nlp.cpp b/tutorial/CodingExercise/Cpp/2-mistake/TutorialCpp_nlp.cpp index 9f01b1710..8e7807116 100644 --- a/tutorial/CodingExercise/Cpp/2-mistake/TutorialCpp_nlp.cpp +++ b/tutorial/CodingExercise/Cpp/2-mistake/TutorialCpp_nlp.cpp @@ -366,17 +366,17 @@ void TutorialCpp_NLP::finalize_solution( fprintf(fp, "\n\nSolution of the primal variables, x\n"); for( Index i = 0; i < n; i++ ) { - fprintf(fp, "x[%d] = %e\n", i, x[i]); + fprintf(fp, "x[%d] = %e\n", (int)i, x[i]); } fprintf(fp, "\n\nSolution of the bound multipliers, z_L and z_U\n"); for( Index i = 0; i < n; i++ ) { - fprintf(fp, "z_L[%d] = %e\n", i, z_L[i]); + fprintf(fp, "z_L[%d] = %e\n", (int)i, z_L[i]); } for( Index i = 0; i < n; i++ ) { - fprintf(fp, "z_U[%d] = %e\n", i, z_U[i]); + fprintf(fp, "z_U[%d] = %e\n", (int)i, z_U[i]); } fprintf(fp, "\n\nObjective value\n"); diff --git a/tutorial/CodingExercise/Cpp/3-solution/TutorialCpp_nlp.cpp b/tutorial/CodingExercise/Cpp/3-solution/TutorialCpp_nlp.cpp index 739a83331..2f656cf1c 100644 --- a/tutorial/CodingExercise/Cpp/3-solution/TutorialCpp_nlp.cpp +++ b/tutorial/CodingExercise/Cpp/3-solution/TutorialCpp_nlp.cpp @@ -350,17 +350,17 @@ void TutorialCpp_NLP::finalize_solution( fprintf(fp, "\n\nSolution of the primal variables, x\n"); for( Index i = 0; i < n; i++ ) { - fprintf(fp, "x[%d] = %e\n", i, x[i]); + fprintf(fp, "x[%d] = %e\n", (int)i, x[i]); } fprintf(fp, "\n\nSolution of the bound multipliers, z_L and z_U\n"); for( Index i = 0; i < n; i++ ) { - fprintf(fp, "z_L[%d] = %e\n", i, z_L[i]); + fprintf(fp, "z_L[%d] = %e\n", (int)i, z_L[i]); } for( Index i = 0; i < n; i++ ) { - fprintf(fp, "z_U[%d] = %e\n", i, z_U[i]); + fprintf(fp, "z_U[%d] = %e\n", (int)i, z_U[i]); } fprintf(fp, "\n\nObjective value\n"); diff --git a/tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f.in b/tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f.in index 2db64d82b..9ba9c653d 100644 --- a/tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f.in +++ b/tutorial/CodingExercise/Fortran/1-skeleton/TutorialFortran.f.in @@ -97,15 +97,15 @@ C C C Number of constraints C - M = + M = C C Number of nonzeros in constraint Jacobian C - NELE_JAC = + NELE_JAC = C C Number of nonzeros in Lagrangian Hessian C - NELE_HESS = + NELE_HESS = C C Set initial point and bounds C diff --git a/tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f.in b/tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f.in index fe08fdb8e..e24062873 100644 --- a/tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f.in +++ b/tutorial/CodingExercise/Fortran/2-mistake/TutorialFortran.f.in @@ -383,7 +383,7 @@ C 1 - DAT(i-2))*COS(X(i)) endif inz = inz + 1 - + HESS(inz) = -LAM(i-1)*(2.d0*X(i)+1.5d0)*SIN(X(i+1)) inz = inz + 1 enddo diff --git a/tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f.in b/tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f.in index 71c3f1dd9..68524e46a 100644 --- a/tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f.in +++ b/tutorial/CodingExercise/Fortran/3-solution/TutorialFortran.f.in @@ -384,7 +384,7 @@ C 1 + 1.5d0*X(i-1) - DAT(i-2))*COS(X(i)) endif inz = inz + 1 - + HESS(inz) = -LAM(i-1)*(2.d0*X(i)+1.5d0)*SIN(X(i+1)) inz = inz + 1 enddo diff --git a/tutorial/CodingExercise/Matlab/1-skeleton/TutorialMatlab.m b/tutorial/CodingExercise/Matlab/1-skeleton/TutorialMatlab.m index a4b2d4518..f518e3b73 100644 --- a/tutorial/CodingExercise/Matlab/1-skeleton/TutorialMatlab.m +++ b/tutorial/CodingExercise/Matlab/1-skeleton/TutorialMatlab.m @@ -1,4 +1,4 @@ -% Copyright (C) 2009 International Business Machines +% Copyright (C) 2009 International Business Machines % All Rights Reserved. % This code is published under the Eclipse Public License. % @@ -64,7 +64,7 @@ % Evaluate value of objective function function f = eval_f(x) - + end @@ -72,7 +72,7 @@ % Evaluate gradient of objective function function df = eval_grad_f(x) - + end @@ -80,7 +80,7 @@ % Evaluate value of constraint bodies function g = eval_g(x) - + end diff --git a/tutorial/CodingExercise/Matlab/2-mistake/TutorialMatlab.m b/tutorial/CodingExercise/Matlab/2-mistake/TutorialMatlab.m index 4e46d607c..2f89a0ca9 100644 --- a/tutorial/CodingExercise/Matlab/2-mistake/TutorialMatlab.m +++ b/tutorial/CodingExercise/Matlab/2-mistake/TutorialMatlab.m @@ -1,4 +1,4 @@ -% Copyright (C) 2009 International Business Machines +% Copyright (C) 2009 International Business Machines % All Rights Reserved. % This code is published under the Eclipse Public License. % @@ -56,8 +56,8 @@ funcs.hessianstructure = @eval_hess_struct; [x info] = ipopt(x0, funcs, options); - - + + % End of main function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/tutorial/CodingExercise/Matlab/3-solution/TutorialMatlab.m b/tutorial/CodingExercise/Matlab/3-solution/TutorialMatlab.m index 09c6a420c..1be6c70aa 100644 --- a/tutorial/CodingExercise/Matlab/3-solution/TutorialMatlab.m +++ b/tutorial/CodingExercise/Matlab/3-solution/TutorialMatlab.m @@ -1,4 +1,4 @@ -% Copyright (C) 2009 International Business Machines +% Copyright (C) 2009 International Business Machines % All Rights Reserved. % This code is published under the Eclipse Public License. % @@ -55,7 +55,7 @@ funcs.hessianstructure = @eval_hess_struct; [x info] = ipopt(x0, funcs, options); - + % End of main function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/tutorial/CodingExercise/exercise_example.mod b/tutorial/CodingExercise/exercise_example.mod index 7834e3200..35f86d407 100644 --- a/tutorial/CodingExercise/exercise_example.mod +++ b/tutorial/CodingExercise/exercise_example.mod @@ -15,7 +15,7 @@ param n := 8; var x {1..n} <= 0, >= -1.5, := -0.5; # The objective function.... -minimize obj: +minimize obj: sum{i in 1..n} (x[i]-1)^2; # ... and the constraints diff --git a/tutorial/Modeling/bad1-fix1.mod b/tutorial/Modeling/bad1-fix1.mod index 4fa9ebdd9..439925fec 100644 --- a/tutorial/Modeling/bad1-fix1.mod +++ b/tutorial/Modeling/bad1-fix1.mod @@ -17,7 +17,7 @@ param n := 50; var x{1..n} >= 0, := 1; var p{1..n} >= 0, <= 1, :=0.1; -minimize obj: +minimize obj: sum{i in 1..n} x[i] ; diff --git a/tutorial/Modeling/bad1-fix2.mod b/tutorial/Modeling/bad1-fix2.mod index af965df28..5648182bc 100644 --- a/tutorial/Modeling/bad1-fix2.mod +++ b/tutorial/Modeling/bad1-fix2.mod @@ -18,7 +18,7 @@ param n := 50; var x{1..n} >= 0, := 1; var p{1..n} >= 0, <= 1, :=0.1; -minimize obj: +minimize obj: sum{i in 1..n} x[i] ; diff --git a/tutorial/Modeling/bad1.mod b/tutorial/Modeling/bad1.mod index f05aa2d67..2fcc4197e 100644 --- a/tutorial/Modeling/bad1.mod +++ b/tutorial/Modeling/bad1.mod @@ -13,7 +13,7 @@ param n := 50; var x{1..n} >= 0, := 1; var p{1..n} >= 0, <= 1, :=0.1; -minimize obj: +minimize obj: sum{i in 1..n} x[i] ;