Skip to content

Commit

Permalink
#19 fix AgentComponent example
Browse files Browse the repository at this point in the history
  • Loading branch information
wouter committed Jun 4, 2020
1 parent a17aab9 commit 51d77a3
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions examples/AgentComponent.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
from aiagents.multi.BasicComplexAgent import BasicComplexAgent
from aiagents.single.RandomAgent import RandomAgent
from gym.spaces import Discrete
from gym.spaces import Discrete, Dict
import logging

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)


def main():

N_agents=10
i=0
action_space=Discrete(3)
simpleComponentList=[]
N_agents = 10
i = 0
action_space = Dict({ n: Discrete(3) for n in range(N_agents) })
obs_space = None # not used anyway in this demo
simpleComponentList = []

while( i < N_agents ):
simpleComponentList.append(RandomAgent(i, action_space))
i+=1
while(i < N_agents):
simpleComponentList.append(RandomAgent(i, action_space, obs_space))
i += 1

myComplexComponent=BasicComplexAgent(simpleComponentList)
myComplexComponent = BasicComplexAgent(simpleComponentList, action_space, obs_space)

N_steps=3
i=0
state=0
N_steps = 3
i = 0
state = 0

while i<N_steps:
while i < N_steps:
myComplexComponent.step(state)
i+=1
i += 1
return 0


if __name__== "__main__":
if __name__ == "__main__":
main()

0 comments on commit 51d77a3

Please sign in to comment.