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