[R] Optimization problem

Pacin Al jokloq at gmail.com
Wed May 16 18:44:49 CEST 2012


Hi,

I'm dealing with an optimization problem. I'm using 'optim' to maximize the
output of a function, given some restrictions on the input. I would like to
know if there is a way to impose some restrictions on 'intermediate
variables' of the function. An example..

fx = function (x)
{
s <- 0
for (i in 1:3)
{
s <- x[i]^3 + s
}
s
}

optim(rep(4,3), method="L-BFGS-B", lower=rep(-10,nlin), upper=rep(10,nlin))

It would return '-10' for all variables. I want, however, a solution
satisfying mean(x)>7.
Please, don't analyse this specific example, but the logic of satisfying a
criterium for the mean of the input (with thousands of variables). My real
problem involves price elasticity and I want to find the price increase for
each individual that would give me maximum total profit margin, but
respecting a minimum retention of clients.

Thank you very much,
John Mayer 

--
View this message in context: http://r.789695.n4.nabble.com/Optimization-problem-tp4630278.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list