Skip to main content

The Seoul AI Gym: Seoul AI Gym is a toolkit for developing AI algorithms.

Project description

Seoul AI Gym

Seoul AI Gym is a toolkit for developing AI algorithms. This gym simulates environments and enables you to apply any teaching technique on agent.

Build Status

Seoul AI Gym was inspired by OpenAI gym and tries to follow its API very closely.

Contents

Basics

There are two terms that are important to understand: Environment and Agent.

An environment is a world (simulation) with which an agent can interact. An agent can observe a world and act based on its decision.

seoulai-gym provides environments. An example of creating environment:

import seoulai_gym as gym
env = gym.make("Checkers")

Every environment has three important methods: reset, step and render.

reset(self) -> observation

Reset an environment to default state and return observation of default state. observation data structure depends on environment and is described separately for each environment.

step(self, agent, action) -> observation, reward, done, info

Perform an action on behalf of agent in environment lastly observed by either reset or step. An action can differ among different environments but the return value of step method is always same. A reward is given to an agent when action that was done in the current step or some of the previous steps have led to a positive outcome for an agent (e.g winning a game). An info is a dictionary containing extra information about performed action.

render(self) -> None

Display state of game on a screen.

Installation

There are two ways to install seoulai-gym.

pip3

The recommended way for developers creating an agent is to install seoulai-gym using pip3.

pip3 install seoulai-gym

From source

You can also clone and install seoulai-gym from source. This option is for developers that want to create new environments or modify existing ones.

git clone https://github.com/seoulai/gym.git
cd gym
pip3 install -e .

Supported systems

seoulai-gym requires to have at least Python 3.6 and was tested on Arch Linux, macOS High Sierra and Windows 10.

Environments

Currently, environment simulating game of Checkers, [Mighty] (https://en.wikipedia.org/wiki/Mighty_(card_game)), and Market are provided.

  • Checkers

    import seoulai_gym as gym
    env = gym.make("Checkers")
    env.reset()
    env.render()
    
  • Mighty

    import seoulai_gym as gym
    from seoulai_gym.envs.mighty.agent.RandomAgent import RandomAgent
    
    env = gym.make("Mighty")
    players = [RandomAgent("Agent 1", 0),
                RandomAgent("Agent 2", 1),
                RandomAgent("Agent 3", 2),
                RandomAgent("Agent 4", 3),
                RandomAgent("Agent 5", 4)]
    obs = env.reset()
    obs["game"].players = [
      players[0]._name,
      players[1]._name,
      players[2]._name,
      players[3]._name,
      players[4]._name,
      ]
    env.render()
    
  • Market

    import seoulai_gym as gym
    from seoulai_gym.envs.traders.agents import RandomAgentBuffett
    
    # make enviroment
    env = gym.make("Market")
    
    # select exchange
    env.select("upbit")
    
    init_cash = 100000000  # KRW
    a1 = RandomAgentBuffett("Buffett", init_cash)
    current_agent = a1
    
    env.reset()
    env.render()
    

Examples

Testing

All test are written using pytest. You can run them via:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seoulai-gym-0.1.2.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

seoulai_gym-0.1.2-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

File details

Details for the file seoulai-gym-0.1.2.tar.gz.

File metadata

  • Download URL: seoulai-gym-0.1.2.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for seoulai-gym-0.1.2.tar.gz
Algorithm Hash digest
SHA256 dd3135bc12cda0a40eac69d9eab459fb2e9b6d60217f6230f7230e127f16c405
MD5 9d226d14c8e1c2e0012e71788a0bc35f
BLAKE2b-256 5bbf854799ed30b8a989ee7c3d53578d8fa1b413295425f67379bcff821a25ba

See more details on using hashes here.

File details

Details for the file seoulai_gym-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: seoulai_gym-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for seoulai_gym-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 23135845981244199b8239f74be898c697c3c2ee3ef83e2b2529d5e148d5869d
MD5 d721da4e251b8135aa661490d44e5c71
BLAKE2b-256 b1754af010c197c74435db5ec780cd081d9fae912c5402aff7f988a5134668db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page