model ModelName uses "mmxprs"; !gain access to the Xpress-Optimizer solver !sample declarations section declarations nodes = 1..10 freq = 1..6 c: array(nodes,nodes) of integer x: array(nodes,freq) of mpvar y: array(freq) of mpvar end-declarations c::[0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] forall(i in nodes, k in freq) x(i,k) is_binary forall(k in freq) y(k) is_binary forall(i in nodes) sum(k in freq) x(i,k) = 1 forall(i in nodes, k in freq) x(i,k) <= y(k) forall(i,j in nodes | c(i,j) > 0, k in freq) sum(l in maxlist(1,k-c(i,j)+1)..minlist(6,k+c(i,j)-1)) x(j,l) <= 1-x(i,k) numfreq := sum(k in freq) y(k) minimize(numfreq) forall(i in nodes, k in freq) do if getsol(x(i,k)) > 0 then writeln("x(",i," ",k,")=",getsol(x(i,k))) end-if end-do writeln("Obj=",getobjval) writeln("End running model") end-model