Method for operating a technical system having a number of components, controllable by means of controlled variables, during a control period (T S) comprising a multiplicity of optimization periods (T opt), involving: a) ascertaining at least one optimized controlled variable for each of the optimization periods (T opt) for minimizing or maximizing a target function of the system such that at least one system variable (V(t)) satisfies a number of predetermined secondary conditions (V min, V max) referenced to the control period (T opt), wherein the ascertaining comprises: - specifying a rating function (X(ΔV)) for each of the secondary conditions (V min, V max) for rating a change (ΔV) in the system variable (V(t)) at the end of the optimization period (T opt) based on a present value (V 0) of the system variable (V(t)) at the beginning (t 0) of the optimization period (T opt), a gradient (V 1 (t)) of the system variable (V(t)) that is referenced to the secondary condition (V min, V max) and attainable as a maximum over the control period (T s) and a gradient (V 2 (t)) of the system variable (V(t)) that is referenced to the secondary condition (V min, V max) and attainable as a minimum over the control period (T s), and - applying an optimization algorithm for minimizing or maximizing the target function using the specified rating functions (X(ΔV)), wherein the at least one system variable V(t) is ascertained as a system response to the at least one optimized controlled variable of the controllable components, and b) adjusting the at least one ascertained optimized controlled variable for operation of the controllable components. a) ascertaining at least one optimized controlled variable for each of the optimization periods (T opt) for minimizing or maximizing a target function of the system such that at least one system variable (V(t)) satisfies a number of predetermined secondary conditions (V min, V max) referenced to the control period (T opt), wherein the ascertaining comprises: - specifying a rating function (X(ΔV)) for each of the secondary conditions (V min, V max) for rating a change (ΔV) in the system variable (V(t)) at the end of the optimization period (T opt) based on a present value (V 0) of the system variable (V(t)) at the beginning (t 0) of the optimization period (T opt), a gradient (V 1 (t)) of the system variable (V(t)) that is referenced to the secondary condition (V min, V max) and attainable as a maximum over the control period (T s) and a gradient (V 2 (t)) of the system variable (V(t)) that is referenced to the secondary condition (V min, V max) and attainable as a minimum over the control period (T s), and - applying an optimization algorithm for minimizing or maximizing the target function using the specified rating functions (X(ΔV)), wherein the at least one system variable V(t) is ascertained as a system response to the at least one optimized controlled variable of the controllable components, and - specifying a rating function (X(ΔV)) for each of the secondary conditions (V min, V max) for rating a change (ΔV) in the system variable (V(t)) at the end of the optimization period (T opt) based on a present value (V 0) of the system variable (V(t)) at the beginning (t 0) of the optimization period (T opt), a gradient (V 1 (t)) of the system variable (V(t)) that is referenced to the secondary condition (V min, V max) and attainable as a maximum over the control period (T s) and a gradient (V 2 (t)) of the system variable (V(t)) that is referenced to the secondary condition (V min, V max) and attainable as a minimum over the control period (T s), and - applying an optimization algorithm for minimizing or maximizing the target function using the specified rating functions (X(ΔV)), wherein the at least one system variable V(t) is ascertained as a system response to the at least one optimized controlled variable of the controllable components, and b) adjusting the at least one ascertained optimized controlled variable for operation of the controllable components.