Currently, the maximum_net_benefit method selects the technologies with the maximum net benefit in each cell. If the best technology can't supply all of the population in the cell (this can be the case for Electricity and Biogas) it duplicates the cell and selects the second-best technology for the rest of the population, adjusting the households and population numbers of the cell.
When adding the MiniGrids technology, there can be a case (technically at least) where we would have some population being supplied by Electricity, some more by MiniGrids and the rest with Biogas. Thus, we need to check if after the second technology there is still population without access and look for a third technology. I suggest, however, that we refactor the method to make it general for any number of possible technologies, so we avoid having this issue again in the future.
This can be done by implementing a while loop that checks the sum of households supplied against the total households in each cell, and tracks that until all household get supplied.
Currently, the
maximum_net_benefit
method selects the technologies with the maximum net benefit in each cell. If the best technology can't supply all of the population in the cell (this can be the case forElectricity
andBiogas
) it duplicates the cell and selects the second-best technology for the rest of the population, adjusting the households and population numbers of the cell.When adding the
MiniGrids
technology, there can be a case (technically at least) where we would have some population being supplied byElectricity
, some more byMiniGrids
and the rest withBiogas
. Thus, we need to check if after the second technology there is still population without access and look for a third technology. I suggest, however, that we refactor the method to make it general for any number of possible technologies, so we avoid having this issue again in the future.