add max marginalization method for factor