interfacedata.aux_variables

20 views
Skip to first unread message

Michiel Jansen

unread,
Mar 9, 2015, 5:30:04 AM3/9/15
to yal...@googlegroups.com
Hi,

I was wondering what the interfacedata.aux_variables exactly do? As they add variables to my problem with new unexplainable initial conditions and upper and lower bounds, which then feed into the solver.

I was looking into the code, as I have a highly nonconvex problem, which I like to solve with fmincon sqp or KNITRO. But it is really prone to give 'infeasible solution' or local minimum results with even a simplified system, while there is an easy global minimum result.

Thanks in advance!

Kind regards,
Michiel

Johan Löfberg

unread,
Mar 9, 2015, 5:42:00 AM3/9/15
to yal...@googlegroups.com
In this

sdpvar x
[~,~,~,M]=export(exp(x+1) <= 1,x)

The model is normalized into

sdpvar x y
[~,~,~,M]=export([y == x + 1, exp(y) <= 1,x)

The variable y is part of the aux_variable. In addition to that, the expression exp has a place holder variable too. Hence, in the final model there are two actual variables (x and y) but three variable indices (x,exp(x,y),y)

>> M.aux_variables

ans
=

     
2     3

>> M.evalVariables

ans
=

     
2

>> M.evalMap

ans
=

   
[1x1 struct]

>> M.evalMap{1}

ans
=

              fcn
: 'exp'
              arg
: {[1x1 sdpvar]  [1x1 sdpvar]}
             
var: [1x1 sdpvar]
         computes
: 2
             
Hash: 21491
    variableIndex
: 3
       properties
: [1x1 struct]
    argumentIndex
: 1





Johan Löfberg

unread,
Mar 9, 2015, 5:49:10 AM3/9/15
to yal...@googlegroups.com
For most models, the aux_variables should be initialized based on the initial guesses on the original variables. If this fails on your model, I would be interested to see the model.

Michiel Jansen

unread,
Mar 9, 2015, 7:45:05 AM3/9/15
to yal...@googlegroups.com
Thanks! I could verify the initial values of the aux_variables and they make sense.

However, I am taking the sqrt(x(i).^2-x(i+1).^2), hence it only decomposes the sqrt. Is this a problem?

Regards,
Michiel

Johan Löfberg

unread,
Mar 9, 2015, 8:04:18 AM3/9/15
to yal...@googlegroups.com
Not sure what you are saying about the decompose thingy. YALMIP will introduce a new variable and write it as sqrt(z), z == x^2-y^2

Are you sure it is the initial conditions which cause the problems?

The following problem correctly initializes everything, fmincon starts from a feasible point according to the display, but diverges and loses feasibility

 sdpvar x y
p
= sqrtm(x^2-y^2);
assign
(x,10);
assign
(y,2);
optimize
([],p,sdpsettings('usex0',1))
Iter F-count            f(x)  Feasibility   optimality         step
   
0       1    9.797959e+00    0.000e+00    5.090e-02
   
1       2    9.795364e+00    5.737e-06    5.085e-02    5.091e-02
   
2       3    9.782362e+00    1.439e-04    5.092e-02    2.549e-01
   
3       4    9.717002e+00    3.615e-03    5.127e-02    1.276e+00
   
4       5    9.381111e+00    9.271e-02    5.306e-02    6.423e+00
   
5       7    7.414765e+00    4.089e-01    6.719e-02    3.308e+01
   
6      11    6.421402e+00    1.019e+00    7.762e-02    1.377e+01
   
7      12   -4.728721e-01    7.877e+00    6.027e-01    4.202e+01
   
8      13   -5.484787e+01    7.423e+00    1.835e-01    6.751e+00
   
9      22   -5.452357e+01    3.962e+00    1.838e-01    3.384e-01

Switch algorithm and it succeeds
assign(x,10);
assign
(y,2);
optimize([],p,sdpsettings('usex0',1,'fmincon.algorithm','sqp'))
                                                         
Norm of First-order
 
Iter F-count            f(x) Feasibility  Steplength        step  optimality
   
0       1    9.797959e+00   0.000e+00                           5.103e-02
   
1       2    9.795361e+00   5.751e-06   1.000e+00   5.097e-02   5.092e-02
   
2       3    9.782356e+00   1.439e-04   1.000e+00   2.549e-01   5.099e-02
   
3       4    9.716982e+00   3.616e-03   1.000e+00   1.276e+00   5.133e-02
   
4       5    9.381015e+00   9.273e-02   1.000e+00   6.424e+00   5.307e-02
   
5       7    7.413958e+00   4.092e-01   1.000e+00   3.309e+01   6.721e-02
   
6       9    1.192093e-07   4.049e+00   1.000e+00   5.511e+01   4.194e+06
   
7      10    1.056170e-07   1.718e-01   1.000e+00   4.598e-01   5.398e+05
   
8      11    1.212986e-08   3.225e-04   1.000e+00   1.891e-02   3.650e+07
   
9      12    1.216887e-07   1.124e-09   1.000e+00   3.545e-05   6.104e+05
   
10      13    1.490116e-08   3.331e-15   1.000e+00   1.051e-10   1.192e-07



Reply all
Reply to author
Forward
0 new messages