Skip to content
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: 0 additions & 2 deletions src/Bridges/Bridges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ MOI.is_copyable(::ListOfNonstandardBridges) = false

MOI.get_fallback(model::MOI.ModelLike, ::ListOfNonstandardBridges) = Type[]

include("precompile.jl")

function _test_structural_identical(
a::MOI.ModelLike,
b::MOI.ModelLike;
Expand Down
20 changes: 0 additions & 20 deletions src/Bridges/precompile.jl

This file was deleted.

2 changes: 0 additions & 2 deletions src/MathOptInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,6 @@ include("FileFormats/FileFormats.jl")

include("instantiate.jl")

_precompile_()

"""
IndexMap()

Expand Down
2 changes: 0 additions & 2 deletions src/Nonlinear/ReverseAD/ReverseAD.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@ include("reverse_mode.jl")
include("forward_over_reverse.jl")
include("mathoptinterface_api.jl")

include("precompile.jl")

end # module
76 changes: 0 additions & 76 deletions src/Nonlinear/ReverseAD/precompile.jl

This file was deleted.

3 changes: 0 additions & 3 deletions src/Utilities/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,4 @@ include("set_dot.jl")

include("distance_to_set.jl")

include("precompile.jl")
_precompile_()

end # module
51 changes: 0 additions & 51 deletions src/Utilities/precompile.jl

This file was deleted.

95 changes: 6 additions & 89 deletions src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,99 +5,16 @@
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.

function precompile_constraint(model, F, S)
Base.precompile(get, (model, ListOfConstraintIndices{F,S}))
Base.precompile(get, (model, ListOfConstraintAttributesSet{F,S}))
Base.precompile(get, (model, ConstraintSet, ConstraintIndex{F,S}))
Base.precompile(get, (model, ConstraintSet, Vector{ConstraintIndex{F,S}}))
Base.precompile(set, (model, ConstraintSet, ConstraintIndex{F,S}, S))

Base.precompile(get, (model, ConstraintFunction, ConstraintIndex{F,S}))
Base.precompile(set, (model, ConstraintFunction, ConstraintIndex{F,S}, F))
Base.precompile(
get,
(model, ConstraintFunction, Vector{ConstraintIndex{F,S}}),
)

Base.precompile(get, (model, ConstraintDual, ConstraintIndex{F,S}))
Base.precompile(get, (model, ConstraintPrimal, ConstraintIndex{F,S}))

Base.precompile(
get,
(model, AbstractConstraintAttribute, ConstraintIndex{F,S}),
)
Base.precompile(
get,
(model, AbstractConstraintAttribute, Vector{ConstraintIndex{F,S}}),
)

Base.precompile(add_constraint, (model, F, S))
Base.precompile(add_constraints, (model, Vector{F}, Vector{S}))
Base.precompile(delete, (model, ConstraintIndex{F,S}))
Base.precompile(is_valid, (model, ConstraintIndex{F,S}))
Base.precompile(get, (model, ConstraintName, ConstraintIndex{F,S}))
return Base.precompile(
set,
(model, ConstraintName, ConstraintIndex{F,S}, String),
)
@warn("This function is deprecated. Use PrecompileTools.jl instead")
return
end

function precompile_variables(model)
Base.precompile(delete, (model, VariableIndex))
Base.precompile(delete, (model, Vector{VariableIndex}))
Base.precompile(get, (model, AbstractVariableAttribute, VariableIndex))
Base.precompile(
get,
(model, AbstractVariableAttribute, Vector{VariableIndex}),
)
Base.precompile(get, (model, VariableName, VariableIndex))
Base.precompile(set, (model, VariableName, VariableIndex, String))
Base.precompile(get, (model, VariablePrimalStart, VariableIndex))
Base.precompile(set, (model, VariablePrimalStart, VariableIndex, Float64))
Base.precompile(get, (model, VariablePrimalStart, Vector{VariableIndex}))
Base.precompile(
set,
(model, VariablePrimalStart, Vector{VariableIndex}, Vector{Float64}),
)
Base.precompile(get, (model, VariablePrimal, VariableIndex))
Base.precompile(get, (model, VariablePrimal, Vector{VariableIndex}))
return Base.precompile(add_constrained_variables, (model, Reals))
@warn("This function is deprecated. Use PrecompileTools.jl instead")
return
end

function precompile_model(model, constraints)
Base.precompile(empty!, (model,))
Base.precompile(is_empty, (model,))
Base.precompile(get, (model, ListOfConstraintTypesPresent))
Base.precompile(optimize!, (model,))
Base.precompile(add_variable, (model,))
Base.precompile(add_variables, (model, Int))
for attr in (
ListOfVariableIndices,
ListOfVariableAttributesSet,
TerminationStatus,
DualStatus,
PrimalStatus,
ObjectiveValue,
Silent,
TimeLimitSec,
NumberOfVariables,
)
Base.precompile(get, (model, attr))
end

precompile_variables(model)
for (F, S) in constraints
precompile_constraint(model, F, S)
end
return Base.precompile(Tuple{typeof(add_constrained_variables),model,Reals})
end

function _precompile_()
return Base.precompile(
Tuple{
Core.kwftype(typeof(instantiate)),
NamedTuple{(:with_bridge_type,),Tuple{DataType}},
typeof(instantiate),
Type,
},
) # time: 0.481656
@warn("This function is deprecated. Use PrecompileTools.jl instead")
return
end
9 changes: 9 additions & 0 deletions test/errors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,15 @@ function test_isvalid_fallback()
return
end

function test_logs_precompile()
model = MOI.Utilities.Model{Float64}()
F, S = MOI.VariableIndex, MOI.ZeroOne
@test_logs (:warn,) MOI.precompile_constraint(model, F, S)
@test_logs (:warn,) MOI.precompile_variables(model)
@test_logs (:warn,) MOI.precompile_model(model, [(F, S)])
return
end

end # module

TestErrors.runtests()
Loading