Seoul AI Gym
Seoul AI Gym is a toolkit for developing AI algorithms.
gym simulates environments and enables you to apply any teaching technique on agent.
Seoul AI Gym was inspired by OpenAI gym and tries to follow its API very closely.
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(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
action on behalf of
agent in environment lastly observed by either
action can differ among different environments but the return value of
step method is always same.
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).
info is a dictionary containing extra information about performed
render(self) -> None
Display state of game on a screen.
There are two ways to install
The recommended way for developers creating an agent is to install
pip3 install seoulai-gym
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 .
seoulai-gym requires to have at least Python 3.6 and was tested on Arch Linux, macOS High Sierra and Windows 10.
import seoulai_gym as gym env = gym.make("Checkers") env.reset() env.render()
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._name, players._name, players._name, players._name, players._name, ] env.render()
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()
All test are written using pytest. You can run them via: