High - Temperature Demagnetization
When a magnet is at a high temperature that exceeds the Curie temperature (about 450°C for ferrite and between 350 - 370°C for neodymium - iron - boron magnets), it can be demagnetized. This is the method used by speaker factories to deal with waste magnets.
Decaying Alternating Magnetic Field (Repeated Reverse Magnetization with Diminishing Field Strength)
By applying a magnetization in the positive direction and then in the negative direction, and repeating this process with the magnetic field strength in each cycle becoming smaller and smaller until the magnet almost has no magnetism.
Operability Considerations
You need to come up with a method that can be actually implemented. Barium ferrite has a primary sintering temperature of 1000°C and a secondary sintering temperature of 1200 - 1400°C. If you want to demagnetizeit by heating to 900°C, the cost will be very high and the chance of damage will increase a lot. The equipment that can heat up to above 900°C is also expensive.
Neodymium - iron - boron magnetism is very sensitive to temperature. Because of its strong magnetism, both the magnetization and demagnetization magnetic fields need to be very strong. High - temperature demagnetization is more accurate for it.