prior first test
This commit is contained in:
21
main.py
21
main.py
@@ -144,27 +144,6 @@ class TensorboardCallback(BaseCallback):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def sample_random_action(agent, mask):
|
|
||||||
"""Sample random UNMASKED action(s) for agent."""
|
|
||||||
# Return a list of actions: 1 for each action subspace
|
|
||||||
if agent.multi_action_mode:
|
|
||||||
split_masks = np.split(mask, agent.action_spaces.cumsum()[:-1])
|
|
||||||
return [np.random.choice(np.arange(len(m_)), p=m_/m_.sum()) for m_ in split_masks]
|
|
||||||
|
|
||||||
# Return a single action
|
|
||||||
else:
|
|
||||||
return np.random.choice(np.arange(agent.action_spaces), p=mask/mask.sum())
|
|
||||||
|
|
||||||
def sample_random_actions(env, obs):
|
|
||||||
"""Samples random UNMASKED actions for each agent in obs."""
|
|
||||||
|
|
||||||
actions = {
|
|
||||||
a_idx: 0
|
|
||||||
for a_idx in range( len(obs))
|
|
||||||
}
|
|
||||||
|
|
||||||
return actions
|
|
||||||
|
|
||||||
def printMarket(market):
|
def printMarket(market):
|
||||||
for i in range(len(market)):
|
for i in range(len(market)):
|
||||||
step=market[i]
|
step=market[i]
|
||||||
|
|||||||
Reference in New Issue
Block a user