Implementing Stable Semantics by Linear Programming