Add more assertations to Factor class.

SumOutFirstVariable and SumOutLastVariable will only are correctly defined if the variable is binary.