Skip to content

Commit f9653d6

Browse files
committed
replace a lot of tabs
1 parent c0c1510 commit f9653d6

26 files changed

+517
-555
lines changed

configure.ac

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -520,27 +520,27 @@ fi
520520
AC_COIN_FINALIZE_FLAGS([IpoptLib IpoptAmplInterfaceLib SIpoptAmplInterfaceLib])
521521

522522
AC_CONFIG_FILES([Makefile
523-
src/ipopt.pc
524-
src/Makefile
525-
src/Apps/AmplSolver/Makefile
526-
src/Apps/AmplSolver/ipoptamplinterface.pc
527-
test/Makefile
528-
test/run_unitTests
529-
doc/Doxyfile
530-
examples/Cpp_example/Makefile
531-
examples/recursive_nlp/Makefile
532-
examples/hs071_cpp/Makefile
533-
examples/hs071_c/Makefile
534-
examples/ScalableProblems/Makefile
535-
tutorial/CodingExercise/C/1-skeleton/Makefile
536-
tutorial/CodingExercise/C/2-mistake/Makefile
537-
tutorial/CodingExercise/C/3-solution/Makefile
538-
tutorial/CodingExercise/Cpp/1-skeleton/Makefile
539-
tutorial/CodingExercise/Cpp/2-mistake/Makefile
540-
tutorial/CodingExercise/Cpp/3-solution/Makefile
541-
tutorial/CodingExercise/Matlab/1-skeleton/startup.m
542-
tutorial/CodingExercise/Matlab/2-mistake/startup.m
543-
tutorial/CodingExercise/Matlab/3-solution/startup.m
523+
src/ipopt.pc
524+
src/Makefile
525+
src/Apps/AmplSolver/Makefile
526+
src/Apps/AmplSolver/ipoptamplinterface.pc
527+
test/Makefile
528+
test/run_unitTests
529+
doc/Doxyfile
530+
examples/Cpp_example/Makefile
531+
examples/recursive_nlp/Makefile
532+
examples/hs071_cpp/Makefile
533+
examples/hs071_c/Makefile
534+
examples/ScalableProblems/Makefile
535+
tutorial/CodingExercise/C/1-skeleton/Makefile
536+
tutorial/CodingExercise/C/2-mistake/Makefile
537+
tutorial/CodingExercise/C/3-solution/Makefile
538+
tutorial/CodingExercise/Cpp/1-skeleton/Makefile
539+
tutorial/CodingExercise/Cpp/2-mistake/Makefile
540+
tutorial/CodingExercise/Cpp/3-solution/Makefile
541+
tutorial/CodingExercise/Matlab/1-skeleton/startup.m
542+
tutorial/CodingExercise/Matlab/2-mistake/startup.m
543+
tutorial/CodingExercise/Matlab/3-solution/startup.m
544544
])
545545

546546
if test -n "$F77" ; then
@@ -567,12 +567,12 @@ fi
567567

568568
if test "$use_sipopt" = yes ; then
569569
AC_CONFIG_FILES([
570-
contrib/sIPOPT/Makefile
571-
contrib/sIPOPT/src/Makefile
572-
contrib/sIPOPT/AmplSolver/Makefile
573-
contrib/sIPOPT/examples/parametric_cpp/Makefile
574-
contrib/sIPOPT/examples/parametric_dsdp_cpp/Makefile
575-
contrib/sIPOPT/examples/redhess_cpp/Makefile
570+
contrib/sIPOPT/Makefile
571+
contrib/sIPOPT/src/Makefile
572+
contrib/sIPOPT/AmplSolver/Makefile
573+
contrib/sIPOPT/examples/parametric_cpp/Makefile
574+
contrib/sIPOPT/examples/parametric_dsdp_cpp/Makefile
575+
contrib/sIPOPT/examples/redhess_cpp/Makefile
576576
])
577577
fi
578578

contrib/RInterface/CHANGELOG

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@
1818

1919
20 November 2011, version 0.8.3:
2020

21-
* Added #include <assert.h> to src/IpoptRNLP.hpp
22-
21+
* Added #include <assert.h> to src/IpoptRNLP.hpp

