Originally posted by: quawarty
> Thank you for your reply.
I would like to use condition instruction.
g = 0
if ei =< Ti <= li g = 1
if Ti >= li:
Could you please tell me if what I did is correct or not?
Thank you for your help.
//Notation//
//----------------------------------//
int n = 3; range V = 1..1; range P = 1..2; range N = 0..n+1;
/* set of customers and depots (N.B. depot is represented by the two vertices )*/
//Parameters//
//------------------------------------//
int q[N0][P] =...; ;
/* amount of a product p provided or required by customer */
int d[N][N] = ...;
/* travel distance between customer*/
int e[N] = [0, 0, 0, 0, 0];
/* lower bound of the time windows*/
int l[N] = [5, 2, 6, 5, 18];
/* upper bound of the time windows*/
int cs = 2;
int E= -1;
int g = 0;
//--------------------------------------------------//
//Decision variables//
//--------------------------------------------------// dvar int+ f[N][N][P];
/* load of the vehicle by product p passing through the arc (i,j)*/ dvar int+ T[N];
/*continous variable indicationg the time at which the vehicle strats serving pickup customer*/ dvar
boolean x[N][N][P];
/* = 1 if the arc (i,j)*/ dvar int+ h;
//--------------------------------------------------//
//Objective fucntion//
//--------------------------------------------------// minimize sum (i in N, j in N, p in P) (d[i][j] * x[i][j][p]) + cs * h + g * E* (sum (i in N)(T[i] - l[i]));
/* Minimize the total distance */
/* Constraint: customer is visited exactly once*/ subject to
{ forall(i in N)
if (g == 1) (T[i] >= l[i]);
else (e[i] <= T[i] <= l[i]);
#DecisionOptimization#OPLusingCPLEXOptimizer