Constraints on supersymmetric models from the muon anomalous magnetic moment