[37] | 1 | function constant_data = setup_fmincon_params(interfacedata) |
---|
| 2 | |
---|
| 3 | monomtable = interfacedata.monomtable; |
---|
| 4 | nonlinearindicies = interfacedata.nonlinearindicies; |
---|
| 5 | linearindicies = interfacedata.linearindicies; |
---|
| 6 | |
---|
| 7 | constant_data.interfacedata = interfacedata; |
---|
| 8 | constant_data.monomtable = monomtable; |
---|
| 9 | constant_data.nonlinearindicies = nonlinearindicies; |
---|
| 10 | constant_data.linearindicies = linearindicies; |
---|
| 11 | |
---|
| 12 | % Figure out if YALMIP easily can compute the gradient of the objective |
---|
| 13 | % This will done completely general later |
---|
| 14 | constant_data.SimpleLinearObjective = 0; |
---|
| 15 | constant_data.SimpleQuadraticObjective = 0; |
---|
| 16 | constant_data.SimpleNonlinearObjective = 1; |
---|
| 17 | constant_data.SimpleNonlinearConstraints = 0; |
---|
| 18 | if isempty(interfacedata.evalMap) |
---|
| 19 | if nnz(interfacedata.c(nonlinearindicies)) == 0 |
---|
| 20 | if (nnz(interfacedata.Q)==0) |
---|
| 21 | constant_data.SimpleLinearObjective = 1; |
---|
| 22 | else |
---|
| 23 | if nnz(interfacedata.Q(nonlinearindicies,nonlinearindicies))==0 |
---|
| 24 | constant_data.SimpleQuadraticObjective = 1; |
---|
| 25 | end |
---|
| 26 | end |
---|
| 27 | end |
---|
| 28 | if isequal(interfacedata.K.s,0) & isequal(interfacedata.K.q,0) & isequal(interfacedata.K.r,0) |
---|
| 29 | constant_data.SimpleNonlinearConstraints = 1; |
---|
| 30 | end |
---|
| 31 | else |
---|
| 32 | constant_data.SimpleNonlinearObjective = 0; |
---|
| 33 | end |
---|
| 34 | constant_data.nonlinearineval = 0; |
---|
| 35 | % Check if there are any nonlinear expression in evaluation based operators |
---|
| 36 | if ~isempty(interfacedata.evalMap) |
---|
| 37 | temp = []; |
---|
| 38 | for i = 1:length(interfacedata.evalMap) |
---|
| 39 | temp = [temp interfacedata.evalMap{i}.variableIndex]; |
---|
| 40 | end |
---|
| 41 | if any(interfacedata.variabletype(temp)) |
---|
| 42 | constant_data.nonlinearineval = 1; |
---|
| 43 | end |
---|
| 44 | end |
---|
| 45 | |
---|
| 46 | |
---|