(based on work by @tkoolen)
This macro has been improved and moved into a new package: https://github.com/rdeits/AxisArrayVariables.jl
We can define a macro to build up AxisArrays of JuMP variables:
import re | |
import subprocess | |
from .base_linter import BaseLinter | |
CONFIG = { | |
'language': 'MATLAB', | |
'lint_args': '{filename}' | |
} |
diff --git a/make.project b/make.project | |
index 481c090..2dd1ce3 100644 | |
--- a/make.project | |
+++ b/make.project | |
@@ -27,7 +27,7 @@ PYVERSION := $(shell python -V 2>&1 | \ | |
ifeq ($(OSTYPE),darwin) | |
BUNDLE = -bundle -undefined suppress | |
-CFLAGS += -flat_namespace | |
+CFLAGS += -flat_namespace -lstdc++ |
# Pkg.add("ForwardDiff") # Just do this once to install the package | |
using ForwardDiff | |
J(T) = ([1. 2.] * inv([T[1] T[2]^2; T[3]^2 T[4]^3]) * [1; 2])[1] | |
g = ForwardDiff.gradient(J) | |
J([1., 2., 3., 4.]) | |
g([1.,2.,3.,4.]) | |
import forcespro as fp | |
import numpy as np | |
NUM_FRICTION_CONE_BASIS_VECTORS = 4 | |
stages = fp.MultistageProblem(1) | |
stages.dims[0]['n'] = NUM_FRICTION_CONE_BASIS_VECTORS # dimension of decision variables | |
stages.dims[0]['r'] = 0 # number of eq constraints | |
stages.dims[0]['l'] = NUM_FRICTION_CONE_BASIS_VECTORS # number of lower bounds | |
stages.dims[0]['u'] = 0 # number of upper bounds |
(based on work by @tkoolen)
This macro has been improved and moved into a new package: https://github.com/rdeits/AxisArrayVariables.jl
We can define a macro to build up AxisArrays of JuMP variables:
""" | |
@wrappedallocs(expr) | |
Given an expression, this macro wraps that expression inside a new function | |
which will evaluate that expression and measure the amount of memory allocated | |
by the expression. Wrapping the expression in a new function allows for more | |
accurate memory allocation detection when using global variables (e.g. when | |
at the REPL). | |
For example, `@wrappedallocs(x + y)` produces: |
using JuMP | |
using SCS | |
using Gurobi | |
# Objective is min. 1/2 x'Qx + q'x | |
Q = [1 0.1; 0.1 1] | |
q = [-3., 4] | |
## Solve with SCS | |
m = Model(solver=SCSSolver()) |
(for the Julia version of this code, check out the demo.ipynb notebook in https://github.com/rdeits/DrakeVisualizer.jl)
Pre-built binary versions of Director are available from http://people.csail.mit.edu/patmarion/software/director/releases/. All of the features described here are known to work with version 0.1.0-35-g26aa674
but newer versions should work too. Just download the appropriate file for your operating system and extract the files.
WARNING: An error occurred during inference. Type inference is now partially disabled. | |
Base.MethodError(f=typeof(Core.Inference.convert)(), args=(Base.AssertionError, "invalid age range update"), world=0x0000000000000ac2) | |
rec_backtrace at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/stackwalk.c:84 | |
record_backtrace at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/task.c:245 [inlined] | |
jl_throw at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/task.c:564 | |
jl_method_error_bare at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:1478 | |
jl_method_error at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:1496 | |
jl_lookup_generic_ at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:1910 | |
jl_apply_generic at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:1930 | |
Type at ./coreimg.jl:14 |