Scippy

SCIP

Solving Constraint Integer Programs

reader_cnf.c File Reference

Detailed Description

CNF file reader.

Author
Thorsten Koch
Tobias Achterberg

The DIMACS CNF (conjunctive normal form) is a file format used for example for SAT problems. For a detailed description of this format see http://people.sc.fsu.edu/~jburkardt/data/cnf/cnf.html .

Definition in file reader_cnf.c.

#include <assert.h>
#include <string.h>
#include "scip/reader_cnf.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/pub_misc.h"

Go to the source code of this file.

Macros

#define READER_NAME   "cnfreader"
 
#define READER_DESC   "file reader for SAT problems in conjunctive normal form"
 
#define READER_EXTENSION   "cnf"
 
#define MAXLINELEN   65536
 

Functions

static void readError (SCIP *scip, int linecount, const char *errormsg)
 
static void readWarning (SCIP *scip, int linecount, const char *warningmsg)
 
static SCIP_RETCODE readCnfLine (SCIP *scip, SCIP_FILE *file, char *buffer, int size, int *linecount)
 
static SCIP_RETCODE readCnf (SCIP *scip, SCIP_FILE *file)
 
static SCIP_DECL_READERCOPY (readerCopyCnf)
 
static SCIP_DECL_READERREAD (readerReadCnf)
 
SCIP_RETCODE SCIPincludeReaderCnf (SCIP *scip)
 

Macro Definition Documentation

#define READER_NAME   "cnfreader"

Definition at line 37 of file reader_cnf.c.

Referenced by SCIP_DECL_READERCOPY(), SCIP_DECL_READERREAD(), and SCIPincludeReaderCnf().

#define READER_DESC   "file reader for SAT problems in conjunctive normal form"

Definition at line 38 of file reader_cnf.c.

Referenced by SCIPincludeReaderCnf().

#define READER_EXTENSION   "cnf"

Definition at line 39 of file reader_cnf.c.

Referenced by SCIPincludeReaderCnf().

#define MAXLINELEN   65536

Definition at line 41 of file reader_cnf.c.

Referenced by readCnf().

Function Documentation

static void readError ( SCIP scip,
int  linecount,
const char *  errormsg 
)
static
Parameters
scipSCIP data structure
linecountline number of error
errormsgerror message

Definition at line 49 of file reader_cnf.c.

References SCIPerrorMessage.

Referenced by readCnf(), and readCnfLine().

static void readWarning ( SCIP scip,
int  linecount,
const char *  warningmsg 
)
static
Parameters
scipSCIP data structure
linecountline number of error
warningmsgwarning message

Definition at line 59 of file reader_cnf.c.

References SCIPwarningMessage().

Referenced by readCnf().

static SCIP_RETCODE readCnfLine ( SCIP scip,
SCIP_FILE file,
char *  buffer,
int  size,
int *  linecount 
)
static

reads the next non-empty non-comment line of a cnf file

Parameters
scipSCIP data structure
fileinput file
bufferbuffer for storing the input line
sizesize of the buffer
linecountpointer to the line number counter

Definition at line 70 of file reader_cnf.c.

References NULL, readError(), SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_READERROR, SCIPfgets(), and SCIPsnprintf().

Referenced by readCnf().

static SCIP_DECL_READERCOPY ( readerCopyCnf  )
static

copy method for reader plugins (called when SCIP copies plugins)

Definition at line 361 of file reader_cnf.c.

References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderCnf(), and SCIPreaderGetName().

static SCIP_DECL_READERREAD ( readerReadCnf  )
static
SCIP_RETCODE SCIPincludeReaderCnf ( SCIP scip)

includes the cnf file reader in SCIP

Parameters
scipSCIP data structure

Definition at line 415 of file reader_cnf.c.

References FALSE, NULL, READER_DESC, READER_EXTENSION, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPaddBoolParam(), SCIPincludeReaderBasic(), SCIPsetReaderCopy(), and SCIPsetReaderRead().

Referenced by SCIP_DECL_READERCOPY(), and SCIPincludeDefaultPlugins().