SCIP Doxygen Documentation
Loading...
Searching...
No Matches
reader_ppm.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_ppm.c
26 * @ingroup DEFPLUGINS_READER
27 * @brief file writer for portable pixmap file format (PPM), open with common graphic viewer programs (e.g. xview)
28 * @author Michael Winkler
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_misc.h"
43#include "scip/pub_reader.h"
44#include "scip/pub_var.h"
45#include "scip/reader_ppm.h"
46#include "scip/scip_cons.h"
47#include "scip/scip_mem.h"
48#include "scip/scip_message.h"
49#include "scip/scip_numerics.h"
50#include "scip/scip_param.h"
51#include "scip/scip_reader.h"
52#include "scip/scip_var.h"
53
54
55#define READER_NAME "ppmreader"
56#define READER_DESC "file writer for portable pixmap file format (PPM), open with common graphic viewer programs (e.g. xview)"
57#define READER_EXTENSION "ppm"
58
59/*
60 * Data structures
61 */
62#define PPM_MAX_LINELEN 71 /**< the maximum length of any line is 70 + '\\0' = 71*/
63#define DEFAULT_PPM_RGB_LIMIT 160
64#define DEFAULT_PPM_COEF_LIMIT 3
65#define DEFAULT_PPM_RGB_RELATIVE TRUE
66#define DEFAULT_PPM_RGB_ASCII TRUE
67
68/** PPM reading data */
69struct SCIP_ReaderData
70{
71 SCIP_Bool rgb_relative;
72 SCIP_Bool rgb_ascii;
73 int rgb_limit;
74 int coef_limit;
75};
76
77/*
78 * Local methods (for writing)
79 */
80
81/** initializes the reader data */
82static
84 SCIP_READERDATA* readerdata /**< reader data */
85 )
86{
87 assert(readerdata != NULL);
88
89 readerdata->rgb_relative = DEFAULT_PPM_RGB_RELATIVE;
90 readerdata->rgb_ascii = DEFAULT_PPM_RGB_ASCII;
91 readerdata->rgb_limit = DEFAULT_PPM_RGB_LIMIT;
92 readerdata->coef_limit = DEFAULT_PPM_COEF_LIMIT;
93}
94
95
96/** transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant */
97static
99 SCIP* scip, /**< SCIP data structure */
100 SCIP_VAR** vars, /**< vars array to get active variables for */
101 SCIP_Real* scalars, /**< scalars a_1, ..., a_n inrc/scip/reader_ppm.c linear sum a_1*x_1 + ... + a_n*x_n + c */
102 int* nvars, /**< pointer to number of variables and values in vars and vals array */
103 SCIP_Real* constant, /**< pointer to constant c in linear sum a_1*x_1 + ... + a_n*x_n + c */
104 SCIP_Bool transformed /**< transformed constraint? */
105 )
106{
107 int requiredsize;
108 int v;
109
110 assert( scip != NULL );
111 assert( vars != NULL );
112 assert( scalars != NULL );
113 assert( nvars != NULL );
114 assert( constant != NULL );
115
116 if( transformed )
117 {
118 SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, scalars, nvars, *nvars, constant, &requiredsize) );
119
120 if( requiredsize > *nvars )
121 {
122 SCIP_CALL( SCIPreallocBufferArray(scip, &vars, requiredsize) );
123 SCIP_CALL( SCIPreallocBufferArray(scip, &scalars, requiredsize) );
124
125 SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, scalars, nvars, requiredsize, constant, &requiredsize) );
126 }
127 assert( requiredsize == *nvars );
128 }
129 else
130 {
131 for( v = 0; v < *nvars; ++v )
132 {
133 SCIP_CALL( SCIPvarGetOrigvarSum(&vars[v], &scalars[v], constant) );
134 }
135 }
136 return SCIP_OKAY;
137}
138
139/** clears the given line buffer */
140static
142 char* linebuffer, /**< line */
143 int* linecnt /**< number of characters in line */
144 )
145{
146 assert( linebuffer != NULL );
147 assert( linecnt != NULL );
148
149 (*linecnt) = 0;
150 linebuffer[0] = '\0';
151}
152
153/** ends the given line with '\\0' and prints it to the given file stream */
154static
156 SCIP* scip, /**< SCIP data structure */
157 FILE* file, /**< output file (or NULL for standard output) */
158 SCIP_READERDATA* readerdata, /**< information for reader */
159 char* linebuffer, /**< line */
160 int* linecnt /**< number of characters in line */
161 )
162{
163 assert( scip != NULL );
164 assert( linebuffer != NULL );
165 assert( linecnt != NULL );
166
167 if( (*linecnt) > 0 )
168 {
169 linebuffer[(*linecnt)] = '\0';
170
171 if(readerdata->rgb_ascii)
172 SCIPinfoMessage(scip, file, "%s", linebuffer);
173 else
174 SCIPinfoMessage(scip, file, "%s\n", linebuffer);
175 clearLine(linebuffer, linecnt);
176 }
177}
178
179/** appends extension to line and prints it to the give file stream if the line exceeded PPM_PRINTLEN */
180static
182 SCIP* scip, /**< SCIP data structure */
183 FILE* file, /**< output file (or NULL for standard output) */
184 SCIP_READERDATA* readerdata, /**< information for reader */
185 char* linebuffer, /**< line */
186 int* linecnt, /**< number of characters in line */
187 const char* extension /**< string to extent the line */
188 )
189{
190 assert( scip != NULL );
191 assert( linebuffer != NULL );
192 assert( linecnt != NULL );
193 assert( extension != NULL );
194
195 if( *linecnt + (int)strlen(extension) > PPM_MAX_LINELEN - 1 )
196 endLine(scip, file, readerdata, linebuffer, linecnt);
197
198 /* append extension to linebuffer */
199 (void) strncat(linebuffer, extension, PPM_MAX_LINELEN - (unsigned int)(*linecnt) - 1);
200 (*linecnt) += (int) strlen(extension);
201}
202
203
204/** calculates the color value for a given coefficient */
205static
207 SCIP* scip, /**< SCIP data structure */
208 SCIP_READERDATA* readerdata, /**< information for reader */
209 SCIP_Real coef, /**< coefficient to scale */
210 int* red, /**< red part */
211 int* green, /**< green part */
212 int* blue, /**< blue part */
213 SCIP_Real scale /**< maximal coefficient */
214 )
215{
216 SCIP_Real coeflog;
217
218 assert(scip != NULL);
219 assert(readerdata != NULL);
220 assert(readerdata->rgb_limit >= 0);
221 assert(coef > 0);
222
223 coeflog = SCIPfloor(scip, log10(coef));
224
225 if( !(readerdata->rgb_relative) )
226 {
227 (*red) = 255;
228 (*blue) = readerdata->rgb_limit - (int) (unsigned short) (coef/scale * readerdata->rgb_limit);
229 (*green) = *blue;
230 }
231 else
232 {
233 if( coeflog >= 0 )
234 {
235 (*red) = 255;
236 if( coeflog >= readerdata->coef_limit )
237 {
238 (*blue) = 0;
239 (*green) = 0;
240 }
241 else
242 {
243 (*blue) = readerdata->rgb_limit - (int) (unsigned short) (readerdata->rgb_limit * coeflog/readerdata->coef_limit);
244 (*green) = *blue;
245 }
246 }
247 else
248 {
249 (*blue) = 255;
250 coeflog = -1.0*coeflog;
251 if( coeflog >= readerdata->coef_limit )
252 {
253 (*red) = 0;
254 (*green) = 0;
255 }
256 else
257 {
258 (*red) = (readerdata->rgb_limit) - (int) (unsigned short) ((readerdata->rgb_limit)*coeflog/(readerdata->coef_limit));
259 (*green) = *red;
260 }
261 }
262 }
263}
264
265
266/** print row in PPM format to file stream */
267static
269 SCIP* scip, /**< SCIP data structure */
270 FILE* file, /**< output file (or NULL for standard output) */
271 SCIP_READERDATA* readerdata, /**< information for reader */
272 SCIP_VAR** vars, /**< array of constraint variables */
273 SCIP_Real* vals, /**< array of constraint values */
274 int nvars, /**< number of constraint variables */
275 int ntotalvars, /**< number of variables */
276 SCIP_Real maxcoef /**< maximal coefficient */
277 )
278{
279 int v;
280 int i;
281 int j;
282
283 int red;
284 int green;
285 int blue;
286
287 char linebuffer[PPM_MAX_LINELEN];
288 int linecnt;
289 int varindex;
290 int actvarindex;
291 int maxvarindex;
292 int indexvar = 0;
293
294 char buffer[PPM_MAX_LINELEN];
295 const unsigned char max = (unsigned char)255;
296 char white[4];
297
298 assert( scip != NULL );
299 assert (nvars > 0);
300 assert (readerdata != NULL);
301
302 i = 0;
303 varindex = -1;
304 maxvarindex = 0;
305
306 (void) SCIPsnprintf(white, 4, "%c%c%c", max, max, max);
307 clearLine(linebuffer, &linecnt);
308
309 /* calculate maximum index of the variables in this constraint */
310 for( v = 0; v < nvars; ++v )
311 {
312 if( maxvarindex < SCIPvarGetProbindex(vars[v]) )
313 maxvarindex = SCIPvarGetProbindex(vars[v]);
314 }
315 assert(maxvarindex < ntotalvars);
316
317 /* print coefficients */
318 for(v = 0; v < nvars; ++v)
319 {
320 actvarindex = maxvarindex;
321 for(j = 0; j < nvars; ++j)
322 {
323 if( varindex < SCIPvarGetProbindex(vars[j]) && SCIPvarGetProbindex(vars[j]) <= actvarindex )
324 {
325 actvarindex = SCIPvarGetProbindex(vars[j]);
326 indexvar = j;
327 }
328 }
329 varindex = actvarindex;
330
331 /* fill in white points since these variables indices do not exits in this constraint */
332 for( ; i < varindex; ++i )
333 {
334 if(readerdata->rgb_ascii)
335 appendLine(scip, file, readerdata, linebuffer, &linecnt, white);
336 else
337 appendLine(scip, file, readerdata, linebuffer, &linecnt, " 255 255 255 ");
338 }
339
340 calcColorValue(scip, readerdata, REALABS(vals[indexvar]), &red, &green, &blue, maxcoef);
341 if( readerdata->rgb_ascii )
342 {
343 if( red == 35 || red == 0 )
344 red++;
345 if( green==35 || green == 0 )
346 green++;
347 if( blue==35 || blue == 0 )
348 blue++;
349 (void) SCIPsnprintf(buffer, PPM_MAX_LINELEN, "%c%c%c", (unsigned char)red, (unsigned char)green, (unsigned char)blue);
350 }
351 else
352 (void) SCIPsnprintf(buffer, PPM_MAX_LINELEN, " %d %d %d ", red, green, blue);
353
354 appendLine(scip, file, readerdata, linebuffer, &linecnt, buffer);
355 i++;
356 }
357
358 /* fill in white points since these variables indices do not exits in this constraint */
359 for( ; i < ntotalvars; ++i )
360 {
361 if(readerdata->rgb_ascii)
362 appendLine(scip, file, readerdata, linebuffer, &linecnt, white);
363 else
364 appendLine(scip, file, readerdata, linebuffer, &linecnt, " 255 255 255 ");
365 }
366
367 endLine(scip, file, readerdata, linebuffer, &linecnt);
368}
369
370
371/** prints given linear constraint information in PPM format to file stream */
372static
374 SCIP* scip, /**< SCIP data structure */
375 FILE* file, /**< output file (or NULL for standard output) */
376 SCIP_READERDATA* readerdata, /**< information for reader */
377 SCIP_VAR** vars, /**< array of variables */
378 SCIP_Real* vals, /**< array of coefficients values (or NULL if all coefficient values are 1) */
379 int nvars, /**< number of variables */
380 int ncompletevars, /**< number of variables in whole problem */
381 SCIP_Bool transformed, /**< transformed constraint? */
382 SCIP_Real* maxcoef, /**< maximal coefficient */
383 SCIP_Bool printbool /**< print row or calculate maximum coefficient */
384 )
385{
386 int v;
387 SCIP_VAR** activevars;
388 SCIP_Real* activevals;
389 int nactivevars;
390 SCIP_Real activeconstant = 0.0;
391
392 assert( scip != NULL );
393 assert( vars != NULL );
394 assert( nvars > 0 );
395 assert( readerdata != NULL );
396
397 /* duplicate variable and value array */
398 nactivevars = nvars;
399 SCIP_CALL( SCIPduplicateBufferArray(scip, &activevars, vars, nactivevars ) );
400 if( vals != NULL )
401 {
402 SCIP_CALL( SCIPduplicateBufferArray(scip, &activevals, vals, nactivevars ) );
403 }
404 else
405 {
406 SCIP_CALL( SCIPallocBufferArray(scip, &activevals, nactivevars) );
407
408 for( v = 0; v < nactivevars; ++v )
409 activevals[v] = 1.0;
410 }
411
412 /* retransform given variables to active variables */
413 SCIP_CALL( getActiveVariables(scip, activevars, activevals, &nactivevars, &activeconstant, transformed) );
414
415 if( ! readerdata->rgb_relative )
416 {
417 if( ! printbool )
418 {
419 for(v = 0; v < nactivevars; ++v)
420 {
421 if( REALABS(activevals[v]) > *maxcoef)
422 *maxcoef = REALABS(activevals[v]);
423 }
424 }
425 else
426 {
427 assert (*maxcoef > 0);
428 /* print constraint */
429 printRow(scip, file, readerdata, activevars, activevals, nactivevars, ncompletevars, *maxcoef);
430 }
431 }
432 else
433 {
434 /* print constraint */
435 printRow(scip, file, readerdata, activevars, activevals, nactivevars, ncompletevars, *maxcoef);
436 }
437
438 /* free buffer arrays */
439 SCIPfreeBufferArray(scip, &activevars);
440 SCIPfreeBufferArray(scip, &activevals);
441
442 return SCIP_OKAY;
443}
444
445
446/*
447 * Callback methods of reader
448 */
449
450/** copy method for reader plugins (called when SCIP copies plugins) */
451static
453{ /*lint --e{715}*/
454 assert(scip != NULL);
455 assert(reader != NULL);
456
458
459 /* call inclusion method of reader */
461
462 return SCIP_OKAY;
463}
464
465/** destructor of reader to free user data (called when SCIP is exiting) */
466static
468{
469 SCIP_READERDATA* readerdata;
470
472
473 readerdata = SCIPreaderGetData(reader);
474 assert(readerdata != NULL);
475 SCIPfreeBlockMemory(scip, &readerdata);
476
477 return SCIP_OKAY;
478}
479
480
481/** problem writing method of reader */
482static
484{ /*lint --e{715}*/
485 SCIP_READERDATA* readerdata;
486
488
489 readerdata = SCIPreaderGetData(reader);
490 assert(readerdata != NULL);
491
492 SCIP_CALL( SCIPwritePpm(scip, file, name, readerdata, transformed, vars, nvars, conss, nconss, result) );
493
494 return SCIP_OKAY;
495}
496
497/*
498 * reader specific interface methods
499 */
500
501/** includes the ppm file reader in SCIP */
503 SCIP* scip /**< SCIP data structure */
504 )
505{
506 SCIP_READERDATA* readerdata;
507 SCIP_READER* reader;
508
509 /* create ppm reader data */
510 SCIP_CALL( SCIPallocBlockMemory(scip, &readerdata) );
511 initReaderdata(readerdata);
512
513 /* include reader */
515
516 assert(reader != NULL);
517
518 /* set non fundamental callbacks via setter functions */
519 SCIP_CALL( SCIPsetReaderCopy(scip, reader, readerCopyPpm) );
520 SCIP_CALL( SCIPsetReaderFree(scip, reader, readerFreePpm) );
521 SCIP_CALL( SCIPsetReaderWrite(scip, reader, readerWritePpm) );
522
523 /* add ppm reader parameters */
525 "reading/ppmreader/rgbrelativ", "should the coloring values be relativ or absolute",
526 &readerdata->rgb_relative, FALSE, DEFAULT_PPM_RGB_RELATIVE, NULL, NULL) );
528 "reading/ppmreader/rgbascii", "should the output format be binary(P6) (otherwise plain(P3) format)",
529 &readerdata->rgb_ascii, FALSE, DEFAULT_PPM_RGB_ASCII, NULL, NULL) );
531 "reading/ppmreader/coefficientlimit",
532 "splitting coefficients in this number of intervals",
533 &readerdata->coef_limit, FALSE, DEFAULT_PPM_COEF_LIMIT, 3, 16, NULL, NULL) );
535 "reading/ppmreader/rgblimit",
536 "maximal color value",
537 &readerdata->rgb_limit, FALSE, DEFAULT_PPM_RGB_LIMIT, 0, 255, NULL, NULL) );
538
539 return SCIP_OKAY;
540}
541
542
543/** writes problem to file */
545 SCIP* scip, /**< SCIP data structure */
546 FILE* file, /**< output file, or NULL if standard output should be used */
547 const char* name, /**< problem name */
548 SCIP_READERDATA* readerdata, /**< information for reader */
549 SCIP_Bool transformed, /**< TRUE iff problem is the transformed problem */
550 SCIP_VAR** vars, /**< array with active variables ordered binary, integer, implicit, continuous */
551 int nvars, /**< number of active variables in the problem */
552 SCIP_CONS** conss, /**< array with constraints of the problem */
553 int nconss, /**< number of constraints in the problem */
554 SCIP_RESULT* result /**< pointer to store the result of the file writing call */
555 )
556{ /*lint --e{715}*/
557 int c;
558 int v;
559 int i;
560
561 int linecnt;
562 char linebuffer[PPM_MAX_LINELEN];
563
564 SCIP_CONSHDLR* conshdlr;
565 const char* conshdlrname;
566 SCIP_CONS* cons;
567
568 SCIP_VAR** consvars;
569 SCIP_Real* consvals;
570 int nconsvars;
571 int i_max = 1;
572 SCIP_Real maxcoef = 0;
573 SCIP_Bool printbool = FALSE;
574
575 assert( scip != NULL );
576 assert(readerdata != NULL);
577 assert(vars != NULL); /* for lint */
578
579 /* print statistics as comment to file */
580 if(readerdata->rgb_ascii)
581 SCIPinfoMessage(scip, file, "P6\n");
582 else
583 SCIPinfoMessage(scip, file, "P3\n");
584 SCIPinfoMessage(scip, file, "# %s\n", name);
585 SCIPinfoMessage(scip, file, "%d %d\n", nvars, nconss);
586 SCIPinfoMessage(scip, file, "255\n");
587
588 clearLine(linebuffer, &linecnt);
589
590 if( ! readerdata->rgb_relative )
591 i_max = 2;
592
593 for(i = 0; i < i_max; ++i)
594 {
595 if( i )
596 {
597 printbool = TRUE;
598 SCIPdebugMsgPrint(scip, "Maximal coefficient = %g\n", maxcoef);
599 }
600
601 for(c = 0; c < nconss; ++c)
602 {
603 cons = conss[c];
604 assert( cons != NULL);
605
606 /* in case the transformed is written only constraint are posted which are enabled in the current node */
607 assert(!transformed || SCIPconsIsEnabled(cons));
608
609 conshdlr = SCIPconsGetHdlr(cons);
610 assert( conshdlr != NULL );
611
612 conshdlrname = SCIPconshdlrGetName(conshdlr);
613 assert( transformed == SCIPconsIsTransformed(cons) );
614
615 if( strcmp(conshdlrname, "linear") == 0 )
616 {
617 consvars = SCIPgetVarsLinear(scip, cons);
618 nconsvars = SCIPgetNVarsLinear(scip, cons);
619 assert( consvars != NULL || nconsvars == 0 );
620
621 if( nconsvars > 0 )
622 {
623 SCIP_CALL( printLinearCons(scip, file, readerdata, consvars, SCIPgetValsLinear(scip, cons),
624 nconsvars, nvars, transformed, &maxcoef, printbool) );
625 }
626 }
627 else if( strcmp(conshdlrname, "setppc") == 0 )
628 {
629 consvars = SCIPgetVarsSetppc(scip, cons);
630 nconsvars = SCIPgetNVarsSetppc(scip, cons);
631 assert( consvars != NULL || nconsvars == 0 );
632
633 if( nconsvars > 0 )
634 {
635 SCIP_CALL( printLinearCons(scip, file, readerdata, consvars, NULL,
636 nconsvars, nvars, transformed, &maxcoef, printbool) );
637 }
638 }
639 else if( strcmp(conshdlrname, "logicor") == 0 )
640 {
641 consvars = SCIPgetVarsLogicor(scip, cons);
642 nconsvars = SCIPgetNVarsLogicor(scip, cons);
643 assert( consvars != NULL || nconsvars == 0 );
644
645 if( nconsvars > 0 )
646 {
647 SCIP_CALL( printLinearCons(scip, file, readerdata, consvars, NULL,
648 nconsvars, nvars, transformed, &maxcoef, printbool) );
649 }
650 }
651 else if( strcmp(conshdlrname, "knapsack") == 0 )
652 {
653 SCIP_Longint* weights;
654
655 consvars = SCIPgetVarsKnapsack(scip, cons);
656 nconsvars = SCIPgetNVarsKnapsack(scip, cons);
657 assert( consvars != NULL || nconsvars == 0 );
658
659 /* copy Longint array to SCIP_Real array */
660 weights = SCIPgetWeightsKnapsack(scip, cons);
661 SCIP_CALL( SCIPallocBufferArray(scip, &consvals, nconsvars) );
662 for( v = 0; v < nconsvars; ++v )
663 consvals[v] = (SCIP_Real)weights[v];
664
665 if( nconsvars > 0 )
666 {
667 SCIP_CALL( printLinearCons(scip, file, readerdata, consvars, consvals, nconsvars, nvars, transformed, &maxcoef, printbool) );
668 }
669
670 SCIPfreeBufferArray(scip, &consvals);
671 }
672 else if( strcmp(conshdlrname, "varbound") == 0 )
673 {
674 SCIP_CALL( SCIPallocBufferArray(scip, &consvars, 2) );
675 SCIP_CALL( SCIPallocBufferArray(scip, &consvals, 2) );
676
677 consvars[0] = SCIPgetVarVarbound(scip, cons);
678 consvars[1] = SCIPgetVbdvarVarbound(scip, cons);
679
680 consvals[0] = 1.0;
681 consvals[1] = SCIPgetVbdcoefVarbound(scip, cons);
682
683 SCIP_CALL( printLinearCons(scip, file, readerdata, consvars, consvals, 2, nvars, transformed, &maxcoef, printbool) );
684
685 SCIPfreeBufferArray(scip, &consvars);
686 SCIPfreeBufferArray(scip, &consvals);
687 }
688 else
689 {
690 SCIPwarningMessage(scip, "constraint handler <%s> cannot print requested format\n", conshdlrname );
691 SCIPinfoMessage(scip, file, "\\ ");
692 SCIP_CALL( SCIPprintCons(scip, cons, file) );
693 SCIPinfoMessage(scip, file, ";\n");
694 }
695 }
696 }
697
699
700 return SCIP_OKAY; /*lint !e438*/
701}
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 TRUE
Definition def.h:102
#define FALSE
Definition def.h:103
#define REALABS(x)
Definition def.h:191
#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 SCIPwritePpm(SCIP *scip, FILE *file, const char *name, SCIP_READERDATA *readerdata, SCIP_Bool transformed, SCIP_VAR **vars, int nvars, SCIP_CONS **conss, int nconss, SCIP_RESULT *result)
Definition reader_ppm.c:544
SCIP_RETCODE SCIPincludeReaderPpm(SCIP *scip)
Definition reader_ppm.c:502
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
#define SCIPdebugMsgPrint
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_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_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 SCIPallocBlockMemory(scip, ptr)
Definition scip_mem.h:89
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader,)
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
Definition reader.c:625
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader,)
const char * SCIPreaderGetName(SCIP_READER *reader)
Definition reader.c:700
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader,)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
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
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition misc.c:10827
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
public methods for managing constraints
public methods for message output
public data structures and miscellaneous methods
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
#define DEFAULT_PPM_COEF_LIMIT
Definition reader_ppm.c:64
static void clearLine(char *linebuffer, int *linecnt)
Definition reader_ppm.c:141
static void endLine(SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, char *linebuffer, int *linecnt)
Definition reader_ppm.c:155
static void initReaderdata(SCIP_READERDATA *readerdata)
Definition reader_ppm.c:83
static SCIP_RETCODE getActiveVariables(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
Definition reader_ppm.c:98
static void appendLine(SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, char *linebuffer, int *linecnt, const char *extension)
Definition reader_ppm.c:181
#define DEFAULT_PPM_RGB_LIMIT
Definition reader_ppm.c:63
#define DEFAULT_PPM_RGB_ASCII
Definition reader_ppm.c:66
#define DEFAULT_PPM_RGB_RELATIVE
Definition reader_ppm.c:65
static void printRow(SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, SCIP_VAR **vars, SCIP_Real *vals, int nvars, int ntotalvars, SCIP_Real maxcoef)
Definition reader_ppm.c:268
static void calcColorValue(SCIP *scip, SCIP_READERDATA *readerdata, SCIP_Real coef, int *red, int *green, int *blue, SCIP_Real scale)
Definition reader_ppm.c:206
#define PPM_MAX_LINELEN
Definition reader_ppm.c:62
static SCIP_RETCODE printLinearCons(SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, SCIP_VAR **vars, SCIP_Real *vals, int nvars, int ncompletevars, SCIP_Bool transformed, SCIP_Real *maxcoef, SCIP_Bool printbool)
Definition reader_ppm.c:373
file writer for portable pixmap file format (PPM), 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 numerical tolerances
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
struct SCIP_Reader SCIP_READER
Definition type_reader.h:53
#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