Arming merchant ships won't work. It will only lead to escalation by the side that can afford to and have access to the heavier weapons. Pirates will end up with heavier and heavier weapons due to the fact they have access to the black market. Shipping companies cannot. As well, you give weapons to merchants that have no training.... a recipe for disaster. They have a right to defend themselves, but are not a flagged warship, and cannot engage any vessel directly. Therefore, anything larger than small arms is out. Meanwhile, as stated, the pirates have access to a larger choice of weaponry via the black market.
Putting Small groups of highly trained special weapons teams onboard ships transitting the area may have effect in the short term, but may be a fuzzy gray area in treatise law. It would give those pirates a bit of pause, if they think a ship has a tactical response team onboard.
A larger naval presence... would mitigate the pirates with brute force, but would also be costly for our Navy.
The only true solution is a Somalia with a stable power base that can effect policy and enforce law on it's own internal affairs. This is, unfortunately, the most improbable, as the country's current government has control on about 2 square miles of the capital... and that's about it.