similar to: How to formulate constraint like abs(x) = y in constrOptim (or other)

Displaying 20 results from an estimated 3000 matches similar to: "How to formulate constraint like abs(x) = y in constrOptim (or other)"

2012 Dec 07
1
Error using constrOptim in constraint definition
Hello, I'm trying to run constrOptim. It returns to me an error about the fact that constraints arguments (ui and ci) are non compatibles: > optout= constrOptim(startparams, f=ImpulseSS, grad=grImpulse, ui=UI, ci=CI, data=gexp[k,], t=t) Error in ui %*% theta : non-conformable arguments I would like to point out that I can calculate that product in the command line: > UI %*%
2007 Aug 02
1
constraint in constrOptim
I'm using the function constrOptim together with the "SANN" method and my objective function (f) has two parameters. One of the parameters needs be into (2^(-10), 2^4) range and the other into (2^(-2), 2^12) range. How can I do it using constrOptim?? Thank you André Rossi Alertas do Yahoo! Mail em seu celular. Saiba mais em http://br.mobile.yahoo.com/mailalertas/
2006 Oct 06
1
Relative constraint using constrOptim?
I am trying to optimize a likelihood function using constrOptim. I know from prior research that, e.g. x1>x2. Is there a way to include that constraint into the optimization routine, i.e. the ci constraint? The examples I found only use absolute numeric values for the constraint and not relative values. My attempts to include it into ci failed: e.g. ci=c(1, x[1]). Am I using the
2012 Sep 17
2
Constraint Optimization with constrOptim
Hi, I am having trouble using constrOptim. My target is to do a portfolio optimization and there some constraints have to be fulfilled. 1) The weight of each share of the portfolio has to be greater than 0 2) The sum of these weights has to be 1 I am able to fulfill either the first or the second constraint but not both. One simple way would be to fulfill the first constraint by using optim as
2008 Jun 08
2
optim, constrOptim: setting some parameters equal to each other
Hello, and apologies for the upcoming naive questions. I am a biologist who is trying to teach himself the appropriate areas of math and stats. I welcome pointers to suggested background reading just as much as I do direct answers to my question. Let's say I have a function F() that takes variables (a,b,c,a1,b1,c1) and returns x, and I want to find the values of these variables that result in
2008 Jan 03
1
EQUALITY constraints in 'constrOptim'
Does anybody know to introduce EQUALITY constraints in 'constrOptim' function? BR, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}}
2008 Mar 14
1
Optimization with constraint.
Hello. I have some problems, when I try to model an optimization problem with some constraints. The original problem cannot be solved analytically, so I have to use routines like "Simulated Annealing" or "Sequential Quadric Programming". But to see how all this works in R, I would like to start with some simple problem to get to know the basics: The Problem: min f(x1,x2)=
2006 Dec 08
1
MAXIMIZATION WITH CONSTRAINTS
Dear R users, I?m a graduate students and in my master thesis I must obtain the values of the parameters x_i which maximize this Multinomial log?likelihood function log(n!)-sum_{i=1]^4 log(n_i!)+sum_ {i=1}^4 n_i log(x_i) under the following constraints: a) sum_i x_i=1, x_i>=0, b) x_1<=x_2+x_3+x_4 c)x_2<=x_3+x_4 I have been using the ?ConstrOptim? R-function with the instructions
2006 Feb 01
1
output hessian matrix in constrOptim
Hi, Is there any way to get the hessian matrix from the "constrOptim" function without supplying gradient function? Thanks. --------------------------------- Bring words and photos together (easily) with [[alternative HTML version deleted]]
2004 Jul 14
2
constrOptim and function with additional parameters?
How can I use a function with some additional input parameters in constrOptim? For example, something like fr <- function(x,a) { ## Rosenbrock Banana function x1 <- x[1] x2 <- x[2] a * (x2 - x1 * x1)^2 + (1 - x1)^2 } where the optimum is to be found w.r.t. x. Calling optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail to provide the a=100 in the constrained case:
2009 Jun 03
1
Using constrOptim() function
I have a function myFunction(beta,x) where beta is a vector of coefficients and x is a data frame (think of it as a matrix). I want to optimize the function myFunction() by ONLY changing beta, i.e. x stays constant, with 4 constraints. I have the following code (with a separate source file for the function): rm(list=ls()) source('mySourceFile')
2003 Oct 29
1
constrOptim doesn´t send arguments to optim!(?)
Hi, I think that there something wrong with the 'constrOptim' max/minimization function because she doesn?t send extra arguments to 'optim' call. Fact: When I use optim in a f(x,theta)-like function, everything goes ok. But using constrOptim with the same function leads to error... Proof: Make a small change in the 'Rosenbrock Banana function' (taken from the Examples
2010 Jun 17
2
constrOptim( ): conflict between help page and code
There is a contradiction between what the help page says and what constrOptim actually does with the constraints. The issue is what happens on the boundary. The help page says The feasible region is defined by ?ui %*% theta - ci >= 0?, but the R code for constrOptim reads if (any(ui %*% theta - ci <= 0)) stop("initial value not feasible") The following example
2011 Dec 20
1
constrOptim and problem with derivative
Dear List, I am using constrOptim to solve the following fr1 <- function(x) { b0 <- x[1] b1 <- x[2] ((1/(1+exp(-b0+b1))+(1/(1+exp(-b0)))+(1/(1+exp(-b0-b1)))))/3 } As you can see, my objective function is ((1/(1+exp(-b0+b1))+(1/(1+exp(-b0)))+(1/(1+exp(-b0-b1)))))/3 and I would like to solve for both b0 and b1. If I were to use optim then I would derive the gradient of the
2009 Sep 11
1
constrOptim parameters
Dear R wizards: I am playing (and struggling) with the example in the constrOptim function. simple example. let's say I want to constrain my variables to be within -1 and 1. I believe I want a whole lot of constraints where ci is -1 and ui is either -1 or 1. That is, I have 2*N constraints. Should the following work? N=10 x= rep(1:N) ci= rep(-1, 2*N) ui= c(rep(1, N), rep(-1, N))
2004 Apr 27
1
constrOptim does ineq, not eq, but who do ?
Hi everybody, please, could you give me help ? I scanned the help archives and didn't found hints... I want to solve a large sparse linear system subjected to an inequality constrains (all solutions positive) and an equality constrain (all solutions sum to 1), thus I tried to fool constrOptim using: x[1] + 0 + ... + 0 >= 0 ... 0 + 0 + ... + x[n] >= 0 x[1] + x[2] + ... +
2009 Apr 23
6
Stuck using constrOptim
Trying to use constrOptim to minimize the sum of squared deviations. I put the objective function in as: sum((x %*% Y - Z)^2) so i'm trying to get values for x to minimize the sum of the squared deviations between the product of x and Y and Z. Anyways i have no problem using this when x is a 3x1 test variable. it works great with the constraints and everything. when i actually use it on
2005 Sep 26
2
constrOptim (PR#8158)
Full_Name: Haobo Ren Version: 2.1.1 OS: Windows 2000 Submission from: (NULL) (192.11.226.116) When running constrOptim, there is error message Error: subscript out of bounds
2010 Mar 17
1
constrOptim - error: initial value not feasible
Hello at all, working with a dataset I try to optimize a non-linear function with constraint. test<-read.csv2("C:/Users/Herb/Desktop/Opti/NORM.csv") fkt<- function(x){ a<-c(0) s<-c(0) #Minimizing square error for(j in 1:107){ s<-(test[j,2] - (x[1] * test[j,3]) - (x[2] * test[j,4]) - (x[3]*test[j,5]) - (x[4]*test[j,6]) - (x[5]*test[j,7]))^2 a<- a+s} a<-as.double(a)
2008 Jan 18
1
constrOptim with method SANN
Hi Everyone, I'm trying to minimize a function using constrOptim with the simulated annealing method SANN. If I understand constrOptim well, it basically passes most of its arguments to optim while somehow enforcing the constraints. My problem is, that since SANN does not need gradients, when using optim with SANN, the gr argument of optim is used to specify a function to create the next