hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_opt_qpconvex1_sparse_option_string (e04nm)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

To supply individual optional parameters to nag_opt_qpconvex1_sparse_solve (e04nk).

Syntax

[lwsav, iwsav, rwsav, inform] = e04nm(str, lwsav, iwsav, rwsav)
[lwsav, iwsav, rwsav, inform] = nag_opt_qpconvex1_sparse_option_string(str, lwsav, iwsav, rwsav)

Description

nag_opt_qpconvex1_sparse_option_string (e04nm) may be used to supply values for optional parameters to nag_opt_qpconvex1_sparse_solve (e04nk). It is only necessary to call nag_opt_qpconvex1_sparse_option_string (e04nm) for those arguments whose values are to be different from their default values. One call to nag_opt_qpconvex1_sparse_option_string (e04nm) sets one argument value.
Each optional parameter is defined by a single character string, of up to 72 characters, consisting of one or more items. The items associated with a given option must be separated by spaces, or equals signs =. Alphabetic characters may be upper or lower case. The string
Print Level = 1
is an example of a string used to set an optional parameter. For each option the string contains one or more of the following items:
a mandatory keyword;
a phrase that qualifies the keyword;
a number that specifies an integer or double value. Such numbers may be up to 16 contiguous characters in Fortran's I, F, E or D formats, terminated by a space if this is not the last item on the line.
Blank strings and comments are ignored. A comment begins with an asterisk (*) and all subsequent characters in the string are regarded as part of the comment.
For nag_opt_qpconvex1_sparse_option_string (e04nm), each user-specified option is normally printed as it is defined, on the current advisory message unit (see nag_file_set_unit_advisory (x04ab)), but this printing may be suppressed using the keyword Nolist. Thus the statement
[lwsav, iwsav, rwsav, inform] = e04nm('Nolist', lwsav, iwsav, rwsav);
suppresses printing of this and subsequent options. Printing will automatically be turned on again after a call to nag_opt_qpconvex1_sparse_solve (e04nk) and may be turned on again at any time using the keyword List.
Optional parameter settings are preserved following a call to nag_opt_qpconvex1_sparse_solve (e04nk) and so the keyword Defaults is provided to allow you to reset all the optional parameters to their default values before a subsequent call to nag_opt_qpconvex1_sparse_solve (e04nk).
A complete list of optional parameters, their abbreviations, synonyms and default values is given in Optional Parameters in nag_opt_qpconvex1_sparse_solve (e04nk).

References

None.

Parameters

Compulsory Input Parameters

1:     str – string
A single valid option string (as described in Description and in Optional Parameters in nag_opt_qpconvex1_sparse_solve (e04nk)).
2:     lwsav20 – logical array
3:     iwsav380 int64int32nag_int array
4:     rwsav285 – double array
The arrays lwsav, iwsav and rwsav must not be altered between calls to any of the functions nag_opt_qpconvex1_sparse_option_string (e04nm), nag_opt_qpconvex1_sparse_solve (e04nk) or nag_opt_init (e04wb).

Optional Input Parameters

None.

Output Parameters

1:     lwsav20 – logical array
2:     iwsav380 int64int32nag_int array
3:     rwsav285 – double array
4:     inform int64int32nag_int scalar
Contains zero if a valid option string has been supplied and a value>0 otherwise (see Error Indicators and Warnings).

Error Indicators and Warnings

   inform=5
The supplied option is invalid. Check that the keywords are neither ambiguous nor misspelt.

Accuracy

Not applicable.

Further Comments

None.

Example

function e04nm_example


fprintf('e04nm example results\n\n');

n = int64(7);
m = int64(8);
iobj = int64(8);
ncolh = int64(7);

% A in coordinate storage form to see the problem better
a = [ 1    1    1    1    1    1    1    ...
      0.15 0.04 0.02 0.04 0.02 0.01 0.03 ...
      0.03 0.05 0.08 0.02 0.06 0.01      ...
      0.02 0.04 0.01 0.02 0.02           ...
      0.02 0.03           0.01           ...
      0.70 0.75 0.80 0.75 0.80 0.97      ...
      0.02 0.06 0.08 0.12 0.02 0.01 0.97 ...
     -200 -2000 -2000 -2000 -2000 400 400];
irow = int64([1  1  1  1  1  1  1 ...
                2  2  2  2  2  2  2 ...
                3  3  3  3  3  3    ...
                4  4  4  4  4       ...
                5  5        5       ...
                6  6  6  6  6  6    ...
                7  7  7  7  7  7  7 ...
                8  8  8  8  8  8  8]);
icol = int64([1  2  3  4  5  6  7 ...
                1  2  3  4  5  6  7 ...
                1  2  3  4  5  6    ...
                1  2  3  4  5       ...
                1  2        5       ...
                1  2  3  4  5  6    ...
                1  2  3  4  5  6  7 ...
                1  2  3  4  5  6  7]);

