I am using choco API to solve a problem. What I need is coding a constraint that make the sum of all my variables equal to 1. This code keeps a sum of rows equal 1:
IntegerVariable[][] rows;
int n; //number of rows
for(int i=0; i<n; i++)
model.addConstraint(eq(sum(rows[i], 1));
But what I need is programming a code that keeps the sum of all my element's matrix (sum of rows) to be equaled to 1 and not the sum of each row = 1.