Asset pricing and portfolio optimization under regime switching models