Skip to content

Commit

Permalink
Merge pull request #104 from JuliaOpt/ml/127
Browse files Browse the repository at this point in the history
support for 12.7 and drop 12.5
  • Loading branch information
mlubin authored Dec 23, 2016
2 parents 1ba8ccd + a1f45f5 commit 0fa0c77
Show file tree
Hide file tree
Showing 6 changed files with 1,200 additions and 9 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CPLEX.jl
========

The CPLEX.jl package provides an interface for using [IBM's CPLEX Optimizer™](http://www.ibm.com/software/commerce/optimization/cplex-optimizer/) from the [Julia language](http://julialang.org/). You cannot use CPLEX.jl without having purchased and installed a copy of CPLEX Optimizer™ from [IBM](http://www.ibm.com/). This package is available free of charge and in no way replaces or alters any functionality of IBM's CPLEX Optimizer product.
The CPLEX.jl package provides an unofficial interface for using [IBM's CPLEX Optimizer™](http://www.ibm.com/software/commerce/optimization/cplex-optimizer/) from the [Julia language](http://julialang.org/). You cannot use CPLEX.jl without having purchased and installed a copy of CPLEX Optimizer™ from [IBM](http://www.ibm.com/). This package is available free of charge and in no way replaces or alters any functionality of IBM's CPLEX Optimizer product.

CPLEX.jl is a Julia interface for the CPLEX optimization software. CPLEX functionality is extensive, so coverage is incomplete, but the basic functionality for solving linear and mixed-integer programs is provided.

Expand All @@ -24,10 +24,6 @@ NOTE: CPLEX [does not officially support linking to their dynamic C library](htt

4. Check that your version is included in ``deps/build.jl`` in the aliases for the library dependency; if not, open an issue.

Note on parameters
------------------

CPLEX has a large range of parameters that can be tuned to change the solvers behavior in many stages of the optimization process. CPLEX.jl includes an automatically generated list of parameters that are accessible for use. However, this list has last been generated with CPLEX version 12.6.2, and there are some differences with previous versions. For this reason, take care when setting solver parameters on earlier versions of CPLEX.

Note for windows
----------------
Expand Down
4 changes: 2 additions & 2 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if is_apple()
Libdl.dlopen("libstdc++",Libdl.RTLD_GLOBAL)
end

cpxvers = ["125","1251","1260","1261","1262","1263"]
cpxvers = ["1260","1261","1262","1263","1270"]

libnames = String["cplex"]
for v in reverse(cpxvers)
Expand All @@ -26,7 +26,7 @@ for v in reverse(cpxvers)
end
end

wincpxvers = ["126","1261","1262","1263"]
wincpxvers = ["126","1261","1262","1263","1270"]
if is_windows()
for v in reverse(wincpxvers)
env = "CPLEX_STUDIO_BINARIES$v"
Expand Down
10 changes: 9 additions & 1 deletion src/CPLEX.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,17 @@ module CPLEX
# cbget_mipsol_sol,
# cplex_model

include("full_defines.jl")

include("cpx_common.jl")
include("cpx_env.jl")
v = version()
if startswith(v,"12.6")
include("full_defines_126.jl")
elseif startswith(v,"12.7")
include("full_defines_127.jl")
else
error("Unsupported CPLEX version $v. Only 12.6 and 12.7 are currently supported.")
end
include("cpx_model.jl")
include("cpx_params.jl")
include("cpx_vars.jl")
Expand Down
9 changes: 9 additions & 0 deletions src/cpx_env.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ function get_error_msg(env::Env, code::Number)
end
end

function version(env::Env = Env())
charptr = @cpx_ccall(version, Ptr{Cchar}, (Ptr{Void},), env.ptr)
if charptr != C_NULL
return unsafe_string(charptr)
else
return error("CPLEX: error getting version")
end
end

type CplexError <: Exception
code::Int
msg::String
Expand Down
2 changes: 1 addition & 1 deletion src/full_defines.jl → src/full_defines_126.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This list was obtained through AWK with Cplex 12.51 (and then pared down):
# This list was obtained through AWK with Cplex 12.6.2 (and then pared down):
#
# grep "#define" cpxconst.h | awk '{ printf("const %s = convert(Cint,%s)\n",$2,$3) }'

Expand Down
Loading

0 comments on commit 0fa0c77

Please sign in to comment.