SCIP Doxygen Documentation
Loading...
Searching...
No Matches
reader.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-2025 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.c
26 * @ingroup OTHER_CFILES
27 * @brief interface for input file readers
28 * @author Tobias Achterberg
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#include <assert.h>
34#include <string.h>
35#if defined(_WIN32) || defined(_WIN64)
36#else
37#include <strings.h> /*lint --e{766}*/
38#endif
39#include <math.h>
40
41#include "scip/def.h"
43#include "scip/set.h"
44#include "scip/clock.h"
45#include "scip/pub_misc.h"
46#include "scip/reader.h"
47#include "scip/prob.h"
48#include "scip/pub_var.h"
49#include "scip/var.h"
50#include "scip/pub_cons.h"
51#include "scip/cons.h"
52#include "scip/pub_message.h"
53
54#include "scip/struct_reader.h"
55
56
57/** copies the given reader to a new scip */
59 SCIP_READER* reader, /**< reader */
60 SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
61 )
62{
63 assert(reader != NULL);
64 assert(set != NULL);
65 assert(set->scip != NULL);
66
67 if( reader->readercopy != NULL )
68 {
69 SCIPsetDebugMsg(set, "including reader %s in subscip %p\n", SCIPreaderGetName(reader), (void*)set->scip);
70 SCIP_CALL( reader->readercopy(set->scip, reader) );
71 }
72 return SCIP_OKAY;
73}
74
75/** internal method to create a reader */
76static
78 SCIP_READER** reader, /**< pointer to store reader */
79 const char* name, /**< name of reader */
80 const char* desc, /**< description of reader */
81 const char* extension, /**< file extension that reader processes */
82 SCIP_DECL_READERCOPY ((*readercopy)), /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */
83 SCIP_DECL_READERFREE ((*readerfree)), /**< destructor of reader */
84 SCIP_DECL_READERREAD ((*readerread)), /**< read method */
85 SCIP_DECL_READERWRITE ((*readerwrite)), /**< write method */
86 SCIP_READERDATA* readerdata /**< reader data */
87 )
88{
89 assert(reader != NULL);
90 assert(name != NULL);
91 assert(desc != NULL);
92 assert(extension != NULL);
93
94 SCIP_ALLOC( BMSallocMemory(reader) );
95 BMSclearMemory(*reader);
96
97 SCIP_ALLOC( BMSduplicateMemoryArray(&(*reader)->name, name, strlen(name)+1) );
98 SCIP_ALLOC( BMSduplicateMemoryArray(&(*reader)->desc, desc, strlen(desc)+1) );
99 SCIP_ALLOC( BMSduplicateMemoryArray(&(*reader)->extension, extension, strlen(extension)+1) );
100 (*reader)->readercopy = readercopy;
101 (*reader)->readerfree = readerfree;
102 (*reader)->readerread = readerread;
103 (*reader)->readerwrite = readerwrite;
104 (*reader)->readerdata = readerdata;
105
106 /* create reading clock */
107 SCIP_CALL( SCIPclockCreate(&(*reader)->readingtime, SCIP_CLOCKTYPE_DEFAULT) );
108
109 return SCIP_OKAY;
110}
111
112/** creates a reader */
114 SCIP_READER** reader, /**< pointer to store reader */
115 SCIP_SET* set, /**< global SCIP settings */
116 const char* name, /**< name of reader */
117 const char* desc, /**< description of reader */
118 const char* extension, /**< file extension that reader processes */
119 SCIP_DECL_READERCOPY ((*readercopy)), /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */
120 SCIP_DECL_READERFREE ((*readerfree)), /**< destructor of reader */
121 SCIP_DECL_READERREAD ((*readerread)), /**< read method */
122 SCIP_DECL_READERWRITE ((*readerwrite)), /**< write method */
123 SCIP_READERDATA* readerdata /**< reader data */
124 )
125{
126 assert(reader != NULL);
127 assert(set != NULL);
128 assert(name != NULL);
129 assert(desc != NULL);
130 assert(extension != NULL);
131
132 SCIP_CALL_FINALLY( doReaderCreate(reader, name, desc, extension, readercopy, readerfree, readerread, readerwrite,
133 readerdata), (void) SCIPreaderFree(reader, set) );
134
135 return SCIP_OKAY;
136}
137
138/** frees memory of reader */
140 SCIP_READER** reader, /**< pointer to reader data structure */
141 SCIP_SET* set /**< global SCIP settings */
142 )
143{
144 assert(reader != NULL);
145 assert(set != NULL);
146
147 if( *reader == NULL )
148 return SCIP_OKAY;
149
150 /* call destructor of reader */
151 if( (*reader)->readerfree != NULL )
152 {
153 SCIP_CALL( (*reader)->readerfree(set->scip, *reader) );
154 }
155
156 BMSfreeMemoryArrayNull(&(*reader)->name);
157 BMSfreeMemoryArrayNull(&(*reader)->desc);
158 BMSfreeMemoryArrayNull(&(*reader)->extension);
159
160 /* free clock */
161 SCIPclockFree(&(*reader)->readingtime);
162
163 BMSfreeMemory(reader);
164
165 return SCIP_OKAY;
166}
167
168/** returns TRUE, if reader is responsible for files with the given extension */
169static
171 SCIP_READER* reader, /**< reader */
172 const char* extension /**< extension of the input file name */
173 )
174{
175 assert(reader != NULL);
176 assert(reader->extension != NULL);
177
178 return (extension != NULL && SCIPstrcasecmp(reader->extension, extension) == 0)
179 || (extension == NULL && *(reader->extension) == '\0');
180}
181
182/** reads problem data from file with given reader or returns SCIP_DIDNOTRUN */
184 SCIP_READER* reader, /**< reader */
185 SCIP_SET* set, /**< global SCIP settings */
186 const char* filename, /**< name of the input file */
187 const char* extension, /**< extension of the input file name */
188 SCIP_RESULT* result /**< pointer to store the result of the callback method */
189 )
190{
191 SCIP_RETCODE retcode;
192
193 assert(reader != NULL);
194 assert(set != NULL);
195 assert(filename != NULL);
196 assert(result != NULL);
197
198 /* check, if reader is applicable on the given file */
199 if( readerIsApplicable(reader, extension) && reader->readerread != NULL )
200 {
201 SCIP_CLOCK* readingtime;
202
203 /**@note we need temporary clock to measure the reading time correctly since in case of creating a new problem
204 * within the reader all clocks are reset (including the reader clocks); this resetting is necessary for
205 * example for those case we people solve several problems using the (same) interactive shell
206 */
207
209
210 /* create a temporary clock for measuring the reading time */
212
213 /* start timing */
214 SCIPclockStart(readingtime, set);
215
216 /* call reader to read problem */
217 retcode = reader->readerread(set->scip, reader, filename, result);
218
219 /* stop timing */
220 SCIPclockStop(readingtime, set);
221
222 /* add time to reader reading clock */
224
225 /* free the temporary clock */
226 SCIPclockFree(&readingtime);
227 }
228 else
229 {
231 retcode = SCIP_OKAY;
232 }
233
234 /* check for reader errors */
235 if( retcode == SCIP_NOFILE || retcode == SCIP_READERROR )
236 return retcode;
237
238 /* check if the result code is valid in case no reader error occurred */
240
241 SCIP_CALL( retcode );
242
243 return SCIP_OKAY;
244}
245
246
247/* reset the variable name to the given one */
248static
250 SCIP_VAR* var, /**< variable */
251 SCIP_SET* set, /**< global SCIP settings */
252 const char* name /**< variable name */
253 )
254{
255 const char * oldname;
256
257 assert( var != NULL );
258 assert( name != NULL );
259
260 /* get pointer to temporary generic name and free the memory */
261 oldname = SCIPvarGetName(var);
262 SCIPsetFreeBufferArray(set, &oldname);
263
264 /* reset name */
266}
267
268
269/** writes problem data to file with given reader or returns SCIP_DIDNOTRUN */
271 SCIP_READER* reader, /**< reader */
272 SCIP_PROB* prob, /**< problem data */
273 SCIP_SET* set, /**< global SCIP settings */
274 SCIP_MESSAGEHDLR* msghdlr, /**< message handler */
275 FILE* file, /**< output file (or NULL for standard output) */
276 const char* format, /**< file format */
277 SCIP_Bool genericnames, /**< using generic variable and constraint names? */
278 SCIP_RESULT* result /**< pointer to store the result of the callback method */
279 )
280{
281 SCIP_RETCODE retcode;
282
283 assert(reader != NULL);
284 assert(set != NULL);
285 assert(set->buffer != NULL);
286 assert(format != NULL);
287 assert(result != NULL);
288
289 /* check, if reader is applicable on the given file */
290 if( readerIsApplicable(reader, format) && reader->readerwrite != NULL )
291 {
292 const char* consname;
293 const char** varnames = NULL;
294 const char** fixedvarnames = NULL;
295 const char** consnames = NULL;
296 SCIP_VAR** vars;
297 SCIP_VAR** fixedvars;
298 SCIP_CONS** conss;
299 SCIP_CONS* cons;
301 char* name;
302 int nfixedvars;
303 int nconss;
304 int nvars;
305 int i;
306 int nduplicates;
307
308 vars = SCIPprobGetVars(prob);
309 nvars = SCIPprobGetNVars(prob);
310 fixedvars = SCIPprobGetFixedVars(prob);
311 nfixedvars = SCIPprobGetNFixedVars(prob);
312
313 /* check if multiple variables have the same name */
314 if ( !genericnames )
315 {
316 nduplicates = 0;
317
318 for( i = 0; i < nvars; ++i )
319 {
320 if( vars[i] != (SCIP_VAR*) SCIPprobFindVar(prob, (void*) SCIPvarGetName(vars[i])) )
321 {
322 if( nduplicates < 3 )
323 {
324 SCIPmessageFPrintWarning(msghdlr, "The same variable name <%s> has been used for at least two different variables.\n", SCIPvarGetName(vars[i]));
325 }
326 ++nduplicates;
327 }
328 }
329
330 for( i = 0; i < nfixedvars; ++i )
331 {
332 if( fixedvars[i] != (SCIP_VAR*) SCIPprobFindVar(prob, (void*) SCIPvarGetName(fixedvars[i])) )
333 {
334 if( nduplicates < 3 )
335 {
336 SCIPmessageFPrintWarning(msghdlr, "The same variable name <%s> has been used for at least two different variables.\n", SCIPvarGetName(fixedvars[i]));
337 }
338 ++nduplicates;
339 }
340 }
341
342 if( nduplicates > 0 )
343 {
344 if( nduplicates > 3 )
345 {
346 SCIPmessageFPrintWarning(msghdlr, "In total %d duplicate variable names.\n", nduplicates);
347 }
348 SCIPmessageFPrintWarning(msghdlr, "This will likely result in wrong output files. Please use unique variable names.\n");
349 }
350 }
351
352 /* case of the transformed problem, we want to write currently valid problem */
353 if( SCIPprobIsTransformed(prob) )
354 {
355 SCIP_CONSHDLR** conshdlrs;
356 int nconshdlrs;
357
358 conshdlrs = set->conshdlrs;
359 nconshdlrs = set->nconshdlrs;
360
361 /* collect number of constraints which have to be enforced; these are the constraints which currency (locally)
362 * enabled; these also includes the local constraints
363 */
364 nconss = 0;
365 for( i = 0; i < nconshdlrs; ++i )
366 {
367 /* check if all constraints of the constraint handler should be written */
368 if( set->write_allconss )
369 nconss += SCIPconshdlrGetNConss(conshdlrs[i]);
370 else
371 nconss += SCIPconshdlrGetNEnfoConss(conshdlrs[i]);
372 }
373
374 SCIPsetDebugMsg(set, "Writing %d constraints.\n", nconss);
375
376 SCIP_CALL( SCIPsetAllocBufferArray(set, &conss, nconss) );
377
378 /* copy the constraints */
379 nconss = 0;
380 for( i = 0; i < nconshdlrs; ++i )
381 {
382 SCIP_CONS** conshdlrconss;
383 int nconshdlrconss;
384 int c;
385
386 /* check if all constraints of the constraint handler should be written */
387 if( set->write_allconss )
388 {
389 conshdlrconss = SCIPconshdlrGetConss(conshdlrs[i]);
390 nconshdlrconss = SCIPconshdlrGetNConss(conshdlrs[i]);
391 }
392 else
393 {
394 conshdlrconss = SCIPconshdlrGetEnfoConss(conshdlrs[i]);
395 nconshdlrconss = SCIPconshdlrGetNEnfoConss(conshdlrs[i]);
396 }
397
398 SCIPsetDebugMsg(set, "Conshdlr <%s> has %d constraints to write from all in all %d constraints.\n", SCIPconshdlrGetName(conshdlrs[i]), nconshdlrconss, SCIPconshdlrGetNConss(conshdlrs[i]));
399
400 for( c = 0; c < nconshdlrconss; ++c )
401 {
402 conss[nconss] = conshdlrconss[c];
403 nconss++;
404 }
405 }
406 }
407 else
408 {
409 conss = SCIPprobGetConss(prob);
410 nconss = SCIPprobGetNConss(prob);
411 }
412
413 /* check if multiple constraints have the same name */
414 if ( !genericnames )
415 {
416 nduplicates = 0;
417
418 for( i = 0; i < nconss; ++i )
419 {
420 if( conss[i] != (SCIP_CONS*) SCIPprobFindCons(prob, (void*) SCIPconsGetName(conss[i])) )
421 {
422 if( nduplicates < 3 )
423 {
424 SCIPmessageFPrintWarning(msghdlr, "The same constraint name <%s> has been used for at least two different constraints.\n", SCIPconsGetName(conss[i]));
425 }
426 ++nduplicates;
427 }
428 }
429
430 if( nduplicates > 0)
431 {
432 if( nduplicates > 3 )
433 {
434 SCIPmessageFPrintWarning(msghdlr, "In total %d duplicate constraint names.\n", nduplicates);
435 }
436 SCIPmessageFPrintWarning(msghdlr, "This can result in wrong output files, especially with indicator constraints.\n");
437 }
438 }
439
440 if( genericnames )
441 {
442 SCIP_VAR* var;
443 int size;
444
445 /* save variable and constraint names and replace these names by generic names */
446
447 /* allocate memory for saving the original variable and constraint names */
449 SCIP_CALL( SCIPsetAllocBufferArray(set, &fixedvarnames, nfixedvars) );
450 SCIP_CALL( SCIPsetAllocBufferArray(set, &consnames, nconss) );
451
452 /* compute length of the generic variable names:
453 * - nvars + 1 to avoid log of zero
454 * - +3 (zero at end + 'x' + 1 because we round down)
455 * Example: 10 -> needs 4 chars ("x10\0")
456 */
457 size = (int) log10(nvars+1.0) + 3;
458
459 for( i = 0; i < nvars; ++i )
460 {
461 var = vars[i];
462 varnames[i] = SCIPvarGetName(var);
463
464 SCIP_CALL( SCIPsetAllocBufferArray(set, &name, size) );
465 (void) SCIPsnprintf(name, size, "x%d", i + set->write_genoffset);
467 }
468
469 /* compute length of the generic variable names */
470 size = (int) log10(nfixedvars+1.0) + 3;
471
472 for( i = 0; i < nfixedvars; ++i )
473 {
474 var = fixedvars[i];
475 fixedvarnames[i] = SCIPvarGetName(var);
476
477 SCIP_CALL( SCIPsetAllocBufferArray(set, &name, size) );
478 (void) SCIPsnprintf(name, size, "y%d", i);
480 }
481
482 /* compute length of the generic constraint names */
483 size = (int) log10(nconss+1.0) + 3;
484
485 for( i = 0; i < nconss; ++i )
486 {
487 cons = conss[i];
488 consnames[i] = SCIPconsGetName(cons);
489
490 SCIP_CALL( SCIPsetAllocBufferArray(set, &name, size) );
491 (void) SCIPsnprintf(name, size, "c%d", i);
492 SCIPconsSetNamePointer(cons, name);
493 }
494 }
495
496 /* adapt objective scale for transformed problem (for the original no change is necessary) */
499 objscale *= -1.0;
500
501 /* call reader to write problem */
502 retcode = reader->readerwrite(set->scip, reader, file, SCIPprobGetName(prob), SCIPprobGetData(prob), SCIPprobIsTransformed(prob),
505 fixedvars, nfixedvars, SCIPprobGetStartNVars(prob),
506 conss, nconss, SCIPprobGetMaxNConss(prob), SCIPprobGetStartNConss(prob), genericnames, result);
507
508 /* reset variable and constraint names to original names */
509 if( genericnames )
510 {
511 assert(varnames != NULL);
512 assert(fixedvarnames != NULL);
513 assert(consnames != NULL);
514 for( i = nconss - 1; i >= 0; --i )
515 {
516 cons = conss[i];
517
518 /* get pointer to temporary generic name and free the memory */
519 consname = SCIPconsGetName(cons);
520 SCIPsetFreeBufferArray(set, &consname);
521
522 /* reset name */
523 SCIPconsSetNamePointer(cons, consnames[i]);
524 }
525
526 for( i = nfixedvars - 1; i >= 0; --i )
527 resetVarname(fixedvars[i], set, fixedvarnames[i]);
528
529 for( i = nvars - 1; i >= 0; --i )
530 resetVarname(vars[i], set, varnames[i]);
531
532 /* free memory */
533 SCIPsetFreeBufferArray(set, &consnames);
534 SCIPsetFreeBufferArray(set, &fixedvarnames);
535 SCIPsetFreeBufferArray(set, &varnames);
536 }
537
538 if( SCIPprobIsTransformed(prob) )
539 {
540 /* free memory */
542 }
543 }
544 else
545 {
547 retcode = SCIP_OKAY;
548 }
549
550 /* check for reader errors */
551 if( retcode == SCIP_WRITEERROR )
552 return retcode;
553
554 SCIP_CALL( retcode );
555
556 return SCIP_OKAY;
557}
558
559/** gets user data of reader */
561 SCIP_READER* reader /**< reader */
562 )
563{
564 assert(reader != NULL);
565
566 return reader->readerdata;
567}
568
569/** sets user data of reader; user has to free old data in advance! */
571 SCIP_READER* reader, /**< reader */
572 SCIP_READERDATA* readerdata /**< new reader user data */
573 )
574{
575 assert(reader != NULL);
576
577 reader->readerdata = readerdata;
578}
579
580/** sets copy method of reader */
582 SCIP_READER* reader, /**< reader */
583 SCIP_DECL_READERCOPY ((*readercopy)) /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */
584 )
585{
586 assert(reader != NULL);
587
588 reader->readercopy = readercopy;
589}
590
591/** sets destructor of reader */
593 SCIP_READER* reader, /**< reader */
594 SCIP_DECL_READERFREE ((*readerfree)) /**< destructor of reader */
595 )
596{
597 assert(reader != NULL);
598
599 reader->readerfree = readerfree;
600}
601
602/** sets read method of reader */
604 SCIP_READER* reader, /**< reader */
605 SCIP_DECL_READERREAD ((*readerread)) /**< read method */
606 )
607{
608 assert(reader != NULL);
609
610 reader->readerread = readerread;
611}
612
613/** sets write method of reader */
615 SCIP_READER* reader, /**< reader */
616 SCIP_DECL_READERWRITE ((*readerwrite)) /**< write method */
617 )
618{
619 assert(reader != NULL);
620
621 reader->readerwrite = readerwrite;
622}
623
624/** gets name of reader */
626 SCIP_READER* reader /**< reader */
627 )
628{
629 assert(reader != NULL);
630
631 return reader->name;
632}
633
634/** gets description of reader */
636 SCIP_READER* reader /**< reader */
637 )
638{
639 assert(reader != NULL);
640
641 return reader->desc;
642}
643
644/** gets file extension of reader */
646 SCIP_READER* reader /**< reader */
647 )
648{
649 assert(reader != NULL);
650
651 return reader->extension;
652}
653
654/** return whether the reader can read files */
656 SCIP_READER* reader /**< reader */
657 )
658{
659 assert(reader != NULL);
660
661 return (reader->readerread != NULL);
662}
663
664/** return whether the reader can write files */
666 SCIP_READER* reader /**< reader */
667 )
668{
669 assert(reader != NULL);
670
671 return (reader->readerwrite != NULL);
672}
673
674/** gets time in seconds used in this reader for reading */
676 SCIP_READER* reader /**< reader */
677 )
678{
679 assert(reader != NULL);
680
681 return SCIPclockGetTime(reader->readingtime);
682}
683
684/** enables or disables all clocks of \p reader, depending on the value of the flag */
686 SCIP_READER* reader, /**< the reader for which all clocks should be enabled or disabled */
687 SCIP_Bool enable /**< should the clocks be enabled? */
688 )
689{
690 assert(reader != NULL);
691
692 SCIPclockEnableOrDisable(reader->readingtime, enable);
693}
694
695/** resets reading time of reader */
697 SCIP_READER* reader /**< reader */
698 )
699{
700 assert(reader != NULL);
701
702 /* reset reading time/clock */
704
705 return SCIP_OKAY;
706}
707
void SCIPclockSetTime(SCIP_CLOCK *clck, SCIP_Real sec)
Definition clock.c:539
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
Definition clock.c:360
SCIP_Bool SCIPclockIsRunning(SCIP_CLOCK *clck)
Definition clock.c:427
void SCIPclockEnableOrDisable(SCIP_CLOCK *clck, SCIP_Bool enable)
Definition clock.c:260
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
Definition clock.c:290
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition clock.c:438
void SCIPclockReset(SCIP_CLOCK *clck)
Definition clock.c:209
void SCIPclockFree(SCIP_CLOCK **clck)
Definition clock.c:185
SCIP_RETCODE SCIPclockCreate(SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
Definition clock.c:170
internal methods for clocks and timing issues
void SCIPconsSetNamePointer(SCIP_CONS *cons, const char *name)
Definition cons.c:6853
internal methods for constraints and constraint handlers
common defines and data types used in all packages of SCIP
#define NULL
Definition def.h:262
#define SCIP_Bool
Definition def.h:91
#define SCIP_ALLOC(x)
Definition def.h:380
#define SCIP_Real
Definition def.h:172
#define SCIP_CALL(x)
Definition def.h:369
#define SCIP_CALL_FINALLY(x, y)
Definition def.h:411
SCIP_CONS ** SCIPconshdlrGetEnfoConss(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4622
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4655
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4216
int SCIPconshdlrGetNEnfoConss(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4665
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4612
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition cons.c:8233
SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
Definition reader.c:560
const char * SCIPreaderGetExtension(SCIP_READER *reader)
Definition reader.c:645
void SCIPreaderSetData(SCIP_READER *reader, SCIP_READERDATA *readerdata)
Definition reader.c:570
const char * SCIPreaderGetName(SCIP_READER *reader)
Definition reader.c:625
SCIP_Bool SCIPreaderCanRead(SCIP_READER *reader)
Definition reader.c:655
SCIP_Bool SCIPreaderCanWrite(SCIP_READER *reader)
Definition reader.c:665
const char * SCIPreaderGetDesc(SCIP_READER *reader)
Definition reader.c:635
const char * SCIPvarGetName(SCIP_VAR *var)
Definition var.c:17437
int SCIPstrcasecmp(const char *s1, const char *s2)
Definition misc.c:10914
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition misc.c:10878
return SCIP_OKAY
int c
assert(minobj< SCIPgetCutoffbound(scip))
int nvars
SCIP_VAR * var
SCIP_Real objscale
static SCIP_VAR ** vars
memory allocation routines
#define BMSfreeMemory(ptr)
Definition memory.h:145
#define BMSduplicateMemoryArray(ptr, source, num)
Definition memory.h:143
#define BMSclearMemory(ptr)
Definition memory.h:129
#define BMSfreeMemoryArrayNull(ptr)
Definition memory.h:148
#define BMSallocMemory(ptr)
Definition memory.h:118
void SCIPmessageFPrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition message.c:451
int SCIPprobGetNContVars(SCIP_PROB *prob)
Definition prob.c:2437
SCIP_CONS ** SCIPprobGetConss(SCIP_PROB *prob)
Definition prob.c:2491
int SCIPprobGetNFixedVars(SCIP_PROB *prob)
Definition prob.c:2455
const char * SCIPprobGetName(SCIP_PROB *prob)
Definition prob.c:2392
SCIP_Real SCIPprobGetObjoffset(SCIP_PROB *prob)
Definition prob.c:2527
int SCIPprobGetNConss(SCIP_PROB *prob)
Definition prob.c:2482
int SCIPprobGetStartNConss(SCIP_PROB *prob)
Definition prob.c:2509
SCIP_OBJSENSE SCIPprobGetObjsense(SCIP_PROB *prob)
Definition prob.c:2518
int SCIPprobGetStartNVars(SCIP_PROB *prob)
Definition prob.c:2473
SCIP_Real SCIPprobGetObjscale(SCIP_PROB *prob)
Definition prob.c:2536
SCIP_VAR * SCIPprobFindVar(SCIP_PROB *prob, const char *name)
Definition prob.c:2201
int SCIPprobGetNImplVars(SCIP_PROB *prob)
Definition prob.c:2428
SCIP_VAR ** SCIPprobGetFixedVars(SCIP_PROB *prob)
Definition prob.c:2464
SCIP_CONS * SCIPprobFindCons(SCIP_PROB *prob, const char *name)
Definition prob.c:2220
int SCIPprobGetNIntVars(SCIP_PROB *prob)
Definition prob.c:2419
int SCIPprobGetNVars(SCIP_PROB *prob)
Definition prob.c:2401
SCIP_PROBDATA * SCIPprobGetData(SCIP_PROB *prob)
Definition prob.c:2382
int SCIPprobGetMaxNConss(SCIP_PROB *prob)
Definition prob.c:2500
int SCIPprobGetNBinVars(SCIP_PROB *prob)
Definition prob.c:2410
SCIP_VAR ** SCIPprobGetVars(SCIP_PROB *prob)
Definition prob.c:2446
SCIP_Bool SCIPprobIsTransformed(SCIP_PROB *prob)
Definition prob.c:2336
internal methods for storing and manipulating the main problem
public methods for managing constraints
public methods for message output
public data structures and miscellaneous methods
public methods for problem variables
SCIP_RETCODE SCIPreaderFree(SCIP_READER **reader, SCIP_SET *set)
Definition reader.c:139
static SCIP_Bool readerIsApplicable(SCIP_READER *reader, const char *extension)
Definition reader.c:170
SCIP_Real SCIPreaderGetReadingTime(SCIP_READER *reader)
Definition reader.c:675
SCIP_RETCODE SCIPreaderCopyInclude(SCIP_READER *reader, SCIP_SET *set)
Definition reader.c:58
SCIP_RETCODE SCIPreaderRead(SCIP_READER *reader, SCIP_SET *set, const char *filename, const char *extension, SCIP_RESULT *result)
Definition reader.c:183
void SCIPreaderSetCopy(SCIP_READER *reader,)
Definition reader.c:581
void SCIPreaderSetRead(SCIP_READER *reader,)
Definition reader.c:603
SCIP_RETCODE SCIPreaderCreate(SCIP_READER **reader, SCIP_SET *set, const char *name, const char *desc, const char *extension, SCIP_DECL_READERCOPY((*readercopy)), SCIP_DECL_READERFREE((*readerfree)), SCIP_DECL_READERREAD((*readerread)), SCIP_DECL_READERWRITE((*readerwrite)), SCIP_READERDATA *readerdata)
Definition reader.c:113
static SCIP_RETCODE doReaderCreate(SCIP_READER **reader, const char *name, const char *desc, const char *extension, SCIP_DECL_READERCOPY((*readercopy)), SCIP_DECL_READERFREE((*readerfree)), SCIP_DECL_READERREAD((*readerread)), SCIP_DECL_READERWRITE((*readerwrite)), SCIP_READERDATA *readerdata)
Definition reader.c:77
SCIP_RETCODE SCIPreaderResetReadingTime(SCIP_READER *reader)
Definition reader.c:696
void SCIPreaderEnableOrDisableClocks(SCIP_READER *reader, SCIP_Bool enable)
Definition reader.c:685
void SCIPreaderSetFree(SCIP_READER *reader,)
Definition reader.c:592
static void resetVarname(SCIP_VAR *var, SCIP_SET *set, const char *name)
Definition reader.c:249
void SCIPreaderSetWrite(SCIP_READER *reader,)
Definition reader.c:614
SCIP_RETCODE SCIPreaderWrite(SCIP_READER *reader, SCIP_PROB *prob, SCIP_SET *set, SCIP_MESSAGEHDLR *msghdlr, FILE *file, const char *format, SCIP_Bool genericnames, SCIP_RESULT *result)
Definition reader.c:270
internal methods for input file readers
internal methods for global SCIP settings
#define SCIPsetFreeBufferArray(set, ptr)
Definition set.h:1755
#define SCIPsetAllocBufferArray(set, ptr, num)
Definition set.h:1748
#define SCIPsetDebugMsg
Definition set.h:1784
const char * desc
const char * extension
SCIP_READERDATA * readerdata
const char * name
SCIP_CLOCK * readingtime
datastructures for input file readers
struct SCIP_Clock SCIP_CLOCK
Definition type_clock.h:49
@ SCIP_CLOCKTYPE_DEFAULT
Definition type_clock.h:43
struct SCIP_Cons SCIP_CONS
Definition type_cons.h:63
struct SCIP_Conshdlr SCIP_CONSHDLR
Definition type_cons.h:62
struct SCIP_Messagehdlr SCIP_MESSAGEHDLR
struct SCIP_Prob SCIP_PROB
Definition type_prob.h:52
@ SCIP_OBJSENSE_MAXIMIZE
Definition type_prob.h:47
#define SCIP_DECL_READERWRITE(x)
struct SCIP_ReaderData SCIP_READERDATA
Definition type_reader.h:53
struct SCIP_Reader SCIP_READER
Definition type_reader.h:52
#define SCIP_DECL_READERREAD(x)
Definition type_reader.h:87
#define SCIP_DECL_READERCOPY(x)
Definition type_reader.h:62
#define SCIP_DECL_READERFREE(x)
Definition type_reader.h:71
@ SCIP_DIDNOTRUN
Definition type_result.h:42
@ SCIP_SUCCESS
Definition type_result.h:58
enum SCIP_Result SCIP_RESULT
Definition type_result.h:61
@ SCIP_NOFILE
@ SCIP_READERROR
@ SCIP_WRITEERROR
enum SCIP_Retcode SCIP_RETCODE
struct SCIP_Set SCIP_SET
Definition type_set.h:71
struct SCIP_Var SCIP_VAR
Definition type_var.h:119
void SCIPvarSetNamePointer(SCIP_VAR *var, const char *name)
Definition var.c:6038
internal methods for problem variables