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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite SCIP wrapper with Clang.jl to support a MIP solver through MOI #76

Merged
merged 82 commits into from
Jan 6, 2019
Merged
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
158beb4
add gen/generate_wrapper.jl
rschwarz Dec 14, 2018
39d47e9
add folder for generated wrapper files
rschwarz Dec 14, 2018
7c3b621
wrap all scip_*.h files
rschwarz Dec 14, 2018
c4bb9ac
wrap selected type_*.h headers
rschwarz Dec 14, 2018
4d5ef74
wrap almost all type_*.h headers
rschwarz Dec 14, 2018
479aae1
don't add pub_*.h headers (for now)
rschwarz Dec 14, 2018
d221a07
also wrap type_var.h
rschwarz Dec 14, 2018
d84a772
adapt generate_wrapper.jl to `restruct` branch of Clang.jl
rschwarz Dec 15, 2018
41c21f9
no special order of type_* headers in generate_wrapper.jl
rschwarz Dec 15, 2018
92d3685
regenerate wrapper
rschwarz Dec 15, 2018
baa31dd
reset README
rschwarz Dec 15, 2018
8e1ee3e
update LICENSE, REQUIRE
rschwarz Dec 15, 2018
3fd6395
delete most of the old code (and tests)
rschwarz Dec 15, 2018
91dbc68
add deps/build.jl
rschwarz Dec 15, 2018
9f9b2be
include all wrappers into another file
rschwarz Dec 15, 2018
fbc281f
add some manually wrapped constants :-(
rschwarz Dec 15, 2018
a58373e
rename type SCIP to SCIP_, avoid name conflict with module
rschwarz Dec 15, 2018
8a3f945
manually define FILE
rschwarz Dec 15, 2018
31b9959
include nlpi headers in generate_wrapper.jl
rschwarz Dec 15, 2018
187ea2b
include lpi headers in generate_wrapper.jl
rschwarz Dec 15, 2018
fe558bd
manually define BMS_{BLK,BUF}MEM
rschwarz Dec 15, 2018
8c60dff
check version during module init
rschwarz Dec 16, 2018
e9282e0
start on first test
rschwarz Dec 16, 2018
b9d1f7c
generate wrapper for scipdefplugins.h
rschwarz Dec 16, 2018
93218b4
wrap included tests in named testset
rschwarz Dec 16, 2018
dd9bea0
extend first test
rschwarz Dec 16, 2018
c1c5f8d
build.jl: check environment variable first
rschwarz Dec 17, 2018
94749bc
extend first test (actually add variable)
rschwarz Dec 17, 2018
e7401cf
generate_wrapper: include all cons_* headers
rschwarz Dec 17, 2018
b53ca2a
test: add linear constraint
rschwarz Dec 18, 2018
4810361
fix type in test
rschwarz Dec 18, 2018
543a572
add MOI to REQUIRE
rschwarz Dec 18, 2018
81ce845
prepare MOI_wrapper.jl
rschwarz Dec 19, 2018
f35860a
add ManagedSCIP (for memory) and include in Optimizer
rschwarz Dec 20, 2018
49bbe94
manage vars, conss for ManagedSCIP
rschwarz Dec 20, 2018
42bed2d
add simple @SC macro for SCIP_CALL
rschwarz Dec 20, 2018
f50bef4
add Travis CI config
rschwarz Dec 20, 2018
d3316aa
travis: install scip .deb package
rschwarz Dec 20, 2018
5a96eae
travis: add `using Pkg`
rschwarz Dec 20, 2018
5d08d9a
travis: install some dependencies
rschwarz Dec 20, 2018
2f8cd78
add .codecov.yml
rschwarz Dec 20, 2018
de1a030
implement more methods to support contlineartest (WIP)
rschwarz Dec 21, 2018
eab75e8
generate_wrapper: include pub_*.h headers
rschwarz Dec 22, 2018
041024d
implement enough of MOI to get to the actual solution query
rschwarz Dec 22, 2018
e74b98d
implement status and solution queries
rschwarz Dec 22, 2018
c6ed123
add allow_modification(o) to reset SCIP stage
rschwarz Dec 22, 2018
60c26ec
implement more problem modification
rschwarz Dec 22, 2018
b97dcff
do not support linear constraints with constant offset
rschwarz Dec 22, 2018
85ea505
add more solution queries
rschwarz Dec 22, 2018
0abb816
enable some MOI contlinear tests
rschwarz Dec 22, 2018
f4b71d8
fix ResultCount for unbounded problems
rschwarz Dec 22, 2018
49494b4
support basic, generic parameter setting
rschwarz Dec 22, 2018
aa3d318
disable SCIP output for MOI tests
rschwarz Dec 22, 2018
f34c1d0
fix get(ConstraintPrimal, SingleVariable)
rschwarz Dec 22, 2018
92d42b9
support problem and variable names
rschwarz Dec 22, 2018
a99be15
support names for some constraints
rschwarz Dec 22, 2018
3d92cfc
try to support names for SingleVariable constraints
rschwarz Dec 23, 2018
ee976e7
partially revert support for names
rschwarz Dec 23, 2018
110682c
use abbreviations for MOI types
rschwarz Dec 23, 2018
acecde3
support variable types binary, integer
rschwarz Dec 23, 2018
97a2108
add more solve statistics
rschwarz Dec 23, 2018
b3ef38d
enable some intlineartests
rschwarz Dec 23, 2018
e1821f1
update README
rschwarz Dec 23, 2018
7e4054b
README: fix typos
rschwarz Dec 23, 2018
279fae4
README: fix typo, more detail about pointer types
rschwarz Jan 4, 2019
c5d54e3
add dummy SCIPSolver() to warn old users about MPB/MOI.
rschwarz Jan 4, 2019
5f5d2c1
rm dependency on Compat
rschwarz Jan 4, 2019
cb51e3d
add version check agains upper bound (next major)
rschwarz Jan 4, 2019
b4e7529
documentation formatting
rschwarz Jan 4, 2019
881b9a7
added documentation
rschwarz Jan 4, 2019
d098f10
use get_* functions more
rschwarz Jan 6, 2019
d7c20e0
rm get_ prefix for accessor functions
rschwarz Jan 6, 2019
8a89494
introduce VarRef, ConsRef in place of Ints
rschwarz Jan 6, 2019
d231570
add copyright notice to files from Clang.jl
rschwarz Jan 6, 2019
d8a5fd8
reconsider type aliases
rschwarz Jan 6, 2019
8d70941
add explicit return keywords to functions
rschwarz Jan 6, 2019
3ea173a
rm empty test/REQUIRE
rschwarz Jan 6, 2019
04e31fe
rm test that depends on GC behavior
rschwarz Jan 6, 2019
f4b5883
add test for memory mgmt with solving
rschwarz Jan 6, 2019
7da7c14
warn about setting FEASIBLITY_SENSE
rschwarz Jan 6, 2019
3ed02b0
map gap limit to MOI.OPTIMAL (conform with other solvers)
rschwarz Jan 6, 2019
3b4f087
constant names consistent with style guide
rschwarz Jan 6, 2019
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
Prev Previous commit
Next Next commit
support problem and variable names
  • Loading branch information
rschwarz committed Dec 22, 2018
commit 92d42b9286f36cb91ec7fe92fba936daecf89138
15 changes: 14 additions & 1 deletion src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ MOI.supports_constraint(o::Optimizer, ::Type{<:SF}, ::Type{<:SS}) = true
MOI.supports(::Optimizer, ::MOI.ObjectiveSense) = true
MOI.supports(::Optimizer, ::MOI.ObjectiveFunction{MOI.ScalarAffineFunction{Float64}}) = true

MOIU.supports_default_copy_to(model::Optimizer, copy_names::Bool) = !copy_names
MOIU.supports_default_copy_to(model::Optimizer, copy_names::Bool) = true

struct Param <: MOI.AbstractOptimizerAttribute
name::String
Expand Down Expand Up @@ -131,6 +131,9 @@ function MOI.copy_to(dest::Optimizer, src::MOI.ModelLike; kws...)
MOIU.automatic_copy_to(dest, src; kws...)
end

MOI.get(o::Optimizer, ::MOI.Name) = SCIPgetProbName(get_scip(o))
MOI.set(o::Optimizer, ::MOI.Name, name::String) = @SC SCIPsetProbName(get_scip(o), name)

function MOI.add_variable(o::Optimizer)
allow_modification(o)
i::Int = add_variable(o.mscip)
Expand All @@ -143,6 +146,16 @@ MOI.add_variables(o::Optimizer, n) = [MOI.add_variable(o) for i=1:n]
MOI.get(o::Optimizer, ::MOI.NumberOfVariables) = length(o.mscip.vars)
MOI.get(o::Optimizer, ::MOI.ListOfVariableIndices) = VI.(1:length(o.mscip.vars))

MOI.get(o::Optimizer, ::MOI.VariableName, vi::VI) = SCIPvarGetName(get_var(o, vi))
function MOI.set(o::Optimizer, ::MOI.VariableName, vi::VI, name::String)
@SC SCIPchgVarName(get_scip(o), get_var(o, vi), name)
end

function MOI.get(o::Optimizer, ::Type{VI}, name::String)
var = SCIPfindVar(get_scip(o), name)
return VI(o.var[var])
end

function MOI.add_constraint(o::Optimizer, func::MOI.SingleVariable,
set::S) where S <: SS
allow_modification(o)
Expand Down