Skip to content

Instantly share code, notes, and snippets.

View thowell's full-sized avatar

Taylor Howell thowell

View GitHub Profile
@thowell
thowell / licq.py
Last active March 7, 2024 14:15
linear indepedence constraint qualification
# Copyright [2024] Taylor Howell
# Linear independence constraint qualification (LICQ)
import numpy as np
# problem setup:
# minimize 0.5 x' P x + q' x
# subject to A x = b
# Lagrangian
@thowell
thowell / osqp.py
Created February 15, 2024 02:30
osqp admm algorithm written in python with numpy
# %%
# Copyright [2024] Taylor Howell
import numpy as np
# %%
# OSQP: https://web.stanford.edu/~boyd/papers/pdf/osqp.pdf
# problem setup:
# minimize 0.5 x' P x + q' x
# subject to l <= A x <= u
@thowell
thowell / ps.py
Last active January 11, 2024 04:47
predictive sampling written in python with numpy
# Copyright 2024 Taylor Howell
from __future__ import annotations
import numpy as np
# predictive sampling
# https://arxiv.org/abs/2212.00541
# policy class for predictive sampling
@thowell
thowell / contact.py
Last active January 8, 2024 01:10
contact dynamics model (impact + friction) for 2D particle on flat surface
# Copyright 2023 Taylor Howell
import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt
# %matplotlib inline
# system parameters
@thowell
thowell / random_search.cpp
Last active January 8, 2024 01:10
multi-threaded random search optimizer
// Copyright 2023 Taylor Howell
#include <iostream>
#include <random>
#include <thread>
#include <vector>
// derivative-free random search
template <typename T>
class RandomSearch {
@thowell
thowell / laplace.c
Last active January 8, 2024 01:11
Laplace solver
// Copyright [2023] Taylor Howell
// Laplace solver
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
// set boundary conditions for grid
void set_boundaries(double* grid, int width, int height, double top,
double bottom, double left, double right) {