constraints are inconsistent, no solution!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

constraints are inconsistent, no solution!

Maija Sirkjärvi
Hi!

I'm solving a quadratic programming problem with some constraints. The
problem is the second set of Amat conditions, which seem to be
inconsistent, but I cannot see why. Do you have any idea, what could be the
problem?

Thanks in advance for your help!
Maija


for(j in 1:J){
  hs[j] <-(-(gEst$KernelRegPartLin..Phi[j]^(-1.2)))
}
hs

Dmat <- matrix(0,nrow= J, ncol=J)
diag(Dmat) <- 1
dvec <- -hs
Aeq <- 0
beq <- 0
Amat <- matrix(0,J,2*J-3)
bvec <- matrix(0,2*J-3,1)

for(j in 2:nrow(Amat)){
  Amat[j-1,j-1] = -1
  Amat[j,j] = 1
}

for(j in 3:nrow(Amat)){
  Amat[j,J-1+j-2] = -1/(Q[j]-Q[j-1])
  Amat[j-1,J-1+j-2] = 1/(Q[j]-Q[j-1])
  Amat[j-2,J-1+j-2] = -1/(Q[j-1]-Q[j-2])
}

for(j in 2:ncol(bvec)) {
  bvec[j-1] = Delta1
}

for(j in 3:ncol(bvec)) {
  bvec[J-1+j-2] = Delta2
}

solution <- solve.QP(Dmat,dvec,Amat,bvec=bvec)
solution

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.