%arg -solver gurobi
#%arg -cd
#%arg -ignoreZeros
%opt cbc threads 2
#%display var x*
#%display con s*
%display solutionPool
%arg -dontRemoveTmpFiles
#%arg -solutionCsv

 parameters:
	seed:=srand(100);
	M:=10000;

	nrOfCities:=3;
	cities:=1..nrOfCities;

	{i in cities:
		  xp[i]:=rand(100);
		  yp[i]:=rand(100);
	}

	{i in cities, j in cities:
	    {i==j: 
		dist[i,j]:=M; |
	    default: 
		dist[i,j]:= sqrt( (xp[i]-xp[j])^2 + (yp[i]-yp[j])^2 );
		dist[j,i]:= dist[i,j]+rand(10)-rand(10);
	    }
	}

variables:
	x[cities,cities]: binary;
	u[cities]: real[0..];

objectives:
	distance: sum{i in cities, j in cities: dist[i,j]* x[i,j]} ->min;

constraints:
	sos_i {j in cities:  sum{i in cities: x[i,j]}=1; }
	sos_j {i in cities:  sum{j in cities: x[i,j]}=1; }

	noSubs {i:=2..nrOfCities, j:=2..nrOfCities, i<>j: u[i] - u[j] + 
			nrOfCities * x[i,j] <= nrOfCities-1; }
	 
 
