Dual formulation of gauge theories and confinement