Synthesis of Optimal Control Systems: a Comparison between Model Checking and Dynamic Programming Techniques