Debian Codegraph @

external/glpk/glpios08.c

raw symbols SCIP
1 /* glpios08.c (clique cut generator) */cxx . . $ `<file>/external/glpk/glpios08.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
27 static double get_row_lbcxx . . $ get_row_lb(68c5770eb0f32231).(LPXcxx . . $ `external/glpk/glpk.h:1087:9`! *lp, int i)
28 { /* this routine returns lower bound of row i or -DBL_MAX if the
29 row has no lower bound */
30 double lb;
31 switch (lpx_get_row_typecxx . . $ `external/glpk/glpk.h:1388:9`!(lp, i))
32 { case LPX_FRcxx . . $ `external/glpk/glpk.h:1094:9`!:
33 case LPX_UPcxx . . $ `external/glpk/glpk.h:1096:9`!:
34 lb = -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
35 break;
36 case LPX_LOcxx . . $ `external/glpk/glpk.h:1095:9`!:
37 case LPX_DBcxx . . $ `external/glpk/glpk.h:1097:9`!:
38 case LPX_FXcxx . . $ `external/glpk/glpk.h:1098:9`!:
39 lb = lpx_get_row_lbcxx . . $ `external/glpk/glpk.h:1392:9`!(lp, i);
40 break;
41 default:
42 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(lp != lp);
43 }
44 return lb;
45 }
46
47 static double get_row_ubcxx . . $ get_row_ub(68c5770eb0f32231).(LPXcxx . . $ `external/glpk/glpk.h:1087:9`! *lp, int i)
48 { /* this routine returns upper bound of row i or +DBL_MAX if the
49 row has no upper bound */
50 double ub;
51 switch (lpx_get_row_typecxx . . $ `external/glpk/glpk.h:1388:9`!(lp, i))
52 { case LPX_FRcxx . . $ `external/glpk/glpk.h:1094:9`!:
53 case LPX_LOcxx . . $ `external/glpk/glpk.h:1095:9`!:
54 ub = +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
55 break;
56 case LPX_UPcxx . . $ `external/glpk/glpk.h:1096:9`!:
57 case LPX_DBcxx . . $ `external/glpk/glpk.h:1097:9`!:
58 case LPX_FXcxx . . $ `external/glpk/glpk.h:1098:9`!:
59 ub = lpx_get_row_ubcxx . . $ `external/glpk/glpk.h:1396:9`!(lp, i);
60 break;
61 default:
62 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(lp != lp);
63 }
64 return ub;
65 }
66
67 static double get_col_lbcxx . . $ get_col_lb(68c5770eb0f32231).(LPXcxx . . $ `external/glpk/glpk.h:1087:9`! *lp, int j)
68 { /* this routine returns lower bound of column j or -DBL_MAX if
69 the column has no lower bound */
70 double lb;
71 switch (lpx_get_col_typecxx . . $ `external/glpk/glpk.h:1405:9`!(lp, j))
72 { case LPX_FRcxx . . $ `external/glpk/glpk.h:1094:9`!:
73 case LPX_UPcxx . . $ `external/glpk/glpk.h:1096:9`!:
74 lb = -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
75 break;
76 case LPX_LOcxx . . $ `external/glpk/glpk.h:1095:9`!:
77 case LPX_DBcxx . . $ `external/glpk/glpk.h:1097:9`!:
78 case LPX_FXcxx . . $ `external/glpk/glpk.h:1098:9`!:
79 lb = lpx_get_col_lbcxx . . $ `external/glpk/glpk.h:1409:9`!(lp, j);
80 break;
81 default:
82 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(lp != lp);
83 }
84 return lb;
85 }
86
87 static double get_col_ubcxx . . $ get_col_ub(68c5770eb0f32231).(LPXcxx . . $ `external/glpk/glpk.h:1087:9`! *lp, int j)
88 { /* this routine returns upper bound of column j or +DBL_MAX if
89 the column has no upper bound */
90 double ub;
91 switch (lpx_get_col_typecxx . . $ `external/glpk/glpk.h:1405:9`!(lp, j))
92 { case LPX_FRcxx . . $ `external/glpk/glpk.h:1094:9`!:
93 case LPX_LOcxx . . $ `external/glpk/glpk.h:1095:9`!:
94 ub = +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
95 break;
96 case LPX_UPcxx . . $ `external/glpk/glpk.h:1096:9`!:
97 case LPX_DBcxx . . $ `external/glpk/glpk.h:1097:9`!:
98 case LPX_FXcxx . . $ `external/glpk/glpk.h:1098:9`!:
99 ub = lpx_get_col_ubcxx . . $ `external/glpk/glpk.h:1413:9`!(lp, j);
100 break;
101 default:
102 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(lp != lp);
103 }
104 return ub;
105 }
106
107 static int is_binarycxx . . $ is_binary(423829e847ef1a83).(LPXcxx . . $ `external/glpk/glpk.h:1087:9`! *lp, int j)
108 { /* this routine checks if variable x[j] is binary */
109 return
110 lpx_get_col_kindcxx . . $ `external/glpk/glpk.h:1618:9`!(lp, j) == LPX_IVcxx . . $ `external/glpk/glpk.h:1129:9`! &&
111 lpx_get_col_typecxx . . $ `external/glpk/glpk.h:1405:9`!(lp, j) == LPX_DBcxx . . $ `external/glpk/glpk.h:1097:9`! &&
112 lpx_get_col_lbcxx . . $ `external/glpk/glpk.h:1409:9`!(lp, j) == 0.0 && lpx_get_col_ubcxx . . $ `external/glpk/glpk.h:1413:9`!(lp, j) == 1.0;
113 }
114
115 static double eval_lf_mincxx . . $ eval_lf_min(f652181b53f7e993).(LPXcxx . . $ `external/glpk/glpk.h:1087:9`! *lp, int len, int ind[], double val[])
116 { /* this routine computes the minimum of a specified linear form
117
118 sum a[j]*x[j]
119 j
120
121 using the formula:
122
123 min = sum a[j]*lb[j] + sum a[j]*ub[j],
124 j in J+ j in J-
125
126 where J+ = {j: a[j] > 0}, J- = {j: a[j] < 0}, lb[j] and ub[j]
127 are lower and upper bound of variable x[j], resp. */
128 int j, t;
129 double lb, ub, sum;
130 sum = 0.0;
131 for (t = 1; t <= len; t++)
132 { j = ind[t];
133 if (val[t] > 0.0)
134 { lb = get_col_lbcxx . . $ get_col_lb(68c5770eb0f32231).(lp, j);
135 if (lb == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
136 { sum = -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
137 break;
138 }
139 sum += val[t] * lb;
140 }
141 else if (val[t] < 0.0)
142 { ub = get_col_ubcxx . . $ get_col_ub(68c5770eb0f32231).(lp, j);
143 if (ub == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
144 { sum = -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
145 break;
146 }
147 sum += val[t] * ub;
148 }
149 else
150 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(val != val);
151 }
152 return sum;
153 }
154
155 static double eval_lf_maxcxx . . $ eval_lf_max(f652181b53f7e993).(LPXcxx . . $ `external/glpk/glpk.h:1087:9`! *lp, int len, int ind[], double val[])
156 { /* this routine computes the maximum of a specified linear form
157
158 sum a[j]*x[j]
159 j
160
161 using the formula:
162
163 max = sum a[j]*ub[j] + sum a[j]*lb[j],
164 j in J+ j in J-
165
166 where J+ = {j: a[j] > 0}, J- = {j: a[j] < 0}, lb[j] and ub[j]
167 are lower and upper bound of variable x[j], resp. */
168 int j, t;
169 double lb, ub, sum;
170 sum = 0.0;
171 for (t = 1; t <= len; t++)
172 { j = ind[t];
173 if (val[t] > 0.0)
174 { ub = get_col_ubcxx . . $ get_col_ub(68c5770eb0f32231).(lp, j);
175 if (ub == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
176 { sum = +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
177 break;
178 }
179 sum += val[t] * ub;
180 }
181 else if (val[t] < 0.0)
182 { lb = get_col_lbcxx . . $ get_col_lb(68c5770eb0f32231).(lp, j);
183 if (lb == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
184 { sum = +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
185 break;
186 }
187 sum += val[t] * lb;
188 }
189 else
190 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(val != val);
191 }
192 return sum;
193 }
194
195 /*----------------------------------------------------------------------
196 -- probing - determine logical relation between binary variables.
197 --
198 -- This routine tentatively sets a binary variable to 0 and then to 1
199 -- and examines whether another binary variable is caused to be fixed.
200 --
201 -- The examination is based only on one row (constraint), which is the
202 -- following:
203 --
204 -- L <= sum a[j]*x[j] <= U. (1)
205 -- j
206 --
207 -- Let x[p] be a probing variable, x[q] be an examined variable. Then
208 -- (1) can be written as:
209 --
210 -- L <= sum a[j]*x[j] + a[p]*x[p] + a[q]*x[q] <= U, (2)
211 -- j in J'
212 --
213 -- where J' = {j: j != p and j != q}.
214 --
215 -- Let
216 --
217 -- L' = L - a[p]*x[p], (3)
218 --
219 -- U' = U - a[p]*x[p], (4)
220 --
221 -- where x[p] is assumed to be fixed at 0 or 1. So (2) can be rewritten
222 -- as follows:
223 --
224 -- L' <= sum a[j]*x[j] + a[q]*x[q] <= U', (5)
225 -- j in J'
226 --
227 -- from where we have:
228 --
229 -- L' - sum a[j]*x[j] <= a[q]*x[q] <= U' - sum a[j]*x[j]. (6)
230 -- j in J' j in J'
231 --
232 -- Thus,
233 --
234 -- min a[q]*x[q] = L' - MAX, (7)
235 --
236 -- max a[q]*x[q] = U' - MIN, (8)
237 --
238 -- where
239 --
240 -- MIN = min sum a[j]*x[j], (9)
241 -- j in J'
242 --
243 -- MAX = max sum a[j]*x[j]. (10)
244 -- j in J'
245 --
246 -- Formulae (7) and (8) allows determining implied lower and upper
247 -- bounds of x[q].
248 --
249 -- Parameters len, val, L and U specify the constraint (1).
250 --
251 -- Parameters lf_min and lf_max specify implied lower and upper bounds
252 -- of the linear form (1). It is assumed that these bounds are computed
253 -- with the routines eval_lf_min and eval_lf_max (see above).
254 --
255 -- Parameter p specifies the probing variable x[p], which is set to 0
256 -- (if set is 0) or to 1 (if set is 1).
257 --
258 -- Parameter q specifies the examined variable x[q].
259 --
260 -- On exit the routine returns one of the following codes:
261 --
262 -- 0 - there is no logical relation between x[p] and x[q];
263 -- 1 - x[q] can take only on value 0;
264 -- 2 - x[q] can take only on value 1. */
265
266 static int probingcxx . . $ probing(1334acfa25e3afa7).(int len, double val[], double L, double U,
267 double lf_min, double lf_max, int p, int set, int q)
268 { double temp;
269 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(1 <= p && p < q && q <= len);
270 /* compute L' (3) */
271 if (L != -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! && set) L -= val[p];
272 /* compute U' (4) */
273 if (U != +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! && set) U -= val[p];
274 /* compute MIN (9) */
275 if (lf_min != -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
276 { if (val[p] < 0.0) lf_min -= val[p];
277 if (val[q] < 0.0) lf_min -= val[q];
278 }
279 /* compute MAX (10) */
280 if (lf_max != +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
281 { if (val[p] > 0.0) lf_max -= val[p];
282 if (val[q] > 0.0) lf_max -= val[q];
283 }
284 /* compute implied lower bound of x[q]; see (7), (8) */
285 if (val[q] > 0.0)
286 { if (L == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! || lf_max == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
287 temp = -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
288 else
289 temp = (L - lf_max) / val[q];
290 }
291 else
292 { if (U == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! || lf_min == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
293 temp = -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
294 else
295 temp = (U - lf_min) / val[q];
296 }
297 if (temp > 0.001) return 2;
298 /* compute implied upper bound of x[q]; see (7), (8) */
299 if (val[q] > 0.0)
300 { if (U == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! || lf_min == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
301 temp = +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
302 else
303 temp = (U - lf_min) / val[q];
304 }
305 else
306 { if (L == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! || lf_max == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)
307 temp = +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!;
308 else
309 temp = (L - lf_max) / val[q];
310 }
311 if (temp < 0.999) return 1;
312 /* there is no logical relation between x[p] and x[q] */
313 return 0;
314 }
315
316 struct COGcxx . . $ COG#
317 { /* conflict graph; it represents logical relations between binary
318 variables and has a vertex for each binary variable and its
319 complement, and an edge between two vertices when at most one
320 of the variables represented by the vertices can equal one in
321 an optimal solution */
322 int ncxx . . $ COG#n.;
323 /* number of variables */
324 int nbcxx . . $ COG#nb.;
325 /* number of binary variables represented in the graph (note that
326 not all binary variables can be represented); vertices which
327 correspond to binary variables have numbers 1, ..., nb while
328 vertices which correspond to complements of binary variables
329 have numbers nb+1, ..., nb+nb */
330 int necxx . . $ COG#ne.;
331 /* number of edges in the graph */
332 int *vertcxx . . $ COG#vert.; /* int vert[1+n]; */
333 /* if x[j] is a binary variable represented in the graph, vert[j]
334 is the vertex number corresponding to x[j]; otherwise vert[j]
335 is zero */
336 int *origcxx . . $ COG#orig.; /* int list[1:nb]; */
337 /* if vert[j] = k > 0, then orig[k] = j */
338 unsigned char *acxx . . $ COG#a.;
339 /* adjacency matrix of the graph having 2*nb rows and columns;
340 only strict lower triangle is stored in dense packed form */
341 };
342
343 /*----------------------------------------------------------------------
344 -- lpx_create_cog - create the conflict graph.
345 --
346 -- SYNOPSIS
347 --
348 -- #include "glplpx.h"
349 -- void *lpx_create_cog(LPX *lp);
350 --
351 -- DESCRIPTION
352 --
353 -- The routine lpx_create_cog creates the conflict graph for a given
354 -- problem instance.
355 --
356 -- RETURNS
357 --
358 -- If the graph has been created, the routine returns a pointer to it.
359 -- Otherwise the routine returns NULL. */
360
361 #define MAX_NBcxx . . $ `external/glpk/glpios08.c:361:9`! 4000
362 #define MAX_ROW_LENcxx . . $ `external/glpk/glpios08.c:362:9`! 500
363
364 static void lpx_add_cog_edgecxx . . $ lpx_add_cog_edge(f75b42a5630b157f).(void *_cog, int i, int j);
365
366 static void *lpx_create_cogcxx . . $ lpx_create_cog(67da298936e5d11b).(LPXcxx . . $ `external/glpk/glpk.h:1087:9`! *lp)
367 { struct COGcxx . . $ COG# *cog = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
368 int m, n, nb, i, j, p, q, len, *ind, *vert, *orig;
369 double L, U, lf_min, lf_max, *val;
370 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("Creating the conflict graph...\n");
371 m = lpx_get_num_rowscxx . . $ `external/glpk/glpk.h:1372:9`!(lp);
372 n = lpx_get_num_colscxx . . $ `external/glpk/glpk.h:1376:9`!(lp);
373 /* determine which binary variables should be included in the
374 conflict graph */
375 nb = 0;
376 vert = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(1+n, sizeof(int));
377 for (j = 1; j <= n; j++) vert[j] = 0;
378 orig = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(1+n, sizeof(int));
379 ind = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(1+n, sizeof(int));
380 val = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(1+n, sizeof(double));
381 for (i = 1; i <= m; i++)
382 { L = get_row_lbcxx . . $ get_row_lb(68c5770eb0f32231).(lp, i);
383 U = get_row_ubcxx . . $ get_row_ub(68c5770eb0f32231).(lp, i);
384 if (L == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! && U == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!) continue;
385 len = lpx_get_mat_rowcxx . . $ `external/glpk/glpk.h:1430:9`!(lp, i, ind, val);
386 if (len > MAX_ROW_LENcxx . . $ `external/glpk/glpios08.c:362:9`!) continue;
387 lf_min = eval_lf_mincxx . . $ eval_lf_min(f652181b53f7e993).(lp, len, ind, val);
388 lf_max = eval_lf_maxcxx . . $ eval_lf_max(f652181b53f7e993).(lp, len, ind, val);
389 for (p = 1; p <= len; p++)
390 { if (!is_binarycxx . . $ is_binary(423829e847ef1a83).(lp, ind[p])) continue;
391 for (q = p+1; q <= len; q++)
392 { if (!is_binarycxx . . $ is_binary(423829e847ef1a83).(lp, ind[q])) continue;
393 if (probingcxx . . $ probing(1334acfa25e3afa7).(len, val, L, U, lf_min, lf_max, p, 0, q) ||
394 probingcxx . . $ probing(1334acfa25e3afa7).(len, val, L, U, lf_min, lf_max, p, 1, q))
395 { /* there is a logical relation */
396 /* include the first variable in the graph */
397 j = ind[p];
398 if (vert[j] == 0) nb++, vert[j] = nb, orig[nb] = j;
399 /* incude the second variable in the graph */
400 j = ind[q];
401 if (vert[j] == 0) nb++, vert[j] = nb, orig[nb] = j;
402 }
403 }
404 }
405 }
406 /* if the graph is either empty or has too many vertices, do not
407 create it */
408 if (nb == 0 || nb > MAX_NBcxx . . $ `external/glpk/glpios08.c:361:9`!)
409 { xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("The conflict graph is either empty or too big\n");
410 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(vert);
411 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(orig);
412 goto done;
413 }
414 /* create the conflict graph */
415 cog = xmalloccxx . . $ `external/glpk/glpenv.h:167:9`!(sizeof(struct COGcxx . . $ COG#));
416 cog->ncxx . . $ COG#n. = n;
417 cog->nbcxx . . $ COG#nb. = nb;
418 cog->necxx . . $ COG#ne. = 0;
419 cog->vertcxx . . $ COG#vert. = vert;
420 cog->origcxx . . $ COG#orig. = orig;
421 len = nb + nb; /* number of vertices */
422 len = (len * (len - 1)) / 2; /* number of entries in triangle */
423 len = (len + (CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`! - 1)) / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!; /* bytes needed */
424 cog->acxx . . $ COG#a. = xmalloccxx . . $ `external/glpk/glpenv.h:167:9`!(len);
425 memsetcxx . . $ memset(d1de1e4fb215f1c6).(cog->acxx . . $ COG#a., 0, len);
426 for (j = 1; j <= nb; j++)
427 { /* add edge between variable and its complement */
428 lpx_add_cog_edgecxx . . $ lpx_add_cog_edge(f75b42a5630b157f).(cog, +orig[j], -orig[j]);
429 }
430 for (i = 1; i <= m; i++)
431 { L = get_row_lbcxx . . $ get_row_lb(68c5770eb0f32231).(lp, i);
432 U = get_row_ubcxx . . $ get_row_ub(68c5770eb0f32231).(lp, i);
433 if (L == -DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`! && U == +DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!) continue;
434 len = lpx_get_mat_rowcxx . . $ `external/glpk/glpk.h:1430:9`!(lp, i, ind, val);
435 if (len > MAX_ROW_LENcxx . . $ `external/glpk/glpios08.c:362:9`!) continue;
436 lf_min = eval_lf_mincxx . . $ eval_lf_min(f652181b53f7e993).(lp, len, ind, val);
437 lf_max = eval_lf_maxcxx . . $ eval_lf_max(f652181b53f7e993).(lp, len, ind, val);
438 for (p = 1; p <= len; p++)
439 { if (!is_binarycxx . . $ is_binary(423829e847ef1a83).(lp, ind[p])) continue;
440 for (q = p+1; q <= len; q++)
441 { if (!is_binarycxx . . $ is_binary(423829e847ef1a83).(lp, ind[q])) continue;
442 /* set x[p] to 0 and examine x[q] */
443 switch (probingcxx . . $ probing(1334acfa25e3afa7).(len, val, L, U, lf_min, lf_max, p, 0, q))
444 { case 0:
445 /* no logical relation */
446 break;
447 case 1:
448 /* x[p] = 0 implies x[q] = 0 */
449 lpx_add_cog_edgecxx . . $ lpx_add_cog_edge(f75b42a5630b157f).(cog, -ind[p], +ind[q]);
450 break;
451 case 2:
452 /* x[p] = 0 implies x[q] = 1 */
453 lpx_add_cog_edgecxx . . $ lpx_add_cog_edge(f75b42a5630b157f).(cog, -ind[p], -ind[q]);
454 break;
455 default:
456 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(lp != lp);
457 }
458 /* set x[p] to 1 and examine x[q] */
459 switch (probingcxx . . $ probing(1334acfa25e3afa7).(len, val, L, U, lf_min, lf_max, p, 1, q))
460 { case 0:
461 /* no logical relation */
462 break;
463 case 1:
464 /* x[p] = 1 implies x[q] = 0 */
465 lpx_add_cog_edgecxx . . $ lpx_add_cog_edge(f75b42a5630b157f).(cog, +ind[p], +ind[q]);
466 break;
467 case 2:
468 /* x[p] = 1 implies x[q] = 1 */
469 lpx_add_cog_edgecxx . . $ lpx_add_cog_edge(f75b42a5630b157f).(cog, +ind[p], -ind[q]);
470 break;
471 default:
472 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(lp != lp);
473 }
474 }
475 }
476 }
477 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("The conflict graph has 2*%d vertices and %d edges\n",
478 cog->nbcxx . . $ COG#nb., cog->necxx . . $ COG#ne.);
479 done: xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(ind);
480 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(val);
481 return cog;
482 }
483
484 /*----------------------------------------------------------------------
485 -- lpx_add_cog_edge - add edge to the conflict graph.
486 --
487 -- SYNOPSIS
488 --
489 -- #include "glplpx.h"
490 -- void lpx_add_cog_edge(void *cog, int i, int j);
491 --
492 -- DESCRIPTION
493 --
494 -- The routine lpx_add_cog_edge adds an edge to the conflict graph.
495 -- The edge connects x[i] (if i > 0) or its complement (if i < 0) and
496 -- x[j] (if j > 0) or its complement (if j < 0), where i and j are
497 -- original ordinal numbers of corresponding variables. */
498
499 static void lpx_add_cog_edgecxx . . $ lpx_add_cog_edge(f75b42a5630b157f).(void *_cog, int i, int j)
500 { struct COGcxx . . $ COG# *cog = _cog;
501 int k;
502 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(i != j);
503 /* determine indices of corresponding vertices */
504 if (i > 0)
505 { xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(1 <= i && i <= cog->n);
506 i = cog->vertcxx . . $ COG#vert.[i];
507 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(i != 0);
508 }
509 else
510 { i = -i;
511 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(1 <= i && i <= cog->n);
512 i = cog->vertcxx . . $ COG#vert.[i];
513 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(i != 0);
514 i += cog->nbcxx . . $ COG#nb.;
515 }
516 if (j > 0)
517 { xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(1 <= j && j <= cog->n);
518 j = cog->vertcxx . . $ COG#vert.[j];
519 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(j != 0);
520 }
521 else
522 { j = -j;
523 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(1 <= j && j <= cog->n);
524 j = cog->vertcxx . . $ COG#vert.[j];
525 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(j != 0);
526 j += cog->nbcxx . . $ COG#nb.;
527 }
528 /* only lower triangle is stored, so we need i > j */
529 if (i < j) k = i, i = j, j = k;
530 k = ((i - 1) * (i - 2)) / 2 + (j - 1);
531 cog->acxx . . $ COG#a.[k / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!] |=
532 (unsigned char)(1 << ((CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`! - 1) - k % CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!));
533 cog->necxx . . $ COG#ne.++;
534 return;
535 }
536
537 /*----------------------------------------------------------------------
538 -- MAXIMUM WEIGHT CLIQUE
539 --
540 -- Two subroutines sub() and wclique() below are intended to find a
541 -- maximum weight clique in a given undirected graph. These subroutines
542 -- are slightly modified version of the program WCLIQUE developed by
543 -- Patric Ostergard <http://www.tcs.hut.fi/~pat/wclique.html> and based
544 -- on ideas from the article "P. R. J. Ostergard, A new algorithm for
545 -- the maximum-weight clique problem, submitted for publication", which
546 -- in turn is a generalization of the algorithm for unweighted graphs
547 -- presented in "P. R. J. Ostergard, A fast algorithm for the maximum
548 -- clique problem, submitted for publication".
549 --
550 -- USED WITH PERMISSION OF THE AUTHOR OF THE ORIGINAL CODE. */
551
552 struct dsacxx . . $ dsa#
553 { /* dynamic storage area */
554 int ncxx . . $ dsa#n.;
555 /* number of vertices */
556 int *wtcxx . . $ dsa#wt.; /* int wt[0:n-1]; */
557 /* weights */
558 unsigned char *acxx . . $ dsa#a.;
559 /* adjacency matrix (packed lower triangle without main diag.) */
560 int recordcxx . . $ dsa#record.;
561 /* weight of best clique */
562 int rec_levelcxx . . $ dsa#rec_level.;
563 /* number of vertices in best clique */
564 int *reccxx . . $ dsa#rec.; /* int rec[0:n-1]; */
565 /* best clique so far */
566 int *cliquecxx . . $ dsa#clique.; /* int clique[0:n-1]; */
567 /* table for pruning */
568 int *setcxx . . $ dsa#set.; /* int set[0:n-1]; */
569 /* current clique */
570 };
571
572 #define ncxx . . $ `external/glpk/glpios08.c:572:9`! (dsa->n)
573 #define wtcxx . . $ `external/glpk/glpios08.c:573:9`! (dsa->wt)
574 #define acxx . . $ `external/glpk/glpios08.c:574:9`! (dsa->a)
575 #define recordcxx . . $ `external/glpk/glpios08.c:575:9`! (dsa->record)
576 #define rec_levelcxx . . $ `external/glpk/glpios08.c:576:9`! (dsa->rec_level)
577 #define reccxx . . $ `external/glpk/glpios08.c:577:9`! (dsa->rec)
578 #define cliquecxx . . $ `external/glpk/glpios08.c:578:9`! (dsa->clique)
579 #define setcxx . . $ `external/glpk/glpios08.c:579:9`! (dsa->set)
580
581 #if 0
582 static int is_edge(struct dsa *dsa, int i, int j)
583 { /* if there is arc (i,j), the routine returns true; otherwise
584 false; 0 <= i, j < n */
585 int k;
586 xassert(0 <= i && i < n);
587 xassert(0 <= j && j < n);
588 if (i == j) return 0;
589 if (i < j) k = i, i = j, j = k;
590 k = (i * (i - 1)) / 2 + j;
591 return a[k / CHAR_BIT] &
592 (unsigned char)(1 << ((CHAR_BIT - 1) - k % CHAR_BIT));
593 }
594 #else
595 #define is_edgecxx . . $ `external/glpk/glpios08.c:595:9`!(dsa, i, j) ((i) == (j) ? 0 : \
596 (i) > (j) ? is_edge1cxx . . $ `external/glpk/glpios08.c:597:9`!(i, j) : is_edge1cxx . . $ `external/glpk/glpios08.c:597:9`!(j, i))
597 #define is_edge1cxx . . $ `external/glpk/glpios08.c:597:9`!(i, j) is_edge2cxx . . $ `external/glpk/glpios08.c:598:9`!(((i) * ((i) - 1)) / 2 + (j))
598 #define is_edge2cxx . . $ `external/glpk/glpios08.c:598:9`!(k) (acxx . . $ `external/glpk/glpios08.c:574:9`![(k) / CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!] & \
599 (unsigned char)(1 << ((CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`! - 1) - (k) % CHAR_BITcxx . . $ `<external>/67164224788392828/limits.h:64:9`!)))
600 #endif
601
602 static void subcxx . . $ sub(ea97451fd2c6e4a3).(struct dsacxx . . $ dsa# *dsa, int ct, int table[], int level,
603 int weight, int l_weight)
604 { int i, j, k, curr_weight, left_weight, *p1, *p2, *newtable;
605 newtable = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(ncxx . . $ `external/glpk/glpios08.c:572:9`!, sizeof(int));
606 if (ct <= 0)
607 { /* 0 or 1 elements left; include these */
608 if (ct == 0)
609 { setcxx . . $ `external/glpk/glpios08.c:579:9`![level++] = table[0];
610 weight += l_weight;
611 }
612 if (weight > recordcxx . . $ `external/glpk/glpios08.c:575:9`!)
613 { recordcxx . . $ `external/glpk/glpios08.c:575:9`! = weight;
614 rec_levelcxx . . $ `external/glpk/glpios08.c:576:9`! = level;
615 for (i = 0; i < level; i++) reccxx . . $ `external/glpk/glpios08.c:577:9`![i] = setcxx . . $ `external/glpk/glpios08.c:579:9`![i];
616 }
617 goto done;
618 }
619 for (i = ct; i >= 0; i--)
620 { if ((level == 0) && (i < ct)) goto done;
621 k = table[i];
622 if ((level > 0) && (cliquecxx . . $ `external/glpk/glpios08.c:578:9`![k] <= (recordcxx . . $ `external/glpk/glpios08.c:575:9`! - weight)))
623 goto done; /* prune */
624 setcxx . . $ `external/glpk/glpios08.c:579:9`![level] = k;
625 curr_weight = weight + wtcxx . . $ `external/glpk/glpios08.c:573:9`![k];
626 l_weight -= wtcxx . . $ `external/glpk/glpios08.c:573:9`![k];
627 if (l_weight <= (recordcxx . . $ `external/glpk/glpios08.c:575:9`! - curr_weight))
628 goto done; /* prune */
629 p1 = newtable;
630 p2 = table;
631 left_weight = 0;
632 while (p2 < table + i)
633 { j = *p2++;
634 if (is_edgecxx . . $ `external/glpk/glpios08.c:595:9`!(dsa, j, k))
635 { *p1++ = j;
636 left_weight += wtcxx . . $ `external/glpk/glpios08.c:573:9`![j];
637 }
638 }
639 if (left_weight <= (recordcxx . . $ `external/glpk/glpios08.c:575:9`! - curr_weight)) continue;
640 subcxx . . $ sub(ea97451fd2c6e4a3).(dsa, p1 - newtable - 1, newtable, level + 1, curr_weight,
641 left_weight);
642 }
643 done: xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(newtable);
644 return;
645 }
646
647 static int wcliquecxx . . $ wclique(ecf28fbd3d93f9b3).(int _n, int w[], unsigned char _a[], int sol[])
648 { struct dsacxx . . $ dsa# _dsa, *dsa = &_dsa;
649 int i, j, p, max_wt, max_nwt, wth, *used, *nwt, *pos;
650 glp_longcxx . . $ glp_long# timer;
651 ncxx . . $ `external/glpk/glpios08.c:572:9`! = _n;
652 wtcxx . . $ `external/glpk/glpios08.c:573:9`! = &w[1];
653 acxx . . $ `external/glpk/glpios08.c:574:9`! = _a;
654 recordcxx . . $ `external/glpk/glpios08.c:575:9`! = 0;
655 rec_levelcxx . . $ `external/glpk/glpios08.c:576:9`! = 0;
656 reccxx . . $ `external/glpk/glpios08.c:577:9`! = &sol[1];
657 cliquecxx . . $ `external/glpk/glpios08.c:578:9`! = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(ncxx . . $ `external/glpk/glpios08.c:572:9`!, sizeof(int));
658 setcxx . . $ `external/glpk/glpios08.c:579:9`! = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(ncxx . . $ `external/glpk/glpios08.c:572:9`!, sizeof(int));
659 used = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(ncxx . . $ `external/glpk/glpios08.c:572:9`!, sizeof(int));
660 nwt = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(ncxx . . $ `external/glpk/glpios08.c:572:9`!, sizeof(int));
661 pos = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(ncxx . . $ `external/glpk/glpios08.c:572:9`!, sizeof(int));
662 /* start timer */
663 timer = xtimecxx . . $ `external/glpk/glpenv.h:179:9`!();
664 /* order vertices */
665 for (i = 0; i < ncxx . . $ `external/glpk/glpios08.c:572:9`!; i++)
666 { nwt[i] = 0;
667 for (j = 0; j < ncxx . . $ `external/glpk/glpios08.c:572:9`!; j++)
668 if (is_edgecxx . . $ `external/glpk/glpios08.c:595:9`!(dsa, i, j)) nwt[i] += wtcxx . . $ `external/glpk/glpios08.c:573:9`![j];
669 }
670 for (i = 0; i < ncxx . . $ `external/glpk/glpios08.c:572:9`!; i++)
671 used[i] = 0;
672 for (i = ncxx . . $ `external/glpk/glpios08.c:572:9`!-1; i >= 0; i--)
673 { max_wt = -1;
674 max_nwt = -1;
675 for (j = 0; j < ncxx . . $ `external/glpk/glpios08.c:572:9`!; j++)
676 { if ((!used[j]) && ((wtcxx . . $ `external/glpk/glpios08.c:573:9`![j] > max_wt) || (wtcxx . . $ `external/glpk/glpios08.c:573:9`![j] == max_wt
677 && nwt[j] > max_nwt)))
678 { max_wt = wtcxx . . $ `external/glpk/glpios08.c:573:9`![j];
679 max_nwt = nwt[j];
680 p = j;
681 }
682 }
683 pos[i] = p;
684 used[p] = 1;
685 for (j = 0; j < ncxx . . $ `external/glpk/glpios08.c:572:9`!; j++)
686 if ((!used[j]) && (j != p) && (is_edgecxx . . $ `external/glpk/glpios08.c:595:9`!(dsa, p, j)))
687 nwt[j] -= wtcxx . . $ `external/glpk/glpios08.c:573:9`![p];
688 }
689 /* main routine */
690 wth = 0;
691 for (i = 0; i < ncxx . . $ `external/glpk/glpios08.c:572:9`!; i++)
692 { wth += wtcxx . . $ `external/glpk/glpios08.c:573:9`![pos[i]];
693 subcxx . . $ sub(ea97451fd2c6e4a3).(dsa, i, pos, 0, 0, wth);
694 cliquecxx . . $ `external/glpk/glpios08.c:578:9`![pos[i]] = recordcxx . . $ `external/glpk/glpios08.c:575:9`!;
695 #if 0
696 if (utime() >= timer + 5.0)
697 #else
698 if (xdifftimecxx . . $ `external/glpk/glpenv.h:183:9`!(xtimecxx . . $ `external/glpk/glpenv.h:179:9`!(), timer) >= 5.0 - 0.001)
699 #endif
700 { /* print current record and reset timer */
701 xprintfcxx . . $ `external/glpk/glpenv.h:145:9`!("level = %d (%d); best = %d\n", i+1, ncxx . . $ `external/glpk/glpios08.c:572:9`!, recordcxx . . $ `external/glpk/glpios08.c:575:9`!);
702 #if 0
703 timer = utime();
704 #else
705 timer = xtimecxx . . $ `external/glpk/glpenv.h:179:9`!();
706 #endif
707 }
708 }
709 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(cliquecxx . . $ `external/glpk/glpios08.c:578:9`!);
710 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(setcxx . . $ `external/glpk/glpios08.c:579:9`!);
711 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(used);
712 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(nwt);
713 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(pos);
714 /* return the solution found */
715 for (i = 1; i <= rec_levelcxx . . $ `external/glpk/glpios08.c:576:9`!; i++) sol[i]++;
716 return rec_levelcxx . . $ `external/glpk/glpios08.c:576:9`!;
717 }
718
719 #undef ncxx . . $ `external/glpk/glpios08.c:572:9`!
720 #undef wtcxx . . $ `external/glpk/glpios08.c:573:9`!
721 #undef acxx . . $ `external/glpk/glpios08.c:574:9`!
722 #undef recordcxx . . $ `external/glpk/glpios08.c:575:9`!
723 #undef rec_levelcxx . . $ `external/glpk/glpios08.c:576:9`!
724 #undef reccxx . . $ `external/glpk/glpios08.c:577:9`!
725 #undef cliquecxx . . $ `external/glpk/glpios08.c:578:9`!
726 #undef setcxx . . $ `external/glpk/glpios08.c:579:9`!
727
728 /*----------------------------------------------------------------------
729 -- lpx_clique_cut - generate cluque cut.
730 --
731 -- SYNOPSIS
732 --
733 -- #include "glplpx.h"
734 -- int lpx_clique_cut(LPX *lp, void *cog, int ind[], double val[]);
735 --
736 -- DESCRIPTION
737 --
738 -- The routine lpx_clique_cut generates a clique cut using the conflict
739 -- graph specified by the parameter cog.
740 --
741 -- If a violated clique cut has been found, it has the following form:
742 --
743 -- sum{j in J} a[j]*x[j] <= b.
744 --
745 -- Variable indices j in J are stored in elements ind[1], ..., ind[len]
746 -- while corresponding constraint coefficients are stored in elements
747 -- val[1], ..., val[len], where len is returned on exit. The right-hand
748 -- side b is stored in element val[0].
749 --
750 -- RETURNS
751 --
752 -- If the cutting plane has been successfully generated, the routine
753 -- returns 1 <= len <= n, which is the number of non-zero coefficients
754 -- in the inequality constraint. Otherwise, the routine returns zero. */
755
756 static int lpx_clique_cutcxx . . $ lpx_clique_cut(44f71e96b4718d9b).(LPXcxx . . $ `external/glpk/glpk.h:1087:9`! *lp, void *_cog, int ind[], double val[])
757 { struct COGcxx . . $ COG# *cog = _cog;
758 int n = lpx_get_num_colscxx . . $ `external/glpk/glpk.h:1376:9`!(lp);
759 int j, t, v, card, temp, len = 0, *w, *sol;
760 double x, sum, b, *vec;
761 /* allocate working arrays */
762 w = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(1 + 2 * cog->nbcxx . . $ COG#nb., sizeof(int));
763 sol = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(1 + 2 * cog->nbcxx . . $ COG#nb., sizeof(int));
764 vec = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(1+n, sizeof(double));
765 /* assign weights to vertices of the conflict graph */
766 for (t = 1; t <= cog->nbcxx . . $ COG#nb.; t++)
767 { j = cog->origcxx . . $ COG#orig.[t];
768 x = lpx_get_col_primcxx . . $ `external/glpk/glpk.h:1527:9`!(lp, j);
769 temp = (int)(100.0 * x + 0.5);
770 if (temp < 0) temp = 0;
771 if (temp > 100) temp = 100;
772 w[t] = temp;
773 w[cog->nbcxx . . $ COG#nb. + t] = 100 - temp;
774 }
775 /* find a clique of maximum weight */
776 card = wcliquecxx . . $ wclique(ecf28fbd3d93f9b3).(2 * cog->nbcxx . . $ COG#nb., w, cog->acxx . . $ COG#a., sol);
777 /* compute the clique weight for unscaled values */
778 sum = 0.0;
779 for ( t = 1; t <= card; t++)
780 { v = sol[t];
781 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(1 <= v && v <= 2 * cog->nb);
782 if (v <= cog->nbcxx . . $ COG#nb.)
783 { /* vertex v corresponds to binary variable x[j] */
784 j = cog->origcxx . . $ COG#orig.[v];
785 x = lpx_get_col_primcxx . . $ `external/glpk/glpk.h:1527:9`!(lp, j);
786 sum += x;
787 }
788 else
789 { /* vertex v corresponds to the complement of x[j] */
790 j = cog->origcxx . . $ COG#orig.[v - cog->nbcxx . . $ COG#nb.];
791 x = lpx_get_col_primcxx . . $ `external/glpk/glpk.h:1527:9`!(lp, j);
792 sum += 1.0 - x;
793 }
794 }
795 /* if the sum of binary variables and their complements in the
796 clique greater than 1, the clique cut is violated */
797 if (sum >= 1.01)
798 { /* construct the inquality */
799 for (j = 1; j <= n; j++) vec[j] = 0;
800 b = 1.0;
801 for (t = 1; t <= card; t++)
802 { v = sol[t];
803 if (v <= cog->nbcxx . . $ COG#nb.)
804 { /* vertex v corresponds to binary variable x[j] */
805 j = cog->origcxx . . $ COG#orig.[v];
806 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(1 <= j && j <= n);
807 vec[j] += 1.0;
808 }
809 else
810 { /* vertex v corresponds to the complement of x[j] */
811 j = cog->origcxx . . $ COG#orig.[v - cog->nbcxx . . $ COG#nb.];
812 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(1 <= j && j <= n);
813 vec[j] -= 1.0;
814 b -= 1.0;
815 }
816 }
817 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(len == 0);
818 for (j = 1; j <= n; j++)
819 { if (vec[j] != 0.0)
820 { len++;
821 ind[len] = j, val[len] = vec[j];
822 }
823 }
824 ind[0] = 0, val[0] = b;
825 }
826 /* free working arrays */
827 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(w);
828 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(sol);
829 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(vec);
830 /* return to the calling program */
831 return len;
832 }
833
834 /*----------------------------------------------------------------------
835 -- lpx_delete_cog - delete the conflict graph.
836 --
837 -- SYNOPSIS
838 --
839 -- #include "glplpx.h"
840 -- void lpx_delete_cog(void *cog);
841 --
842 -- DESCRIPTION
843 --
844 -- The routine lpx_delete_cog deletes the conflict graph, which the
845 -- parameter cog points to, freeing all the memory allocated to this
846 -- object. */
847
848 static void lpx_delete_cogcxx . . $ lpx_delete_cog(5d22bdacc48458e8).(void *_cog)
849 { struct COGcxx . . $ COG# *cog = _cog;
850 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(cog->vertcxx . . $ COG#vert.);
851 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(cog->origcxx . . $ COG#orig.);
852 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(cog->acxx . . $ COG#a.);
853 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(cog);
854 }
855
856 /**********************************************************************/
857
858 void *ios_clq_initcxx . . $ `external/glpk/glpios.h:547:9`!(glp_treecxx . . $ glp_tree# *tree)
859 { /* initialize clique cut generator */
860 glp_probcxx . . $ glp_prob# *mip = tree->mipcxx . . $ glp_tree#mip.;
861 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(mip != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
862 return lpx_create_cogcxx . . $ lpx_create_cog(67da298936e5d11b).(mip);
863 }
864
865 /***********************************************************************
866 * NAME
867 *
868 * ios_clq_gen - generate clique cuts
869 *
870 * SYNOPSIS
871 *
872 * #include "glpios.h"
873 * void ios_clq_gen(glp_tree *tree, void *gen);
874 *
875 * DESCRIPTION
876 *
877 * The routine ios_clq_gen generates clique cuts for the current point
878 * and adds them to the clique pool. */
879
880 void ios_clq_gencxx . . $ `external/glpk/glpios.h:551:9`!(glp_treecxx . . $ glp_tree# *tree, void *gen)
881 { int n = lpx_get_num_colscxx . . $ `external/glpk/glpk.h:1376:9`!(tree->mipcxx . . $ glp_tree#mip.);
882 int len, *ind;
883 double *val;
884 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(gen != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
885 ind = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(1+n, sizeof(int));
886 val = xcalloccxx . . $ `external/glpk/glpenv.h:171:9`!(1+n, sizeof(double));
887 len = lpx_clique_cutcxx . . $ lpx_clique_cut(44f71e96b4718d9b).(tree->mipcxx . . $ glp_tree#mip., gen, ind, val);
888 if (len > 0)
889 { /* xprintf("len = %d\n", len); */
890 glp_ios_add_rowcxx . . $ glp_ios_add_row(9419d8ac4450cc37).(tree, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, GLP_RF_CLQcxx . . $ `external/glpk/glpk.h:215:9`!, 0, len, ind, val,
891 GLP_UPcxx . . $ `external/glpk/glpk.h:61:9`!, val[0]);
892 }
893 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(ind);
894 xfreecxx . . $ `external/glpk/glpenv.h:175:9`!(val);
895 return;
896 }
897
898 /**********************************************************************/
899
900 void ios_clq_termcxx . . $ `external/glpk/glpios.h:555:9`!(void *gen)
901 { /* terminate clique cut generator */
902 xassertcxx . . $ `external/glpk/glpenv.h:162:9`!(gen != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
903 lpx_delete_cogcxx . . $ lpx_delete_cog(5d22bdacc48458e8).(gen);
904 return;
905 }
906
907 /* eof */