contrib/RInterface/R/get.option.types.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
get.option.types <- function(opts) {
1616

17-
# define types of ipopt options
17+
# define types of ipopt options
1818
ipopt.option.types <- list(
1919

2020
# Output
@@ -174,15 +174,15 @@ get.option.types <- function(opts) {
174174
"wsmp_scaling"="integer",
175175
"wsmp_singularity_threshold"="numeric"
176176
)
177-
178-
179-
180-
# initialize list with options sorted by type
181-
converted.opts <- list( "integer"=list(), "string"=list(), "numeric"=list() )
182-
183-
is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol
184-
185-
# check if we have at least 1 element in the list, otherwise the
177+
178+
179+
180+
# initialize list with options sorted by type
181+
converted.opts <- list( "integer"=list(), "string"=list(), "numeric"=list() )
182+
183+
is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol
184+
185+
# check if we have at least 1 element in the list, otherwise the
186186
# loop runs from 1 to down 0 and we get errors
187187
if ( length( opts ) > 0 ) {
188188

@@ -212,6 +212,6 @@ get.option.types <- function(opts) {
212212
}
213213
}
214214
}
215-
216-
return ( converted.opts )
215+
216+
return ( converted.opts )
217217
}

contrib/RInterface/R/ipoptr.R

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,32 @@
1111
# data.table and it wasn't useful (thanks to Florian Oswald for reporting)
1212
#
1313
# Input:
14-
# x0 : vector with initial values
15-
# eval_f : function to evaluate objective function
16-
# eval_grad_f : function to evaluate gradient of objective function
17-
# lb : lower bounds of the control
18-
# ub : upper bounds of the control
19-
# eval_g : function to evaluate (non-)linear constraints that should hold in the solution
20-
# eval_jac_g : function to evaluate the jacobian of the (non-)linear constraints that should hold in the solution
21-
# eval_jac_g_structure : sparseness structure of the jacobian
22-
# constraint_lb : lower bounds of the (non-)linear constraints
23-
# constraint_ub : upper bounds of the (non-)linear constraints
24-
# eval_h : function to evaluate the hessian
25-
# eval_h_structure : sparseness structure of the hessian
26-
# opts : list with options that are passed to Ipopt
27-
# ... : arguments that will be passed to user-defined functions
14+
# x0 : vector with initial values
15+
# eval_f : function to evaluate objective function
16+
# eval_grad_f : function to evaluate gradient of objective function
17+
# lb : lower bounds of the control
18+
# ub : upper bounds of the control
19+
# eval_g : function to evaluate (non-)linear constraints that should hold in the solution
20+
# eval_jac_g : function to evaluate the jacobian of the (non-)linear constraints that should hold in the solution
21+
# eval_jac_g_structure : sparseness structure of the jacobian
22+
# constraint_lb : lower bounds of the (non-)linear constraints
23+
# constraint_ub : upper bounds of the (non-)linear constraints
24+
# eval_h : function to evaluate the hessian
25+
# eval_h_structure : sparseness structure of the hessian
26+
# opts : list with options that are passed to Ipopt
27+
# ... : arguments that will be passed to user-defined functions
2828
#
2929
# Output: structure with inputs and
30-
# call : the call that was made to solve
31-
# status : integer value with the status of the optimization (0 is success)
32-
# message : more informative message with the status of the optimization
33-
# iterations : number of iterations that were executed
34-
# objective : final value of the objective function
35-
# solution : final values for the controls
36-
# z_L : final values for the lower bound multipliers
37-
# z_U : final values for the upper bound multipliers
38-
# constraints : final values for the constraints
39-
# lambda : final values for the Lagrange mulipliers
30+
# call : the call that was made to solve
31+
# status : integer value with the status of the optimization (0 is success)
32+
# message : more informative message with the status of the optimization
33+
# iterations : number of iterations that were executed
34+
# objective : final value of the objective function
35+
# solution : final values for the controls
36+
# z_L : final values for the lower bound multipliers
37+
# z_U : final values for the upper bound multipliers
38+
# constraints : final values for the constraints
39+
# lambda : final values for the Lagrange mulipliers
4040

