I faced the following problem recently. When I was working on an electricity market clearing problem, it is hard for me to derive the dual problem of it, which is necessary to obtain the optimal price.
The original primal problem: \begin{align} &\mathop{Maximize}_{p_g^G, p_d^D, \theta_n}{\quad SW = \sum_d U_d p_d^D - \sum_g C_g p_g^G}\\ &subject\quad to:\\ &0\leq p_d^D \leq \overline{P}_d^D \qquad \forall d \\ &0\leq p_g^G \leq \overline{P}_g^G \qquad \forall g \\ &\sum_{d \in \Psi_n} p_d^D + \sum_{m \in \Omega_n}B_{n,m}(\theta_n-\theta_m)- \sum_{g \in \Psi_n} p_g^G=0 :\lambda_n \forall n \\ &-F_{n,m}\leq B_{n,m}(\theta_n-\theta_m) \leq F_{n,m} \qquad \forall n, \forall m \\ &\theta_{ref} = 0 \end{align}
At first, I do it in this way: I transform the problem into standard format: \begin{align} &\mathop{Minimize}_{p_g^G, p_d^D, \theta_n}{\quad SW = -\sum_d U_d p_d^D + \sum_g C_g p_g^G}\\ &subject\quad to:\\ & -p_d^D \leq 0 &:\mu_{d1}^D\\ & -p_g^G \leq 0 &:\mu_{g1}^G\\ & p_d^D-\overline{P}_d^D \leq 0 &:\mu_{d2}^D\\ & p_g^G-\overline{P}_g^G \leq 0 &:\mu_{g2}^{G}\\ &\sum_{d \in \Psi_n} p_d^D + \sum_{m \in \Omega_n}B_{n,m}(\theta_n-\theta_m)- \sum_{g \in \Psi_n} p_g^G=0 \quad \forall n &:\lambda_n \\ &-F_{n,m}- B_{n,m}(\theta_n-\theta_m) \leq 0 &:\underline{\eta}_{n,m} \\ & B_{n,m}(\theta_n-\theta_m) - F_{n,m} \leq 0 &:\overline{\eta}_{n,m}\\ &\theta_{ref} =0 &:\gamma \end{align}
And then I derive the lagrangian function:
\begin{equation} \begin{split} L(p,\theta,\mu, \lambda, \eta) = &-\sum_d U_d p_d^D + \sum_g C_g p_g^G - \sum_d{\mu_{d1}^D p_d^D} \\ &- \sum_g {\mu_{g1}^{D} p_g^G} + \sum_d{\mu_{d2}^D(p_d^D - \overline{P}_d^D)} + \sum_g{\mu_{g2}^G(p_g^G-\overline{P}_g^G)} \\ &+ \sum_n{\lambda_n (\sum_{d \in \Psi_n}{p_d^D} + \sum_{m \in \Omega_n}{B_{n,m}(\theta_n-\theta_m)}- \sum_{g \in \Psi_n}{p_g^G}}) \\ &- \sum_{n,m} {\underline{\eta}_{n,m}(F_{n,m}+B_{n,m}(\theta_n-\theta_m))} \\ &+ \sum_{n,m} {\overline{\eta}_{n,m}(B_{n,m}(\theta_n-\theta_m)-F_{n,m})}+ \gamma \theta_1 \end{split} \end{equation}
From which I can get the following problem: \begin{equation} \begin{split} &\mathop{Minimize}_{p,\theta} L(p,\theta,\mu, \lambda, \eta) \\ &= -\sum_d \mu_{d2}^D \overline{P}^D_d - \sum_g \mu_{g2}^G \overline{P}_g^G - \sum_{n,m} \underline{\eta}_{n,m}F_{n,m} - \sum_{n,m} \overline{\eta}_{n,m}F_{n,m} \end{split} \end{equation}
However, for your information, The answer is \begin{align} &\mathop{Minimize}_{\mu,\eta,\lambda,\gamma} \sum_d \mu_{d2}^D \overline{P}^D_d + \sum_g \mu_{g2}^G \overline{P}_g^G + \sum_{n,m} \underline{\eta}_{n,m}F_{n,m} + \sum_{n,m} \overline{\eta}_{n,m}F_{n,m}\\ &subject \quad to:\\ & -U_d+\mu_d^D+\lambda_{n \in \Psi_d} \geq 0 :p_d^D \forall d\\ & C_g+\mu_g^G-\lambda_{n \in \Psi_d} \geq 0 :p_g^G \forall g\\ &\sum_{m \in \Omega_n} B_{n,m} (\lambda_n-\lambda_m+\overline{\eta}_{n,m}-\overline{\eta}_{m,n}-\underline{\eta}_{n,m}-\underline{\eta}_{m,n})+\gamma=0 :\theta_n \quad n=ref\\ &\sum_{m \in \Omega_n} B_{n,m} (\lambda_n-\lambda_m+\overline{\eta}_{n,m}-\overline{\eta}_{m,n}-\underline{\eta}_{n,m}-\underline{\eta}_{m,n})=0 :\theta_n \quad \forall{n/ref} \end{align} Which I don't know how to obtain. (I know how to do simple primal-dual transformation but this is somehow hard for me to do)
Anyone know how to obtain the dual format of the primal problem shown above? Thanks for your help in advance.