Question about outputting multiple feasible solutions
AnsweredHello, I have a question about outputting more feasible solutions. Although similar answers already exist, can you illustrate it again with the following example?
The following is a simple 0,1 integer programming problem. It is obvious that there are two optimal solutions ((1 0 1) (0 1 1)). How can I output these two solutions? Also, what does "Solution count" mean in the output?
thanks for your help!
# from gurobipy import *
#
# m = Model("simple_example")
#
# x = m.addVar(vtype=GRB.BINARY, name="x")
# y = m.addVar(vtype=GRB.BINARY, name="y")
# z = m.addVar(vtype=GRB.BINARY, name="z")
#
# m.setObjective(x + y + 2 * z, GRB.MAXIMIZE)
#
# m.addConstr(x + y + 3 * z <= 4, "c0")
# m.addConstr(x + y >= 1, "c1")
#
# m.optimize()
#
# for v in m.getVars():
# print(v.varName, v.x)
0

What you are looking for is Gurobi's Solution Pool feature. The documentation and examples should answer your questions.
0
Please sign in to leave a comment.
Comments
1 comment