Years ago, my parents put in an invisible fence to keep our family dog from running away. The dog wore a shock collar for a while in order to get used to where the boundaries of the yard were located.