Automatic Frequency Control in a Semiconductor Laser and an Optical Amplifier