Skip to content

Instantly share code, notes, and snippets.

View msaroufim's full-sized avatar
🤖
Putting the finishing touches on my robot army

Mark Saroufim msaroufim

🤖
Putting the finishing touches on my robot army
View GitHub Profile
#[no_mangle]
pub unsafe extern fn mr_MatrixIsZero(
mut m : *const f64, n1 : i32, n2 : i32
) -> i32 {
let mut _currentBlock;
let mut i : i32;
let mut n : i32 = n1 * n2;
i = 0i32;
'loop1: loop {
if !(i < n) {
struct _mjModel
{
// ------------------------------- sizes
// sizes needed at mjModel construction
int nq; // number of generalized coordinates = dim(qpos)
int nv; // number of degrees of freedom = dim(qvel)
int nu; // number of actuators/controls = dim(ctrl)
int na; // number of activation states = dim(act)
int nbody; // number of bodies
@msaroufim
msaroufim / numeric.fs
Created October 15, 2019 02:26
numeric.fs
let gaussian
# examples/mountain_car.jl
# Import the RL algorithms
using Reinforce
# Import the Mountain car environment
using Reinforce.MountainCarEnv: MountainCar
# Import the Plots plotting library and use GR as the backend
# https://github.com/jheinen/GR.jl
# examples/mountain_car.jl
# Import the RL algorithms
using Reinforce
# Import the Mountain car environment
using Reinforce.MountainCarEnv: MountainCar
# Import the Plots plotting library and use GR as the backend
# https://github.com/jheinen/GR.jl
cd github.com
git clone https://github.com/JuliaML/Reinforce.jl
cd Reinforce.jl
# Full example here https://github.com/JuliaOpt/JuMP.jl/blob/master/examples/cannery.jl
@variable(cannery, ship[1:num_plants, 1:num_markets] >= 0)
# Ship no more than plant capacity
@constraint(cannery, capacity_con[i in 1:num_plants],
sum(ship[i,j] for j in 1:num_markets) <= capacity[i]
)
# Ship at least market demand
struct Point{T}
x::T
y::T
end
# https://github.com/JuliaML/Reinforce.jl/blob/master/examples/mountain_car.jl
using Reinforce
using Reinforce.MountainCarEnv: MountainCar
using Plots
gr()
# Deterministic policy that is solving the problem
mutable struct BasicCarPolicy <: Reinforce.AbstractPolicy end