The upper limit of the action space has the wrong unit. According to your code, the insulin unit input by the simulator is U/min, but in fact the upper limit unit of your pump parameters is U/hour.
def bolus(self, amount):
bol = bol * self.U2PMOL # convert from U/min to pmol/min
bol = np.round(bol / self._params['inc_bolus']) * self._params['inc_bolus']
bol = bol / self.U2PMOL # convert from pmol/min to U/min
bol = min(bol, self._params['max_bolus'])
bol = max(bol, self._params['min_bolus'])
return bol
The basal insulin injection rate is usually 1 U/hour, and the bolus is about 10 U/hour. Obviously pump parameters are U/hour, not U/min, which results in the upper limit of the action space being too large and the agent unable to converge.
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
Insulin unit error
The upper limit of the action space has the wrong unit. According to your code, the insulin unit input by the simulator is U/min, but in fact the upper limit unit of your pump parameters is U/hour.
The basal insulin injection rate is usually 1 U/hour, and the bolus is about 10 U/hour. Obviously pump parameters are U/hour, not U/min, which results in the upper limit of the action space being too large and the agent unable to converge. <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
Name | min_bolus | max_bolus | inc_bolus | min_basal | max_basal | inc_basal | sample_time -- | -- | -- | -- | -- | -- | -- | -- Cozmo | 0 | 75 | 0.05 | 0 | 35 | 0.05 | 1 Insulet | 0 | 30 | 0.05 | 0 | 30 | 0.05 | 1