Originally posted by: Treee
hey,
in my model the containers just "spawn" simultaneosly. But actually there is a container list and the first container should be placed first, the second container second and so on.And This Containers should be placed in a tuple like this :
tuple ContainerData
{
key int ContainerNumber
int value;
int y;
int x;
int t;
int block
}
How can i do that?
my.dat:
Container =
{<"Container1" 1 1000 5> <"Container3" 3 1100 2>
<"Container2" 2 500 1> <"Container4" 1 900 2>
<"Container5" 4 550 4>};
Rows = 4;
Columns = 5;
Tiers = 3;
Blocks =2;
nbTypesOfContainers = 2; //normalContainers, CoolingContainers
TimeNeededBlock =
[[[[ 1 7 13 19 25] //
[ 3 9 2 21 27] //
[5 11 17 23 29] //
[7 13 19 25 31]]
[[2 8 14 20 26]
[4 10 16 22 28]
[6 12 18 24 30]
[8 14 20 26 32]]
[[3 9 15 21 27]
[5 11 17 23 29]
[7 13 19 25 31]
[9 15 21 27 33]]]
[[[37 43 49 55 61]
[39 45 51 57 63]
[41 47 53 59 65]
[44 50 55 61 67]]
[[38 44 50 56 62]
[40 46 52 58 64]
[42 48 54 60 66]
[44 50 56 62 68]]
[[39 45 51 57 63]
[41 47 53 59 65]
[43 49 55 61 67]
[45 51 57 63 69]]]];
and my mod:
int nbTypesOfContainers = ...;
range ContainerTypes = 1..nbTypesOfContainers;
int Rows = ...;
range Row = 1..Rows;
int Columns = ...;
range CoolingColumn = 4..Columns;
range NormalColumn = 1..Columns-2;
range Column = 1..Columns;
int Tiers = ...;
range Tier = 1..Tiers;
int Blocks = ...;
range Block = 1..Blocks;
int TimeNeededBlock[Block][Tier][Row][Column] = ...;
dvar boolean placedTypes[ContainerTypes][Block][Tier][Row][Column];
tuple ContainerDaten {
key int ContainerNumber;
int type;
int weight;
int duration;
}
{ContainerDaten} Container = ...;
minimize
sum( t in Tier,r in Row, c in Column, a in ContainerTypes, b in Block)
placedTypes[a][b][t][r][c]*TimeNeededBlock[b][t][r][c];
int totalType1 = sum(con in Container : con.type ==1)1;
int totalType2 = sum(con in Container : con.type ==2)1;
subject to {
ctType1:
sum(t in Tier,r in Row, c in NormalColumn, b in Block)
placedTypes[1][b][t][r][c] == totalType1;
ctType2:
sum(t in Tier,r in Row, c in NormalColumn,b in Block)
placedTypes[2][b][t][r][c] == totalType2;
} // some more constraints
kind regards
#DecisionOptimization#OPLusingCPLEXOptimizer