Invariants of SDP exactness in quadratic programming