Skip to content

Commit

Permalink
remove trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
svigerske committed May 7, 2021
1 parent dada3a2 commit 13b9f56
Show file tree
Hide file tree
Showing 49 changed files with 459 additions and 460 deletions.
8 changes: 4 additions & 4 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,21 @@ 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
Expand Down
8 changes: 4 additions & 4 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ commit history.
- 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
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
Expand Down Expand Up @@ -583,12 +583,12 @@ commit history.
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
Expand Down Expand Up @@ -796,7 +796,7 @@ commit history.
(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.)
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
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ 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
Expand Down Expand Up @@ -577,7 +577,7 @@ 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
case $build in
*-cygwin* | *-mingw* | *-msys* )
AC_CONFIG_FILES([contrib/RInterface/src/Makevars.win:contrib/RInterface/src/Makevars.in])
;;
Expand Down
4 changes: 2 additions & 2 deletions contrib/RInterface/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
R> res$constraints
R> res$lambda

* Removed ipoptr_environment as argument in ipoptr because it wasn't useful and it caused undesired behaviour in
* 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 <assert.h> to src/IpoptRNLP.hpp
10 changes: 5 additions & 5 deletions contrib/RInterface/R/get.option.types.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -175,14 +175,14 @@ get.option.types <- function(opts) {
"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
# 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 ) {

Expand All @@ -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" ) {
Expand Down
74 changes: 37 additions & 37 deletions contrib/RInterface/R/ipoptr.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#
# 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:
# Input:
# x0 : vector with initial values
# eval_f : function to evaluate objective function
# eval_grad_f : function to evaluate gradient of objective function
Expand Down Expand Up @@ -39,39 +39,39 @@
# 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 = ""))

# determine function arguments
fargs <- formals(fun)

if ( length(fargs) > 1 ) {
# determine argument names user-defined function
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)

# determine which arguments where required but not supplied
m1 = match(argnames_udf, argnames_supplied)
if( any(is.na(m1)) ){
Expand All @@ -80,7 +80,7 @@ function( x0,
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)) ){
Expand All @@ -92,28 +92,28 @@ function( x0,
}
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' )

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
Expand All @@ -127,32 +127,32 @@ function( x0,


# 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
Expand All @@ -163,6 +163,6 @@ function( x0,
ret$z_U <- solution$z_U
ret$constraints <- solution$constraints
ret$lambda <- solution$lambda

return( ret )
}
34 changes: 17 additions & 17 deletions contrib/RInterface/R/is.ipoptr.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
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 ) {
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 ) {
Expand All @@ -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 ) {
Expand All @@ -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 )
}
Loading

0 comments on commit 13b9f56

Please sign in to comment.