GLPK callbacks in JuMP

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.


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.

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.