Scippy

SCIP

Solving Constraint Integer Programs

reader_smps.c File Reference

Detailed Description

SMPS file reader - smps files list the cor, tim and sto files for a single instance.

Author
Stephen J. Maher

Definition in file reader_smps.c.

#include "blockmemshell/memory.h"
#include "scip/pub_fileio.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_reader.h"
#include "scip/reader_cor.h"
#include "scip/reader_smps.h"
#include "scip/reader_sto.h"
#include "scip/reader_tim.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_prob.h"
#include "scip/scip_reader.h"
#include <string.h>
#include <strings.h>

Go to the source code of this file.

Data Structures

struct  SmpsInput
 

Macros

#define READER_NAME   "smpsreader"
 
#define READER_DESC   "file reader for core problem of stochastic programs in the SMPS file format"
 
#define READER_EXTENSION   "smps"
 
#define SMPS_MAX_LINELEN   1024
 
#define BLANK   ' '
 
#define LINEWIDTH   80
 
#define COR_FILEEXTENSION   "cor"
 
#define TIM_FILEEXTENSION   "tim"
 
#define STO_FILEEXTENSION   "sto"
 

Typedefs

typedef enum SCIP_SmpsFileType SCIP_SMPSFILETYPE
 
typedef struct SmpsInput SMPSINPUT
 

Enumerations

enum  SCIP_SmpsFileType {
  SCIP_SMPSFILETYPE_COR = 0,
  SCIP_SMPSFILETYPE_TIM = 1,
  SCIP_SMPSFILETYPE_STO = 2
}
 

Functions

static SCIP_RETCODE smpsinputCreate (SCIP *scip, SMPSINPUT **smpsi, SCIP_FILE *fp)
 
static void smpsinputFree (SCIP *scip, SMPSINPUT **smpsi)
 
static const char * smpsinputField0 (const SMPSINPUT *smpsi)
 
static void clearFrom (char *buf, unsigned int pos)
 
static SCIP_Bool smpsinputReadLine (SMPSINPUT *smpsi)
 
static SCIP_DECL_READERCOPY (readerCopySmps)
 
static SCIP_DECL_READERREAD (readerReadSmps)
 
SCIP_RETCODE SCIPincludeReaderSmps (SCIP *scip)
 

Macro Definition Documentation

◆ READER_NAME

#define READER_NAME   "smpsreader"

Definition at line 48 of file reader_smps.c.

Referenced by SCIP_DECL_READERCOPY(), and SCIPincludeReaderSmps().

◆ READER_DESC

#define READER_DESC   "file reader for core problem of stochastic programs in the SMPS file format"

Definition at line 49 of file reader_smps.c.

Referenced by SCIPincludeReaderSmps().

◆ READER_EXTENSION

#define READER_EXTENSION   "smps"

Definition at line 50 of file reader_smps.c.

Referenced by SCIPincludeReaderSmps().

◆ SMPS_MAX_LINELEN

#define SMPS_MAX_LINELEN   1024

Definition at line 52 of file reader_smps.c.

Referenced by smpsinputReadLine().

◆ BLANK

#define BLANK   ' '

Definition at line 53 of file reader_smps.c.

Referenced by clearFrom(), and smpsinputReadLine().

◆ LINEWIDTH

#define LINEWIDTH   80

Definition at line 54 of file reader_smps.c.

Referenced by clearFrom(), and smpsinputReadLine().

◆ COR_FILEEXTENSION

#define COR_FILEEXTENSION   "cor"

Definition at line 56 of file reader_smps.c.

Referenced by SCIP_DECL_READERREAD().

◆ TIM_FILEEXTENSION

#define TIM_FILEEXTENSION   "tim"

Definition at line 57 of file reader_smps.c.

Referenced by SCIP_DECL_READERREAD().

◆ STO_FILEEXTENSION

#define STO_FILEEXTENSION   "sto"

Definition at line 58 of file reader_smps.c.

Referenced by SCIP_DECL_READERREAD().

Typedef Documentation

◆ SCIP_SMPSFILETYPE

Definition at line 67 of file reader_smps.c.

◆ SMPSINPUT

typedef struct SmpsInput SMPSINPUT

Definition at line 80 of file reader_smps.c.

Enumeration Type Documentation

◆ SCIP_SmpsFileType

enum for the file types that are read by the SMPS reader

Enumerator
SCIP_SMPSFILETYPE_COR 
SCIP_SMPSFILETYPE_TIM 
SCIP_SMPSFILETYPE_STO 

Definition at line 61 of file reader_smps.c.

Function Documentation

◆ smpsinputCreate()

static SCIP_RETCODE smpsinputCreate ( SCIP scip,
SMPSINPUT **  smpsi,
SCIP_FILE fp 
)
static

creates the smps input structure

Parameters
scipSCIP data structure
smpsismps input structure
fpfile object for the input file

Definition at line 85 of file reader_smps.c.

References FALSE, SmpsInput::fp, NULL, SCIP_CALL, SCIP_OKAY, and SCIPallocBlockMemory.

Referenced by SCIP_DECL_READERREAD().

◆ smpsinputFree()

static void smpsinputFree ( SCIP scip,
SMPSINPUT **  smpsi 
)
static

free the smps input structure

Parameters
scipSCIP data structure
smpsismps input structure

Definition at line 108 of file reader_smps.c.

References SCIPfreeBlockMemory.

Referenced by SCIP_DECL_READERREAD().

◆ smpsinputField0()

static const char* smpsinputField0 ( const SMPSINPUT smpsi)
static

return the current value of field 0

Parameters
smpsismps input structure

Definition at line 118 of file reader_smps.c.

References SmpsInput::f0, and NULL.

Referenced by SCIP_DECL_READERREAD().

◆ clearFrom()

static void clearFrom ( char *  buf,
unsigned int  pos 
)
static

fill the line from pos up to column LINEWIDTH with blanks.

Parameters
bufbuffer to clear
posposition to start the clearing process

Definition at line 129 of file reader_smps.c.

References BLANK, and LINEWIDTH.

Referenced by smpsinputReadLine().

◆ smpsinputReadLine()

static SCIP_Bool smpsinputReadLine ( SMPSINPUT smpsi)
static

read a smps format data line and parse the fields.

Parameters
smpsismps input structure

Definition at line 143 of file reader_smps.c.

References BLANK, SmpsInput::buf, clearFrom(), SmpsInput::f0, SmpsInput::f1, FALSE, SmpsInput::fp, SmpsInput::lineno, LINEWIDTH, NULL, SCIP_Bool, SCIPdebugMessage, SCIPfgets(), SCIPstrtok(), SMPS_MAX_LINELEN, and TRUE.

Referenced by SCIP_DECL_READERREAD().

◆ SCIP_DECL_READERCOPY()

static SCIP_DECL_READERCOPY ( readerCopySmps  )
static

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

Definition at line 211 of file reader_smps.c.

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

◆ SCIP_DECL_READERREAD()