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_mip_ilp_print (h02bv)

Purpose

nag_mip_ilp_print (h02bv) prints the solution to a linear or integer programming problem computed by nag_opt_lp_solve (e04mf) or nag_mip_ilp_dense (h02bb) and nag_mip_ilp_info (h02bz), with user-supplied names for the rows and columns.

Syntax

[ifail] = h02bv(a, bl, bu, x, clamda, istate, crname, 'n', n, 'm', m)
[ifail] = nag_mip_ilp_print(a, bl, bu, x, clamda, istate, crname, 'n', n, 'm', m)

Description

nag_mip_ilp_print (h02bv) prints the solution to a linear or integer programming problem with user-supplied names for the rows and columns. All output is written to the current advisory message unit (as defined by nag_file_set_unit_advisory (x04ab)). The function must be preceded in the same program by calls to either nag_opt_lp_solve (e04mf) (if an LP problem has been solved) or nag_mip_ilp_dense (h02bb) and nag_mip_ilp_info (h02bz) (if an IP problem has been solved). The documents for nag_opt_lp_solve (e04mf) and/or nag_mip_ilp_dense (h02bb) and nag_mip_ilp_info (h02bz) should be consulted for further details.

References

IBM (1971) MPSX – Mathematical programming system Program Number 5734 XM4 IBM Trade Corporation, New York

Parameters

Compulsory Input Parameters

1:     a(lda, : :) – double array
The first dimension of the array a must be at least max (1,m)max(1,m)
The second dimension of the array must be at least nn if m > 0m>0 and at least 11 if m = 0m=0
The matrix of general linear constraints.
2:     bl(n + mn+m) – double array
The lower bounds for all the constraints, as returned by nag_opt_lp_solve (e04mf) or nag_mip_ilp_info (h02bz).
3:     bu(n + mn+m) – double array
The upper bounds for all the constraints, as returned by nag_opt_lp_solve (e04mf) or nag_mip_ilp_info (h02bz).
4:     x(n) – double array
n, the dimension of the array, must satisfy the constraint n > 0n>0.
The solution to the problem, as returned by nag_opt_lp_solve (e04mf) or nag_mip_ilp_dense (h02bb).
5:     clamda(n + mn+m) – double array
The Lagrange-multipliers (reduced costs) for each constraint with respect to the working set, as returned by nag_opt_lp_solve (e04mf) or nag_mip_ilp_info (h02bz).
6:     istate(n + mn+m) – int64int32nag_int array
The status of every constraint in the working set at the solution, as returned by nag_opt_lp_solve (e04mf) or nag_mip_ilp_info (h02bz).
7:     crname(n + mn+m) – cell array of strings
The user-defined names for all the variables and constraints.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The dimension of the array x.
The number of variables.
Constraint: n > 0n>0.
2:     m – int64int32nag_int scalar
Default: The first dimension of the array a.
The number of general linear constraints.
Constraint: m0m0.

Input Parameters Omitted from the MATLAB Interface

lda

Output Parameters

1:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,n0n0,
orm < 0m<0,
orlda < max (1,m)lda<max(1,m).

Accuracy

Not applicable.

Further Comments

None.

Example

function nag_mip_ilp_print_example
n = int64(6);
m = int64(3);
itmax = int64(0);
msglvl = int64(0);
a = [ 110,  205,  160,  160,  420,  260;
        4,   32,   13,    8,    4,   14;
        2,   12,   54,  285,   22,   80];
bl = [0;
      0;
      0;
      0;
      0;
      0;
      2000;
      55;
      800];
bu = [4;
      3;
      2;
      8;
      2;
      2;
      1e+20;
      1e+20;
      1e+20];
intvar = [int64(1);1;1;1;1;1];
cvec = [3;24;13;9;20;19];
maxnod = int64(0);
intfst = int64(0);
toliv = 0;
tolfes = 0;
bigbnd = 1e+20;
x = zeros(6,1);

