alpar@1: %* glpk03.tex *%
alpar@1:
alpar@1: \chapter{Utility API routines}
alpar@1:
alpar@1: \section{Problem data reading/writing routines}
alpar@1:
alpar@1: \subsection{glp\_read\_mps---read problem data in MPS format}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_read_mps(glp_prob *lp, int fmt, const void *parm,
alpar@1: const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_read_mps| reads problem data in MPS format from a
alpar@1: text file. (The MPS format is described in Appendix \ref{champs}, page
alpar@1: \pageref{champs}.)
alpar@1:
alpar@1: The parameter \verb|fmt| specifies the MPS format version as follows:
alpar@1:
alpar@1: \begin{tabular}{@{}ll}
alpar@1: \verb|GLP_MPS_DECK| & fixed (ancient) MPS format; \\
alpar@1: \verb|GLP_MPS_FILE| & free (modern) MPS format. \\
alpar@1: \end{tabular}
alpar@1:
alpar@1: The parameter \verb|parm| is reserved for use in the future and must be
alpar@1: specified as \verb|NULL|.
alpar@1:
alpar@1: The character string \verb|fname| specifies a name of the text file to
alpar@1: be read in. (If the file name ends with suffix `\verb|.gz|', the file is
alpar@1: assumed to be compressed, in which case the routine \verb|glp_read_mps|
alpar@1: decompresses it ``on the fly''.)
alpar@1:
alpar@1: Note that before reading data the current content of the problem object
alpar@1: is completely erased with the routine \verb|glp_erase_prob|.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation was successful, the routine \verb|glp_read_mps|
alpar@1: returns zero. Otherwise, it prints an error message and returns
alpar@1: non-zero.
alpar@1:
alpar@1: \subsection{glp\_write\_mps---write problem data in MPS format}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_write_mps(glp_prob *lp, int fmt, const void *parm,
alpar@1: const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_write_mps| writes problem data in MPS format to a
alpar@1: text file. (The MPS format is described in Appendix \ref{champs}, page
alpar@1: \pageref{champs}.)
alpar@1:
alpar@1: The parameter \verb|fmt| specifies the MPS format version as follows:
alpar@1:
alpar@1: \begin{tabular}{@{}ll}
alpar@1: \verb|GLP_MPS_DECK| & fixed (ancient) MPS format; \\
alpar@1: \verb|GLP_MPS_FILE| & free (modern) MPS format. \\
alpar@1: \end{tabular}
alpar@1:
alpar@1: The parameter \verb|parm| is reserved for use in the future and must be
alpar@1: specified as \verb|NULL|.
alpar@1:
alpar@1: The character string \verb|fname| specifies a name of the text file to
alpar@1: be written out. (If the file name ends with suffix `\verb|.gz|', the
alpar@1: file is assumed to be compressed, in which case the routine
alpar@1: \verb|glp_write_mps| performs automatic compression on writing it.)
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation was successful, the routine \verb|glp_write_mps|
alpar@1: returns zero. Otherwise, it prints an error message and returns
alpar@1: non-zero.
alpar@1:
alpar@1: \subsection{glp\_read\_lp---read problem data in CPLEX LP format}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_read_lp(glp_prob *lp, const void *parm,
alpar@1: const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_read_lp| reads problem data in CPLEX LP format
alpar@1: from a text file. (The CPLEX LP format is described in Appendix
alpar@1: \ref{chacplex}, page \pageref{chacplex}.)
alpar@1:
alpar@1: The parameter \verb|parm| is reserved for use in the future and must be
alpar@1: specified as \verb|NULL|.
alpar@1:
alpar@1: The character string \verb|fname| specifies a name of the text file to
alpar@1: be read in. (If the file name ends with suffix `\verb|.gz|', the file is
alpar@1: assumed to be compressed, in which case the routine \verb|glp_read_lp|
alpar@1: decompresses it ``on the fly''.)
alpar@1:
alpar@1: Note that before reading data the current content of the problem object
alpar@1: is completely erased with the routine \verb|glp_erase_prob|.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation was successful, the routine \verb|glp_read_lp| returns
alpar@1: zero. Otherwise, it prints an error message and returns non-zero.
alpar@1:
alpar@1: \subsection{glp\_write\_lp---write problem data in CPLEX LP format}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_write_lp(glp_prob *lp, const void *parm,
alpar@1: const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_write_lp| writes problem data in CPLEX LP format
alpar@1: to a text file. (The CPLEX LP format is described in Appendix
alpar@1: \ref{chacplex}, page \pageref{chacplex}.)
alpar@1:
alpar@1: The parameter \verb|parm| is reserved for use in the future and must be
alpar@1: specified as \verb|NULL|.
alpar@1:
alpar@1: The character string \verb|fname| specifies a name of the text file to
alpar@1: be written out. (If the file name ends with suffix `\verb|.gz|', the
alpar@1: file is assumed to be compressed, in which case the routine
alpar@1: \verb|glp_write_lp| performs automatic compression on writing it.)
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation was successful, the routine \verb|glp_write_lp|
alpar@1: returns zero. Otherwise, it prints an error message and returns
alpar@1: non-zero.
alpar@1:
alpar@1: \subsection{glp\_read\_prob---read problem data in GLPK format}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_read_prob(glp_prob *P, int flags, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_read_prob| reads problem data in the GLPK LP/MIP
alpar@1: format from a text file. (For description of the GLPK LP/MIP format see
alpar@1: below.)
alpar@1:
alpar@1: The parameter \verb|flags| is reserved for use in the future and should
alpar@1: be specified as zero.
alpar@1:
alpar@1: The character string \verb|fname| specifies a name of the text file to
alpar@1: be read in. (If the file name ends with suffix `\verb|.gz|', the file
alpar@1: is assumed to be compressed, in which case the routine
alpar@1: \verb|glp_read_prob| decompresses it ``on the fly''.)
alpar@1:
alpar@1: Note that before reading data the current content of the problem object
alpar@1: is completely erased with the routine \verb|glp_erase_prob|.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation was successful, the routine \verb|glp_read_prob|
alpar@1: returns zero. Otherwise, it prints an error message and returns
alpar@1: non-zero.
alpar@1:
alpar@1: \subsubsection*{GLPK LP/MIP format}
alpar@1:
alpar@1: The GLPK LP/MIP format is a DIMACS-like format.\footnote{The DIMACS
alpar@1: formats were developed by the Center for Discrete Mathematics and
alpar@1: Theoretical Computer Science (DIMACS) to facilitate exchange of problem
alpar@1: data. For details see: {\tt }. }
alpar@1: The file in this format is a plain ASCII text file containing lines of
alpar@1: several types described below. A line is terminated with the end-of-line
alpar@1: character. Fields in each line are separated by at least one blank
alpar@1: space. Each line begins with a one-character designator to identify the
alpar@1: line type.
alpar@1:
alpar@1: The first line of the data file must be the problem line (except
alpar@1: optional comment lines, which may precede the problem line). The last
alpar@1: line of the data file must be the end line. Other lines may follow in
alpar@1: arbitrary order, however, duplicate lines are not allowed.
alpar@1:
alpar@1: \paragraph{Comment lines.} Comment lines give human-readable
alpar@1: information about the data file and are ignored by GLPK routines.
alpar@1: Comment lines can appear anywhere in the data file. Each comment line
alpar@1: begins with the lower-case character \verb|c|.
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: c This is an example of comment line
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \paragraph{Problem line.} There must be exactly one problem line in the
alpar@1: data file. This line must appear before any other lines except comment
alpar@1: lines and has the following format:
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: p CLASS DIR ROWS COLS NONZ
alpar@1: \end{verbatim}
alpar@1:
alpar@1: The lower-case letter \verb|p| specifies that this is the problem line.
alpar@1:
alpar@1: The \verb|CLASS| field defines the problem class and can contain either
alpar@1: the keyword \verb|lp| (that means linear programming problem) or
alpar@1: \verb|mip| (that means mixed integer programming problem).
alpar@1:
alpar@1: The \verb|DIR| field defines the optimization direction (that is, the
alpar@1: objective function sense) and can contain either the keyword \verb|min|
alpar@1: (that means minimization) or \verb|max| (that means maximization).
alpar@1:
alpar@1: The \verb|ROWS|, \verb|COLS|, and \verb|NONZ| fields contain
alpar@1: non-negative integer values specifying, respectively, the number of
alpar@1: rows (constraints), columns (variables), and non-zero constraint
alpar@1: coefficients in the problem instance. Note that \verb|NONZ| value does
alpar@1: not account objective coefficients.
alpar@1:
alpar@1: \paragraph{Row descriptors.} There must be at most one row descriptor
alpar@1: line in the data file for each row (constraint). This line has one of
alpar@1: the following formats:
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: i ROW f
alpar@1: i ROW l RHS
alpar@1: i ROW u RHS
alpar@1: i ROW d RHS1 RHS2
alpar@1: i ROW s RHS
alpar@1: \end{verbatim}
alpar@1:
alpar@1: The lower-case letter \verb|i| specifies that this is the row
alpar@1: descriptor line.
alpar@1:
alpar@1: The \verb|ROW| field specifies the row ordinal number, an integer
alpar@1: between 1 and $m$, where $m$ is the number of rows in the problem
alpar@1: instance.
alpar@1:
alpar@1: The next lower-case letter specifies the row type as follows:
alpar@1:
alpar@1: \verb|f| --- free (unbounded) row: $-\infty<\sum a_jx_j<+\infty$;
alpar@1:
alpar@1: \verb|l| --- inequality constraint of `$\geq$' type:
alpar@1: $\sum a_jx_j\geq b$;
alpar@1:
alpar@1: \verb|u| --- inequality constraint of `$\leq$' type:
alpar@1: $\sum a_jx_j\leq b$;
alpar@1:
alpar@1: \verb|d| --- double-sided inequality constraint:
alpar@1: $b_1\leq\sum a_jx_j\leq b_2$;
alpar@1:
alpar@1: \verb|s| --- equality constraint: $\sum a_jx_j=b$.
alpar@1:
alpar@1: The \verb|RHS| field contains a floaing-point value specifying the
alpar@1: row right-hand side. The \verb|RHS1| and \verb|RHS2| fields contain
alpar@1: floating-point values specifying, respectively, the lower and upper
alpar@1: right-hand sides for the double-sided row.
alpar@1:
alpar@1: If for some row its descriptor line does not appear in the data file,
alpar@1: by default that row is assumed to be an equality constraint with zero
alpar@1: right-hand side.
alpar@1:
alpar@1: \paragraph{Column descriptors.} There must be at most one column
alpar@1: descriptor line in the data file for each column (variable). This line
alpar@1: has one of the following formats depending on the problem class
alpar@1: specified in the problem line:
alpar@1:
alpar@1: \bigskip
alpar@1:
alpar@1: \begin{tabular}{@{}l@{\hspace*{40pt}}l}
alpar@1: LP class & MIP class \\
alpar@1: \hline
alpar@1: \verb|j COL f| & \verb|j COL KIND f| \\
alpar@1: \verb|j COL l BND| & \verb|j COL KIND l BND| \\
alpar@1: \verb|j COL u BND| & \verb|j COL KIND u BND| \\
alpar@1: \verb|j COL d BND1 BND2| & \verb|j COL KIND d BND1 BND2| \\
alpar@1: \verb|j COL s BND| & \verb|j COL KIND s BND| \\
alpar@1: \end{tabular}
alpar@1:
alpar@1: \bigskip
alpar@1:
alpar@1: The lower-case letter \verb|j| specifies that this is the column
alpar@1: descriptor line.
alpar@1:
alpar@1: The \verb|COL| field specifies the column ordinal number, an integer
alpar@1: between 1 and $n$, where $n$ is the number of columns in the problem
alpar@1: instance.
alpar@1:
alpar@1: The \verb|KIND| field is used only for MIP problems and specifies the
alpar@1: column kind as follows:
alpar@1:
alpar@1: \verb|c| --- continuous column;
alpar@1:
alpar@1: \verb|i| --- integer column;
alpar@1:
alpar@1: \verb|b| --- binary column (in this case all remaining fields must be
alpar@1: omitted).
alpar@1:
alpar@1: The next lower-case letter specifies the column type as follows:
alpar@1:
alpar@1: \verb|f| --- free (unbounded) column: $-\infty
alpar@1: #include
alpar@1: #include
alpar@1:
alpar@1: int main(void)
alpar@1: { glp_prob *lp;
alpar@1: glp_tran *tran;
alpar@1: int ret;
alpar@1: lp = glp_create_prob();
alpar@1: tran = glp_mpl_alloc_wksp();
alpar@1: ret = glp_mpl_read_model(tran, "egypt.mod", 0);
alpar@1: if (ret != 0)
alpar@1: { fprintf(stderr, "Error on translating model\n");
alpar@1: goto skip;
alpar@1: }
alpar@1: ret = glp_mpl_generate(tran, NULL);
alpar@1: if (ret != 0)
alpar@1: { fprintf(stderr, "Error on generating model\n");
alpar@1: goto skip;
alpar@1: }
alpar@1: glp_mpl_build_prob(tran, lp);
alpar@1: ret = glp_write_mps(lp, GLP_MPS_FILE, NULL, "egypt.mps");
alpar@1: if (ret != 0)
alpar@1: fprintf(stderr, "Error on writing MPS file\n");
alpar@1: skip: glp_mpl_free_wksp(tran);
alpar@1: glp_delete_prob(lp);
alpar@1: return 0;
alpar@1: }
alpar@1:
alpar@1: /* eof */
alpar@1: \end{verbatim}
alpar@1: \end{small}
alpar@1:
alpar@1: \subsubsection*{Example 2}
alpar@1:
alpar@1: In this example the program reads model section from file
alpar@1: \verb|sudoku.mod|\footnote{This is an example model which is included
alpar@1: in the GLPK distribution along with alternative data file
alpar@1: {\tt sudoku.dat}.} ignoring data section in this file, reads alternative
alpar@1: data section from file \verb|sudoku.dat|, solves the problem instance
alpar@1: and passes the solution found back to the model.
alpar@1:
alpar@1: \begin{small}
alpar@1: \begin{verbatim}
alpar@1: /* mplsamp2.c */
alpar@1:
alpar@1: #include
alpar@1: #include
alpar@1: #include
alpar@1:
alpar@1: int main(void)
alpar@1: { glp_prob *mip;
alpar@1: glp_tran *tran;
alpar@1: int ret;
alpar@1: mip = glp_create_prob();
alpar@1: tran = glp_mpl_alloc_wksp();
alpar@1: ret = glp_mpl_read_model(tran, "sudoku.mod", 1);
alpar@1: if (ret != 0)
alpar@1: { fprintf(stderr, "Error on translating model\n");
alpar@1: goto skip;
alpar@1: }
alpar@1: ret = glp_mpl_read_data(tran, "sudoku.dat");
alpar@1: if (ret != 0)
alpar@1: { fprintf(stderr, "Error on translating data\n");
alpar@1: goto skip;
alpar@1: }
alpar@1: ret = glp_mpl_generate(tran, NULL);
alpar@1: if (ret != 0)
alpar@1: { fprintf(stderr, "Error on generating model\n");
alpar@1: goto skip;
alpar@1: }
alpar@1: glp_mpl_build_prob(tran, mip);
alpar@1: glp_simplex(mip, NULL);
alpar@1: glp_intopt(mip, NULL);
alpar@1: ret = glp_mpl_postsolve(tran, mip, GLP_MIP);
alpar@1: if (ret != 0)
alpar@1: fprintf(stderr, "Error on postsolving model\n");
alpar@1: skip: glp_mpl_free_wksp(tran);
alpar@1: glp_delete_prob(mip);
alpar@1: return 0;
alpar@1: }
alpar@1:
alpar@1: /* eof */
alpar@1: \end{verbatim}
alpar@1: \end{small}
alpar@1:
alpar@1: \subsection{glp\_mpl\_alloc\_wksp---allocate the translator workspace}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: glp_tran *glp_mpl_alloc_wksp(void);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_mpl_alloc_wksp| allocates the MathProg translator
alpar@1: work\-space. (Note that multiple instances of the workspace may be
alpar@1: allocated, if necessary.)
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: The routine returns a pointer to the workspace, which should be used in
alpar@1: all subsequent operations.
alpar@1:
alpar@1: \subsection{glp\_mpl\_read\_model---read and translate model section}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_mpl_read_model(glp_tran *tran, const char *fname,
alpar@1: int skip);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_mpl_read_model| reads model section and,
alpar@1: optionally, data section, which may follow the model section, from a
alpar@1: text file, whose name is the character string \verb|fname|, performs
alpar@1: translation of model statements and data blocks, and stores all the
alpar@1: information in the workspace.
alpar@1:
alpar@1: The parameter \verb|skip| is a flag. If the input file contains the
alpar@1: data section and this flag is non-zero, the data section is not read as
alpar@1: if there were no data section and a warning message is printed. This
alpar@1: allows reading data section(s) from other file(s).
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation is successful, the routine returns zero. Otherwise
alpar@1: the routine prints an error message and returns non-zero.
alpar@1:
alpar@1: \subsection{glp\_mpl\_read\_data---read and translate data section}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_mpl_read_data(glp_tran *tran, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_mpl_read_data| reads data section from a text
alpar@1: file, whose name is the character string \verb|fname|, performs
alpar@1: translation of data blocks, and stores the data read in the translator
alpar@1: workspace. If necessary, this routine may be called more than once.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation is successful, the routine returns zero. Otherwise
alpar@1: the routine prints an error message and returns non-zero.
alpar@1:
alpar@1: \subsection{glp\_mpl\_generate---generate the model}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_mpl_generate(glp_tran *tran, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_mpl_generate| generates the model using its
alpar@1: description stored in the translator workspace. This operation means
alpar@1: generating all variables, constraints, and objectives, executing check
alpar@1: and display statements, which precede the solve statement (if it is
alpar@1: presented).
alpar@1:
alpar@1: The character string \verb|fname| specifies the name of an output text
alpar@1: file, to which output produced by display statements should be written.
alpar@1: If \verb|fname| is \verb|NULL|, the output is sent to the terminal.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation is successful, the routine returns zero. Otherwise
alpar@1: the routine prints an error message and returns non-zero.
alpar@1:
alpar@1: \subsection{glp\_mpl\_build\_prob---build problem instance from the
alpar@1: model}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: void glp_mpl_build_prob(glp_tran *tran, glp_prob *prob);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_mpl_build_prob| obtains all necessary information
alpar@1: from the translator workspace and stores it in the specified problem
alpar@1: object \verb|prob|. Note that before building the current content of
alpar@1: the problem object is erased with the routine \verb|glp_erase_prob|.
alpar@1:
alpar@1: \subsection{glp\_mpl\_postsolve---postsolve the model}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_mpl_postsolve(glp_tran *tran, glp_prob *prob,
alpar@1: int sol);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_mpl_postsolve| copies the solution from the
alpar@1: specified problem object \verb|prob| to the translator workspace and
alpar@1: then executes all the remaining model statements, which follow the
alpar@1: solve statement.
alpar@1:
alpar@1: The parameter \verb|sol| specifies which solution should be copied
alpar@1: from the problem object to the workspace as follows:
alpar@1:
alpar@1: \begin{tabular}{@{}ll}
alpar@1: \verb|GLP_SOL| & basic solution; \\
alpar@1: \verb|GLP_IPT| & interior-point solution; \\
alpar@1: \verb|GLP_MIP| & mixed integer solution. \\
alpar@1: \end{tabular}
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation is successful, the routine returns zero. Otherwise
alpar@1: the routine prints an error message and returns non-zero.
alpar@1:
alpar@1: \subsection{glp\_mpl\_free\_wksp---free the translator workspace}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: void glp_mpl_free_wksp(glp_tran *tran);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_mpl_free_wksp| frees all the memory allocated to
alpar@1: the translator workspace. It also frees all other resources, which are
alpar@1: still used by the translator.
alpar@1:
alpar@1: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
alpar@1:
alpar@1: \newpage
alpar@1:
alpar@1: \section{Problem solution reading/writing routines}
alpar@1:
alpar@1: \subsection{glp\_print\_sol---write basic solution in printable format}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_print_sol(glp_prob *lp, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_print_sol writes| the current basic solution of
alpar@1: an LP problem, which is specified by the pointer \verb|lp|, to a text
alpar@1: file, whose name is the character string \verb|fname|, in printable
alpar@1: format.
alpar@1:
alpar@1: Information reported by the routine \verb|glp_print_sol| is intended
alpar@1: mainly for visual analysis.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If no errors occurred, the routine returns zero. Otherwise the routine
alpar@1: prints an error message and returns non-zero.
alpar@1:
alpar@1: \subsection{glp\_read\_sol---read basic solution from text file}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_read_sol(glp_prob *lp, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_read_sol| reads basic solution from a text file
alpar@1: whose name is specified by the parameter \verb|fname| into the problem
alpar@1: object.
alpar@1:
alpar@1: For the file format see description of the routine \verb|glp_write_sol|.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: On success the routine returns zero, otherwise non-zero.
alpar@1:
alpar@1: \newpage
alpar@1:
alpar@1: \subsection{glp\_write\_sol---write basic solution to text file}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_write_sol(glp_prob *lp, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_write_sol| writes the current basic solution to a
alpar@1: text file whose name is specified by the parameter \verb|fname|. This
alpar@1: file can be read back with the routine \verb|glp_read_sol|.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: On success the routine returns zero, otherwise non-zero.
alpar@1:
alpar@1: \subsubsection*{File format}
alpar@1:
alpar@1: The file created by the routine \verb|glp_write_sol| is a plain text
alpar@1: file, which contains the following information:
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: m n
alpar@1: p_stat d_stat obj_val
alpar@1: r_stat[1] r_prim[1] r_dual[1]
alpar@1: . . .
alpar@1: r_stat[m] r_prim[m] r_dual[m]
alpar@1: c_stat[1] c_prim[1] c_dual[1]
alpar@1: . . .
alpar@1: c_stat[n] c_prim[n] c_dual[n]
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \noindent
alpar@1: where:
alpar@1:
alpar@1: \noindent
alpar@1: $m$ is the number of rows (auxiliary variables);
alpar@1:
alpar@1: \noindent
alpar@1: $n$ is the number of columns (structural variables);
alpar@1:
alpar@1: \noindent
alpar@1: \verb|p_stat| is the primal status of the basic solution
alpar@1: (\verb|GLP_UNDEF| = 1, \verb|GLP_FEAS| = 2, \verb|GLP_INFEAS| = 3, or
alpar@1: \verb|GLP_NOFEAS| = 4);
alpar@1:
alpar@1: \noindent
alpar@1: \verb|d_stat| is the dual status of the basic solution
alpar@1: (\verb|GLP_UNDEF| = 1, \verb|GLP_FEAS| = 2, \verb|GLP_INFEAS| = 3, or
alpar@1: \verb|GLP_NOFEAS| = 4);
alpar@1:
alpar@1: \noindent
alpar@1: \verb|obj_val| is the objective value;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|r_stat[i]|, $i=1,\dots,m$, is the status of $i$-th row
alpar@1: (\verb|GLP_BS| = 1, \verb|GLP_NL| = 2, \verb|GLP_NU| = 3,
alpar@1: \verb|GLP_NF| = 4, or \verb|GLP_NS| = 5);
alpar@1:
alpar@1: \noindent
alpar@1: \verb|r_prim[i]|, $i=1,\dots,m$, is the primal value of $i$-th row;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|r_dual[i]|, $i=1,\dots,m$, is the dual value of $i$-th row;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|c_stat[j]|, $j=1,\dots,n$, is the status of $j$-th column
alpar@1: (\verb|GLP_BS| = 1, \verb|GLP_NL| = 2, \verb|GLP_NU| = 3,
alpar@1: \verb|GLP_NF| = 4, or \verb|GLP_NS| = 5);
alpar@1:
alpar@1: \noindent
alpar@1: \verb|c_prim[j]|, $j=1,\dots,n$, is the primal value of $j$-th column;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|c_dual[j]|, $j=1,\dots,n$, is the dual value of $j$-th column.
alpar@1:
alpar@1: \subsection{glp\_print\_ipt---write interior-point solution in
alpar@1: printable format}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_print_ipt(glp_prob *lp, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_print_ipt| writes the current interior point
alpar@1: solution of an LP problem, which the parameter \verb|lp| points to, to
alpar@1: a text file, whose name is the character string \verb|fname|, in
alpar@1: printable format.
alpar@1:
alpar@1: Information reported by the routine \verb|glp_print_ipt| is intended
alpar@1: mainly for visual analysis.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If no errors occurred, the routine returns zero. Otherwise the routine
alpar@1: prints an error message and returns non-zero.
alpar@1:
alpar@1: \subsection{glp\_read\_ipt---read interior-point solution from text
alpar@1: file}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_read_ipt(glp_prob *lp, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_read_ipt| reads interior-point solution from a
alpar@1: text file whose name is specified by the parameter \verb|fname| into the
alpar@1: problem object.
alpar@1:
alpar@1: For the file format see description of the routine \verb|glp_write_ipt|.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: On success the routine returns zero, otherwise non-zero.
alpar@1:
alpar@1: \subsection{glp\_write\_ipt---write interior-point solution to text
alpar@1: file}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_write_ipt(glp_prob *lp, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_write_ipt| writes the current interior-point
alpar@1: solution to a text file whose name is specified by the parameter
alpar@1: \verb|fname|. This file can be read back with the routine
alpar@1: \verb|glp_read_ipt|.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: On success the routine returns zero, otherwise non-zero.
alpar@1:
alpar@1: \subsubsection*{File format}
alpar@1:
alpar@1: The file created by the routine \verb|glp_write_ipt| is a plain text
alpar@1: file, which contains the following information:
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: m n
alpar@1: stat obj_val
alpar@1: r_prim[1] r_dual[1]
alpar@1: . . .
alpar@1: r_prim[m] r_dual[m]
alpar@1: c_prim[1] c_dual[1]
alpar@1: . . .
alpar@1: c_prim[n] c_dual[n]
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \noindent
alpar@1: where:
alpar@1:
alpar@1: \noindent
alpar@1: $m$ is the number of rows (auxiliary variables);
alpar@1:
alpar@1: \noindent
alpar@1: $n$ is the number of columns (structural variables);
alpar@1:
alpar@1: \noindent
alpar@1: \verb|stat| is the solution status (\verb|GLP_UNDEF| = 1 or
alpar@1: \verb|GLP_OPT| = 5);
alpar@1:
alpar@1: \noindent
alpar@1: \verb|obj_val| is the objective value;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|r_prim[i]|, $i=1,\dots,m$, is the primal value of $i$-th row;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|r_dual[i]|, $i=1,\dots,m$, is the dual value of $i$-th row;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|c_prim[j]|, $j=1,\dots,n$, is the primal value of $j$-th column;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|c_dual[j]|, $j=1,\dots,n$, is the dual value of $j$-th column.
alpar@1:
alpar@1: \subsection{glp\_print\_mip---write MIP solution in printable format}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_print_mip(glp_prob *lp, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_print_mip| writes a best known integer solution
alpar@1: of a MIP problem, which is specified by the pointer \verb|lp|, to a text
alpar@1: file, whose name is the character string \verb|fname|, in printable
alpar@1: format.
alpar@1:
alpar@1: Information reported by the routine \verb|glp_print_mip| is intended
alpar@1: mainly for visual analysis.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If no errors occurred, the routine returns zero. Otherwise the routine
alpar@1: prints an error message and returns non-zero.
alpar@1:
alpar@1: \newpage
alpar@1:
alpar@1: \subsection{glp\_read\_mip---read MIP solution from text file}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_read_mip(glp_prob *mip, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_read_mip| reads MIP solution from a text file
alpar@1: whose name is specified by the parameter \verb|fname| into the problem
alpar@1: object.
alpar@1:
alpar@1: For the file format see description of the routine \verb|glp_write_mip|.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: On success the routine returns zero, otherwise non-zero.
alpar@1:
alpar@1: \subsection{glp\_write\_mip---write MIP solution to text file}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_write_mip(glp_prob *mip, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_write_mip| writes the current MIP solution to a
alpar@1: text file whose name is specified by the parameter \verb|fname|. This
alpar@1: file can be read back with the routine \verb|glp_read_mip|.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: On success the routine returns zero, otherwise non-zero.
alpar@1:
alpar@1: \subsubsection*{File format}
alpar@1:
alpar@1: The file created by the routine \verb|glp_write_sol| is a plain text
alpar@1: file, which contains the following information:
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: m n
alpar@1: stat obj_val
alpar@1: r_val[1]
alpar@1: . . .
alpar@1: r_val[m]
alpar@1: c_val[1]
alpar@1: . . .
alpar@1: c_val[n]
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \noindent
alpar@1: where:
alpar@1:
alpar@1: \noindent
alpar@1: $m$ is the number of rows (auxiliary variables);
alpar@1:
alpar@1: \noindent
alpar@1: $n$ is the number of columns (structural variables);
alpar@1:
alpar@1: \noindent
alpar@1: \verb|stat| is the solution status (\verb|GLP_UNDEF| = 1,
alpar@1: \verb|GLP_FEAS| = 2, \verb|GLP_NOFEAS| = 4, or \verb|GLP_OPT| = 5);
alpar@1:
alpar@1: \noindent
alpar@1: \verb|obj_val| is the objective value;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|r_val[i]|, $i=1,\dots,m$, is the value of $i$-th row;
alpar@1:
alpar@1: \noindent
alpar@1: \verb|c_val[j]|, $j=1,\dots,n$, is the value of $j$-th column.
alpar@1:
alpar@1: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
alpar@1:
alpar@1: \newpage
alpar@1:
alpar@1: \section{Post-optimal analysis routines}
alpar@1:
alpar@1: \subsection{glp\_print\_ranges---print sensitivity analysis report}
alpar@1:
alpar@1: \subsubsection*{Synopsis}
alpar@1:
alpar@1: \begin{verbatim}
alpar@1: int glp_print_ranges(glp_prob *P, int len, const int list[],
alpar@1: int flags, const char *fname);
alpar@1: \end{verbatim}
alpar@1:
alpar@1: \subsubsection*{Description}
alpar@1:
alpar@1: The routine \verb|glp_print_ranges| performs sensitivity analysis of
alpar@1: current optimal basic solution and writes the analysis report in
alpar@1: human-readable format to a text file, whose name is the character
alpar@1: string {\it fname}. (Detailed description of the report structure is
alpar@1: given below.)
alpar@1:
alpar@1: The parameter {\it len} specifies the length of the row/column list.
alpar@1:
alpar@1: The array {\it list} specifies ordinal number of rows and columns to be
alpar@1: analyzed. The ordinal numbers should be passed in locations
alpar@1: {\it list}[1], {\it list}[2], \dots, {\it list}[{\it len}]. Ordinal
alpar@1: numbers from 1 to $m$ refer to rows, and ordinal numbers from $m+1$ to
alpar@1: $m+n$ refer to columns, where $m$ and $n$ are, resp., the total number
alpar@1: of rows and columns in the problem object. Rows and columns appear in
alpar@1: the analysis report in the same order as they follow in the array list.
alpar@1:
alpar@1: It is allowed to specify $len=0$, in which case the array {\it list} is
alpar@1: not used (so it can be specified as \verb|NULL|), and the routine
alpar@1: performs analysis for all rows and columns of the problem object.
alpar@1:
alpar@1: The parameter {\it flags} is reserved for use in the future and must be
alpar@1: specified as zero.
alpar@1:
alpar@1: On entry to the routine \verb|glp_print_ranges| the current basic
alpar@1: solution must be optimal and the basis factorization must exist.
alpar@1: The application program can check that with the routine
alpar@1: \verb|glp_bf_exists|, and if the factorization does
alpar@1: not exist, compute it with the routine \verb|glp_factorize|. Note that
alpar@1: if the LP preprocessor is not used, on normal exit from the simplex
alpar@1: solver routine \verb|glp_simplex| the basis factorization always exists.
alpar@1:
alpar@1: \subsubsection*{Returns}
alpar@1:
alpar@1: If the operation was successful, the routine \verb|glp_print_ranges|
alpar@1: returns zero. Otherwise, it prints an error message and returns
alpar@1: non-zero.
alpar@1:
alpar@1: \subsubsection*{Analysis report example}
alpar@1:
alpar@1: An example of the sensitivity analysis report is shown on the next two
alpar@1: pages. This example corresponds to the example of LP problem described
alpar@1: in Subsection ``Example of MPS file''.
alpar@1:
alpar@1: \subsubsection*{Structure of the analysis report}
alpar@1:
alpar@1: For each row and column specified in the array {\it list} the routine
alpar@1: prints two lines containing generic information and analysis
alpar@1: information, which depends on the status of corresponding row or column.
alpar@1:
alpar@1: Note that analysis of a row is analysis of its auxiliary variable,
alpar@1: which is equal to the row linear form $\sum a_jx_j$, and analysis of
alpar@1: a column is analysis of corresponding structural variable. Therefore,
alpar@1: formally, on performing the sensitivity analysis there is no difference
alpar@1: between rows and columns.
alpar@1:
alpar@1: \bigskip
alpar@1:
alpar@1: \noindent
alpar@1: {\it Generic information}
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: {\tt No.} is the row or column ordinal number in the problem object.
alpar@1: Rows are numbered from 1 to $m$, and columns are numbered from 1 to $n$,
alpar@1: where $m$ and $n$ are, resp., the total number of rows and columns in
alpar@1: the problem object.
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: {\tt Row name} is the symbolic name assigned to the row. If the row has
alpar@1: no name assigned, this field contains blanks.
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: {\tt Column name} is the symbolic name assigned to the column. If the
alpar@1: column has no name assigned, this field contains blanks.
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: {\tt St} is the status of the row or column in the optimal solution:
alpar@1:
alpar@1: {\tt BS} --- non-active constraint (row), basic column;
alpar@1:
alpar@1: {\tt NL} --- inequality constraint having its lower right-hand side
alpar@1: active (row), non-basic column having its lower bound active;
alpar@1:
alpar@1: {\tt NU} --- inequality constraint having its upper right-hand side
alpar@1: active (row), non-basic column having its upper bound active;
alpar@1:
alpar@1: {\tt NS} --- active equality constraint (row), non-basic fixed column.
alpar@1:
alpar@1: {\tt NF} --- active free row, non-basic free (unbounded) column. (This
alpar@1: case means that the optimal solution is dual degenerate.)
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: {\tt Activity} is the (primal) value of the auxiliary variable (row) or
alpar@1: structural variable (column) in the optimal solution.
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: {\tt Slack} is the (primal) value of the row slack variable.
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: {\tt Obj coef} is the objective coefficient of the column (structural
alpar@1: variable).
alpar@1:
alpar@1: \begin{landscape}
alpar@1: \begin{scriptsize}
alpar@1: \begin{verbatim}
alpar@1: GLPK 4.42 - SENSITIVITY ANALYSIS REPORT Page 1
alpar@1:
alpar@1: Problem: PLAN
alpar@1: Objective: VALUE = 296.2166065 (MINimum)
alpar@1:
alpar@1: No. Row name St Activity Slack Lower bound Activity Obj coef Obj value at Limiting
alpar@1: Marginal Upper bound range range break point variable
alpar@1: ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------
alpar@1: 1 VALUE BS 296.21661 -296.21661 -Inf 299.25255 -1.00000 . MN
alpar@1: . +Inf 296.21661 +Inf +Inf
alpar@1:
alpar@1: 2 YIELD NS 2000.00000 . 2000.00000 1995.06864 -Inf 296.28365 BIN3
alpar@1: -.01360 2000.00000 2014.03479 +Inf 296.02579 CU
alpar@1:
alpar@1: 3 FE NU 60.00000 . -Inf 55.89016 -Inf 306.77162 BIN4
alpar@1: -2.56823 60.00000 62.69978 2.56823 289.28294 BIN3
alpar@1:
alpar@1: 4 CU BS 83.96751 16.03249 -Inf 93.88467 -.30613 270.51157 MN
alpar@1: . 100.00000 79.98213 .21474 314.24798 BIN5
alpar@1:
alpar@1: 5 MN NU 40.00000 . -Inf 34.42336 -Inf 299.25255 BIN4
alpar@1: -.54440 40.00000 41.68691 .54440 295.29825 BIN3
alpar@1:
alpar@1: 6 MG BS 19.96029 10.03971 -Inf 24.74427 -1.79618 260.36433 BIN1
alpar@1: . 30.00000 9.40292 .28757 301.95652 MN
alpar@1:
alpar@1: 7 AL NL 1500.00000 . 1500.00000 1485.78425 -.25199 292.63444 CU
alpar@1: .25199 +Inf 1504.92126 +Inf 297.45669 BIN3
alpar@1:
alpar@1: 8 SI NL 250.00000 50.00000 250.00000 235.32871 -.48520 289.09812 CU
alpar@1: .48520 300.00000 255.06073 +Inf 298.67206 BIN3
alpar@1: \end{verbatim}
alpar@1: \end{scriptsize}
alpar@1: \end{landscape}
alpar@1:
alpar@1: \begin{landscape}
alpar@1: \begin{scriptsize}
alpar@1: \begin{verbatim}
alpar@1: GLPK 4.42 - SENSITIVITY ANALYSIS REPORT Page 2
alpar@1:
alpar@1: Problem: PLAN
alpar@1: Objective: VALUE = 296.2166065 (MINimum)
alpar@1:
alpar@1: No. Column name St Activity Obj coef Lower bound Activity Obj coef Obj value at Limiting
alpar@1: Marginal Upper bound range range break point variable
alpar@1: ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------
alpar@1: 1 BIN1 NL . .03000 . -28.82475 -.22362 288.90594 BIN4
alpar@1: .25362 200.00000 33.88040 +Inf 304.80951 BIN4
alpar@1:
alpar@1: 2 BIN2 BS 665.34296 .08000 . 802.22222 .01722 254.44822 BIN1
alpar@1: . 2500.00000 313.43066 .08863 301.95652 MN
alpar@1:
alpar@1: 3 BIN3 BS 490.25271 .17000 400.00000 788.61314 .15982 291.22807 MN
alpar@1: . 800.00000 -347.42857 .17948 300.86548 BIN5
alpar@1:
alpar@1: 4 BIN4 BS 424.18773 .12000 100.00000 710.52632 .10899 291.54745 MN
alpar@1: . 700.00000 -256.15524 .14651 307.46010 BIN1
alpar@1:
alpar@1: 5 BIN5 NL . .15000 . -201.78739 .13544 293.27940 BIN3
alpar@1: .01456 1500.00000 58.79586 +Inf 297.07244 BIN3
alpar@1:
alpar@1: 6 ALUM BS 299.63899 .21000 . 358.26772 .18885 289.87879 AL
alpar@1: . +Inf 112.40876 .22622 301.07527 MN
alpar@1:
alpar@1: 7 SILICON BS 120.57762 .38000 . 124.27093 .14828 268.27586 BIN5
alpar@1: . +Inf 85.54745 .46667 306.66667 MN
alpar@1:
alpar@1: End of report
alpar@1: \end{verbatim}
alpar@1: \end{scriptsize}
alpar@1: \end{landscape}
alpar@1:
alpar@1: \noindent
alpar@1: {\tt Marginal} is the reduced cost (dual activity) of the auxiliary
alpar@1: variable (row) or structural variable (column).
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: {\tt Lower bound} is the lower right-hand side (row) or lower bound
alpar@1: (column). If the row or column has no lower bound, this field contains
alpar@1: {\tt -Inf}.
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: {\tt Upper bound} is the upper right-hand side (row) or upper bound
alpar@1: (column). If the row or column has no upper bound, this field contains
alpar@1: {\tt +Inf}.
alpar@1:
alpar@1: \bigskip
alpar@1:
alpar@1: \noindent
alpar@1: {\it Sensitivity analysis of active bounds}
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: The sensitivity analysis of active bounds is performed only for rows,
alpar@1: which are active constraints, and only for non-basic columns, because
alpar@1: inactive constraints and basic columns have no active bounds.
alpar@1:
alpar@1: For every auxiliary (row) or structural (column) non-basic variable the
alpar@1: routine starts changing its active bound in both direction. The first
alpar@1: of the two lines in the report corresponds to decreasing, and the
alpar@1: second line corresponds to increasing of the active bound. Since the
alpar@1: variable being analyzed is non-basic, its activity, which is equal to
alpar@1: its active bound, also starts changing. This changing leads to changing
alpar@1: of basic (auxiliary and structural) variables, which depend on the
alpar@1: non-basic variable. The current basis remains primal feasible and
alpar@1: therefore optimal while values of all basic variables are primal
alpar@1: feasible, i.e. are within their bounds. Therefore, if some basic
alpar@1: variable called the {\it limiting variable} reaches its (lower or
alpar@1: upper) bound first, before any other basic variables, it thereby limits
alpar@1: further changing of the non-basic variable, because otherwise the
alpar@1: current basis would become primal infeasible. The point, at which this
alpar@1: happens, is called the {\it break point}. Note that there are two break
alpar@1: points: the lower break point, which corresponds to decreasing of the
alpar@1: non-basic variable, and the upper break point, which corresponds to
alpar@1: increasing of the non-basic variable.
alpar@1:
alpar@1: In the analysis report values of the non-basic variable (i.e. of its
alpar@1: active bound) being analyzed at both lower and upper break points are
alpar@1: printed in the field `{\tt Activity range}'. Corresponding values of
alpar@1: the objective function are printed in the field `{\tt Obj value at
alpar@1: break point}', and symbolic names of corresponding limiting basic
alpar@1: variables are printed in the field `{\tt Limiting variable}'.
alpar@1: If the active bound can decrease or/and increase unlimitedly, the field
alpar@1: `{\tt Activity range}' contains {\tt -Inf} or/and {\tt +Inf}, resp.
alpar@1:
alpar@1: For example (see the example report above), row SI is a double-sided
alpar@1: constraint, which is active on its lower bound (right-hand side), and
alpar@1: its activity in the optimal solution being equal to the lower bound is
alpar@1: 250. The activity range for this row is $[235.32871,255.06073]$. This
alpar@1: means that the basis remains optimal while the lower bound is
alpar@1: increasing up to 255.06073, and further increasing is limited by
alpar@1: (structural) variable BIN3. If the lower bound reaches this upper break
alpar@1: point, the objective value becomes equal to 298.67206.
alpar@1:
alpar@1: Note that if the basis does not change, the objective function depends
alpar@1: on the non-basic variable linearly, and the per-unit change of the
alpar@1: objective function is the reduced cost (marginal value) of the
alpar@1: non-basic variable.
alpar@1:
alpar@1: \bigskip
alpar@1:
alpar@1: \noindent
alpar@1: {\it Sensitivity analysis of objective coefficients at non-basic
alpar@1: variables}
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: The sensitivity analysis of the objective coefficient at a non-basic
alpar@1: variable is quite simple, because in this case change in the objective
alpar@1: coefficient leads to equivalent change in the reduced cost (marginal
alpar@1: value).
alpar@1:
alpar@1: For every auxiliary (row) or structural (column) non-basic variable the
alpar@1: routine starts changing its objective coefficient in both direction.
alpar@1: (Note that auxiliary variables are not included in the objective
alpar@1: function and therefore always have zero objective coefficients.) The
alpar@1: first of the two lines in the report corresponds to decreasing, and the
alpar@1: second line corresponds to increasing of the objective coefficient.
alpar@1: This changing leads to changing of the reduced cost of the non-basic
alpar@1: variable to be analyzed and does affect reduced costs of all other
alpar@1: non-basic variables. The current basis remains dual feasible and
alpar@1: therefore optimal while the reduced cost keeps its sign. Therefore, if
alpar@1: the reduced cost reaches zero, it limits further changing of the
alpar@1: objective coefficient (if only the non-basic variable is non-fixed).
alpar@1:
alpar@1: In the analysis report minimal and maximal values of the objective
alpar@1: coefficient, on which the basis remains optimal, are printed in the
alpar@1: field `\verb|Obj coef range|'. If the objective coefficient can
alpar@1: decrease or/and increase unlimitedly, this field contains {\tt -Inf}
alpar@1: or/and {\tt +Inf}, resp.
alpar@1:
alpar@1: For example (see the example report above), column BIN5 is non-basic
alpar@1: having its lower bound active. Its objective coefficient is 0.15, and
alpar@1: reduced cost in the optimal solution 0.01456. The column lower bound
alpar@1: remains active while the column reduced cost remains non-negative,
alpar@1: thus, minimal value of the objective coefficient, on which the current
alpar@1: basis still remains optimal, is $0.15-0.01456=0.13644$, that is
alpar@1: indicated in the field `\verb|Obj coef range|'.
alpar@1:
alpar@1: \bigskip
alpar@1:
alpar@1: \noindent
alpar@1: {\it Sensitivity analysis of objective coefficients at basic variables}
alpar@1:
alpar@1: \medskip
alpar@1:
alpar@1: \noindent
alpar@1: To perform sensitivity analysis for every auxiliary (row) or structural
alpar@1: (column) variable the routine starts changing its objective coefficient
alpar@1: in both direction. (Note that auxiliary variables are not included in
alpar@1: the objective function and therefore always have zero objective
alpar@1: coefficients.) The first of the two lines in the report corresponds to
alpar@1: decreasing, and the second line corresponds to increasing of the
alpar@1: objective coefficient. This changing leads to changing of reduced costs
alpar@1: of non-basic variables. The current basis remains dual feasible and
alpar@1: therefore optimal while reduced costs of all non-basic variables
alpar@1: (except fixed variables) keep their signs. Therefore, if the reduced
alpar@1: cost of some non-basic non-fixed variable called the {\it limiting
alpar@1: variable} reaches zero first, before reduced cost of any other
alpar@1: non-basic non-fixed variable, it thereby limits further changing of the
alpar@1: objective coefficient, because otherwise the current basis would become
alpar@1: dual infeasible (non-optimal). The point, at which this happens, is
alpar@1: called the {\it break point}. Note that there are two break points: the
alpar@1: lower break point, which corresponds to decreasing of the objective
alpar@1: coefficient, and the upper break point, which corresponds to increasing
alpar@1: of the objective coefficient. Let the objective coefficient reach its
alpar@1: limit value and continue changing a bit further in the same direction
alpar@1: that makes the current basis dual infeasible (non-optimal). Then the
alpar@1: reduced cost of the non-basic limiting variable becomes ``a bit'' dual
alpar@1: infeasible that forces the limiting variable to enter the basis
alpar@1: replacing there some basic variable, which leaves the basis to keep its
alpar@1: primal feasibility. It should be understood that if we change the
alpar@1: current basis in this way exactly at the break point, both the current
alpar@1: and adjacent bases will be optimal with the same objective value,
alpar@1: because at the break point the limiting variable has zero reduced cost.
alpar@1: On the other hand, in the adjacent basis the value of the limiting
alpar@1: variable changes, because there it becomes basic, that leads to
alpar@1: changing of the value of the basic variable being analyzed. Note that
alpar@1: on determining the adjacent basis the bounds of the analyzed basic
alpar@1: variable are ignored as if it were a free (unbounded) variable, so it
alpar@1: cannot leave the current basis.
alpar@1:
alpar@1: In the analysis report lower and upper limits of the objective
alpar@1: coefficient at the basic variable being analyzed, when the basis
alpar@1: remains optimal, are printed in the field `{\tt Obj coef range}'.
alpar@1: Corresponding values of the objective function at both lower and upper
alpar@1: break points are printed in the field `{\tt Obj value at break point}',
alpar@1: symbolic names of corresponding non-basic limiting variables are
alpar@1: printed in the field `{\tt Limiting variable}', and values of the basic
alpar@1: variable, which it would take on in the adjacent bases (as was
alpar@1: explained above) are printed in the field `{\tt Activity range}'.
alpar@1: If the objective coefficient can increase or/and decrease unlimitedly,
alpar@1: the field `{\tt Obj coef range}' contains {\tt -Inf} and/or {\tt +Inf},
alpar@1: resp. It also may happen that no dual feasible adjacent basis exists
alpar@1: (i.e. on entering the basis the limiting variable can increase or
alpar@1: decrease unlimitedly), in which case the field `{\tt Activity range}'
alpar@1: contains {\tt -Inf} and/or {\tt +Inf}.
alpar@1:
alpar@1: \newpage
alpar@1:
alpar@1: For example (see the example report above), structural variable
alpar@1: (column) BIN3 is basic, its optimal value is 490.25271, and its
alpar@1: objective coefficient is 0.17. The objective coefficient range for this
alpar@1: column is $[0.15982,0.17948]$. This means that the basis remains
alpar@1: optimal while the objective coefficient is decreasing down to 0.15982,
alpar@1: and further decreasing is limited by (auxiliary) variable MN. If we
alpar@1: make the objective coefficient a bit less than 0.15982, the limiting
alpar@1: variable MN will enter the basis, and in that adjacent basis the
alpar@1: structural variable BIN3 will take on new optimal value 788.61314. At
alpar@1: the lower break point, where the objective coefficient is exactly
alpar@1: 0.15982, the objective function takes on the value 291.22807 in both
alpar@1: the current and adjacent bases.
alpar@1:
alpar@1: Note that if the basis does not change, the objective function depends
alpar@1: on the objective coefficient at the basic variable linearly, and the
alpar@1: per-unit change of the objective function is the value of the basic
alpar@1: variable.
alpar@1:
alpar@1: %* eof *%