add pattern_max back into solver