SCIP-SDP  4.0.0
Macros | Typedefs | Functions
reader_cbf.c File Reference

file reader for mixed-integer semidefinite programs in CBF format More...

Go to the source code of this file.

Macros

#define READER_NAME   "cbfreader"
 
#define READER_DESC   "file reader and writer for MISDPs in cbf format"
 
#define READER_EXTENSION   "cbf"
 
#define CBF_VERSION_NR   3
 
#define CBF_CHECK_NONNEG   TRUE
 
#define CBF_MAX_LINE   512 /* Last 3 chars reserved for '\r\n\0' */
 
#define CBF_MAX_NAME   512
 
#define MACRO_STR_EXPAND(tok)   #tok
 
#define MACRO_STR(tok)   MACRO_STR_EXPAND(tok)
 
#define CBF_NAME_FORMAT   "%" MACRO_STR(CBF_MAX_NAME) "s"
 

Typedefs

typedef struct CBF_Data CBF_DATA
 

Functions

static SCIP_RETCODE CBFfreeData (SCIP *scip, SCIP_FILE *file, CBF_DATA *data)
 
static SCIP_RETCODE CBFfgets (SCIP *scip, CBF_DATA *data, SCIP_FILE *pFile, SCIP_Longint *linecount, SCIP_Bool printerror)
 
