Nonserial Dynamic Programming: On the Optimal Strategy of Variable Elimination for the Rectangular Lattice