Method for operating an internal combustion engine having a supercharging system that has an exhaust-gas turbocharger and an electrically driven compressor, wherein an output of the exhaust-gas turbocharger can be adjusted by means of an actuating device (17, 19), the opening and closing times of input and output valves of a cylinder of the internal combustion engine exhibit a valve overlap (vo) and wherein the actuating device (17, 19) comprises a variable turbine geometry and/or a wastegate, wherein the method comprises the following steps: - determining a setpoint boost pressure (p 2,set) for achieving an increased engine setpoint torque; - operating the electrically driven compressor and the actuating device (17, 19) depending on each other in order to build up an actual boost pressure (P 2,act) in accordance with the setpoint boost pressure (P 2, set) and a positive scavenging gradient (p 23) to be achieved; characterized in that the method further comprises the following steps: - determining a capacity (K ES) of the power-supplying battery; - determining an optimized actuating variable (U ATL,opt) for the actuating device (17, 19) in a first operating state depending on at least the positive scavenging gradient (p 23) to be achieved and the capacity (K ES) of the power-supplying battery; and - determining an optimized actuating variable (U EV,opt) for the electrically driven compressor in the first operating state depending on at least the positive scavenging gradient (p 23) to be achieved and the determined capacity (K ES) of the power-supplying battery, wherein the optimized actuating variable (U ATL,opt) for the actuating device (17, 19) and the optimized actuating variable (U EV,opt) for the electrically driven compressor are determined based on common characteristic maps and/or characteristic curves (31, 33) in order to operate the electrically driven compressor and the actuating device (17, 19) depending on each other. - determining a setpoint boost pressure (p 2,set) for achieving an increased engine setpoint torque; - operating the electrically driven compressor and the actuating device (17, 19) depending on each other in order to build up an actual boost pressure (P 2,act) in accordance with the setpoint boost pressure (P 2, set) and a positive scavenging gradient (p 23) to be achieved; characterized in that the method further comprises the following steps: - determining a capacity (K ES) of the power-supplying battery; - determining an optimized actuating variable (U ATL,opt) for the actuating device (17, 19) in a first operating state depending on at least the positive scavenging gradient (p 23) to be achieved and the capacity (K ES) of the power-supplying battery; and - determining an optimized actuating variable (U EV,opt) for the electrically driven compressor in the first operating state depending on at least the positive scavenging gradient (p 23) to be achieved and the determined capacity (K ES) of the power-supplying battery, wherein the optimized actuating variable (U ATL,opt) for the actuating device (17, 19) and the optimized actuating variable (U EV,opt) for the electrically driven compressor are determined based on common characteristic maps and/or characteristic curves (31, 33) in order to operate the electrically driven compressor and the actuating device (17, 19) depending on each other. - determining a capacity (K ES) of the power-supplying battery; - determining an optimized actuating variable (U ATL,opt) for the actuating device (17, 19) in a first operating state depending on at least the positive scavenging gradient (p 23) to be achieved and the capacity (K ES) of the power-supplying battery; and - determining an optimized actuating variable (U EV,opt) for the electrically driven compressor in the first operating state depending on at least the positive scavenging gradient (p 23) to be achieved and the determined capacity (K ES) of the power-supplying battery,