I have a model as follows
VC_model2 = direct_model(Gurobi.Optimizer())
@variable(VC_model2, y[i=initial:n], binary=true)
@variable(VC_model2, x[i=initial:n], binary=true)
################################################
@constraint(VC_model2, sum(x[j] for j in initial:n) == k_val)
for j=initial:n
@constraint(VC_model2,y[j] <= sum(x[i] for (j,i) in E))
end
@objective(VC_model2, Max, sum(y[j] for j in initial:n))
optimize!(VC_model2)
for some reason, I have to solve the model multiple times and in each iteration, I have to add a constraint, what I did is the following
add_constraint(VC_model2,sum(x[i] for i in sol) <= k_val-1)
but it gives an error message
LoadError: MethodError: no method matching isless(::AffExpr, ::Int64)
Closest candidates are:
isless(::Union{StatsBase.PValue, StatsBase.TestStat}, ::Real) at C:\Users\Ahmad Anaqreh\.julia\packages\StatsBase\XgjIN\src\statmodels.jl:90