crname = {'OATMEAL '; 'CHICKEN '; 'EGGS    '; 'MILK    '; 'PIE     '; 'BACON   '; 'ENERGY  '; 'PROTEIN '; 'CALCIUM '};

[itmax, toliv, tolfes, bigbnd, x, objmip, iwork, rwork, ifail] = ...
     nag_mip_ilp_dense(itmax, msglvl, a, bl, bu, intvar, cvec, maxnod, intfst, toliv, tolfes, bigbnd, x);

[bl, bu, clamda, istate, ifail] = nag_mip_ilp_info(n, m, iwork, rwork);

[ifail] = nag_mip_ilp_print(a, bl, bu, x, clamda, istate, crname)
 


 Varbl   State     Value     Lower Bound   Upper Bound    Lagr Mult   Residual

 OATMEAL  EQ    4.00000       4.00000       4.00000       3.000       0.000
 CHICKEN  LL    0.00000       0.00000       3.00000       24.00       0.000
 EGGS     LL    0.00000       0.00000       2.00000       13.00       0.000
 MILK     LL    5.00000       5.00000       8.00000       9.000       0.000
 PIE      EQ    2.00000       2.00000       2.00000       20.00       0.000
 BACON    LL    0.00000       0.00000       2.00000       19.00       0.000


 L Con   State     Value     Lower Bound   Upper Bound    Lagr Mult   Residual

 ENERGY   FR    2080.00       2000.00         None        0.000       80.00
 PROTEIN  FR    64.0000       55.0000         None        0.000       9.000
 CALCIUM  FR    1477.00       800.000         None        0.000       677.0

ifail =

                    0


function h02bv_example
n = int64(6);
m = int64(3);
itmax = int64(0);
msglvl = int64(0);
a = [ 110,  205,  160,  160,  420,  260;
        4,   32,   13,    8,    4,   14;
        2,   12,   54,  285,   22,   80];
bl = [0;
      0;
      0;
      0;
      0;
      0;
      2000;
      55;
      800];
bu = [4;
      3;
      2;
      8;
      2;
      2;
      1e+20;
      1e+20;
      1e+20];
intvar = [int64(1);1;1;1;1;1];
cvec = [3;24;13;9;20;19];
maxnod = int64(0);
intfst = int64(0);
toliv = 0;
tolfes = 0;
bigbnd = 1e+20;
x = zeros(6,1);

crname = {'OATMEAL '; 'CHICKEN '; 'EGGS    '; 'MILK    '; 'PIE     '; ...
          'BACON   '; 'ENERGY  '; 'PROTEIN '; 'CALCIUM '};

[itmax, toliv, tolfes, bigbnd, x, objmip, iwork, rwork, ifail] = ...
     h02bb(itmax, msglvl, a, bl, bu, intvar, cvec, maxnod, intfst, toliv, ...
           tolfes, bigbnd, x);

[bl, bu, clamda, istate, ifail] = h02bz(n, m, iwork, rwork);

[ifail] = h02bv(a, bl, bu, x, clamda, istate, crname)
 


 Varbl   State     Value     Lower Bound   Upper Bound    Lagr Mult   Residual

 OATMEAL  EQ    4.00000       4.00000       4.00000       3.000       0.000
 CHICKEN  LL    0.00000       0.00000       3.00000       24.00       0.000
 EGGS     LL    0.00000       0.00000       2.00000       13.00       0.000
 MILK     LL    5.00000       5.00000       8.00000       9.000       0.000
 PIE      EQ    2.00000       2.00000       2.00000       20.00       0.000
 BACON    LL    0.00000       0.00000       2.00000       19.00       0.000


 L Con   State     Value     Lower Bound   Upper Bound    Lagr Mult   Residual

 ENERGY   FR    2080.00       2000.00         None        0.000       80.00
 PROTEIN  FR    64.0000       55.0000         None        0.000       9.000
 CALCIUM  FR    1477.00       800.000         None        0.000       677.0

ifail =

                    0



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–2013