Aggregation may be harmful but cannot always be avoided in the analysis of complex econometric models. It should be carried out intelligently by choosing ein aggregative model optimally for modes of aggregation speeified in advance, i.e. minimizing the bias introduced by aggregation and mea-sured by a formula based on the mean-square forecast error. This leads to an integer programming problem of high computational complexity. In this paper the optimization heuristic Threshold Accepting is used to over-come this problem. It is implemented for the optimal aggregation of a long series of Swedish internal and external price indices. The problem of heteroskedasticity due to inflation is tackled by introducing an estimator of the sample covariance matrix in the formula for the mean-square forecast error and employing Euclidean distance; this is compared with results obtained by using an alternative objective funetion based on Mahalanobis distance. The algorithm and the resulting groupings are presented.