The present invention concerns a method and a system for operating an
internal combustion engine capable of performing auto-ignition combustion
as well as spark-ignition combustion. In auto-ignition combustion mode,
inlet and outlet control devices are adjusted to retain a portion of
exhaust gas for subjecting the retained exhaust gas to compression. In one
preferred embodiment, a parameter indicative of engine-surrounding
environment is monitored. Closing timing of the outlet control device is
adjusted in response to the monitored parameter, thereby to vary an
exhaust gas retaining duration when there is a change in the monitored
parameter.