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