I’ve been thinking about a proper algorithm, too.
The thermal storage capacity of most houses is well large enough that there’ll be no noticeable drop in hours. Plus most HP owners have a water buffer.
What about to simply define a heating time in minutes and have the algorithm select the cheapest m minutes for preferred heating and most expensive n minutes to stop ?
Heat pumps run on their own schedule by default.
If you use SGready to tell your hp to prefer or stop heating, it does not mean it will start or stop heating right away, it will decide based on local parameters such as buffer temperature.
During the rest of the time it would be in normal mode and will only heat when there’s a need to (buffer drop below threshold). If you turn on the fireplace it won’t drop so won’t heat.
So no need to ‘sort’ heating slices, right?
Anyone could adapt n and m to his housing’s needs (or financials, those actually are).
Long-term apply some AI, eventually, based on outer temperature maybe, or observed efficiency.