# JuMP only for formulation and CPLEX.jl (or Gurobi.jl) as callable library wrapper?

**URL:** <https://discourse.julialang.org/t/jump-only-for-formulation-and-cplex-jl-or-gurobi-jl-as-callable-library-wrapper/60662>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, cplex\
**Created:** [May 6, 2021, 3:53pm UTC](https://discourse.julialang.org/t/jump-only-for-formulation-and-cplex-jl-or-gurobi-jl-as-callable-library-wrapper/60662 "2021-05-06T15:53:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rocarvaj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocarvaj/32/4769_2.png) [@rocarvaj](https://discourse.julialang.org/u/rocarvaj)\
**Post date:** [May 6, 2021, 3:53pm UTC](https://discourse.julialang.org/t/jump-only-for-formulation-and-cplex-jl-or-gurobi-jl-as-callable-library-wrapper/60662/1 "2021-05-06T15:53:14Z")

</div>

Hello!  
I’ve read the documentation for both JuMP and CPLEX.jl (the readme page on Github) but I just want to be 100% if it is possible to do the following:

- Formulate a MILP (using only constraints supported by the solver, nothing fancy)
- Use only the CPLEX C Callable library (through CPLEX.jl as a wrapper) to interact with the solver.

Could I run into any limitations when trying to use the advanced features in the Callable library?

The reason for doing this is that I love using JuMP for formulating a model, but there are certain “tricks” that I think I can achieve with the C callable library (e.g. getting the cuts generated by CPLEX at the root node cut loop).

Thanks in advance for your comments! 🙇‍♂️

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [May 6, 2021, 5:36pm UTC](https://discourse.julialang.org/t/jump-only-for-formulation-and-cplex-jl-or-gurobi-jl-as-callable-library-wrapper/60662/2 "2021-05-06T17:36:55Z")

</div>

Hi @rocarvaj, you can use JuMP’s [direct mode](https://jump.dev/JuMP.jl/v0.21.1/solvers/#Direct-mode-1) to build the model and then interact with it using the CPLEX API. In direct mode, there’s a 1:1 mapping from JuMP variables and constraints to CPLEX variables and constraints.

---

<div class="post-metadata">

**Author:** ![rocarvaj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocarvaj/32/4769_2.png) [@rocarvaj](https://discourse.julialang.org/u/rocarvaj)\
**Post date:** [May 6, 2021, 6:36pm UTC](https://discourse.julialang.org/t/jump-only-for-formulation-and-cplex-jl-or-gurobi-jl-as-callable-library-wrapper/60662/3 "2021-05-06T18:36:13Z")

</div>

Thanks, Miles! I read about direct mode but I wasn’t sure. This definitely gives me the best of both worlds 🙂.
