Scippy

SCIP

Solving Constraint Integer Programs

reader.c File Reference

Detailed Description

interface for input file readers

Author
Tobias Achterberg

Definition in file reader.c.

#include <assert.h>
#include <string.h>
#include <math.h>
#include "scip/def.h"
#include "blockmemshell/memory.h"
#include "scip/set.h"
#include "scip/clock.h"
#include "scip/pub_misc.h"
#include "scip/reader.h"
#include "scip/prob.h"
#include "scip/pub_var.h"
#include "scip/var.h"
#include "scip/pub_cons.h"
#include "scip/cons.h"
#include "scip/struct_reader.h"

Go to the source code of this file.

Functions

SCIP_RETCODE SCIPreaderCopyInclude (SCIP_READER *reader, SCIP_SET *set)
 
SCIP_RETCODE SCIPreaderCreate (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)
 
SCIP_RETCODE SCIPreaderFree (SCIP_READER **reader, SCIP_SET *set)
 
static SCIP_Bool readerIsApplicable (SCIP_READER *reader, const char *extension)
 
SCIP_RETCODE SCIPreaderRead (SCIP_READER *reader, SCIP_SET *set, const char *filename, const char *extension, SCIP_RESULT *result)
 
static void resetVarname (SCIP_VAR *var, const char *name)
 
SCIP_RETCODE SCIPreaderWrite (SCIP_READER *reader, SCIP_PROB *prob, SCIP_SET *set, FILE *file, const char *extension, SCIP_Bool genericnames, SCIP_RESULT *result)
 
SCIP_READERDATASCIPreaderGetData (SCIP_READER *reader)
 
void SCIPreaderSetData (SCIP_READER *reader, SCIP_READERDATA *readerdata)
 
