I have two input matrices, dt(10,3) & wt(3,3), that i need to use to find the optimal decision matrix (same dimension), Par(10,3) so as to maximize an objective function. Below R code would give some direction into the problem (used Sample inputs here) -

```
#Input Matrices
dt <- matrix(runif(300),100,3) 
wt <- matrix(c(1,0,0,0,2,0,0,0,1),3,3) #weights

#objective function    
Obj <- function(Par) {
   P = matrix(Par, nrow = 10, byrow=F) # Reshape
   X = t((dt%*%wt)[,1])%*%P[,1]
   Y = t((dt%*%wt)[,2])%*%P[,2]
   Z = t((dt%*%wt)[,3])%*%P[,3]
   as.numeric(X+Y+Z) #maximize
   }

```

Now I am struggling to apply the following constraints to the problem :

```
1) Matrix, Par can only have binary values (0 or 1)
2) rowSums(Par) = 1 (Basically a row can only have 1 in one of the three columns) 
3) colSums(Par[,1]) <= 5, colSums(Par[,2]) <= 6, & colSums(Par[,3]) <= 4
4) X/(X+Y+Z) < 0.35, & Y/(X+Y+Z) < 0.4 (X,Y,Z are defined in the objective function)

```

I tried coding the constraints in constrOptim, but not sure how to input binary & integer constraints. I am reading up on lpSolve, but not able to figure out. Any help much appreciated. Thanks!