NAG Library Routine Document

h02bff  (ilp_mpsx)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

h02bff solves linear or integer programming problems specified in MPSX input format. It is not intended for large sparse problems.

2
Specification

Fortran Interface
Subroutine h02bff ( infile, maxn, maxm, optim, xbldef, xbudef, maxdpt, msglvl, n, m, x, crname, iwork, liwork, rwork, lrwork, ifail)
Integer, Intent (In):: infile, maxn, maxm, maxdpt, msglvl, liwork, lrwork
Integer, Intent (Inout):: ifail
Integer, Intent (Out):: n, m, iwork(liwork)
Real (Kind=nag_wp), Intent (In):: xbldef, xbudef
Real (Kind=nag_wp), Intent (Out):: x(maxn), rwork(lrwork)
Character (3), Intent (In):: optim
Character (8), Intent (Out):: crname(maxn+maxm)
C Header Interface
#include nagmk26.h
void  h02bff_ ( const Integer *infile, const Integer *maxn, const Integer *maxm, const char *optim, const double *xbldef, const double *xbudef, const Integer *maxdpt, const Integer *msglvl, Integer *n, Integer *m, double x[], char crname[], Integer iwork[], const Integer *liwork, double rwork[], const Integer *lrwork, Integer *ifail, const Charlen length_optim, const Charlen length_crname)

3
Description

h02bff solves linear programming (LP) or integer programming (IP) problems specified in MPSX (see IBM (1971)) input format. It calls either e04mff/e04mfa (to solve an LP problem) or h02bbf and h02bzf (to solve an IP problem); these routines are designed to solve problems of the form
minimizexRncTx  subject to  l x Ax u  
where c is an n-element vector and A is an m by n matrix (i.e., there are n variables and m general linear constraints). h02bbf is used if at least one of the variables is restricted to take an integer value at the optimum solution. The document for h02buf should be consulted for a detailed description of the MPSX format.
In the MPSX data file the first free row, that is a row defined with the row type n, is taken as the objective row. Similarly, if there are more than one RHS, RANGES or BOUNDS sets, then the first set is used for the optimization. h02bff also prints the solution to the problem using the row and column names specified in the MPSX data file (by calling h02bvf).

4
References

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

5
Arguments

1:     infile – IntegerInput
On entry: the unit number associated with the MPSX data file.
Constraint: 0infile99.
2:     maxn – IntegerInput
On entry: an upper limit for the number of variables in the problem.
Constraint: maxn1.
3:     maxm – IntegerInput
On entry: an upper limit for the number of constraints (including the objective) in the problem.
Constraint: maxm1.
4:     optim – Character(3)Input
On entry: specifies the direction of the optimization. optim must be set to 'MIN' for minimization and to 'MAX' for maximization.
Constraint: optim='MIN' or 'MAX'.
5:     xbldef – Real (Kind=nag_wp)Input
On entry: the default lower bound to be used for the variables in the problem when none is specified in the BOUNDS section of the MPSX data file. For a standard LP or IP problem xbldef would normally be set to zero.
6:     xbudef – Real (Kind=nag_wp)Input
On entry: the default upper bound to be used for the variables in the problem when none is specified in the BOUNDS section of the MPSX data file. For a standard LP or IP problem xbudef would normally be set to ‘infinity’ (i.e., xbudef1020).
Constraint: xbudefxbldef.
7:     maxdpt – IntegerInput
On entry: for an IP problem, maxdpt must specify the maximum depth of the branch and bound tree.
Constraint: maxdpt2.
For an LP problem, maxdpt is not referenced
8:     msglvl – IntegerInput
On entry: the amount of printout produced by e04mff/e04mfa or h02bbf, as indicated below. For a description of the printed output see Section 9.2 in e04mff/e04mfa or Section 5.1 in h02bbf (as appropriate). All output is written to the current advisory message unit (as defined by x04abf).
For an LP problem (e04mff/e04mfa):
Value Definition
0 No output.
1 The final solution only.
5 One line of output for each iteration (no printout of the final solution).
10 The final solution and one line of output for each iteration.
For an IP problem (h02bbf):
Value Definition
0 No output.
1 The final IP solution only.
5 One line of output for each node investigated and the final IP solution.
10 The original LP solution (first node) with dummy names for the rows and columns, one line of output for each node investigated and the final IP solution with MPSX names for the rows and columns.
9:     n – IntegerOutput
On exit: n, the actual number of variables in the problem.
10:   m – IntegerOutput
On exit: m, the actual number of general linear constraints in the problem.
11:   xmaxn – Real (Kind=nag_wp) arrayOutput
On exit: the solution to the problem, stored in x1,x2,,xn. xi is the value of the variable whose MPSX name is stored in crnamei, for i=1,2,,n.
12:   crnamemaxn+maxm – Character(8) arrayOutput
On exit: the first n elements contain the MPSX names for the variables in the problem.
13:   iworkliwork – Integer arrayOutput
On exit: the first (n+m) elements contain ISTATE (the status of the constraints in the working set at the solution). Further details can be found in Section 5 in e04mff/e04mfa or h02bzf (as appropriate).
14:   liwork – IntegerInput
On entry: the dimension of the array iwork as declared in the (sub)program from which h02bff is called.
Constraints:
  • for an LP problem, liwork4×maxn+maxm+3;
  • for an IP problem, liwork25+maxn+maxm×maxdpt+7×maxn+2× maxm+4.
