How does one determine the optimal CH4:O2 ratio in a methane-LOX rocket engine?

The SpaceX Raptor uses a 78:22 O2:CH4 ratio. It also has combustion chamber pressures higher than any other rocket engine ever built.

My questions are:

• What's the math / chemistry that determines what ratio optimizes Isp?
• How much does combustion chamber pressure matter in determining what the optimal O2:CH4 is?
• Can we raise Isp by running more CH4 rich in combustion chambers of higher pressure?
• Partial duplicate addressing the first question: Merlin engine stoichiometry Dec 31 '20 at 18:52
• Here's an explanation of the Isp equation. On the one hand, the chemical makeup terms $R_{gas}$ and $k$ are independent of the pressure and temperature terms, but on the other hand, the chemical makeup of the exhaust will change with different characteristics in the combustion chamber. I suspect that hotter & higher pressure chambers favor leaner mixes up to complete combustion (because the heat can dissociate the exhaust products), but engines are limited by cooling constraints. Dec 31 '20 at 23:53