Originally posted by: SystemAdmin
Hi guys... Suppose that I need k paths between two nodes. How can I do this having the adjacency matrix? I have a set of links and I need k paths between any pair of nodes.
tuple demand {int source; int destination; int bd;}
{demand} Demands= ...;
tuple link {int source; int destination;}
{link} Links = ...;
{link} Path
Demands;
int matriz
NodesNodes;
int m
NodesNodes;
int mc
NodesNodes;
execute PreProcessing{
for(var l in Links){
matriz
http://l.sourcehttp://l.destination = 1;
matriz
http://l.destinationhttp://l.source = 1;
}
for(var i in Nodes)
for(var j in Nodes)
if(matriz[i][j] == 1)
m[i][j] = j;
else
m[i][j] = 0;
mc=matriz;
for(i in Nodes)
for(j in Nodes)
if(mc[i][j] ==1)
for(var k in Nodes)
if(mc[i][k]>mc[i][j]+mc[j][k]){
mc[i][k] = mc[i][j]+mc[j][k];
m[i][k] = m[i][j];
}
}
Someone have any idea about how to solve this problem or any idea about how to change the model to make it more simple?
#DecisionOptimization#OPLusingCPLEXOptimizer