# Adding cuts to a MILP prior to the solving

**URL:** <https://discourse.julialang.org/t/adding-cuts-to-a-milp-prior-to-the-solving/11395>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [June 3, 2018, 7:18pm UTC](https://discourse.julialang.org/t/adding-cuts-to-a-milp-prior-to-the-solving/11395 "2018-06-03T19:18:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdeboeck](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jdeboeck/32/4766_2.png) [@jdeboeck](https://discourse.julialang.org/u/jdeboeck)\
**Post date:** [June 3, 2018, 7:18pm UTC](https://discourse.julialang.org/t/adding-cuts-to-a-milp-prior-to-the-solving/11395/1 "2018-06-03T19:18:51Z")

</div>

I am solving a MILP with JuMP and have a set of valid cuts for the linear relaxation. I would like to add all these inequalities as a pool of possible cuts before launching the solving and the branching procedure. The aim is to avoid implementation of callback where I test all these cuts manually to find the ones violated by a fractional solution. I used to work in C where the function AddCuts would do this ([https://www.ibm.com/support/knowledgecenter/SSSA5P\_12.6.0/ilog.odms.cplex.help/refdotnetcplex/html/M\_ILOG\_CPLEX\_Cplex\_AddCuts.htm](https://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.0/ilog.odms.cplex.help/refdotnetcplex/html/M_ILOG_CPLEX_Cplex_AddCuts.htm)) but I cannot find anything equivalent in JuMP.

Does this possibility exist in JuMP ?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [June 3, 2018, 10:53pm UTC](https://discourse.julialang.org/t/adding-cuts-to-a-milp-prior-to-the-solving/11395/2 "2018-06-03T22:53:04Z")

</div>

If you know the set of valid cuts, can’t you just add them via the `@constraint` macro? Do they need to be lazy?

If you want something CPLEX specific, and it is not implemented in [https://github.com/juliaopt/cplex.jl](https://github.com/juliaopt/cplex.jl) (for example, [addusercuts](https://www.ibm.com/support/knowledgecenter/SS9UKU_12.6.0/com.ibm.cplex.zos.help/refcallablelibrary/mipapi/addusercuts.html)), PR’s are accepted 🙂

---

<div class="post-metadata">

**Author:** ![jdeboeck](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jdeboeck/32/4766_2.png) [@jdeboeck](https://discourse.julialang.org/u/jdeboeck)\
**Post date:** [June 4, 2018, 1:14am UTC](https://discourse.julialang.org/t/adding-cuts-to-a-milp-prior-to-the-solving/11395/3 "2018-06-04T01:14:37Z")

</div>

I need something equivalent to usercuts, not lazy constraints. This is because this set of constraints is of big cardinality but are not necessary for my formulation. We observed a smaller LP gap with these cuts but when adding all of them from the start the solving time is much bigger. Plus I suspect that many of these constraints are not necessary during the resolution. So wanted to try the “addCuts” version.

If there is nothing generic in JuMP, it could be worth adding it to CPLEX.jl. If I manage to make it work with @cpx\_ccall, I’ll propose the piece of code 🙂

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [June 4, 2018, 1:25am UTC](https://discourse.julialang.org/t/adding-cuts-to-a-milp-prior-to-the-solving/11395/4 "2018-06-04T01:25:09Z")

</div>

> If there is nothing generic in JuMP

The current version of JuMP does support user cuts (see [the docs](http://www.juliaopt.org/JuMP.jl/0.18/callbacks.html#user-cuts)); however, I did not mention it because the new version of JuMP is removing solver-independent callbacks since there is [plenty](https://discourse.julialang.org/t/cutting-plane-algorithm-performance-varies-with-gurobi-and-cplex/8597/2) of [evidence](https://discourse.julialang.org/t/cut-generation-not-working-lazy-constraints-lagrangian-relaxation/9948/7) that callbacks are not solver-independent.

You can read more about the upcoming changes [here](https://discourse.julialang.org/t/mathoptinterface-and-upcoming-breaking-changes-in-jump-0-19/4874).
