# JuMP solver callback arguments

**URL:** <https://discourse.julialang.org/t/jump-solver-callback-arguments/13936>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [August 23, 2018, 12:49pm UTC](https://discourse.julialang.org/t/jump-solver-callback-arguments/13936 "2018-08-23T12:49:39Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Zacharie\_ALES](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zacharie_ales/32/11144_2.png) [@Zacharie\_ALES](https://discourse.julialang.org/u/Zacharie_ALES)\
**Post date:** [August 24, 2018, 1:50pm UTC](https://discourse.julialang.org/t/jump-solver-callback-arguments/13936/3 "2018-08-24T13:50:54Z")

</div>

Thank you for your answer. It is good to know that more efficient callbacks are on their way.

I am still interested to know if the way I currently manage variables in the callback is the best I can do.  
Here is a simplified example:

```julia
using JuMP
using CPLEX

# Definition of the callback
function myCallback()

    # Do something using the current value of variables n and w
    # ...
    
end 

# Example of instance file:
# n = 3
#
# d = [1 2 10;
# 1 3 20;
# 2 3 30]
#
# w = [1 2 100;
# 1 3 50;
# 2 3 20] 
instancePath = ["./instance1.txt", "./instance2.txt", "./instance3.txt"]

for instance in instancePath

    include(instance)

    model = Model(solver = CplexSolver())
    
    # Create the model using variables n and d
    # ...

    addlazycallback(model, myCallback)

    solve(model)

    # Do something with the results
    # ...

end

```

---

_[View the full topic](https://discourse.julialang.org/t/jump-solver-callback-arguments/13936)._
