Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hook up to MOI (WIP) #56

Merged
merged 13 commits into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[MathOptInterface]]
deps = ["Compat", "Unicode"]
git-tree-sha1 = "ba12e7ce825c1458c03f88aae84fa630d882d303"
repo-rev = "master"
repo-url = "https://github.com/JuliaOpt/MathOptInterface.jl.git"
uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
version = "0.6.1"
version = "0.6.1+"

[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
Expand Down
3 changes: 2 additions & 1 deletion examples/lp/lp.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#=
Copyright 2018, David Papp, Sercan Yildiz, and contributors
Copyright 2018, Chris Coey and contributors
Copyright 2018, David Papp, Sercan Yildiz

modified from https://github.com/dpapp-github/alfonso/blob/master/random_lp.m
solves a simple LP min c'x s.t. Ax = b, x >= 0
Expand Down
3 changes: 2 additions & 1 deletion examples/namedpoly/namedpoly.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#=
Copyright 2018, David Papp, Sercan Yildiz, and contributors
Copyright 2018, Chris Coey and contributors
Copyright 2018, David Papp, Sercan Yildiz

modified from https://github.com/dpapp-github/alfonso/blob/master/polyOpt.m
formulates and solves the polynomial optimization problem for a given polynomial, described in the paper:
Expand Down
7 changes: 5 additions & 2 deletions src/Alfonso.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Alfonso
include("interpolation.jl")
include("cone.jl")
for primcone in [
"nonnegative",
"orthant",
"sumofsquares",
"secondorder",
"exponential",
Expand All @@ -19,5 +19,8 @@ module Alfonso
include(joinpath(@__DIR__, "primitivecones", primcone * ".jl"))
end
include("nativeinterface.jl")
# include("mathoptinterface.jl")

import MathOptInterface
MOI = MathOptInterface
include("mathoptinterface.jl")
end
13 changes: 9 additions & 4 deletions src/cone.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@

#=
cone object
=#

# cone object
abstract type PrimitiveCone end

# TODO reorder primitive cones so easiest ones to check incone are first
mutable struct Cone
prms::Vector{PrimitiveCone}
idxs::Vector{AbstractVector{Int}}
end
Cone() = Cone(PrimitiveCone[], AbstractVector{Int}[])

function addprimitivecone!(cone::Cone, prm::PrimitiveCone, idx::AbstractVector{Int})
@assert dimension(prm) == length(idx)
push!(cone.prms, prm)
push!(cone.idxs, idx)
return cone
end

# calculate complexity parameter of the barrier (sum of the primitive cone barrier parameters)
barrierpar(cone::Cone) = sum(barrierpar_prm(prm) for prm in cone.prms)
Expand Down
5 changes: 3 additions & 2 deletions src/interpolation.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#=
Copyright 2018, David Papp, Sercan Yildiz, and contributors
Copyright 2018, Chris Coey and contributors
Copyright 2018, David Papp, Sercan Yildiz

modified from files in https://github.com/dpapp-github/alfonso/
https://github.com/dpapp-github/alfonso/blob/master/ChebInterval.m
Expand Down Expand Up @@ -182,7 +183,7 @@ function approxfekete_data(n::Int, d::Int, calc_w::Bool)

pts = ipts[keep_pnt,:] # subset of points indexed with the support of w
P0 = M[keep_pnt,1:L] # subset of polynomial evaluations up to total degree d
P = Array(qr(P0).Q)
P = Array(qr(P0).Q)

if calc_w
w = UpperTriangular(F.R[:,1:U])\(F.Q'*m)
Expand Down
Loading