jump-dev / cplex.jl Goto Github PK
View Code? Open in Web Editor NEWA Julia interface to the CPLEX solver
Home Page: https://www.ibm.com/products/ilog-cplex-optimization-studio
License: MIT License
A Julia interface to the CPLEX solver
Home Page: https://www.ibm.com/products/ilog-cplex-optimization-studio
License: MIT License
I have a SOCP problem (@mlubin : ACOPF with SOC relaxations), which gives different objective values when I have the following model options without any other modifications:
a. With CPX_PARAM_PREIND=0
Opt obj: 721341.0797
b. Without CPX_PARAM_PREIND=0
Opt obj: 721299.7785
When I solve SOCP with outer approximation using callback, I still get opt obj = 721341.0797. Looks like there is an issue with having presolve switched on.
I am on Julia 0.4 and have updated the packages. Would this be an issue on CPLEX.jl/JuMP.jl or in CPLEX itself?
When using CPLEX with the concert API, to write the log to an external file; I would do
cplex.setOut(outputfilestream)
How to do a similar thing in Julia?
As the title suggests, I want to change eps tolerance for an MILP intially to some value, later solve some subproblem, add a cut and resolve the original model with a different tolerance. How do I go about doing this?
When I use a two sided range constraint in a JuMP Model, I get the following warning:
Julia Cplex interface doesn't properly support range (two-sided) constraints.
Should I be concerned when this pops up?
Hi,
I'm running Julia 0.2.1 (64bit) on mac.
When I call test/qp_01.jl (also qp_02.jl), I got the following error message:
ERROR: access to undefined reference
in unsafe_copy! at array.jl:135
in copy! at array.jl:51
in getindex at array.jl:296
in splice! at array.jl:814
in splice! at array.jl:807
in - at sparse/sparsematrix.jl:498
in - at sparse/sparsematrix.jl:407
in add_qpterms! at /Users/yuichirowaki/.julia/CPLEX/src/cpx_quad.jl:11
in add_qpterms! at /Users/yuichirowaki/.julia/CPLEX/src/cpx_quad.jl:37
in include at boot.jl:238
in include_from_node1 at loading.jl:114
in process_options at client.jl:303
in _start at client.jl:389
at /Users/yuichirowaki/.julia/CPLEX/test/qp_01.jl:19
This was solved by changing the line 10 in src/cpx_quad.jl from
Q = Q + Q' - spdiagm(diag(Q))
to
Q = Q + Q' - spdiagm(convert(Array{Cdouble},diag(Q)))
It seems, when applied to a sparse matrix, diag returns an array of type ANY and this was causing the problem.
E.g. on my system I think its
/opt/ibm/ILOG/CPLEX_Studio_Preview1251/cplex/bin/x86-64_sles10_4.1
which has libcplex1251.so which I assume is the right file? Haven't got it to work yet...
The methods to build a quadratic objective function are somewhat confusing, it is not clear when one must pass the matrix coefficients or the "term" coefficients.
Even more confusing when you consider that the convention used in CPLEX.jl is different from what is used in Gurobi.jl: add_qpterms()
expects "term" coefficients in Gurobi.jl, while it expects "matrix" coefficients in CPLEX.jl.
This is probably the cause why the test qp_01.jl gives "wrong" results in CPLEX.jl compared to what is expected (the results are not actually checked in the tests) -- it was probably copied & pasted from GUROBI.jl, that uses a different convention.
Not saying that the two interfaces have to be identical -- they don't, but I found it somewhat confusing.
[Also, the MPB tests do not pass, updatemodel()
doesn't exist for CPLEX.]
julia> Pkg.add("CPLEX")
INFO: Installing CPLEX v0.1.2
INFO: Building CPLEX
signal (11): Segmentation fault
unknown function (ip: 0x34f6a811a1)
__strdup at /lib64/libc.so.6 (unknown line)
jl_uv_dlopen at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
check_path! at /home/schalil/.julia/v0.4/BinDeps/src/dependencies.jl:558
jlcall_check_path!_21267 at (unknown line)
jl_apply_generic at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
_find_library at /home/schalil/.julia/v0.4/BinDeps/src/dependencies.jl:544
satisfy! at /home/schalil/.julia/v0.4/BinDeps/src/dependencies.jl:776
jl_apply_generic at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
satisfy! at /home/schalil/.julia/v0.4/BinDeps/src/dependencies.jl:776
jl_apply_generic at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
anonymous at /home/schalil/.julia/v0.4/BinDeps/src/dependencies.jl:831
unknown function (ip: 0x7ff0793009d3)
unknown function (ip: 0x7ff0793015ec)
jl_load at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
include at ./boot.jl:261
jl_apply_generic at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:304
jl_apply_generic at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
unknown function (ip: 0x7ff0792ec253)
unknown function (ip: 0x7ff0792eb5e9)
unknown function (ip: 0x7ff07930091c)
unknown function (ip: 0x7ff079300993)
jl_toplevel_eval_in at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
evalfile at loading.jl:320
evalfile at loading.jl:320
jl_apply_generic at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
anonymous at none:14
cd at ./file.jl:22
jl_apply_generic at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
anonymous at none:13
open at iostream.jl:114
jl_apply_generic at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
unknown function (ip: 0x7ff0792ec253)
unknown function (ip: 0x7ff0792eb5e9)
unknown function (ip: 0x7ff07930091c)
unknown function (ip: 0x7ff079300993)
jl_toplevel_eval_in at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
process_options at ./client.jl:257
_start at ./client.jl:378
unknown function (ip: 0x7ff07157b8f9)
jl_apply_generic at /home/schalil/julia-cbe1bee3a8/bin/../lib/julia/libjulia.so (unknown line)
unknown function (ip: 0x401c47)
unknown function (ip: 0x40182f)
__libc_start_main at /lib64/libc.so.6 (unknown line)
unknown function (ip: 0x401875)
ERROR: Build process failed.
in build! at pkg/entry.jl:701
in build at pkg/entry.jl:720
in resolve at ./pkg/entry.jl:479
in edit at pkg/entry.jl:26
in anonymous at task.jl:447
in sync_end at ./task.jl:413
[inlined code] from task.jl:422
in add at pkg/entry.jl:46
in add at pkg/entry.jl:73
in anonymous at pkg/dir.jl:31
in cd at file.jl:22
in cd at pkg/dir.jl:31
in add at pkg.jl:23
I was trying to install CPLEX.jl. I have specified the path for CPLEX in bash_profile as below
PATH=$PATH:$HOME/bin:$HOME/julia-cbe1bee3a8/bin:$HOME/CPLEX/
LD_LIBRARY_PATH="/home/schalil/CPLEX":$LD_LIBRARY_PATH
export PATH
export LD_LIBRARY_PATH
My cplex file location is as below
[schalil@user001 ~]$ cd CPLEX/
[schalil@user001 CPLEX]$ ls
cplex libcplex1263.so
[schalil@user001 CPLEX]$ pwd
/home/schalil/CPLEX
[schalil@user001 CPLEX]$
When I try to use CPLEX.jl, the error that i am getting is as below
julia> using CPLEX
INFO: Precompiling module CPLEX...
ERROR: LoadError: could not open file /home/schalil/.julia/v0.4/CPLEX/src/../deps/deps.jl
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
[inlined code] from none:2
in anonymous at no file:0
in process_options at ./client.jl:257
in _start at ./client.jl:378
while loading /home/schalil/.julia/v0.4/CPLEX/src/CPLEX.jl, in expression starting on line 8
ERROR: Failed to precompile CPLEX to /home/schalil/.julia/lib/v0.4/CPLEX.ji
in error at ./error.jl:21
in compilecache at loading.jl:384
in require at ./loading.jl:250
Hi!
I'm starting to work with JuMP and I'm trying to build and install the CPLEX package but I'm having some troubles. In particular, when I try to build the package (Pkg.build("CPLEX")) I get the error:
================================[ ERROR: CPLEX ]================================
Libdl not defined
while loading /Users/irios/.julia/v0.3/CPLEX/deps/build.jl, in expression starting on line 4
I have already installed CPLEX and add it to the library PATH. I'm working on mac osx 10.9.4.
What can I do to fix it?
Using using CPLEX_Studio1263, Julia 0.4.5 and Ubuntu 16.04:
Pkg.add("CPLEX")
INFO: Installing CPLEX v0.1.2
INFO: Building CPLEX
signal (11): Segmentation fault
strlen at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
__strdup at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
jl_uv_dlopen at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
check_path! at /home/thuener/.julia/v0.4/BinDeps/src/dependencies.jl:559
ERROR: Build process failed.
in build! at ./pkg/entry.jl:701
[inlined code] from ./task.jl:422
in add at ./pkg/entry.jl:64
ERROR: `updatemodel!` has no method matching updatemodel!(::CplexMathProgModel)
in linprogsolvertest at /home/mlubin/.julia/v0.3/MathProgBase/test/linproginterface.jl:34
What was the resolution on this?
I am trying without success to use the incumbent callback functionality provided in JuMPfunction.jl. I get the following error on Julia 0.4:
using JuMP,CPLEX
m=Model(solver=CplexSolver(CPX_PARAM_MIPDISPLAY=5,CPX_PARAM_SCRIND=0,CPX_PARAM_REDUCE=0, CPX_PARAM_MIPCBREDLP=0))
G=1:30
T=1:5
@defvar(m,10>=y[G,T]>=0)
@defvar(m,x[G,T],Bin)
@addConstraint(m,_c[t=T],sum{y[i,t], i in G}>=100_rand()+50)
@addConstraint(m, _c[i=G,t=T], y[i,t]<=100_x[i,t])
@setObjective(m,Min,sum{10_rand()_x[i,t]+2 _rand()_y[i,t]^2, i in G, t=T} );
function mycallback(cb)
obj_val = cbgetnodeobjval(cb)
if obj_val>1238.0
rejectIncumbent(cb)
else
acceptIncumbent(cb)
end
end
addIncumbentCallback(m, mycallback)
solve(m)
ERROR: MethodError: convert
has no method matching convert(::Type{CPLEX.CplexIncumbentCallbackData}, ::CPLEX.CallbackData, ::Symbol, ::Int32, ::Array{Float64,1}, ::Ptr{Int32}, ::Ptr{Int32})
This may have arisen from a call to the constructor CPLEX.CplexIncumbentCallbackData(...),
since type constructors fall back to convert methods.
Closest candidates are:
CPLEX.CplexIncumbentCallbackData(::CPLEX.CallbackData, ::Symbol, ::Int32, ::Array{Float64,1}, ::Ptr{Int32}, ::Ptr{Int32}, ::Array{CPLEX.BranchingChoice,1})
CPLEX.CplexIncumbentCallbackData(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
call{T}(::Type{T}, ::Any)
...
in masterincumbentcallback at /Users/frank/.julia/v0.4/CPLEX/src/CplexSolverInterface.jl:653
in optimize! at /Users/frank/.julia/v0.4/CPLEX/src/cpx_solve.jl:5
in optimize! at /Users/frank/.julia/v0.4/CPLEX/src/CplexSolverInterface.jl:153
in solve at /Users/frank/.julia/v0.4/JuMP/src/solvers.jl:84
in solvehook at /Users/frank/.julia/v0.4/CPLEX/src/JuMPfunctions.jl:45
in solve at /Users/frank/.julia/v0.4/JuMP/src/solvers.jl:62
julia> versioninfo()
Julia Version 0.4.0-dev+6819
Commit 4d72065* (2015-08-18 17:55 UTC)
Platform Info:
System: Darwin (x86_64-apple-darwin14.4.0)
CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
WORD_SIZE: 64
BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas
LIBM: libopenlibm
LLVM: libLLVM-3.3
Hello. I'm trying to use CPLEX solver from Julia, but getting the following error:
julia> using Cplex
ERROR: MathProgCallbackData not defined
in include at boot.jl:238
in include_from_node1 at loading.jl:114
in include at boot.jl:238
in include_from_node1 at loading.jl:114
in reload_path at loading.jl:140
in _require at loading.jl:58
in require at loading.jl:43
at D:\Documents and Settings\magistere\.julia\Cplex\src\CplexSolverCallbacksInterface.
jl:6
at D:\Documents and Settings\magistere\.julia\Cplex\src\Cplex.jl:43
But I cannot find any mentions of MathProgCallbackData
in MathProgBase
package. Have I missed something during installation?
How do I obtain the MIPrelativegap within a lazy callback? I tried using getobjgap(m). It throws an error. I can see that the following function is implemented
getobjgap(m::CplexMathProgModel) = get_rel_gap(m.inner)
How do I use this function to get the gap from a lazy callback ?
I tried to use CPLEX.jl with JuMP.
I have added
export LD_LIBRARY_PATH=“Users/username/Applications/IBM/ILOG/CPLEX_Studio126/cplex/bin/x86-64_osx/”:$LD_LIBRARY_PATH
to the bash_profile. But there is no libcplexXXX.dylib file in that directory. Do I miss something here?
After Pkg.add("CPLEX"). I got the following errors:
================================[ ERROR: CPLEX ]================================
LoadError: None of the selected providers can install dependency libcplex.
Use BinDeps.debug(package_name) to see available providers
while loading /Users/username/.julia/v0.4/CPLEX/deps/build.jl, in expression starting on line 31
================================[ BUILD ERRORS ]================================
WARNING: CPLEX had build errors.
Pkg.build("CPLEX")
deps/build.jl
scriptPlease help me solve this problem and really appreciate it. Thank you.
Not a issue just an enhancement. In the readme the "/path/to/CPLEX/library" path is misleading, in cplex 12.5 the real path is the bin folder (/opt/ibm/ILOG/CPLEX_Studio125/cplex/bin/x86-64_sles10_4.1). That was the only way that worked for me. I try to use /opt/ibm/ILOG/CPLEX_Studio125/cplex/lib/x86-64_sles10_4.1/static_pic/lib and didn't worked.
I suggest also to put an example:
export LD_LIBRARY_PATH="/opt/ibm/ILOG/CPLEX_Studio125/cplex/bin/x86-64_sles10_4.1":$LD_LIBRARY_PATH
We probably missed this because these tests only run on the default solver:
Test: model.jl
...
ERROR: assertion failed: |getDual(constraints)[2] - 1.0| <= 1.0e-6
getDual(constraints)[2] = -1.0
1.0 = 1.0
difference = 2.0 > 1.0e-6
in error at error.jl:22
in test_approx_eq at test.jl:109
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in anonymous at no file:18
in include at ./boot.jl:245
in include_from_node1 at loading.jl:128
in process_options at ./client.jl:285
in _start at ./client.jl:354
while loading /home/mlubin/.julia/v0.3/JuMP/test/model.jl, in expression starting on line 162
Same issue as jump-dev/Gurobi.jl#15 (JuliaLang/julia#5613). Win32 is probably not a high priority, but this issue should at least be documented.
It's probably time to move this to juliaopt. Should anything else be done besides documenting the windows installation issues?
Each time Env()
is called a new cplex environment is created using CPXopenCplex
. Unfortunately, no finalizer is registered, so creating a lot of models as in the following example eventually eats up your memory:
using MathProgBase
using CPLEX
for i=1:10000
local m = MathProgBase.model(CplexSolver())
end
I suggest to add a corresponding finalizer:
diff --git a/src/cpx_env.jl b/src/cpx_env.jl
index af7f19e..6c58e69 100644
--- a/src/cpx_env.jl
+++ b/src/cpx_env.jl
@@ -2,12 +2,14 @@ type Env
ptr::Ptr{Void}
function Env()
- stat = Array(Cint, 1)
- tmp = @cpx_ccall(openCPLEX, Ptr{Void}, (Ptr{Cint},), stat)
- if tmp == C_NULL
- error("CPLEX: Error creating environment")
- end
- new(tmp)
+ stat = Array(Cint, 1)
+ tmp = @cpx_ccall(openCPLEX, Ptr{Void}, (Ptr{Cint},), stat)
+ if tmp == C_NULL
+ error("CPLEX: Error creating environment")
+ end
+ env = new(tmp)
+ finalizer(env, close_CPLEX)
+ env
end
end
The two functions free_problem
and close_CPLEX
appear to have a bug: the argument of the object to be closed must be a pointer to CPXLPptr
and CPXENVptr
, respectively.
diff --git a/src/cpx_model.jl b/src/cpx_model.jl
index ba53f3b..2aecb99 100644
--- a/src/cpx_model.jl
+++ b/src/cpx_model.jl
@@ -136,15 +136,17 @@ function set_warm_start!(model::Model, indx::IVec, val::FVec)
end
function free_problem(model::Model)
- stat = @cpx_ccall(freeprob, Cint, (Ptr{Void}, Ptr{Void}), model.env.ptr, model.lp)
+ tmp = Ptr{Void}[model.lp]
+ stat = @cpx_ccall(freeprob, Cint, (Ptr{Void}, Ptr{Void}), model.env.ptr, tmp)
if stat != 0
throw(CplexError(model.env, stat))
end
end
function close_CPLEX(env::Env)
- stat = @cpx_ccall(closeCPLEX, Cint, (Ptr{Void},), env.ptr)
+ tmp = Ptr{Void}[env.ptr]
+ stat = @cpx_ccall(closeCPLEX, Cint, (Ptr{Void},), tmp)
if stat != 0
- throw(CplexError(model.env, stat))
+ throw(CplexError(env, stat))
end
end
However, these changes introduce another problem: because finalizers do not seem to be run in a particular order at exit, the finalizer for the environment might be called before the finalizer of the model, leading to the following error (in free_problem
):
error in running finalizer: CPLEX.CplexError(code=1002, msg="CPLEX Error 1002: No environment.")
In my tests this never happened during the run of the program, only at the end. Calling gc()
right before the program exits seems to solve the problem, but I have no idea of a "clean" solution.
I'm sure it's a known issue, but ctrl+c causes the REPL to crash (brutal segfault).
[If it only happens to me, I'd like to find out why :)]
Related: with Gurobi, ctrl+c takes me back to the REPL but the solver keeps running in the background, until it completes (or you quit the REPL) -- only marginally less annoying than a crash. Should probably open an issue there as well, if there isn't one already.
Can we reproduce this issue from a simple example in pure C? If so, it should be easy to get support to make this work. If not, we have something interesting to debug.
Pkg.test("CPLEX")
eventually leads to
ERROR: LoadError: LoadError: MethodError: `updatemodel!` has no method matching updatemodel!(::CPLEX.CplexMathProgModel)
in linprogsolvertest at /Users/dpo/.julia/v0.4/MathProgBase/test/linproginterface.jl:34
in include at /usr/local/Cellar/julia/0.4.3/lib/julia/sys.dylib
in include_from_node1 at /usr/local/Cellar/julia/0.4.3/lib/julia/sys.dylib
in evalfile at loading.jl:320 (repeats 2 times)
[inlined code] from /Users/dpo/.julia/v0.4/CPLEX/test/runtests.jl:15
in anonymous at no file:0
in include at /usr/local/Cellar/julia/0.4.3/lib/julia/sys.dylib
in include_from_node1 at /usr/local/Cellar/julia/0.4.3/lib/julia/sys.dylib
in process_options at /usr/local/Cellar/julia/0.4.3/lib/julia/sys.dylib
in _start at /usr/local/Cellar/julia/0.4.3/lib/julia/sys.dylib
while loading /Users/dpo/.julia/v0.4/CPLEX/test/mathprog.jl, in expression starting on line 14
while loading /Users/dpo/.julia/v0.4/CPLEX/test/runtests.jl, in expression starting on line 12
I ran Pkg.update()
tonight.
Stumbled across the following while running one of the tests:
[yeesian@yeesian-p7h55d-m test]$ julia ma
mathprog.jl mathprog_v2.jl
[yeesian@yeesian-p7h55d-m test]$ julia mathprog.jl
WARNING: Package CPLEX is installed but couldn't be loaded
Testing linprog with solver CplexSolver
ERROR: linprog not defined
while loading /home/yeesian/.julia/v0.3/CPLEX/test/mathprog.jl, in expression starting on line 4
If I import CPLEX
before including test/linprog.jl
, linprog
does not get imported:
| | |_| | | | (_| | | Version 0.3.0-prerelease+3766 (2014-06-19 03:37 UTC)
_/ |\__'_|_|_|\__'_| | Commit 28ba276 (0 days old master)
|__/ | x86_64-unknown-linux-gnu
julia> import CPLEX
WARNING: Package CPLEX is installed but couldn't be loaded
julia> include(joinpath(Pkg.dir("MathProgBase"),"test","linprog.jl"))
linprogtest (generic function with 2 methods)
julia> lin
linprogtest linreg linspace
It works in the reverse order though (only when done in the interactive session, and not by running as a script):
| | |_| | | | (_| | | Version 0.3.0-prerelease+3766 (2014-06-19 03:37 UTC)
_/ |\__'_|_|_|\__'_| | Commit 28ba276 (0 days old master)
|__/ | x86_64-unknown-linux-gnu
julia> include(joinpath(Pkg.dir("MathProgBase"),"test","linprog.jl"))
linprogtest (generic function with 2 methods)
julia> lin
linprog linprogtest linreg linspace
julia> import CPLEX
julia> lin
linprog linprogtest linreg linspace
julia> lin
The problem does not surface with the other solvers (e.g. Clp
and GLPKMathProgInterface
) though.
| | |_| | | | (_| | | Version 0.3.0-prerelease+3766 (2014-06-19 03:37 UTC)
_/ |\__'_|_|_|\__'_| | Commit 28ba276 (0 days old master)
|__/ | x86_64-unknown-linux-gnu
julia> using GLPKMathProgInterface
julia> include(joinpath(Pkg.dir("MathProgBase"),"test","linprog.jl"))
linprogtest (generic function with 2 methods)
julia> lin
linprog linprogtest linreg linspace
julia> lin
The packages involved:
julia> Pkg.status()
...
- CPLEX 0.0.6
- Clp 0.0.7
- GLPKMathProgInterface 0.1.4
CplexMathProgModel complains that getsolvetime is not implemented, if this can be added to CPLEX.jl I would really appreciate, many thanks in advance!
julia> Pkg.add("CPLEX")
...
INFO: Building CPLEX
==========================================================[ ERROR: CPLEX ]==========================================================
LoadError: UndefVarError: RTLD_GLOBAL not defined
while loading /Users/jiahao/.julia/v0.4/CPLEX/deps/build.jl, in expression starting on line 4
====================================================================================================================================
When calling getvartype
with all variables continuous, CPLEX seems to barf and say:
CPLEX Error 3003: Not a mixed-integer problem.
. This happens inside JuMP when re-solving LPs, so the user sees this confusing output.
I think the readme file mainly talks about connecting Julia with CPLEX in OS X.
May I know if there is a good way to solve this problem in Windows?
I installed the CPLEX package, and it says the package can't be loaded?
Thank you for your help!
> julia simpleusercut.jl
[1] 39373 segmentation fault julia simpleusercut.jl
Only seems to appear on first run after changing simpleusercut.jl
; otherwise it runs fine. Might need to break out gdb
.
I've updated the MathProgBase interface and JuMP to use it (so CPLEX currently isn't working).
Just added to MathProgBase since I need them for implementing Benders decomposition. See the implementation in Gurobi.
And revise install instructions
We shouldn't pretend to support a version if we didn't regenerate the options map from the corresponding header file.
According to the CPLEX manual, QPs with quadratic objective (and only linear constraints) should also be solved by CPXqpopt
. However, the current implementation only calls CPXqpopt
if the problem has a quadratic constraint (i.e. if has_qc
equals true which is only set in add_qconstr!
.
I've been experiencing what looks like a memory leak when solving LPs with Cplex.
I managed to isolate and reproduce the issue, here's a gist that should do the trick. Everytime time you solve the LP (of course, starting from the second one), htop says 3 extra MBs are reserved.
It doesn't happen 100% of the time, but if you keep trying long enough, you should be able to see it. I hope it's something obvious that I'm missing. Apparently it doesn't happen with Gurobi, though.
JuMP's internal variable bounds, when Inf
or -Inf
, get modified after calling CPLEX.jl, I think due to:
https://github.com/JuliaOpt/CPLEX.jl/blob/6f9c2445a33a93972808ef6d6bbd87bb03b6d272/src/cpx_vars.jl#L8
Should probably be just env
instead of model.env
and possibly stat[1]
instead of stat
:
diff --git a/src/cpx_model.jl b/src/cpx_model.jl
index ba53f3b..e29dd5a 100644
--- a/src/cpx_model.jl
+++ b/src/cpx_model.jl
@@ -17,7 +17,7 @@ function Model(env::Env, name::ASCIIString)
stat = Array(Cint, 1)
tmp = @cpx_ccall(createprob, Ptr{Void}, (Ptr{Void}, Ptr{Cint}, Ptr{Cchar}), env.ptr, stat, name)
if tmp == C_NULL
- throw(CplexError(model.env, stat))
+ throw(CplexError(env, stat[1]))
end
return Model(env, tmp)
end
Hello,
It seem's there is still a deprecated Uint8 type in the cpx_quad.jl file
(line 132) :
Ptr{Uint8} # name
should be replace with:
Ptr{UInt8} # name
-- Maurice
I am trying to get the best bound value after a certain termination criteria is satisfied. I looked up the documentation and source code. The JuMP documentation says I can do it using an infocallback which does not seem to work with CPLEX.jl.
In the source code for cplex_callbacks.jl, there is a function get_best_bound, which it tried calling in my program. It throws an error "get_best_bound not defined".
This is the content of my CPLEX library directory on Mac OS X. CPLEX version is 12.6
convert
cplex
cplexamp
libcplex1260.jnilib
libcplex1260mpitransport.dylib
libcplex1260mpiworker.dylib
libcplex1260processtransport.dylib
libcplex1260processworker.dylib
libcplex1260remote.dylib
libcplex1260remotejni.jnilib
libcplex1260tcpiptransport.dylib
libcplex1260tcpipworker.dylib
I added push!(libnames, "cplex")
in build.jl
to install CPLEX.jl
.
Hi,
The new Cplex version, 12.6.3, is now available. We need to add this information to build.jl for the package to build with the new version.
Cheers,
melih
Before moving to metadata, we should probably rename to CPLEX.
CPLEX 12.6.2 has introduced a bunch of new params for dealing with MISOCPs. It would be great if CPLEX.jl is updated to reflect the changes.
Link to the new parameter list: http://www-01.ibm.com/support/knowledgecenter/SSSA5P_12.6.2/ilog.odms.cplex.help/CPLEX/Parameters/topics/introListAlpha.html
I am getting inconsistent results executing the following in Julia.
using JuMP,CPLEX
I=[1,2];
m2 = JuMP.Model(solver=CPLEX.CplexSolver());
JuMP.@defVar(m2, w[I], Bin);
JuMP.@defVar(m2, y[I] >= 0);
JuMP.@setObjective(m2, Min, 10*w[1]+w[2] + y[1] + y[2]);
JuMP.@addConstraint(m2,y[1] + 2*y[2]≤ 5*w[1]);
JuMP.@addConstraint(m2,3*y[1] + y[2]≤ 10*w[2]);
solve(m2)
Either the model is solved (as it should) or I get the following error:
ERROR: error compiling model: error compiling __CplexMathProgModel#1__: error compiling call: could not load library "/Users/frank/machinerie/IBM/ILOG/CPLEX_Studio1261/cplex/bin/x86-64_osx/libcplex1261.dylib"
dlopen(/Users/frank/machinerie/IBM/ILOG/CPLEX_Studio1261/cplex/bin/x86-64_osx/libcplex1261.dylib, 1): Symbol not found: __ZNSt8ios_base4InitD1Ev
Referenced from: /Users/frank/machinerie/IBM/ILOG/CPLEX_Studio1261/cplex/bin/x86-64_osx/libcplex1261.dylib
Expected in: flat namespace
in /Users/frank/machinerie/IBM/ILOG/CPLEX_Studio1261/cplex/bin/x86-64_osx/libcplex1261.dylib
in buildInternalModel at /Users/frank/.julia/v0.4/JuMP/src/solvers.jl:238
in solve at /Users/frank/.julia/v0.4/JuMP/src/solvers.jl:79
The error systematically occurs when I start the Julia shell session with the above instructions. I am on OSX using Julia 0.4.3. The CPLEX deps.jl file points to libcplex1261.dylib:
ls -l ~/machinerie/IBM/ILOG/CPLEX_Studio1261/cplex/bin/x86-64_osx/libcplex1261.dylib
lrwxr-xr-x 1 frank staff 19 Apr 7 14:17 /Users/frank/machinerie/IBM/ILOG/CPLEX_Studio1261/cplex/bin/x86-64_osx/libcplex1261.dylib -> libcplex1261.jnilib
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.