Scippy

SCIP

Solving Constraint Integer Programs

reader_cip.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-2024 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_cip.c
26 * @ingroup DEFPLUGINS_READER
27 * @brief CIP file reader
28 * @author Stefan Heinz
29 * @author Marc Pfetsch
30 * @author Michael Winkler
31 *
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
37#include "scip/cons_linear.h"
38#include "scip/pub_fileio.h"
39#include "scip/pub_message.h"
40#include "scip/pub_misc.h"
41#include "scip/pub_reader.h"
42#include "scip/pub_var.h"
43#include "scip/reader_cip.h"
44#include "scip/scip_cons.h"
45#include "scip/scip_mem.h"
46#include "scip/scip_message.h"
47#include "scip/scip_numerics.h"
48#include "scip/scip_param.h"
49#include "scip/scip_prob.h"
50#include "scip/scip_reader.h"
51#include "scip/scip_var.h"
52
53
54#define READER_NAME "cipreader"
55#define READER_DESC "file reader for CIP (Constraint Integer Program) format"
56#define READER_EXTENSION "cip"
57
58#define DEFAULT_CIP_WRITEFIXEDVARS TRUE /**< Should fixed and aggregated variables be written when writing? */
59
60
61/** CIP reading data */
62struct SCIP_ReaderData
63{
64 SCIP_Bool writefixedvars; /**< Should fixed and aggregated variables be written when writing? */
65};
66
67
68/** Section of the in CIP files */
70{
71 CIP_START, /**< start tag */
72 CIP_STATISTIC, /**< statistics section */
73 CIP_OBJECTIVE, /**< objective */
74 CIP_VARS, /**< list of (free) variables */
75 CIP_FIXEDVARS, /**< list of fixed variables */
76 CIP_CONSTRAINTS, /**< constraints */
77 CIP_END /**< end of file tag */
78};
79typedef enum CipSection CIPSECTION; /**< Section of the in CIP files */
80
81
82/*
83 * Data structures
84 */
85
86/** CIP reading data */
87struct CipInput
88{
89 SCIP_FILE* file; /**< input file */
90 char* strbuf; /**< string buffer for input lines */
91 int len; /**< length of strbuf */
92 int readingsize; /**< size of block in which len is increased if necessary */
93 int linenumber; /**< number of line in input file */
94 CIPSECTION section; /**< current section */
95 SCIP_Bool haserror; /**< some error occurred */
96 SCIP_Bool endfile; /**< we have reached the end of the file */
97};
98typedef struct CipInput CIPINPUT; /**< CIP reading data */
99
100
101/*
102 * Local methods for reading/parsing
103 */
104
105/** get next input line; this are all characters until the next semicolon */
106static
108 SCIP* scip, /**< SCIP data structure */
109 CIPINPUT* cipinput /**< CIP parsing data */
110 )
111{
112 char* endline;
113 char* endcharacter;
114 char* windowsendlinechar;
115
116 assert(cipinput != NULL);
117
118 /* read next line */
119 cipinput->endfile = (SCIPfgets(cipinput->strbuf, cipinput->len, cipinput->file) == NULL);
120
121 if( cipinput->endfile )
122 {
123 /* clear the line for safety reason */
124 BMSclearMemoryArray(cipinput->strbuf, cipinput->len);
125 return SCIP_OKAY;
126 }
127
128 cipinput->linenumber++;
129 endline = strchr(cipinput->strbuf, '\n');
130 endcharacter = strchr(cipinput->strbuf, ';');
131
132 while( endline == NULL || (endcharacter == NULL && cipinput->section == CIP_CONSTRAINTS && strncmp(cipinput->strbuf, "END", 3) != 0 ) )
133 {
134 int pos;
135
136 /* we refill the buffer from the '\n' character */
137 if( endline == NULL )
138 pos = cipinput->len - 1;
139 else
140 pos = (int) (endline - cipinput->strbuf);
141
142 /* don't erase the '\n' from all buffers for constraints */
143 if( endline != NULL && cipinput->section == CIP_CONSTRAINTS )
144 pos++;
145
146 /* if necessary reallocate memory */
147 if( pos + cipinput->readingsize >= cipinput->len )
148 {
149 cipinput->len = SCIPcalcMemGrowSize(scip, pos + cipinput->readingsize);
150 SCIP_CALL( SCIPreallocBufferArray(scip, &(cipinput->strbuf), cipinput->len) );
151 }
152
153 /* read next line */
154 cipinput->endfile = (SCIPfgets(&(cipinput->strbuf[pos]), cipinput->len - pos, cipinput->file) == NULL);
155
156 if( cipinput->endfile )
157 {
158 /* clear the line for safety reason */
159 BMSclearMemoryArray(cipinput->strbuf, cipinput->len);
160 return SCIP_OKAY;
161 }
162
163 cipinput->linenumber++;
164 endline = strrchr(&cipinput->strbuf[pos], '\n');
165 endcharacter = strchr(&cipinput->strbuf[pos], ';');
166 }
167 assert(endline != NULL);
168
169 /*SCIPdebugMsg(scip, "read line: %s\n", cipinput->strbuf);*/
170
171 /* check for windows "carriage return" endline character */
172 windowsendlinechar = strrchr(cipinput->strbuf, '\r');
173 if( windowsendlinechar != NULL && windowsendlinechar + 1 == endline )
174 --endline;
175 else
176 /* if the assert should not hold we found a windows "carriage return" which was not at the end of the line */
177 assert(windowsendlinechar == NULL);
178
179 if( cipinput->section == CIP_CONSTRAINTS && endcharacter != NULL && endline - endcharacter != 1 )
180 {
181 SCIPerrorMessage("Constraint line has to end with ';\\n' (line: %d).\n", cipinput->linenumber);
182 cipinput->haserror = TRUE;
183 return SCIP_OKAY; /* return error at hightest level */
184 }
185
186 *endline = '\0';
187
188 return SCIP_OKAY;
189}
190
191/** read the problem name out of the statistics */
192static
194 SCIP* scip, /**< SCIP data structure */
195 CIPINPUT* cipinput /**< CIP parsing data */
196 )
197{
198 char* buf;
199
200 assert(scip != NULL);
201
202 buf = cipinput->strbuf;
203
204 if( strncmp(buf, "STATISTICS", 9) == 0 )
205 {
206 cipinput->section = CIP_STATISTIC;
207 return;
208 }
209
210 if( strncmp(buf, "VARIABLES", 8) == 0 || strncmp(buf, "FIXED", 5) == 0 || strncmp(buf, "CONSTRAINTS", 11) == 0 || strncmp(buf, "OBJECTIVE", 9) == 0 )
211 {
212 SCIPerrorMessage("Syntax Error: File has to start with 'STATISTICS' section.\n");
213 cipinput->haserror = TRUE;
214 }
215}
216
217
218/** read the problem name out of the statistics */
219static
221 SCIP* scip, /**< SCIP data structure */
222 CIPINPUT* cipinput /**< CIP parsing data */
223 )
224{
225 char* buf;
226
227 buf = cipinput->strbuf;
228
229 if( strncmp(buf, "OBJECTIVE", 9) == 0 )
230 {
231 cipinput->section = CIP_OBJECTIVE;
232 return SCIP_OKAY;
233 }
234
235 SCIPdebugMsg(scip, "parse statistics\n");
236
237 if( strncmp(buf, " Problem name", 14) == 0 )
238 {
239 char* name;
240 char* s;
241
242 name = strchr(buf, ':');
243
244 if( name == NULL )
245 {
246 SCIPwarningMessage(scip, "did not find problem name (line: %d):\n%s\n", cipinput->linenumber, cipinput->strbuf);
247 return SCIP_OKAY; /* no error, might work with empty problem name */
248 }
249
250 /* skip ':' */
251 ++name;
252
253 /* make sure that we terminate the string at comments ('#') or newline ('\r', '\n')*/
254 if( NULL != (s = strpbrk(name, "#\r\n")) )
255 *s = '\0';
256
257 /* remove white space (tabs, ' ') in front of the name */
258 SCIP_CALL( SCIPskipSpace(&name) );
259
260 /* set problem name */
262
263 SCIPdebugMsg(scip, "problem name <%s>\n", name);
264 }
265
266 return SCIP_OKAY;
267}
268
269/** read objective sense, offset, and scale */
270static
272 SCIP* scip, /**< SCIP data structure */
273 CIPINPUT* cipinput, /**< CIP parsing data */
274 SCIP_Real* objscale, /**< buffer where to multiply with objective scale */
275 SCIP_Real* objoffset /**< buffer where to add with objective offset */
276 )
277{
278 char* buf;
279 char* name;
280
281 assert(objscale != NULL);
282 assert(objoffset != NULL);
283
284 buf = cipinput->strbuf;
285
286 if( strncmp(buf, "VARIABLES", 8) == 0 )
287 cipinput->section = CIP_VARS;
288 else if( strncmp(buf, "FIXED", 5) == 0 )
289 cipinput->section = CIP_FIXEDVARS;
290 else if( strncmp(buf, "CONSTRAINTS", 11) == 0 )
291 cipinput->section = CIP_CONSTRAINTS;
292 else if( strncmp(buf, "END", 3) == 0 )
293 cipinput->section = CIP_END;
294
295 if( cipinput->section != CIP_OBJECTIVE )
296 return SCIP_OKAY;
297
298 SCIPdebugMsg(scip, "parse objective information\n");
299
300 /* remove white space */
301 SCIP_CALL( SCIPskipSpace(&buf) );
302
303 if( SCIPstrncasecmp(buf, "Sense", 5) == 0 )
304 {
305 SCIP_OBJSENSE objsense;
306
307 name = strchr(buf, ':');
308
309 if( name == NULL )
310 {
311 SCIPwarningMessage(scip, "did not find objective sense (line: %d):\n%s\n", cipinput->linenumber, cipinput->strbuf);
312 return SCIP_OKAY; /* no error - might work with default */
313 }
314
315 /* skip ':' */
316 ++name;
317
318 /* remove white space in front of the name */
319 SCIP_CALL( SCIPskipSpace(&name) );
320
321 if( SCIPstrncasecmp(name, "min", 3) == 0 )
322 objsense = SCIP_OBJSENSE_MINIMIZE;
323 else if( SCIPstrncasecmp(name, "max", 3) == 0 )
324 objsense = SCIP_OBJSENSE_MAXIMIZE;
325 else
326 {
327 SCIPwarningMessage(scip, "unknown objective sense '%s' (line: %d):\n%s\n", name, cipinput->linenumber, cipinput->strbuf);
328 return SCIP_OKAY; /* no error - might work with default */
329 }
330
331 /* set problem name */
332 SCIP_CALL( SCIPsetObjsense(scip, objsense) );
333 SCIPdebugMsg(scip, "objective sense <%s>\n", objsense == SCIP_OBJSENSE_MINIMIZE ? "minimize" : "maximize");
334 }
335 else if( SCIPstrncasecmp(buf, "Offset", 6) == 0 )
336 {
337 SCIP_Real off = 0;
338 char* endptr;
339
340 name = strchr(buf, ':');
341
342 if( name == NULL )
343 {
344 SCIPwarningMessage(scip, "did not find offset (line: %d)\n", cipinput->linenumber);
345 return SCIP_OKAY;
346 }
347
348 /* skip ':' */
349 ++name;
350
351 /* remove white space in front of the name */
352 SCIP_CALL( SCIPskipSpace(&name) );
353
354 if ( SCIPstrToRealValue(name, &off, &endptr) )
355 {
356 *objoffset += off;
357 SCIPdebugMsg(scip, "offset <%g> (total: %g)\n", off, *objoffset);
358 }
359 else
360 {
361 SCIPwarningMessage(scip, "could not parse offset (line: %d)\n%s\n", cipinput->linenumber, cipinput->strbuf);
362 return SCIP_OKAY;
363 }
364 }
365 else if( SCIPstrncasecmp(buf, "Scale", 5) == 0 )
366 {
367 SCIP_Real scale = 1.0;
368 char* endptr;
369
370 name = strchr(buf, ':');
371
372 if( name == NULL )
373 {
374 SCIPwarningMessage(scip, "did not find scale (line: %d)\n", cipinput->linenumber);
375 return SCIP_OKAY;
376 }
377
378 /* skip ':' */
379 ++name;
380
381 /* remove white space in front of the name */
382 SCIP_CALL( SCIPskipSpace(&name) );
383
384 if ( SCIPstrToRealValue(name, &scale, &endptr) )
385 {
386 *objscale *= scale;
387 SCIPdebugMsg(scip, "objscale <%g> (total: %g)\n", scale, *objscale);
388 }
389 else
390 {
391 SCIPwarningMessage(scip, "could not parse objective scale (line: %d)\n%s\n", cipinput->linenumber, cipinput->strbuf);
392 return SCIP_OKAY;
393 }
394 }
395
396 return SCIP_OKAY;
397}
398
399/** read variable */
400static
402 SCIP* scip, /**< SCIP data structure */
403 CIPINPUT* cipinput, /**< CIP parsing data */
404 SCIP_Bool initial, /**< should var's column be present in the initial root LP? */
405 SCIP_Bool removable, /**< is var's column removable from the LP (due to aging or cleanup)? */
406 SCIP_Real objscale /**< objective scale */
407 )
408{
409 SCIP_Bool success;
410 SCIP_VAR* var;
411 char* buf;
412 char* endptr;
413
414 buf = cipinput->strbuf;
415
416 if( strncmp(buf, "FIXED", 5) == 0 )
417 cipinput->section = CIP_FIXEDVARS;
418 else if( strncmp(buf, "CONSTRAINTS", 4) == 0 )
419 cipinput->section = CIP_CONSTRAINTS;
420 else if( strncmp(buf, "END", 3) == 0 )
421 cipinput->section = CIP_END;
422
423 if( cipinput->section != CIP_VARS )
424 return SCIP_OKAY;
425
426 SCIPdebugMsg(scip, "parse variable\n");
427
428 /* parse the variable */
429 SCIP_CALL( SCIPparseVar(scip, &var, buf, initial, removable, NULL, NULL, NULL, NULL, NULL, &endptr, &success) );
430
431 if( !success )
432 {
433 SCIPerrorMessage("syntax error in variable information (line: %d):\n%s\n", cipinput->linenumber, cipinput->strbuf);
434 cipinput->haserror = TRUE;
435 return SCIP_OKAY;
436 }
437
438 if( objscale != 1.0 )
439 {
440 SCIP_CALL( SCIPchgVarObj(scip, var, SCIPvarGetObj(var) * objscale) );
441 }
442
443 SCIP_CALL( SCIPaddVar(scip, var) );
444
446
447 SCIP_CALL( SCIPreleaseVar(scip, &var) );
448
449 return SCIP_OKAY;
450}
451
452/** read fixed variable */
453static
455 SCIP* scip, /**< SCIP data structure */
456 CIPINPUT* cipinput /**< CIP parsing data */
457 )
458{
459 SCIP_Bool success;
460 SCIP_VAR* var;
461 char* buf;
462 char* endptr;
463 char name[SCIP_MAXSTRLEN];
464
465 buf = cipinput->strbuf;
466
467 if( strncmp(buf, "CONSTRAINTS", 11) == 0 )
468 cipinput->section = CIP_CONSTRAINTS;
469 else if( strncmp(buf, "END", 3) == 0 )
470 cipinput->section = CIP_END;
471
472 if( cipinput->section != CIP_FIXEDVARS )
473 return SCIP_OKAY;
474
475 SCIPdebugMsg(scip, "parse fixed variable\n");
476
477 /* parse the variable */
478 SCIP_CALL( SCIPparseVar(scip, &var, buf, TRUE, FALSE, NULL, NULL, NULL, NULL, NULL, &endptr, &success) );
479
480 if( !success )
481 {
482 SCIPerrorMessage("syntax error in variable information (line: %d):\n%s\n", cipinput->linenumber, cipinput->strbuf);
483 cipinput->haserror = TRUE;
484 return SCIP_OKAY;
485 }
486
487 /* skip intermediate stuff */
488 buf = endptr;
489
490 while ( *buf != '\0' && (*buf == ' ' || *buf == ',') )
491 ++buf;
492
493 /* check whether variable is fixed */
494 if ( strncmp(buf, "fixed:", 6) == 0 )
495 {
496 SCIP_CALL( SCIPaddVar(scip, var) );
498 }
499 else if ( strncmp(buf, "negated:", 8) == 0 )
500 {
501 SCIP_CONS* lincons;
502 SCIP_VAR* negvar;
503 SCIP_Real vals[2];
504 SCIP_VAR* vars[2];
505
506 buf += 8;
507
508 /* we can just parse the next variable (ignoring all other information in between) */
509 SCIP_CALL( SCIPparseVarName(scip, buf, &negvar, &endptr) );
510
511 if ( negvar == NULL )
512 {
513 SCIPerrorMessage("could not parse negated variable (line: %d):\n%s\n", cipinput->linenumber, cipinput->strbuf);
514 cipinput->haserror = TRUE;
515 return SCIP_OKAY;
516 }
517
518 assert(SCIPvarIsBinary(var));
519 assert(SCIPvarIsBinary(negvar));
520
521 SCIP_CALL( SCIPaddVar(scip, var) );
522
523 SCIPdebugMsg(scip, "creating negated variable <%s> (of <%s>) ...\n", SCIPvarGetName(var), SCIPvarGetName(negvar) );
525
526 /* add linear constraint for negation */
527 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "neg_%s", SCIPvarGetName(var) );
528 vars[0] = var;
529 vars[1] = negvar;
530 vals[0] = 1.0;
531 vals[1] = 1.0;
532 SCIPdebugMsg(scip, "coupling constraint:\n");
533 SCIP_CALL( SCIPcreateConsLinear(scip, &lincons, name, 2, vars, vals, 1.0, 1.0, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE) );
534 SCIPdebugPrintCons(scip, lincons, NULL);
535 SCIP_CALL( SCIPaddCons(scip, lincons) );
536 SCIP_CALL( SCIPreleaseCons(scip, &lincons) );
537 }
538 else if ( strncmp(buf, "aggregated:", 11) == 0 )
539 {
540 /* handle (multi-)aggregated variables */
541 SCIP_CONS* lincons;
542 SCIP_Real* vals;
543 SCIP_VAR** vars;
544 SCIP_Real rhs = 0.0;
545 const char* str;
546 int nvarssize = 20;
547 int requsize;
548 int nvars;
549
550 buf += 11;
551
552 SCIPdebugMsg(scip, "parsing aggregated variable <%s> ...\n", SCIPvarGetName(var));
553
554 /* first parse constant */
555 if ( ! SCIPstrToRealValue(buf, &rhs, &endptr) )
556 {
557 SCIPerrorMessage("expected constant when aggregated variable information (line: %d):\n%s\n", cipinput->linenumber, buf);
558 cipinput->haserror = TRUE;
559 return SCIP_OKAY;
560 }
561
562 /* check whether constant is 0.0 */
563 str = endptr;
564 SCIP_CALL( SCIPskipSpace((char**)&str) );
565 /* if next char is '<' we found a variable -> constant is 0 */
566 if ( *str != '<' )
567 {
568 SCIPdebugMsg(scip, "constant: %f\n", rhs);
569 buf = endptr;
570 }
571 else
572 {
573 /* otherwise keep buf */
574 rhs = 0.0;
575 }
576
577 /* initialize buffers for storing the variables and values */
578 SCIP_CALL( SCIPallocBufferArray(scip, &vars, nvarssize) );
579 SCIP_CALL( SCIPallocBufferArray(scip, &vals, nvarssize) );
580
581 vars[0] = var;
582 vals[0] = -1.0;
583 --nvarssize;
584
585 /* parse linear sum to get variables and coefficients */
586 SCIP_CALL( SCIPparseVarsLinearsum(scip, buf, &(vars[1]), &(vals[1]), &nvars, nvarssize, &requsize, &endptr, &success) );
587 if ( success && requsize > nvarssize )
588 {
589 /* realloc buffers and try again */
590 nvarssize = requsize;
591 SCIP_CALL( SCIPreallocBufferArray(scip, &vars, nvarssize + 1) );
592 SCIP_CALL( SCIPreallocBufferArray(scip, &vals, nvarssize + 1) );
593
594 SCIP_CALL( SCIPparseVarsLinearsum(scip, buf, &(vars[1]), &(vals[1]), &nvars, nvarssize, &requsize, &endptr, &success) );
595 assert( ! success || requsize <= nvarssize); /* if successful, then should have had enough space now */
596 }
597
598 if( success )
599 {
600 /* add aggregated variable */
601 SCIP_CALL( SCIPaddVar(scip, var) );
602
603 /* special handling of variables that seem to be slack variables of indicator constraints */
604 str = SCIPvarGetName(var);
605 if ( strncmp(str, "indslack", 8) == 0 )
606 {
607 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "indlin");
608 (void) strncat(name, str+8, SCIP_MAXSTRLEN-7);
609 }
610 else if ( strncmp(str, "t_indslack", 10) == 0 )
611 {
612 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "indlin");
613 (void) strncat(name, str+10, SCIP_MAXSTRLEN-7);
614 }
615 else
616 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s", SCIPvarGetName(var) );
617
618 /* add linear constraint for (multi-)aggregation */
619 SCIPdebugMsg(scip, "coupling constraint:\n");
620 SCIP_CALL( SCIPcreateConsLinear(scip, &lincons, name, nvars + 1, vars, vals, -rhs, -rhs, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE) );
621 SCIPdebugPrintCons(scip, lincons, NULL);
622 SCIP_CALL( SCIPaddCons(scip, lincons) );
623 SCIP_CALL( SCIPreleaseCons(scip, &lincons) );
624 }
625 else
626 {
627 SCIPwarningMessage(scip, "Could not read (multi-)aggregated variable <%s>: dependent variables unkown - consider changing the order (line: %d):\n%s\n",
628 SCIPvarGetName(var), cipinput->linenumber, buf);
629 }
630
633 }
634 else
635 {
636 SCIPerrorMessage("unknown section when parsing variables (line: %d):\n%s\n", cipinput->linenumber, buf);
637 cipinput->haserror = TRUE;
638 return SCIP_OKAY;
639 }
640 SCIP_CALL( SCIPreleaseVar(scip, &var) );
641
642 return SCIP_OKAY;
643}
644
645/** read constraint */
646static
648 SCIP* scip, /**< SCIP data structure */
649 CIPINPUT* cipinput, /**< CIP parsing data */
650 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
651 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
652 SCIP_Bool dynamic, /**< Is constraint subject to aging?
653 * Usually set to FALSE. Set to TRUE for own cuts which
654 * are separated as constraints. */
655 SCIP_Bool removable /**< should the relaxation be removed from the LP due to aging or cleanup?
656 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
657 )
658{
659 SCIP_CONS* cons;
660 char* buf;
661 char* copybuf;
662 SCIP_RETCODE retcode;
663 SCIP_Bool separate;
664 SCIP_Bool enforce;
665 SCIP_Bool check;
666 SCIP_Bool propagate;
667 SCIP_Bool local;
668 SCIP_Bool modifiable;
669 SCIP_Bool success;
670 int len;
671
672 buf = cipinput->strbuf;
673
674 if( strncmp(buf, "END", 3) == 0 )
675 {
676 cipinput->section = CIP_END;
677 return SCIP_OKAY;
678 }
679
680 SCIPdebugMsg(scip, "parse constraints in line %d\n", cipinput->linenumber);
681
682 separate = TRUE;
683 enforce = TRUE;
684 check = TRUE;
685 propagate = TRUE;
686 local = FALSE;
687 modifiable = FALSE;
688
689 /* get length of line and check for correct ending of constraint line */
690 len = (int)strlen(buf);
691 if( len < 1 )
692 {
693 SCIPerrorMessage("syntax error: expected constraint in line %d.\n", cipinput->linenumber);
694 cipinput->haserror = TRUE;
695 return SCIP_OKAY;
696 }
697 if ( buf[len - 1] != ';' )
698 {
699 SCIPerrorMessage("syntax error: line has to end with ';' (line: %d)\n", cipinput->linenumber);
700 cipinput->haserror = TRUE;
701 return SCIP_OKAY;
702 }
703
704 /* copy buffer for working purpose */
705 SCIP_CALL( SCIPduplicateBufferArray(scip, &copybuf, buf, len) );
706 copybuf[len - 1] = '\0';
707
708 /* parse the constraint */
709 retcode = SCIPparseCons(scip, &cons, copybuf,
710 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, FALSE, &success);
711
712 /* free temporary buffer */
713 SCIPfreeBufferArray(scip, &copybuf);
714
715 SCIP_CALL( retcode );
716
717 if( !success )
718 {
719 SCIPerrorMessage("syntax error when reading constraint (line: %d):\n%s\n", cipinput->linenumber, cipinput->strbuf);
720 cipinput->haserror = TRUE;
721 return SCIP_OKAY;
722 }
723
724 SCIP_CALL( SCIPaddCons(scip, cons) );
726 SCIP_CALL( SCIPreleaseCons(scip, &cons) );
727
728 return SCIP_OKAY;
729}
730
731/*
732 * Callback methods of reader
733 */
734
735/** copy method for reader plugins (called when SCIP copies plugins) */
736static
738{ /*lint --e{715}*/
739 assert(scip != NULL);
740 assert(reader != NULL);
741 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
742
743 /* call inclusion method of reader */
745
746 return SCIP_OKAY;
747}
748
749/** destructor of reader to free user data (called when SCIP is exiting) */
750static
752{
753 SCIP_READERDATA* readerdata;
754
755 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
756 readerdata = SCIPreaderGetData(reader);
757 assert(readerdata != NULL);
758 SCIPfreeBlockMemory(scip, &readerdata);
759
760 return SCIP_OKAY;
761}
762
763
764/** problem reading method of reader */
765static
767{ /*lint --e{715}*/
768 CIPINPUT cipinput;
769 SCIP_Real objscale;
770 SCIP_Real objoffset;
771 SCIP_Bool initialconss;
772 SCIP_Bool dynamicconss;
773 SCIP_Bool dynamiccols;
774 SCIP_Bool dynamicrows;
775 SCIP_Bool initialvar;
776 SCIP_Bool removablevar;
777 SCIP_RETCODE retcode;
778
779 if( NULL == (cipinput.file = SCIPfopen(filename, "r")) )
780 {
781 SCIPerrorMessage("cannot open file <%s> for reading\n", filename);
782 SCIPprintSysError(filename);
783 return SCIP_NOFILE;
784 }
785
786 cipinput.len = 131071;
787 SCIP_CALL( SCIPallocBufferArray(scip, &(cipinput.strbuf), cipinput.len) );
788
789 cipinput.linenumber = 0;
790 cipinput.section = CIP_START;
791 cipinput.haserror = FALSE;
792 cipinput.endfile = FALSE;
793 cipinput.readingsize = 65535;
794
796
797 SCIP_CALL( SCIPgetBoolParam(scip, "reading/initialconss", &initialconss) );
798 SCIP_CALL( SCIPgetBoolParam(scip, "reading/dynamiccols", &dynamiccols) );
799 SCIP_CALL( SCIPgetBoolParam(scip, "reading/dynamicconss", &dynamicconss) );
800 SCIP_CALL( SCIPgetBoolParam(scip, "reading/dynamicrows", &dynamicrows) );
801
802 initialvar = !dynamiccols;
803 removablevar = dynamiccols;
804
805 objscale = 1.0;
806 objoffset = 0.0;
807
808 while( cipinput.section != CIP_END && !cipinput.haserror )
809 {
810 /* get next input string */
811 SCIP_CALL( getInputString(scip, &cipinput) );
812
813 if( cipinput.endfile )
814 break;
815
816 switch( cipinput.section )
817 {
818 case CIP_START:
819 getStart(scip, &cipinput);
820 break;
821 case CIP_STATISTIC:
822 SCIP_CALL( getStatistics(scip, &cipinput) );
823 break;
824 case CIP_OBJECTIVE:
825 SCIP_CALL( getObjective(scip, &cipinput, &objscale, &objoffset) );
826 break;
827 case CIP_VARS:
828 retcode = getVariable(scip, &cipinput, initialvar, removablevar, objscale);
829
830 if( retcode == SCIP_READERROR )
831 {
832 cipinput.haserror = TRUE;
833 goto TERMINATE;
834 }
835 SCIP_CALL(retcode);
836
837 break;
838 case CIP_FIXEDVARS:
839 retcode = getFixedVariable(scip, &cipinput);
840
841 if( retcode == SCIP_READERROR )
842 {
843 cipinput.haserror = TRUE;
844 goto TERMINATE;
845 }
846 SCIP_CALL(retcode);
847
848 break;
849 case CIP_CONSTRAINTS:
850 retcode = getConstraint(scip, &cipinput, initialconss, dynamicconss, dynamicrows);
851
852 if( retcode == SCIP_READERROR )
853 {
854 cipinput.haserror = TRUE;
855 goto TERMINATE;
856 }
857 SCIP_CALL(retcode);
858
859 break;
860 default:
861 SCIPerrorMessage("invalid CIP state\n");
862 SCIPABORT();
863 return SCIP_INVALIDDATA; /*lint !e527*/
864 } /*lint !e788*/
865 }
866
867 if( !SCIPisZero(scip, objoffset) && !cipinput.haserror )
868 {
869 SCIP_VAR* objoffsetvar;
870
871 objoffset *= objscale;
872 SCIP_CALL( SCIPcreateVar(scip, &objoffsetvar, "objoffset", objoffset, objoffset, 1.0, SCIP_VARTYPE_CONTINUOUS,
873 TRUE, TRUE, NULL, NULL, NULL, NULL, NULL) );
874 SCIP_CALL( SCIPaddVar(scip, objoffsetvar) );
875 SCIP_CALL( SCIPreleaseVar(scip, &objoffsetvar) );
876 SCIPdebugMsg(scip, "added variables <objoffset> for objective offset of <%g>\n", objoffset);
877 }
878
879 if( cipinput.section != CIP_END && !cipinput.haserror )
880 {
881 SCIPerrorMessage("unexpected EOF\n");
882 }
883
884 TERMINATE:
885 /* close file stream */
886 SCIPfclose(cipinput.file);
887
888 SCIPfreeBufferArray(scip, &cipinput.strbuf);
889
890 if( cipinput.haserror )
891 return SCIP_READERROR;
892
893 /* successfully parsed cip format */
894 *result = SCIP_SUCCESS;
895 return SCIP_OKAY;
896}
897
898/** hash key retrieval function for variables */
899static
901{ /*lint --e{715}*/
902 return elem;
903}
904
905/** returns TRUE iff the indices of both variables are equal */
906static
908{ /*lint --e{715}*/
909 if( key1 == key2 )
910 return TRUE;
911 return FALSE;
912}
913
914/** returns the hash value of the key */
915static
917{ /*lint --e{715}*/
918 assert( SCIPvarGetIndex((SCIP_VAR*) key) >= 0 );
919 return (unsigned int) SCIPvarGetIndex((SCIP_VAR*) key);
920}
921
922/** problem writing method of reader */
923static
925{ /*lint --e{715}*/
926 SCIP_HASHTABLE* varhash = NULL;
927 SCIP_READERDATA* readerdata;
928 int i;
929
930 assert(reader != NULL);
931 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
932
933 SCIPinfoMessage(scip, file, "STATISTICS\n");
934 SCIPinfoMessage(scip, file, " Problem name : %s\n", name);
935 SCIPinfoMessage(scip, file, " Variables : %d (%d binary, %d integer, %d implicit integer, %d continuous)\n",
936 nvars, nbinvars, nintvars, nimplvars, ncontvars);
937 SCIPinfoMessage(scip, file, " Constraints : %d initial, %d maximal\n", startnconss, maxnconss);
938
939 SCIPinfoMessage(scip, file, "OBJECTIVE\n");
940 SCIPinfoMessage(scip, file, " Sense : %s\n", objsense == SCIP_OBJSENSE_MINIMIZE ? "minimize" : "maximize");
941 if( !SCIPisZero(scip, objoffset) )
942 SCIPinfoMessage(scip, file, " Offset : %+.15g\n", objoffset);
943 if( !SCIPisEQ(scip, objscale, 1.0) )
944 SCIPinfoMessage(scip, file, " Scale : %.15g\n", objscale);
945
946 if ( nfixedvars > 0 )
947 {
948 /* set up hash table for variables that have been written property (used for writing out fixed vars in the right order) */
949 SCIP_CALL( SCIPhashtableCreate(&varhash, SCIPblkmem(scip), nvars + nfixedvars, hashGetKeyVar, hashKeyEqVar, hashKeyValVar, NULL) );
950 }
951
952 if ( nvars + nfixedvars > 0 )
953 {
954 SCIPinfoMessage(scip, file, "VARIABLES\n");
955 }
956
957 if( nvars > 0 )
958 {
959 for( i = 0; i < nvars; ++i )
960 {
961 SCIP_VAR* var;
962
963 var = vars[i];
964 assert( var != NULL );
965 SCIP_CALL( SCIPprintVar(scip, var, file) );
966 if ( varhash != NULL )
967 {
968 /* add free variable to hashtable */
969 if ( ! SCIPhashtableExists(varhash, (void*) var) )
970 {
971 SCIP_CALL( SCIPhashtableInsert(varhash, (void*) var) );
972 }
973 }
974 }
975 }
976
977 readerdata = SCIPreaderGetData(reader);
978 assert(readerdata != NULL);
979
980 if( readerdata->writefixedvars && nfixedvars > 0 )
981 {
982 int nwritten = 0;
983
984 SCIPinfoMessage(scip, file, "FIXED\n");
985
986 /* loop through variables until each has been written after the variables that it depends on have been written; this
987 * requires several runs over the variables, but the depth (= number of loops) is usually small. */
988 while ( nwritten < nfixedvars )
989 {
990 SCIPdebugMsg(scip, "written %d of %d fixed variables.\n", nwritten, nfixedvars);
991 for (i = 0; i < nfixedvars; ++i)
992 {
993 SCIP_VAR* var;
994 SCIP_VAR* tmpvar;
995
996 var = fixedvars[i];
997 assert( var != NULL );
998
999 /* skip variables already written */
1000 if ( SCIPhashtableExists(varhash, (void*) var) )
1001 continue;
1002
1003 switch ( SCIPvarGetStatus(var) )
1004 {
1006
1007 /* fixed variables can simply be output and added to the hashtable */
1008 SCIP_CALL( SCIPprintVar(scip, var, file) );
1009 assert( ! SCIPhashtableExists(varhash, (void*) var) );
1010 SCIP_CALL( SCIPhashtableInsert(varhash, (void*) var) );
1011 ++nwritten;
1012
1013 break;
1014
1016
1017 tmpvar = SCIPvarGetNegationVar(var);
1018 assert( tmpvar != NULL );
1019 assert( var == SCIPvarGetNegatedVar(tmpvar) );
1020
1021 /* if the negated variable has been written, we can write the current variable */
1022 if ( SCIPhashtableExists(varhash, (void*) tmpvar) )
1023 {
1024 SCIP_CALL( SCIPprintVar(scip, var, file) );
1025 assert( ! SCIPhashtableExists(varhash, (void*) var) );
1026 SCIP_CALL( SCIPhashtableInsert(varhash, (void*) var) );
1027 ++nwritten;
1028 }
1029 break;
1030
1032
1033 tmpvar = SCIPvarGetAggrVar(var);
1034 assert( tmpvar != NULL );
1035
1036 /* if the aggregating variable has been written, we can write the current variable */
1037 if ( SCIPhashtableExists(varhash, (void*) tmpvar) )
1038 {
1039 SCIP_CALL( SCIPprintVar(scip, var, file) );
1040 assert( ! SCIPhashtableExists(varhash, (void*) var) );
1041 SCIP_CALL( SCIPhashtableInsert(varhash, (void*) var) );
1042 ++nwritten;
1043 }
1044 break;
1045
1047 {
1048 SCIP_VAR** aggrvars;
1049 int naggrvars;
1050 int j;
1051
1052 /* get the active representation */
1054
1055 naggrvars = SCIPvarGetMultaggrNVars(var);
1056 aggrvars = SCIPvarGetMultaggrVars(var);
1057 assert(aggrvars != NULL || naggrvars == 0);
1058
1059 for (j = 0; j < naggrvars; ++j)
1060 {
1061 if( !SCIPhashtableExists(varhash, (void*) aggrvars[j]) ) /*lint !e613*/
1062 break;
1063 }
1064
1065 /* if all multi-aggregating variables have been written, we can write the current variable */
1066 if ( j >= naggrvars )
1067 {
1068 SCIP_CALL( SCIPprintVar(scip, var, file) );
1069 assert( ! SCIPhashtableExists(varhash, (void*) var) );
1070 SCIP_CALL( SCIPhashtableInsert(varhash, (void*) var) );
1071 ++nwritten;
1072 }
1073 break;
1074 }
1075
1079 SCIPerrorMessage("Only fixed variables are allowed to be present in fixedvars list.\n");
1080 SCIPABORT();
1081 return SCIP_ERROR; /*lint !e527*/
1082 }
1083 }
1084 }
1085 }
1086
1087 if( nconss > 0 )
1088 {
1089 SCIPinfoMessage(scip, file, "CONSTRAINTS\n");
1090
1091 for( i = 0; i < nconss; ++i )
1092 {
1093 SCIP_CALL( SCIPprintCons(scip, conss[i], file) );
1094 SCIPinfoMessage(scip, file, ";\n");
1095 }
1096 }
1097 SCIPinfoMessage(scip, file, "END\n");
1098
1099 *result = SCIP_SUCCESS;
1100
1101 if( nfixedvars > 0 )
1102 SCIPhashtableFree(&varhash);
1103 else
1104 assert(varhash == NULL);
1105
1106 return SCIP_OKAY;
1107}
1108
1109
1110/*
1111 * reader specific interface methods
1112 */
1113
1114/** includes the cip file reader in SCIP */
1116 SCIP* scip /**< SCIP data structure */
1117 )
1118{
1119 SCIP_READERDATA* readerdata;
1120 SCIP_READER* reader;
1121
1122 /* create cip reader data */
1123 SCIP_CALL( SCIPallocBlockMemory(scip, &readerdata) );
1124
1125 /* include reader */
1127
1128 /* set non fundamental callbacks via setter functions */
1129 SCIP_CALL( SCIPsetReaderCopy(scip, reader, readerCopyCip) );
1130 SCIP_CALL( SCIPsetReaderFree(scip, reader, readerFreeCip) );
1131 SCIP_CALL( SCIPsetReaderRead(scip, reader, readerReadCip) );
1132 SCIP_CALL( SCIPsetReaderWrite(scip, reader, readerWriteCip) );
1133
1134 /* add cip reader parameters */
1136 "reading/cipreader/writefixedvars", "should fixed and aggregated variables be printed (if not, re-parsing might fail)",
1137 &readerdata->writefixedvars, FALSE, DEFAULT_CIP_WRITEFIXEDVARS, NULL, NULL) );
1138
1139 return SCIP_OKAY;
1140}
Constraint handler for linear constraints in their most general form, .
#define NULL
Definition: def.h:266
#define SCIP_MAXSTRLEN
Definition: def.h:287
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:172
#define TRUE
Definition: def.h:93
#define FALSE
Definition: def.h:94
#define SCIPABORT()
Definition: def.h:345
#define SCIP_CALL(x)
Definition: def.h:373
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
Definition: fileio.c:153
int SCIPfclose(SCIP_FILE *fp)
Definition: fileio.c:232
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
Definition: fileio.c:200
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE SCIPincludeReaderCip(SCIP *scip)
Definition: reader_cip.c:1115
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
Definition: scip_prob.c:1668
SCIP_RETCODE SCIPsetProbName(SCIP *scip, const char *name)
Definition: scip_prob.c:1095
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:2770
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
Definition: scip_prob.c:1242
SCIP_RETCODE SCIPcreateProb(SCIP *scip, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata)
Definition: scip_prob.c:117
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition: misc.c:2349
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2662
SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
Definition: misc.c:2299
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2550
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:208
#define SCIPdebugMsg
Definition: scip_message.h:78
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:120
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
Definition: scip_param.c:250
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
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
Definition: scip_cons.c:2537
SCIP_RETCODE SCIPparseCons(SCIP *scip, SCIP_CONS **cons, const char *str, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, SCIP_Bool *success)
Definition: scip_cons.c:1082
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip_cons.c:1174
int SCIPcalcMemGrowSize(SCIP *scip, int num)
Definition: scip_mem.c:139
#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 SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
Definition: scip_reader.c:109
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
Definition: scip_reader.c:147
SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
Definition: reader.c:492
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERFREE((*readerfree)))
Definition: scip_reader.c:171
const char * SCIPreaderGetName(SCIP_READER *reader)
Definition: reader.c:557
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip_reader.c:195
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERWRITE((*readerwrite)))
Definition: scip_reader.c:219
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
Definition: var.c:17893
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
Definition: var.c:17598
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:17537
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17925
SCIP_RETCODE SCIPparseVarName(SCIP *scip, const char *str, SCIP_VAR **var, char **endptr)
Definition: scip_var.c:533
SCIP_RETCODE SCIPparseVar(SCIP *scip, SCIP_VAR **var, const char *str, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARCOPY((*varcopy)), SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_VARDATA *vardata, char **endptr, SCIP_Bool *success)
Definition: scip_var.c:474
int SCIPvarGetIndex(SCIP_VAR *var)
Definition: var.c:17757
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:17418
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
Definition: scip_var.c:1248
SCIP_RETCODE SCIPparseVarsLinearsum(SCIP *scip, const char *str, SCIP_VAR **vars, SCIP_Real *vals, int *nvars, int varssize, int *requiredsize, char **endptr, SCIP_Bool *success)
Definition: scip_var.c:704
SCIP_RETCODE SCIPflattenVarAggregationGraph(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:1693
SCIP_VAR ** SCIPvarGetMultaggrVars(SCIP_VAR *var)
Definition: var.c:17857
int SCIPvarGetMultaggrNVars(SCIP_VAR *var)
Definition: var.c:17845
SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
Definition: var.c:17903
SCIP_RETCODE SCIPcreateVar(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
Definition: scip_var.c:114
SCIP_RETCODE SCIPprintVar(SCIP *scip, SCIP_VAR *var, FILE *file)
Definition: scip_var.c:10117
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
Definition: scip_var.c:4636
SCIP_VAR * SCIPvarGetAggrVar(SCIP_VAR *var)
Definition: var.c:17809
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10880
SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
Definition: misc.c:11008
void SCIPprintSysError(const char *message)
Definition: misc.c:10772
SCIP_RETCODE SCIPskipSpace(char **s)
Definition: misc.c:10869
int SCIPstrncasecmp(const char *s1, const char *s2, int length)
Definition: misc.c:10929
memory allocation routines
#define BMSclearMemoryArray(ptr, num)
Definition: memory.h:130
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:57
wrapper functions to map file i/o to standard or zlib file i/o
struct SCIP_File SCIP_FILE
Definition: pub_fileio.h:43
public methods for message output
#define SCIPerrorMessage
Definition: pub_message.h:64
#define SCIPdebug(x)
Definition: pub_message.h:93
#define SCIPdebugPrintCons(x, y, z)
Definition: pub_message.h:102
public data structures and miscellaneous methods
public methods for input file readers
public methods for problem variables
static SCIP_RETCODE getConstraint(SCIP *scip, CIPINPUT *cipinput, SCIP_Bool initial, SCIP_Bool dynamic, SCIP_Bool removable)
Definition: reader_cip.c:647
enum CipSection CIPSECTION
Definition: reader_cip.c:79
static SCIP_DECL_READERFREE(readerFreeCip)
Definition: reader_cip.c:751
static SCIP_RETCODE getInputString(SCIP *scip, CIPINPUT *cipinput)
Definition: reader_cip.c:107
static SCIP_DECL_HASHGETKEY(hashGetKeyVar)
Definition: reader_cip.c:900
static SCIP_RETCODE getObjective(SCIP *scip, CIPINPUT *cipinput, SCIP_Real *objscale, SCIP_Real *objoffset)
Definition: reader_cip.c:271
#define READER_DESC
Definition: reader_cip.c:55
static void getStart(SCIP *scip, CIPINPUT *cipinput)
Definition: reader_cip.c:193
static SCIP_DECL_READERCOPY(readerCopyCip)
Definition: reader_cip.c:737
CipSection
Definition: reader_cip.c:70
@ CIP_CONSTRAINTS
Definition: reader_cip.c:76
@ CIP_VARS
Definition: reader_cip.c:74
@ CIP_START
Definition: reader_cip.c:71
@ CIP_OBJECTIVE
Definition: reader_cip.c:73
@ CIP_FIXEDVARS
Definition: reader_cip.c:75
@ CIP_STATISTIC
Definition: reader_cip.c:72
@ CIP_END
Definition: reader_cip.c:77
static SCIP_DECL_READERREAD(readerReadCip)
Definition: reader_cip.c:766
static SCIP_RETCODE getStatistics(SCIP *scip, CIPINPUT *cipinput)
Definition: reader_cip.c:220
#define READER_EXTENSION
Definition: reader_cip.c:56
#define DEFAULT_CIP_WRITEFIXEDVARS
Definition: reader_cip.c:58
static SCIP_DECL_READERWRITE(readerWriteCip)
Definition: reader_cip.c:924
#define READER_NAME
Definition: reader_cip.c:54
static SCIP_DECL_HASHKEYEQ(hashKeyEqVar)
Definition: reader_cip.c:907
static SCIP_DECL_HASHKEYVAL(hashKeyValVar)
Definition: reader_cip.c:916
struct CipInput CIPINPUT
Definition: reader_cip.c:98
static SCIP_RETCODE getFixedVariable(SCIP *scip, CIPINPUT *cipinput)
Definition: reader_cip.c:454
static SCIP_RETCODE getVariable(SCIP *scip, CIPINPUT *cipinput, SCIP_Bool initial, SCIP_Bool removable, SCIP_Real objscale)
Definition: reader_cip.c:401
CIP file reader.
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 global and local (sub)problems
public methods for reader plugins
public methods for SCIP variables
@ SCIP_OBJSENSE_MAXIMIZE
Definition: type_prob.h:47
@ SCIP_OBJSENSE_MINIMIZE
Definition: type_prob.h:48
enum SCIP_Objsense SCIP_OBJSENSE
Definition: type_prob.h:50
struct SCIP_ReaderData SCIP_READERDATA
Definition: type_reader.h:53
@ SCIP_SUCCESS
Definition: type_result.h:58
@ SCIP_NOFILE
Definition: type_retcode.h:47
@ SCIP_READERROR
Definition: type_retcode.h:45
@ SCIP_INVALIDDATA
Definition: type_retcode.h:52
@ SCIP_OKAY
Definition: type_retcode.h:42
@ SCIP_ERROR
Definition: type_retcode.h:43
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
@ SCIP_VARTYPE_CONTINUOUS
Definition: type_var.h:71
@ SCIP_VARSTATUS_ORIGINAL
Definition: type_var.h:49
@ SCIP_VARSTATUS_FIXED
Definition: type_var.h:52
@ SCIP_VARSTATUS_COLUMN
Definition: type_var.h:51
@ SCIP_VARSTATUS_MULTAGGR
Definition: type_var.h:54
@ SCIP_VARSTATUS_NEGATED
Definition: type_var.h:55
@ SCIP_VARSTATUS_AGGREGATED
Definition: type_var.h:53
@ SCIP_VARSTATUS_LOOSE
Definition: type_var.h:50