SCIP-SDP  3.2.0
Macros | Typedefs | Functions | Variables
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   2
 
#define CBF_CHECK_NONNEG   TRUE
 
#define MACRO_STR_EXPAND(tok)   #tok
 
#define MACRO_STR(tok)   MACRO_STR_EXPAND(tok)
 
#define CBF_NAME_FORMAT   "%" MACRO_STR(CBF_MAX_NAME) "s"
 
#define CBF_MAX_LINE   512 /* Last 3 chars reserved for '\r\n\0' */
 
#define CBF_MAX_NAME   512
 

Typedefs

typedef struct CBF_Data CBF_DATA
 

Functions

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

Variables

char CBF_LINE_BUFFER [CBF_MAX_LINE]
 
char CBF_NAME_BUFFER [CBF_MAX_NAME]
 

Detailed Description

file reader for mixed-integer semidefinite programs in CBF format

Author
Tristan Gally
Henrik A. Friberg
Marc Pfetsch
Frederic Matter

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 78 of file reader_cbf.c.

Referenced by SCIPincludeReaderCbf().

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

Definition at line 79 of file reader_cbf.c.

Referenced by SCIPincludeReaderCbf().

#define READER_EXTENSION   "cbf"

Definition at line 80 of file reader_cbf.c.

Referenced by SCIPincludeReaderCbf().

#define CBF_VERSION_NR   2

version number for CBF format

Definition at line 82 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 83 of file reader_cbf.c.

#define MACRO_STR_EXPAND (   tok)    #tok

Definition at line 92 of file reader_cbf.c.

#define MACRO_STR (   tok)    MACRO_STR_EXPAND(tok)

Definition at line 93 of file reader_cbf.c.

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

Definition at line 94 of file reader_cbf.c.

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

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

Definition at line 95 of file reader_cbf.c.

#define CBF_MAX_NAME   512

Definition at line 96 of file reader_cbf.c.

Typedef Documentation

typedef struct CBF_Data CBF_DATA

Definition at line 137 of file reader_cbf.c.

Function Documentation

static SCIP_RETCODE CBFfgets ( SCIP_FILE *  pFile,
SCIP_Longint *  linecount 
)
static

finds first non-commentary line in given file

Parameters
pFilefile to read from
linecountcurrent linecount

Definition at line 146 of file reader_cbf.c.

References CBF_LINE_BUFFER, and CBFreadObjsense().

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

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

reads objective sense from given CBF-file

Parameters
scipSCIP data structure
pfilefile to read from
linecountcurrent linecount

Definition at line 168 of file reader_cbf.c.

References CBF_LINE_BUFFER, CBF_NAME_BUFFER, CBF_NAME_FORMAT, CBFfgets(), and CBFreadVar().

Referenced by CBFfgets().

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

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

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

Definition at line 207 of file reader_cbf.c.

References CBF_LINE_BUFFER, CBF_NAME_BUFFER, CBF_NAME_FORMAT, CBFfgets(), and CBFreadPsdVar().

Referenced by CBFreadObjsense().

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

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

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

Definition at line 328 of file reader_cbf.c.

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

Referenced by CBFreadVar().

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

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

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

Definition at line 446 of file reader_cbf.c.

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

Referenced by CBFreadPsdVar().

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

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

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

Definition at line 517 of file reader_cbf.c.

References CBF_LINE_BUFFER, CBF_NAME_BUFFER, CBF_NAME_FORMAT, CBFfgets(), and CBFreadInt().

Referenced by CBFreadPsdVarRank1().

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

reads integrality conditions from given CBF-file

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

Definition at line 644 of file reader_cbf.c.

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

Referenced by CBFreadCon().

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

reads SDP-constraint sizes from given CBF-file

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

Definition at line 711 of file reader_cbf.c.

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

Referenced by CBFreadInt().

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

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

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

Definition at line 787 of file reader_cbf.c.

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

Referenced by CBFreadPsdCon().

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

reads objective values for matrix variables from given CBF-file

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

Definition at line 857 of file reader_cbf.c.

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

Referenced by CBFreadPsdConRank1().

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

reads objective values for scalar variables from given CBF-file

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

Definition at line 968 of file reader_cbf.c.

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

Referenced by CBFreadObjFcoord().

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

reads matrix variable coefficients from given CBF-file

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

Definition at line 1048 of file reader_cbf.c.

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

Referenced by CBFreadObjAcoord().

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

reads linear coefficients from given CBF-file

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

Definition at line 1173 of file reader_cbf.c.

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

Referenced by CBFreadFcoord().

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

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

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

Definition at line 1269 of file reader_cbf.c.

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

Referenced by CBFreadAcoord().

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

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

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

Definition at line 1361 of file reader_cbf.c.

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

Referenced by CBFreadBcoord().

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

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

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

Definition at line 1643 of file reader_cbf.c.

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

Referenced by CBFreadHcoord().

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

frees all data allocated for the CBF-data-struct

Parameters
scipSCIP data structure
datadata pointer to save the results in

Definition at line 1780 of file reader_cbf.c.

References SCIP_DECL_READERCOPY().

Referenced by CBFreadDcoord().

static SCIP_DECL_READERCOPY ( readerCopyCbf  )
static

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

Definition at line 1945 of file reader_cbf.c.

Referenced by CBFfreeData().

static SCIP_DECL_READERREAD ( readerReadCbf  )
static

problem reading method of reader

Definition at line 1956 of file reader_cbf.c.

static SCIP_DECL_READERWRITE ( readerWriteCbf  )
static

problem writing method of reader

Definition at line 2308 of file reader_cbf.c.

SCIP_RETCODE SCIPincludeReaderCbf ( SCIP *  scip)

includes the CBF file reader in SCIP

Parameters
scipSCIP data structure

Definition at line 2878 of file reader_cbf.c.

References READER_DESC, READER_EXTENSION, and READER_NAME.

Referenced by SCIPSDPincludeDefaultPlugins().

Variable Documentation

char CBF_LINE_BUFFER[CBF_MAX_LINE]
char CBF_NAME_BUFFER[CBF_MAX_NAME]

Definition at line 99 of file reader_cbf.c.

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