static SCIP_RETCODE CBFreadObjsense (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadVar (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadPsdVar (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadPsdVarRank1 (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadCon (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadInt (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadPsdCon (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadPsdConRank1 (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadObjFcoord (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadObjAcoord (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadFcoord (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadAcoord (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadBcoord (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadHcoord (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_RETCODE CBFreadDcoord (SCIP *scip, CBF_DATA *data, SCIP_FILE *pfile, SCIP_Longint *linecount)
 
static SCIP_DECL_READERCOPY (readerCopyCbf)
 
static SCIP_DECL_READERREAD (readerReadCbf)
 
static SCIP_DECL_READERWRITE (readerWriteCbf)
 
SCIP_RETCODE SCIPincludeReaderCbf (SCIP *scip)
 

Detailed Description

file reader for mixed-integer semidefinite programs in CBF format

Author
Tristan Gally
Henrik A. Friberg
Marc Pfetsch
Frederic Matter

The CBF format is http://cblib.zib.de/.

As an extension of the original CBF format it is possible to specify the constraint that a psd variable and/or a SDP-constraint has rank 1. This is done by using the two new keywords PSDCONRANK1 and PSDVARRANK1 with the following structure:

PSDCONRANK1 r m_1 ... m_r, where \(r\) is the number of SDP-constraints with a rank-1 constraint, and \(m_1, \dots, m_r\) are the indices of the SDP-constraints with a rank-1 constraints.

PSDVARRANK1 r v_1 ... v_r, where \(r\) is the number of psd variables with a rank-1 constraint, and \(v_1, \dots, v_r\) are the indices of the psd variables with a rank-1 constraints.

Definition in file reader_cbf.c.

Macro Definition Documentation

#define READER_NAME   "cbfreader"

Definition at line 80 of file reader_cbf.c.

Referenced by SCIPincludeReaderCbf().

#define READER_DESC   "file reader and writer for MISDPs in cbf format"

Definition at line 81 of file reader_cbf.c.

Referenced by SCIPincludeReaderCbf().

#define READER_EXTENSION   "cbf"

Definition at line 82 of file reader_cbf.c.

Referenced by SCIPincludeReaderCbf().

#define CBF_VERSION_NR   3

version number for CBF format

Definition at line 84 of file reader_cbf.c.

#define CBF_CHECK_NONNEG   TRUE

when writing: check linear constraints and move nonnegativity(-positivity) constraints to definition of variables (which are now defined in non-negative orthant)

Definition at line 85 of file reader_cbf.c.

#define CBF_MAX_LINE   512 /* Last 3 chars reserved for '\r\n\0' */

Definition at line 94 of file reader_cbf.c.

Referenced by CBFfgets(), and CBFfreeData().

#define CBF_MAX_NAME   512

Definition at line 95 of file reader_cbf.c.

Referenced by CBFfreeData().

#define MACRO_STR_EXPAND (   tok)    #tok

Definition at line 98 of file reader_cbf.c.

#define MACRO_STR (   tok)    MACRO_STR_EXPAND(tok)

Definition at line 99 of file reader_cbf.c.

#define CBF_NAME_FORMAT   "%" MACRO_STR(CBF_MAX_NAME) "s"

Definition at line 100 of file reader_cbf.c.

Referenced by CBFreadCon(), CBFreadObjsense(), and CBFreadVar().

Typedef Documentation

typedef struct CBF_Data CBF_DATA

Definition at line 140 of file reader_cbf.c.

Function Documentation

static SCIP_RETCODE CBFfreeData ( SCIP *  scip,
SCIP_FILE *  file,
CBF_DATA data 
)
static

frees all data allocated for the CBF-data-struct

Parameters
scipSCIP data structure
filefile
datadata pointer

Definition at line 148 of file reader_cbf.c.

References CBF_MAX_LINE, CBF_MAX_NAME, and CBFfgets().

Referenced by CBFfgets(), CBFreadAcoord(), CBFreadBcoord(), CBFreadCon(), CBFreadDcoord(), CBFreadFcoord(), CBFreadHcoord(), CBFreadInt(), CBFreadObjAcoord(), CBFreadObjFcoord(), CBFreadObjsense(), CBFreadPsdCon(), CBFreadPsdConRank1(), CBFreadPsdVar(), CBFreadPsdVarRank1(), and CBFreadVar().

static SCIP_RETCODE CBFfgets ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pFile,
SCIP_Longint *  linecount,
SCIP_Bool  printerror 
)
static

finds first non-commentary line in given file

Parameters
scipSCIP data structure
dataCBF data
pFilefile to read from
linecountcurrent linecount
printerrorShould an error be printed and the CBF data be freed?

Definition at line 321 of file reader_cbf.c.

References CBF_MAX_LINE, CBFfreeData(), and CBFreadObjsense().

Referenced by CBFfreeData(), CBFreadAcoord(), CBFreadBcoord(), CBFreadCon(), CBFreadDcoord(), CBFreadFcoord(), CBFreadHcoord(), CBFreadInt(), CBFreadObjAcoord(), CBFreadObjFcoord(), CBFreadObjsense(), CBFreadPsdCon(), CBFreadPsdConRank1(), CBFreadPsdVar(), CBFreadPsdVarRank1(), and CBFreadVar().

static SCIP_RETCODE CBFreadObjsense ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads objective sense from given CBF-file

Parameters
scipSCIP data structure
dataCBF data
pfilefile to read from
linecountcurrent linecount

Definition at line 352 of file reader_cbf.c.

References CBF_NAME_FORMAT, CBFfgets(), CBFfreeData(), and CBFreadVar().

Referenced by CBFfgets().

static SCIP_RETCODE CBFreadVar ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads the number and type of scalar variables from given CBF-file

Parameters
scipSCIP data structure
dataCBF data
pfilefile to read from
linecountcurrent linecount

Definition at line 393 of file reader_cbf.c.

References CBF_NAME_FORMAT, CBFfgets(), CBFfreeData(), and CBFreadPsdVar().

Referenced by CBFreadObjsense().

static SCIP_RETCODE CBFreadPsdVar ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads the number and type of psd variables from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 521 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadPsdVarRank1().

Referenced by CBFreadVar().

static SCIP_RETCODE CBFreadPsdVarRank1 ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads the rank-1 information of psd variables from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 645 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadCon().

Referenced by CBFreadPsdVar().

static SCIP_RETCODE CBFreadCon ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads the number and type of constraints from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 720 of file reader_cbf.c.

References CBF_NAME_FORMAT, CBFfgets(), CBFfreeData(), and CBFreadInt().

Referenced by CBFreadPsdVarRank1().

static SCIP_RETCODE CBFreadInt ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads integrality conditions from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 853 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadPsdCon().

Referenced by CBFreadCon().

static SCIP_RETCODE CBFreadPsdCon ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads SDP-constraint sizes from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 930 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadPsdConRank1().

Referenced by CBFreadInt().

static SCIP_RETCODE CBFreadPsdConRank1 ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads rank-1 information of SDP-constraints from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 1017 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadObjFcoord().

Referenced by CBFreadPsdCon().

static SCIP_RETCODE CBFreadObjFcoord ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads objective values for matrix variables from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 1097 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadObjAcoord().

Referenced by CBFreadPsdConRank1().

static SCIP_RETCODE CBFreadObjAcoord ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads objective values for scalar variables from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 1219 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadFcoord().

Referenced by CBFreadObjFcoord().

static SCIP_RETCODE CBFreadFcoord ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads matrix variable coefficients from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 1310 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadAcoord().

Referenced by CBFreadObjAcoord().

static SCIP_RETCODE CBFreadAcoord ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads linear coefficients from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 1446 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadBcoord().

Referenced by CBFreadFcoord().

static SCIP_RETCODE CBFreadBcoord ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads left- and right-hand sides from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 1553 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadHcoord().

Referenced by CBFreadAcoord().

static SCIP_RETCODE CBFreadHcoord ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads nonzero coefficients of SDP-constraints from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 1656 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and CBFreadDcoord().

Referenced by CBFreadBcoord().

static SCIP_RETCODE CBFreadDcoord ( SCIP *  scip,
CBF_DATA data,
SCIP_FILE *  pfile,
SCIP_Longint *  linecount 
)
static

reads constant entries of SDP-constraints from given CBF-file

Parameters
scipSCIP data structure
datadata pointer to save the results in
pfilefile to read from
linecountcurrent linecount

Definition at line 1956 of file reader_cbf.c.

References CBFfgets(), CBFfreeData(), and SCIP_DECL_READERCOPY().

Referenced by CBFreadHcoord().

static SCIP_DECL_READERCOPY ( readerCopyCbf  )
static

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

Definition at line 2109 of file reader_cbf.c.

Referenced by CBFreadDcoord().

static SCIP_DECL_READERREAD ( readerReadCbf  )
static

problem reading method of reader

Definition at line 2120 of file reader_cbf.c.

static SCIP_DECL_READERWRITE ( readerWriteCbf  )
static

problem writing method of reader

Definition at line 2506 of file reader_cbf.c.

SCIP_RETCODE SCIPincludeReaderCbf ( SCIP *  scip)

includes the CBF file reader in SCIP

Parameters
scipSCIP data structure

Definition at line 3088 of file reader_cbf.c.

References READER_DESC, READER_EXTENSION, and READER_NAME.

Referenced by SCIPSDPincludeDefaultPlugins().