# Convex solver returns disordered dual variables, how to re-order?

I have the following convex optimization problem:

\begin{align*} \min_{x} &f(x) \\ \text{subject to} \\ x_{k+1} &= x_k+\cdots\qquad k=0,1,2,\ldots,N-1 \end{align*}

I managed to solve the above problem using YALMIP, using its very fast optimizer parser. Unfortunately, while optimizer can give me the dual variables associated with my $N$ constraints, it gives them out of order - in other words, the second element in the array of duals that optimizer returns does not necessarily correspond to the dual of the constraint $x_2=x_1+\cdots$.

Question: how can I recover the duals of this optimization problem, either by direct calculation or by matching the out-of-order duals that I have with the constraints?

I think this is a mathematical question rather than a programming one. In the end, I'm just asking how I can compute the duals of an already-solved optimization problem.

• You're better off asking that question on the YALMIP forum as this is very YALMIP specific. I don't see why the order would be changed for this problem, so please post an MVE on the YALMIP forum and I'll try to answer it there. May 11 '16 at 17:47
• It's not straightforward, see comments and answer to this question: math.stackexchange.com/questions/1279435/… May 12 '16 at 12:13