got a more specific problem?

Generally they involve populating some kind of matrix and then calculating scores for various generated sequences of manipulations, then choosing the one with the best score.

Pretty fluffy, huh.

More info is required on your problem domain.