* src.getFilter().getPopInt();
* Util.getItemsProduced(src);
    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();        //reset the intermediate tiles list        intermediateTiles = 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 (!assignToAComputeNode(src))                continue;            ComputeNode srcNode = getComputeNode(src);            assert srcNode != null;            // add the src tile to the list of tiles used by this SSG            if (srcNode.isTile())                tiles.add(srcNode);            // make sure we have not previously tried to route through this tile            // in a previous SSG            if (srcNode.isTile() && usedTiles.contains(srcNode)) {                // System.out.println(srcNode);                // return -1.0;                cost += ILLEGAL_WEIGHT;            }            // get all the dests for this node that are assigned tiles            Iterator dsts = getDownStream(src).iterator();            while (dsts.hasNext()) {                FlatNode dst = (FlatNode) dsts.next();                if (!assignToAComputeNode(dst))                    continue;                ComputeNode dstNode = getComputeNode(dst);                assert dstNode != null;                // add the dst tile to the list of tiles used by this SSG                if (dstNode.isTile())                    tiles.add(dstNode);                // make sure we have not previously (in another SSG) tried to                // route                // thru the tile assigned to the dst                if (dstNode.isTile() && usedTiles.contains(dstNode)) {                    // System.out.println(dstNode);                    cost += ILLEGAL_WEIGHT;                    // return -1.0;                }                ComputeNode[] route = (ComputeNode[]) router.getRoute(ssg,                                                                      srcNode, dstNode).toArray(new ComputeNode[0]);                // check if we cannot find a route from src to dst that does not                // go                // thru another ssg                if (route.length == 0) {                    // System.out.println("Cannot find route from src to dst                    // within SSG " +                    // src + "(" + srcNode + ") -> " + dst + "(" + dstNode +                    // ")");                    cost += ILLEGAL_WEIGHT;                    // return -1.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++) {                    assert route[i].isTile();                    //add this intermediate hop tile to the list of intermediate tiles                    intermediateTiles.add(route[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])) {                        cost += ILLEGAL_WEIGHT;                        // return -1.0;                    }                    // add this tile to the set of tiles used by this SSG                    tiles.add(route[i]);                    /*                     * if (getNode((RawTile)route[i]) != null) //assigned tile                     * numAssigned += ASSIGNED_WEIGHT * (1.0 /                     * workEstimates.getEstimate(getNode((RawTile)route[i])));                     * else {                     */                    // router tile, only penalize it if we have routed through                    // it before                    if (routers.contains(route[i])                        || (getNode((RawTile) route[i]) != null))                        numAssigned += ROUTER_WEIGHT;                    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;                }                items *= Util.getTypeSize(Util.getOutputType(src));                // calculate communication cost of this node and add it to the                // cost sum                // what we really want to do here is add to the latency the work                // estimation sum of all the routes that this route crosses...                // um, yeah                cost += ((items * hops) + (/* items */numAssigned));            }        }        SpaceDynamicBackend.addAll(usedTiles, tiles);        return cost;    }