1
votes

I'm trying to solve a model using Julia-JuMP. The following is the outline of the model that I created. Here, z[i,j] is a binary variable and d[i,j] is the cost for which z[i,j]=1. My constraint creates an infinite number of constraint and hence I need to use a separation algorithm to solve it. First, I solve the model without any constraint, so the answer to all variables z[i,j] and d[i,j] are zero. Then, I'm including the separation algorithm (which is given inside the if condition). Even though I'm including if z_value == 0, z_values are not passing to it. Am I missing something in the format of this model?

m = Model(solver=GurobiSolver())

@variable(m, z[N,N], Bin)
@variable(m, d[N,N]>=0)

@objective(m, Min, sum{ d[i,j]*z[i,j], i in N, j in N} )

z_value = getvalue(z)
d_value = getvalue(d)

if z_value == 0
    statement
elseif z_value == 1 
  statement
end

@constraint(m, sum{z[i,j], i in N, j in N}>=2)

solve(m)

println("Final solution: [ $(getvalue(z)), $(getvalue(d)) ]")
1

1 Answers

2
votes

You're multiplying z by d which both are variables, hence your model is non-linear,

Are the costs d[i,j] constant or really a variable of the problem ? If so you need to use a non-linear solver