At it’s heart, the finding the gear problem is pretty simple. You know the exact power developed and the fuel consumption per unit of power developed at any RPM. You can update those numbers in real time from ECU data.
You know the vehicle speed, the derivatives for that speed, and running averages of speed and their derivatives.
So, anyways, given this information, you could calculate the shift points at the points that save the most fuel. You prevent “hunting” by making the downshift threshold a little more complex than just a simple number, you also track derivatives (so if the optimal threshold is 1400 RPM to downshift but the RPM is only dropping by 1 rpm/second, you don’t downshift right on 1400 rpm)
Anyways, I don’t really understand why manual transmissions are still a major thing, especially on 18 wheeler trucks. In solving the gear problem, you can take into account hundreds of variables, ultimately (most would feed into the ECU and be available indirectly), and much more exact information that humans can perceive. You ultimately only have a handful of possible output states to consider, and most of the time there are only 2 variables to optimize for : maximum fuel efficiency with mechanical wear per hour below a calculated maximum. (since there’s no point in saving the user fuel if you burn up your transmission with constant gear shifts)