Question about outputting multiple feasible solutions
回答済みHello, 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
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
What you are looking for is Gurobi's Solution Pool feature. The documentation and examples should answer your questions.
0
投稿コメントは受け付けていません。
コメント
2件のコメント