This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SimpleTreeInterface | |
export ChildrenFirst, ParentsFirst | |
export NodeOnly, NodeDepth, NodeIndex | |
abstract type AbstractReturnMode end | |
abstract type AbstractTreeIterator{T,RetMode<:AbstractReturnMode} end | |
struct NodeOnly <: AbstractReturnMode end | |
struct NodeDepth <: AbstractReturnMode end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### 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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
NewerOlder