Optimal control of systems described by delay differential equations