OK, I think I understand what you want. You cannot separately assign volume and weight for the same item. I recommend introducing a new variable to represent the proportion of the item assigned to a box, along with implicit variables to represent the volume and weight:
var BoxesNeeded {ISN,BOX} >= 0 integer;
var Proportion {ISN,BOX} >= 0 <= 1;
impvar VolumeInsideBox {i in ISN, b in BOX} = Volume_ISN[i] * Proportion[i,b];
impvar WeightInsideBox {i in ISN, b in BOX} = Weight_ISN[i] * Proportion[i,b];
The implicit variables for costs are then as follows:
impvar PerVol_Based_Costs = sum {i in ISN, b in BOX: <Org_ISN[i],Des_ISN[i],b> in PerVol_Based_Rate_NoZeroes}
PerVol_Based_Rate[Org_ISN[i],Des_ISN[i],b] * VolumeInsideBox[i,b];
impvar PerWeight_Based_Costs = sum {i in ISN, b in BOX: <Org_ISN[i],Des_ISN[i],b> in PerWeight_Based_Rate_NoZeroes}
PerWeight_Based_Rate[Org_ISN[i],Des_ISN[i],b] * WeightInsideBox[i,b];
And the constraints are:
/* Constraints - START */
for {i in ISN, b in BOX: Is_BoxAvalable_for_a_lane[Org_ISN[i],Des_ISN[i],b] = 0}
fix BoxesNeeded[i,b] = 0;
con SumProportionToOne {i in ISN}:
sum {b in BOX} Proportion[i,b] = 1;
con Volume_Constraint {i in ISN, b in BOX}:
Volume_Capacity[Org_ISN[i],Des_ISN[i],b] * BoxesNeeded[i,b] >= VolumeInsideBox[i,b];
con Weight_Constraint {i in ISN, b in BOX}:
Weight_Capacity[Org_ISN[i],Des_ISN[i],b] * BoxesNeeded[i,b] >= WeightInsideBox[i,b];
con Volume_Constraint_MinThreshold {i in ISN, b in BOX}:
Volume_Min[Org_ISN[i],Des_ISN[i],b] * BoxesNeeded[i,b] <= VolumeInsideBox[i,b];
con Weight_Constraint_MinThreshold {i in ISN, b in BOX}:
Weight_Min[Org_ISN[i],Des_ISN[i],b] * BoxesNeeded[i,b] <= WeightInsideBox[i,b];
/* Constraints - END */
For your sample data, the resulting optimal solution has an objective value of 500,000 and uses 1x10T and 2x8T:
[1]
[2]
BoxesNeeded
Proportion
VolumeInsideBox
WeightInsideBox
SHA_LAX_2
10T
1
0.66667
21.333
10000
SHA_LAX_2
12T
0
0.00000
0.000
0
SHA_LAX_2
20F
0
0.00000
0.000
0
SHA_LAX_2
40F
0
0.00000
0.000
0
SHA_LAX_2
40H
0
0.00000
0.000
0
SHA_LAX_2
45F
0
0.00000
0.000
0
SHA_LAX_2
8T
2
0.33333
10.667
5000
SHA_LAX_2
LCL
0
0.00000
0.000
0
SHA_LAX_2
Level0
0
0.00000
0.000
0
SHA_LAX_2
Level1
0
0.00000
0.000
0
SHA_LAX_2
Level2
0
0.00000
0.000
0
Your proposed solution of 1x10T and 1x12T would have violated the minimum volume threshold of 36 (> 32) for 12T.
... View more