Dear all,

I need to maximize the v:

 v= D' W D


D is a column vector ( n , 1)
W is a given matrix (n, n)

subject to:
 sum D= 1

(BTW, n is less than 300)
I´ve tried to use maxBFGS, as follows:

#####################################
objectiveFunction<-function(x)
{
  return(t(D)%*%W%*%D)
}

Amat<-diag(nrow(D))
Amat<-rbind((rep(-1, nrow(D))), Amat)
bvec<-matrix( c(0), nrow(D)+1, 1)
bvec[1,1]<-c(1)
startValues=rep(1/nrow(D),nrow(D)) #Istart value is homogeneous distribution
res <<- maxBFGS(objectiveFunction, start=startValues,
constraints=list(ineqA=Amat, ineqB=bvec))
########################################
The outcome is equal to the startValues. I´ve tried several initial values
and nothing changes.
Please, what am I doing wrong? Any suggestion?

Thanks a lot!

Leo.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to