Packages

Gyx allows designing and training Reinforcement Learning tasks. It includes environment abstractions that allows interaction with Python based environments like OpenAI Gym.

Current section

Files

Jump to
gyx lib mix tasks trainer_sarsa.ex
Raw

lib/mix/tasks/trainer_sarsa.ex

defmodule Mix.Tasks.Gyx.Train do
use Mix.Task
@env_module Gyx.Environments.Gym
@q_storage_module Gyx.Qstorage.QGenServer
@agents_module "Elixir.Gyx.Agents."
@shortdoc "Runs a training process"
def run([agent, env_name]) do
agent_name = String.to_atom(@agents_module <> agent)
{:ok, environment} = @env_module.start_link([], [])
{:ok, qgenserver} = @q_storage_module.start_link([], [])
{:ok, agent} = agent_name.start_link(qgenserver, [])
Gyx.Environments.Gym.make(environment, env_name)
end
end