def __init__(self, current_battery_percentage=100.0, battery_capacity=5.0, charging_rate=1.0): #super(Battery, self).__init__() self.current_battery_percentage = current_battery_percentage self.battery_capacity = battery_capacity self.charging_rate = charging_rate self.mean_battery = 50 self.variance_battery = 0 # self.min_mean_battery = 999999.9 # self.max_mean_battery = -999999.9 # self.min_variance_battery = 999999.9 # self.max_variance_battery = -999999.9 self.mean_battery_bounds = Bounds() self.variance_battery_bounds = Bounds(reset_count=300)
def __init__(self, centroids): self.centroids = centroids Centroid.centroids = centroids Bounds(centroids) Border.reset() # starting over each frame Centroid.reset() # starting over each frame l = len(Centroid.centroids) for n1 in range(1, len(Centroid.centroids)): print '%i/%i' % (n1, l) c1 = Centroid.centroids[n1] # dist-sort, & break when c1 in enclosed others = DistSort(c1, [Centroid.centroids[n2] for n2 in range(n1)]) B = [] for c2 in others: b = Border(c1, c2) for bb in B: if bb.nIntersects < 2: i = b.validate_BorderBorderIntersectPoint(bb) if i and b.nIntersects == 2: break B.append(b) if {bb.nIntersects for bb in B} == {2}: break for c in Centroid.centroids: if not c.isClosed: c.addCornerVert()
def __init__(self, loads = None): if loads is None: loads = [] self.loads = loads self.num_loads = 0 self.current_demand = 0.0 self.demands = [] # self.min_demand = 999999.0 # self.max_demand = 0.0 self.demand_bounds = Bounds()
def __init__(self, sourceID = None, capacity = 10000.0, current_price = 0.0, with_agent = False, look_ahead = 1): super().__init__() if sourceID is None: sourceID = Source.num_sources self.sourceID = sourceID self.supply_capacity = capacity # MW self.current_price = current_price self.prices = [] self.with_agent = with_agent self.look_ahead = look_ahead self.price_bounds = Bounds() # self.min_price = 100000.0 # self.future_max = 0.0 # self.future_min = 999999.9 # self.update_count = 0 # self.max_price = 0.0 self.dumb_load_range = DemandRange(0.0,0.0) Source.num_sources +=1
def __init__(self, demand_ranges = None, batteryParams = None, loadID = None, with_agent=False, look_ahead = 1): if loadID is None: loadID = Load.num_loads Load.num_loads += 1 if demand_ranges is None: #Because http://docs.python-guide.org/en/latest/writing/gotchas/ if self.RANDOMIZE_DEMANDS: demand_ranges = [[DemandRange.default_lower_bound,DemandRange.default_upper_bound]] * 288 else: demand_ranges = [] with open(self.csv_input_file, 'r') as csv_file: reader = csv.reader(csv_file) for line in reader: try: _demands = None # ignore initial lines of csv file if line[0].startswith("#") or len(line)<2: next(reader) continue except IndexError: _demands = [[float(val) for val in value] for value in reader] # [0] is lower bounds, [1] is upper bounds print(len(_demands), len(_demands[0]), len(_demands[1])) if _demands is None or len(_demands) != 2 or len(_demands[0]) != 288 or len(_demands[1]) != 288: raise AssertionError("Expected timestep size of 5 mins. Data doesn't match.") for i in range(len(_demands[0])): demand_ranges.append([_demands[0][i], _demands[1][i]]) if batteryParams is None: batteryParams = {} self.demand_ranges = [] for demand_range in demand_ranges: self.demand_ranges.append(DemandRange(float(demand_range[0]), float(demand_range[1]))) self.battery = Battery(**batteryParams) self.demands = list() self.loadID = loadID self.with_agent = with_agent self.costs = list() self.look_ahead = look_ahead self.demand_bounds = Bounds()
def addDigit(self, unit, lowerBound, upperBound): # assert type(unit) is FloatType, "unit is not a float" + str(unit) self.digits[unit] = Bounds(lowerBound, upperBound)