Skip to main content

Simulator interface library for Bonsai AI platform v2

Project description

A python library for integrating data sources with Bonsai BRAIN.

Installation

To install the current release version:

$ pip install bonsai-ai

Usage

Clients will subclass bonsai.Simulator and implement the required methods.

Example:

#!/usr/bin/env python3

import sys
from bonsai_ai import Simulator, Brain, Config

class MySim(Simulator):
    def episode_start(self, parameters):
        initial = {"value": 1.0}
        return initial

    def simulate(self, action, objective):
        terminal = True
        state = {"value": 1.0}
        return (state, 1.0, terminal)

Then, the simulator is configured and assigned a BRAIN and run.

def example():
    config = Config(sys.argv)
    brain = Brain(config)
    sim = MySim(brain, 'example_simulator')
    while sim.run():
        continue

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

bonsai-ai-2.0.15.tar.gz (28.7 kB view hashes)

Uploaded Source

Built Distribution

bonsai_ai-2.0.15-py2.py3-none-any.whl (35.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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