Skip to content

Instantly share code, notes, and snippets.

View beduffy's full-sized avatar

Ben Duffy beduffy

View GitHub Profile
@beduffy
beduffy / ai2thor_wrapper_basic_config.json
Last active April 28, 2019 13:56
An example of a config file in our AI2Thor wrapper. This can be configured to change environment settings and what "task variant" is currently the agent's goal e.g. pick up apples instead of mugs. More info at https://github.com/TheMTank/cups-rl
{
"render_options": {"depth": true},
"open_close_interaction": true,
"pickup_put_interaction": true,
"pickup_objects": [
"Apple"
],
"acceptable_receptacles": [
"CounterTop",
"TableTop",
@beduffy
beduffy / pick_up_task_example.py
Last active April 28, 2019 13:54
Example of how you can define a task within our AI2Thor wrapper at https://github.com/TheMTank/cups-rl
class PickUpTask(BaseTask):
"""
This task consists of picking up a target object. Rewards are only collected if the right
object was added to the inventory with the action PickUp (See gym_ai2thor.envs.ai2thor_env for
details). Because the agent can only carry 1 object at a time in its inventory, to receive
a lot of reward one must learn to put objects down. Optimal behaviour will lead to the agent
spamming PickupObject and PutObject near a receptacle
"""
def __init__(self, **kwargs):
super().__init__(kwargs)
@beduffy
beduffy / ai2thor_wrapper_simple interface.py
Last active April 30, 2019 20:49
Basic example and use case of a random agent for our AI2Thor wrapper which has an OpenAI Gym interface. More information at: https://github.com/TheMTank/cups-rl
from gym_ai2thor.envs.ai2thor_env import AI2ThorEnv
config_dict = {'open_close_interaction': False, # disable opening/closing objects
'task': {
'task_name': 'PickUpTask',
'target_objects': {'Mug': 1} # 1 reward for picking up cup
}
}
env = AI2ThorEnv(config_dict=config_dict)
for episode in range(20):
state = env.reset()
print("Hello, world!")
# Python comments begin with #
booleanVariable = True
characterVariable = 'a'
stringVariable = 'abc'
integerVariable = 5
floatVariable = 5.0
if integerVariable > 4:
console.log("Hello, world!");
booleanVariable = true;
characterVariable = 'a';
integerVariable a = 5;
floatVariable = 5.0;
using System;
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello, world!");
boolean = true;
char = 'a';
int a = 5;
package helloworldapp;
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!");
boolean = true;
char = 'a';
int a = 5;
float = 5;
@beduffy
beduffy / HowtoProgram.cpp
Last active October 27, 2016 22:43
Variables and assignment ex1
#include
int main()
{
std::cout << "Hello, world!";
bool = true;
char = 'a';
int a = 5;
float = 5;