Skip to content

Commit

Permalink
some compat updates for 0.7 (#208)
Browse files Browse the repository at this point in the history
* some compat updates for 0.7

* add Compat to REQUIRE

* missing using Compat
  • Loading branch information
mlubin authored Apr 24, 2018
1 parent 7c6f0a8 commit f2d9c55
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
julia 0.6
Compat 0.63
1 change: 1 addition & 0 deletions src/HighLevelInterface/HighLevelInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module HighLevelInterface

using ..SolverInterface
using ..MathProgBase
using Compat

function warn_no_inf(T)
if !(isinf(typemin(T)) && isinf(typemax(T)))
Expand Down
8 changes: 4 additions & 4 deletions src/HighLevelInterface/linprog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ function buildlp(c::InputVector, A::AbstractMatrix, rowlb::InputVector, rowub::I
rhs = rowubtmp
@assert realtype <: Real

rowlb = Array{realtype}(nrow)
rowub = Array{realtype}(nrow)
rowlb = Array{realtype}(undef, nrow)
rowub = Array{realtype}(undef, nrow)
for i in 1:nrow
if sense[i] == '<'
rowlb[i] = typemin(realtype)
Expand Down Expand Up @@ -86,15 +86,15 @@ function solvelp(m)
try
attrs[:infeasibilityray] = getinfeasibilityray(m)
catch
warn("Problem is infeasible, but infeasibility ray (\"Farkas proof\") is unavailable; check that the proper solver options are set.")
Compat.@warn("Problem is infeasible, but infeasibility ray (\"Farkas proof\") is unavailable; check that the proper solver options are set.")
end
return LinprogSolution(stat, nothing, [], attrs)
elseif stat == :Unbounded
attrs = Dict()
try
attrs[:unboundedray] = getunboundedray(m)
catch
warn("Problem is unbounded, but unbounded ray is unavailable; check that the proper solver options are set.")
Compat.@warn("Problem is unbounded, but unbounded ray is unavailable; check that the proper solver options are set.")
end
return LinprogSolution(stat, nothing, [], attrs)
else
Expand Down
4 changes: 2 additions & 2 deletions src/HighLevelInterface/mixintprog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ function mixintprog(c::InputVector, A::AbstractMatrix, rowlb::InputVector, rowub
sense = rowlbtmp
rhs = rowubtmp
@assert realtype <: Real
rowlb = Array{realtype}(nrow)
rowub = Array{realtype}(nrow)
rowlb = Array{realtype}(undef, nrow)
rowub = Array{realtype}(undef, nrow)
for i in 1:nrow
if sense[i] == '<'
rowlb[i] = typemin(realtype)
Expand Down
6 changes: 3 additions & 3 deletions src/SolverInterface/LinearQuadratic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ setquadobj!(m::AbstractLinearQuadraticModel,Q::Matrix) = setquadobj!(m,sparse(fl
function setquadobj!(m::AbstractLinearQuadraticModel,Q::SparseMatrixCSC{Float64})
if issymmetric(Q) || istriu(Q)
nnz_q = nnz(Q)
qr = Array{Cint}(nnz_q)
qc = Array{Cint}(nnz_q)
qv = Array{Cdouble}(nnz_q)
qr = Array{Cint}(undef, nnz_q)
qc = Array{Cint}(undef, nnz_q)
qv = Array{Cdouble}(undef, nnz_q)
k = 0
colptr::Vector{Int} = Q.colptr
nzval::Vector{Float64} = Q.nzval
Expand Down
3 changes: 3 additions & 0 deletions src/SolverInterface/SolverInterface.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module SolverInterface

using Base.Meta
using Compat
using Compat.SparseArrays
using Compat.LinearAlgebra

const methods_by_tag = Dict{Symbol,Vector{Symbol}}()

Expand Down
4 changes: 2 additions & 2 deletions src/SolverInterface/lpqp_to_conic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ function loadproblem!(m::LPQPtoConicBridge, c, A, b, constr_cones, var_cones)


# Linear constraint bounds
lb = Array{Float64}(length(linconstr_idx))
ub = Array{Float64}(length(linconstr_idx))
lb = Array{Float64}(undef, length(linconstr_idx))
ub = Array{Float64}(undef, length(linconstr_idx))
k = 1
for (cone,idxs) in constr_cones
if cone != :SOC && cone != :SOCRotated
Expand Down
4 changes: 3 additions & 1 deletion test/conicinterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# Test the MathProgBase.jl interface for a provided conic solver.
#############################################################################

using Base.Test
using Compat.Test
using Compat.LinearAlgebra
using Compat.SparseArrays
using MathProgBase

function coniclineartest(solver::MathProgBase.AbstractMathProgSolver;duals=false, tol=1e-6)
Expand Down
4 changes: 3 additions & 1 deletion test/linprog.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Base.Test
using Compat.Test
using Compat.LinearAlgebra
using Compat.SparseArrays
using MathProgBase

function linprogtest(solver; objtol = 1e-7, primaltol = 1e-6)
Expand Down
5 changes: 3 additions & 2 deletions test/linproginterface.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Base.Test
using MathProgBase
using Compat.Test
using Compat.LinearAlgebra
#using MathProgBase
using MathProgBase.SolverInterface

function linprogsolvertest(solver::AbstractMathProgSolver, eps = Base.rtoldefault(Float64))
Expand Down
3 changes: 2 additions & 1 deletion test/mixintprog.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Base.Test
using Compat.Test
using Compat.LinearAlgebra
using MathProgBase

function mixintprogtest(solver)
Expand Down

0 comments on commit f2d9c55

Please sign in to comment.