[docs]classEquityPerAgent(Reward):""" Reward based on the equity of comforts measure. It's a measure of statical dispersion of the Comfort metrics of all agents. Instead of comparing the *actual* and *hypothetical* environments (as in :py:class:`smartgrid.rewards.numeric.differentiated.equity.Equity`), it simply computes the equity (Hoover index) of all agents' comfort. """name:str
[docs]defcalculate(self,world,agent):# Comforts of all agentscomforts=[a.state.comfortforainworld.agents]# Compute the equity in the actual environment (others + agent)# we use 1-x since hoover returns 0=equity and 1=inequityactual_equity=1.0-hoover(comforts)returnactual_equity