def initialize_banks_from_files(self, bankDirectory, state, time): from bank import Bank # this routine is called more than once, so we have to reset the list of banks each time self.banks = [] listing = os.listdir(bankDirectory) if (len(listing) != self.parameters.numBanks): logging.error(" ERROR: number of configuration files in %s (=%s) does not match numBanks (=%s)", bankDirectory, str(len(listing)), str(self.parameters.numBanks)) for infile in listing: bank = Bank() bank.get_parameters_from_file(bankDirectory + infile, self.get_state(0), self.parameters.numBanks, time) self.banks.append(bank) bank.__del__() # TODO not sure if this is really safe, but it is better than doing nothing about all those created instances...
def initialize_banks_from_files(self, bankDirectory, state, time): from bank import Bank # this routine is called more than once, so we have to reset the list of banks each time self.banks = [] listing = os.listdir(bankDirectory) if (len(listing) != self.parameters.numBanks): logging.error(" ERROR: number of configuration files in %s (=%s) does not match numBanks (=%s)", bankDirectory, str(len(listing)), str(self.parameters.numBanks)) for infile in listing: bank = Bank() bank.get_parameters_from_file(bankDirectory + infile, self.get_state(0), self.parameters.numBanks, time) bank.calculate_optimal_investment_volume() self.banks.append(bank) bank.__del__() # TODO not sure if this is really safe, but it is better than doing nothing about all those created instances...