Skip to content

Latest commit

 

History

History
91 lines (63 loc) · 4.42 KB

File metadata and controls

91 lines (63 loc) · 4.42 KB

Crux.jl

Documentation Build Status Code Coverage status

Deep RL library with concise implementations of popular algorithms. Implemented using Flux.jl and fits into the POMDPs.jl interface.

Supports CPU and GPU computation and implements deep reinforcement learning, imitation learning, batch RL, adversarial RL, and continual learning algorithms. See the documentation for more details.

Reinforcement Learning

Imitation Learning

Batch RL

Adversarial RL

Continual Learning

Installation

To install the package, run:

] add Crux

Usage

Basic Example (Pure Julia)

A minimal example using DQN to solve a GridWorld problem:

using Crux

mdp = SimpleGridWorld()
S = state_space(mdp)

A() = DiscreteNetwork(Chain(Dense(2, 8, relu), Dense(8, 4)), actions(mdp))

solver = DQN=A(), S=S, N=100_000)
policy = solve(solver, mdp)

See the documentation for more examples and details.

Gym Environments

For OpenAI Gym environments like CartPole, install POMDPGym.jl:

] add https://github.com/ancorso/POMDPGym.jl

Note: POMDPGym requires Python with Gymnasium installed (pip install gymnasium).

using Crux, POMDPGym

mdp = GymPOMDP(:CartPole)
as = actions(mdp)
S = state_space(mdp)

A() = DiscreteNetwork(Chain(Dense(dim(S)..., 64, relu), Dense(64, length(as))), as)

solver = REINFORCE(S=S, π=A())
policy = solve(solver, mdp)

See the installation documentation for more details on how to install POMDPGym for more environment.