I am trying to model an objective function using Cplex in java. My objective function is a product of a probability and a cost expression, that is: Obj= sum(Pr(i)*Cost(i)).
I modeled like this:
IloLinearNumExpr objective = cplex.linearNumExpr();
for (int i=0; i<M; i++){
objective.addTerm(Pc[i],SupplierCost[i]);
}
But I have the error message that "The method addTerm(double, IloNumVar) in the type IloLinearNumExpr is not applicable for the arguments (double, IloLinearNumExpr)".
What is wrong?
Thanks!