15:   rworklrwork – Real (Kind=nag_wp) arrayOutput
On exit: the first (n+m) elements contain BL (the lower bounds), the next (n+m) elements contain BU (the upper bounds) and the next (n+m) elements contain CLAMDA (the Lagrange-multipliers). Further details can be found in Section 5 in e04mff/e04mfa or h02bzf (as appropriate). Note that for an IP problem the contents of BL and BU may not be the same as those originally specified in the MPSX data file and/or via the arguments xbldef and xbudef.
16:   lrwork – IntegerInput
On entry: the dimension of the array rwork as declared in the (sub)program from which h02bff is called.
Constraints:
  • for an LP problem, lrwork2×MIN maxn,maxm+1 2+maxm×maxn+ 12×maxn+9×maxm;
  • for an IP problem,
    lrworkmaxdpt×maxn+1+2×MIN maxn,maxm+1 2+maxm× maxn+19×maxn+15×maxm.
17:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=iandifail<0
Either maxm and/or maxn are too small or the MPSX data file is nonstandard and/or corrupt. This corresponds to ifail=-i in Section 6 in h02buf.
ifail=1
x is a weak local minimum. This means that the solution is not unique.
ifail=2
The solution appears to be unbounded. This value of ifail implies that a step as large as xbudef would have to be taken in order to continue the algorithm. See Section 9.
ifail=3
No feasible point was found, i.e., it was not possible to satisfy all the constraints to within the feasibility tolerance (defined internally as machine precision). See Section 9.
ifail=4
The maximum number of iterations (defined internally as max50,5n+m) was reached before normal termination occurred. See Section 9.
ifail=5
An input argument is invalid. Refer to the printed output to determine which argument must be redefined.
ifail=6 (e04mff/e04mfa or h02bbf)
A serious error has occurred in an internal call to one of the specified routines. Check all subroutine calls and array dimensions.
For an IP problem only:
ifail=7
The solution returned may not be optimal. See Section 9.
ifail=8
maxdpt is too small. Try increasing its value (along with that of liwork and/or lrwork if appropriate) and rerun h02bff.
ifail=9
No feasible integer point was found, i.e., it was not possible to satisfy all the integer variables to within the integer feasibility tolerance (defined internally as 10-5). See Section 9.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

h02bff implements a numerically stable active set strategy and returns solutions that are as accurate as the condition of the problem allows on the machine.

8
Parallelism and Performance

h02bff is not thread safe and should not be called from a multithreaded user program. Please see Section 3.12.1 in How to Use the NAG Library and its Documentation for more information on thread safety.
h02bff makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

For an LP problem only:
For an IP problem only:

10
Example

This example solves the same problem as the example for h02buf, except that it treats it as an IP problem.
One of the applications of integer programming is to the so-called diet problem. Given the nutritional content of a selection of foods, the cost of each food, the amount available of each food and the consumer's minimum daily nutritional requirements, the problem is to find the cheapest combination. This gives rise to the following problem:
minimize
cTx  
subject to
Axb, 0xu,  
where
The rows of A correspond to energy, protein and calcium and the columns of A correspond to oatmeal, chicken, eggs, milk, pie and bacon respectively.
The MPSX data representation of this problem is given in Section 10.2.

10.1
Program Text

Program Text (h02bffe.f90)

10.2
Program Data

Program Options (h02bffe.opt)

10.3
Program Results

Program Results (h02bffe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017