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

WIP : MOI wrapper (based on LQOI) #27

Merged
merged 23 commits into from
Aug 14, 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
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ os:
- osx
julia:
- 0.6
- nightly
- 0.7
notifications:
email: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd()); Pkg.build("Clp"); Pkg.test("Clp"; coverage=true)'
#after_success:
#- julia -e 'cd(Pkg.dir("Clp")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
after_success:
- julia -e 'cd(Pkg.dir("Clp")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
2 changes: 2 additions & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
julia 0.6
Compat 0.59
Cbc
MathProgBase 0.5 0.8
LinQuadOptInterface 0.3 0.4
2 changes: 2 additions & 0 deletions src/Clp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ __precompile__()

module Clp

using Compat

include("ClpCInterface.jl")
include("ClpSolverInterface.jl")
include("MOIWrapper.jl")

using Clp.ClpMathProgSolverInterface
export ClpSolver
Expand Down
19 changes: 17 additions & 2 deletions src/ClpCInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export
resize,
delete_rows,
add_rows,
add_row,
delete_columns,
add_column,
add_columns,
chg_row_lower,
chg_row_upper,
Expand Down Expand Up @@ -414,16 +416,30 @@ function add_rows(model::ClpModel, number::Integer, row_lower::Vector{Float64},
row_starts::Vector{Int32}, columns::Vector{Int32},
elements::Vector{Float64})
_jl__check_model(model)

@clp_ccall addRows Void (Ptr{Void}, Int32, Ptr{Float64}, Ptr{Float64}, Ptr{Int32}, Ptr{Int32}, Ptr{Float64}) model.p number row_lower row_upper row_starts columns elements
end

#This function exists in cpp but not c interface
function add_row(model::ClpModel, nnz::Cint, columns::Vector{Int32},
elements::Vector{Float64}, row_lower::Float64, row_upper::Float64)
add_rows(model, 1, [row_lower], [row_upper], [Cint(0), nnz], columns,
elements)
end

# Delete columns.
function delete_columns(model::ClpModel, which::Vector{Int32})
_jl__check_model(model)
@clp_ccall deleteColumns Void (Ptr{Void},Int32,Ptr{Int32}) model.p length(which) which
end

#This function exists in cpp but not c interface
function add_column(model::ClpModel, nnz::Int32, rows::Vector{Int32},
elements::Vector{Float64}, column_lower::Float64,
column_upper::Float64, objective::Float64)
add_columns(model, 1, [column_lower], [column_upper], [objective],
[Int32(0), nnz], rows, elements)
end

# Add columns.
function add_columns(model::ClpModel, number::Integer, column_lower::Vector{Float64},
column_upper::Vector{Float64},
Expand All @@ -440,7 +456,6 @@ function add_columns(model::ClpModel, column_lower::Vector{Float64},
column_upper::Vector{Float64},
objective::Vector{Float64},
new_columns::SparseMatrixCSC{Float64,Int32})

add_columns(model, new_columns.n, column_lower, column_upper, objective, new_columns.colptr-convert(Int32,1), new_columns.rowval-convert(Int32,1), new_columns.nzval)
end

Expand Down
Loading