for (int i = 0; i < scheduleOrder.length; i++) {
while (traces.hasNext()) { Trace trace = (Trace)traces.next();
    private int[] getTileWorks(boolean bias) {        int[] tileCosts = new int[rawChip.getTotalTiles()];                for (int i = 0; i < scheduleOrder.length; i++) {                        //don't do anything for predefined filters...            if (scheduleOrder[i].getHead().getNextFilter().isPredefined())                 continue;            //find the bottleneck filter based on the filter work estimates            //and the tile avail for each filter            FilterTraceNode bottleNeck = null;            int maxAvail = -1;            int prevStart = 0;            int bottleNeckStart = 0;                        for (int f = 0; f < scheduleOrder[i].getFilterNodes().length; f++) {                FilterTraceNode current = scheduleOrder[i].getFilterNodes()[f];                RawTile tile = getTile(current);                int currentStart =  Math.max(tileCosts[tile.getTileNumber()],                         prevStart + partitioner.getFilterStartupCost(current));                int tileAvail = partitioner.getFilterWorkSteadyMult(current) +                   currentStart;                //System.out.println("Checking start of " + current + " on " + tile +                 //        "start: " + currentStart + ", tile avail: " + tileAvail);                if (tileAvail > maxAvail) {                    maxAvail = tileAvail;                    bottleNeck = current;                    bottleNeckStart = currentStart;                }                prevStart = currentStart;            }                            assert bottleNeck != null : "Could not find bottleneck for " + scheduleOrder[i] ;                            RawTile bottleNeckTile = getTile(bottleNeck);                                    if (bottleNeck.getPrevious().isInputTrace()) {                tileCosts[bottleNeckTile.getTileNumber()]+= DRAM_ISSUE_COST;            }            if (bottleNeck.getNext().isOutputTrace()) {                //account for the                //cost of sending an item over the gdn if it uses it...                if (LogicalDramTileMapping.mustUseGdn(bottleNeckTile)) {                    tileCosts[bottleNeckTile.getTileNumber()] += (bottleNeck.getFilter().getPushInt() *                             bottleNeck.getFilter().getSteadyMult() *                             GDN_PUSH_COST);                }            }                                               //calculate when the bottle neck tile will finish,             //and base everything off of that, traversing backward and             //foward in the trace            tileCosts[bottleNeckTile.getTileNumber()] =                 (bottleNeckStart +                partitioner.getFilterWorkSteadyMult(bottleNeck));                        //System.out.println("Setting bottleneck finish: " + bottleNeck + " " +             //        tileCosts[bottleNeckTile.getTileNumber()]);                        int nextFinish = tileCosts[bottleNeckTile.getTileNumber()];            int next1Iter = partitioner.getWorkEstOneFiring(bottleNeck);            TraceNode current = bottleNeck.getPrevious();            //traverse backwards and set the finish times of the traces...            while (current.isFilterTrace()) {                RawTile tile = getTile(current.getAsFilter());                tileCosts[tile.getTileNumber()] = (nextFinish - next1Iter);                //get ready for next iteration                //System.out.println("Setting " + tile + " " + current + " to " +                 //        tileCosts[tile.getTileNumber()]);                nextFinish = tileCosts[tile.getTileNumber()];                next1Iter = partitioner.getWorkEstOneFiring(current.getAsFilter());                current = current.getPrevious();            }                        //traverse forwards and set the finish times of the traces            current = bottleNeck.getNext();            int prevFinish = tileCosts[bottleNeckTile.getTileNumber()];                        while (current.isFilterTrace()) {                RawTile tile = getTile(current.getAsFilter());                tileCosts[tile.getTileNumber()] =                     (prevFinish + partitioner.getWorkEstOneFiring(current.getAsFilter()));                //System.out.println("Setting " + tile + " " + current + " to " +                 //        tileCosts[tile.getTileNumber()]);                prevFinish = tileCosts[tile.getTileNumber()];                current = current.getNext();            }        }                 if (bias)            return biasCosts(tileCosts);        else             return tileCosts;    }