| 1 | /* glpapi08.c (interior-point method routines) */cxx . . $ `<file>/external/glpk/glpapi08.c`/ |
| 2 | |
| 3 | /*********************************************************************** |
| 4 | * This code is part of GLPK (GNU Linear Programming Kit). |
| 5 | * |
| 6 | * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
| 7 | * 2009, 2010 Andrew Makhorin, Department for Applied Informatics, |
| 8 | * Moscow Aviation Institute, Moscow, Russia. All rights reserved. |
| 9 | * E-mail: <[email protected]>. |
| 10 | * |
| 11 | * GLPK is free software: you can redistribute it and/or modify it |
| 12 | * under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation, either version 3 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * GLPK is distributed in the hope that it will be useful, but WITHOUT |
| 17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 18 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 19 | * License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with GLPK. If not, see <http://www.gnu.org/licenses/>. |
| 23 | ***********************************************************************/ |
| 24 | |
| 25 | #include "glpapi.h"cxx . . $ `<file>/external/glpk/glpapi.h`/ |
| 26 | #include "glpipm.h"cxx . . $ `<file>/external/glpk/glpipm.h`/ |
| 27 | #include "glpnpp.h"cxx . . $ `<file>/external/glpk/glpnpp.h`/ |
| 28 | |
| 29 | /*********************************************************************** |
| 30 | * NAME |
| 31 | * |
| 32 | * glp_interior - solve LP problem with the interior-point method |
| 33 | * |
| 34 | * SYNOPSIS |
| 35 | * |
| 36 | * int glp_interior(glp_prob *P, const glp_iptcp *parm); |
| 37 | * |
| 38 | * The routine glp_interior is a driver to the LP solver based on the |
| 39 | * interior-point method. |
| 40 | * |
| 41 | * The interior-point solver has a set of control parameters. Values of |
| 42 | * the control parameters can be passed in a structure glp_iptcp, which |
| 43 | * the parameter parm points to. |
| 44 | * |
| 45 | * Currently this routine implements an easy variant of the primal-dual |
| 46 | * interior-point method based on Mehrotra's technique. |
| 47 | * |
| 48 | * This routine transforms the original LP problem to an equivalent LP |
| 49 | * problem in the standard formulation (all constraints are equalities, |
| 50 | * all variables are non-negative), calls the routine ipm_main to solve |
| 51 | * the transformed problem, and then transforms an obtained solution to |
| 52 | * the solution of the original problem. |
| 53 | * |
| 54 | * RETURNS |
| 55 | * |
| 56 | * 0 The LP problem instance has been successfully solved. This code |
| 57 | * does not necessarily mean that the solver has found optimal |
| 58 | * solution. It only means that the solution process was successful. |
| 59 | * |
| 60 | * GLP_EFAIL |
| 61 | * The problem has no rows/columns. |
| 62 | * |
| 63 | * GLP_ENOCVG |
| 64 | * Very slow convergence or divergence. |
| 65 | * |
| 66 | * GLP_EITLIM |
| 67 | * Iteration limit exceeded. |
| 68 | * |
| 69 | * GLP_EINSTAB |
| 70 | * Numerical instability on solving Newtonian system. */ |
| 71 | |
| 72 | static void transformcxx . . $ transform(317768444a5e3bb5).(NPPcxx . . $ NPP# *npp) |
| 73 | { /* transform LP to the standard formulation */ |
| 74 | NPPROWcxx . . $ NPPROW# *row, *prev_row; |
| 75 | NPPCOLcxx . . $ NPPCOL# *col, *prev_col; |
| 76 | for (row = npp->r_tailcxx . . $ NPP#r_tail.; row != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; row = prev_row) |
| 77 | { prev_row = row->prevcxx . . $ NPPROW#prev.; |
| 78 | if (row->lbcxx . . $ NPPROW#lb. == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! && row->ubcxx . . $ NPPROW#ub. == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!) |
| 79 | npp_free_rowcxx . . $ `external/glpk/glpnpp.h:361:9`!(npp, row); |
| 80 | else if (row->lbcxx . . $ NPPROW#lb. == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!) |
| 81 | npp_leq_rowcxx . . $ `external/glpk/glpnpp.h:369:9`!(npp, row); |
| 82 | else if (row->ubcxx . . $ NPPROW#ub. == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!) |
| 83 | npp_geq_rowcxx . . $ `external/glpk/glpnpp.h:365:9`!(npp, row); |
| 84 | else if (row->lbcxx . . $ NPPROW#lb. != row->ubcxx . . $ NPPROW#ub.) |
| 85 | { if (fabscxx . . $ fabs(447c67c6676f75c3).(row->lbcxx . . $ NPPROW#lb.) < fabscxx . . $ fabs(447c67c6676f75c3).(row->ubcxx . . $ NPPROW#ub.)) |
| 86 | npp_geq_rowcxx . . $ `external/glpk/glpnpp.h:365:9`!(npp, row); |
| 87 | else |
| 88 | npp_leq_rowcxx . . $ `external/glpk/glpnpp.h:369:9`!(npp, row); |
| 89 | } |
| 90 | } |
| 91 | for (col = npp->c_tailcxx . . $ NPP#c_tail.; col != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; col = prev_col) |
| 92 | { prev_col = col->prevcxx . . $ NPPCOL#prev.; |
| 93 | if (col->lbcxx . . $ NPPCOL#lb. == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! && col->ubcxx . . $ NPPCOL#ub. == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!) |
| 94 | npp_free_colcxx . . $ `external/glpk/glpnpp.h:373:9`!(npp, col); |
| 95 | else if (col->lbcxx . . $ NPPCOL#lb. == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!) |
| 96 | npp_ubnd_colcxx . . $ `external/glpk/glpnpp.h:381:9`!(npp, col); |
| 97 | else if (col->ubcxx . . $ NPPCOL#ub. == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!) |
| 98 | { if (col->lbcxx . . $ NPPCOL#lb. != 0.0) |
| 99 | npp_lbnd_colcxx . . $ `external/glpk/glpnpp.h:377:9`!(npp, col); |
| 100 | } |
| 101 | else if (col->lbcxx . . $ NPPCOL#lb. != col->ubcxx . . $ NPPCOL#ub.) |
| 102 | { if (fabscxx . . $ fabs(447c67c6676f75c3).(col->lbcxx . . $ NPPCOL#lb.) < fabscxx . . $ fabs(447c67c6676f75c3).(col->ubcxx . . $ NPPCOL#ub.)) |
| 103 | { if (col->lbcxx . . $ NPPCOL#lb. != 0.0) |
| 104 | npp_lbnd_colcxx . . $ `external/glpk/glpnpp.h:377:9`!(npp, col); |
| 105 | } |
| 106 | else |
| 107 | npp_ubnd_colcxx . . $ `external/glpk/glpnpp.h:381:9`!(npp, col); |
| 108 | npp_dbnd_colcxx . . $ `external/glpk/glpnpp.h:385:9`!(npp, col); |
| 109 | } |
| 110 | else |
| 111 | npp_fixed_colcxx . . $ `external/glpk/glpnpp.h:389:9`!(npp, col); |
| 112 | } |
| 113 | for (row = npp->r_headcxx . . $ NPP#r_head.; row != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; row = row->nextcxx . . $ NPPROW#next.) |
| 114 | xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(row->lb == row->ub); |
| 115 | for (col = npp->c_headcxx . . $ NPP#c_head.; col != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; col = col->nextcxx . . $ NPPCOL#next.) |
| 116 | xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(col->lb == 0.0 && col->ub == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!); |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | int glp_interiorcxx . . $ glp_interior(d70fb529629f878d).(glp_probcxx . . $ glp_prob# *P, const glp_iptcpcxx . . $ glp_iptcp# *parm) |
| 121 | { glp_iptcpcxx . . $ glp_iptcp# _parm; |
| 122 | GLPROWcxx . . $ GLPROW# *row; |
| 123 | GLPCOLcxx . . $ GLPCOL# *col; |
| 124 | NPPcxx . . $ NPP# *npp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 125 | glp_probcxx . . $ glp_prob# *prob = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 126 | int i, j, ret; |
| 127 | /* check control parameters */ |
| 128 | if (parm == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 129 | glp_init_iptcpcxx . . $ glp_init_iptcp(15c332fc7968b4e3).(&_parm), parm = &_parm; |
| 130 | if (!(parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. == GLP_MSG_OFFcxx . . $ `external/glpk/glpk.h:115:9`! || |
| 131 | parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. == GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`! || |
| 132 | parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. == GLP_MSG_ONcxx . . $ `external/glpk/glpk.h:117:9`! || |
| 133 | parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. == GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)) |
| 134 | xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_interior: msg_lev = %d; invalid parameter\n", |
| 135 | parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev.); |
| 136 | if (!(parm->ord_algcxx . . $ $anonymous_type_2d15b5456314bbc5_2#ord_alg. == GLP_ORD_NONEcxx . . $ `external/glpk/glpk.h:147:9`! || |
| 137 | parm->ord_algcxx . . $ $anonymous_type_2d15b5456314bbc5_2#ord_alg. == GLP_ORD_QMDcxx . . $ `external/glpk/glpk.h:148:9`! || |
| 138 | parm->ord_algcxx . . $ $anonymous_type_2d15b5456314bbc5_2#ord_alg. == GLP_ORD_AMDcxx . . $ `external/glpk/glpk.h:149:9`! || |
| 139 | parm->ord_algcxx . . $ $anonymous_type_2d15b5456314bbc5_2#ord_alg. == GLP_ORD_SYMAMDcxx . . $ `external/glpk/glpk.h:150:9`!)) |
| 140 | xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_interior: ord_alg = %d; invalid parameter\n", |
| 141 | parm->ord_algcxx . . $ $anonymous_type_2d15b5456314bbc5_2#ord_alg.); |
| 142 | /* interior-point solution is currently undefined */ |
| 143 | P->ipt_statcxx . . $ glp_prob#ipt_stat. = GLP_UNDEFcxx . . $ `external/glpk/glpk.h:85:9`!; |
| 144 | P->ipt_objcxx . . $ glp_prob#ipt_obj. = 0.0; |
| 145 | /* check bounds of double-bounded variables */ |
| 146 | for (i = 1; i <= P->mcxx . . $ glp_prob#m.; i++) |
| 147 | { row = P->rowcxx . . $ glp_prob#row.[i]; |
| 148 | if (row->typecxx . . $ GLPROW#type. == GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`! && row->lbcxx . . $ GLPROW#lb. >= row->ubcxx . . $ GLPROW#ub.) |
| 149 | { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!) |
| 150 | xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_interior: row %d: lb = %g, ub = %g; incorre" |
| 151 | "ct bounds\n", i, row->lbcxx . . $ GLPROW#lb., row->ubcxx . . $ GLPROW#ub.); |
| 152 | ret = GLP_EBOUNDcxx . . $ `external/glpk/glpk.h:242:9`!; |
| 153 | goto done; |
| 154 | } |
| 155 | } |
| 156 | for (j = 1; j <= P->ncxx . . $ glp_prob#n.; j++) |
| 157 | { col = P->colcxx . . $ glp_prob#col.[j]; |
| 158 | if (col->typecxx . . $ GLPCOL#type. == GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`! && col->lbcxx . . $ GLPCOL#lb. >= col->ubcxx . . $ GLPCOL#ub.) |
| 159 | { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!) |
| 160 | xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_interior: column %d: lb = %g, ub = %g; inco" |
| 161 | "rrect bounds\n", j, col->lbcxx . . $ GLPCOL#lb., col->ubcxx . . $ GLPCOL#ub.); |
| 162 | ret = GLP_EBOUNDcxx . . $ `external/glpk/glpk.h:242:9`!; |
| 163 | goto done; |
| 164 | } |
| 165 | } |
| 166 | /* transform LP to the standard formulation */ |
| 167 | if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!) |
| 168 | xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("Original LP has %d row(s), %d column(s), and %d non-z" |
| 169 | "ero(s)\n", P->mcxx . . $ glp_prob#m., P->ncxx . . $ glp_prob#n., P->nnzcxx . . $ glp_prob#nnz.); |
| 170 | npp = npp_create_wkspcxx . . $ `external/glpk/glpnpp.h:261:9`!(); |
| 171 | npp_load_probcxx . . $ `external/glpk/glpnpp.h:338:9`!(npp, P, GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!, GLP_IPTcxx . . $ `external/glpk/glpk.h:81:9`!, GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`!); |
| 172 | transformcxx . . $ transform(317768444a5e3bb5).(npp); |
| 173 | prob = glp_create_probcxx . . $ glp_create_prob(7c2d8bedb6abbdaf).(); |
| 174 | npp_build_probcxx . . $ `external/glpk/glpnpp.h:343:9`!(npp, prob); |
| 175 | if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!) |
| 176 | xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("Working LP has %d row(s), %d column(s), and %d non-ze" |
| 177 | "ro(s)\n", prob->mcxx . . $ glp_prob#m., prob->ncxx . . $ glp_prob#n., prob->nnzcxx . . $ glp_prob#nnz.); |
| 178 | #if 1 |
| 179 | /* currently empty problem cannot be solved */ |
| 180 | if (!(prob->mcxx . . $ glp_prob#m. > 0 && prob->ncxx . . $ glp_prob#n. > 0)) |
| 181 | { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!) |
| 182 | xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_interior: unable to solve empty problem\n"); |
| 183 | ret = GLP_EFAILcxx . . $ `external/glpk/glpk.h:243:9`!; |
| 184 | goto done; |
| 185 | } |
| 186 | #endif |
| 187 | /* scale the resultant LP */ |
| 188 | { ENVcxx . . $ ENV# *env = get_env_ptrcxx . . $ `external/glpk/glpenv.h:133:9`!(); |
| 189 | int term_out = env->term_outcxx . . $ ENV#term_out.; |
| 190 | env->term_outcxx . . $ ENV#term_out. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!; |
| 191 | glp_scale_probcxx . . $ glp_scale_prob(e00ef8be97973834).(prob, GLP_SF_EQcxx . . $ `external/glpk/glpk.h:74:9`!); |
| 192 | env->term_outcxx . . $ ENV#term_out. = term_out; |
| 193 | } |
| 194 | /* warn about dense columns */ |
| 195 | if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. >= GLP_MSG_ONcxx . . $ `external/glpk/glpk.h:117:9`! && prob->mcxx . . $ glp_prob#m. >= 200) |
| 196 | { int len, cnt = 0; |
| 197 | for (j = 1; j <= prob->ncxx . . $ glp_prob#n.; j++) |
| 198 | { len = glp_get_mat_colcxx . . $ glp_get_mat_col(223ff0a4a32a5807).(prob, j, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 199 | if ((double)len >= 0.20 * (double)prob->mcxx . . $ glp_prob#m.) cnt++; |
| 200 | } |
| 201 | if (cnt == 1) |
| 202 | xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("WARNING: PROBLEM HAS ONE DENSE COLUMN\n"); |
| 203 | else if (cnt > 0) |
| 204 | xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("WARNING: PROBLEM HAS %d DENSE COLUMNS\n", cnt); |
| 205 | } |
| 206 | /* solve the transformed LP */ |
| 207 | ret = ipm_solvecxx . . $ `external/glpk/glpipm.h:30:9`!(prob, parm); |
| 208 | /* postprocess solution from the transformed LP */ |
| 209 | npp_postprocesscxx . . $ `external/glpk/glpnpp.h:347:9`!(npp, prob); |
| 210 | /* and store solution to the original LP */ |
| 211 | npp_unload_solcxx . . $ `external/glpk/glpnpp.h:351:9`!(npp, P); |
| 212 | done: /* free working program objects */ |
| 213 | if (npp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) npp_delete_wkspcxx . . $ `external/glpk/glpnpp.h:355:9`!(npp); |
| 214 | if (prob != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) glp_delete_probcxx . . $ glp_delete_prob(84c60d68cac39b9a).(prob); |
| 215 | /* return to the application program */ |
| 216 | return ret; |
| 217 | } |
| 218 | |
| 219 | /*********************************************************************** |
| 220 | * NAME |
| 221 | * |
| 222 | * glp_init_iptcp - initialize interior-point solver control parameters |
| 223 | * |
| 224 | * SYNOPSIS |
| 225 | * |
| 226 | * void glp_init_iptcp(glp_iptcp *parm); |
| 227 | * |
| 228 | * DESCRIPTION |
| 229 | * |
| 230 | * The routine glp_init_iptcp initializes control parameters, which are |
| 231 | * used by the interior-point solver, with default values. |
| 232 | * |
| 233 | * Default values of the control parameters are stored in the glp_iptcp |
| 234 | * structure, which the parameter parm points to. */ |
| 235 | |
| 236 | void glp_init_iptcpcxx . . $ glp_init_iptcp(15c332fc7968b4e3).(glp_iptcpcxx . . $ glp_iptcp# *parm) |
| 237 | { parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_2#msg_lev. = GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!; |
| 238 | parm->ord_algcxx . . $ $anonymous_type_2d15b5456314bbc5_2#ord_alg. = GLP_ORD_AMDcxx . . $ `external/glpk/glpk.h:149:9`!; |
| 239 | return; |
| 240 | } |
| 241 | |
| 242 | /*********************************************************************** |
| 243 | * NAME |
| 244 | * |
| 245 | * glp_ipt_status - retrieve status of interior-point solution |
| 246 | * |
| 247 | * SYNOPSIS |
| 248 | * |
| 249 | * int glp_ipt_status(glp_prob *lp); |
| 250 | * |
| 251 | * RETURNS |
| 252 | * |
| 253 | * The routine glp_ipt_status reports the status of solution found by |
| 254 | * the interior-point solver as follows: |
| 255 | * |
| 256 | * GLP_UNDEF - interior-point solution is undefined; |
| 257 | * GLP_OPT - interior-point solution is optimal; |
| 258 | * GLP_INFEAS - interior-point solution is infeasible; |
| 259 | * GLP_NOFEAS - no feasible solution exists. */ |
| 260 | |
| 261 | int glp_ipt_statuscxx . . $ glp_ipt_status(317ecc1aeadfe2b7).(glp_probcxx . . $ glp_prob# *lp) |
| 262 | { int ipt_stat = lp->ipt_statcxx . . $ glp_prob#ipt_stat.; |
| 263 | return ipt_stat; |
| 264 | } |
| 265 | |
| 266 | /*********************************************************************** |
| 267 | * NAME |
| 268 | * |
| 269 | * glp_ipt_obj_val - retrieve objective value (interior point) |
| 270 | * |
| 271 | * SYNOPSIS |
| 272 | * |
| 273 | * double glp_ipt_obj_val(glp_prob *lp); |
| 274 | * |
| 275 | * RETURNS |
| 276 | * |
| 277 | * The routine glp_ipt_obj_val returns value of the objective function |
| 278 | * for interior-point solution. */ |
| 279 | |
| 280 | double glp_ipt_obj_valcxx . . $ glp_ipt_obj_val(cf94942ae12487e5).(glp_probcxx . . $ glp_prob# *lp) |
| 281 | { /*struct LPXCPS *cps = lp->cps;*/ |
| 282 | double z; |
| 283 | z = lp->ipt_objcxx . . $ glp_prob#ipt_obj.; |
| 284 | /*if (cps->round && fabs(z) < 1e-9) z = 0.0;*/ |
| 285 | return z; |
| 286 | } |
| 287 | |
| 288 | /*********************************************************************** |
| 289 | * NAME |
| 290 | * |
| 291 | * glp_ipt_row_prim - retrieve row primal value (interior point) |
| 292 | * |
| 293 | * SYNOPSIS |
| 294 | * |
| 295 | * double glp_ipt_row_prim(glp_prob *lp, int i); |
| 296 | * |
| 297 | * RETURNS |
| 298 | * |
| 299 | * The routine glp_ipt_row_prim returns primal value of the auxiliary |
| 300 | * variable associated with i-th row. */ |
| 301 | |
| 302 | double glp_ipt_row_primcxx . . $ glp_ipt_row_prim(68c5770eb0f32231).(glp_probcxx . . $ glp_prob# *lp, int i) |
| 303 | { /*struct LPXCPS *cps = lp->cps;*/ |
| 304 | double pval; |
| 305 | if (!(1 <= i && i <= lp->mcxx . . $ glp_prob#m.)) |
| 306 | xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_ipt_row_prim: i = %d; row number out of range\n", |
| 307 | i); |
| 308 | pval = lp->rowcxx . . $ glp_prob#row.[i]->pvalcxx . . $ GLPROW#pval.; |
| 309 | /*if (cps->round && fabs(pval) < 1e-9) pval = 0.0;*/ |
| 310 | return pval; |
| 311 | } |
| 312 | |
| 313 | /*********************************************************************** |
| 314 | * NAME |
| 315 | * |
| 316 | * glp_ipt_row_dual - retrieve row dual value (interior point) |
| 317 | * |
| 318 | * SYNOPSIS |
| 319 | * |
| 320 | * double glp_ipt_row_dual(glp_prob *lp, int i); |
| 321 | * |
| 322 | * RETURNS |
| 323 | * |
| 324 | * The routine glp_ipt_row_dual returns dual value (i.e. reduced cost) |
| 325 | * of the auxiliary variable associated with i-th row. */ |
| 326 | |
| 327 | double glp_ipt_row_dualcxx . . $ glp_ipt_row_dual(68c5770eb0f32231).(glp_probcxx . . $ glp_prob# *lp, int i) |
| 328 | { /*struct LPXCPS *cps = lp->cps;*/ |
| 329 | double dval; |
| 330 | if (!(1 <= i && i <= lp->mcxx . . $ glp_prob#m.)) |
| 331 | xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_ipt_row_dual: i = %d; row number out of range\n", |
| 332 | i); |
| 333 | dval = lp->rowcxx . . $ glp_prob#row.[i]->dvalcxx . . $ GLPROW#dval.; |
| 334 | /*if (cps->round && fabs(dval) < 1e-9) dval = 0.0;*/ |
| 335 | return dval; |
| 336 | } |
| 337 | |
| 338 | /*********************************************************************** |
| 339 | * NAME |
| 340 | * |
| 341 | * glp_ipt_col_prim - retrieve column primal value (interior point) |
| 342 | * |
| 343 | * SYNOPSIS |
| 344 | * |
| 345 | * double glp_ipt_col_prim(glp_prob *lp, int j); |
| 346 | * |
| 347 | * RETURNS |
| 348 | * |
| 349 | * The routine glp_ipt_col_prim returns primal value of the structural |
| 350 | * variable associated with j-th column. */ |
| 351 | |
| 352 | double glp_ipt_col_primcxx . . $ glp_ipt_col_prim(68c5770eb0f32231).(glp_probcxx . . $ glp_prob# *lp, int j) |
| 353 | { /*struct LPXCPS *cps = lp->cps;*/ |
| 354 | double pval; |
| 355 | if (!(1 <= j && j <= lp->ncxx . . $ glp_prob#n.)) |
| 356 | xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_ipt_col_prim: j = %d; column number out of range\n" |
| 357 | , j); |
| 358 | pval = lp->colcxx . . $ glp_prob#col.[j]->pvalcxx . . $ GLPCOL#pval.; |
| 359 | /*if (cps->round && fabs(pval) < 1e-9) pval = 0.0;*/ |
| 360 | return pval; |
| 361 | } |
| 362 | |
| 363 | /*********************************************************************** |
| 364 | * NAME |
| 365 | * |
| 366 | * glp_ipt_col_dual - retrieve column dual value (interior point) |
| 367 | * |
| 368 | * SYNOPSIS |
| 369 | * |
| 370 | * #include "glplpx.h" |
| 371 | * double glp_ipt_col_dual(glp_prob *lp, int j); |
| 372 | * |
| 373 | * RETURNS |
| 374 | * |
| 375 | * The routine glp_ipt_col_dual returns dual value (i.e. reduced cost) |
| 376 | * of the structural variable associated with j-th column. */ |
| 377 | |
| 378 | double glp_ipt_col_dualcxx . . $ glp_ipt_col_dual(68c5770eb0f32231).(glp_probcxx . . $ glp_prob# *lp, int j) |
| 379 | { /*struct LPXCPS *cps = lp->cps;*/ |
| 380 | double dval; |
| 381 | if (!(1 <= j && j <= lp->ncxx . . $ glp_prob#n.)) |
| 382 | xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_ipt_col_dual: j = %d; column number out of range\n" |
| 383 | , j); |
| 384 | dval = lp->colcxx . . $ glp_prob#col.[j]->dvalcxx . . $ GLPCOL#dval.; |
| 385 | /*if (cps->round && fabs(dval) < 1e-9) dval = 0.0;*/ |
| 386 | return dval; |
| 387 | } |
| 388 | |
| 389 | /* eof */ |