Note: This question is related to an earlier question of mine that I decided to vote to be closed and narrow down my problem in this question so it might maybe help people facing a similar problem.
I'm trying to solve the constrained optimization problem
$$\min_{\mathbf{A}}\quad l(\mathbf{A}) $$ with $$l(\mathbf{A}) = -\Phi\cdot (\mathbf{AB})$$ being the log-likelihood of the model I'm trying to fit ( originally a maximization problem but since MATLAB only does minimization I changed it).
$\mathbf{A}$ is a matrix with $m \times r$ coefficients of $m$ polynomials of order $r-1$ and $\mathbf{B}$ is the design matrix with $r \times n$ entries. $$\mathbf{AB} = \begin{bmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,r} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,r} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,r} \end{bmatrix} \begin{bmatrix} b_{1,1} & b_{1,2} & \cdots & b_{1,n} \\ b_{2,1} & b_{2,2} & \cdots & b_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ b_{r,1} & b_{r,2} & \cdots & b_{r,n} \end{bmatrix} = \begin{bmatrix} \gamma_{1,1} & \gamma_{1,2} & \cdots & \gamma_{1,n} \\ \gamma_{2,1} & \gamma_{2,2} & \cdots & \gamma_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ \gamma_{m,1} & \gamma_{m,2} & \cdots & \gamma_{m,n} \end{bmatrix}=\Gamma $$ subject to the constraints
- $\sum_{j=1}^{m} \gamma_{j,i} = 1 \quad\forall i\in\{1,\cdots,n\}$
- $0 \leq \gamma < 1 \quad \forall \gamma\in \Gamma$
However, I'm struggling to formulate these constraints in a form that MATLABs fmincon function accepts. This is hard for me because 1) the constraints don't directly apply to $\mathbf{A}$ and 2) althought the function accepts a matrix as input (in my case $\mathbf{A}$) it will be passed to the linear constraints as a column vector $\mathbf{a}$ of form
$$\mathbf{a} = \begin{pmatrix} a_{1,1}\\ a_{2,1}\\ \vdots\\ a_{m,1}\\ a_{1,2}\\ \vdots\\ a_{m,2}\\ \vdots\\ a_{m,r}\\ \end{pmatrix} \\ $$
As can be taken from the link, the function accepts linear constraints in the form (I adjusted the notation to be consistent with this post)
- $\mathbf{C} \mathbf{a} \leq \mathbf{d}$
- $\mathbf{D} \mathbf{a} = \mathbf{e}$
- $\mathbf{L} \leq \mathbf{a} \leq \mathbf{U}$
But I've since failed formulating my constraints in a form that fits the function and would like to ask your help with this. Is this even possible?
Another option would be to include them as non-linear constraints, which are defined as functions and get $\mathbf{A}$ instead of $\mathbf{a}$ passed to them.