A Ternary Lattice Boltzmann Model for Amphiphilic Fluids