void SCIPreaderSetCopy (SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
 
void SCIPreaderSetFree (SCIP_READER *reader, SCIP_DECL_READERFREE((*readerfree)))
 
void SCIPreaderSetRead (SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
 
void SCIPreaderSetWrite (SCIP_READER *reader, SCIP_DECL_READERWRITE((*readerwrite)))
 
const char * SCIPreaderGetName (SCIP_READER *reader)
 
const char * SCIPreaderGetDesc (SCIP_READER *reader)
 
const char * SCIPreaderGetExtension (SCIP_READER *reader)
 
SCIP_Bool SCIPreaderCanRead (SCIP_READER *reader)
 
SCIP_Bool SCIPreaderCanWrite (SCIP_READER *reader)
 
SCIP_Real SCIPreaderGetReadingTime (SCIP_READER *reader)
 
SCIP_RETCODE SCIPreaderResetReadingTime (SCIP_READER *reader)
 

Function Documentation

SCIP_RETCODE SCIPreaderCopyInclude ( SCIP_READER reader,
SCIP_SET set 
)

copies the given reader to a new scip

Parameters
readerreader
setSCIP_SET of SCIP to copy to

Definition at line 43 of file reader.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, and SCIPreaderGetName().

Referenced by SCIPsetCopyPlugins().

SCIP_RETCODE SCIPreaderCreate ( 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 
)

creates a reader

Parameters
readerpointer to store reader
namename of reader
descdescription of reader
extensionfile extension that reader processes
readerdatareader data

Definition at line 61 of file reader.c.

References BMSallocMemory, BMSduplicateMemoryArray, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_CLOCKTYPE_DEFAULT, SCIP_OKAY, and SCIPclockCreate().

Referenced by SCIPincludeReader(), and SCIPincludeReaderBasic().

SCIP_RETCODE SCIPreaderFree ( SCIP_READER **  reader,
SCIP_SET set 
)

frees memory of reader

Parameters
readerpointer to reader data structure
setglobal SCIP settings

Definition at line 95 of file reader.c.

References BMSfreeMemory, BMSfreeMemoryArray, NULL, SCIP_CALL, SCIP_OKAY, and SCIPclockFree().

Referenced by SCIPsetFree().

static SCIP_Bool readerIsApplicable ( SCIP_READER reader,
const char *  extension 
)
static

returns TRUE, if reader is responsible for files with the given extension

Parameters
readerreader
extensionextension of the input file name

Definition at line 123 of file reader.c.

References SCIP_Reader::extension, and NULL.

Referenced by SCIPreaderRead(), and SCIPreaderWrite().

SCIP_RETCODE SCIPreaderRead ( SCIP_READER reader,
SCIP_SET set,
const char *  filename,
const char *  extension,
SCIP_RESULT result 
)

reads problem data from file with given reader or returns SCIP_DIDNOTRUN

Note
we need temporary clock to measure the reading time correctly since in case of creating a new problem within the reader all clocks are reset (including the reader clocks); this resetting is necessary for example for those case we people solve several problems using the (same) interactive shell
Parameters
readerreader
setglobal SCIP settings
filenamename of the input file
extensionextension of the input file name
resultpointer to store the result of the callback method

Definition at line 136 of file reader.c.

References NULL, readerIsApplicable(), SCIP_Reader::readingtime, SCIP_CALL, SCIP_CLOCKTYPE_DEFAULT, SCIP_DIDNOTRUN, SCIP_NOFILE, SCIP_OKAY, SCIP_READERROR, SCIP_SUCCESS, SCIPclockCreate(), SCIPclockFree(), SCIPclockGetTime(), SCIPclockIsRunning(), SCIPclockSetTime(), SCIPclockStart(), and SCIPclockStop().

Referenced by SCIPreadProb().

static void resetVarname ( SCIP_VAR var,
const char *  name 
)
static
Parameters
varvariable
namevariable name

Definition at line 202 of file reader.c.

References BMSfreeMemory, NULL, SCIPvarGetName(), and SCIPvarSetNamePointer().

Referenced by SCIPreaderWrite().

SCIP_RETCODE SCIPreaderWrite ( SCIP_READER reader,
SCIP_PROB prob,
SCIP_SET set,
FILE *  file,
const char *  extension,
SCIP_Bool  genericnames,
SCIP_RESULT result 
)
SCIP_READERDATA* SCIPreaderGetData ( SCIP_READER reader)
void SCIPreaderSetData ( SCIP_READER reader,
SCIP_READERDATA readerdata 
)

sets user data of reader; user has to free old data in advance!

Parameters
readerreader
readerdatanew reader user data

Definition at line 455 of file reader.c.

References NULL, and SCIP_Reader::readerdata.

Referenced by SCIP_DECL_READERFREE().

void SCIPreaderSetCopy ( SCIP_READER reader,
SCIP_DECL_READERCOPY((*readercopy))   
)

sets copy method of reader

Parameters
readerreader

Definition at line 466 of file reader.c.

References NULL.

Referenced by SCIPsetReaderCopy().

void SCIPreaderSetFree ( SCIP_READER reader,
SCIP_DECL_READERFREE((*readerfree))   
)

sets destructor of reader

Parameters
readerreader

Definition at line 477 of file reader.c.

References NULL.

Referenced by SCIPsetReaderFree().

void SCIPreaderSetRead ( SCIP_READER reader,
SCIP_DECL_READERREAD((*readerread))   
)

sets read method of reader

Parameters
readerreader

Definition at line 488 of file reader.c.

References NULL.

Referenced by SCIPsetReaderRead().

void SCIPreaderSetWrite ( SCIP_READER reader,
SCIP_DECL_READERWRITE((*readerwrite))   
)

sets write method of reader

Parameters
readerreader

Definition at line 499 of file reader.c.

References NULL.

Referenced by SCIPsetReaderWrite().

const char* SCIPreaderGetDesc ( SCIP_READER reader)

gets description of reader

Parameters
readerreader

Definition at line 520 of file reader.c.

References SCIP_Reader::desc, and NULL.

Referenced by displayReaders(), SCIPincludeDialogDefaultFix(), and SCIPincludeDialogDefaultSet().

const char* SCIPreaderGetExtension ( SCIP_READER reader)

gets file extension of reader

Parameters
readerreader

Definition at line 530 of file reader.c.

References SCIP_Reader::extension, and NULL.

Referenced by displayReaders().

SCIP_Bool SCIPreaderCanRead ( SCIP_READER reader)

return whether the reader can read files

Parameters
readerreader

Definition at line 540 of file reader.c.

References NULL.

Referenced by displayReaders().

SCIP_Bool SCIPreaderCanWrite ( SCIP_READER reader)

return whether the reader can write files

Parameters
readerreader

Definition at line 550 of file reader.c.

References NULL.

Referenced by displayReaders().

SCIP_Real SCIPreaderGetReadingTime ( SCIP_READER reader)

gets time in seconds used in this reader for reading

Parameters
readerreader

Definition at line 560 of file reader.c.

References NULL, SCIP_Reader::readingtime, and SCIPclockGetTime().

Referenced by SCIPgetReadingTime().

SCIP_RETCODE SCIPreaderResetReadingTime ( SCIP_READER reader)

resets reading time of reader

Parameters
readerreader

Definition at line 570 of file reader.c.

References NULL, SCIP_Reader::readingtime, SCIP_OKAY, and SCIPclockReset().

Referenced by SCIPfreeProb().