SCIP Doxygen Documentation
Loading...
Searching...
No Matches
reader_pbm.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2026 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file reader_pbm.c
26 * @ingroup DEFPLUGINS_READER
27 * @brief file writer for portable bitmap file format (PBM), open with common graphic viewer programs (e.g. xview)
28 * @author Alexandra Kraft
29 *
30 */
31
32/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33
35#include "scip/cons_knapsack.h"
36#include "scip/cons_linear.h"
37#include "scip/cons_logicor.h"
38#include "scip/cons_setppc.h"
39#include "scip/cons_varbound.h"
40#include "scip/pub_cons.h"
41#include "scip/pub_message.h"
42#include "scip/pub_reader.h"
43#include "scip/pub_var.h"
44#include "scip/reader_pbm.h"
45#include "scip/scip_cons.h"
46#include "scip/scip_mem.h"
47#include "scip/scip_message.h"
48#include "scip/scip_param.h"
49#include "scip/scip_reader.h"
50#include "scip/scip_var.h"
51
52
53#define READER_NAME "pbmreader"
54#define READER_DESC "file writer for portable bitmap file format (PBM), open with common graphic viewer programs (e.g. xview)"
55#define READER_EXTENSION "pbm"
56
57/*
58 * Data structures
59 */
60#define PBM_MAX_LINELEN 71 /**< the maximum length of any line is 70 + '\\0' = 71*/
61#define DEFAULT_PBM_BINARY TRUE /**< binary is the default format for PBM */
62#define DEFAULT_PBM_MAXROWS 1000 /**< allowed maximum of pixel-rows int the picture */
63#define DEFAULT_PBM_MAXCOLS 1000 /**< allowed maximum of pixel-columns in the picture */
64
65/** LP reading data */
66struct SCIP_ReaderData
67{
68 SCIP_Bool binary; /**< binary is the default format for PBM */
69 int maxrows; /**< allowed maximum of pixel-rows int the picture */
70 int maxcols; /**< allowed maximum of pixel-columns in the picture */
71};
72
73/*
74 * Local methods (for writing)
75 */
76
77/** transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant */
78static
80 SCIP* scip, /**< SCIP data structure */
81 SCIP_VAR** vars, /**< vars array to get active variables for */
82 SCIP_Real* scalars, /**< scalars a_1, ..., a_n in sum a_1*x_1 + ... + a_n*x_n + c */
83 int* nvars, /**< pointer to number of variables and values in vars and vals array */
84 SCIP_Real* constant, /**< pointer to constant c in linear sum a_1*x_1 + ... + a_n*x_n + c */
85 SCIP_Bool transformed /**< transformed constraint? */
86 )
87{
88 int requiredsize;
89 int v;
90
91 assert(scip != NULL);
92 assert(vars != NULL);
94 assert(nvars != NULL);
95 assert(constant != NULL);
96
97 if( transformed )
98 {
99 SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, scalars, nvars, *nvars, constant, &requiredsize) );
100
101 if( requiredsize > *nvars )
102 {
103 SCIP_CALL( SCIPreallocBufferArray(scip, &vars, requiredsize) );
104 SCIP_CALL( SCIPreallocBufferArray(scip, &scalars, requiredsize) );
105
106 SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, scalars, nvars, requiredsize, constant, &requiredsize) );
107 }
108 assert(requiredsize == *nvars);
109 }
110 else
111 {
112 for( v = 0; v < *nvars; ++v )
113 {
114 SCIP_CALL( SCIPvarGetOrigvarSum(&vars[v], &scalars[v], constant) );
115 }
116 }
117
118 return SCIP_OKAY;
119}
120
121/** transforms given variables to the corresponding active variables */
122static
124 SCIP* scip, /**< SCIP data structure */
125 SCIP_VAR** vars, /**< vars array to get active variables for */
126 int* nvars, /**< pointer to number of variables and values in vars and vals array */
127 SCIP_Bool transformed /**< transformed constraint? */
128 )
129{
130 int requiredsize;
131 int v;
132
133 assert(scip != NULL);
134 assert(vars != NULL);
135 assert(nvars != NULL);
136
137 if( transformed )
138 {
139 SCIP_CALL( SCIPgetActiveVars(scip, vars, nvars, *nvars, &requiredsize) );
140
141 if( requiredsize > *nvars )
142 {
143 SCIP_CALL( SCIPreallocBufferArray(scip, &vars, requiredsize) );
144
145 SCIP_CALL( SCIPgetActiveVars(scip, vars, nvars, requiredsize, &requiredsize) );
146 assert(requiredsize <= *nvars);
147 }
148 }
149 else
150 {
151 SCIP_Real scalar;
152 SCIP_Real constant;
153 for( v = 0; v < *nvars; ++v )
154 {
155 scalar = 1.0;
156 constant = 0.0;
157 SCIP_CALL( SCIPvarGetOrigvarSum(&vars[v], &scalar, &constant) );
158 }
159 }
160
161 return SCIP_OKAY;
162}
163
164/** clears the given line buffer */
165static
167 char* linebuffer, /**< line */
168 int* linecnt /**< number of characters in line */
169 )
170{
171 assert(linebuffer != NULL);
172 assert(linecnt != NULL);
173
174 (*linecnt) = 0;
175 linebuffer[0] = '\0';
176}
177
178
179/** appends a bit to buffer and prints it to the give file stream if we've gather a whole byte */
180static
182 SCIP* scip, /**< SCIP data structure */
183 FILE* file, /**< output file (or NULL for standard output) */
184 unsigned char* bitcnt, /**< counts bits until whole byte is gathered */
185 unsigned char* bitbuffer /**< bit buffer */
186 )
187{
188 assert(scip != NULL);
189
190 if( *bitcnt == 0 )
191 return;
192
193 assert(bitbuffer != NULL);
194 assert(*bitcnt > 0 && *bitcnt <= 8);
195
196 (*bitbuffer) <<= (8 - *bitcnt); /*lint !e701 !e734*/
197
198 fputc(*bitbuffer, file);
199
200 *bitcnt = 0;
201 *bitbuffer = 0;
202}
203
204
205/** appends a bit to buffer and prints it to the given file stream if we've gathered a whole byte */
206static
208 SCIP* scip, /**< SCIP data structure */
209 FILE* file, /**< output file (or NULL for standard output) */
210 unsigned char bit, /**< bit to append */
211 unsigned char* bitcnt, /**< counts bits until whole byte is gathered */
212 unsigned char* bitbuffer /**< bit buffer */
213 )
214{
215 assert(scip != NULL);
216 assert(*bitcnt < 8);
217 assert(bitbuffer != NULL);
218
219 (*bitbuffer) = ((*bitbuffer)<<1)|(bit&1); /*lint !e734*/
220 *bitcnt += 1;
221
222 if( *bitcnt == 8 )
223 flushBits(scip, file, bitcnt, bitbuffer);
224}
225
226/** calculates the size of the quadratic matrix, which will correspond to one pixel in the picture */
227static
229 SCIP_READERDATA* readerdata, /**< information for reader */
230 int nvars, /**< number of variables */
231 int nconss /**< number of constraints */
232 )
233{
234 int sizev;
235 int sizeh;
236 int res;
237
238 assert(readerdata->maxrows != 0 && readerdata->maxcols != 0);
239
240 if( readerdata->maxrows > nconss )
241 readerdata->maxrows = nconss;
242
243 if( readerdata->maxcols > nvars )
244 readerdata->maxcols = nvars;
245
246 sizev = (nconss + readerdata->maxrows - 1) / readerdata->maxrows;
247 sizeh = (nvars + readerdata->maxcols - 1) / readerdata->maxcols;
248
249 /* both defined with -1 */
250 if( readerdata->maxrows == -1 && readerdata->maxcols == -1 )
251 res = 1;
252
253 /* only width is defined */
254 else if( readerdata->maxrows == -1 && readerdata->maxcols > 0 )
255 res = sizeh;
256
257 /* only height is defined */
258 else if( readerdata->maxrows > 0 && readerdata->maxcols == -1 )
259 res = sizev;
260
261 /* both are defined, use smaller scaling factor */
262 else if( sizev > sizeh )
263 res = sizev;
264 else
265 res = sizeh;
266
267 readerdata->maxrows = (nconss + res - 1) / res;
268 readerdata->maxcols = (nvars + res - 1) / res;
269
270 return res;
271}
272
273
274/** print row in PBM format to file stream */
275static
277 SCIP* scip, /**< SCIP data structure */
278 SCIP_READERDATA* readerdata, /**< information for reader */
279 SCIP_VAR** vars, /**< array of constraint variables */
280 int conscnt, /**< current constraint */
281 int nvars, /**< number of constraint variables */
282 int submatrixsize, /**< size of the submatrices */
283 int* scaledimage /**< array of ints that count variables in every submatrix */
284 )
285{
286 int v;
287 int i;
288 const int y = conscnt / submatrixsize;
289 int x;
290
291 assert(scip != NULL);
292 assert(nvars > 0);
293 assert(readerdata != NULL);
294
295 for( i = 0; i < nvars; ++i )
296 {
297 assert(vars != NULL); /* for lint */
298
300 if( v != -1 )
301 {
302 x = v / submatrixsize;
303 ++(scaledimage[y * readerdata->maxcols + x]);
304 }
305 }
306
307 return;
308}
309
310/** prints given linear constraint information in PBM format to file stream */
311static
313 SCIP* scip, /**< SCIP data structure */
314 SCIP_READERDATA* readerdata, /**< information for reader */
315 SCIP_VAR** vars, /**< array of variables */
316 SCIP_Real* vals, /**< array of coefficients values (or NULL if all coefficient values are 1) */
317 int nvars, /**< current constraint */
318 int conscnt, /**< counts variables in the constraint */
319 SCIP_Bool transformed, /**< transformed constraint? */
320 int submatrixsize, /**< size of the submatrices */
321 int* scaledimage /**< array of ints that count variables in every submatrix */
322 )
323{
324 SCIP_VAR** activevars;
325 SCIP_Real* activevals;
326 SCIP_Real activeconstant = 0.0;
327 int nactivevars;
328 int v;
329
330 assert(scip != NULL);
331 assert(vars != NULL);
332 assert(nvars > 0);
333 assert(conscnt >= 0);
334 assert(readerdata != NULL);
335
336 /* duplicate variable and value array */
337 nactivevars = nvars;
338 SCIP_CALL( SCIPduplicateBufferArray(scip, &activevars, vars, nactivevars ) );
339 if( vals != NULL )
340 {
341 SCIP_CALL( SCIPduplicateBufferArray(scip, &activevals, vals, nactivevars ) );
342 }
343 else
344 {
345 SCIP_CALL( SCIPallocBufferArray(scip, &activevals, nactivevars) );
346
347 for( v = 0; v < nactivevars; ++v )
348 activevals[v] = 1.0;
349 }
350
351 /* retransform given variables to active variables */
352 SCIP_CALL( getActiveVariables(scip, activevars, activevals, &nactivevars, &activeconstant, transformed) );
353
354 /* print constraint */
355 printRow(scip, readerdata, activevars, conscnt, nactivevars, submatrixsize, scaledimage);
356
357 /* free buffer arrays */
358 SCIPfreeBufferArray(scip, &activevars);
359 SCIPfreeBufferArray(scip, &activevals);
360
361 return SCIP_OKAY;
362}
363
364/* draws the scaled image */
365static
367 SCIP* scip, /**< SCIP data structure */
368 FILE* file, /**< output file, or NULL if standard output should be used */
369 SCIP_READERDATA* readerdata, /**< information for reader */
370 int* scaledimage /**< array of ints that count variables in every submatrix */
371 )
372{
373 int y;
374 int x;
375 unsigned char bitcnt = 0;
376 unsigned char bitbuffer = '\0';
377
378 assert(scip != NULL);
379 assert(readerdata != NULL);
380
381 for( y = 0; y < readerdata->maxrows; y++ )
382 {
383 for( x = 0; x < readerdata->maxcols; x++ )
384 {
385 unsigned char v = 0;
386 if( scaledimage[y*readerdata->maxcols+x] >= 1 )
387 {
388 v = 1;
389 }
390 appendBit(scip, file, v, &bitcnt, &bitbuffer);
391 }
392 flushBits(scip, file, &bitcnt, &bitbuffer);
393 }
394}
395
396
397/*
398 * Callback methods of reader
399 */
400
401/** copy method for reader plugins (called when SCIP copies plugins) */
402static
404{ /*lint --e{715}*/
405 assert(scip != NULL);
406 assert(reader != NULL);
407
409
410 /* call inclusion method of reader */
412
413 return SCIP_OKAY;
414}
415
416/** destructor of reader to free user data (called when SCIP is exiting) */
417static
419{
420 SCIP_READERDATA* readerdata;
421
423
424 readerdata = SCIPreaderGetData(reader);
425 assert(readerdata != NULL);
426
427 SCIPfreeBlockMemory(scip, &readerdata);
428
429 return SCIP_OKAY;
430}
431
432/** problem reading method of reader */
433#define readerReadPbm NULL
434
435/** problem writing method of reader */
436static
438{ /*lint --e{715}*/
439 SCIP_READERDATA* readerdata;
440
442
443 readerdata = SCIPreaderGetData(reader);
444 assert(readerdata != NULL);
445
446 SCIP_CALL( SCIPwritePbm(scip, file, name, readerdata, transformed, nvars, conss, nconss, result) );
447
448 return SCIP_OKAY;
449}
450
451/*
452 * reader specific interface methods
453 */
454
455/** includes the pbm file reader in SCIP */
457 SCIP* scip /**< SCIP data structure */
458 )
459{
460 SCIP_READERDATA* readerdata;
461
462 /* create pbm reader data */
463 SCIP_CALL( SCIPallocBlockMemory(scip, &readerdata) );
464
465 /* include pbm reader */
467 readerCopyPbm, readerFreePbm, readerReadPbm, readerWritePbm, readerdata) );
468
469 /* add pbm reader parameters */
471 "reading/pbmreader/binary", "should the output format be binary(P4) (otherwise plain(P1) format)",
472 &readerdata->binary, FALSE, DEFAULT_PBM_BINARY, NULL, NULL) );
474 "reading/pbmreader/maxrows", "maximum number of rows in the scaled picture (-1 for no limit)",
475 &readerdata->maxrows, FALSE, DEFAULT_PBM_MAXROWS, -1, INT_MAX, NULL, NULL) );
477 "reading/pbmreader/maxcols", "maximum number of columns in the scaled picture (-1 for no limit)",
478 &readerdata->maxcols, FALSE, DEFAULT_PBM_MAXCOLS, -1, INT_MAX, NULL, NULL) );
479
480 return SCIP_OKAY;
481}
482
483/* writes picture of matrix structure to file */
485 SCIP* scip, /**< SCIP data structure */
486 FILE* file, /**< output file, or NULL if standard output should be used */
487 const char* name, /**< problem name */
488 SCIP_READERDATA* readerdata, /**< information for reader */
489 SCIP_Bool transformed, /**< TRUE iff problem is the transformed problem */
490 int nvars, /**< number of active variables in the problem */
491 SCIP_CONS** conss, /**< array with constraints of the problem */
492 int nconss, /**< number of constraints in the problem */
493 SCIP_RESULT* result /**< pointer to store the result of the file writing call */
494 )
495{
496 SCIP_CONSHDLR* conshdlr;
497 SCIP_CONS* cons;
498 SCIP_VAR** consvars;
499 SCIP_Real* consvals;
500 SCIP_READERDATA readerdata_copy;
501 char linebuffer[PBM_MAX_LINELEN];
502 const char* conshdlrname;
503 int* scaledimage;
504 int submatrixsize;
505 int nconsvars;
506 int linecnt;
507 int c;
508 int v;
509
510 assert(scip != NULL);
511 assert(readerdata != NULL);
512 assert(conss != NULL);
513
514 readerdata_copy = *readerdata;
515 submatrixsize = getSubmatrixSize(&readerdata_copy, nvars, nconss);
516 readerdata = &readerdata_copy;
517
518 SCIP_CALL( SCIPallocBufferArray(scip, &scaledimage, readerdata_copy.maxrows * readerdata_copy.maxcols) );
519 assert(scaledimage != NULL);
520 BMSclearMemoryArray(scaledimage, readerdata->maxrows * readerdata->maxcols);
521
522 /* print statistics as comment to file */
523 if( readerdata->binary )
524 SCIPinfoMessage(scip, file, "P4\n");
525 else
526 SCIPinfoMessage(scip, file, "P1\n");
527
528 SCIPinfoMessage(scip, file, "# %s\n", name);
529 SCIPinfoMessage(scip, file, "%d %d\n", readerdata->maxcols, readerdata->maxrows);
530
531 clearLine(linebuffer, &linecnt);
532
533 for( c = 0; c < nconss; ++c )
534 {
535 cons = conss[c];
536 assert(cons != NULL);
537
538 /* in case the transformed is written only constraint are posted which are enabled in the current node */
539 assert(!transformed || SCIPconsIsEnabled(cons));
540
541 conshdlr = SCIPconsGetHdlr(cons);
542 assert(conshdlr != NULL);
543
544 conshdlrname = SCIPconshdlrGetName(conshdlr);
545 assert(transformed == SCIPconsIsTransformed(cons));
546
547 if( strcmp(conshdlrname, "linear") == 0 )
548 {
549 consvars = SCIPgetVarsLinear(scip, cons);
550 nconsvars = SCIPgetNVarsLinear(scip, cons);
551 assert(consvars != NULL || nconsvars == 0);
552
553 if( nconsvars > 0 )
554 {
555 SCIP_CALL( printLinearCons(scip, readerdata, consvars, SCIPgetValsLinear(scip, cons),
556 nconsvars, c, transformed, submatrixsize, scaledimage) );
557 }
558 }
559 else if( strcmp(conshdlrname, "setppc") == 0 )
560 {
561 consvars = SCIPgetVarsSetppc(scip, cons);
562 nconsvars = SCIPgetNVarsSetppc(scip, cons);
563 assert(consvars != NULL || nconsvars == 0);
564
565 if( nconsvars > 0 )
566 {
567 SCIP_CALL( printLinearCons(scip, readerdata, consvars, NULL,
568 nconsvars, c, transformed, submatrixsize, scaledimage) );
569 }
570 }
571 else if( strcmp(conshdlrname, "logicor") == 0 )
572 {
573 consvars = SCIPgetVarsLogicor(scip, cons);
574 nconsvars = SCIPgetNVarsLogicor(scip, cons);
575 assert(consvars != NULL || nconsvars == 0);
576
577 if( nconsvars > 0 )
578 {
579 SCIP_CALL( printLinearCons(scip, readerdata, consvars, NULL,
580 nconsvars, c, transformed, submatrixsize, scaledimage) );
581 }
582 }
583 else if( strcmp(conshdlrname, "knapsack") == 0 )
584 {
585 SCIP_Longint* weights;
586
587 consvars = SCIPgetVarsKnapsack(scip, cons);
588 nconsvars = SCIPgetNVarsKnapsack(scip, cons);
589 assert(consvars != NULL || nconsvars == 0);
590
591 /* copy Longint array to SCIP_Real array */
592 weights = SCIPgetWeightsKnapsack(scip, cons);
593 SCIP_CALL( SCIPallocBufferArray(scip, &consvals, nconsvars) );
594 for( v = 0; v < nconsvars; ++v )
595 consvals[v] = weights[v];
596
597 if( nconsvars > 0 )
598 {
599 SCIP_CALL( printLinearCons(scip, readerdata, consvars, consvals, nconsvars, c, transformed,
600 submatrixsize, scaledimage) );
601 }
602
603 SCIPfreeBufferArray(scip, &consvals);
604 }
605 else if( strcmp(conshdlrname, "varbound") == 0 )
606 {
607 SCIP_CALL( SCIPallocBufferArray(scip, &consvars, 2) );
608 SCIP_CALL( SCIPallocBufferArray(scip, &consvals, 2) );
609
610 consvars[0] = SCIPgetVarVarbound(scip, cons);
611 consvars[1] = SCIPgetVbdvarVarbound(scip, cons);
612
613 consvals[0] = 1.0;
614 consvals[1] = SCIPgetVbdcoefVarbound(scip, cons);
615
616 SCIP_CALL( printLinearCons(scip, readerdata, consvars, consvals, 2, c, transformed,
617 submatrixsize, scaledimage) );
618
619 SCIPfreeBufferArray(scip, &consvars);
620 SCIPfreeBufferArray(scip, &consvals);
621 }
622 else
623 {
624 SCIP_Bool success;
625
626 consvars = NULL;
627 SCIP_CALL( SCIPgetConsNVars(scip, cons, &nconsvars, &success) );
628
629 if( success )
630 {
631 SCIP_CALL( SCIPallocBufferArray(scip, &consvars, nconsvars) );
632
633 SCIP_CALL( SCIPgetConsVars(scip, cons, consvars, nconsvars, &success) );
634 }
635
636 if( success )
637 {
638 /* retransform given variables to active variables */
639 SCIP_CALL( getActiveVariables2(scip, consvars, &nconsvars, transformed) );
640
641 printRow(scip, readerdata, consvars, c, nconsvars, submatrixsize, scaledimage);
642 }
643 else
644 {
645 SCIPwarningMessage(scip, "constraint handler <%s> cannot print requested format\n", conshdlrname );
646 SCIPinfoMessage(scip, file, "\\ ");
647 SCIP_CALL( SCIPprintCons(scip, cons, file) );
648 }
649
650 SCIPfreeBufferArrayNull(scip, &consvars);
651 }
652 }
653
654 drawScaledImage(scip, file, readerdata, scaledimage);
655
656 SCIPfreeBufferArray(scip, &scaledimage);
657
659
660 return SCIP_OKAY; /*lint !e438*/
661}
SCIP_VAR ** y
SCIP_VAR ** x
Constraint handler for knapsack constraints of the form , x binary and .
Constraint handler for linear constraints in their most general form, .
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
Constraint handler for the set partitioning / packing / covering constraints .
Constraint handler for variable bound constraints .
#define NULL
Definition def.h:257
#define SCIP_Longint
Definition def.h:150
#define SCIP_Bool
Definition def.h:100
#define SCIP_STRINGEQ(name, reference, retcode)
Definition def.h:454
#define SCIP_Real
Definition def.h:165
#define FALSE
Definition def.h:103
#define SCIP_CALL(x)
Definition def.h:364
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPwritePbm(SCIP *scip, FILE *file, const char *name, SCIP_READERDATA *readerdata, SCIP_Bool transformed, int nvars, SCIP_CONS **conss, int nconss, SCIP_RESULT *result)
Definition reader_pbm.c:484
SCIP_RETCODE SCIPincludeReaderPbm(SCIP *scip)
Definition reader_pbm.c:456
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition scip_param.c:83
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition scip_param.c:57
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4320
SCIP_RETCODE SCIPgetConsNVars(SCIP *scip, SCIP_CONS *cons, int *nvars, SCIP_Bool *success)
Definition scip_cons.c:2621
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
Definition cons.c:8413
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
Definition scip_cons.c:2536
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
Definition cons.c:8702
SCIP_RETCODE SCIPgetConsVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int varssize, SCIP_Bool *success)
Definition scip_cons.c:2577
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
Definition cons.c:8490
#define SCIPallocBufferArray(scip, ptr, num)
Definition scip_mem.h:124
#define SCIPreallocBufferArray(scip, ptr, num)
Definition scip_mem.h:128
#define SCIPfreeBufferArray(scip, ptr)
Definition scip_mem.h:136
#define SCIPduplicateBufferArray(scip, ptr, source, num)
Definition scip_mem.h:132
#define SCIPfreeBlockMemory(scip, ptr)
Definition scip_mem.h:108
#define SCIPfreeBufferArrayNull(scip, ptr)
Definition scip_mem.h:137
#define SCIPallocBlockMemory(scip, ptr)
Definition scip_mem.h:89
SCIP_RETCODE SCIPincludeReader(SCIP *scip, const char *name, const char *desc, const char *extension, SCIP_DECL_READERCOPY((*readercopy)), SCIP_DECL_READERFREE((*readerfree)), SCIP_DECL_READERREAD((*readerread)), SCIP_DECL_READERWRITE((*readerwrite)), SCIP_READERDATA *readerdata)
Definition scip_reader.c:66
SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
Definition reader.c:625
const char * SCIPreaderGetName(SCIP_READER *reader)
Definition reader.c:700
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
Definition var.c:18365
int SCIPvarGetProbindex(SCIP_VAR *var)
Definition var.c:23694
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize)
Definition scip_var.c:2378
SCIP_RETCODE SCIPgetActiveVars(SCIP *scip, SCIP_VAR **vars, int *nvars, int varssize, int *requiredsize)
Definition scip_var.c:2574
return SCIP_OKAY
int c
assert(minobj< SCIPgetCutoffbound(scip))
int nvars
static SCIP_VAR ** vars
static const SCIP_Real scalars[]
Definition lp.c:5959
memory allocation routines
#define BMSclearMemoryArray(ptr, num)
Definition memory.h:130
public methods for managing constraints
public methods for message output
public methods for input file readers
public methods for problem variables
#define READER_DESC
Definition reader_bnd.c:62
#define READER_EXTENSION
Definition reader_bnd.c:63
#define READER_NAME
Definition reader_bnd.c:61
static void appendBit(SCIP *scip, FILE *file, unsigned char bit, unsigned char *bitcnt, unsigned char *bitbuffer)
Definition reader_pbm.c:207
static void drawScaledImage(SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, int *scaledimage)
Definition reader_pbm.c:366
static void clearLine(char *linebuffer, int *linecnt)
Definition reader_pbm.c:166
static SCIP_RETCODE getActiveVariables2(SCIP *scip, SCIP_VAR **vars, int *nvars, SCIP_Bool transformed)
Definition reader_pbm.c:123
static void printRow(SCIP *scip, SCIP_READERDATA *readerdata, SCIP_VAR **vars, int conscnt, int nvars, int submatrixsize, int *scaledimage)
Definition reader_pbm.c:276
#define readerReadPbm
Definition reader_pbm.c:433
static SCIP_RETCODE getActiveVariables(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
Definition reader_pbm.c:79
static void flushBits(SCIP *scip, FILE *file, unsigned char *bitcnt, unsigned char *bitbuffer)
Definition reader_pbm.c:181
#define DEFAULT_PBM_MAXROWS
Definition reader_pbm.c:62
#define DEFAULT_PBM_BINARY
Definition reader_pbm.c:61
#define DEFAULT_PBM_MAXCOLS
Definition reader_pbm.c:63
static int getSubmatrixSize(SCIP_READERDATA *readerdata, int nvars, int nconss)
Definition reader_pbm.c:228
static SCIP_RETCODE printLinearCons(SCIP *scip, SCIP_READERDATA *readerdata, SCIP_VAR **vars, SCIP_Real *vals, int nvars, int conscnt, SCIP_Bool transformed, int submatrixsize, int *scaledimage)
Definition reader_pbm.c:312
#define PBM_MAX_LINELEN
Definition reader_pbm.c:60
file writer for portable bitmap file format (PBM), open with common graphic viewer programs (e....
public methods for constraint handler plugins and constraints
public methods for memory management
public methods for message handling
public methods for SCIP parameter handling
public methods for reader plugins
public methods for SCIP variables
struct SCIP_Cons SCIP_CONS
Definition type_cons.h:63
struct SCIP_Conshdlr SCIP_CONSHDLR
Definition type_cons.h:62
#define SCIP_DECL_READERWRITE(x)
struct SCIP_ReaderData SCIP_READERDATA
Definition type_reader.h:54
#define SCIP_DECL_READERCOPY(x)
Definition type_reader.h:63
#define SCIP_DECL_READERFREE(x)
Definition type_reader.h:72
@ SCIP_SUCCESS
Definition type_result.h:58
enum SCIP_Result SCIP_RESULT
Definition type_result.h:61
@ SCIP_INVALIDCALL
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
Definition type_scip.h:39
struct SCIP_Var SCIP_VAR
Definition type_var.h:166