Make quadratic optimization code less mutable.
Allow specifying type of monotonicity.