Scippy

SCIP

Solving Constraint Integer Programs

reader_lop.c File Reference

Detailed Description

linear ordering file reader

Author
Marc Pfetsch

This file implements the reader/parser used to read linear ordering problems. For more details see How to add file readers. The data should be given in LOLIB format, see LOLIB.

Definition in file reader_lop.c.

#include <assert.h>
#include <string.h>
#include <ctype.h>
#include "cons_lop.h"
#include "reader_lop.h"
#include <scip/pub_fileio.h>

Go to the source code of this file.

Macros

#define READER_NAME   "lopreader"
 
#define READER_DESC   "file reader for linear ordering problems"
 
#define READER_EXTENSION   "lop"
 
#define READER_STRLEN   65536
 

Functions

static SCIP_RETCODE getNextNumber (SCIP_FILE *file, char *buffer, char **s, SCIP_Real *value)
 
static SCIP_RETCODE LOPreadFile (SCIP *scip, const char *filename, int *n, SCIP_Real ***W)
 
static SCIP_RETCODE getProblemName (const char *filename, char *probname, int maxSize)
 
Callback methods
static SCIP_DECL_READERREAD (LOPreaderRead)
 
Interface methods
SCIP_RETCODE SCIPincludeReaderLOP (SCIP *scip)
 

Macro Definition Documentation

◆ READER_NAME

#define READER_NAME   "lopreader"

Definition at line 43 of file reader_lop.c.

Referenced by SCIPincludeReaderLOP().

◆ READER_DESC

#define READER_DESC   "file reader for linear ordering problems"

Definition at line 44 of file reader_lop.c.

Referenced by SCIPincludeReaderLOP().

◆ READER_EXTENSION

#define READER_EXTENSION   "lop"

Definition at line 45 of file reader_lop.c.

Referenced by SCIPincludeReaderLOP().

◆ READER_STRLEN

#define READER_STRLEN   65536

Definition at line 47 of file reader_lop.c.

Referenced by getNextNumber(), and LOPreadFile().

Function Documentation

◆ getNextNumber()

static SCIP_RETCODE getNextNumber ( SCIP_FILE file,
char *  buffer,
char **  s,
SCIP_Real value 
)
static

Get next number from file

Parameters
filefile to read from
bufferbuffer to store lines in
spointer to string pointer
valuepointer to store the read value

Definition at line 53 of file reader_lop.c.

References NULL, READER_STRLEN, SCIP_INVALID, SCIP_OKAY, SCIP_READERROR, SCIPerrorMessage, and SCIPfgets().

Referenced by LOPreadFile().

◆ LOPreadFile()

static SCIP_RETCODE LOPreadFile ( SCIP scip,
const char *  filename,
int *  n,
SCIP_Real ***  W 
)
static

read weight matrix from file (in LOLIB format)

Format: comment line n = # of elements weight matrix (n times n double matrix)

Parameters
scipSCIP data structure
filenamename of file to read
npointer to store the number of elements on exit
Wpointer to store the weight matrix on exit

Definition at line 115 of file reader_lop.c.

References getNextNumber(), NULL, READER_STRLEN, SCIP_CALL, SCIP_INVALID, SCIP_NOFILE, SCIP_OKAY, SCIP_READERROR, SCIP_Real, SCIPallocBlockMemoryArray, SCIPerrorMessage, SCIPfclose(), SCIPfeof(), SCIPfgets(), SCIPfopen(), and SCIPprintSysError().

Referenced by SCIP_DECL_READERREAD().

◆ getProblemName()

static SCIP_RETCODE getProblemName ( const char *  filename,
char *  probname,
int  maxSize 
)
static

get problem name

Returns NULL on error

Parameters
filenameinput filename
probnameoutput problemname
maxSizemaximum size of probname

Definition at line 202 of file reader_lop.c.

References SCIP_ERROR, and SCIP_OKAY.

Referenced by SCIP_DECL_READERREAD().

◆ SCIP_DECL_READERREAD()

◆ SCIPincludeReaderLOP()

SCIP_RETCODE SCIPincludeReaderLOP ( SCIP scip)

includes the linear ordering file reader in SCIP

Parameters
scipSCIP data structure

Definition at line 348 of file reader_lop.c.

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

Referenced by main().