MAP estimation via agreement on (hyper)trees: Message-passing and linear programming