private void constrainConnectedPartitions(LinearProgram lp) {   for (int i=0; i<numTiles; i++) { for (int j=0; j<nodes.size()-1; j++) {  double[] con = lp.getEmptyConstraint(); con[dNum(j,i)] = 1; con[pNum(j,i)] = -1; con[pNum(j+1,i)] = 1; lp.addConstraintGE(con, 0);  con = lp.getEmptyConstraint(); con[dNum(j,i)] = 1; con[pNum(j,i)] = 1; con[pNum(j+1,i)] = -1; lp.addConstraintGE(con, 0); } }
    private void constrainWMax(LinearProgram lp) {	for (int i=0; i<numTiles; i++) {	    double[] con = lp.getEmptyConstraint();	    con[wmaxNum()] = 1;	    for (int j=0; j<nodes.size(); j++) {		Object node = nodes.get(j);		if (node instanceof SIRFilter) {		    // for filter, add work estimate of filter		    con[pNum(j, i)] = -1 * work.getWork((SIRFilter)node);		} else if (node instanceof SIRJoiner) {		    // for joiners, add JOINER_WORK_ESTIMATE		    con[pNum(j, i)] = -1 * ILPPartitioner.JOINER_WORK_ESTIMATE;		} else {		    // otherwise we should have a dummy node		    Utils.assert(node instanceof DummyNode, "Didn't expect node " 				 + node + " of type " + node.getClass());		}	    }	    lp.addConstraintGE(con, 0);	}    }    private void constrainConnectedPartitions(LinearProgram lp) {	// introduce <d> variables and set them to be greater than	// diffs of adjacent indicator vars	for (int i=0; i<numTiles; i++) {	    for (int j=0; j<nodes.size()-1; j++) {		// d_j,i >= (P_j,i - P_j+1,i)		double[] con = lp.getEmptyConstraint();		con[dNum(j,i)] = 1;		con[pNum(j,i)] = -1;		con[pNum(j+1,i)] = 1;		lp.addConstraintGE(con, 0);		// d_j,i >= -1 * (P_L[j],i - P_L[j+1],i)		con = lp.getEmptyConstraint();		con[dNum(j,i)] = 1;		con[pNum(j,i)] = 1;		con[pNum(j+1,i)] = -1;		lp.addConstraintGE(con, 0);	    }	}