printf "# The set of nodes in the network\n"; display N; printf "# The set of links in the network\n"; display E; printf "# The set of modular sizes for structures and couplers\n"; display W; printf "# The set of OD pairs and \n"; printf "# the number wavelengths required for each o-d pair\n"; printf "param: D: r :=\n"; for{(o,d) in D} printf "%d\t%d\t%d\n",o,d,r[o,d]; printf ";\n\n"; printf "# The set of available structures\n"; display S; printf "# The edges in each structure\n"; display Es; printf "# The set of available switches\n"; display C; printf "# The structure costs\n"; printf "param a:\n\t"; for {w in W} printf "%d\t",w; printf " :=\n"; for {s in S} { printf "%d",s; for {w in W} printf "\t%d",a[s,w]; printf "\n"; } printf ";\n\n"; printf "# The switch costs\n"; printf "param f:\n\t"; for {w in W} printf "%d\t",w; printf " :=\n"; for {c in C} { printf "%d",c; for {w in W} printf "\t%d",f[c,w]; printf "\n"; } printf ";\n\n"; printf "\n# The set of optical cycle\n"; display K; printf "\n# The set of optical cycles serving each demand pair\n"; display J; printf "\n# The set of paths\n"; display P; printf "\n# The set of paths making up each optical cycle\n"; display Pk; printf "\n# The set of paths using each switch\n"; display L; printf "\n# The set of paths using each edge of each structure\n"; display Pes; # determine the set of conflicting paths set PATHS_USING_STRUCTURE {S} within P default {}; let {s in S} PATHS_USING_STRUCTURE[s] := union {(i,j) in Es[s]} Pes[i,j,s]; set STRUCTURES_TRAVERSED_BY_PATH {P} within S default {}; let {p in P} STRUCTURES_TRAVERSED_BY_PATH[p] := {s in S: p in PATHS_USING_STRUCTURE[s]}; set H1 within {P, P} default {}; # Add the pairs of paths that use the same edge of each given structure for {s in S} { for {(u,v) in Es[s]} { let H1 := H1 union {i in Pes[u,v,s], j in Pes[u,v,s]: i < j}; } } # the translation parameter must be already set (i.e., by the perl program create_data_file.pl) if (translation = 2) then { # In this model, we start a new path every time we cross a switch. # A given switch c connects two structures: s1[c] and s2[c]. # A path p in L[c] either traverses s1[c] xor it traverses s2[c]. # A pair of paths p and q in L[c] conflict if they both traverse s1[c] or they both traverse s2[c]. # If p traverses s1[c] and q traverses s2[c], then they don't conflict in this model. for {c in C: card(L[c]) > 1} { for {i in L[c], j in L[c]: i < j} { if card(STRUCTURES_TRAVERSED_BY_PATH[i] intersect STRUCTURES_TRAVERSED_BY_PATH[j]) > 0 then { let H1 := H1 union {(i,j)}; } } } } else { # Add the pairs of paths that use the same switch for {c in C} { let H1 := H1 union {i in L[c], j in L[c]: i < j}; } } set H within {P, P} default {}; for {p in 1 .. card(H1) - 1} { for {q in p+1 .. card(H1)} { if (p,q) in H1 then { let H := H union {(p,q)}; } } } display H;