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
# Note that this script can accept some limited command-line arguments, run | |
# `julia build_tarballs.jl --help` to see a usage message. | |
using Pkg | |
Pkg.add("BinaryBuilder") | |
using BinaryBuilder | |
name = "SCIP" | |
version = v"800.0.400" | |
# Collection of sources required to complete build |
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
{ | |
"name": "MathOptFormat Model", | |
"version": { | |
"major": 0, | |
"minor": 5 | |
}, | |
"variables": [ | |
{ | |
"name": "A_1[1,1]" | |
}, |
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
""" | |
Takes the model loaded from the MPS file and the line of the `.aux` file. | |
""" | |
function build_from_mibp(m::JuMP.Model, aux_file::Vector{String}; complete=false) | |
l1 = split(aux_file[1]) | |
@assert length(l1) == 2 | |
nl = parse(Int, l1[2]) | |
nu = num_variables(m) - nl | |
l2 = split(aux_file[2]) | |
@assert length(l2) == 2 |
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 Javis | |
nframes = 200 | |
function ground(args...) | |
background("white") # canvas background | |
sethue("black") # pen color | |
end | |
function object(p=O, color="black", radius=12) |
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
# This script assumes the Julia session is running at the root of the General repository | |
# https://github.com/JuliaRegistries/General | |
# Need these 3 installed | |
using LightGraphs, MetaGraphs, GraphPlot | |
import Pkg | |
function find_direct_deps(pkg_paths, source) | |
direct_deps = filter(pkg_paths) do pkg_path | |
deps_file = joinpath(pkg_path.path, "Deps.toml") |
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
[user] | |
name = Mathieu Besançon | |
[core] | |
autocrlf = true | |
[pager] | |
branch = false |
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
function expand_matrix(ms) | |
T = eltype(eltype(ms)) | |
m2 = Matrix{T}(undef, 0, length(first(ms))) | |
for i in eachindex(ms) | |
m2 = [m2; ms[i]'] | |
end | |
return m2 | |
end | |
function prealloc_matrix(ms) |
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
julia> function setindex(x::Tuple, v, i::Integer) | |
Base.@_inline_meta | |
@boundscheck 1 <= i <= length(x) || throw(BoundsError(x, i)) | |
Base._setindex(v, i, x...) | |
end | |
julia> using BenchmarkTools | |
julia> const t1 = (42, "", π) | |
(42, "", π = 3.1415926535897...) |
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
function sort_by_degree(g::LightGraphs.AbstractGraph) | |
vs = vertices(g) | |
degrees = (degree(g, v) for v in vs) | |
vertex_pairs = collect(zip(vs, degrees)) | |
sort!(vertex_pairs, by = p -> p[2], rev = true) | |
end | |
julia> sort_by_degree(path_graph(5)) | |
5-element Array{Tuple{Int64,Int64},1}: | |
(2, 2) |
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
# julia v1.1.1 | |
import Random | |
using Distributions # v0.21.0 | |
import RandomNumbers # v1.3.0 | |
using BenchmarkTools # v0.4.2 | |
function f(µ::T, rng::Random.AbstractRNG) where {T<:Real} | |
n = 0 | |
Σx = zero(T) | |
X = Normal(µ, one(T)) |
NewerOlder