Displaying 20 results from an estimated 40000 matches similar to: "Constraint Optimization problem."
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
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
2004 Aug 09
4
linear constraint optim with bounds/reparametrization
Hello All,
I would like to optimize a (log-)likelihood function subject to a number of
linear constraints between parameters. These constraints are equality
constraints of the form A%*%theta=c, ie (1,1) %*% 0.8,0.2)^t = 1 meaning
that these parameters should sum to one. Moreover, there are bounds on the
individual parameters, in most cases that I am considering parameters are
bound between zero
2010 Jul 26
1
Optimization problem with nonlinear constraint
Dear all,
I'm looking for a way to solve a simple optimization problem with a
nonlinear constraint. An example would be
max x s.t. y = x * T ^(x-1)
where y and T are known values.
optim() and constrOptim() do only allow for box or linear constraints,
so I did not succedd here. I also found hints to donlp2 but this does
not seem to be available anymore.
Any hints are welcome,
2006 Dec 08
1
fmincon equivalent in R
Dear all R users,
I am wondering if there are any function for Constraint optimization in R.
Especially i am looking for a R - equivalent of "fmincon" function in
MATLAB.
Thanks and regards,
Arun
[[alternative HTML version deleted]]
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
}
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)=
2011 Oct 12
2
Minimization/Optimization under functional constraints
Hi,
I hope someone can help me with the following issue.
I need find the minimum beta that satisfies the following:
inf{beta>0 | f(x+beta*f(x))*f(x)<=0}
where f() is a function and x is a sample statistic.
Functions such as "nlminb" and "constrOptim" minimize a function and output
the parameter (under parameter constraints). I need to minimize the
parameter (also
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
2004 Oct 02
1
constraints in optim?
>
optim(c(1,1),LL,method="SANN",control=list(fnscale=-1),trans=trans,times=times)
$par
[1] 17.422635 -1.606859
How could i constraint that the parameters should be both positive in
my maximizing problem?
I check constrOptim but here i could only constraint the variables trans and
times and not my parameters?
many thanks, regards
Christian
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 <-
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)
2008 May 19
0
constrOptim converging not to the optimal values
Dear helpers,
I am using constrOptim to minimize a function subject to inequality
constraint. It works well when the number of parameters to optimize is low
(e.g. 4) but when they are more (e.g. 10) it does not produce the expected
results.
The function is minus the determinant of a binomial logit model with one
explanatory variable.
Calling ?xeta? the vector of explanatory variables the
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
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
2011 Dec 29
0
problem of "constrOptim.nl", no hessian and convergence values
Dear Helper,
I used "constrOptim.nl" and got the value of par. The estimations looks good
even if the number of iterations is only 16. But the values of hessian and
convergence are both "NULL".
I tested the objective function and gradient function by "optim" and didn't
see any problem there. With these functions, "optim" gives the convergence
value
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 Aug 19
1
nonlinear constrained optimization
Hi. I need some advises on how to use R to find pi (i is the index) with
the following objective function and constraint:
max (sum i)[ f(ai, bi, pi) * g(ci, di, pi) * Di ]
s.t. (sum i)[ f(ai, bi, pi) * Di * pi] / (sum i)[ f(ai, bi, pi) * Di ] <=
constant
f and g are diffentiable.
So, I am thinking of optim with method = "BFGS"? But wonder how to include
the
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) {
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