📄 glpk03.tex
字号:
int sol);\end{verbatim}\subsubsection*{Description}The routine \verb|glp_mpl_postsolve| copies the solution from thespecified problem object \verb|prob| to the translator workspace andthen executes all the remaining model statements, which follow thesolve statement.The parameter \verb|sol| specifies which solution should be copiedfrom the problem object to the workspace as follows:\begin{tabular}{@{}ll}\verb|GLP_SOL| & basic solution; \\\verb|GLP_IPT| & interior-point solution; \\\verb|GLP_MIP| & mixed integer solution. \\\end{tabular}\subsubsection*{Returns}If the operation is successful, the routine returns zero. Otherwisethe routine prints an error message and returns non-zero.\subsection{glp\_mpl\_free\_wksp---free the translator workspace}\subsubsection*{Synopsis}\begin{verbatim}void glp_mpl_free_wksp(glp_tran *tran);\end{verbatim}\subsubsection*{Description}The routine \verb|glp_mpl_free_wksp| frees all the memory allocated tothe translator workspace. It also frees all other resources, which arestill used by the translator.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\newpage\section{Problem solution reading/writing routines}\subsection{lpx\_print\_sol---write basic solution in printableformat}\subsubsection*{Synopsis}\begin{verbatim}int lpx_print_sol(glp_prob *lp, char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|lpx_print_sol writes| the current basic solution ofan LP problem, which is specified by the pointer \verb|lp|, to a textfile, whose name is the character string \verb|fname|, in printableformat.Information reported by the routine \verb|lpx_print_sol| is intendedmainly for visual analysis.\subsubsection*{Returns}If no errors occurred, the routine returns zero. Otherwise the routineprints an error message and returns non-zero.\subsection{lpx\_print\_sens\_bnds---write bounds sensitivityinformation}\subsubsection*{Synopsis}\begin{verbatim}int lpx_print_sens_bnds(glp_prob *lp, char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|lpx_print_sens_bnds| writes the bounds for objectivecoefficients, right-hand-sides of constraints, and variable boundsfor which the current optimal basic solution remains optimal (for LPonly).The LP is given by the pointer \verb|lp|, and the output is written tothe file specified by \verb|fname|. The current contents of the filewill be overwritten.Information reported by the routine \verb|lpx_print_sens_bnds| isintended mainly for visual analysis.\subsubsection*{Returns}If no errors occurred, the routine returns zero. Otherwise the routineprints an error message and returns non-zero.\subsection{lpx\_print\_ips---write interior-point solution inprintable format}\subsubsection*{Synopsis}\begin{verbatim}int lpx_print_ips(glp_prob *lp, char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|lpx_print_ips| writes the current interior pointsolution of an LP problem, which the parameter \verb|lp| points to, toa text file, whose name is the character string \verb|fname|, inprintable format.Information reported by the routine \verb|lpx_print_ips| is intendedmainly for visual analysis.\subsubsection*{Returns}If no errors occurred, the routine returns zero. Otherwise the routineprints an error message and returns non-zero.\subsection{lpx\_print\_mip---write MIP solution in printable format}\subsubsection*{Synopsis}\begin{verbatim}int lpx_print_mip(glp_prob *lp, char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|lpx_print_mip| writes a best known integer solutionof a MIP problem, which is specified by the pointer \verb|lp|, to a textfile, whose name is the character string \verb|fname|, in printableformat.Information reported by the routine \verb|lpx_print_mip| is intendedmainly for visual analysis.\subsubsection*{Returns}If no errors occurred, the routine returns zero. Otherwise the routineprints an error message and returns non-zero.\pagebreak\subsection{glp\_read\_sol---read basic solution from text file}\subsubsection*{Synopsis}\begin{verbatim}int glp_read_sol(glp_prob *lp, const char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|glp_read_sol| reads basic solution from a text filewhose name is specified by the parameter \verb|fname| into the problemobject.For the file format see description of the routine \verb|glp_write_sol|.\subsubsection*{Returns}On success the routine returns zero, otherwise non-zero.\subsection{glp\_write\_sol---write basic solution to text file}\subsubsection*{Synopsis}\begin{verbatim}int glp_write_sol(glp_prob *lp, const char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|glp_write_sol| writes the current basic solution to atext file whose name is specified by the parameter \verb|fname|. Thisfile can be read back with the routine \verb|glp_read_sol|.\subsubsection*{Returns}On success the routine returns zero, otherwise non-zero.\subsubsection*{File format}The file created by the routine \verb|glp_write_sol| is a plain textfile, which contains the following information:\begin{verbatim} m n p_stat d_stat obj_val r_stat[1] r_prim[1] r_dual[1] . . . r_stat[m] r_prim[m] r_dual[m] c_stat[1] c_prim[1] c_dual[1] . . . c_stat[n] c_prim[n] c_dual[n]\end{verbatim}\noindentwhere:\noindent$m$ is the number of rows (auxiliary variables);\noindent$n$ is the number of columns (structural variables);\noindent\verb|p_stat| is the primal status of the basic solution(\verb|GLP_UNDEF| = 1, \verb|GLP_FEAS| = 2, \verb|GLP_INFEAS| = 3, or\verb|GLP_NOFEAS| = 4);\noindent\verb|d_stat| is the dual status of the basic solution(\verb|GLP_UNDEF| = 1, \verb|GLP_FEAS| = 2, \verb|GLP_INFEAS| = 3, or\verb|GLP_NOFEAS| = 4);\noindent\verb|obj_val| is the objective value;\noindent\verb|r_stat[i]|, $i=1,\dots,m$, is the status of $i$-th row(\verb|GLP_BS| = 1, \verb|GLP_NL| = 2, \verb|GLP_NU| = 3,\verb|GLP_NF| = 4, or \verb|GLP_NS| = 5);\noindent\verb|r_prim[i]|, $i=1,\dots,m$, is the primal value of $i$-th row;\noindent\verb|r_dual[i]|, $i=1,\dots,m$, is the dual value of $i$-th row;\noindent\verb|c_stat[j]|, $j=1,\dots,n$, is the status of $j$-th column(\verb|GLP_BS| = 1, \verb|GLP_NL| = 2, \verb|GLP_NU| = 3,\verb|GLP_NF| = 4, or \verb|GLP_NS| = 5);\noindent\verb|c_prim[j]|, $j=1,\dots,n$, is the primal value of $j$-th column;\noindent\verb|c_dual[j]|, $j=1,\dots,n$, is the dual value of $j$-th column.\subsection{glp\_read\_ipt---read interior-point solution from textfile}\subsubsection*{Synopsis}\begin{verbatim}int glp_read_ipt(glp_prob *lp, const char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|glp_read_ipt| reads interior-point solution from atext file whose name is specified by the parameter \verb|fname| into theproblem object.For the file format see description of the routine \verb|glp_write_ipt|.\subsubsection*{Returns}On success the routine returns zero, otherwise non-zero.\pagebreak\subsection{glp\_write\_ipt---write interior-point solution to textfile}\subsubsection*{Synopsis}\begin{verbatim}int glp_write_ipt(glp_prob *lp, const char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|glp_write_ipt| writes the current interior-pointsolution to a text file whose name is specified by the parameter\verb|fname|. This file can be read back with the routine\verb|glp_read_ipt|.\subsubsection*{Returns}On success the routine returns zero, otherwise non-zero.\subsubsection*{File format}The file created by the routine \verb|glp_write_ipt| is a plain textfile, which contains the following information:\begin{verbatim} m n stat obj_val r_prim[1] r_dual[1] . . . r_prim[m] r_dual[m] c_prim[1] c_dual[1] . . . c_prim[n] c_dual[n]\end{verbatim}\noindentwhere:\noindent$m$ is the number of rows (auxiliary variables);\noindent$n$ is the number of columns (structural variables);\noindent\verb|stat| is the solution status (\verb|GLP_UNDEF| = 1 or\verb|GLP_OPT| = 5);\noindent\verb|obj_val| is the objective value;\noindent\verb|r_prim[i]|, $i=1,\dots,m$, is the primal value of $i$-th row;\noindent\verb|r_dual[i]|, $i=1,\dots,m$, is the dual value of $i$-th row;\noindent\verb|c_prim[j]|, $j=1,\dots,n$, is the primal value of $j$-th column;\noindent\verb|c_dual[j]|, $j=1,\dots,n$, is the dual value of $j$-th column.\subsection{glp\_read\_mip---read MIP solution from text file}\subsubsection*{Synopsis}\begin{verbatim}int glp_read_mip(glp_prob *mip, const char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|glp_read_mip| reads MIP solution from a text filewhose name is specified by the parameter \verb|fname| into the problemobject.For the file format see description of the routine \verb|glp_write_mip|.\subsubsection*{Returns}On success the routine returns zero, otherwise non-zero.\subsection{glp\_write\_mip---write MIP solution to text file}\subsubsection*{Synopsis}\begin{verbatim}int glp_write_mip(glp_prob *mip, const char *fname);\end{verbatim}\subsubsection*{Description}The routine \verb|glp_write_mip| writes the current MIP solution to atext file whose name is specified by the parameter \verb|fname|. Thisfile can be read back with the routine \verb|glp_read_mip|.\subsubsection*{Returns}On success the routine returns zero, otherwise non-zero.\subsubsection*{File format}The file created by the routine \verb|glp_write_sol| is a plain textfile, which contains the following information:\begin{verbatim} m n stat obj_val r_val[1] . . . r_val[m] c_val[1] . . . c_val[n]\end{verbatim}\noindentwhere:\noindent$m$ is the number of rows (auxiliary variables);\noindent$n$ is the number of columns (structural variables);\noindent\verb|stat| is the solution status (\verb|GLP_UNDEF| = 1,\verb|GLP_FEAS| = 2, \verb|GLP_NOFEAS| = 4, or \verb|GLP_OPT| = 5);\noindent\verb|obj_val| is the objective value;\noindent\verb|r_val[i]|, $i=1,\dots,m$, is the value of $i$-th row;\noindent\verb|c_val[j]|, $j=1,\dots,n$, is the value of $j$-th column.%* eof *%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -