SCIP Doxygen Documentation
 
Loading...
Searching...
No Matches
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-2025 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file reader_wbo.c
26 * @ingroup DEFPLUGINS_READER
27 * @brief WBO file reader (OPB format with weighted constraints)
28 * @author Michael Winkler
29 */
30
31/* For file format description see opb-reader. */
32
33/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34
35#include "scip/pub_message.h"
36#include "scip/pub_reader.h"
37#include "scip/reader_opb.h"
38#include "scip/reader_wbo.h"
39#include "scip/scip_reader.h"
40#include <string.h>
41
42#define READER_NAME "wboreader"
43#define READER_DESC "file reader for pseudoboolean wbo file format"
44#define READER_EXTENSION "wbo"
45
46/*
47 * Callback methods of reader
48 */
49
50/** copy method for reader plugins (called when SCIP copies plugins) */
51static
53{ /*lint --e{715}*/
54 assert(scip != NULL);
55 assert(reader != NULL);
56 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
57
58 /* call inclusion method of reader */
60
61 return SCIP_OKAY;
62}
63
64
65/** problem reading method of reader */
66static
68{ /*lint --e{715}*/
69
70 SCIP_CALL( SCIPreadOpb(scip, reader, filename, result) );
71
72 return SCIP_OKAY;
73}
74
75
76/** problem writing method of reader */
77static
78SCIP_DECL_READERWRITE(readerWriteWbo)
79{ /*lint --e{715}*/
80 SCIP_CALL( SCIPwriteOpb(scip, file, name, transformed, objsense, objscale, objoffset, vars,
81 nvars, nbinvars, nintvars, nimplvars, ncontvars, fixedvars, nfixedvars, conss, nconss, genericnames, result) );
82
83 return SCIP_OKAY;
84}
85
86
87/*
88 * reader specific interface methods
89 */
90
91/** includes the wbo file reader in SCIP */
93 SCIP* scip /**< SCIP data structure */
94 )
95{
96 SCIP_READER* reader;
97
98 /* include reader */
100
101 assert(reader != NULL);
102
103 /* set non fundamental callbacks via setter functions */
104 SCIP_CALL( SCIPsetReaderCopy(scip, reader, readerCopyWbo) );
105 SCIP_CALL( SCIPsetReaderRead(scip, reader, readerReadWbo) );
106 SCIP_CALL( SCIPsetReaderWrite(scip, reader, readerWriteWbo) );
107
108 return SCIP_OKAY;
109}
#define NULL
Definition def.h:266
#define SCIP_CALL(x)
Definition def.h:373
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)
SCIP_RETCODE SCIPreadOpb(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
SCIP_RETCODE SCIPincludeReaderWbo(SCIP *scip)
Definition reader_wbo.c:92
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader,)
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader,)
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader,)
const char * SCIPreaderGetName(SCIP_READER *reader)
Definition reader.c:557
return SCIP_OKAY
assert(minobj< SCIPgetCutoffbound(scip))
int nvars
SCIP_Real objscale
static SCIP_VAR ** vars
int nbinvars
int nintvars
public methods for message output
public methods for input file readers
#define READER_DESC
Definition reader_bnd.c:62
#define READER_EXTENSION
Definition reader_bnd.c:63
#define READER_NAME
Definition reader_bnd.c:61
pseudo-Boolean file reader (opb format)
WBO file reader (LP format with generic variables and row names)
public methods for reader plugins
#define SCIP_DECL_READERWRITE(x)
struct SCIP_Reader SCIP_READER
Definition type_reader.h:52
#define SCIP_DECL_READERREAD(x)
Definition type_reader.h:87
#define SCIP_DECL_READERCOPY(x)
Definition type_reader.h:62
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
Definition type_scip.h:39