Skip to content

Remove unneeded module prefixes #336

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
May 16, 2025
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
2 changes: 1 addition & 1 deletion src/LibSCIP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63974,7 +63974,7 @@ const ARTIFICIALVARNAMEPREFIX = "andresultant_"
const SCIPisFinite = isfinite

# exports
const PREFIXES = ["SCIP_", "SCIP", "BMS_"]
const PREFIXES = ["SCIP", "BMS_"]
for name in names(@__MODULE__; all=true), prefix in PREFIXES
if startswith(string(name), prefix)
@eval export $name
Expand Down
16 changes: 8 additions & 8 deletions src/MOI_wrapper/HeuristicCallback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,25 @@ function MOI.submit(
heur_ = o.inner.heuristic_storage[heuristic]
sol = create_empty_scipsol(o.inner.scip[], heur_)
for idx in eachindex(x)
SCIP.@SCIP_CALL SCIP.SCIPsetSolVal(
@SCIP_CALL SCIPsetSolVal(
o.inner.scip[],
sol,
var(o, x[idx]),
values[idx],
)
end
stored = Ref{SCIP_Bool}(SCIP.FALSE)
stored = Ref{SCIP_Bool}(FALSE)
@SCIP_CALL SCIPtrySolFree(
o.inner.scip[],
Ref(sol),
SCIP.FALSE,
SCIP.FALSE,
SCIP.TRUE,
SCIP.TRUE,
SCIP.TRUE,
FALSE,
FALSE,
TRUE,
TRUE,
TRUE,
stored,
)
if stored[] == SCIP.TRUE
if stored[] == TRUE
callback_data.submit_called = true
end
return
Expand Down
10 changes: 5 additions & 5 deletions src/MOI_wrapper/conflict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ function compute_minimum_unsatisfied_constraints!(o::Optimizer)
)
end
# free the transformed problem first
if LibSCIP.SCIPgetStage(o) != LibSCIP.SCIP_STAGE_PROBLEM
@SCIP_CALL LibSCIP.SCIPfreeTransform(o)
if SCIPgetStage(o) != SCIP_STAGE_PROBLEM
@SCIP_CALL SCIPfreeTransform(o)
end
# first transform all variable bound constraints to constraint bounds
for (F, S) in MOI.get(o, MOI.ListOfConstraintTypesPresent())
Expand Down Expand Up @@ -68,9 +68,9 @@ function compute_minimum_unsatisfied_constraints!(o::Optimizer)
end
end
end
success = Ref{LibSCIP.SCIP_Bool}(SCIP.FALSE)
@SCIP_CALL LibSCIP.SCIPtransformMinUC(o, success)
if success[] != SCIP.TRUE
success = Ref{SCIP_Bool}(FALSE)
@SCIP_CALL SCIPtransformMinUC(o, success)
if success[] != TRUE
error(
"Failed to compute the minimum unsatisfied constraints system.\nSome constraint types may not support the required transformations",
)
Expand Down
2 changes: 1 addition & 1 deletion src/MOI_wrapper/constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ function MOI.is_valid(o::Optimizer, c::MOI.ConstraintIndex{F,S}) where {F,S}
if !in(ConsRef(c.value), cons_set)
return false
end
return haskey(o.inner.conss, SCIP.ConsRef(c.value))
return haskey(o.inner.conss, ConsRef(c.value))
end
2 changes: 1 addition & 1 deletion src/MOI_wrapper/linear_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function MOI.add_constraint(
end

function MOI.set(
o::SCIP.Optimizer,
o::Optimizer,
::MOI.ConstraintSet,
ci::MOI.ConstraintIndex{<:MOI.ScalarAffineFunction{Float64},S},
set::S,
Expand Down
22 changes: 11 additions & 11 deletions src/MOI_wrapper/quadratic_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ function MOI.get(
expr_ref = SCIPgetExprNonlinear(c)
# This call is required to get quaddata computed in the expression
isq = Ref{UInt32}(100)
@SCIP_CALL LibSCIP.SCIPcheckExprQuadratic(o, expr_ref, isq)
@SCIP_CALL SCIPcheckExprQuadratic(o, expr_ref, isq)
@assert isq[] == 1
constant_ref = Ref{Cdouble}(-1.0)
n_linear_terms_ref = Ref{Cint}(-1)
linear_exprs = Ref{Ptr{Ptr{LibSCIP.SCIP_EXPR}}}()
linear_exprs = Ref{Ptr{Ptr{SCIP_EXPR}}}()
lincoefs = Ref{Ptr{Cdouble}}()
n_quad_terms_ref = Ref{Cint}(-1)
n_bilinear_terms_ref = Ref{Cint}(-1)
LibSCIP.SCIPexprGetQuadraticData(
SCIPexprGetQuadraticData(
expr_ref,
constant_ref,
n_linear_terms_ref,
Expand All @@ -83,16 +83,16 @@ function MOI.get(
unsafe_wrap(Vector{Ptr{Cvoid}}, linear_exprs[], n_linear_terms_ref[])
lin_coeff_vec =
unsafe_wrap(Vector{Cdouble}, lincoefs[], n_linear_terms_ref[])
func = SCIP.MOI.ScalarQuadraticFunction{Float64}([], [], constant_ref[])
func = MOI.ScalarQuadraticFunction{Float64}([], [], constant_ref[])
for idx in 1:n_linear_terms_ref[]
var_ptr = LibSCIP.SCIPgetVarExprVar(lin_expr_vec[idx])
var_ptr = SCIPgetVarExprVar(lin_expr_vec[idx])
func += lin_coeff_vec[idx] * MOI.VariableIndex(o.reference[var_ptr].val)
end
for term_idx in 1:n_quad_terms_ref[]
var_expr = Ref{Ptr{Cvoid}}()
lin_coef_ref = Ref{Cdouble}()
sqr_coef_ref = Ref{Cdouble}()
LibSCIP.SCIPexprGetQuadraticQuadTerm(
SCIPexprGetQuadraticQuadTerm(
expr_ref,
term_idx - 1, # 0-indexed terms
var_expr,
Expand All @@ -104,7 +104,7 @@ function MOI.get(
)
@assert lin_coef_ref[] == 0.0
if sqr_coef_ref[] != 0.0
var_ptr = LibSCIP.SCIPgetVarExprVar(var_expr[])
var_ptr = SCIPgetVarExprVar(var_expr[])
var_idx = MOI.VariableIndex(o.reference[var_ptr].val)
MOI.Utilities.operate!(
+,
Expand All @@ -118,7 +118,7 @@ function MOI.get(
var_expr1 = Ref{Ptr{Cvoid}}()
var_expr2 = Ref{Ptr{Cvoid}}()
coef_ref = Ref{Cdouble}()
LibSCIP.SCIPexprGetQuadraticBilinTerm(
SCIPexprGetQuadraticBilinTerm(
expr_ref,
term_idx - 1,
var_expr1,
Expand All @@ -128,9 +128,9 @@ function MOI.get(
C_NULL,
)
if coef_ref[] != 0.0
var_ptr1 = LibSCIP.SCIPgetVarExprVar(var_expr1[])
var_ptr1 = SCIPgetVarExprVar(var_expr1[])
var_idx1 = MOI.VariableIndex(o.reference[var_ptr1].val)
var_ptr2 = LibSCIP.SCIPgetVarExprVar(var_expr2[])
var_ptr2 = SCIPgetVarExprVar(var_expr2[])
var_idx2 = MOI.VariableIndex(o.reference[var_ptr2].val)
MOI.Utilities.operate!(
+,
Expand Down Expand Up @@ -164,7 +164,7 @@ function MOI.get(
c = cons(o, ci)
expr_ref = SCIPgetExprNonlinear(c)
isq = Ref{UInt32}(100)
@SCIP_CALL LibSCIP.SCIPcheckExprQuadratic(o, expr_ref, isq)
@SCIP_CALL SCIPcheckExprQuadratic(o, expr_ref, isq)
@assert isq[] == 1
sol = SCIPgetBestSol(o)
@SCIP_CALL SCIPevalExpr(o, expr_ref, sol, Clonglong(0))
Expand Down
6 changes: 3 additions & 3 deletions src/branching_rule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
`allow_additional_constraints` is a Boolean indicating if the branching rule
is allowed to add constraints to the current node in order to cut off the current solution instead of creating a branching.

That method must return a tuple (return_code::LibSCIP.SCIP_RETCODE, result::SCIP.LibSCIP.SCIP_RESULT).
That method must return a tuple (return_code::SCIP_RETCODE, result::SCIP_RESULT).
If no branching was performed, use `SCIP_DIDNOTRUN` as a result to pass on to the following branching rule.

`type` is the `BranchingType` to branch on, i.e. on LP solution, pseudo-solution or external candidate.
Expand All @@ -53,7 +53,7 @@
allow_additional_constraints,
type::BranchingType,
)
return (LibSCIP.SCIP_OKAY, LibSCIP.SCIP_DIDNOTRUN)
return (SCIP_OKAY, SCIP_DIDNOTRUN)

Check warning on line 56 in src/branching_rule.jl

View check run for this annotation

Codecov / codecov/patch

src/branching_rule.jl#L56

Added line #L56 was not covered by tests
end

"""
Expand Down Expand Up @@ -104,7 +104,7 @@
end

function branch_on_candidate!(scip, var)
@SCIP_CALL LibSCIP.SCIPbranchVar(scip, var, C_NULL, C_NULL, C_NULL)
@SCIP_CALL SCIPbranchVar(scip, var, C_NULL, C_NULL, C_NULL)
return nothing
end

Expand Down
2 changes: 1 addition & 1 deletion src/convenience.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Recover Julia object which is attached to user constraint (via constraint data).
"""
function user_constraint(cons_::Ptr{SCIP_CONS})
@assert cons_ != C_NULL
consdata_::Ptr{SCIP.SCIP_CONSDATA} = SCIPconsGetData(cons_)
consdata_::Ptr{SCIP_CONSDATA} = SCIPconsGetData(cons_)
return unsafe_pointer_to_objref(consdata_)
end

Expand Down
4 changes: 2 additions & 2 deletions src/cut_selector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function _select_cut_callback(
@assert length(cuts) == ncuts
forced_cuts = unsafe_wrap(Vector{Ptr{SCIP_ROW}}, forced_cuts_, nforced_cuts)
@assert length(forced_cuts) == nforced_cuts
root = root_ == SCIP.TRUE
root = root_ == TRUE
(retcode, nselectedcuts, result) = select_cuts(
cutsel,
scip,
Expand Down Expand Up @@ -260,7 +260,7 @@ function select_cuts(
nselected_cuts = Ref{Cint}(-1)
maxparalellism = root ? cutsel.max_parallelism_root : cutsel.max_parallelism
max_good_parallelism = max(maxparalellism, 0.5)
retcode = LibSCIP.SCIPselectCutsHybrid(
retcode = SCIPselectCutsHybrid(
scip,
cuts,
forced_cuts,
Expand Down
14 changes: 7 additions & 7 deletions src/event_handler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,19 @@ function _eventexit(
return SCIP_OKAY
end
"""
include_event_handler(scipd::SCIP.SCIPData, event_handler::EVENTHDLR; name="", desc="")
include_event_handler(scipd::SCIPData, event_handler::EVENTHDLR; name="", desc="")

Include the event handler in SCIP. WARNING! In contrast to the separator wrapper you only need to
pass the SCIPData rather than the SCIP pointer and dictionary.

# Arguments
- scipd::SCIP.SCIPData: The SCIPData object
- scipd::SCIPData: The SCIPData object
- event_handler::EVENTHDLR: The event handler object
- name::String: The name of the event handler
- desc::String: The description of the event handler
"""
function include_event_handler(
scipd::SCIP.SCIPData,
scipd::SCIPData,
event_handler::EVENTHDLR;
name="",
desc="",
Expand Down Expand Up @@ -135,14 +135,14 @@ function include_event_handler(
end

"""
catch_event(scipd::SCIP.SCIPData, eventtype::SCIP_EVENTTYPE, eventhdlr::EVENTHDLR)
catch_event(scipd::SCIPData, eventtype::SCIP_EVENTTYPE, eventhdlr::EVENTHDLR)

Catch an event in SCIP. This function is a wrapper around the SCIPcatchEvent function.
Warning! This function should only be called after the SCIP has been transformed.
Use this instead of calling SCIPcatchEvent directly.
"""
function catch_event(
scipd::SCIP.SCIPData,
scipd::SCIPData,
eventtype::SCIP_EVENTTYPE,
eventhdlr::EVENTHDLR,
) where {EVENTHDLR<:AbstractEventhdlr}
Expand All @@ -153,14 +153,14 @@ function catch_event(
end

"""
drop_event(scipd::SCIP.SCIPData, eventtype::SCIP_EVENTTYPE, eventhdlr::EVENTHDLR)
drop_event(scipd::SCIPData, eventtype::SCIP_EVENTTYPE, eventhdlr::EVENTHDLR)

Drop an event in SCIP. This function is a wrapper around the SCIPdropEvent function.
Warning! This function should only be called after the SCIP has been transformed.
Use this instead of calling SCIPdropEvent directly.
"""
function drop_event(
scipd::SCIP.SCIPData,
scipd::SCIPData,
eventtype::SCIP_EVENTTYPE,
eventhdlr::EVENTHDLR,
) where {EVENTHDLR<:AbstractEventhdlr}
Expand Down
2 changes: 1 addition & 1 deletion src/heuristic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function _find_primal_solution_callback(
)
heurdata::Ptr{SCIP_HEURDATA} = SCIPheurGetData(heur_)
heur = unsafe_pointer_to_objref(heurdata)
nodeinfeasible = nodeinfeasible_ == SCIP.TRUE
nodeinfeasible = nodeinfeasible_ == TRUE
(retcode, result) = find_primal_solution(
scip,
heur,
Expand Down
2 changes: 1 addition & 1 deletion src/scip_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ mutable struct SCIPData
@SCIP_CALL SCIPcreate(scip)
@assert scip[] != C_NULL
@SCIP_CALL SCIPincludeDefaultPlugins(scip[])
@SCIP_CALL SCIP.SCIPcreateProbBasic(scip[], "")
@SCIP_CALL SCIPcreateProbBasic(scip[], "")
scip_data = new(
scip,
Dict{VarRef,Ref{Ptr{SCIP_VAR}}}(),
Expand Down
Loading