A Study Of Supply Function Equilibrium With Applications To Electricity Markets