% Convert to compressed column storage format for e04nk
dup = 'F';
zero = 'R';
nz = int64(size(a,2));
[nz, a, irow, ha, ka, ifail] = ...
f11za( ...
       m, nz, a, icol, irow, dup, zero);

% constraint bounds
bn = -1e25; bp = 1e25;
bl = [  0    0 400 100    0  0  0 2000 bn  bn bn bn 1500 250 bn];
bu = [200 2500 800 700 1500 bp bp 2000 60 100 40 30   bp 300 bp];
start = 'C';
names = {'        '; '        '; '        '; '        '; '        '};
crname = {'...X1...'; '...X2...'; '...X3...'; '...X4...'; '...X5...'; ...
          '...X6...'; '...X7...'; '..ROW1..'; '..ROW2..'; '..ROW3..'; ...
          '..ROW4..'; '..ROW5..'; '..ROW6..'; '..ROW7..'; '..COST..'};


ns = int64(0);
xs = zeros(n+m,1);
istate = zeros(n+m, 1, 'int64');
leniz = int64(10000);
lenz  = int64(10000);

% Initialize
[cwsav,lwsav,iwsav,rwsav,ifail] = e04wb( ...
                                         'e04nk');
% Print solution option
[lwsav, iwsav, rwsav, inform] = e04nm( ...
                                       'Print Level = 1', lwsav, iwsav, rwsav);
% Optimize
[ns, xs, istate, miniz, minz, ninf, sinf, obj, clamda, ...
 user, lwsav, iwsav, rwsav, ifail] = ...
e04nk( ...
       n, m, iobj, ncolh, @qphx, a, ha, ka, bl, bu, start, names, crname, ...
       ns, xs, istate, leniz, lenz, lwsav, iwsav, rwsav);



function [hx, user] = qphx(nstate, ncolh, x, user)
  hx = zeros(ncolh, 1);

  hx(1) = 2*x(1);
  hx(2) = 2*x(2);
  hx(3) = 2*(x(3)+x(4));
  hx(4) = hx(3);
  hx(5) = 2*x(5);
  hx(6) = 2*(x(6)+x(7));
  hx(7) = hx(6);
e04nm example results


 *** E04NKA

 Parameters
 ----------

 Frequencies.
 Check frequency.........        60       Expand frequency........     10000
 Factorization frequency.       100

 LP Parameters.
 Scale tolerance.........  9.00E-01       Feasibility tolerance...  1.00E-06
 Iteration limit.........        75       Scale option............         2
 Optimality tolerance....  1.00E-06       Partial price...........        10
 Crash tolerance.........  1.00E-01       Pivot tolerance.........  2.04E-11
 Crash option............         2

 QP objective.
 Objective variables.....         7       Hessian columns.........         7
 Superbasics limit.......         7

 Miscellaneous.
 Variables...............         7       Linear constraints......         8
 LU factor tolerance.....  1.00E+02       LU update tolerance.....  1.00E+01
 LU singularity tolerance  2.04E-11       Monitoring file.........        -1
 EPS (machine precision).  1.11E-16       Print level.............         1
 Infinite bound size.....  1.00E+20       Infinite step size......  1.00E+20
 COLD start..............                 MINIMIZE................

 Workspace provided is                 IZ(   10000),  Z(   10000).
 To start solving the problem we need  IZ(     428),  Z(     358).


 Variable State     Value       Lower Bound  Upper Bound   Lagr Mult  Residual

 ...X1...    LL    0.00000           .        200.00       2361.         .
 ...X2...    BS    349.399           .        2500.0     -3.4207E-12   349.4
 ...X3...   SBS    648.853       400.00       800.00     -2.2932E-12   151.1
 ...X4...   SBS    172.847       100.00       700.00      1.9491E-12   72.85
 ...X5...    BS    407.521           .        1500.0      9.1881E-13   407.5
 ...X6...    BS    271.356           .           None    -1.4910E-13   271.4
 ...X7...    BS    150.023           .           None     1.5700E-12   150.0


 Constrnt State     Value       Lower Bound  Upper Bound   Lagr Mult  Residual

 ..ROW1..    EQ    2000.00       2000.0       2000.0     -1.2901E+04     .
 ..ROW2..    BS    49.2316          None      60.000           .      -10.77
 ..ROW3..    UL    100.000          None      100.00      -2325.         .
 ..ROW4..    BS    32.0719          None      40.000           .      -7.928
 ..ROW5..    BS    14.5572          None      30.000           .      -15.44
 ..ROW6..    LL    1500.00       1500.0          None     1.4455E+04     .
 ..ROW7..    LL    250.000       250.00       300.00      1.4581E+04     .
 ..COST..    BS  -2.988690E+06      None         None     -1.000     -2.9887E+06

 Exit E04NKA - Optimal QP solution found.

 Final QP objective value =    -1847785.

 Exit from QP problem after       9 iterations.

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015