[MCCS-2064] Add a basic SelectionPolicy to CalibrationStore
Until the postgresql database deployed has sufficient resolution of solutions it will be difficult to apply any solution since this has to match the outside_temperature to 2dp and frequency to the integer. This MR adds a configurable SelectionPolicy defining what solution will be chosen from the database. By default during deployment the policy will be printed to the user.
The Policy:
A solution is selected from a set of tolerances.
The solution with the smallest absolute summed variance
to requested outside_temperature and frequency is chosen.
If more than one solutions tie we yield the most recent.
The current tolerance set are:
- Absolute temperature tolerance : 0.0 (Degree Celcius)
- Absolute frequency tolerance : 0 (channel)
The user can also probe the policy using the calibrationStore.selectionPolicy
property.
To set a new policy a user can use the method
calibrationStore.UpdateSelectionPolicy(json.dumps({"temperature_tolerance": 0.5, "frequency_tolerance": 0}))
Edited by Alistair Child