similar to: Relative constraint using constrOptim?

Displaying 20 results from an estimated 12000 matches similar to: "Relative constraint using constrOptim?"

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/
2010 Dec 06
1
How to formulate constraint like abs(x) = y in constrOptim (or other)
Hello list reader, I am trying to form some constraints for an optimization I am working on. I think I have understand the use of the constraints in matrix form. I use them like: constr_mat<- -diag(2) constr_vec<- rep(-0.05,2) constr_mat<- rbind(constr_mat, diag(2)) constr_vec<- c(constr_vec, rep(-1, 2)) To get parameters in the interval [-1, 0.05]. (And this works so far) Now I
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
2011 Dec 21
1
constrOptim and further arguments
Dear List, I have the code below, where I am using the constrained optimisation package, 'constrOptim.nl' to find the values of two values, b0 and b1. I have no problems when I enter further variable information DIRECTLY into the functions, fn, and heq. In this instance I require fn to have -0.0075 appended to it, and in the case of heq, h[1] has -0.2. library(alabama)
2013 Sep 26
0
ConstrOptim Function (Related to Constraint Matrix/ui/ci error)
Hello All, I am stuck in the following problem. Cexpt=c(0,25,50,100,150,300,250,125,40) t=c(0,0.2,0.4,0.6,1,4,8,12,24) theta0= vector of 6 parms (My initial parameter) A=Constraint matrix (hopefully 6*6) B= Constraint vector of length 6) Cfit=function(t,theta){ J(t)=function(theta,t) Cfit=function(J(t),constant) return(Cfit) } loss=function(theta,t,Cexpt) {
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 Jun 26
1
Question about Constraint Optimization
Dear All, I am having trouble in using R function "constrOptim" to do constraint optimization. It seems that "constrOptim" calls function "optim" when it does the optimization, and "optim" allows us to set "method" to be "SANN" if we want to use simulated annealing. In "optim", the function allows us to set gradient to be
2007 Aug 01
1
constrOptim
Hi, I'm having trouble using the constrOptim function to generate the 9-component vector argmin of the function ELfsds: ELfsds <- function(pvechat){ LG=0 for(i in 1:9){ LG=LG+log(pvechat[i]) } return(-LG) } with accompanying gradient function: gradfunc <- function(thetavec){ g=1/(9*thetavec) return(g) } The constraints on the optimization problem are: 1 - components of
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
2006 Oct 20
1
Cardinality constraint
Hello, How do I implement a cardinality constraint with constrOptim? I want to minimize (least square) a%*%x = 4 subject to x1<2 x2<1 x3<4 count(x1, x2, x3)= 2 (cardinality constraint) Is there a way to specify binary integer variables with constrOptim? Here's my code so far: a <-matrix(1:3,1,3) fr <- function(x) { (a%*%x-4)^2 }
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')
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]]
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
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
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
2008 May 12
1
hessian in constrained optimization (constrOptim)
Dear helpers, I am using the function "constrOptim" to estimate a model with ML with an inequality constraint using the option method='Nelder-Mead'. When I specify the option: hessian = TRUE I obtain the response: Error in f(theta, ...) : unused argument(s) (hessian = TRUE) I guess the function "constrOptim" does not allow this argument which, on the other hand, is
2008 Jun 17
2
constrOptim with method = "L-BFGS-B"
Hi, i need to minimize a quadratic function with boundary condidtions and one equality condition. In order to do that i converted the equality constraint into 2 inequality constaints and passed everything cia constrOptim, as the manual said: everything included in the ... will be passed to Optim that will pass it back to fn in case it does not need it. My code is the following: mat <-
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}}
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