Debian Codegraph @

external/glpk/glpapi09.c

raw symbols SCIP
1 /* glpapi09.c (mixed integer programming routines) */cxx . . $ `<file>/external/glpk/glpapi09.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 "glpios.h"cxx . . $ `<file>/external/glpk/glpios.h`/
26 #include "glpnpp.h"cxx . . $ `<file>/external/glpk/glpnpp.h`/
27
28 /***********************************************************************
29 * NAME
30 *
31 * glp_set_col_kind - set (change) column kind
32 *
33 * SYNOPSIS
34 *
35 * void glp_set_col_kind(glp_prob *mip, int j, int kind);
36 *
37 * DESCRIPTION
38 *
39 * The routine glp_set_col_kind sets (changes) the kind of j-th column
40 * (structural variable) as specified by the parameter kind:
41 *
42 * GLP_CV - continuous variable;
43 * GLP_IV - integer variable;
44 * GLP_BV - binary variable. */
45
46 void glp_set_col_kindcxx . . $ glp_set_col_kind(b083f42914639ad0).(glp_probcxx . . $ glp_prob# *mip, int j, int kind)
47 { GLPCOLcxx . . $ GLPCOL# *col;
48 if (!(1 <= j && j <= mip->ncxx . . $ glp_prob#n.))
49 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_set_col_kind: j = %d; column number out of range\n"
50 , j);
51 col = mip->colcxx . . $ glp_prob#col.[j];
52 switch (kind)
53 { case GLP_CVcxx . . $ `external/glpk/glpk.h:54:9`!:
54 col->kindcxx . . $ GLPCOL#kind. = GLP_CVcxx . . $ `external/glpk/glpk.h:54:9`!;
55 break;
56 case GLP_IVcxx . . $ `external/glpk/glpk.h:55:9`!:
57 col->kindcxx . . $ GLPCOL#kind. = GLP_IVcxx . . $ `external/glpk/glpk.h:55:9`!;
58 break;
59 case GLP_BVcxx . . $ `external/glpk/glpk.h:56:9`!:
60 col->kindcxx . . $ GLPCOL#kind. = GLP_IVcxx . . $ `external/glpk/glpk.h:55:9`!;
61 if (!(col->typecxx . . $ GLPCOL#type. == GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`! && col->lbcxx . . $ GLPCOL#lb. == 0.0 && col->ubcxx . . $ GLPCOL#ub. ==
62 1.0)) glp_set_col_bndscxx . . $ glp_set_col_bnds(9376c6e48e598b7a).(mip, j, GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`!, 0.0, 1.0);
63 break;
64 default:
65 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_set_col_kind: j = %d; kind = %d; invalid column"
66 " kind\n", j, kind);
67 }
68 return;
69 }
70
71 /***********************************************************************
72 * NAME
73 *
74 * glp_get_col_kind - retrieve column kind
75 *
76 * SYNOPSIS
77 *
78 * int glp_get_col_kind(glp_prob *mip, int j);
79 *
80 * RETURNS
81 *
82 * The routine glp_get_col_kind returns the kind of j-th column, i.e.
83 * the kind of corresponding structural variable, as follows:
84 *
85 * GLP_CV - continuous variable;
86 * GLP_IV - integer variable;
87 * GLP_BV - binary variable */
88
89 int glp_get_col_kindcxx . . $ glp_get_col_kind(423829e847ef1a83).(glp_probcxx . . $ glp_prob# *mip, int j)
90 { GLPCOLcxx . . $ GLPCOL# *col;
91 int kind;
92 if (!(1 <= j && j <= mip->ncxx . . $ glp_prob#n.))
93 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_get_col_kind: j = %d; column number out of range\n"
94 , j);
95 col = mip->colcxx . . $ glp_prob#col.[j];
96 kind = col->kindcxx . . $ GLPCOL#kind.;
97 switch (kind)
98 { case GLP_CVcxx . . $ `external/glpk/glpk.h:54:9`!:
99 break;
100 case GLP_IVcxx . . $ `external/glpk/glpk.h:55:9`!:
101 if (col->typecxx . . $ GLPCOL#type. == GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`! && col->lbcxx . . $ GLPCOL#lb. == 0.0 && col->ubcxx . . $ GLPCOL#ub. == 1.0)
102 kind = GLP_BVcxx . . $ `external/glpk/glpk.h:56:9`!;
103 break;
104 default:
105 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(kind != kind);
106 }
107 return kind;
108 }
109
110 /***********************************************************************
111 * NAME
112 *
113 * glp_get_num_int - retrieve number of integer columns
114 *
115 * SYNOPSIS
116 *
117 * int glp_get_num_int(glp_prob *mip);
118 *
119 * RETURNS
120 *
121 * The routine glp_get_num_int returns the current number of columns,
122 * which are marked as integer. */
123
124 int glp_get_num_intcxx . . $ glp_get_num_int(317ecc1aeadfe2b7).(glp_probcxx . . $ glp_prob# *mip)
125 { GLPCOLcxx . . $ GLPCOL# *col;
126 int j, count = 0;
127 for (j = 1; j <= mip->ncxx . . $ glp_prob#n.; j++)
128 { col = mip->colcxx . . $ glp_prob#col.[j];
129 if (col->kindcxx . . $ GLPCOL#kind. == GLP_IVcxx . . $ `external/glpk/glpk.h:55:9`!) count++;
130 }
131 return count;
132 }
133
134 /***********************************************************************
135 * NAME
136 *
137 * glp_get_num_bin - retrieve number of binary columns
138 *
139 * SYNOPSIS
140 *
141 * int glp_get_num_bin(glp_prob *mip);
142 *
143 * RETURNS
144 *
145 * The routine glp_get_num_bin returns the current number of columns,
146 * which are marked as binary. */
147
148 int glp_get_num_bincxx . . $ glp_get_num_bin(317ecc1aeadfe2b7).(glp_probcxx . . $ glp_prob# *mip)
149 { GLPCOLcxx . . $ GLPCOL# *col;
150 int j, count = 0;
151 for (j = 1; j <= mip->ncxx . . $ glp_prob#n.; j++)
152 { col = mip->colcxx . . $ glp_prob#col.[j];
153 if (col->kindcxx . . $ GLPCOL#kind. == GLP_IVcxx . . $ `external/glpk/glpk.h:55:9`! && col->typecxx . . $ GLPCOL#type. == GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`! && col->lbcxx . . $ GLPCOL#lb. ==
154 0.0 && col->ubcxx . . $ GLPCOL#ub. == 1.0) count++;
155 }
156 return count;
157 }
158
159 /***********************************************************************
160 * NAME
161 *
162 * glp_intopt - solve MIP problem with the branch-and-bound method
163 *
164 * SYNOPSIS
165 *
166 * int glp_intopt(glp_prob *P, const glp_iocp *parm);
167 *
168 * DESCRIPTION
169 *
170 * The routine glp_intopt is a driver to the MIP solver based on the
171 * branch-and-bound method.
172 *
173 * On entry the problem object should contain optimal solution to LP
174 * relaxation (which can be obtained with the routine glp_simplex).
175 *
176 * The MIP solver has a set of control parameters. Values of the control
177 * parameters can be passed in a structure glp_iocp, which the parameter
178 * parm points to.
179 *
180 * The parameter parm can be specified as NULL, in which case the MIP
181 * solver uses default settings.
182 *
183 * RETURNS
184 *
185 * 0 The MIP problem instance has been successfully solved. This code
186 * does not necessarily mean that the solver has found optimal
187 * solution. It only means that the solution process was successful.
188 *
189 * GLP_EBOUND
190 * Unable to start the search, because some double-bounded variables
191 * have incorrect bounds or some integer variables have non-integer
192 * (fractional) bounds.
193 *
194 * GLP_EROOT
195 * Unable to start the search, because optimal basis for initial LP
196 * relaxation is not provided.
197 *
198 * GLP_EFAIL
199 * The search was prematurely terminated due to the solver failure.
200 *
201 * GLP_EMIPGAP
202 * The search was prematurely terminated, because the relative mip
203 * gap tolerance has been reached.
204 *
205 * GLP_ETMLIM
206 * The search was prematurely terminated, because the time limit has
207 * been exceeded.
208 *
209 * GLP_ENOPFS
210 * The MIP problem instance has no primal feasible solution (only if
211 * the MIP presolver is used).
212 *
213 * GLP_ENODFS
214 * LP relaxation of the MIP problem instance has no dual feasible
215 * solution (only if the MIP presolver is used).
216 *
217 * GLP_ESTOP
218 * The search was prematurely terminated by application. */
219
220 static int solve_mipcxx . . $ solve_mip(6369e4bd25f3670d).(glp_probcxx . . $ glp_prob# *P, const glp_iocpcxx . . $ glp_iocp# *parm)
221 { /* solve MIP directly without using the preprocessor */
222 glp_treecxx . . $ glp_tree# *T;
223 int ret;
224 /* optimal basis to LP relaxation must be provided */
225 if (glp_get_statuscxx . . $ glp_get_status(317ecc1aeadfe2b7).(P) != GLP_OPTcxx . . $ `external/glpk/glpk.h:89:9`!)
226 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!)
227 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_intopt: optimal basis to initial LP relaxation"
228 " not provided\n");
229 ret = GLP_EROOTcxx . . $ `external/glpk/glpk.h:250:9`!;
230 goto done;
231 }
232 /* it seems all is ok */
233 if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
234 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("Integer optimization begins...\n");
235 /* create the branch-and-bound tree */
236 T = ios_create_treecxx . . $ `external/glpk/glpios.h:387:9`!(P, parm);
237 /* solve the problem instance */
238 ret = ios_drivercxx . . $ `external/glpk/glpios.h:465:9`!(T);
239 /* delete the branch-and-bound tree */
240 ios_delete_treecxx . . $ `external/glpk/glpios.h:407:9`!(T);
241 /* analyze exit code reported by the mip driver */
242 if (ret == 0)
243 { if (P->mip_statcxx . . $ glp_prob#mip_stat. == GLP_FEAScxx . . $ `external/glpk/glpk.h:86:9`!)
244 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
245 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("INTEGER OPTIMAL SOLUTION FOUND\n");
246 P->mip_statcxx . . $ glp_prob#mip_stat. = GLP_OPTcxx . . $ `external/glpk/glpk.h:89:9`!;
247 }
248 else
249 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
250 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("PROBLEM HAS NO INTEGER FEASIBLE SOLUTION\n");
251 P->mip_statcxx . . $ glp_prob#mip_stat. = GLP_NOFEAScxx . . $ `external/glpk/glpk.h:88:9`!;
252 }
253 }
254 else if (ret == GLP_EMIPGAPcxx . . $ `external/glpk/glpk.h:252:9`!)
255 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
256 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("RELATIVE MIP GAP TOLERANCE REACHED; SEARCH TERMINA"
257 "TED\n");
258 }
259 else if (ret == GLP_ETMLIMcxx . . $ `external/glpk/glpk.h:247:9`!)
260 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
261 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("TIME LIMIT EXCEEDED; SEARCH TERMINATED\n");
262 }
263 else if (ret == GLP_EFAILcxx . . $ `external/glpk/glpk.h:243:9`!)
264 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!)
265 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_intopt: cannot solve current LP relaxation\n");
266 }
267 else if (ret == GLP_ESTOPcxx . . $ `external/glpk/glpk.h:251:9`!)
268 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
269 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("SEARCH TERMINATED BY APPLICATION\n");
270 }
271 else
272 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(ret != ret);
273 done: return ret;
274 }
275
276 static int preprocess_and_solve_mipcxx . . $ preprocess_and_solve_mip(6369e4bd25f3670d).(glp_probcxx . . $ glp_prob# *P, const glp_iocpcxx . . $ glp_iocp# *parm)
277 { /* solve MIP using the preprocessor */
278 ENVcxx . . $ ENV# *env = get_env_ptrcxx . . $ `external/glpk/glpenv.h:133:9`!();
279 int term_out = env->term_outcxx . . $ ENV#term_out.;
280 NPPcxx . . $ NPP# *npp;
281 glp_probcxx . . $ glp_prob# *mip = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
282 glp_bfcpcxx . . $ glp_bfcp# bfcp;
283 glp_smcpcxx . . $ glp_smcp# smcp;
284 int ret;
285 if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
286 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("Preprocessing...\n");
287 /* create preprocessor workspace */
288 npp = npp_create_wkspcxx . . $ `external/glpk/glpnpp.h:261:9`!();
289 /* load original problem into the preprocessor workspace */
290 npp_load_probcxx . . $ `external/glpk/glpnpp.h:338:9`!(npp, P, GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!, GLP_MIPcxx . . $ `external/glpk/glpk.h:82:9`!, GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!);
291 /* process MIP prior to applying the branch-and-bound method */
292 if (!term_out || parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. < GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
293 env->term_outcxx . . $ ENV#term_out. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
294 else
295 env->term_outcxx . . $ ENV#term_out. = GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`!;
296 ret = npp_integercxx . . $ `external/glpk/glpnpp.h:514:9`!(npp, parm);
297 env->term_outcxx . . $ ENV#term_out. = term_out;
298 if (ret == 0)
299 ;
300 else if (ret == GLP_ENOPFScxx . . $ `external/glpk/glpk.h:248:9`!)
301 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
302 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("PROBLEM HAS NO PRIMAL FEASIBLE SOLUTION\n");
303 }
304 else if (ret == GLP_ENODFScxx . . $ `external/glpk/glpk.h:249:9`!)
305 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
306 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("LP RELAXATION HAS NO DUAL FEASIBLE SOLUTION\n");
307 }
308 else
309 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(ret != ret);
310 if (ret != 0) goto done;
311 /* build transformed MIP */
312 mip = glp_create_probcxx . . $ glp_create_prob(7c2d8bedb6abbdaf).();
313 npp_build_probcxx . . $ `external/glpk/glpnpp.h:343:9`!(npp, mip);
314 /* if the transformed MIP is empty, it has empty solution, which
315 is optimal */
316 if (mip->mcxx . . $ glp_prob#m. == 0 && mip->ncxx . . $ glp_prob#n. == 0)
317 { mip->mip_statcxx . . $ glp_prob#mip_stat. = GLP_OPTcxx . . $ `external/glpk/glpk.h:89:9`!;
318 mip->mip_objcxx . . $ glp_prob#mip_obj. = mip->c0cxx . . $ glp_prob#c0.;
319 if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
320 { xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("Objective value = %17.9e\n", mip->mip_objcxx . . $ glp_prob#mip_obj.);
321 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("INTEGER OPTIMAL SOLUTION FOUND BY MIP PREPROCESSOR"
322 "\n");
323 }
324 goto post;
325 }
326 /* display some statistics */
327 if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
328 { int ni = glp_get_num_intcxx . . $ glp_get_num_int(317ecc1aeadfe2b7).(mip);
329 int nb = glp_get_num_bincxx . . $ glp_get_num_bin(317ecc1aeadfe2b7).(mip);
330 char s[50];
331 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("%d row%s, %d column%s, %d non-zero%s\n",
332 mip->mcxx . . $ glp_prob#m., mip->mcxx . . $ glp_prob#m. == 1 ? "" : "s", mip->ncxx . . $ glp_prob#n., mip->ncxx . . $ glp_prob#n. == 1 ? "" :
333 "s", mip->nnzcxx . . $ glp_prob#nnz., mip->nnzcxx . . $ glp_prob#nnz. == 1 ? "" : "s");
334 if (nb == 0)
335 strcpycxx . . $ strcpy(b7b3a83273496486).(s, "none of");
336 else if (ni == 1 && nb == 1)
337 strcpycxx . . $ strcpy(b7b3a83273496486).(s, "");
338 else if (nb == 1)
339 strcpycxx . . $ strcpy(b7b3a83273496486).(s, "one of");
340 else if (nb == ni)
341 strcpycxx . . $ strcpy(b7b3a83273496486).(s, "all of");
342 else
343 sprintfcxx . . $ sprintf(26c8642d26409d6d).(s, "%d of", nb);
344 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("%d integer variable%s, %s which %s binary\n",
345 ni, ni == 1 ? "" : "s", s, nb == 1 ? "is" : "are");
346 }
347 /* inherit basis factorization control parameters */
348 glp_get_bfcpcxx . . $ glp_get_bfcp(cc8cafde03995f03).(P, &bfcp);
349 glp_set_bfcpcxx . . $ glp_set_bfcp(cfafdb23988eec12).(mip, &bfcp);
350 /* scale the transformed problem */
351 if (!term_out || parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. < GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
352 env->term_outcxx . . $ ENV#term_out. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
353 else
354 env->term_outcxx . . $ ENV#term_out. = GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`!;
355 glp_scale_probcxx . . $ glp_scale_prob(e00ef8be97973834).(mip,
356 GLP_SF_GMcxx . . $ `external/glpk/glpk.h:73:9`! | GLP_SF_EQcxx . . $ `external/glpk/glpk.h:74:9`! | GLP_SF_2Ncxx . . $ `external/glpk/glpk.h:75:9`! | GLP_SF_SKIPcxx . . $ `external/glpk/glpk.h:76:9`!);
357 env->term_outcxx . . $ ENV#term_out. = term_out;
358 /* build advanced initial basis */
359 if (!term_out || parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. < GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
360 env->term_outcxx . . $ ENV#term_out. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
361 else
362 env->term_outcxx . . $ ENV#term_out. = GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`!;
363 glp_adv_basiscxx . . $ glp_adv_basis(e00ef8be97973834).(mip, 0);
364 env->term_outcxx . . $ ENV#term_out. = term_out;
365 /* solve initial LP relaxation */
366 if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
367 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("Solving LP relaxation...\n");
368 glp_init_smcpcxx . . $ glp_init_smcp(719730d4b69ecbe).(&smcp);
369 smcp.msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_1#msg_lev. = parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev.;
370 mip->it_cntcxx . . $ glp_prob#it_cnt. = P->it_cntcxx . . $ glp_prob#it_cnt.;
371 ret = glp_simplexcxx . . $ glp_simplex(115ca84ce6c1686e).(mip, &smcp);
372 P->it_cntcxx . . $ glp_prob#it_cnt. = mip->it_cntcxx . . $ glp_prob#it_cnt.;
373 if (ret != 0)
374 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!)
375 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_intopt: cannot solve LP relaxation\n");
376 ret = GLP_EFAILcxx . . $ `external/glpk/glpk.h:243:9`!;
377 goto done;
378 }
379 /* check status of the basic solution */
380 ret = glp_get_statuscxx . . $ glp_get_status(317ecc1aeadfe2b7).(mip);
381 if (ret == GLP_OPTcxx . . $ `external/glpk/glpk.h:89:9`!)
382 ret = 0;
383 else if (ret == GLP_NOFEAScxx . . $ `external/glpk/glpk.h:88:9`!)
384 ret = GLP_ENOPFScxx . . $ `external/glpk/glpk.h:248:9`!;
385 else if (ret == GLP_UNBNDcxx . . $ `external/glpk/glpk.h:90:9`!)
386 ret = GLP_ENODFScxx . . $ `external/glpk/glpk.h:249:9`!;
387 else
388 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(ret != ret);
389 if (ret != 0) goto done;
390 /* solve the transformed MIP */
391 mip->it_cntcxx . . $ glp_prob#it_cnt. = P->it_cntcxx . . $ glp_prob#it_cnt.;
392 ret = solve_mipcxx . . $ solve_mip(6369e4bd25f3670d).(mip, parm);
393 P->it_cntcxx . . $ glp_prob#it_cnt. = mip->it_cntcxx . . $ glp_prob#it_cnt.;
394 /* only integer feasible solution can be postprocessed */
395 if (!(mip->mip_statcxx . . $ glp_prob#mip_stat. == GLP_OPTcxx . . $ `external/glpk/glpk.h:89:9`! || mip->mip_statcxx . . $ glp_prob#mip_stat. == GLP_FEAScxx . . $ `external/glpk/glpk.h:86:9`!))
396 { P->mip_statcxx . . $ glp_prob#mip_stat. = mip->mip_statcxx . . $ glp_prob#mip_stat.;
397 goto done;
398 }
399 /* postprocess solution from the transformed MIP */
400 post: npp_postprocesscxx . . $ `external/glpk/glpnpp.h:347:9`!(npp, mip);
401 /* the transformed MIP is no longer needed */
402 glp_delete_probcxx . . $ glp_delete_prob(84c60d68cac39b9a).(mip), mip = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
403 /* store solution to the original problem */
404 npp_unload_solcxx . . $ `external/glpk/glpnpp.h:351:9`!(npp, P);
405 done: /* delete the transformed MIP, if it exists */
406 if (mip != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) glp_delete_probcxx . . $ glp_delete_prob(84c60d68cac39b9a).(mip);
407 /* delete preprocessor workspace */
408 npp_delete_wkspcxx . . $ `external/glpk/glpnpp.h:355:9`!(npp);
409 return ret;
410 }
411
412 #ifndef HAVE_ALIEN_SOLVER /* 28/V-2010 */
413 int _glp_intopt1cxx . . $ _glp_intopt1(6369e4bd25f3670d).(glp_probcxx . . $ glp_prob# *P, const glp_iocpcxx . . $ glp_iocp# *parm)
414 { xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(P == P);
415 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(parm == parm);
416 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_intopt: no alien solver is available\n");
417 return GLP_EFAILcxx . . $ `external/glpk/glpk.h:243:9`!;
418 }
419 #endif
420
421 int glp_intoptcxx . . $ glp_intopt(6369e4bd25f3670d).(glp_probcxx . . $ glp_prob# *P, const glp_iocpcxx . . $ glp_iocp# *parm)
422 { /* solve MIP problem with the branch-and-bound method */
423 glp_iocpcxx . . $ glp_iocp# _parm;
424 int i, j, ret;
425 /* check problem object */
426 if (P == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || P->magiccxx . . $ glp_prob#magic. != GLP_PROB_MAGICcxx . . $ `external/glpk/glpapi.h:39:9`!)
427 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: P = %p; invalid problem object\n", P);
428 if (P->treecxx . . $ glp_prob#tree. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
429 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: operation not allowed\n");
430 /* check control parameters */
431 if (parm == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
432 parm = &_parm, glp_init_iocpcxx . . $ glp_init_iocp(b61dbaae1883028f).((glp_iocpcxx . . $ glp_iocp# *)parm);
433 if (!(parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. == GLP_MSG_OFFcxx . . $ `external/glpk/glpk.h:115:9`! ||
434 parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. == GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`! ||
435 parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. == GLP_MSG_ONcxx . . $ `external/glpk/glpk.h:117:9`! ||
436 parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. == GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`! ||
437 parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. == GLP_MSG_DBGcxx . . $ `external/glpk/glpk.h:119:9`!))
438 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: msg_lev = %d; invalid parameter\n",
439 parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev.);
440 if (!(parm->br_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#br_tech. == GLP_BR_FFVcxx . . $ `external/glpk/glpk.h:164:9`! ||
441 parm->br_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#br_tech. == GLP_BR_LFVcxx . . $ `external/glpk/glpk.h:165:9`! ||
442 parm->br_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#br_tech. == GLP_BR_MFVcxx . . $ `external/glpk/glpk.h:166:9`! ||
443 parm->br_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#br_tech. == GLP_BR_DTHcxx . . $ `external/glpk/glpk.h:167:9`! ||
444 parm->br_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#br_tech. == GLP_BR_PCHcxx . . $ `external/glpk/glpk.h:168:9`!))
445 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: br_tech = %d; invalid parameter\n",
446 parm->br_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#br_tech.);
447 if (!(parm->bt_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#bt_tech. == GLP_BT_DFScxx . . $ `external/glpk/glpk.h:170:9`! ||
448 parm->bt_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#bt_tech. == GLP_BT_BFScxx . . $ `external/glpk/glpk.h:171:9`! ||
449 parm->bt_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#bt_tech. == GLP_BT_BLBcxx . . $ `external/glpk/glpk.h:172:9`! ||
450 parm->bt_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#bt_tech. == GLP_BT_BPHcxx . . $ `external/glpk/glpk.h:173:9`!))
451 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: bt_tech = %d; invalid parameter\n",
452 parm->bt_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#bt_tech.);
453 if (!(0.0 < parm->tol_intcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tol_int. && parm->tol_intcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tol_int. < 1.0))
454 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: tol_int = %g; invalid parameter\n",
455 parm->tol_intcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tol_int.);
456 if (!(0.0 < parm->tol_objcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tol_obj. && parm->tol_objcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tol_obj. < 1.0))
457 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: tol_obj = %g; invalid parameter\n",
458 parm->tol_objcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tol_obj.);
459 if (parm->tm_limcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tm_lim. < 0)
460 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: tm_lim = %d; invalid parameter\n",
461 parm->tm_limcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tm_lim.);
462 if (parm->out_frqcxx . . $ $anonymous_type_2d15b5456314bbc5_3#out_frq. < 0)
463 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: out_frq = %d; invalid parameter\n",
464 parm->out_frqcxx . . $ $anonymous_type_2d15b5456314bbc5_3#out_frq.);
465 if (parm->out_dlycxx . . $ $anonymous_type_2d15b5456314bbc5_3#out_dly. < 0)
466 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: out_dly = %d; invalid parameter\n",
467 parm->out_dlycxx . . $ $anonymous_type_2d15b5456314bbc5_3#out_dly.);
468 if (!(0 <= parm->cb_sizecxx . . $ $anonymous_type_2d15b5456314bbc5_3#cb_size. && parm->cb_sizecxx . . $ $anonymous_type_2d15b5456314bbc5_3#cb_size. <= 256))
469 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: cb_size = %d; invalid parameter\n",
470 parm->cb_sizecxx . . $ $anonymous_type_2d15b5456314bbc5_3#cb_size.);
471 if (!(parm->pp_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#pp_tech. == GLP_PP_NONEcxx . . $ `external/glpk/glpk.h:184:9`! ||
472 parm->pp_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#pp_tech. == GLP_PP_ROOTcxx . . $ `external/glpk/glpk.h:185:9`! ||
473 parm->pp_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#pp_tech. == GLP_PP_ALLcxx . . $ `external/glpk/glpk.h:186:9`!))
474 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: pp_tech = %d; invalid parameter\n",
475 parm->pp_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#pp_tech.);
476 if (parm->mip_gapcxx . . $ $anonymous_type_2d15b5456314bbc5_3#mip_gap. < 0.0)
477 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: mip_gap = %g; invalid parameter\n",
478 parm->mip_gapcxx . . $ $anonymous_type_2d15b5456314bbc5_3#mip_gap.);
479 if (!(parm->mir_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#mir_cuts. == GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`! || parm->mir_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#mir_cuts. == GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!))
480 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: mir_cuts = %d; invalid parameter\n",
481 parm->mir_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#mir_cuts.);
482 if (!(parm->gmi_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#gmi_cuts. == GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`! || parm->gmi_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#gmi_cuts. == GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!))
483 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: gmi_cuts = %d; invalid parameter\n",
484 parm->gmi_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#gmi_cuts.);
485 if (!(parm->cov_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#cov_cuts. == GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`! || parm->cov_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#cov_cuts. == GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!))
486 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: cov_cuts = %d; invalid parameter\n",
487 parm->cov_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#cov_cuts.);
488 if (!(parm->clq_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#clq_cuts. == GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`! || parm->clq_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#clq_cuts. == GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!))
489 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: clq_cuts = %d; invalid parameter\n",
490 parm->clq_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#clq_cuts.);
491 if (!(parm->presolvecxx . . $ $anonymous_type_2d15b5456314bbc5_3#presolve. == GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`! || parm->presolvecxx . . $ $anonymous_type_2d15b5456314bbc5_3#presolve. == GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!))
492 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: presolve = %d; invalid parameter\n",
493 parm->presolvecxx . . $ $anonymous_type_2d15b5456314bbc5_3#presolve.);
494 if (!(parm->binarizecxx . . $ $anonymous_type_2d15b5456314bbc5_3#binarize. == GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`! || parm->binarizecxx . . $ $anonymous_type_2d15b5456314bbc5_3#binarize. == GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!))
495 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: binarize = %d; invalid parameter\n",
496 parm->binarizecxx . . $ $anonymous_type_2d15b5456314bbc5_3#binarize.);
497 if (!(parm->fp_heurcxx . . $ $anonymous_type_2d15b5456314bbc5_3#fp_heur. == GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`! || parm->fp_heurcxx . . $ $anonymous_type_2d15b5456314bbc5_3#fp_heur. == GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!))
498 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: fp_heur = %d; invalid parameter\n",
499 parm->fp_heurcxx . . $ $anonymous_type_2d15b5456314bbc5_3#fp_heur.);
500 #if 1 /* 28/V-2010 */
501 if (!(parm->aliencxx . . $ $anonymous_type_2d15b5456314bbc5_3#alien. == GLP_ONcxx . . $ `external/glpk/glpk.h:221:9`! || parm->aliencxx . . $ $anonymous_type_2d15b5456314bbc5_3#alien. == GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!))
502 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_intopt: alien = %d; invalid parameter\n",
503 parm->aliencxx . . $ $anonymous_type_2d15b5456314bbc5_3#alien.);
504 #endif
505 /* integer solution is currently undefined */
506 P->mip_statcxx . . $ glp_prob#mip_stat. = GLP_UNDEFcxx . . $ `external/glpk/glpk.h:85:9`!;
507 P->mip_objcxx . . $ glp_prob#mip_obj. = 0.0;
508 /* check bounds of double-bounded variables */
509 for (i = 1; i <= P->mcxx . . $ glp_prob#m.; i++)
510 { GLPROWcxx . . $ GLPROW# *row = P->rowcxx . . $ glp_prob#row.[i];
511 if (row->typecxx . . $ GLPROW#type. == GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`! && row->lbcxx . . $ GLPROW#lb. >= row->ubcxx . . $ GLPROW#ub.)
512 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!)
513 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_intopt: row %d: lb = %g, ub = %g; incorrect"
514 " bounds\n", i, row->lbcxx . . $ GLPROW#lb., row->ubcxx . . $ GLPROW#ub.);
515 ret = GLP_EBOUNDcxx . . $ `external/glpk/glpk.h:242:9`!;
516 goto done;
517 }
518 }
519 for (j = 1; j <= P->ncxx . . $ glp_prob#n.; j++)
520 { GLPCOLcxx . . $ GLPCOL# *col = P->colcxx . . $ glp_prob#col.[j];
521 if (col->typecxx . . $ GLPCOL#type. == GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`! && col->lbcxx . . $ GLPCOL#lb. >= col->ubcxx . . $ GLPCOL#ub.)
522 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!)
523 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_intopt: column %d: lb = %g, ub = %g; incorr"
524 "ect bounds\n", j, col->lbcxx . . $ GLPCOL#lb., col->ubcxx . . $ GLPCOL#ub.);
525 ret = GLP_EBOUNDcxx . . $ `external/glpk/glpk.h:242:9`!;
526 goto done;
527 }
528 }
529 /* bounds of all integer variables must be integral */
530 for (j = 1; j <= P->ncxx . . $ glp_prob#n.; j++)
531 { GLPCOLcxx . . $ GLPCOL# *col = P->colcxx . . $ glp_prob#col.[j];
532 if (col->kindcxx . . $ GLPCOL#kind. != GLP_IVcxx . . $ `external/glpk/glpk.h:55:9`!) continue;
533 if (col->typecxx . . $ GLPCOL#type. == GLP_LOcxx . . $ `external/glpk/glpk.h:60:9`! || col->typecxx . . $ GLPCOL#type. == GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`!)
534 { if (col->lbcxx . . $ GLPCOL#lb. != floorcxx . . $ floor(447c67c6676f75c3).(col->lbcxx . . $ GLPCOL#lb.))
535 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!)
536 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_intopt: integer column %d has non-intege"
537 "r lower bound %g\n", j, col->lbcxx . . $ GLPCOL#lb.);
538 ret = GLP_EBOUNDcxx . . $ `external/glpk/glpk.h:242:9`!;
539 goto done;
540 }
541 }
542 if (col->typecxx . . $ GLPCOL#type. == GLP_UPcxx . . $ `external/glpk/glpk.h:61:9`! || col->typecxx . . $ GLPCOL#type. == GLP_DBcxx . . $ `external/glpk/glpk.h:62:9`!)
543 { if (col->ubcxx . . $ GLPCOL#ub. != floorcxx . . $ floor(447c67c6676f75c3).(col->ubcxx . . $ GLPCOL#ub.))
544 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!)
545 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_intopt: integer column %d has non-intege"
546 "r upper bound %g\n", j, col->ubcxx . . $ GLPCOL#ub.);
547 ret = GLP_EBOUNDcxx . . $ `external/glpk/glpk.h:242:9`!;
548 goto done;
549 }
550 }
551 if (col->typecxx . . $ GLPCOL#type. == GLP_FXcxx . . $ `external/glpk/glpk.h:63:9`!)
552 { if (col->lbcxx . . $ GLPCOL#lb. != floorcxx . . $ floor(447c67c6676f75c3).(col->lbcxx . . $ GLPCOL#lb.))
553 { if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ERRcxx . . $ `external/glpk/glpk.h:116:9`!)
554 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("glp_intopt: integer column %d has non-intege"
555 "r fixed value %g\n", j, col->lbcxx . . $ GLPCOL#lb.);
556 ret = GLP_EBOUNDcxx . . $ `external/glpk/glpk.h:242:9`!;
557 goto done;
558 }
559 }
560 }
561 /* solve MIP problem */
562 if (parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. >= GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!)
563 { int ni = glp_get_num_intcxx . . $ glp_get_num_int(317ecc1aeadfe2b7).(P);
564 int nb = glp_get_num_bincxx . . $ glp_get_num_bin(317ecc1aeadfe2b7).(P);
565 char s[50];
566 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("GLPK Integer Optimizer, v%s\n", glp_versioncxx . . $ glp_version(33a1f659e94feb42).());
567 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("%d row%s, %d column%s, %d non-zero%s\n",
568 P->mcxx . . $ glp_prob#m., P->mcxx . . $ glp_prob#m. == 1 ? "" : "s", P->ncxx . . $ glp_prob#n., P->ncxx . . $ glp_prob#n. == 1 ? "" : "s",
569 P->nnzcxx . . $ glp_prob#nnz., P->nnzcxx . . $ glp_prob#nnz. == 1 ? "" : "s");
570 if (nb == 0)
571 strcpycxx . . $ strcpy(b7b3a83273496486).(s, "none of");
572 else if (ni == 1 && nb == 1)
573 strcpycxx . . $ strcpy(b7b3a83273496486).(s, "");
574 else if (nb == 1)
575 strcpycxx . . $ strcpy(b7b3a83273496486).(s, "one of");
576 else if (nb == ni)
577 strcpycxx . . $ strcpy(b7b3a83273496486).(s, "all of");
578 else
579 sprintfcxx . . $ sprintf(26c8642d26409d6d).(s, "%d of", nb);
580 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("%d integer variable%s, %s which %s binary\n",
581 ni, ni == 1 ? "" : "s", s, nb == 1 ? "is" : "are");
582 }
583 #if 1 /* 28/V-2010 */
584 if (parm->aliencxx . . $ $anonymous_type_2d15b5456314bbc5_3#alien.)
585 { /* use alien integer optimizer */
586 ret = _glp_intopt1cxx . . $ _glp_intopt1(6369e4bd25f3670d).(P, parm);
587 goto done;
588 }
589 #endif
590 if (!parm->presolvecxx . . $ $anonymous_type_2d15b5456314bbc5_3#presolve.)
591 ret = solve_mipcxx . . $ solve_mip(6369e4bd25f3670d).(P, parm);
592 else
593 ret = preprocess_and_solve_mipcxx . . $ preprocess_and_solve_mip(6369e4bd25f3670d).(P, parm);
594 done: /* return to the application program */
595 return ret;
596 }
597
598 /***********************************************************************
599 * NAME
600 *
601 * glp_init_iocp - initialize integer optimizer control parameters
602 *
603 * SYNOPSIS
604 *
605 * void glp_init_iocp(glp_iocp *parm);
606 *
607 * DESCRIPTION
608 *
609 * The routine glp_init_iocp initializes control parameters, which are
610 * used by the integer optimizer, with default values.
611 *
612 * Default values of the control parameters are stored in a glp_iocp
613 * structure, which the parameter parm points to. */
614
615 void glp_init_iocpcxx . . $ glp_init_iocp(b61dbaae1883028f).(glp_iocpcxx . . $ glp_iocp# *parm)
616 { parm->msg_levcxx . . $ $anonymous_type_2d15b5456314bbc5_3#msg_lev. = GLP_MSG_ALLcxx . . $ `external/glpk/glpk.h:118:9`!;
617 parm->br_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#br_tech. = GLP_BR_DTHcxx . . $ `external/glpk/glpk.h:167:9`!;
618 parm->bt_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#bt_tech. = GLP_BT_BLBcxx . . $ `external/glpk/glpk.h:172:9`!;
619 parm->tol_intcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tol_int. = 1e-5;
620 parm->tol_objcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tol_obj. = 1e-7;
621 parm->tm_limcxx . . $ $anonymous_type_2d15b5456314bbc5_3#tm_lim. = INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!;
622 parm->out_frqcxx . . $ $anonymous_type_2d15b5456314bbc5_3#out_frq. = 5000;
623 parm->out_dlycxx . . $ $anonymous_type_2d15b5456314bbc5_3#out_dly. = 10000;
624 parm->cb_funccxx . . $ $anonymous_type_2d15b5456314bbc5_3#cb_func. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
625 parm->cb_infocxx . . $ $anonymous_type_2d15b5456314bbc5_3#cb_info. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
626 parm->cb_sizecxx . . $ $anonymous_type_2d15b5456314bbc5_3#cb_size. = 0;
627 parm->pp_techcxx . . $ $anonymous_type_2d15b5456314bbc5_3#pp_tech. = GLP_PP_ALLcxx . . $ `external/glpk/glpk.h:186:9`!;
628 parm->mip_gapcxx . . $ $anonymous_type_2d15b5456314bbc5_3#mip_gap. = 0.0;
629 parm->mir_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#mir_cuts. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
630 parm->gmi_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#gmi_cuts. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
631 parm->cov_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#cov_cuts. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
632 parm->clq_cutscxx . . $ $anonymous_type_2d15b5456314bbc5_3#clq_cuts. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
633 parm->presolvecxx . . $ $anonymous_type_2d15b5456314bbc5_3#presolve. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
634 parm->binarizecxx . . $ $anonymous_type_2d15b5456314bbc5_3#binarize. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
635 parm->fp_heurcxx . . $ $anonymous_type_2d15b5456314bbc5_3#fp_heur. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
636 #if 1 /* 28/V-2010 */
637 parm->aliencxx . . $ $anonymous_type_2d15b5456314bbc5_3#alien. = GLP_OFFcxx . . $ `external/glpk/glpk.h:222:9`!;
638 #endif
639 return;
640 }
641
642 /***********************************************************************
643 * NAME
644 *
645 * glp_mip_status - retrieve status of MIP solution
646 *
647 * SYNOPSIS
648 *
649 * int glp_mip_status(glp_prob *mip);
650 *
651 * RETURNS
652 *
653 * The routine lpx_mip_status reports the status of MIP solution found
654 * by the branch-and-bound solver as follows:
655 *
656 * GLP_UNDEF - MIP solution is undefined;
657 * GLP_OPT - MIP solution is integer optimal;
658 * GLP_FEAS - MIP solution is integer feasible but its optimality
659 * (or non-optimality) has not been proven, perhaps due to
660 * premature termination of the search;
661 * GLP_NOFEAS - problem has no integer feasible solution (proven by the
662 * solver). */
663
664 int glp_mip_statuscxx . . $ glp_mip_status(317ecc1aeadfe2b7).(glp_probcxx . . $ glp_prob# *mip)
665 { int mip_stat = mip->mip_statcxx . . $ glp_prob#mip_stat.;
666 return mip_stat;
667 }
668
669 /***********************************************************************
670 * NAME
671 *
672 * glp_mip_obj_val - retrieve objective value (MIP solution)
673 *
674 * SYNOPSIS
675 *
676 * double glp_mip_obj_val(glp_prob *mip);
677 *
678 * RETURNS
679 *
680 * The routine glp_mip_obj_val returns value of the objective function
681 * for MIP solution. */
682
683 double glp_mip_obj_valcxx . . $ glp_mip_obj_val(cf94942ae12487e5).(glp_probcxx . . $ glp_prob# *mip)
684 { /*struct LPXCPS *cps = mip->cps;*/
685 double z;
686 z = mip->mip_objcxx . . $ glp_prob#mip_obj.;
687 /*if (cps->round && fabs(z) < 1e-9) z = 0.0;*/
688 return z;
689 }
690
691 /***********************************************************************
692 * NAME
693 *
694 * glp_mip_row_val - retrieve row value (MIP solution)
695 *
696 * SYNOPSIS
697 *
698 * double glp_mip_row_val(glp_prob *mip, int i);
699 *
700 * RETURNS
701 *
702 * The routine glp_mip_row_val returns value of the auxiliary variable
703 * associated with i-th row. */
704
705 double glp_mip_row_valcxx . . $ glp_mip_row_val(68c5770eb0f32231).(glp_probcxx . . $ glp_prob# *mip, int i)
706 { /*struct LPXCPS *cps = mip->cps;*/
707 double mipx;
708 if (!(1 <= i && i <= mip->mcxx . . $ glp_prob#m.))
709 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_mip_row_val: i = %d; row number out of range\n", i)
710 ;
711 mipx = mip->rowcxx . . $ glp_prob#row.[i]->mipxcxx . . $ GLPROW#mipx.;
712 /*if (cps->round && fabs(mipx) < 1e-9) mipx = 0.0;*/
713 return mipx;
714 }
715
716 /***********************************************************************
717 * NAME
718 *
719 * glp_mip_col_val - retrieve column value (MIP solution)
720 *
721 * SYNOPSIS
722 *
723 * double glp_mip_col_val(glp_prob *mip, int j);
724 *
725 * RETURNS
726 *
727 * The routine glp_mip_col_val returns value of the structural variable
728 * associated with j-th column. */
729
730 double glp_mip_col_valcxx . . $ glp_mip_col_val(68c5770eb0f32231).(glp_probcxx . . $ glp_prob# *mip, int j)
731 { /*struct LPXCPS *cps = mip->cps;*/
732 double mipx;
733 if (!(1 <= j && j <= mip->ncxx . . $ glp_prob#n.))
734 xerrorcxx . . $ `external/glpk/glpenv.h:158:9`!("glp_mip_col_val: j = %d; column number out of range\n",
735 j);
736 mipx = mip->colcxx . . $ glp_prob#col.[j]->mipxcxx . . $ GLPCOL#mipx.;
737 /*if (cps->round && fabs(mipx) < 1e-9) mipx = 0.0;*/
738 return mipx;
739 }
740
741 /* eof */