“multiple inequality constraints” - Minimization with R nloptr package
问题 Is there a way to define multiple "inequality constraints" in nloptr package in R? The inequality function needs to have five inequality constraints; colsum of a matrix (stacked from a integer vector) <=1 . (5 out of 6 columns) This is how I implemented to achieve it: constraint.func <- function(my.data.var) { column = 2 constr <- c("numeric",ncol(my.data.matrix.inj) ) for(index in 1:ncol(my.data.matrix.inj)) #1 to 5 { constr[index] <- sum(my.data.var[column], my.data.var[column+6], my.data