What kind of magnet can vary its strength and polarity?

Electromagnet