MatterMiners/lapis

Inverted definition of allocation and utilization

Opened this issue · 2 comments

I am currently under the impression that the definition of allocation and utilization might be inverted in

lapis/lapis/drone.py

Lines 88 to 96 in 989b805

def _init_allocation_and_utilisation(self):
levels = self.resources.levels
resources = []
for resource_key in self._valid_resource_keys:
resources.append(
getattr(levels, resource_key) / self.pool_resources[resource_key]
)
self._allocation = max(resources)
self._utilisation = min(resources)

As levels is aequivalent to the amount of unallocated resources on the machine, the allocation and utilization should be given by
self._allocation = min(resources) and self._utilisation = max(resources) respectively or am I mistaken?

The definition in the code seam correct according to the definition in the docu:
https://cobald.readthedocs.io/en/latest/source/model/pool_model.html#allocation-versus-utilisation

From what I see and understood from having had a quick look at it on Monday, the problem is not simply a mixup of min vs max. Rather the problem, as mentioned be Tabea, is that the levels give the amount of unused resources.
As a result, allocation and utilisation are wrong here and should rather be self._allocation = 1 - min(resources) and self._utilisation = 1 - max(resources) or, to have the representation more consistent with the documentation, the calculation for the resources can be changed respectively.
@maxfischer2781 @eileen-kuehn, any input?