Questions tagged [nlopt]

NLopt is a nonlinear optimization library written in C by Steven G. Johnson and licensed under the LGPL.

144 questions
30
votes
8 answers

Installing nloptr on Linux

I am trying to install the R package nloptr on a CentOS Linux machine that doesn't have internet connection as follows: install.packages("/home/ravi/nloptr_1.0.4.tar.gz", repos = NULL, type="source") This command in turn looks for the following…
Ravi
  • 3,223
  • 7
  • 37
  • 49
18
votes
6 answers

Trouble installing nloptr package on R 3.3.0

I can't install the package nloptr 1.0.4 on R 3.3.0. The messages are the following: > install.packages("nloptr") Installing package into ‘/Users/fgomesbarros/Library/R/3.3/library (as ‘lib’ is unspecified) trying URL…
Fabio Barros
  • 329
  • 1
  • 2
  • 7
10
votes
2 answers

Minimize quadratic function subject to linear equality constraints with SciPy

I have a reasonably simple constrained optimization problem but get different answers depending on how I do it. Let's get the import and a pretty print function out of the way first: import numpy as np from scipy.optimize import minimize,…
JohnE
  • 29,156
  • 8
  • 79
  • 109
10
votes
1 answer

Installing nloptr on Linux - fatal error: nlopt.h: No such file or directory

Another cry for help with installing nloptr package on Linux (Ubuntu 14.04.4 LTS). I looked through many questions but did not manage to find a solution for this. I am unable to install lme4 package in R (version 3.3.1/Rstudio Version 0.99.902) as…
user1442363
  • 800
  • 1
  • 10
  • 18
10
votes
1 answer

Minimization with R nloptr package - multiple equality constraints

Is it possible to specify more than one equality constraint in nloptr function in R? The code that I am trying to run is the following: eval_f <- function( x ) { return( list( "objective" = x[3]^2+x[4]^2, "gradient" = c( 0, …
6
votes
1 answer

Minimize matrix in Equation using OpenCV

I need to minimize H in following equation: Where H is 3x3 Matrix. Pn is 3x1 matrix (point). Euclidean() gives distance between 2 points. Dn is the actual distance. I have one initial estimate of H and m points(P0 to Pm) I need optimize value of…
Deepak
  • 1,038
  • 5
  • 17
  • 44
6
votes
1 answer

Why does my NLOPT optimization error/fail to solve?

I'm stumped. I have a problem formulated for NLOPT in R. The current problem solves for 180 variables with 28 equality constraints The code is re-used from a simpler version of the problem, earlier in my script, with 36 variables and 20 equality…
paperwings
  • 63
  • 1
  • 5
5
votes
1 answer

Non-linear optimization in R

I am trying to solve an optimization problem using the package nloptr in R. I am not sure what is wrong with the following code, as I keep getting this error: Error: nlopt_add_equality_mconstraint returned NLOPT_INVALID_ARGS. Here is the problem…
Mayou
  • 8,498
  • 16
  • 59
  • 98
4
votes
2 answers

Prepare CRAN R package with external dependencies (nlopt)

I am trying to submit a package to CRAN that fails during the pretest process on Debian. I use some C++ code that interfaces to the nlopt optimization library with Rcpp/RcppArmadillo (using ). Thus, my package requires a system version of…
4
votes
3 answers

Unable to install nloptr / nlopt on a cluster without root rights

I am trying to install (on a linux based cluster) the R package FactoMineR, which requires nloptr, which in turn requires nlopt. Just using install.packages("nloptr") does not work and yields the following error: >…
Mojoesque
  • 1,166
  • 8
  • 15
4
votes
1 answer

Error while installing a tar.gz package in R

When i try to install a R package nlopt-2.4.2.tar.gz from http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz , using sudo R CMD INSTALL nlopt-2.4.2.tar.gz, I get the following Error : Error in untar2(tarfile, files, list, exdir, restore_times) : …
4
votes
1 answer

NLopt SLSQP discards good solution in favour of older, worse solution

I'm solving a standard optimisation problem from Finance - portfolio optimisation. The vast majority of the time, NLopt is returning a sensible solution. However, on rare occasions, the SLSQP algorithm appears to iterate to the correct solution, and…
4
votes
2 answers

NLOPT Invalid argument Python

When I run the following simple NLOPT example in python : import numpy as np import nlopt n = 2 localopt_feval_max = 10 lb = np.array([-1, -1]) ub = np.array([1, 1]) def myfunc(x, grad): return -1 opt = nlopt.opt(nlopt.LN_NELDERMEAD,…
jmlarson
  • 837
  • 8
  • 31
3
votes
1 answer

NLopt with Armadillo data

The NLopt objective function looks like this: double myfunc(const std::vector &x, std::vector &grad, void *my_func_data) x is the data being optimized, grad is a vector of gradients, and my_func_data holds additional data. I am…
covstat
  • 331
  • 1
  • 3
  • 10
3
votes
0 answers

NLopt minimum working example fails with "RoundoffLimited"

I was experimenting with NLopt and created the following minimum working example, which consistently fails with RoundoffLimited: NLopt roundoff-limited: import numpy as np import nlopt dim = 1 def obj_func(x, grad): return float(…
1
2 3
9 10