Skip to content

Persistence Of SCIPData Object #290

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

Merged
merged 2 commits into from
Jun 1, 2024
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
3 changes: 2 additions & 1 deletion src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ mutable struct Optimizer <: MOI.AbstractOptimizer
false,
MOI.COMPUTE_CONFLICT_NOT_CALLED,
)
finalizer(free_scip, o)
finalizer(free_scip, scip_data)

# Set all parameters given as keyword arguments, replacing the
# delimiter, since "/" is used by all SCIP parameters, but is not
Expand All @@ -76,6 +76,7 @@ mutable struct Optimizer <: MOI.AbstractOptimizer
end
end

# [TODO] Should Be Safe To Remove
free_scip(o::Optimizer) = free_scip(o.inner)

Base.cconvert(::Type{Ptr{SCIP_}}, o::Optimizer) = o
Expand Down
12 changes: 6 additions & 6 deletions test/conshdlr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@test ch.lock_called == 1

# free the problem
finalize(o)
finalize(o.inner)
end

@testset "dummy conshdlr (always satisfied, with constraint)" begin
Expand Down Expand Up @@ -54,7 +54,7 @@ end
@test ch.lock_called == 1

# free the problem
finalize(o)
finalize(o.inner)
end

@testset "dummy conshdlr (always satisfied, no constraint, but needs it)" begin
Expand All @@ -79,7 +79,7 @@ end
@test ch.lock_called == 0

# free the problem
finalize(o)
finalize(o.inner)
end

@testset "never satisfied conshdlr (does not need constraint)" begin
Expand All @@ -104,7 +104,7 @@ end
@test ch.lock_called == 1

# free the problem
finalize(o)
finalize(o.inner)
end

@testset "never satisfied conshdlr (needs constraint but does not have it)" begin
Expand All @@ -129,7 +129,7 @@ end
@test ch.lock_called == 0

# free the problem
finalize(o)
finalize(o.inner)
end

@testset "never satisfied conshdlr (needs constraint and has one)" begin
Expand Down Expand Up @@ -157,5 +157,5 @@ end
@test ch.lock_called == 1

# free the problem
finalize(o)
finalize(o.inner)
end
6 changes: 3 additions & 3 deletions test/scip_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end
@testset "create and semi-manual free" begin
o = SCIP.Optimizer()
@test o.inner.scip[] != C_NULL
finalize(o)
finalize(o.inner)
@test o.inner.scip[] == C_NULL
end

Expand Down Expand Up @@ -77,7 +77,7 @@ end
SCIP.@SCIP_CALL SCIP.SCIPsolve(o.inner.scip[])
end

finalize(o)
finalize(o.inner)
for var in values(o.inner.vars)
@test var[] == C_NULL
end
Expand Down Expand Up @@ -108,7 +108,7 @@ end
SCIP.@SCIP_CALL SCIP.SCIPsolve(o)
end

finalize(o)
finalize(o.inner)
for var in values(o.inner.vars)
@test var[] == C_NULL
end
Expand Down
Loading