Introduction to nloptr: an R interface to NLopt
|
|
|
- Martin Barker
- 9 years ago
- Views:
Transcription
1 Introduction to nloptr: an R interface to NLopt Jelmer Ypma August 2, 2014 Abstract This document describes how to use nloptr, which is an R interface to NLopt. NLopt is a free/open-source library for nonlinear optimization started by Steven G. Johnson, providing a common interface for a number of different free optimization routines available online as well as original implementations of various other algorithms. The NLopt library is available under the GNU Lesser General Public License (LGPL), and the copyrights are owned by a variety of authors. 1 Introduction NLopt addresses general nonlinear optimization problems of the form: min f(x) x R n s.t. g(x) 0 h(x) = 0 x L x x U where f( ) is the objective function and x represents the n optimization parameters. This problem may optionally be subject to the bound constraints (also called box constraints), x L and x U. For partially or totally unconstrained problems the bounds can take values or. One may also optionally have m nonlinear inequality constraints (sometimes called a nonlinear programming problem), which can be specified in g( ), and equality constraints that can be specified in h( ). Note that not all of the algorithms in NLopt can handle constraints. This vignette describes how to formulate minimization problems to be solved with the R interface to NLopt. 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 has been taken from the NLopt website 1, where more details are available. All credit for implementing the C code for the different algorithms availalbe in NLopt should go to the respective authors. See the website 2 for information on how to cite NLopt and the algorithms you use. This package should be considered in beta and comments about any aspect of the package are welcome. This document is an R vignette prepared with the aid of Sweave (Leisch, 2002). Financial support of the UK Economic and Social Research Council through a grant (RES ) to the ESRC Centre for Microdata Methods and Practice (CeMMAP) is gratefully acknowledged
2 2 Installation This package is on CRAN and can be installed from within R using > install.packages("nloptr") You should now be able to load the R interface to NLopt and read the help. > library('nloptr') >?nloptr The most recent experimental version of nloptr can be installed from R-Forge using > install.packages("nloptr",repos=" or from source using > install.packages("nloptr",type="source",repos=" 3 Minimizing the Rosenbrock Banana function As a first example we will solve an unconstrained minimization problem. The function we look at is the Rosenbrock Banana function f(x) = 100 ( x 2 x 2 1) 2 + (1 x1 ) 2, which is also used as an example in the documentation for the standard R optimizer optim. The gradient of the objective function is given by ( ) 400 x1 (x f(x) = 2 x 2 1) 2 (1 x 1 ) 200 (x 2 x 2. 1) Not all of the algorithms in NLopt need gradients to be supplied by the user. We will show examples with and without supplying the gradient. After loading the library > library(nloptr) we start by specifying the objective function and its gradient > ## Rosenbrock Banana function > 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) { return( c( -400 * x[1] * (x[2] - x[1] * x[1]) - 2 * (1 - x[1]), 200 * (x[2] - x[1] * x[1]) ) ) We define initial values 2
3 > # initial values > x0 <- c( -1.2, 1 ) and then minimize the function using the nloptr 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. Before we can minimize the function we need to specify which algorithm we want to use > opts <- list("algorithm"="nlopt_ld_lbfgs", "xtol_rel"=1.0e-8) Here we use the L-BFGS algorithm (Liu and Nocedal, 1989; Nocedal, 1980). The characters LD in the algorithm show that this algorithm looks for local minima (L) using a derivative-based (D) algorithm. Other algorithms look for global (G) minima, or they don t need derivatives (N). We also specified the termination criterium in terms of the relative x-tolerance. Other termination criteria are available (see Appendix A for a full list of options). We then solve the minimization problem using > # solve Rosenbrock Banana function > res <- nloptr( x0=x0, eval_f=eval_f, eval_grad_f=eval_grad_f, opts=opts) We can see the results by printing the resulting object. > print( res ) Call: nloptr(x0 = x0, eval_f = eval_f, eval_grad_f = eval_grad_f, opts = opts) Minimization using NLopt version NLopt solver status: 1 ( NLOPT_SUCCESS: Generic success return value. ) Number of Iterations...: 56 Termination conditions: xtol_rel: 1e-08 Number of inequality constraints: 0 Number of equality constraints: 0 Optimal value of objective function: e-23 Optimal value of controls: 1 1 Sometimes the objective function and its gradient contain common terms. To economize on calculations, we can return the objective and its gradient in a list. For the Rosenbrock Banana function we have for instance 3
4 > ## Rosenbrock Banana function and gradient in one function > eval_f_list <- function(x) { common_term <- x[2] - x[1] * x[1] return( list( "objective" = 100 * common_term^2 + (1 - x[1])^2, "gradient" = c( -400 * x[1] * common_term - 2 * (1 - x[1]), 200 * common_term) ) ) which we minimize using > res <- nloptr( x0=x0, eval_f=eval_f_list, opts=opts) > print( res ) Call: nloptr(x0 = x0, eval_f = eval_f_list, opts = opts) Minimization using NLopt version NLopt solver status: 1 ( NLOPT_SUCCESS: Generic success return value. ) Number of Iterations...: 56 Termination conditions: xtol_rel: 1e-08 Number of inequality constraints: 0 Number of equality constraints: 0 Optimal value of objective function: e-23 Optimal value of controls: 1 1 This gives the same results as before. 4 Minimization with inequality constraints This section shows how to minimize a function subject to inequality constraints. This example is the same as the one used in the tutorial on the NLopt website. The problem we want to solve is min x R n x2 s.t. x 2 0 x 2 (a 1 x 1 + b 1 ) 3 x 2 (a 2 x 1 + b 2 ) 3, where a 1 = 2, b 1 = 0, a 2 = 1, and b 2 = 1. In order to solve this problem, we first have to re-formulate the constraints to be of the form g(x) 0. Note that the first constraint is a bound on x 2, which we will add later. The other two constraints can be re-written as (a 1 x 1 + b 1 ) 3 x 2 0 (a 2 x 1 + b 2 ) 3 x
5 First we define R functions to calculate the objective function and its gradient > # objective function > eval_f0 <- function( x, a, b ){ return( sqrt(x[2]) ) > # gradient of objective function > eval_grad_f0 <- function( x, a, b ){ return( c( 0,.5/sqrt(x[2]) ) ) If needed, these can of course be calculated in the same function as before. Then we define the two constraints and the jacobian of the constraints > # constraint function > eval_g0 <- function( x, a, b ) { return( (a*x[1] + b)^3 - x[2] ) > # jacobian of constraint > eval_jac_g0 <- function( x, a, b ) { return( rbind( c( 3*a[1]*(a[1]*x[1] + b[1])^2, -1.0 ), c( 3*a[2]*(a[2]*x[1] + b[2])^2, -1.0 ) ) ) Note that all of the functions above depend on additional parameters, a and b. We have to supply specific values for these when we invoke the optimization command. The constraint function eval_g0 returns a vector with in this case the same length as the vectors a and b. The function calculating the jacobian of the constraint should return a matrix where the number of rows equal the number of constraints (in this case two). The number of columns should equal the number of control variables (two in this case as well). After defining values for the parameters > # define parameters > a <- c(2,-1) > b <- c(0, 1) we can minimize the function subject to the constraints with the following command > # Solve using NLOPT_LD_MMA with gradient information supplied in separate function > res0 <- nloptr( x0=c(1.234,5.678), eval_f=eval_f0, eval_grad_f=eval_grad_f0, lb = c(-inf,0), ub = c(inf,inf), eval_g_ineq = eval_g0, eval_jac_g_ineq = eval_jac_g0, opts = list("algorithm" = "NLOPT_LD_MMA", "xtol_rel"=1.0e-8, "print_level" = 2, 5
6 a = a, b = b ) iteration: 1 f(x) = g(x) = ( , ) iteration: 2 f(x) = g(x) = ( , ) iteration: 3 f(x) = g(x) = ( , ) iteration: 4 f(x) = g(x) = ( , ) iteration: 5 f(x) = g(x) = ( , ) iteration: 6 f(x) = g(x) = ( , ) iteration: 7 f(x) = g(x) = ( , ) iteration: 8 f(x) = g(x) = ( , ) iteration: 9 f(x) = g(x) = ( , ) iteration: 10 f(x) = g(x) = ( , ) iteration: 11 g(x) = ( , ) iteration: 12 iteration: 13 iteration: 14 iteration: 15 "check_derivatives" = TRUE, "check_derivatives_print" = "all"), 6
7 iteration: 16 iteration: 17 iteration: 18 iteration: 19 iteration: 20 iteration: 21 g(x) = ( , ) iteration: 22 g(x) = ( , ) iteration: 23 g(x) = ( , ) iteration: 24 g(x) = ( , ) iteration: 25 g(x) = ( , ) > print( res0 ) Call: nloptr(x0 = c(1.234, 5.678), eval_f = eval_f0, eval_grad_f = eval_grad_f0, lb = c(-inf, 0), ub = c(inf, Inf), eval_g_ineq = eval_g0, eval_jac_g_ineq = eval_jac_g0, opts = list(algorithm = "NLOPT_LD_MMA", xtol_rel = 1e-08, print_level = 2, check_derivatives = TRUE, check_derivatives_print = "all"), a = a, b = b) Minimization using NLopt version NLopt solver status: 4 ( NLOPT_XTOL_REACHED: Optimization stopped because xtol_rel or xtol_abs (above) was reached. ) Number of Iterations...: 25 Termination conditions: xtol_rel: 1e-08 Number of inequality constraints: 2 7
8 Number of equality constraints: 0 Optimal value of objective function: Optimal value of controls: Here we supplied lower bounds for x 2 in lb. There are no upper bounds for both control variables, so we supply Inf values. If we don t supply lower or upper bounds, plus or minus infinity is chosen by default. The inequality constraints and its jacobian are defined using eval_g_ineq and eval_jac_g_ineq. Not all algorithms can handle inequality constraints, so we have to specifiy one that does, NLOPT_LD_MMA (Svanberg, 2002). We also specify the option print_level to obtain output during the optimization process. For the available print_level values, see?nloptr. Setting the check_derivatives option to TRUE, compares the gradients supplied by the user with a finite difference approximation in the initial point (x0). When this check is run, the option check_derivatives_print can be used to print all values of the derivative checker (all (default)), only those values that result in an error (errors) or no output (none), in which case only the number of errors is shown. The tolerance that determines if a difference between the analytic gradient and the finite difference approximation results in an error can be set using the option check_derivatives_tol (default = 1e-04). The first column shows the value of the analytic gradient, the second column shows the value of the finite difference approximation, and the third column shows the relative error. Stars are added at the front of a line if the relative error is larger than the specified tolerance. Finally, we add all the parameters that have to be passed on to the objective and constraint functions, a and b. We can also use a different algorithm to solve the same minimization problem. The only thing we have to change is the algorithm that we want to use, in this case NLOPT_LN_COBYLA, which is an algorithm that doesn t need gradient information (Powell, 1994, 1998). > # Solve using NLOPT_LN_COBYLA without gradient information > res1 <- nloptr( x0=c(1.234,5.678), eval_f=eval_f0, lb = c(-inf,0), ub = c(inf,inf), eval_g_ineq = eval_g0, opts = list("algorithm"="nlopt_ln_cobyla", "xtol_rel"=1.0e-8), a = a, b = b ) > print( res1 ) Call: nloptr(x0 = c(1.234, 5.678), eval_f = eval_f0, lb = c(-inf, 0), ub = c(inf, Inf), eval_g_ineq = eval_g0, opts = list(algorithm = "NLOPT_LN_COBYLA", xtol_rel = 1e-08), a = a, b = b) Minimization using NLopt version
9 NLopt solver status: 4 ( NLOPT_XTOL_REACHED: Optimization stopped because xtol_rel or xtol_abs (above) was reached. ) Number of Iterations...: 50 Termination conditions: xtol_rel: 1e-08 Number of inequality constraints: 2 Number of equality constraints: 0 Optimal value of objective function: Optimal value of controls: Derivative checker The derivative checker can be called when supplying a minimization problem to nloptr, using the options check_derivatives, check_derivatives_tol and check_derivatives_print, but it can also be used separately. For example, define the function g, with vector outcome, and its gradient g_grad > g <- function( x, a ) { return( c( x[1] - a[1], x[2] - a[2], (x[1] - a[1])^2, (x[2] - a[2])^2, (x[1] - a[1])^3, (x[2] - a[2])^3 ) ) > g_grad <- function( x, a ) { return( rbind( c( 1, 0 ), c( 0, 1 ), c( 2*(x[1] - a[1]), 0 ), c( 2*(x[1] - a[1]), 2*(x[2] - a[2]) ), c( 3*(x[1] - a[2])^2, 0 ), c( 0, 3*(x[2] - a[2])^2 ) ) ) a is some vector containing data. The gradient contains some errors in this case. By calling the function check.derivatives we can check the user-supplied analytic gradients with a finite difference approximation at a point.x. > res <- check.derivatives(.x=c(1,2), func=g, 9
10 func_grad=g_grad, check_derivatives_print='all', a=c(.3,.8) ) The errors are shown on screen, where the option check_derivatives_print determines the amount of output you see. The value of the analytic gradient and the value of the finite difference approximation at the supplied point is returned in a list. > res $analytic [,1] [,2] [1,] [2,] [3,] [4,] [5,] [6,] $finite_difference [,1] [,2] [1,] [2,] [3,] [4,] [5,] [6,] $relative_error [,1] [,2] [1,] e e+00 [2,] e e+00 [3,] e e+00 [4,] e e-08 [5,] e e+00 [6,] e e-08 $flag_derivative_warning [,1] [,2] [1,] FALSE FALSE [2,] FALSE FALSE [3,] FALSE FALSE [4,] TRUE FALSE [5,] TRUE FALSE [6,] FALSE FALSE Note that not all errors will be picked up by the derivative checker. For instance, if we run the check with a = c(.5,.5), one of the errors is not flagged as an error. 10
11 6 Notes The.R scripts in the tests directory contain more examples. For instance, hs071.r and systemofeq.r show how to solve problems with equality constraints. See also for more details. Please let me know if you re missing any of the features that are implemented in NLopt. Sometimes the optimization procedure terminates with a message maxtime was reached without evaluating the objective function. Submitting the same problem again usually solves this problem. References Steven G. Johnson. The NLopt nonlinear-optimization package. Friedrich Leisch. Sweave: Dynamic generation of statistical reports using literate data analysis. In Wolfgang Härdle and Bernd Rönz, editors, Compstat 2002 Proceedings in Computational Statistics, pages Physica Verlag, Heidelberg, URL leisch/sweave. ISBN D. C. Liu and J. Nocedal. On the limited memory BFGS method for large scale optimization. Math. Programming, 45: , J. Nocedal. Updating quasi-newton matrices with limited storage. Math. Comput., 35: , M. J. D. Powell. A direct search optimization method that models the objective and constraint functions by linear interpolation. In S. Gomez and J.-P. Hennart, editors, Advances in Optimization and Numerical Analysis, pages Kluwer Academic, Dordrecht, M. J. D. Powell. Direct search algorithms for optimization calculations. Acta Numerica, 7: , Krister Svanberg. A class of globally convergent optimization methods based on conservative convex separable approximations. SIAM J. Optim., 12(2): , A Description of options > nloptr.print.options() algorithm possible values: NLOPT_GN_DIRECT, NLOPT_GN_DIRECT_L, NLOPT_GN_DIRECT_L_RAND, NLOPT_GN_DIRECT_NOSCAL, NLOPT_GN_DIRECT_L_NOSCAL, NLOPT_GN_DIRECT_L_RAND_NOSCAL, NLOPT_GN_ORIG_DIRECT, NLOPT_GN_ORIG_DIRECT_L, 11
12 default value: NLOPT_GD_STOGO, NLOPT_GD_STOGO_RAND, NLOPT_LD_SLSQP, NLOPT_LD_LBFGS_NOCEDAL, NLOPT_LD_LBFGS, NLOPT_LN_PRAXIS, NLOPT_LD_VAR1, NLOPT_LD_VAR2, NLOPT_LD_TNEWTON, NLOPT_LD_TNEWTON_RESTART, NLOPT_LD_TNEWTON_PRECOND, NLOPT_LD_TNEWTON_PRECOND_RESTART, NLOPT_GN_CRS2_LM, NLOPT_GN_MLSL, NLOPT_GD_MLSL, NLOPT_GN_MLSL_LDS, NLOPT_GD_MLSL_LDS, NLOPT_LD_MMA, NLOPT_LN_COBYLA, NLOPT_LN_NEWUOA, NLOPT_LN_NEWUOA_BOUND, NLOPT_LN_NELDERMEAD, NLOPT_LN_SBPLX, NLOPT_LN_AUGLAG, NLOPT_LD_AUGLAG, NLOPT_LN_AUGLAG_EQ, NLOPT_LD_AUGLAG_EQ, NLOPT_LN_BOBYQA, NLOPT_GN_ISRES none stopval This option is required. Check the NLopt website for a description of the algorithms. possible values: -Inf <= stopval <= Inf default value: -Inf Stop minimization when an objective value <= stopval is found. Setting stopval to -Inf disables this stopping criterion (default). ftol_rel possible values: ftol_rel > 0 default value: 0.0 Stop when an optimization step (or an estimate of the optimum) changes the objective function value by less than ftol_rel multiplied by the absolute value of the function value. If there is any chance that your optimum function value is close to zero, you might want to set an absolute tolerance with ftol_abs as well. Criterion is disabled if ftol_rel is non-positive (default). ftol_abs possible values: ftol_abs > 0 default value: 0.0 Stop when an optimization step (or an estimate of the optimum) changes the function value by less than ftol_abs. Criterion is disabled if ftol_abs is non-positive (default). xtol_rel possible values: xtol_rel > 0 default value: 1.0e-04 Stop when an optimization step (or an estimate of the optimum) 12
13 changes every parameter by less than xtol_rel multiplied by the absolute value of the parameter. If there is any chance that an optimal parameter is close to zero, you might want to set an absolute tolerance with xtol_abs as well. Criterion is disabled if xtol_rel is non-positive. xtol_abs possible values: xtol_abs > 0 default value: rep( 0.0, length(x0) ) maxeval maxtime xtol_abs is a vector of length n (the number of elements in x) giving the tolerances: stop when an optimization step (or an estimate of the optimum) changes every parameter x[i] by less than xtol_abs[i]. Criterion is disabled if all elements of xtol_abs are non-positive (default). possible values: maxeval is a positive integer default value: 100 Stop when the number of function evaluations exceeds maxeval. This is not a strict maximum: the number of function evaluations may exceed maxeval slightly, depending upon the algorithm. Criterion is disabled if maxeval is non-positive. possible values: maxtime > 0 default value: -1.0 Stop when the optimization time (in seconds) exceeds maxtime. This is not a strict maximum: the time may exceed maxtime slightly, depending upon the algorithm and on how slow your function evaluation is. Criterion is disabled if maxtime is non-positive (default). tol_constraints_ineq possible values: tol_constraints_ineq > 0.0 default value: rep( 1e-8, num_constraints_ineq ) The parameter tol_constraints_ineq is a vector of tolerances. Each tolerance corresponds to one of the inequality constraints. The tolerance is used for the purpose of stopping criteria only: a point x is considered feasible for judging whether to stop the optimization if eval_g_ineq(x) <= tol. A tolerance of zero means that NLopt will try not to consider any x to be converged unless eval_g_ineq(x) is strictly non-positive; generally, at least a small positive tolerance is advisable to reduce sensitivity to rounding errors. By default the tolerances for all inequality constraints are set to 1e-8. tol_constraints_eq possible values: tol_constraints_eq >
14 default value: rep( 1e-8, num_constraints_eq ) The parameter tol_constraints_eq is a vector of tolerances. Each tolerance corresponds to one of the equality constraints. The tolerance is used for the purpose of stopping criteria only: a point x is considered feasible for judging whether to stop the optimization if abs( eval_g_ineq(x) ) <= tol. For equality constraints, a small positive tolerance is strongly advised in order to allow NLopt to converge even if the equality constraint is slightly nonzero. By default the tolerances for all equality constraints are set to 1e-8. print_level possible values: 0, 1, 2, or 3 default value: 0 The option print_level controls how much output is shown during the optimization process. Possible values: 0 (default): no output; 1: show iteration number and value of objective function; 2: 1 + show value of (in)equalities; 3: 2 + show value of controls. check_derivatives possible values: TRUE or FALSE default value: FALSE The option check_derivatives can be activated to compare the user-supplied analytic gradients with finite difference approximations. check_derivatives_tol possible values: check_derivatives_tol > 0.0 default value: 1e-04 The option check_derivatives_tol determines when a difference between an analytic gradient and its finite difference approximation is flagged as an error. check_derivatives_print possible values: 'none', 'all', 'errors', default value: all The option check_derivatives_print controls the output of the derivative checker (if check_derivatives==true). All comparisons are shown ('all'), only those comparisions that resulted in an error ('error'), or only the number of errors is shown ('none'). print_options_doc possible values: TRUE or FALSE default value: FALSE If TRUE, a description of all options and their current and default 14
15 values is printed to the screen. population possible values: population is a positive integer default value: 0 ranseed Several of the stochastic search algorithms (e.g., CRS, MLSL, and ISRES) start by generating some initial population of random points x. By default, this initial population size is chosen heuristically in some algorithm-specific way, but the initial population can by changed by setting a positive integer value for population. A population of zero implies that the heuristic default will be used. possible values: ranseed is a positive integer default value: 0 For stochastic optimization algorithms, pseudorandom numbers are generated. Set the random seed using ranseed if you want to use a 'deterministic' sequence of pseudorandom numbers, i.e. the same sequence from run to run. If ranseed is 0 (default), the seed for the random numbers is generated from the system time, so that you will get a different sequence of pseudorandom numbers each time you run your program. 15
Operation Count; Numerical Linear Algebra
10 Operation Count; Numerical Linear Algebra 10.1 Introduction Many computations are limited simply by the sheer number of required additions, multiplications, or function evaluations. If floating-point
General Framework for an Iterative Solution of Ax b. Jacobi s Method
2.6 Iterative Solutions of Linear Systems 143 2.6 Iterative Solutions of Linear Systems Consistent linear systems in real life are solved in one of two ways: by direct calculation (using a matrix factorization,
Nonlinear Programming Methods.S2 Quadratic Programming
Nonlinear Programming Methods.S2 Quadratic Programming Operations Research Models and Methods Paul A. Jensen and Jonathan F. Bard A linearly constrained optimization problem with a quadratic objective
(Quasi-)Newton methods
(Quasi-)Newton methods 1 Introduction 1.1 Newton method Newton method is a method to find the zeros of a differentiable non-linear function g, x such that g(x) = 0, where g : R n R n. Given a starting
Numerisches Rechnen. (für Informatiker) M. Grepl J. Berger & J.T. Frings. Institut für Geometrie und Praktische Mathematik RWTH Aachen
(für Informatiker) M. Grepl J. Berger & J.T. Frings Institut für Geometrie und Praktische Mathematik RWTH Aachen Wintersemester 2010/11 Problem Statement Unconstrained Optimality Conditions Constrained
GenOpt (R) Generic Optimization Program User Manual Version 3.0.0β1
(R) User Manual Environmental Energy Technologies Division Berkeley, CA 94720 http://simulationresearch.lbl.gov Michael Wetter [email protected] February 20, 2009 Notice: This work was supported by the U.S.
IEOR 4404 Homework #2 Intro OR: Deterministic Models February 14, 2011 Prof. Jay Sethuraman Page 1 of 5. Homework #2
IEOR 4404 Homework # Intro OR: Deterministic Models February 14, 011 Prof. Jay Sethuraman Page 1 of 5 Homework #.1 (a) What is the optimal solution of this problem? Let us consider that x 1, x and x 3
Lecture 3. Linear Programming. 3B1B Optimization Michaelmas 2015 A. Zisserman. Extreme solutions. Simplex method. Interior point method
Lecture 3 3B1B Optimization Michaelmas 2015 A. Zisserman Linear Programming Extreme solutions Simplex method Interior point method Integer programming and relaxation The Optimization Tree Linear Programming
THE FUNDAMENTAL THEOREM OF ALGEBRA VIA PROPER MAPS
THE FUNDAMENTAL THEOREM OF ALGEBRA VIA PROPER MAPS KEITH CONRAD 1. Introduction The Fundamental Theorem of Algebra says every nonconstant polynomial with complex coefficients can be factored into linear
Vector and Matrix Norms
Chapter 1 Vector and Matrix Norms 11 Vector Spaces Let F be a field (such as the real numbers, R, or complex numbers, C) with elements called scalars A Vector Space, V, over the field F is a non-empty
7. LU factorization. factor-solve method. LU factorization. solving Ax = b with A nonsingular. the inverse of a nonsingular matrix
7. LU factorization EE103 (Fall 2011-12) factor-solve method LU factorization solving Ax = b with A nonsingular the inverse of a nonsingular matrix LU factorization algorithm effect of rounding error sparse
Interior-Point Algorithms for Quadratic Programming
Interior-Point Algorithms for Quadratic Programming Thomas Reslow Krüth Kongens Lyngby 2008 IMM-M.Sc-2008-19 Technical University of Denmark Informatics and Mathematical Modelling Building 321, DK-2800
10.2 ITERATIVE METHODS FOR SOLVING LINEAR SYSTEMS. The Jacobi Method
578 CHAPTER 1 NUMERICAL METHODS 1. ITERATIVE METHODS FOR SOLVING LINEAR SYSTEMS As a numerical technique, Gaussian elimination is rather unusual because it is direct. That is, a solution is obtained after
Nonlinear Optimization: Algorithms 3: Interior-point methods
Nonlinear Optimization: Algorithms 3: Interior-point methods INSEAD, Spring 2006 Jean-Philippe Vert Ecole des Mines de Paris [email protected] Nonlinear optimization c 2006 Jean-Philippe Vert,
Numerical methods for American options
Lecture 9 Numerical methods for American options Lecture Notes by Andrzej Palczewski Computational Finance p. 1 American options The holder of an American option has the right to exercise it at any moment
Solving polynomial least squares problems via semidefinite programming relaxations
Solving polynomial least squares problems via semidefinite programming relaxations Sunyoung Kim and Masakazu Kojima August 2007, revised in November, 2007 Abstract. A polynomial optimization problem whose
Computing a Nearest Correlation Matrix with Factor Structure
Computing a Nearest Correlation Matrix with Factor Structure Nick Higham School of Mathematics The University of Manchester [email protected] http://www.ma.man.ac.uk/~higham/ Joint work with Rüdiger
SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA
SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA This handout presents the second derivative test for a local extrema of a Lagrange multiplier problem. The Section 1 presents a geometric motivation for the
MATLAB and Big Data: Illustrative Example
MATLAB and Big Data: Illustrative Example Rick Mansfield Cornell University August 19, 2014 Goals Use a concrete example from my research to: Demonstrate the value of vectorization Introduce key commands/functions
2.3 Convex Constrained Optimization Problems
42 CHAPTER 2. FUNDAMENTAL CONCEPTS IN CONVEX OPTIMIZATION Theorem 15 Let f : R n R and h : R R. Consider g(x) = h(f(x)) for all x R n. The function g is convex if either of the following two conditions
5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1
5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1 General Integer Linear Program: (ILP) min c T x Ax b x 0 integer Assumption: A, b integer The integrality condition
Optimization Modeling for Mining Engineers
Optimization Modeling for Mining Engineers Alexandra M. Newman Division of Economics and Business Slide 1 Colorado School of Mines Seminar Outline Linear Programming Integer Linear Programming Slide 2
LAYOUT OF THE KEYBOARD
Dr. Charles Hofmann, LaSalle [email protected] Dr. Roseanne Hofmann, MCCC [email protected] ------------------------------------------------------------------------------------------------- DISPLAY CONTRAST
Recovery of primal solutions from dual subgradient methods for mixed binary linear programming; a branch-and-bound approach
MASTER S THESIS Recovery of primal solutions from dual subgradient methods for mixed binary linear programming; a branch-and-bound approach PAULINE ALDENVIK MIRJAM SCHIERSCHER Department of Mathematical
24. The Branch and Bound Method
24. The Branch and Bound Method It has serious practical consequences if it is known that a combinatorial problem is NP-complete. Then one can conclude according to the present state of science that no
The Steepest Descent Algorithm for Unconstrained Optimization and a Bisection Line-search Method
The Steepest Descent Algorithm for Unconstrained Optimization and a Bisection Line-search Method Robert M. Freund February, 004 004 Massachusetts Institute of Technology. 1 1 The Algorithm The problem
1 if 1 x 0 1 if 0 x 1
Chapter 3 Continuity In this chapter we begin by defining the fundamental notion of continuity for real valued functions of a single real variable. When trying to decide whether a given function is or
Nonlinear Algebraic Equations. Lectures INF2320 p. 1/88
Nonlinear Algebraic Equations Lectures INF2320 p. 1/88 Lectures INF2320 p. 2/88 Nonlinear algebraic equations When solving the system u (t) = g(u), u(0) = u 0, (1) with an implicit Euler scheme we have
Chapter 3. if 2 a i then location: = i. Page 40
Chapter 3 1. Describe an algorithm that takes a list of n integers a 1,a 2,,a n and finds the number of integers each greater than five in the list. Ans: procedure greaterthanfive(a 1,,a n : integers)
To give it a definition, an implicit function of x and y is simply any relationship that takes the form:
2 Implicit function theorems and applications 21 Implicit functions The implicit function theorem is one of the most useful single tools you ll meet this year After a while, it will be second nature to
Linear Programming. March 14, 2014
Linear Programming March 1, 01 Parts of this introduction to linear programming were adapted from Chapter 9 of Introduction to Algorithms, Second Edition, by Cormen, Leiserson, Rivest and Stein [1]. 1
Overview of Violations of the Basic Assumptions in the Classical Normal Linear Regression Model
Overview of Violations of the Basic Assumptions in the Classical Normal Linear Regression Model 1 September 004 A. Introduction and assumptions The classical normal linear regression model can be written
Date: April 12, 2001. Contents
2 Lagrange Multipliers Date: April 12, 2001 Contents 2.1. Introduction to Lagrange Multipliers......... p. 2 2.2. Enhanced Fritz John Optimality Conditions...... p. 12 2.3. Informative Lagrange Multipliers...........
Optimization in R n Introduction
Optimization in R n Introduction Rudi Pendavingh Eindhoven Technical University Optimization in R n, lecture Rudi Pendavingh (TUE) Optimization in R n Introduction ORN / 4 Some optimization problems designing
Nonlinear Algebraic Equations Example
Nonlinear Algebraic Equations Example Continuous Stirred Tank Reactor (CSTR). Look for steady state concentrations & temperature. s r (in) p,i (in) i In: N spieces with concentrations c, heat capacities
Numerical Methods for Solving Systems of Nonlinear Equations
Numerical Methods for Solving Systems of Nonlinear Equations by Courtney Remani A project submitted to the Department of Mathematical Sciences in conformity with the requirements for Math 4301 Honour s
Practical Guide to the Simplex Method of Linear Programming
Practical Guide to the Simplex Method of Linear Programming Marcel Oliver Revised: April, 0 The basic steps of the simplex algorithm Step : Write the linear programming problem in standard form Linear
Here are some examples of combining elements and the operations used:
MATRIX OPERATIONS Summary of article: What is an operation? Addition of two matrices. Multiplication of a Matrix by a scalar. Subtraction of two matrices: two ways to do it. Combinations of Addition, Subtraction,
Derivative Free Optimization
Department of Mathematics Derivative Free Optimization M.J.D. Powell LiTH-MAT-R--2014/02--SE Department of Mathematics Linköping University S-581 83 Linköping, Sweden. Three lectures 1 on Derivative Free
How I won the Chess Ratings: Elo vs the rest of the world Competition
How I won the Chess Ratings: Elo vs the rest of the world Competition Yannis Sismanis November 2010 Abstract This article discusses in detail the rating system that won the kaggle competition Chess Ratings:
Predict Influencers in the Social Network
Predict Influencers in the Social Network Ruishan Liu, Yang Zhao and Liuyu Zhou Email: rliu2, yzhao2, [email protected] Department of Electrical Engineering, Stanford University Abstract Given two persons
Chapter 7 Nonlinear Systems
Chapter 7 Nonlinear Systems Nonlinear systems in R n : X = B x. x n X = F (t; X) F (t; x ; :::; x n ) B C A ; F (t; X) =. F n (t; x ; :::; x n ) When F (t; X) = F (X) is independent of t; it is an example
AC 2012-4561: MATHEMATICAL MODELING AND SIMULATION US- ING LABVIEW AND LABVIEW MATHSCRIPT
AC 2012-4561: MATHEMATICAL MODELING AND SIMULATION US- ING LABVIEW AND LABVIEW MATHSCRIPT Dr. Nikunja Swain, South Carolina State University Nikunja Swain is a professor in the College of Science, Mathematics,
10. Proximal point method
L. Vandenberghe EE236C Spring 2013-14) 10. Proximal point method proximal point method augmented Lagrangian method Moreau-Yosida smoothing 10-1 Proximal point method a conceptual algorithm for minimizing
BIG DATA PROBLEMS AND LARGE-SCALE OPTIMIZATION: A DISTRIBUTED ALGORITHM FOR MATRIX FACTORIZATION
BIG DATA PROBLEMS AND LARGE-SCALE OPTIMIZATION: A DISTRIBUTED ALGORITHM FOR MATRIX FACTORIZATION Ş. İlker Birbil Sabancı University Ali Taylan Cemgil 1, Hazal Koptagel 1, Figen Öztoprak 2, Umut Şimşekli
CPLEX Tutorial Handout
CPLEX Tutorial Handout What Is ILOG CPLEX? ILOG CPLEX is a tool for solving linear optimization problems, commonly referred to as Linear Programming (LP) problems, of the form: Maximize (or Minimize) c
4.6 Linear Programming duality
4.6 Linear Programming duality To any minimization (maximization) LP we can associate a closely related maximization (minimization) LP. Different spaces and objective functions but in general same optimal
Multi-variable Calculus and Optimization
Multi-variable Calculus and Optimization Dudley Cooke Trinity College Dublin Dudley Cooke (Trinity College Dublin) Multi-variable Calculus and Optimization 1 / 51 EC2040 Topic 3 - Multi-variable Calculus
A Labeling Algorithm for the Maximum-Flow Network Problem
A Labeling Algorithm for the Maximum-Flow Network Problem Appendix C Network-flow problems can be solved by several methods. In Chapter 8 we introduced this topic by exploring the special structure of
Discrete Optimization
Discrete Optimization [Chen, Batson, Dang: Applied integer Programming] Chapter 3 and 4.1-4.3 by Johan Högdahl and Victoria Svedberg Seminar 2, 2015-03-31 Todays presentation Chapter 3 Transforms using
Solutions Of Some Non-Linear Programming Problems BIJAN KUMAR PATEL. Master of Science in Mathematics. Prof. ANIL KUMAR
Solutions Of Some Non-Linear Programming Problems A PROJECT REPORT submitted by BIJAN KUMAR PATEL for the partial fulfilment for the award of the degree of Master of Science in Mathematics under the supervision
Notes from Week 1: Algorithms for sequential prediction
CS 683 Learning, Games, and Electronic Markets Spring 2007 Notes from Week 1: Algorithms for sequential prediction Instructor: Robert Kleinberg 22-26 Jan 2007 1 Introduction In this course we will be looking
Interior Point Methods and Linear Programming
Interior Point Methods and Linear Programming Robert Robere University of Toronto December 13, 2012 Abstract The linear programming problem is usually solved through the use of one of two algorithms: either
The KaleidaGraph Guide to Curve Fitting
The KaleidaGraph Guide to Curve Fitting Contents Chapter 1 Curve Fitting Overview 1.1 Purpose of Curve Fitting... 5 1.2 Types of Curve Fits... 5 Least Squares Curve Fits... 5 Nonlinear Curve Fits... 6
A NEW LOOK AT CONVEX ANALYSIS AND OPTIMIZATION
1 A NEW LOOK AT CONVEX ANALYSIS AND OPTIMIZATION Dimitri Bertsekas M.I.T. FEBRUARY 2003 2 OUTLINE Convexity issues in optimization Historical remarks Our treatment of the subject Three unifying lines of
Package jrvfinance. R topics documented: October 6, 2015
Package jrvfinance October 6, 2015 Title Basic Finance; NPV/IRR/Annuities/Bond-Pricing; Black Scholes Version 1.03 Implements the basic financial analysis functions similar to (but not identical to) what
Adaptive Online Gradient Descent
Adaptive Online Gradient Descent Peter L Bartlett Division of Computer Science Department of Statistics UC Berkeley Berkeley, CA 94709 bartlett@csberkeleyedu Elad Hazan IBM Almaden Research Center 650
Chapter 10: Network Flow Programming
Chapter 10: Network Flow Programming Linear programming, that amazingly useful technique, is about to resurface: many network problems are actually just special forms of linear programs! This includes,
Optimal Scheduling for Dependent Details Processing Using MS Excel Solver
BULGARIAN ACADEMY OF SCIENCES CYBERNETICS AND INFORMATION TECHNOLOGIES Volume 8, No 2 Sofia 2008 Optimal Scheduling for Dependent Details Processing Using MS Excel Solver Daniela Borissova Institute of
Performance Optimization of I-4 I 4 Gasoline Engine with Variable Valve Timing Using WAVE/iSIGHT
Performance Optimization of I-4 I 4 Gasoline Engine with Variable Valve Timing Using WAVE/iSIGHT Sean Li, DaimlerChrysler (sl60@dcx dcx.com) Charles Yuan, Engineous Software, Inc ([email protected]) Background!
Linear Algebra Notes
Linear Algebra Notes Chapter 19 KERNEL AND IMAGE OF A MATRIX Take an n m matrix a 11 a 12 a 1m a 21 a 22 a 2m a n1 a n2 a nm and think of it as a function A : R m R n The kernel of A is defined as Note
D-optimal plans in observational studies
D-optimal plans in observational studies Constanze Pumplün Stefan Rüping Katharina Morik Claus Weihs October 11, 2005 Abstract This paper investigates the use of Design of Experiments in observational
A Simultaneous Solution for General Linear Equations on a Ring or Hierarchical Cluster
Acta Technica Jaurinensis Vol. 3. No. 1. 010 A Simultaneous Solution for General Linear Equations on a Ring or Hierarchical Cluster G. Molnárka, N. Varjasi Széchenyi István University Győr, Hungary, H-906
Massive Data Classification via Unconstrained Support Vector Machines
Massive Data Classification via Unconstrained Support Vector Machines Olvi L. Mangasarian and Michael E. Thompson Computer Sciences Department University of Wisconsin 1210 West Dayton Street Madison, WI
npsolver A SAT Based Solver for Optimization Problems
npsolver A SAT Based Solver for Optimization Problems Norbert Manthey and Peter Steinke Knowledge Representation and Reasoning Group Technische Universität Dresden, 01062 Dresden, Germany [email protected]
14:440:127 Introduction to Computers for Engineers. Notes for Lecture 06
14:440:127 Introduction to Computers for Engineers Notes for Lecture 06 Rutgers University, Spring 2010 Instructor- Blase E. Ur 1 Loop Examples 1.1 Example- Sum Primes Let s say we wanted to sum all 1,
Duality in General Programs. Ryan Tibshirani Convex Optimization 10-725/36-725
Duality in General Programs Ryan Tibshirani Convex Optimization 10-725/36-725 1 Last time: duality in linear programs Given c R n, A R m n, b R m, G R r n, h R r : min x R n c T x max u R m, v R r b T
7 Gaussian Elimination and LU Factorization
7 Gaussian Elimination and LU Factorization In this final section on matrix factorization methods for solving Ax = b we want to take a closer look at Gaussian elimination (probably the best known method
Duality of linear conic problems
Duality of linear conic problems Alexander Shapiro and Arkadi Nemirovski Abstract It is well known that the optimal values of a linear programming problem and its dual are equal to each other if at least
Variance Reduction. Pricing American Options. Monte Carlo Option Pricing. Delta and Common Random Numbers
Variance Reduction The statistical efficiency of Monte Carlo simulation can be measured by the variance of its output If this variance can be lowered without changing the expected value, fewer replications
Using EXCEL Solver October, 2000
Using EXCEL Solver October, 2000 2 The Solver option in EXCEL may be used to solve linear and nonlinear optimization problems. Integer restrictions may be placed on the decision variables. Solver may be
AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables
AMATH 352 Lecture 3 MATLAB Tutorial MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical analysis. It provides an environment for computation and the visualization. Learning
CSCI567 Machine Learning (Fall 2014)
CSCI567 Machine Learning (Fall 2014) Drs. Sha & Liu {feisha,yanliu.cs}@usc.edu September 22, 2014 Drs. Sha & Liu ({feisha,yanliu.cs}@usc.edu) CSCI567 Machine Learning (Fall 2014) September 22, 2014 1 /
Simplex method summary
Simplex method summary Problem: optimize a linear objective, subject to linear constraints 1. Step 1: Convert to standard form: variables on right-hand side, positive constant on left slack variables for
Review Jeopardy. Blue vs. Orange. Review Jeopardy
Review Jeopardy Blue vs. Orange Review Jeopardy Jeopardy Round Lectures 0-3 Jeopardy Round $200 How could I measure how far apart (i.e. how different) two observations, y 1 and y 2, are from each other?
Convex Programming Tools for Disjunctive Programs
Convex Programming Tools for Disjunctive Programs João Soares, Departamento de Matemática, Universidade de Coimbra, Portugal Abstract A Disjunctive Program (DP) is a mathematical program whose feasible
Airport Planning and Design. Excel Solver
Airport Planning and Design Excel Solver Dr. Antonio A. Trani Professor of Civil and Environmental Engineering Virginia Polytechnic Institute and State University Blacksburg, Virginia Spring 2012 1 of
Proximal mapping via network optimization
L. Vandenberghe EE236C (Spring 23-4) Proximal mapping via network optimization minimum cut and maximum flow problems parametric minimum cut problem application to proximal mapping Introduction this lecture:
FACTORING SPARSE POLYNOMIALS
FACTORING SPARSE POLYNOMIALS Theorem 1 (Schinzel): Let r be a positive integer, and fix non-zero integers a 0,..., a r. Let F (x 1,..., x r ) = a r x r + + a 1 x 1 + a 0. Then there exist finite sets S
Linear Programming. Widget Factory Example. Linear Programming: Standard Form. Widget Factory Example: Continued.
Linear Programming Widget Factory Example Learning Goals. Introduce Linear Programming Problems. Widget Example, Graphical Solution. Basic Theory:, Vertices, Existence of Solutions. Equivalent formulations.
A Simple Introduction to Support Vector Machines
A Simple Introduction to Support Vector Machines Martin Law Lecture for CSE 802 Department of Computer Science and Engineering Michigan State University Outline A brief history of SVM Large-margin linear
8 Square matrices continued: Determinants
8 Square matrices continued: Determinants 8. Introduction Determinants give us important information about square matrices, and, as we ll soon see, are essential for the computation of eigenvalues. You
EXCEL SOLVER TUTORIAL
ENGR62/MS&E111 Autumn 2003 2004 Prof. Ben Van Roy October 1, 2003 EXCEL SOLVER TUTORIAL This tutorial will introduce you to some essential features of Excel and its plug-in, Solver, that we will be using
Appendix 4 Simulation software for neuronal network models
Appendix 4 Simulation software for neuronal network models D.1 Introduction This Appendix describes the Matlab software that has been made available with Cerebral Cortex: Principles of Operation (Rolls
Logistic Regression for Spam Filtering
Logistic Regression for Spam Filtering Nikhila Arkalgud February 14, 28 Abstract The goal of the spam filtering problem is to identify an email as a spam or not spam. One of the classic techniques used
The Multicut L-Shaped Method
1 / 25 The Multicut L-Shaped Method Operations Research Anthony Papavasiliou Contents 2 / 25 1 The Multicut L-Shaped Method [ 5.1 of BL] 2 Example 3 Example: Capacity Expansion Planning Table of Contents
How long is the vector? >> length(x) >> d=size(x) % What are the entries in the matrix d?
MATLAB : A TUTORIAL 1. Creating vectors..................................... 2 2. Evaluating functions y = f(x), manipulating vectors. 4 3. Plotting............................................ 5 4. Miscellaneous
Arithmetic and Algebra of Matrices
Arithmetic and Algebra of Matrices Math 572: Algebra for Middle School Teachers The University of Montana 1 The Real Numbers 2 Classroom Connection: Systems of Linear Equations 3 Rational Numbers 4 Irrational
Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh
Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh Peter Richtárik Week 3 Randomized Coordinate Descent With Arbitrary Sampling January 27, 2016 1 / 30 The Problem
HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!
Math 7 Fall 205 HOMEWORK 5 SOLUTIONS Problem. 2008 B2 Let F 0 x = ln x. For n 0 and x > 0, let F n+ x = 0 F ntdt. Evaluate n!f n lim n ln n. By directly computing F n x for small n s, we obtain the following
Mathematical finance and linear programming (optimization)
Mathematical finance and linear programming (optimization) Geir Dahl September 15, 2009 1 Introduction The purpose of this short note is to explain how linear programming (LP) (=linear optimization) may
constraint. Let us penalize ourselves for making the constraint too big. We end up with a
Chapter 4 Constrained Optimization 4.1 Equality Constraints (Lagrangians) Suppose we have a problem: Maximize 5, (x 1, 2) 2, 2(x 2, 1) 2 subject to x 1 +4x 2 =3 If we ignore the constraint, we get the
SOLVING LINEAR SYSTEMS
SOLVING LINEAR SYSTEMS Linear systems Ax = b occur widely in applied mathematics They occur as direct formulations of real world problems; but more often, they occur as a part of the numerical analysis
A few useful MATLAB functions
A few useful MATLAB functions Renato Feres - Math 350 Fall 2012 1 Uniform random numbers The Matlab command rand is based on a popular deterministic algorithm called multiplicative congruential method.
What is Linear Programming?
Chapter 1 What is Linear Programming? An optimization problem usually has three essential ingredients: a variable vector x consisting of a set of unknowns to be determined, an objective function of x to
4 UNIT FOUR: Transportation and Assignment problems
4 UNIT FOUR: Transportation and Assignment problems 4.1 Objectives By the end of this unit you will be able to: formulate special linear programming problems using the transportation model. define a balanced
Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions.
Chapter 1 Vocabulary identity - A statement that equates two equivalent expressions. verbal model- A word equation that represents a real-life problem. algebraic expression - An expression with variables.
