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-2016 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_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 <string.h>
26 
27 #include "scip/reader_opb.h"
28 #include "scip/reader_wbo.h"
29 
30 #define READER_NAME "wboreader"
31 #define READER_DESC "file reader for pseudoboolean wbo file format"
32 #define READER_EXTENSION "wbo"
33 
34 /*
35  * Callback methods of reader
36  */
37 
38 /** copy method for reader plugins (called when SCIP copies plugins) */
39 static
40 SCIP_DECL_READERCOPY(readerCopyWbo)
41 { /*lint --e{715}*/
42  assert(scip != NULL);
43  assert(reader != NULL);
44  assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
45 
46  /* call inclusion method of reader */
48 
49  return SCIP_OKAY;
50 }
51 
52 
53 /** problem reading method of reader */
54 static
55 SCIP_DECL_READERREAD(readerReadWbo)
56 { /*lint --e{715}*/
57 
58  SCIP_CALL( SCIPreadOpb(scip, reader, filename, result) );
59 
60  return SCIP_OKAY;
61 }
62 
63 
64 /** problem writing method of reader */
65 static
66 SCIP_DECL_READERWRITE(readerWriteWbo)
67 { /*lint --e{715}*/
68  SCIP_CALL( SCIPwriteOpb(scip, file, name, transformed, objsense, objscale, objoffset, vars,
69  nvars, nbinvars, nintvars, nimplvars, ncontvars, fixedvars, nfixedvars, conss, nconss, genericnames, result) );
70 
71  return SCIP_OKAY;
72 }
73 
74 
75 /*
76  * reader specific interface methods
77  */
78 
79 /** includes the wbo file reader in SCIP */
81  SCIP* scip /**< SCIP data structure */
82  )
83 {
84  SCIP_READERDATA* readerdata;
85  SCIP_READER* reader;
86 
87  /* create reader data */
88  readerdata = NULL;
89 
90  /* include reader */
92 
93  assert(reader != NULL);
94 
95  /* set non fundamental callbacks via setter functions */
96  SCIP_CALL( SCIPsetReaderCopy(scip, reader, readerCopyWbo) );
97  SCIP_CALL( SCIPsetReaderRead(scip, reader, readerReadWbo) );
98  SCIP_CALL( SCIPsetReaderWrite(scip, reader, readerWriteWbo) );
99 
100  return SCIP_OKAY;
101 }
const char * SCIPreaderGetName(SCIP_READER *reader)
Definition: reader.c:510
#define NULL
Definition: lpi_spx.cpp:130
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIP_CALL(x)
Definition: def.h:266
#define READER_DESC
Definition: reader_wbo.c:31
SCIP_RETCODE SCIPincludeReaderWbo(SCIP *scip)
Definition: reader_wbo.c:80
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
Definition: scip.c:4601
static SCIP_DECL_READERCOPY(readerCopyWbo)
Definition: reader_wbo.c:40
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:4110
SCIP_RETCODE SCIPreadOpb(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
Definition: reader_opb.c:4035
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip.c:4649
struct SCIP_ReaderData SCIP_READERDATA
Definition: type_reader.h:37
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.c:4563
#define READER_NAME
Definition: reader_wbo.c:30
#define READER_EXTENSION
Definition: reader_wbo.c:32
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERWRITE((*readerwrite)))
Definition: scip.c:4673
pseudo-Boolean file reader (opb format)
static SCIP_DECL_READERWRITE(readerWriteWbo)
Definition: reader_wbo.c:66
static SCIP_DECL_READERREAD(readerReadWbo)
Definition: reader_wbo.c:55