I'm working on fleet assignment problem, and I'm building a model in xpress-Mosel. However, I need to build it too in OPL - Cplex.
I'm new at OPL, so I've some doubts. I can't define variables by some expression that aren't constraints or given by input.
I've the following vectors in my .dat file, this is a part of all the data file:
proc_low=[...];
cof=[...];
cov_km=[...];
dist_km=[...];
penalty=[...];
Defined on this way:
range N0=0..n;
range N=1..n;
range Fleet=1..3;
range liga=1..30;
range POSS=1..poss;
int legs[N]=...;
int org[N]=...;
int dest[N]=...;
int proc_low[N]=...;
int tp_cod[Fleet]=...;
int cap[Fleet]=...;
int test1[Fleet]=...;
int cof[Fleet]=...;
int cov_km[Fleet]=...;
int cod_org[lig]=...;
int cod_dest[lig]=...;
int penalty[lig]=...;
float dist_km[lig]=...;
int leg_atual[POSS]=...;
int leg_after[POSS]=...;
int tp_fleet[POSS]=...;
tuple T {
int atual;
int after;
int type_f;
}
//Decicion variables
{T} tuples = { <leg_atual[k], leg_after[k], tp_fleet[k]> | k in POSS };
dvar boolean x[tuples];
So, here is my doubt: I cant define this expressions... spill passengers for each leg, that depends of sells (proc_low) and fleet capacity if the leg was flew by some aircraft. The code above isn't in cplex format... is in xpress mosel, and it's here that I need help for write in cplex format...
forall(l in 1..n2) pass_out(l):= spill(l)>=proc_low(l)-sum(f in Fleet)cap(f)*(sum(i in n3..n)x(i,l,f)+x(0,l,f))
forall(l in n3..n) pass_in(l) := spill(l)>=proc_low(l)-sum(f in Fleet)cap(f)*sum(i in 1..n2)x(i,l,f)
Then, the penalty on the objective function per spill passengers
forall(j in N,i in lig|org(j)=cod_org(i) and dest(j)=cod_dest(i))do
pen(j):=penalty(i)*spill(j)
end-do
And last, the cost of assignment of some aircraft at some leg
forall(j in N,i in ligs, f in Fleet|org(j)=cod_org(i) and dest(j)=cod_dest(i))do
cost(j,f):=cof(f)+cov_km(f)*dist_km(i)
end-do
I've defined this variables, on the way shown above, but I'm not sure... Perhaps it's with dexpr
. I really don't know...
dvar int spill[N];
dvar float+ pen[N];
dvar float+ cost[N][Fleet];
Thanks! Regards