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]]