Skip to content

Instantly share code, notes, and snippets.

View zsunberg's full-sized avatar

Zachary Sunberg zsunberg

View GitHub Profile
@zsunberg
zsunberg / simple_grid_world.jl
Last active August 30, 2018 22:19
A simpler verion of a grid world problem for POMDPs.jl
const Vec2 = SVector{2,Int}
const StateTypes = Union{Vec2, TerminalState}
@with_kw struct SimpleGridWorld <: MDP{StateTypes, Symbol}
size::Tuple{Int, Int} = (10,10)
rewards::Dict{Vec2, Float64} = Dict(Vec2(4,3)=>-10.0, Vec2(4,6)=>-5.0, Vec2(9,3)=>10.0, Vec2(8,8)=>3.0)
terminate_in::Set{Vec2} = Set((Vec2(4,3), Vec2(4,6), Vec2(9,3), Vec2(8,8)))
tprob::Float64 = 0.7
discount::Float64 = 0.95
end

AutoViz.jl

A package for rendering simple scenes primarily consisting of cars on roadways using Cairo.

Usage

The main function is

render(scene)
@zsunberg
zsunberg / create_points.py
Created November 28, 2017 18:38
PyJulia Example Use Case
import numpy as np
r = np.arange(1.0, 11.0, 0.1)
n = len(r)**3
pts = np.empty((n, 3))
i = 0
for x in r:
for y in r:
for z in r:
@zsunberg
zsunberg / pomdps_alloc_test.jl
Last active December 2, 2016 07:41
A script to test the effects of preallocating memory in POMDPs.jl
using POMDPs
import POMDPs: create_state, discount, reward
using POMDPToolbox
type ImageMDP <: MDP{Matrix{Int},Int}
size::Tuple{Int, Int}
end
create_state(mdp::ImageMDP) = Array(Int, mdp.size[1], mdp.size[2])
discount(::ImageMDP) = 0.9