second order cone contraint
回答済みHello,
I want to solve a model in gurobipy and I am dealing with the following constraint:
\begin{equation}
- (\sum_{\tau=1}^t x_\tau + \sum_{\tau=2}^t (X_\tau) \mu - t\mu) \leq F^{-1}(\alpha)\sqrt{\sum_{\tau=1}^{t-1} (1-X_{\tau+1})^2 \sigma^2 +\sigma^2}
\end{equation}
I have coded as: for t in range(1,periods+1):
m.addConstr(rhs[t]==gp.quicksum((1-X[tau+1])**2 for tau in range(1,t))+1)
m.addConstr(lhs[t]==-(gp.quicksum(x[tau] for tau in range(1,t+1))+gp.quicksum(X[tau]*mean for tau in range(2,t+1))-t*mean)/(s*norm.ppf(alpha)))
m.addConstr(lhs[t]*lhs[t]-rhs[t]>=0)
However, this is not recognized as SOC. Could anyone help how to represent it to be recognize as SOC?
-
Hi Azadeh,
Can you try substituting your expression for rhs directly into the soc constraint, i.e.
m.addConstr(lhs[t]*lhs[t] >= gp.quicksum((1-X[tau+1])**2 for tau in range(1,t))+1)
and then remove the rhs variable and the quadratic equality constraint it appears in (a quadratic equality constraint is non-convex). I expect this will resolve the issue.
- Riley
0
サインインしてコメントを残してください。
コメント
1件のコメント