Optimal transition control between combustion modes in a Diesel-ignited gas engine