  Using results from quantum filtering theory and methods from classical
control theory, we derive an optimal control strategy for an open two-level
system (a qubit in interaction with the electromagnetic field) controlled by a
laser. The aim is to optimally choose the laser's amplitude and phase in order
to drive the system into a desired state. The Bellman equations are obtained
for the case of diffusive and counting measurements for vacuum field states. A
full exact solution of the optimal control problem is given for a system with
simpler, linear, dynamics. These linear dynamics can be obtained physically by
considering a two-level atom in a strongly driven, heavily damped, optical
cavity.
