I have to disagree that the lying is inexplicable. Obama knows that he snubbed the troops because he couldn't get his photo-op. He wants to avoid admitting it.
That's a clear, simple explanation which is totally in keeping with his character (or perhaps I should say -- lack thereof).
He was going to get his photo-op. The stumbling point was the Pentagon not allowing the retired general to accompany him because he was part of the campaign. Obama had no Senate staffer on the trip so he would have had to face the troops alone.