Scippy

SCIP

Solving Constraint Integer Programs

reader_wbo.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-2020 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 visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file reader_wbo.c
17  * @ingroup DEFPLUGINS_READER
18  * @brief WBO file reader (OPB format with weighted constraints)
19  * @author Michael Winkler
20  */
21 
22 /* For file format description see opb-reader. */
23 
24 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
25 
26 #include "scip/pub_message.h"
27 #include "scip/pub_reader.h"
28 #include "scip/reader_opb.h"
29 #include "scip/reader_wbo.h"
30 #include "scip/scip_reader.h"
31 #include <string.h>
32 
33 #define READER_NAME "wboreader"
34 #define READER_DESC "file reader for pseudoboolean wbo file format"
35 #define READER_EXTENSION "wbo"
36 
37 /*
38  * Callback methods of reader
39  */
40 
41 /** copy method for reader plugins (called when SCIP copies plugins) */
42 static
43 SCIP_DECL_READERCOPY(readerCopyWbo)
44 { /*lint --e{715}*/
45  assert(scip != NULL);
46  assert(reader != NULL);
47  assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
48 
49  /* call inclusion method of reader */
51 
52  return SCIP_OKAY;
53 }
54 
55 
56 /** problem reading method of reader */
57 static
58 SCIP_DECL_READERREAD(readerReadWbo)
59 { /*lint --e{715}*/
60 
61  SCIP_CALL( SCIPreadOpb(scip, reader, filename, result) );
62 
63  return SCIP_OKAY;
64 }
65 
66 
67 /** problem writing method of reader */
68 static
69 SCIP_DECL_READERWRITE(readerWriteWbo)
70 { /*lint --e{715}*/
71  SCIP_CALL( SCIPwriteOpb(scip, file, name, transformed, objsense, objscale, objoffset, vars,
72  nvars, nbinvars, nintvars, nimplvars, ncontvars, fixedvars, nfixedvars, conss, nconss, genericnames, result) );
73 
74  return SCIP_OKAY;
75 }
76 
77 
78 /*
79  * reader specific interface methods
80  */
81 
82 /** includes the wbo file reader in SCIP */
84  SCIP* scip /**< SCIP data structure */
85  )
86 {
87  SCIP_READER* reader;
88 
89  /* include reader */
91 
92  assert(reader != NULL);
93 
94  /* set non fundamental callbacks via setter functions */
95  SCIP_CALL( SCIPsetReaderCopy(scip, reader, readerCopyWbo) );
96  SCIP_CALL( SCIPsetReaderRead(scip, reader, readerReadWbo) );
97  SCIP_CALL( SCIPsetReaderWrite(scip, reader, readerWriteWbo) );
98 
99  return SCIP_OKAY;
100 }
SCIP_EXPORT const char * SCIPreaderGetName(SCIP_READER *reader)
Definition: reader.c:548
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip_reader.c:186
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
Definition: scip_reader.c:138
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
#define READER_DESC
Definition: reader_wbo.c:34
SCIP_RETCODE SCIPreadOpb(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
Definition: reader_opb.c:4197
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERWRITE((*readerwrite)))
Definition: scip_reader.c:210
static SCIP_DECL_READERCOPY(readerCopyWbo)
Definition: reader_wbo.c:43
#define NULL
Definition: lpi_spx1.cpp:155
#define SCIP_CALL(x)
Definition: def.h:364
SCIP_RETCODE SCIPwriteOpb(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_VAR **fixedvars, int nfixedvars, SCIP_CONS **conss, int nconss, SCIP_Bool genericnames, SCIP_RESULT *result)
Definition: reader_opb.c:4275
WBO file reader (LP format with generic variables and row names)
#define READER_NAME
Definition: reader_wbo.c:33
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
Definition: scip_reader.c:100
SCIP_RETCODE SCIPincludeReaderWbo(SCIP *scip)
Definition: reader_wbo.c:83
#define READER_EXTENSION
Definition: reader_wbo.c:35
pseudo-Boolean file reader (opb format)
static SCIP_DECL_READERWRITE(readerWriteWbo)
Definition: reader_wbo.c:69
public methods for message output
public methods for input file readers
static SCIP_DECL_READERREAD(readerReadWbo)
Definition: reader_wbo.c:58
public methods for reader plugins