Scippy

SCIP

Solving Constraint Integer Programs

reader_cyc.c File Reference

Detailed Description

file reader for cycle clustering instances

Author
Leon Eifler

This file implements the reader for the cycle clustering problem. The data is read from a matrix, entries separated by whitespace. The first line in the file has to be of the form "# p nstates ncluster", where nstates is the size of the matrix and ncluster is the number of clusters that should be used. The file has to have the ending ".cyc" to be recognized by the reader.

Definition in file reader_cyc.c.

#include "reader_cyc.h"
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include "probdata_cyc.h"

Go to the source code of this file.

Macros

#define READER_NAME   "cycreader"
 
#define READER_DESC   "file reader for a .cyc-file with a transition matrix for a cycle clustering problem"
 
#define READER_EXTENSION   "cyc"
 
#define COL_MAX_LINELEN   10000
 

Functions

static SCIP_Real getNextNumber (char **s)
 
static SCIP_RETCODE readCyc (SCIP *scip, const char *filename)
 
static SCIP_DECL_READERCOPY (readerCopyCyc)
 
static SCIP_DECL_READERREAD (readerReadCyc)
 
SCIP_RETCODE SCIPincludeReaderCyc (SCIP *scip)
 

Macro Definition Documentation

◆ READER_NAME

#define READER_NAME   "cycreader"

Definition at line 34 of file reader_cyc.c.

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

◆ READER_DESC

#define READER_DESC   "file reader for a .cyc-file with a transition matrix for a cycle clustering problem"

Definition at line 35 of file reader_cyc.c.

Referenced by SCIPincludeReaderCyc().

◆ READER_EXTENSION

#define READER_EXTENSION   "cyc"

Definition at line 36 of file reader_cyc.c.

Referenced by SCIPincludeReaderCyc().

◆ COL_MAX_LINELEN

#define COL_MAX_LINELEN   10000

Definition at line 38 of file reader_cyc.c.

Referenced by readCyc().

Function Documentation

◆ getNextNumber()

static SCIP_Real getNextNumber ( char **  s)
static

get next number from string s

Parameters
spointer to the pointer of the current position in the string

Definition at line 47 of file reader_cyc.c.

References SCIP_Real.

Referenced by readCyc().

◆ readCyc()

static SCIP_RETCODE readCyc ( SCIP scip,
const char *  filename 
)
static

read LP in Cyc File Format. That means first line is "p edges nbins ncluster". Then a matrix with whitespace-separated entries of size nbins x nbins

Parameters
scipSCIP data structure
filenamename of the input file

Definition at line 70 of file reader_cyc.c.

References COL_MAX_LINELEN, getNextNumber(), NULL, SCIP_CALL, SCIP_NOFILE, SCIP_OKAY, SCIP_READERROR, SCIP_Real, SCIPallocMemoryArray, SCIPcreateProbCyc(), SCIPerrorMessage, SCIPfclose(), SCIPfeof(), SCIPfgets(), SCIPfopen(), SCIPfreeMemoryArray, and SCIPinfoMessage().

Referenced by SCIP_DECL_READERREAD().

◆ SCIP_DECL_READERCOPY()

static SCIP_DECL_READERCOPY ( readerCopyCyc  )
static

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

Definition at line 179 of file reader_cyc.c.

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

◆ SCIP_DECL_READERREAD()

static SCIP_DECL_READERREAD ( readerReadCyc  )
static

problem reading method of reader

Definition at line 190 of file reader_cyc.c.

References NULL, readCyc(), READER_NAME, SCIP_CALL, SCIP_OKAY, SCIP_SUCCESS, and SCIPreaderGetName().

◆ SCIPincludeReaderCyc()

SCIP_RETCODE SCIPincludeReaderCyc ( SCIP scip)

includes the cyc file reader in SCIP

Parameters
scipSCIP data structure

Definition at line 209 of file reader_cyc.c.

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

Referenced by SCIPincludeCycPlugins().