Discrete-Time Linear Quadratic Optimal Control with Fixed and Free Terminal State via Double Generating Functions