absolute value in cplex c++
Please help me. I have to use absolute value in the cost function of some
linear problem. Part that bother me like this
for (t=0;t<T;t++)
for (i=0;i<I; i++){
for (j=1;j<J; j++)
Sum += |x[i][j][t]-x[i][j][t-1]|*L/2;
Sum += |x[i][0][t]-x[i][0][t-1]|*V/2;
}
I am writing my code in c++ and I don't know how to implement absolute
value. x is integer value. I have tried with
cplex.getValue(x[i][j][t])-cplex.getValue(x[i][j][t-1]) >0 but it couldn't
work.
Thanx in advance :)
No comments:
Post a Comment