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)
there is any way that gurobi can help to get all the possible solutions of the model?
I do not know if Gurobi can achieve that. But you could solve your model in a loop, and cut off each found solution by adding no-good-cuts (as new constraints) until the objective value changes (i.e., then you have cut off all optimal solutions of your initial model).
I think the question is not Gurobi specific. Alternative solutions might be sought by adding extra constraints and checking the objective value in each try.
It could be used in conjunction with first solving the model once and imposing the optimal objective value as new constraint: objective function == optimal value of first solve.