In a method and magnetic resonance apparatus for generation of a
measurement sequence that can be executed with the hardware of the
magnetic resonance apparatus, a measurement sequence is generated as a
series of time slices of different time slice types, with the control
signals for the magnetic resonance apparatus during each time slice being
determined using parameters describing these time slices. After division
of the measurement sequence into a number of time slices dependent on the
sequence type and on a k-space sampling type, descriptive variables are
associated with the time slices. Value ranges of the variables are
limited and/or the variables are set in relation to one another using
boundary conditions. A determination ensues of solution values of the
variables with which a predetermined target parameter of the measurement
sequence is optimized. A measurement sequence executable on the hardware
is attained by association of the solution values with the corresponding
parameters of the time slices.