Git Product home page Git Product logo

Comments (7)

blavad avatar blavad commented on September 15, 2024 1

Hi @indhra007 .
Indeed it is totally possible to train two independant agents with DQN algorithm. All you have to do is to :

  1. Instantiate your OpenAI Gym like environment and get observation and action space for both agents (if they have different observation and/or action space)
import marl
from marl.agent import DQNAgent

env = my_env()

# This part may depend of the implementation of the environment
obs_space1 = env.observation_space[0]
act_space1 = env.action_space[0]

obs_space2 = env.observation_space[1]
act_space2 = env.action_space[1]
  1. Instantiate two DQNAgent with the best training parameters for each. Easiest way to do (with neither custom parameters nor custom model) is as follow:
agent1 = DQNAgent("MlpNet", obs_space1, act_space1)
print("#> Agent 1 :\n", agent1, "\n")

agent2 = DQNAgent("MlpNet", obs_space2, act_space2)
print("#> Agent 2 :\n", agent2, "\n")
  1. Instantiate your multi-agent system for reinforcement learning. If the agents are independant learners, you don't need to use set_mas() function because it means that they don't need to know local information about other agents (i.e. policies of other agents):
mas = MARL(agents_list=[agent1, agent2])
  1. Train and test your system
# Train the agent for 100 000 timesteps
mas.learn(env, nb_timesteps=100000)

# Test the agent for 10 episodes
mas.test(env, nb_episodes=10)

I hope this will help you. I continue to implement some module for this API and I hope I will have time
to improve the documentation in order to provide more usefull examples.

from marl.

blavad avatar blavad commented on September 15, 2024 1

@indhra007 sorry for the late answer. In order to avoid problems of importing packages when using notebook, go to the marl directory before installing it.
If you are using a Notebook or Google Colab, the following lines should fix the problem:

!git clone https://github.com/blavad/marl.git
%cd marl
!pip install -e .

or

!git clone https://github.com/blavad/marl.git
!cd marl
!pip install -e .

If you are using command line, something as follow should work:

git clone https://github.com/blavad/marl.git
cd marl
pip install -e .

from marl.

indhra avatar indhra commented on September 15, 2024

its kind of competitive between agent A vs agent B of same environment

from marl.

indhra avatar indhra commented on September 15, 2024

@blavad thanks for quick reply

If possible can u share an environment which has multi agents-with some documentation

from marl.

indhra avatar indhra commented on September 15, 2024

@blavad Any multi agent environment other than soccer,
Because of no soccer documentation it is not possible to understand

from marl.

blavad avatar blavad commented on September 15, 2024

@indhra007 For the moment I cannot share another well documented environment. I am currently working with another environment (for the game Hanabi) but it is not online yet.
You can check to this section of the documentation (https://blavad.github.io/marl/html/quickstart/environment.html) for a brief review of how to build an adequate environment.

I will let you know as soon as I make a repo with some multi-agent environments.

from marl.

indhra avatar indhra commented on September 15, 2024

Ok
Does the soccer environment works?

from marl.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.