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:
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