SCIP Doxygen Documentation
Loading...
Searching...
No Matches
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-2026 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_rlp.c
26 * @ingroup DEFPLUGINS_READER
27 * @brief RLP file reader (LP format with generic variables and row names)
28 * @author Stefan Heinz
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#include "scip/pub_message.h"
34#include "scip/pub_reader.h"
35#include "scip/reader_lp.h"
36#include "scip/reader_rlp.h"
37#include "scip/scip_message.h"
38#include "scip/scip_reader.h"
39#include "scip/scip_prob.h"
40
41
42#define READER_NAME "rlpreader"
43#define READER_DESC "file reader for MIPs in IBM CPLEX's RLP file format"
44#define READER_EXTENSION "rlp"
45
46
47/*
48 * Callback methods of reader
49 */
50
51/** copy method for reader plugins (called when SCIP copies plugins) */
52static
54{ /*lint --e{715}*/
55 assert(scip != NULL);
56 assert(reader != NULL);
57
59
60 /* call inclusion method of reader */
62
63 return SCIP_OKAY;
64}
65
66
67/** problem reading method of reader */
68static
70{ /*lint --e{715}*/
71
72 SCIP_CALL( SCIPreadLp(scip, reader, filename, result) );
73
74 return SCIP_OKAY;
75}
76
77
78/** problem writing method of reader */
79static
80SCIP_DECL_READERWRITE(readerWriteRlp)
81{ /*lint --e{715}*/
82 if( genericnames )
83 {
84 SCIP_CALL( SCIPwriteLp(scip, file, name, transformed, objsense, objoffset, objscale, objoffsetexact, objscaleexact,
85 vars, nvars, nbinvars, nintvars, nimplvars, ncontvars, conss, nconss, result) );
86 }
87 else
88 {
89 SCIPwarningMessage(scip, "RLP format is LP format with generic variable and constraint names\n");
90
91 if( transformed )
92 {
93 SCIPwarningMessage(scip, "write transformed problem with generic variable and constraint names\n");
94 SCIP_CALL( SCIPprintTransProblem(scip, file, "rlp", TRUE) );
95 }
96 else
97 {
98 SCIPwarningMessage(scip, "write original problem with generic variable and constraint names\n");
99 SCIP_CALL( SCIPprintOrigProblem(scip, file, "rlp", TRUE) );
100 }
102 }
103 return SCIP_OKAY;
104}
105
106
107/*
108 * reader specific interface methods
109 */
110
111/** includes the rlp file reader in SCIP */
113 SCIP* scip /**< SCIP data structure */
114 )
115{
116 SCIP_READER* reader;
117
118 /* include reader */
120
121 assert(reader != NULL);
122
123 /* set non fundamental callbacks via setter functions */
124 SCIP_CALL( SCIPsetReaderCopy(scip, reader, readerCopyRlp) );
125 SCIP_CALL( SCIPsetReaderRead(scip, reader, readerReadRlp) );
126 SCIP_CALL( SCIPsetReaderWrite(scip, reader, readerWriteRlp) );
127
128 return SCIP_OKAY;
129}
#define NULL
Definition def.h:257
#define SCIP_STRINGEQ(name, reference, retcode)
Definition def.h:454
#define TRUE
Definition def.h:102
#define SCIP_CALL(x)
Definition def.h:364
SCIP_RETCODE SCIPreadLp(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
Definition reader_lp.c:4430
SCIP_RETCODE SCIPwriteLp(SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_OBJSENSE objsense, SCIP_Real objoffset, SCIP_Real objscale, SCIP_RATIONAL *objoffsetexact, SCIP_RATIONAL *objscaleexact, 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:4506
SCIP_RETCODE SCIPincludeReaderRlp(SCIP *scip)
Definition reader_rlp.c:112
SCIP_RETCODE SCIPprintTransProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
Definition scip_prob.c:696
SCIP_RETCODE SCIPprintOrigProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
Definition scip_prob.c:652
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
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:700
return SCIP_OKAY
assert(minobj< SCIPgetCutoffbound(scip))
int nvars
SCIP_Real objscale
static SCIP_VAR ** vars
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
LP file reader.
RLP file reader (LP format with generic variables and row names).
public methods for message handling
public methods for global and local (sub)problems
public methods for reader plugins
#define SCIP_DECL_READERWRITE(x)
struct SCIP_Reader SCIP_READER
Definition type_reader.h:53
#define SCIP_DECL_READERREAD(x)
Definition type_reader.h:88
#define SCIP_DECL_READERCOPY(x)
Definition type_reader.h:63
@ SCIP_SUCCESS
Definition type_result.h:58
@ SCIP_INVALIDCALL
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
Definition type_scip.h:39