Skip to content

Instantly share code, notes, and snippets.

Avatar

Mattias Fält mfalt

  • Lund, Sweden
View GitHub Profile
View quadratic.jl
# To add packages in the REPL: "]add BenchmarkTools"
using LinearAlgebra, BenchmarkTools
# Simple method and syntax, no types!
function quadratic(x,Q,y)
dot(x,Q*y)
end
Q = randn(5,5)
x = randn(5)
y = randn(5)
View dynamics.jl
using Ipopt # Solver
using NLOptControl # Problem definition and discretization
using Plots # Custom plots
# =========== PROBLEM DEFINITION ==============================
# Constraints on states
XL = [-Inf,-Inf,-Inf,-Inf]
XU = [Inf,Inf,Inf,Inf]
# Constraints on control, we will add ux^2+uy^2 <= 1, so these won't be active
@mfalt
mfalt / PlotTestCommenter
Created Mar 26, 2020
PlotTestCommenter
View PlotTestCommenter
#### Test Plots
using ControlExamplePlots
using Plots
gr()
default(show=false)
funcs, refs, eps = getexamples()
# Make it easier to pass tests on different systems
# Set to a factor 2 of common errors
eps = [0.15, 0.015, 0.1, 0.01, 0.01, 0.02, 0.01, 0.15, 0.15, 0.01, 0.01]
@mfalt
mfalt / benchmark.jl
Created Mar 27, 2019
benchmark in proximal operators, osqp vs qpdas
View benchmark.jl
using ProximalOperators, Random
# Number of variables
n = 1000
# Number of halfspaces
mi = 50 # Inequalities with C
me = 50 # Equalities with A
Random.seed!(1)
# One point in polytope
x0 = randn(n)