#the higher the commission fees- the less the trading quantities that occur (makes sense if you think of cost function). #the higher the trade commission fees- the lower the trading price, but because of lower trade quantities (zero if possible) - less economic benefit for prosumers Commission_Fees = 0 #- for decentralized models (for economic comparison) #Commission_Fees = 0.5 #- for centralized models 50c/kwh or might use 1c/kwh as done in [12] - using 1c/kwh gets almost the same price as having 0 commission fees and trades are at a slightly lower quantity #using 50c/kwh commission fee results in vastly lower prices but basically 0 traded quantities penalty_factor = 0.01 preferences = Commission_Fees * np.ones(num_agents - 1) part = np.ones([num_agents, num_agents]) for i in range(num_agents): for j in range(num_agents): if (i == j): part[i][j] = 0 player = func.createPlayers(agents, part, preferences, penalty_factor, (num_agent - 1)) Trades = np.zeros([num_agents]) optimal = False while (optimal == 0): print('Performing Local Optimisation') temp = player[0].optimize(Trades) prices = player[0].y primal_res = player[0].Res_primal * 10000 primal_res = round(primal_res) dual_res = player[0].Res_dual * 10000 dual_res = round(dual_res) #print(primal_res) # #print(dual_res) sender = str(web3.eth.accounts[num_agent - 1]) #print(web3.eth.defaultAccount)
preferences = Commission_Fees* np.ones(len(agents)-1) Trades = np.zeros([num_agents, num_agents]) Prices = np.zeros([num_agents, num_agents]) #array of trade partners- set index to 1 if trade is happening e.g. part[0][1] = 1 if customer 0 is trading with customer 1 part = np.ones([num_agents, num_agents]) for i in range(num_agents): for j in range(num_agents): if (i == j): part[i][j] = 0 print('Part', part) #create players for this optimisation run - uses Prosumer class players = func.createPlayers(agents, part, preferences, penalty_factor) prim = float('inf') dual = float('inf') iteration = 0 SW = 0 simulation_time = 0 prim_previous = 0 lapsed = 0 start_time = time.time() ouch = 0 prim_list = [] window = 25 #local optimisation function while ((prim > residual_primal or dual>resiudal_dual) and iteration< max_Iter): iteration+=1 temp = np.copy(Trades)