The invisible dog fence is actually a radio fence that activates a shock collar that the pet wears. I bet one could train a pig to an invisible fence, but I don't see the value in it. It's cheaper, simpler, and quicker to use an electric fence.
An electric fence is a wire that transmits a mild electric current. The charger is grounded so that anything touching the wire and the soil gets a shock (no shock collar needed). The amount of that shock depends upon the charger setting and the soil moisture. (Where the soil is dry, there is an alternative way of creating the necessary ground.) The set up I use just gives a mild, intermittent zap....enough to startle but not harm.
The pigs, like myself, don't like to be zapped. So we all tend to avoid touching the hot wire. As a result, an electric fence is a good deterrent to roaming pigs.....and careless humans. Since I installed the electric fence, the pigs have been staying in their pasture.
The charger is the heart of the system. There are all sorts of chargers (also called energizers) available. You just need to match it to the task at hand. In my case, I opted for a charger from Premier 1, a solar powered one that can use AC current to tup up the battery if needed.
There are several types of hotwires to choose from. I prefer the lightweight rope, but I couldn't get it when I needed it. So I bought a roll of galvanized electric fence wire. It's easy enough to work with, and will last quite a while.
The hotwire needs to be insulated from the soil. I use plastic posts to mount the hotwire on. But there are other methods to accomplish the same goal. The wire needs to be strung at the height the particular animal will touch it. For my pigs, that's 6"-12" above the ground.