IPOPT solutions in the wrong order

31 views Asked by At

I am using the AMPL interface and IPOPT in C++ to solve an optimization problem. I have successfully solved several problems, but in this particular one, I've encountered an issue where the array of solutions is sometimes in the wrong sequence. For example, the 10th element can appear in the last position and I have no information about the order in which IPOPT has returned the array of solutions. The solution does not correspond to the sequence in which the variable was declared.

Just showing the important parts, i have the following in my data file:

var x_b = 
1 -1.57
2 1.57
3 -1.57
4 1.57
5 0.00
6 0.00
7 -0.00
8 20.00
9 -1.57
10 -1.57
11 1.57
12 -1.57
13 0.00
14 0.00
15 -0.00
16 20.00;

In my model file:

param x_init {i in 1..16};
param llim {i in 1..16}; 
param ulim {i in 1..16}; 
param lambda {i in 1..16}; 
set nJ := 1..16;
# Decision variables
var x_b {i in 1..16} >= llim[i], <= ulim[i]; 

minimize z: sum {j in nJ} (lambda[j]*(x_init[j]-x_b[j])^2);

With lambda, x_init, llim, ulim values being defined in the data file.

The values returned from IPOPT of the final solution seem correct, but they are in the wrong sequence. In other optimization problems i made the final order is correct. However, in this one with more variables, the described behaviour is occurring.

Is there any option in IPOPT that prevents the final solution from having values in the incorrect indexes ("shuffling the values") and maintains the original order in which they were declared?

Searched the Ipopt documentation, but couldn't find anything.

0

There are 0 answers