4141
ipoptr <-
4242
function( x0,
@@ -60,43 +60,43 @@ function( x0,
6060

6161
# internal function to check the arguments of the functions
6262
checkFunctionArguments <- function( fun, arglist, funname ) {
63-
if( !is.function(fun) ) stop(paste(funname, " must be a function\n", sep = ""))
64-
63+
if( !is.function(fun) ) stop(paste(funname, " must be a function\n", sep = ""))
64+
6565
# determine function arguments
6666
fargs <- formals(fun)
6767

68-
if ( length(fargs) > 1 ) {
68+
if ( length(fargs) > 1 ) {
6969
# determine argument names user-defined function
70-
argnames_udf <- names(fargs)[2:length(fargs)] # remove first argument, which is x
70+
argnames_udf <- names(fargs)[2:length(fargs)] # remove first argument, which is x
7171

7272
# determine argument names that where supplied to ipoptr()
73-
argnames_supplied <- names(arglist)
73+
argnames_supplied <- names(arglist)
7474

7575
# determine which arguments where required but not supplied
76-
m1 = match(argnames_udf, argnames_supplied)
77-
if( any(is.na(m1)) ){
78-
mx1 = which( is.na(m1) )
79-
for( i in 1:length(mx1) ){
80-
stop(paste(funname, " requires argument '", argnames_udf[mx1], "' but this has not been passed to the 'ipoptr' function.\n", sep = ""))
81-
}
82-
}
76+
m1 = match(argnames_udf, argnames_supplied)
77+
if( any(is.na(m1)) ){
78+
mx1 = which( is.na(m1) )
79+
for( i in 1:length(mx1) ){
80+
stop(paste(funname, " requires argument '", argnames_udf[mx1], "' but this has not been passed to the 'ipoptr' function.\n", sep = ""))
81+
}
82+
}
8383

8484
# determine which arguments where supplied but not required
85-
m2 = match(argnames_supplied, argnames_udf)
86-
if( any(is.na(m2)) ){
87-
mx2 = which( is.na(m2) )
88-
for( i in 1:length(mx2) ){
89-
stop(paste("'", argnames_supplied[mx2], "' passed to (...) in 'ipoptr' but this is not required in the ", funname, " function.\n", sep = ""))
90-
}
91-
}
92-
}
93-
return( 0 )
94-
}
85+
m2 = match(argnames_supplied, argnames_udf)
86+
if( any(is.na(m2)) ){
87+
mx2 = which( is.na(m2) )
88+
for( i in 1:length(mx2) ){
89+
stop(paste("'", argnames_supplied[mx2], "' passed to (...) in 'ipoptr' but this is not required in the ", funname, " function.\n", sep = ""))
90+
}
91+
}
92+
}
93+
return( 0 )
94+
}
9595

9696
# extract list of additional arguments and check user-defined functions
9797
arglist <- list(...)
98-
checkFunctionArguments( eval_f, arglist, 'eval_f' )
99-
checkFunctionArguments( eval_grad_f, arglist, 'eval_grad_f' )
98+
checkFunctionArguments( eval_f, arglist, 'eval_f' )
99+
checkFunctionArguments( eval_grad_f, arglist, 'eval_grad_f' )
100100

101101
num.constraints <- length( constraint_lb )
102102
if ( num.constraints > 0 ) {
@@ -124,7 +124,6 @@ function( x0,
124124
checkFunctionArguments( eval_h, c( arglist, obj_factor=0, hessian_lambda=0 ), 'eval_h' )
125125
eval_h_wrapper = function( x, obj_factor, hessian_lambda ) { eval_h(x, obj_factor, hessian_lambda, ...) }
126126
}
127-
128127

129128

130129
# build ipoptr object

contrib/RInterface/R/is.ipoptr.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ is.ipoptr <- function(x) {
4646
stopifnot( length(x$eval_f( x$x0 ))==1 )
4747
stopifnot( length(x$eval_grad_f( x$x0 ))==num.controls )
4848
stopifnot( length(x$eval_g( x$x0 ))==num.constraints )
49-
stopifnot( length(x$eval_jac_g( x$x0 ))==length(unlist(x$eval_jac_g_structure)) ) # the number of non-zero elements in the Jacobian
49+
stopifnot( length(x$eval_jac_g( x$x0 ))==length(unlist(x$eval_jac_g_structure)) ) # the number of non-zero elements in the Jacobian
5050
if ( !flag_hessian_approximation ) {
51-
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
51+
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
5252
}
5353

5454
# Check the whether we don't have NA's in initial values
5555
stopifnot( all(!is.na(x$eval_f( x$x0 ))) )
5656
stopifnot( all(!is.na(x$eval_grad_f( x$x0 ))) )
5757
stopifnot( all(!is.na(x$eval_g( x$x0 ))) )
58-
stopifnot( all(!is.na(x$eval_jac_g( x$x0 ))) ) # the number of non-zero elements in the Jacobian
58+
stopifnot( all(!is.na(x$eval_jac_g( x$x0 ))) ) # the number of non-zero elements in the Jacobian
5959
if ( !flag_hessian_approximation ) {
60-
stopifnot( all(!is.na(x$eval_h( x$x0, 1, rep(1,num.constraints) ))) ) # the number of non-zero elements in the Hessian
60+
stopifnot( all(!is.na(x$eval_h( x$x0, 1, rep(1,num.constraints) ))) ) # the number of non-zero elements in the Hessian
6161
}
6262

6363
# Check whether a correct structure was supplied, and check the size

contrib/RInterface/R/print.ipoptr.R

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
# has been solved.
1111

1212
print.ipoptr <- function(x, show.controls=TRUE, ...) {
13-
cat("\nCall:\n", deparse(x$call), "\n\n", sep = "", fill=TRUE)
14-
cat( unlist(strsplit(paste( "Ipopt solver status:", x$status, "(", x$message, ")\n" ),' ')), fill=TRUE )
13+
cat("\nCall:\n", deparse(x$call), "\n\n", sep = "", fill=TRUE)
14+
cat( unlist(strsplit(paste( "Ipopt solver status:", x$status, "(", x$message, ")\n" ),' ')), fill=TRUE )
1515
cat( paste( "Number of Iterations....:", x$iterations, "\n" ) )
16-
16+
1717
# if show.controls is TRUE or FALSE, show all or none of the controls
1818
if ( is.logical( show.controls ) ) {
1919
# show all control variables
@@ -29,10 +29,10 @@ print.ipoptr <- function(x, show.controls=TRUE, ...) {
2929
show.controls = TRUE
3030
}
3131

32-
# if solved successfully
33-
if ( x$status<=0 ) {
34-
cat( paste( "Optimal value of objective function: ", x$objective, "\n" ) )
35-
if ( show.controls ) {
32+
# if solved successfully
33+
if ( x$status<=0 ) {
34+
cat( paste( "Optimal value of objective function: ", x$objective, "\n" ) )
35+
if ( show.controls ) {
3636
if ( length( controls.indices ) < length(x$solution) ) {
3737
cat( "Optimal value of user-defined subset of controls: " )
3838
} else {
@@ -41,9 +41,9 @@ print.ipoptr <- function(x, show.controls=TRUE, ...) {
4141
cat( x$solution[ controls.indices ], fill=TRUE)
4242
cat("\n")
4343
}
44-
} else {
45-
cat( paste( "Current value of objective function: ", x$objective, "\n" ) )
46-
if ( show.controls ) {
44+
} else {
45+
cat( paste( "Current value of objective function: ", x$objective, "\n" ) )
46+
if ( show.controls ) {
4747
if ( length( controls.indices ) < length(x$solution) ) {
4848
cat( "Current value of user-defined subset of controls: " )
4949
} else {
@@ -53,5 +53,5 @@ print.ipoptr <- function(x, show.controls=TRUE, ...) {
5353
cat("\n")
5454
}
5555
}
56-
cat("\n")
56+
cat("\n")
5757
}

contrib/RInterface/R/print.sparseness.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ print.sparseness <- function( x, indices=TRUE, data=NULL, ncol=NULL, ... ) {
3939
}
4040
}
4141
cnt = cnt+1
42-
}
42+
}
4343
}
4444

4545
return( p )

contrib/RInterface/README

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Maintainer: Jelmer Ypma <[email protected]>
88
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.
99
License: EPL
1010
Directories follow the standard structure of an R package:
11-
- inst Contains citation information that is displayed by the R citation('ipoptr') command, and the TeX/Sweave code of the documentation.
12-
- man Contains help-files for the commands available in this package. E.g. ?ipoptr in R shows the help-file for the ipoptr command.
13-
- R Contains R code defining the R commands. Each command is defined in a separate file.
14-
- src Contains C++ code interfacing between R and Ipopt.
15-
- tests Contains some examples/tests to show how the R interface works.
11+
- inst Contains citation information that is displayed by the R citation('ipoptr') command, and the TeX/Sweave code of the documentation.
12+
- man Contains help-files for the commands available in this package. E.g. ?ipoptr in R shows the help-file for the ipoptr command.
13+
- R Contains R code defining the R commands. Each command is defined in a separate file.
14+
- src Contains C++ code interfacing between R and Ipopt.
15+
- tests Contains some examples/tests to show how the R interface works.

contrib/RInterface/inst/CITATION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
citHeader("To cite Ipopt in publications use:")
22

33
citEntry(entry="Article",
4-
title = "On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming",
4+
title = "On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming",
55
author = personList(as.person("A. W\"{a}chter"),
66
as.person("L. T. Biegler")),
77
year = "2006",

contrib/RInterface/inst/doc/ipoptr.Rnw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ eval_grad_f <- function( x ) {
302302
return( c( x[1] * x[4] + x[4] * (x[1] + x[2] + x[3]),
303303
x[1] * x[4],
304304
x[1] * x[4] + 1.0,
305-
x[1] * (x[1] + x[2] + x[3]) ) )
305+
x[1] * (x[1] + x[2] + x[3]) ) )
306306
}
307307
@
308308
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.

0 commit comments

Comments
 (0)