# Accessing the root node solution

**URL:** https://discourse.julialang.org/t/accessing-the-root-node-solution/10371
**Category:** Optimization (Mathematical)
**Created:** [April 16, 2018, 8:11pm UTC](https://discourse.julialang.org/t/accessing-the-root-node-solution/10371 "2018-04-16T20:11:37Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![varun7rs](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@varun7rs](https://discourse.julialang.org/u/varun7rs)
#### Post date: [April 16, 2018, 8:11pm UTC](https://discourse.julialang.org/t/accessing-the-root-node-solution/10371/1 "2018-04-16T20:11:37Z")

</div>

I’m working on a heuristic that takes in a fractional solution and applies randomised rounding operations to get a feasible solution. In order to obtain the fractional solution, I tried solving the LP but the computation times are too high, and hence I reverted to the idea of obtaining the fractional solution at the root node of the MIP. Could you please let me know what type of callback can be used to get this fractional solution? I’m using CPLEX to solve my models.

---

<div class="post-metadata">

### Author: ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)
#### Post date: [April 16, 2018, 8:25pm UTC](https://discourse.julialang.org/t/accessing-the-root-node-solution/10371/2 "2018-04-16T20:25:15Z")

</div>

I could be wrong but I don’t think that JuMP has any utilities for accessing any of the nodes in the MIP tree, at least in version 0.18. You will likely have to resort to going through [CPLEX.jl](https://github.com/JuliaOpt/CPLEX.jl) to figure out how to do it. It’ll probably be basically the same as however it’s done in the C API, so you might want to get out the CPLEX C API docs.

---

<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: [April 16, 2018, 8:54pm UTC](https://discourse.julialang.org/t/accessing-the-root-node-solution/10371/3 "2018-04-16T20:54:01Z")

</div>

Have you looked at setting a parameter like [https://www.ibm.com/support/knowledgecenter/SSSA5P\_12.6.0/ilog.odms.cplex.help/CPLEX/Parameters/topics/NodeLim.html](https://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.0/ilog.odms.cplex.help/CPLEX/Parameters/topics/NodeLim.html)

---

<div class="post-metadata">

### Author: ![varun7rs](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@varun7rs](https://discourse.julialang.org/u/varun7rs)
#### Post date: [April 16, 2018, 8:56pm UTC](https://discourse.julialang.org/t/accessing-the-root-node-solution/10371/4 "2018-04-16T20:56:53Z")

</div>

Setting the node limit to zero ensures CPLEX stops after the root node is completely processed. But, I’m not sure if it will return the fractional solution as we are still solving a MIP or I may be wrong?

---

<div class="post-metadata">

### Author: ![varun7rs](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@varun7rs](https://discourse.julialang.org/u/varun7rs)
#### Post date: [April 16, 2018, 9:02pm UTC](https://discourse.julialang.org/t/accessing-the-root-node-solution/10371/5 "2018-04-16T21:02:30Z")

</div>

@odow I had some doubts regarding the example you illustrated in Issue [#1226](https://github.com/JuliaOpt/JuMP.jl/issues/1226) in JuMP. Could you please explain accessing the Gurobi API for the [simplelazy.jl](https://github.com/JuliaOpt/JuMP.jl/blob/master/examples/old/simplelazy.jl) problem in /JuMP.jl/old/examples?

---

<div class="post-metadata">

### Author: ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)
#### Post date: [April 16, 2018, 10:03pm UTC](https://discourse.julialang.org/t/accessing-the-root-node-solution/10371/6 "2018-04-16T22:03:54Z")

</div>

> [@varun7rs](#):
>
> I tried solving the LP but the computation times are too high

May you elaborate? MILP solvers solve a ton of LPs. If you only want the root node’s solution, then it should faster to solve your LP once using CPLEX for example.

---

<div class="post-metadata">

### Author: ![varun7rs](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@varun7rs](https://discourse.julialang.org/u/varun7rs)
#### Post date: [April 17, 2018, 5:16am UTC](https://discourse.julialang.org/t/accessing-the-root-node-solution/10371/7 "2018-04-17T05:16:05Z")

</div>

Typically, the MIP presolve is capable of doing more reductions as it can exploit the integrality of the variables. So, instead of solving the LP relaxation of the problem, one can solve the MIP and obtain the root node solution, which is faster to compute. Ref :[CPLEX Forum](https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014553011&ps=25)
