Scippy

SCIP

Solving Constraint Integer Programs

reader_rlp.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file reader_rlp.c
17  * @brief RLP file reader (LP format with generic variables and row names)
18  * @author Stefan Heinz
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #include <string.h>
24 
25 #include "scip/reader_lp.h"
26 #include "scip/reader_rlp.h"
27 
28 #define READER_NAME "rlpreader"
29 #define READER_DESC "file reader for MIPs in IBM CPLEX's RLP file format"
30 #define READER_EXTENSION "rlp"
31 
32 
33 /*
34  * Callback methods of reader
35  */
36 
37 /** copy method for reader plugins (called when SCIP copies plugins) */
38 static
39 SCIP_DECL_READERCOPY(readerCopyRlp)
40 { /*lint --e{715}*/
41  assert(scip != NULL);
42  assert(reader != NULL);
43  assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
44 
45  /* call inclusion method of reader */
47 
48  return SCIP_OKAY;
49 }
50 
51 
52 /** problem reading method of reader */
53 static
54 SCIP_DECL_READERREAD(readerReadRlp)
55 { /*lint --e{715}*/
56 
57  SCIP_CALL( SCIPreadLp(scip, reader, filename, result) );
58 
59  return SCIP_OKAY;
60 }
61 
62 
63 /** problem writing method of reader */
64 static
65 SCIP_DECL_READERWRITE(readerWriteRlp)
66 { /*lint --e{715}*/
67  if( genericnames )
68  {
69  SCIP_CALL( SCIPwriteLp(scip, file, name, transformed, objsense, objscale, objoffset, vars,
70  nvars, nbinvars, nintvars, nimplvars, ncontvars, conss, nconss, result) );
71  }
72  else
73  {
74  SCIPwarningMessage(scip, "RLP format is LP format with generic variable and constraint names\n");
75 
76  if( transformed )
77  {
78  SCIPwarningMessage(scip, "write transformed problem with generic variable and constraint names\n");
79  SCIP_CALL( SCIPprintTransProblem(scip, file, "rlp", TRUE) );
80  }
81  else
82  {
83  SCIPwarningMessage(scip, "write original problem with generic variable and constraint names\n");
84  SCIP_CALL( SCIPprintOrigProblem(scip, file, "rlp", TRUE) );
85  }
86  *result = SCIP_SUCCESS;
87  }
88  return SCIP_OKAY;
89 }
90 
91 
92 /*
93  * reader specific interface methods
94  */
95 
96 /** includes the rlp file reader in SCIP */
98  SCIP* scip /**< SCIP data structure */
99  )
100 {
101  SCIP_READER* reader;
102 
103  /* include reader */
105 
106  assert(reader != NULL);
107 
108  /* set non fundamental callbacks via setter functions */
109  SCIP_CALL( SCIPsetReaderCopy(scip, reader, readerCopyRlp) );
110  SCIP_CALL( SCIPsetReaderRead(scip, reader, readerReadRlp) );
111  SCIP_CALL( SCIPsetReaderWrite(scip, reader, readerWriteRlp) );
112 
113  return SCIP_OKAY;
114 }
RLP file reader (LP format with generic variables and row names)
SCIP_RETCODE SCIPprintTransProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
Definition: scip.c:43309
const char * SCIPreaderGetName(SCIP_READER *reader)
Definition: reader.c:515
#define TRUE
Definition: def.h:63
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip.c:1260
SCIP_RETCODE SCIPprintOrigProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
Definition: scip.c:43265
#define NULL
Definition: lpi_spx1.cpp:137
static SCIP_DECL_READERREAD(readerReadRlp)
Definition: reader_rlp.c:54
#define SCIP_CALL(x)
Definition: def.h:306
static SCIP_DECL_READERWRITE(readerWriteRlp)
Definition: reader_rlp.c:65
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
Definition: scip.c:5201
#define READER_EXTENSION
Definition: reader_rlp.c:30
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERWRITE((*readerwrite)))
Definition: scip.c:5311
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
Definition: scip.c:5239
#define READER_NAME
Definition: reader_rlp.c:28
LP file reader.
#define READER_DESC
Definition: reader_rlp.c:29
SCIP_RETCODE SCIPreadLp(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
Definition: reader_lp.c:3459
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip.c:5287
SCIP_RETCODE SCIPincludeReaderRlp(SCIP *scip)
Definition: reader_rlp.c:97
static SCIP_DECL_READERCOPY(readerCopyRlp)
Definition: reader_rlp.c:39
SCIP_RETCODE SCIPwriteLp(SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_OBJSENSE objsense, SCIP_Real objscale, SCIP_Real objoffset, SCIP_VAR **vars, int nvars, int nbinvars, int nintvars, int nimplvars, int ncontvars, SCIP_CONS **conss, int nconss, SCIP_RESULT *result)
Definition: reader_lp.c:3532