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