1
$\begingroup$

I have been struggling with the following question while solving an optimization problem in $\mathbb{R}_{+}^G$. Basically, I have $$\min_{y \in \mathbb{R}_{+}^G} F(y) = y^{T}\mathcal{K} + \exp(-y^{T} \mathcal{A}) \mathcal{P},$$ where $\mathcal{K}$ is a positive vector in $G\times 1$, $\mathcal{A}$ is a positive matrix in $G \times J$ and $\mathcal{P}$ is a positive vector in $J \times 1$.

But when I try to get $\nabla_{y} F(y)$ and $H_{y} F(y)$ Mathematica tells me "the tensor ... and ... have incompatible shapes.". I'm not very familiar with exponential matrices differentiation, so if anybody could give me a little help, it would be great.

{G, J, S} = {2, 2, 1}

\[ScriptCapitalK] = Table[Subscript[k, g, s], {g, 1, G}, {s, 1, S}];
\[ScriptCapitalY] = Table[Subscript[y, g, s], {g, 1, G}, {s, 1, S}];
\[ScriptCapitalA] = Table[Subscript[a, g, j], {g, 1, G}, {j, 1, J}] ;
\[CapitalRho] = Table[Subscript[\[Rho], j, s], {j, 1, J}, {s, 1, S}];

{\[ScriptCapitalY] // MatrixForm,
 \[ScriptCapitalK] //    MatrixForm,
 \[ScriptCapitalA] // MatrixForm,
 \[CapitalRho] // MatrixForm,
 E^-\[ScriptCapitalA]\[Transpose].\[ScriptCapitalY] // MatrixForm}

F[y__] :=   y\[Transpose].\[ScriptCapitalK] + E^(-y\[Transpose].\[ScriptCapitalA]).\[CapitalRho]

grad = \[ScriptCapitalK] - \[ScriptCapitalA].E^(-y\[Transpose].\[ScriptCapitalA]).\[CapitalRho]

Best,

----------------- Edit 1: The code

Grad[F[\[ScriptCapitalY]],Flatten[\[ScriptCapitalY]]]

Gives me a result I can't reproduce with only matrices operations.

$\endgroup$
2
  • 1
    $\begingroup$ Can't execute your code as written, {G,S,J} all need to be defined first $\endgroup$
    – Jason B.
    Commented Nov 23, 2015 at 13:47
  • $\begingroup$ Thank you. I missed the first line: {G, J, S} = {2, 2, 1}, but I'd like it to be general for s=1. $\endgroup$ Commented Nov 23, 2015 at 13:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.