void addConstarint(IloEnv env, IloModel &model, IloBoolVarArray y, BoolVarMatrix x)

/****************************************************/

/* This function add constarints to the formulation */

/****************************************************/

{

IloExpr constraint(env);

for (int i = 0; i < nCandidates; i++){

constraint += y[i];

}

cout << constraint << endl;

model.add(constraint == k);

for (int j = 0; j < nVoters; j++){

IloExpr constraint(env);

for(int i = 0; i < nCandidates; i++){

constraint+=x[i][j];

}

model.add(constraint == 1);

}

for(int i = 0; i < nCandidates; i++){

for (int j = 0; j < nVoters; j++){

model.add(x[i][j]-y[i] <= 0);

}

}

}

This is for IP solution and it works fine, but I want to check my LP solution and when I change the type of variables y and x and make them IloNumVarArray and NumVarMatrix in order to get the fractional solution, I got the following error when it reached to line "constraint += y[i];":

**Error :"No source available for "operator+() "**

This is my function for adding constraint to LP model :

void addConstarintLP(IloEnv env, IloModel &model, IloNumVarArray y, NumVarMatrix x)

/***********************************************************/

/* This function add constarints to the formulation for LP */

/***********************************************************/

{

IloExpr constraint(env);

IloBoolVar v;

constraint = constraint + v;

for (int i = 0; i < nCandidates; i++){

constraint += y[i];

}

cout << constraint << endl;

model.add(constraint == k);

for (int j = 0; j < nVoters; j++){

IloExpr constraint(env);

for(int i = 0; i < nCandidates; i++){

constraint+=x[i][j];

}

model.add(constraint == 1);

}

for(int i = 0; i < nCandidates; i++){

for (int j = 0; j < nVoters; j++){

model.add(x[i][j]-y[i] <= 0);

}

}

}

Can someone help me? what is my mistake or what did I forget?

Thank you.