# GLPK callbacks in JuMP

**URL:** <https://discourse.julialang.org/t/glpk-callbacks-in-jump/39261>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [May 11, 2020, 5:01am UTC](https://discourse.julialang.org/t/glpk-callbacks-in-jump/39261 "2020-05-11T05:01:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmacherone](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jmacherone](https://discourse.julialang.org/u/jmacherone)\
**Post date:** [May 11, 2020, 5:01am UTC](https://discourse.julialang.org/t/glpk-callbacks-in-jump/39261/1 "2020-05-11T05:01:48Z")

</div>

Hello! I’ve been trying to implement a callback function using GLPK that rejects feasible solutions (with lazy constraints) when certain conditions are met. However, I understand that JuMP only allows you to retrieve solutions coming from the LP relaxation (ignoring heuristic-based incumbents). So I’m wondering if there’s any other way to achieve this. I basically want to replicate the “if where == GRB.Callback.MIP” from Gurobi.

Thanks!

---

<div class="post-metadata">

**Author:** ![leethargo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leethargo/32/6004_2.png) [@leethargo](https://discourse.julialang.org/u/leethargo)\
**Post date:** [May 11, 2020, 5:58am UTC](https://discourse.julialang.org/t/glpk-callbacks-in-jump/39261/2 "2020-05-11T05:58:28Z")

</div>

I don’t know the answer, but I suspect that this is not a limitition built into JuMP or MOI, but rather a solver-dependent behavior.

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [May 11, 2020, 3:02pm UTC](https://discourse.julialang.org/t/glpk-callbacks-in-jump/39261/3 "2020-05-11T15:02:40Z")

</div>

> [@jmacherone](#):
>
> However, I understand that JuMP only allows you to retrieve solutions coming from the LP relaxation (ignoring heuristic-based incumbents).

uh? I do not know solvers that distinguish between primal solutions found by solving an LP that gives an integer solution and solutions found by internal heuristics. I think that when a solver finds a new primal solution for any means it will trigger callbacks that are triggered when a new incumbent is found, and querying the current primal values will give you the values of the current primal solution irrelevant from its origin.

Also, as @leethargo said, this is almost surely solver behavior, unless some MOI wrapper cache things incorrectly.
