Originally posted by: kutikz
i have a route matrix which represent the route for each period to deliver such amount of items, 0 represent the depot, and 1,2,3,4 represent the node of the customers. i have 4 period and 4 customer. and distanceCost is a matrix which represents the cost for doing a delivery including from depot to another customer.
route=[[0,2,1,4,0,3,0,0],
[0,2,4,0,1,0,0,0],
[0,2,0,3,0,4,0,0],
[0,1,2,0,3,0,4,0]];
distanceCost=[[0, 14, 25, 36, 35],
[14, 0, 19, 28, 32],
[25, 19, 0, 11, 13],
[36, 28, 11, 0, 14],
[35, 32, 13, 14, 0]];
my question is i want to calculate the totalcost for the whole rote, which meand sum of the cost for each period,
totalcost==distanceCost[0][2] + distanceCost[2][1] + distanceCost[1][4] + distanceCost[4][0]+...distanceCost[0][0]+
distanceCost[0][2]+distanceCost[2][4]...+ distanceCost[0][0]+
distanceCost[0][2]+ ...+ distanceCost[0][0]+
distanceCost[0][1]+ ... + distanceCost[4][0] ;
im getting confused on how to input the index for calculating the totalcost, because i need the element from the route matrix and use it as the index for the distanceCost.
please help me
#DecisionOptimization#OPLusingCPLEXOptimizer