I am trying to optimize the below problem in CPLEX OPL. I have defined the parameters and decision variables. However, when I try to formulate the objective function and the constraints I seem to encounter a problem as I receive an error in the line of the objective function calles 'cannot use type range for int'. I am not sure what is wrong here.
Also in the constraint formulation I have a problem formulating constraints that ensure that variable I & W are balanced in between two consequative periods. CPLEX error reads operator not available for range - int.
The problem I am trying to recreate is:
This is my current data file:
time=2;
// Try product =1
d = [2000,1500];
k = [5000,5000];
h = [1,1];
p = [300,300];
q = [600,600];
e = [1,1];
c = [3,3];
r = [4,4];
This is what I came up with so far in the model:
int Time = ...; range T=1..Time;
// Parameters
int d [T] = ...; // demand in period t
int K [T] = ...; // fixed order cost in period t
int h [T] = ...; // unit holding cost in period t
int p [T] = ...; // fixed cost of increasing WH size in period t
int q [T] = ...; // fixed cost of increasing WH size in period t
int e [T] = ...; // variable cost of increasing WH size in period t
int c [T] = ...; // variable cost of decreasing WH size in period t
int r [T] = ...; // WH rental cost per unit in period t
dvar int+ x[T]; //order size in period t
dvar int+ i[T]; //inventory lvl at the end of period t
dvar int+ w[T]; // warehouse size at the end of period t
dvar int+ u[T]; // warehouse size expansion at beginning of period t
dvar int+ v[T]; // warehouse size contraction at beginning of period t
dvar boolean y[T]; // binary variable for ordering in period t
dvar boolean z1[T]; // binary variable for WH expansion in period t
dvar boolean z2[T]; // binary variable for WH contraction in period t
//objecTve funcTon
dexpr int Cost = sum(t in T)(K[T]*y[T]+h[T]*i1[T]+p[T]*z1[T]+e[T]*u[T]+q[T]*z2[T]+c[T]*v[T]+r[T]*w1[T]);
minimize Cost;
//constraints
subject to {
forall(t in T) {
i[T-1] + x[T] - d[T] == i[T];
w[T-1] + u[T] - v[T] == w[T];
i[T] <= w[T];
x[T] <= d[T]*y[T];
u[T] <= d[T]*z1[T];
v[T] <= d[T]*z2[T];
I[0]==0;
}
}
Could someone give me some advice on what I am doing wrong in the objective function formulation and How I can correctly formulate the constraint that I(t-1)+x-d=I(t) ?
This would be very much appreciated!