Trying to work with maximum-value causes model is infeasible-error
回答済みHello,
I'm trying to solve an optimization problem by the gurobi optimizer, but I'm getting the model is infeasible message.
The following part causes the problem:
mf = {(i,j): opt_model.addVar(vtype=grb.GRB.CONTINUOUS,name="mf_{0}_{1}".format(i,j)) for i in set_I for j in set_J}
.
.
.
for j in range(0, num_tasks):
# Constraint: start-time of every task in group i is greater than group-start
opt_model.addConstr(
ts_vars[i,j] >= gs_vars[i]
)
if j > 0:
# Constraint: get the largest finish-time of preceding tasks as start-time for task j
opt_model.addConstr(
mf[i,j] == grb.max_(tf_vars[i,j_dash] for j_dash in get_preceding_tasks(set_J,j))
)
opt_model.addConstr(
ts_vars[i,j] >= mf[i,j]
)
# Constraint: finish-time of every task is start-time + runtime of the task
opt_model.addConstr(
tf_vars[i, j] + eps >= grb.quicksum(
x_vars[i, j, k] * get_runtime(workloads[j], tasktypes[j], max_widths[j], k, i,
cores) for k in set_K) + ts_vars[i, j]
)
ts_vars, tf_vars and gs_vars are of the type continous.
i and j are integers.
x_vars are of the type binary. For every j there is exactly one x[i,j,k], so e.g. the sum of x[i,j,k] and x[i',j,k] would be 1.
the get_runtime-function calculates the runtime of type float for every task (it can be 0.0).
gs_vars stands for the start-time of a group, it is calculated before.
The start-time of every task should be the maximum of the finish-times of the preceeding tasks in the group, so that tasks run one after the other.
Both constraints,
# Constraint: get the largest finish-time of preceding tasks as start-time for task j and
# Constraint: finish-time of every task is start-time + runtime of the task
do not work together. If I use only one of them, the program runs (of course, with unusable results).
I'm not sure if the mathematical approach is incorrect or if I simply did some programming errors, as I am very new to gurobi.
Any help would be much appreciated.
With kind regards
Frank
-
正式なコメント
This post is more than two 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. -
Hi Frank,
Did you already try to follow the suggestions in this article about how to find out why some model is infeasible?
Best regards,
Mario0 -
Hi Mario,
thanks for the immediate reply.
Well, I read about computing an IIS but I thought this will be overdoing for my problem.
Meanwhile I tried to set up an IIS and I'm examinating the result.
Thanks again and best regards
Frank0
投稿コメントは受け付けていません。
コメント
3件のコメント