-
Notifications
You must be signed in to change notification settings - Fork 86
/
precompile.jl
103 lines (94 loc) · 3.73 KB
/
precompile.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright (c) 2017: Miles Lubin and contributors
# Copyright (c) 2017: Google Inc.
#
# Use of this source code is governed by an MIT-style license that can be found
# 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),
)
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))
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
end