I have the following facility location model:
m = Model(solver=GLPKSolverMIP()) @variable(m, sf[1:N], Bin) @variable(m, cf[c=1:M,f=1:N], Bin) @objective(m, Min, dot(f_s,sf)+sum(cf[c=j,f=i]*euclidean(c_pos[j],f_pos[i]) for i=1:N,j=1:M)) @constraint(m, demand_constr[i=1:N], dot(cf[c=1:M,f=i],c_d) <= f_c[i]) @constraint(m, served_constr[j=1:M], sum(cf[c=j,f=1:N]) == 1) @constraint(m, setup_constr[i=1:N], sf[i] >= sum(cf[c=1:M,f=i])/M)
Adding a heuristic:
Which is defined as:
function myheuristic(cb) addsolution(cb) end
Should basically do nothing, right?
It tells me that the solution is infeasible.
Anyway if I don’t use the heuristic I get an optimal solution.
Can anyone explain this behavior?
If I use the code mentioned here: http://jump.readthedocs.io/en/latest/callbacks.html
It works also if I use the same useless heuristic as here and using GLPK as well.
It seems like it’s having problems with Arrays of Jump Variables.
If I use this strange problem:
# Define our variables to be inside a box, and integer @variable(m, 0 <= x[1:10] <= 2, Int) @variable(m, 0 <= y <= 2, Int) # Optimal solution is trying to go towards top-right corner (2.0, 2.0) @objective(m, Max, sum(x) + 2y) # We have one constraint that cuts off the top right corner @constraint(m, y + sum(x) <= 3.5) @constraint(m, constr[i=2:10], x[i-1] >= x[i])
then it says infeasible as well if I do nothing in the heuristic function.
Looks like Gurobi doesn’t have a problem with that and is much faster as always. (Would like to have an OS solver which is as good as Gurobi )