cols:=demand.keys.sort(); res :=vogel(costs,supply,demand); cost:=0; println("\t",cols.concat("\t")); foreach g in (costs.keys.sort()){ print(g,"\t"); foreach n in (cols){ y:=res[g].find(n); if(y){ y=y[0]; print(y); cost+=y*costs[g][n]; } print("\t"); } println(); } println("\nTotal Cost = ",cost);