diff --git a/Project.toml b/Project.toml index 2cdcd56..830aefb 100644 --- a/Project.toml +++ b/Project.toml @@ -4,12 +4,11 @@ repo = "https://github.com/jump-dev/Gurobi.jl" version = "1.3.1" [deps] -Gurobi_jll = "c018c7e6-a5b0-4aea-8f80-9c1ef9991411" +JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" [compat] -Gurobi_jll = "~9.5, ~10.0, ~11.0" Libdl = "<0.0.1, 1.6" MathOptInterface = "1.21" Random = "<0.0.1, 1.6" diff --git a/src/MOI_wrapper/MOI_nonlinear.jl b/src/MOI_wrapper/MOI_nonlinear.jl index dbc861b..83bfbc7 100644 --- a/src/MOI_wrapper/MOI_nonlinear.jl +++ b/src/MOI_wrapper/MOI_nonlinear.jl @@ -4,27 +4,31 @@ # 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. -const _OPCODE_MAP = Dict( - :+ => GRB_OPCODE_PLUS, - :- => GRB_OPCODE_MINUS, - :* => GRB_OPCODE_MULTIPLY, - :/ => GRB_OPCODE_DIVIDE, - # GRB_OPCODE_UMINUS 6 - # GRB_OPCODE_SQUARE 7 - :sqrt => GRB_OPCODE_SQRT, - :sin => GRB_OPCODE_SIN, - :cos => GRB_OPCODE_COS, - :tan => GRB_OPCODE_TAN, - :^ => GRB_OPCODE_POW, - :exp => GRB_OPCODE_EXP, - :log => GRB_OPCODE_LOG, - :log2 => GRB_OPCODE_LOG2, - :log10 => GRB_OPCODE_LOG10, - :logistic => GRB_OPCODE_LOGISTIC, -) - _supports_nonlinear() = _GUROBI_VERSION >= v"12.0.0" +if _supports_nonlinear() + const _OPCODE_MAP = Dict( + :+ => GRB_OPCODE_PLUS, + :- => GRB_OPCODE_MINUS, + :* => GRB_OPCODE_MULTIPLY, + :/ => GRB_OPCODE_DIVIDE, + # GRB_OPCODE_UMINUS 6 + # GRB_OPCODE_SQUARE 7 + :sqrt => GRB_OPCODE_SQRT, + :sin => GRB_OPCODE_SIN, + :cos => GRB_OPCODE_COS, + :tan => GRB_OPCODE_TAN, + :^ => GRB_OPCODE_POW, + :exp => GRB_OPCODE_EXP, + :log => GRB_OPCODE_LOG, + :log2 => GRB_OPCODE_LOG2, + :log10 => GRB_OPCODE_LOG10, + :logistic => GRB_OPCODE_LOGISTIC, + ) +else + const _OPCODE_MAP = Dict() +end + function MOI.supports_constraint( ::Optimizer, ::Type{MOI.ScalarNonlinearFunction},