# Joint Beam-Forming Optimization for Active-RIS-Assisted Internet-of-Things Networks with SWIPT
## 3 Proposed Algorithm
### Optimizing \(P\),\(\Theta\) Given \(w_{k},\rho_{k},t_{k}\)
}^{K}\mathrm{Tr}\Big{(}\mathrm{S}_{k,j}\mathrm{T}\Big{)} -\sigma_{v}^{2}\mathrm{Tr}\Big{(}\widetilde{Z}_{k}\mathrm{T}\Big{)}\geq \widetilde{\sigma}_{k}, \tag{34}\]  
\[\theta^{H}Q_{i}\theta =\mathrm{Tr}\Big{(}\widetilde{Q}_{k}\mathrm{T}\Big{)}\] \[\theta^{H}\theta =\mathrm{Tr}(\mathrm{T})\] \[\sum_{i=1}^{K}\mathrm{Tr}\Big{(}\widetilde{Q}_{k}\mathrm{T}\Big{)} +\sigma_{v}^{2}\mathrm{Tr}(\mathrm{T})\leq p_{\mathrm{max}}, \tag{35}\] \[\sum_{j=1}^{K}\mathrm{Tr}\Big{(}\mathrm{S}_{k,j}\mathrm{T}\Big{)}+ \left|a_{k,j}\right|^{2}+\sigma_{v}^{2}\mathrm{Tr}\Big{(}\widetilde{Z}_{k} \mathrm{T}\Big{)}\geq\frac{t_{k}^{2}}{1-\rho_{k}}. \tag{36}\]  
In this way, the optimization problem (P4) is transformed into finding a suitable T as follows:  
\[(\mathrm{P5}):\mathrm{FindT}, \tag{37}\]  
\[\mathrm{T}\succeq 0, \tag{38}\]  
where \(\widetilde{Q}_{k}\) and \(\widetilde{Z}_{k}\) in (35) and (36) have zero rows and zero columns more than the other matrices. After the transformation of (P5) into an SDP problem, we can use CVX software (version 3.0) to solve this convex problem. Due to the SDR technique, the resulting solution does not satisfy the rank-one constraint. To obtain a solution with only a unique rank, a penalty-based approach can be used. The rank one constraint can be described in the following equivalent form:  
\[\left\|\mathrm{T}\right\|_{*}-\left\|\mathrm{T}\right\|_{2}\leq 0.\]  
For any given \(\mathrm{T}\in\mathbb{H}^{m\times n}\), the following equation holds if and only if the rank of T is 1:  
\[\left\|\mathrm{T}\right\|_{*}=\sum_{i}\sigma_{i}\geq\left\|\mathrm{T}\right\| _{2}=\max_{i}\{\sigma_{i}\},\]  
where \(\sigma_{i}\) is the \(i\)th singular value of T. After adding the rank-one constraint, (P5) can be rewritten in the following form:  
\[(\mathrm{P6}):\min_{\mathrm{T}}\frac{1}{2\mu}\big{(}\left\|\mathrm{T}\right\| _{*}-\left\|\mathrm{T}\right\|_{2}\big{)} \tag{39}\]  
\[\mathrm{s.t. }\frac{\mathrm{Tr}(\mathrm{S}_{k,k}\mathrm{T})+\left|a_{k,k} \right|^{2}}{\gamma_{k}}-\sum_{ \begin{subarray}{c}j=1\\ j\
eq k\end{subarray} }^{K}\mathrm{Tr}\Big{(}\mathrm{S}_{k,j}\mathrm{T}\Big{)} -\sigma_{v}^{2}\mathrm{Tr}\Big{(}\widetilde{Z}_{k}\mathrm{T}\Big{)}\geq \widetilde{\sigma}_{k}, \tag{40}\]  
\[\sum_{i=1}^{K}\mathrm{Tr}\Big{(}\widetilde{Q}_{k}\mathrm{T}\Big{)}+\sigma_{v} ^{2}\mathrm{Tr}(\mathrm{T})\leq p_{\mathrm{max}}, \tag{41}\]  
\[\sum_{j=1}^{K}\mathrm{Tr}\Big{(}\mathrm{S}_{k,j}\mathrm{T}\Big{)}+\left|a_{k,j }\right|^{2}+\sigma_{v}^{2}\mathrm{Tr}\Big{(}\widetilde{Z}_{k}\mathrm{T}\Big{)} \geq\frac{t_{k}^{2}}{1-\rho_{k}}, \tag{42}\]  
\[\mathrm{T}\succeq 0, \tag{43}\]  
where \(\mu\) is the penalty factor, and only when the value of \(\mu\) reaches a very small value does (P6) obtain a solution with only a unique rank. It is worth noting that (P6) is non-convex because its optimization objective function is the subtraction of two convex functions, which does not guarantee that the resulting difference is necessarily convex. This problem can be solved by using the SCA technique. Using Taylor series expansion to represent \(\Psi(\mathrm{T})\)its first-order expansion can be used in place of \(\left\|\mathrm{T}\right\|_{2}\), and this is the global minimum since \(\Psi(\mathrm{T})\) is a convex function and its first-order expansion is as follows:  
\[\Psi(\mathrm{T})\geqslant\Psi(\mathrm{T}^{i})+\mathrm{Tr}\Big{(}\
abla_{ \mathrm{T}}^{\mathrm{H}}\Psi\Big{(}\mathrm{T}^{i}\Big{)}\Big{(}\mathrm{T}- \mathrm{T}^{i}\Big{)}\Big{)}\triangleq\widetilde{\Psi}(\mathrm{T}), \tag{44}\]  
where \(\
abla_{\mathrm{T}}\left\|\mathrm{T}^{i}\right\|_{2}=\
abla_{\mathrm{T}} \mathrm{u}_{1}^{H}\mathrm{T}^{i}\mathrm{u}_{1}=\
abla_{\mathrm{T}}\mathrm{Tr }\Big{(}\mathrm{T}^{i}\mathrm{u}_{1}\mathrm{u}_{1}^{H}\Big{)}=\mathrm{u}_{1} \mathrm{u}_{1}^{H}\). Inside \(\mathrm{u}_{1}\) is the eigenvector, which corresponds to the largest eigenvalue of \(\mathrm{T}^{i}\). (P6) already has an optimization objective function inside and hence is a feasibility problem; any solution that satisfies the constraints and has a unique rank is optimal.