Originally posted by: kumarrj
Hello,
I am having trouble using the tuple.
In my problem,the nodes in retailer has different timeslices.
For example Retailer 1 has 42,16,48,12,6
Retailer 2 has 31,3.
Retailer 3 .........
Since each node in retailer has different number of timeslices, I have created a tuple Tj
tuple Slices {
int node;
int slice;
}
the .dat file contains the data for Tj.in the following format.
Tj = {<1,42>,<1,16>,<1,48>,<1,12>,<1,6>,<2,31>,<2,3>,<3,26>,<3,22>,<4,19>,<4,3>,
<5,46>,<5,31>,<6,10>,<6,2>,<6,24>,<6,22>,<6,48>,<7,37>,<7,1>,<7,50>,<7,35>,<8,23>,<8,33>,<8,38>,
<8,27>,<8,40>,<9,4>,<9,31>,<9,42>,<9,28>,<10,13>,<10,33>,<11,45>,<11,20>,<12,37>,<12,45>,<13,30>,
<13,8>,<13,11>,<13,3>,<13,46>,<14,12>,<14,11>,<14,13>,<14,29>,<14,9>,<15,15>,<15,25>,<15,27>,<16,1>,
<16,21>,<16,34>,<16,36>,<17,13>,<17,30>,<17,18>,<17,7>,<17,11>,<18,10>,<18,50>,<18,20>,<19,9>,<19,42>,
<19,38>,<19,3>,<19,10>,<20,31>,<20,43>,<20,11>,<20,27>,<20,41>};
The problem is while the CPLEX is running the problem, it is not taking the different timeslice for the particular retailer.
I have attached the .mod and .dat file below.
I tried formulating this problem as a set covering problem, But i got error: circular dependency, so I have formulated using tuple.
Following are the .mod and .dat files for my problem.
Could anyone please help me with this
Thanks
kumar
-----------------t1.mod..........................
{int} Retailer = ...;
{int} Supplier = ...;
{int} Initial = ...;
{int} Vehicle = ...;
int Capacity
Vehicle = ...; //
int Dprodrs
Retailer,Supplier = ...;
tuple Slices {
int node;
int slice;
}
{Slices} Tj = ...;
dvar int q
Vehicle,Supplier,Retailer,Tj in 0..26;
// Objective function
minimize
sum(v in Vehicle, s in Supplier, r in Retailer, <r,t> in Tj)q
v,s,r,t;
subject to {
//2
forall(r in Retailer, s in Supplier)
sum(v in Vehicle, <r,t> in Tj)
q
v,s,r,t == Dprodrs
r,s;
}
------------------------------------t2.dat------------------------------------
Retailer = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
Supplier = { 21, 22, 23, 24, 25, 26, 27, 28, 29, 30};
Initial = { 31, 32, 33, 34, 35, 36, 37, 38, 39,40};
Vehicle = {1, 2, 3, 4, 5, 6, 7, 8, 9,10};
Capacity =
26, 24, 26, 26, 26, 24, 24, 26, 26, 26;
Dprodrs = [
90, 90, 90, 90, 90, 90, 90, 90, 90, 90 2, 6, 1, 3, 1, 0, 1, 0, 0, 0 0, 1, 2, 0, 1, 0, 0, 0, 0, 0 1, 1, 2, 0, 0, 0, 4, 7, 4, 1 6, 2, 1, 2, 0, 0, 1, 0, 1, 0 0, 3, 1, 1, 1, 0, 3, 4, 1, 10 0, 3, 1, 0, 0, 0, 0, 0, 0, 0 4, 8, 1, 2, 0, 0, 0, 1, 2, 0 3, 2, 2, 1, 0, 0, 0, 4, 0, 0 0, 4, 1, 0, 0, 0, 5, 5, 0, 0 2, 2, 1, 1, 1, 0, 3, 1, 1, 2 4, 3, 0, 0, 0, 0, 3, 6, 2, 3 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 3, 1, 2, 1, 0, 0, 0, 4, 3, 0 3, 2, 4, 2, 0, 0, 0, 1, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 2, 2, 2, 1, 0, 0, 1, 3, 3, 3 0, 3, 5, 1, 0, 0, 2, 6, 2, 2 4, 5, 2, 1, 0, 0, 0, 2, 0, 1 0, 2, 0, 1, 0, 0, 1, 0, 0, 0] ;
Tj = {<1,42>,<1,16>,<1,48>,<1,12>,<1,6>,<2,31>,<2,3>,<3,26>,<3,22>,<4,19>,<4,3>,
<5,46>,<5,31>,<6,10>,<6,2>,<6,24>,<6,22>,<6,48>,<7,37>,<7,1>,<7,50>,<7,35>,<8,23>,<8,33>,<8,38>,
<8,27>,<8,40>,<9,4>,<9,31>,<9,42>,<9,28>,<10,13>,<10,33>,<11,45>,<11,20>,<12,37>,<12,45>,<13,30>,
<13,8>,<13,11>,<13,3>,<13,46>,<14,12>,<14,11>,<14,13>,<14,29>,<14,9>,<15,15>,<15,25>,<15,27>,<16,1>,
<16,21>,<16,34>,<16,36>,<17,13>,<17,30>,<17,18>,<17,7>,<17,11>,<18,10>,<18,50>,<18,20>,<19,9>,<19,42>,
<19,38>,<19,3>,<19,10>,<20,31>,<20,43>,<20,11>,<20,27>,<20,41>};
#DecisionOptimization#OPLusingCPLEXOptimizer