A computational method is presented to determine the tokamak actuator time evolution (trajectories) required to optimally reach a given point in the tokamak operating space while satisfying a set of constraints. Usually, trajectories of plasma auxiliary heating, current drive and plasma current required during the transient phases of a tokamak shot to reach a desired shape of the plasma temperature and safety factor (q) profiles are determined by trial-and-error by physics operators. In this paper, these trajectories are calculated by solving a non-linear, constrained, finite-time optimal control problem. The optimization problem contains a physics model of the non-linear plasma profile dynamics, a cost function to be minimized, and a set of constraints on the actuators and plasma quantities. The method is tested by optimizing the trajectories of Ip, heating and current drive power to obtain a typical hybrid plasma q profile at the end of the current ramp-up phase, while minimizing both the Ohmic flux swing and the distance from a stationary condition, and requiring q > 1 and edge Vloop > 0 at all times. The optimized trajectories feature an Ip overshoot similar to that used in existing experiments, and are shown to perform significantly better than a set of non-optimized trajectories, allowing stationary profiles to be obtained at the beginning of the flat-top phase. Additional information is obtained, including the parameter sensitivity of the optimal solution, a linear model describing the linearized dynamics of the profiles around the optimal trajectory, as well as a classification of the actuator trajectories based on the critical constraint which limits their value at a given time. This provides a solid basis for subsequent closed-loop feedback controller design. The tools presented in this paper could be useful to improve existing tokamak operational scenarios, to prepare operation of future machines and optimize their design.