Hi everyone, why do I get no solution? Can you help me again?
set i /0*7/;
alias (i,ip);
display i,ip;
set subset(i) /1*6/;
alias (subset,subsetp);
display subset, subsetp;
table d(i,ip) ‘distances between cities’
$onDelim
,1,2,3,4,5,6
1,0.00,1.66,5.08,6.52,8.83,5.53
2,1.66,0.00,4.09,6.02,9.20,5.76
3,5.08,4.09,0.00,2.45,6.96,4.00
4,6.52,6.02,2.45,0.00,4.80,2.71
5,8.83,9.20,6.96,4.80,0.00,3.44
6,5.53,5.76,4.00,2.71,3.44,0.00
$offDelim
;
display d;
Scalar m ‘total number of cities’ / 6 /;
variables x(i,ip) ‘if ip is visited after i 0-15 arası’
z ‘total distance travelled’ ;
binary variables x;
equations of
eq1
eq2
eq3(ip) ‘city balance constraint’
eq4(subset)
eq5(subset);
of… z=e= sum((subset,subsetp), x(subset,subsetp)d(subset,subsetp));
eq1… sum(subsetp, x(‘0’,subsetp))=e= 1;
eq2… sum(subset, x(subset,‘7’))=e=1;
eq3(subsetp)… (sum( subset (not sameas(subset,subsetp)), x(subset,subsetp)) - sum(subset (not sameas(subset,subsetp)), x(subsetp,subset)) ) =e= 0;
eq4(subset)… sum(subsetp (not sameas(subset,subsetp)), x(subset,subsetp) ) =g= m*x('0', subset);
eq5(subset).. sum(subsetp (not sameas(subset,subsetp)), x(subsetp,subset) )=g= mx(subset,‘7’);
model tsp2test / all /;
solve tsp2test minimizing z using mip;
display x.l, x.m, z.l;