Skip to content

Instantly share code, notes, and snippets.

@mlubin
mlubin / 15083-install.md
Created February 5, 2016 02:12
JuMP install instructions for 15.083

Install Julia

You should use Julia 0.4.0 or later. If you have an older version of Julia installed, e.g., 0.3 or 0.4.0-rc1, please update to the latest version. Binaries of Julia for all platforms are available here.

  • Windows and Linux users should choose the 64-bit version, unless using a very old computer.

If updating from Julia 0.4.0-rc1, you should also update your packages by running:

pcost dcost gap pres dres
0: 3.8500e+03 3.9338e+03 2e+03 1e+00 1e+00
1: 2.0645e+03 2.1700e+03 2e+03 1e+00 1e+00
2: 4.0064e+02 5.8278e+02 2e+03 1e+00 1e+00
3: 2.5441e+02 6.9543e+02 2e+03 9e-01 9e-01
4: 4.3080e+02 1.2381e+03 1e+03 8e-01 8e-01
5: 6.7652e+02 2.0939e+03 1e+03 7e-01 7e-01
6: 8.9445e+02 2.8259e+03 1e+03 6e-01 6e-01
7: 1.2857e+03 4.1114e+03 1e+03 6e-01 6e-01
8: 1.6758e+03 5.4303e+03 1e+03 5e-01 5e-01
using JuMP, Mosek, FactCheck
sdp_solvers = [MosekSolver(LOG=0)]
include(Pkg.dir("JuMP","test","data","robust_uncertainty.jl"))
facts("[sdp] Robust uncertainty example") do
for solver in sdp_solvers
context("With solver $(typeof(solver))") do
R = 1
d = 3
using Mosek, MathProgBase
I = [1,1,2,2,3,3,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,32,33,33,34,34,35,36,37,38,39,40]
J = [14,10,15,11,16,12,13,18,1,21,2,24,3,19,2,22,4,25,5,20,3,23,5,26,6,17,13,17,13,14,15,16,17,18,19,20,21,22,23,24,25,26,7,10,8,11,9,12,1,2,3,4,5,6]
V = [1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,1.0,1.0,-1.0,1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0]
b = [-0.6088331477422722,-0.02852197818671054,-0.9016074145524158,0.4999165215049682,-0.025485683857737418,-0.07276320066249353,0.056565030662414396,-0.07276320066249353,-0.3319954143963322,0.3286736785015988,0.056565030662414396,0.3286736785015988,-0.43682537007384287,1.0516057442061533,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,18.999999999999996,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
var_cones = Any[(:SDP,1:6),(:NonNeg,[13,17
using Convex
using ECOS
using SCS
using ConicNonlinearBridge
using Ipopt
x1 = Variable(1)
x2 = Variable(1)
x3 = Variable(1)
x4 = Variable(1)
x5 = Variable(1)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mlubin
mlubin / newton.jl
Last active May 24, 2017 04:40
julia/C microbenchmark
function squareroot(x)
it = x
while abs(it*it - x) > 1e-13
it = it - (it*it-x)/(2it)
end
return it
end
function time_sqrt(x)
const num_iter = 100000
@mlubin
mlubin / main.jl
Last active August 29, 2015 14:01
import Optim
function clogit_ll{R}(coeff::Vector{R}, x1, x2, x3, x4, x5, x6,
y1, y2, y3, y4, y5, y6,
T, nObs, nVar)
llit = zero(R)
for i=1:nObs
for t=1:T
function genF(Q)
f(x) = (1/2)*dot(x,Q*x)
fgrad(x) = Q*x
return f, fgrad
end
function gradDescent(f, fgrad, startX)
const stepsize = 1.0
const sigma = 0.1