It would be more cost effective hiring a small car for a few days.
Train travel, and infrequent buses, would probably make hiring a small car a cheaper alternative, as the cost of trains here in the Uk is never cheap.
Having a car at your disposal, means you are then free to explore all areas of the Brecon Beacons, some areas are not well served by either train or bus.