if (usedTiles.contains(getTile(src))) { System.out.println(getTile(src));
if (usedTiles.contains(srcTile)) {
    private double getStaticCost(StaticStreamGraph ssg, HashSet usedTiles)     {	//the tiles used by THIS SSG for routing	//this set is filled with tiles that are not assigned but 	//have been used to route items previously by this SSG	HashSet routers = new HashSet();	//allt tiles used for this SSG, add it to used tiles at the end, if legal	HashSet tiles = new HashSet();		Iterator nodes = ssg.getFlatNodes().iterator();	double cost = 0.0;	//calculate the communication cost for each node that is assign a tile in	//the ssg	while (nodes.hasNext()) {	    FlatNode src = (FlatNode)nodes.next();	    if (!(assigned.contains(src)))		continue;	    	    assert getTile(src) != null;	    //add the src tile to the list of tiles used by this SSG	    tiles.add(getTile(src));	    	    //make sure we have not previously tried to route through this tile	    //in a previous SSG	    if (usedTiles.contains(getTile(src))) {		System.out.println(getTile(src));		return -1.0;	    }	    	    //don't worry about nodes that aren't assigned tiles	    if (!assigned.contains(src))		continue;	    //get all the dests for this node that are assigned tiles	    Iterator dsts = getDownStream(src).iterator();	    while (dsts.hasNext()) {		FlatNode dst = (FlatNode)dsts.next();		assert assigned.contains(dst);		assert getTile(dst) != null;		//add the dst tile to the list of tiles used by this SSG		tiles.add(getTile(dst));				//make sure we have not previously (in another SSG) tried to route 		//thru the tile assigned to the dst		if (usedTiles.contains(getTile(dst))) {		    //System.out.println(getTile(dst));		    return -1.0;		}				RawTile[] route = 		    (RawTile[])router.getRoute(ssg, getTile(src), getTile(dst)).toArray(new RawTile[0]);				//find the cost of the route, penalize routes that go thru 		//tiles assigned to filters or joiners, reward routes that go thru 		//non-assigned tiles		double numAssigned = 0.0;				for (int i = 1; i < route.length - 1; i++) {		    //make sure that this route does not pass thru any tiles assigned to other SSGs		    //otherwise we have a illegal layout!!!!		    if (usedTiles.contains(route[i]))			return -1.0;		    //add this tile to the set of tiles used by this SSG		    tiles.add(route[i]);		    		    if (getNode(route[i]) != null) //assigned tile			numAssigned += 100.0;		    else {			//router tile, only penalize it if we have routed through it before			if (routers.contains(route[i]))			    numAssigned += 0.5;			else //now it is a router tile			    routers.add(route[i]);		    }		}				int hops = route.length - 2;		//the number of items sent over this channel for one execution of entire		//SSG, from src to dest		int items = 0;				//now calculate the number of items sent per firing of SSG				//if we are sending thru a splitter we have to be careful because not		//all the data that the src produces goes to the dest		if (src.edges[0].isSplitter()) {		    //if the dest is a filter, then just calculate the number of items		    //the dest filter receives		    if (dst.isFilter())			items = ssg.getMult(dst, false) * dst.getFilter().getPopInt();		    else {			//this is a joiner			assert dst.isJoiner();			//the percentage of items that go to this dest			double rate = 1.0;						//we are sending to a joiner thru a splitter, this will only happen			//for a feedback loop, the feedback path is always way 0 thru the joiner			if (dst.inputs > 1) 			    rate = ((double)dst.incomingWeights[0]) / 				((double) dst.getTotalIncomingWeights());			//now calculate the rate at which the splitter sends to the joiner			rate = rate * 			    (((double)src.edges[0].weights[0]) / ((double)src.edges[0].getTotalOutgoingWeights()));			//now calculate the number of items sent to this dest by this filter			items = (int) rate * ssg.getMult(dst, false) * src.getFilter().getPopInt();		    }		}		else {		    //sending without intermediate splitter		    //get the number of items sent		    int push = 0;		    if (src.isFilter())			push = src.getFilter().getPushInt();		    else //joiner			push = 1;		    items = ssg.getMult(src, false) * push;		}		//calculate communication cost of this node and add it to the cost sum		cost += ((items * hops) + (items * Util.getTypeSize(Util.getOutputType(src)) *					   numAssigned * 10));	    }   	}	SpaceDynamicBackend.addAll(usedTiles, tiles);	return cost;	    }