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
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CPLEX"
uuid = "a076750e-1247-5638-91d2-ce28b192dca0"
repo = "https://github.com/jump-dev/CPLEX.jl"
version = "0.8.1"
version = "1.0.0"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand All @@ -11,8 +11,8 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
CEnum = "0.3, 0.4"
MathOptInterface = "0.10"
julia = "1"
MathOptInterface = "1"
julia = "1.6"

[extras]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
64 changes: 0 additions & 64 deletions scripts/deprecate.jl

This file was deleted.

19 changes: 2 additions & 17 deletions src/CPLEX.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ end
const _CPLEX_VERSION = _get_version_number()

if _CPLEX_VERSION == v"12.10.0"
include("gen1210/ctypes.jl")
include("gen1210/libcpx_common.jl")
include("gen1210/libcpx_api.jl")
elseif _CPLEX_VERSION == v"20.1.0"
include("gen2010/ctypes.jl")
include("gen2010/libcpx_common.jl")
include("gen2010/libcpx_api.jl")
else
Expand Down Expand Up @@ -60,21 +58,8 @@ include("MOI/indicator_constraint.jl")
# CPLEX exports all `CPXxxx` symbols. If you don't want all of these symbols in
# your environment, then use `import CPLEX` instead of `using CPLEX`.

for sym in names(@__MODULE__, all = true)
sym_string = string(sym)
if startswith(sym_string, "CPX")
@eval export $sym
end
end

include("deprecated_functions.jl")

# Special overload to deprecate the `model.inner` field access.
function Base.getproperty(opt::Optimizer, key::Symbol)
if key == :inner
error(_DEPRECATED_ERROR_MESSAGE)
end
return getfield(opt, key)
for sym in filter(s -> startswith("$s", "CPX"), names(@__MODULE__, all = true))
@eval export $sym
end

end
40 changes: 21 additions & 19 deletions src/MOI/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,26 @@ function _check_ret_optimize(model)
return
end

"""
Optimizer(env::Union{Nothing, Env} = nothing)

Create a new Optimizer object.

You can share CPLEX `Env`s between models by passing an instance of `Env` as the
first argument.

Set optimizer attributes using `MOI.RawOptimizerAttribute` or
`JuMP.set_optimizer_atttribute`.

## Example

```julia
using JuMP, CPLEX
const env = CPLEX.Env()
model = JuMP.Model(() -> CPLEX.Optimizer(env))
set_optimizer_attribute(model, "CPXPARAM_ScreenOutput", 0)
```
"""
mutable struct Optimizer <: MOI.AbstractOptimizer
# The low-level CPLEX model.
lp::CPXLPptr
Expand Down Expand Up @@ -211,24 +231,6 @@ mutable struct Optimizer <: MOI.AbstractOptimizer
heuristic_callback::Union{Nothing,Function}
generic_callback::Any

"""
Optimizer(env::Union{Nothing, Env} = nothing)

Create a new Optimizer object.

You can share CPLEX `Env`s between models by passing an instance of `Env`
as the first argument.

Set optimizer attributes using `MOI.RawOptimizerAttribute` or
`JuMP.set_optimizer_atttribute`.

## Example

using JuMP, CPLEX
const env = CPLEX.Env()
model = JuMP.Model(() -> CPLEX.Optimizer(env))
set_optimizer_attribute(model, "CPXPARAM_ScreenOutput", 0)
"""
function Optimizer(env::Union{Nothing,Env} = nothing)
model = new()
model.lp = C_NULL
Expand Down Expand Up @@ -2757,7 +2759,7 @@ function MOI.get(model::Optimizer, attr::MOI.TerminationStatus)

$(MOI.get(model, MOI.RawStatusString()))

Please open an issue at https://github.com/JuliaOpt/CPLEX.jl/issues and
Please open an issue at https://github.com/jump-dev/CPLEX.jl/issues and
provide the complete text of this error message.
""")
return MOI.OTHER_ERROR
Expand Down
Loading