Let $A\in\mathbb{R}^{n\times n}$ be a stable matrix (i.e., the eigenvalues of $A$ have negative real parts). Consider the following optimization problem in $X \in \mathbb{R}^{n \times n}$
$$\begin{array}{ll} \text{maximize} & \mbox{tr} \left(P X \right)\\ \text{subject to} & \mbox{tr}(X) = 1\\ & X \succeq 0\end{array}$$
where $X \succeq 0$ denotes that $X$ is positive semidefinite, and $P$ is the solution of the following Lyapunov equation $$ AP+PA^\top =-X. $$
Question: Does the above-formulated problem admit a closed-form solution?
An equivalent formulation. We can rewrite the above optimization problem in the following equivalent way. Consider the optimization problem in $P \in \mathbb{R}^{n \times n}$, $P\succeq 0$,
$$\begin{array}{ll} \text{minimize} & \mbox{tr} \left(PAP \right)\\ \text{subject to} & \mbox{tr}(PA) = -1/2\\ & AP+PA^\top \preceq 0\\ & P \succeq 0\end{array}$$