Gurobi solving SOCP problem
ユーザーの入力を待っています。Hi,
I'm using Gurobi to solve an SOCP problem and have tried two different formulations.
In the first approach, I define the constraint directly as follows:
m.addConstrs(v[k,q,i,h]**2- (4*(1 + 1) * w0[q][0]
+ 4*gp.quicksum(1 * w[q][i_prime][h_prime]*(x[i_prime,h_prime]**2) for i_prime in var_i for h_prime in var_h)
+ ((w0[q][0]+gp.quicksum(w[q][i_prime][h_prime]*x[i_prime,h_prime] for i_prime in var_i for h_prime in var_h))-(2-pi[k,q,i,h]))**2) >= 0 for k in var_k for q in var_q for i in var_i for h in var_h)
In the second approach, I introduce an auxiliary variable z3 to represent the third long term:
z3= m.addVars(K,Q,N,H, vtype=GRB.CONTINUOUS,lb=-gp.GRB.INFINITY, name="z3")
m.addConstrs((w0[q][0]+gp.quicksum(w[q][i_prime][h_prime]*x[i_prime,h_prime] for i_prime in var_i for h_prime in var_h))-2+pi[k,q,i,h]
== z3[k,q,i,h] for k in var_k for q in var_q for i in var_i for h in var_h)
#SOCP
m.addConstrs(v[k,q,i,h]**2- (4*(1 + 1) * w0[q][0]
+ 4*gp.quicksum(1 * w[q][i_prime][h_prime]*(x[i_prime,h_prime]**2) for i_prime in var_i for h_prime in var_h)
+ z3[k,q,i,h]**2) >= 0 for k in var_k for q in var_q for i in var_i for h in var_h)
The first formulation produces an optimal solution, but the second one results in an infeasible or unbounded model. I suspect there might be an issue with how I introduced z3.
Could you please help me check whether I made any mistakes in defining the new variable and modifying the constraint? Any guidance on how to fix this issue would be greatly appreciated. Thank you!
-
Hi Yutian,
I would start with this article and see what sort of IIS you can compute:
How do I determine why my model is infeasible?- Riley
0
サインインしてコメントを残してください。
コメント
1件のコメント