what is the dist array, and how do I fill it out for the next cost matrix?
[ 99 2 3 4 1 2 99 5 6 3 3 5 99 7 2 4 6 2 99 6 1 3 1 6 99 ]
I used the standard cplex solution
.mod:
int n = ...;
range Cities = 1..n;
tuple edge {
int i;
int j;
}
setof(edge) Edges = {<i,j> | ordered i,j in Cities};
int dist[Edges] = ...;
dvar boolean x[Edges];
In
setof(edge) Edges = {<i,j> | ordered i,j in Cities};
int dist[Edges] = ...;
you expect to get a symmetrical matrix with only half of the (i,j) but in
[ 99 2 3 4 1 2 99 5 6 3 3 5 99 7 2 4 6 2 99 6 1 3 1 6 99 ]
you have provided the full 5*5 array.
So in your model you should change
setof(edge) Edges = {<i,j> | ordered i,j in Cities};
into
setof(edge) Edges = {<i,j> | i,j in Cities};