// Set of inputs
int i=...; //set of origins
int j=...; //set of destinations
int t=...;//set of time step
range origins=1..i;
range destinations=1..j;
range time=1..t;
tuple demandType {
int demands;
int origins;
int destinations;
int time;
}
demandType dm=...;//Demand of vehicles
float p=...;//Penalty cost
dvar int+ l[origins][destinations][time];//numbers of vehicles from origin i to destination j during t
dvar int+ u[origins][destinations][time];//unmet demand from origin i to destination j at the end of t
dexpr float cost1= sum(i in origins,j in destinations, t in time)(p*u[i][j][t]);
//Objective Function
minimize cost1;
subject to{
constraint1:
forall(i in origins, j in destinations, t in time:(t-1) in time)
u[i][j][t]== u[i][j][t-1] + dm.demands- l[i][j][t];
constraint2:
forall(i in origins, j in destinations, t in time)
l[i][j][t]<= dm.demands;
}
The model looks fine but the error is from the data file.
dm = { <19, 1,1,1>, <17, 2,1,1>, <18, 2,1,2>};
Data item "19" unexpected for "Demand[][destinations][time]".
------------------------------
Anika Tabassum
------------------------------
Original Message:
Sent: Wed July 01, 2020 04:05 AM
From: Daniel Junglas
Subject: Cplex error
In
forall(i in origins, j in destinations, t in time)
u[i][j][t]== u[i][j][t-1] + dm[i][j][t]- l[i][j][t];
you are trying to add integer variable u with tuple dm. You probably mean something like dm[i][j][t].demand?
------------------------------
Daniel Junglas
------------------------------