NOVELTY - The method involves calculating temperature and a rate of change in temperature of a heat exchanger i.e. hot side heat exchanger (106), of a waste heat recovery system (100). A temperature and a rate of change in temperature of a material flowing via a channel of the system are predicted. A valve position and timing for the channel configurable for achieving a rate of material flow to be determined to produce and maintain a defined threshold temperature of the exchanger are calculated. An exhaust bypass valve is actuated according to the calculated valve position and calculated timing.    USE - Method for implementing an optimized waste heat recovery system in an internal combustion engine in an automobile.    ADVANTAGE - The waste heat recovery system provides an exhaust gas bypass valve and coolant flow controls for achieving optimum temperatures in a waste heat recovery device. The waste heat recovery system provides temperature stability of hot and cold side heat exchangers of thermoelectric generators in order to maximize electrical power generation efficiency and lengthen the useful life of the thermoelectric modules. The waste heat recovery system uses logic to actuate the bypass valve in order to divert the exhaust gas when the gas is colder than the heat exchanger, and to actuate the coolant flow control to divert the coolant when the coolant is hotter than the cold side heat exchanger. The method enables monitoring the temperature difference between heat exchanger and the material flowing through the channel in the waste heat recovery system, so that the bypass valves and/or coolant controls can be actuated to prevent a reverse in the direction of the heat flow among the heat exchangers and the material. The method enables adjusting the valve positions in order to optimize the temperatures of the heat exchangers in a case when the exhaust gas becomes cooler than the hot side heat exchanger or the coolant becomes hotter than the cold side heat exchanger.    DETAILED DESCRIPTION - The material is an exhaust gas. INDEPENDENT CLAIMS are also included for the following:    (1) a system for implementing an optimized waste heat recovery system    (2) a computer program product for implementing an optimized waste heat recovery system.    DESCRIPTION OF DRAWING(S) - The drawing shows a perspective view of a waste heat recovery system.    Waste heat recovery system (100)    Cold side heat exchanger (104)    Hot side heat exchanger (106)    Thermoelectric modules (108)    Waste heat recovery device (120)