cpp file w/ equilibrium algo