Skip to content

Commit

Permalink
corrects a bug where vendors were giving away products for free
Browse files Browse the repository at this point in the history
  • Loading branch information
liamlaverty committed May 14, 2023
1 parent 01b4c0a commit 82c6d4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Macodiac.ML/multiagent_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self):
self.save_path = os.path.join(filePath,'saved_models', 'model')
self.save_path_intermittent = os.path.join(filePath,'saved_models', 'intermittent_saved_models')
self.numTrainingIterations = 1_000
self.numEpisodes = 15
self.numEpisodes = 150
self.envTimesteps = 15
self.numAgents = 10

Expand Down Expand Up @@ -87,7 +87,7 @@ def run_multiagent_project_with_rand_test(self, env:MultiAgentMacodiacEnvironmen
iterator+=1
print(f'iterator:{iterator}')
action_arr = env.action_space.sample()

print(f'action for agents:\t{action_arr}')

obs_arr, reward, isDone, info_arr = env.step(action_arr)
Expand Down
6 changes: 3 additions & 3 deletions Macodiac.ML/multiagentenvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, envTimesteps:int, numAgents: int):

self.action_space = spaces.MultiDiscrete(arr)

# the observation space is a nAgents by nActions array of float32 numbers between 0-100
# the observation space is a nAgents by nActions array of float32 numbers between -99-99
# also contains the static value for marginal cost and wholesale price
self.observation_space = spaces.Box(low=-100,high=100, shape=(numAgents, 4), dtype=np.float32)

Expand All @@ -80,7 +80,7 @@ def set_agent_action(self, action, agent, actionSpace):
agentBaseVendingPriceAdjust = self.env_wholesale_price * (agent.state / 100)
baseAgentVendingPrice = self.env_wholesale_price + agentBaseVendingPriceAdjust
#agentMarginalCostAddedVendingPrice = agentBaseVendingPriceAdjust + self.env_agent_marginal_cost
agent.vendingPrice = baseAgentVendingPrice
agent.vendingPrice = max(baseAgentVendingPrice, 1)
# print(f'agent vending price was {agent.vendingPrice}')

def step_agent(self, agent):
Expand Down Expand Up @@ -268,4 +268,4 @@ def get_consumer_quantity_demanded_at_price(self, price):


def get_agent_default_observation_array(self):
return [0.0, 0.0, 60.0, 5.0]
return [0.0, 0.0, self.env_wholesale_price, self.env_agent_marginal_cost]

0 comments on commit 82c6d4e

Please sign in to comment.