If the fencing of track is not feasible then railway had to dig a canal of width 2 meter on both side to prevent reaching cattle on the track with the help of JCB or Hydraulic tractor. it is a very cheap option for the railway as well as local people. This can save them a lot.