Originally posted by: A.Omidi
Dear Mr. Junglas,
According to your comment on the problem, I have two sets.
The first, number of works, {1,2,3,4,5,6}, and the second, number of resources, {A,B,C}.
I define two indexes [i],[k] in the works and index [m] in the resources.
The model has a constraint in the below form:
*=======================
forall(k in works, m in resources)
comp(m,k) == start(m,k) + sum((i in works), time(m,i)*rank(i,k));
where comp, start and rank are variables and time is given parameter.
*=======================
I was trying to write the model in the Java language using IDE.
The form of code is such as below:
*=======================
for (int k = 0; k < works; k++) {
for(int m=0; m < resource; m++){
IloLinearNumExpr constraint = model.linearNumExpr();
for (int i = 0; i < works; i++) {
constraint.addTerm(1, comp[j]);
constraint.addTerm(-1, start[j]);
constraint.addTerm(-time[m][i], rank[i][k]);
}
model.addEq(constraint, 0);
}
}
*=======================
When I solve the model, it does not have the correct solution.
Please, let me know, how can I write this constraint?
Best regards
#CPLEXOptimizers#DecisionOptimization