def Welfare(self, output_list): # Initiate an instance of Consumer C = Consumer(self.c, self.g, self.f, self.A, self.B, self.T) # Generate the utility list of the consumer instance utility_list = C.Utility(output_list) ''' An utilitarian welfare function ''' welfare = -1 * np.sum(utility_list) return welfare
def Welfare(self,output_list): # Initiate an instance of Consumer C = Consumer(self.c,self.g,self.f,self.A,self.B,self.T) # Generate the utility list of the consumer instance utility_list = C.Utility(output_list) # Generate the parameters for the welfare function # Obtain overall weight for the welfare function overall_weight = float(1) # Obtain individual utility weights for each consumer for the welfare function utility_weights = Loop(self.c) # Calculate the welfare # The welfare function is defined as the (sum of U^(2x)) ^ y, where x are individual weights and y is the overall weight utility_list_square = np.power(np.e,utility_list) welfare = (np.sum(np.power(utility_list_square , utility_weights))) # Obtain the negative of the welfare for minimization neg_welfare = welfare * -1 return neg_welfare