I have a function for that I want to find the minimum. The function calculates the distance between two sets where a set is defined as matix of row vectors $ D = [ d_1, d_2, ..., d_n]$, $d_n$ is a $m \times 1$ vector. The distance metric is:
$$ d(x_1,x_2) = -(x_1 - x_2)^T G (x_1 - x_2) + x_1^T M x_2 $$ $M$ and $G$ are $m \times m$ matrices.
In order to make this distance function suitable for sets I need to find the weighted mean for both sets ( $Da$ where $a$ is a weighting vector of $n \times 1$) that minimize the distance:
$$ \min_{a,b} - (D_1a - D_2 b)^T G (D_1a - D_2 b) + (D_1a)^T M D_2 b $$ with $$ \sum a_i = 1, \sum b_i = 1 $$
My question is, which algorithm can I use to find $a,b$ and how can I implement it in Matlab?