Scippy

SCIP

Solving Constraint Integer Programs

reader_opb.c File Reference

Detailed Description

pseudo-Boolean file reader (opb format)

Author
Stefan Heinz
Michael Winkler

This file reader parses the opb format and is also used by the wbo reader for the wbo format. For a detailed description of this format see

The syntax of the input file format can be described by a simple Backus-Naur form. <formula> is the start symbol of this grammar.

<formula>::= <sequence_of_comments> [<objective>] | [<softheader>] <sequence_of_comments_or_constraints>

<sequence_of_comments>::= <comment> [<sequence_of_comments>] <comment>::= "*" <any_sequence_of_characters_other_than_EOL> <EOL> <sequence_of_comments_or_constraints>::=<comment_or_constraint> [<sequence_of_comments_or_constraints>] <comment_or_constraint>::=<comment>|<constraint>

<objective>::= "min:" <zeroOrMoreSpace> <sum> ";" <constraint>::= <sum> <relational_operator> <zeroOrMoreSpace> <integer> <zeroOrMoreSpace> ";"

<sum>::= <weightedterm> | <weightedterm> <sum> <weightedterm>::= <integer> <oneOrMoreSpace> <term> <oneOrMoreSpace>

<integer>::= <unsigned_integer> | "+" <unsigned_integer> | "-" <unsigned_integer> <unsigned_integer>::= <digit> | <digit><unsigned_integer>

<relational_operator>::= "\>=" | "="

<variablename>::= "x" <unsigned_integer>

<oneOrMoreSpace>::= " " [<oneOrMoreSpace>] <zeroOrMoreSpace>::= [" " <zeroOrMoreSpace>]

For linear pseudo-Boolean instances, <term> is defined as

<term>::=<variablename>

For non-linear instances, <term> is defined as

<term>::= <oneOrMoreLiterals> <oneOrMoreLiterals>::= <literal> | <literal> <oneOrMoreSpace> <oneOrMoreLiterals> <literal>::= <variablename> | "~"<variablename>

For wbo-files are the following additional/changed things possible.

<softheader>::= "soft:" [<unsigned integer>] ";"

<comment_or_constraint>::=<comment>|<constraint>|<softconstraint>

<softconstraint>::= "[" <zeroOrMoreSpace> <unsigned integer> <zeroOrMoreSpace> "]" <constraint>

Definition in file reader_opb.c.

#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include "scip/cons_and.h"
#include "scip/cons_indicator.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_pseudoboolean.h"
#include "scip/cons_setppc.h"
#include "scip/cons_varbound.h"
#include "scip/pub_misc.h"
#include "scip/reader_opb.h"
#include "scip/debug.h"

Go to the source code of this file.

Macros

#define READER_NAME   "opbreader"
 
#define READER_DESC   "file reader for pseudo-Boolean problem in opb format"
 
#define READER_EXTENSION   "opb"
 
#define GENCONSNAMES   TRUE /* remove if no constraint names should be generated */
 
#define LINEAROBJECTIVE
 
#define INDICATORVARNAME   "indicatorvar" /* standard part of name for all indicator variables */
 
#define INDICATORSLACKVARNAME   "indslack" /* standard part of name for all indicator slack variables; should be the same in cons_indicator */
 
#define TOPCOSTCONSNAME   "topcostcons" /* standard name for artificial topcost constraint in wbo problems */
 
#define OPB_MAX_LINELEN   65536
 
#define OPB_MAX_PUSHEDTOKENS   2
 
#define OPB_INIT_COEFSSIZE   8192
 
#define HASHTABLESIZE_FACTOR   5
 

Typedefs

typedef enum OpbExpType OPBEXPTYPE
 
typedef enum OpbSense OPBSENSE
 
typedef struct OpbInput OPBINPUT
 

Enumerations

enum  OpbExpType {
  OPB_EXP_NONE,
  OPB_EXP_UNSIGNED,
  OPB_EXP_SIGNED
}
 
enum  OpbSense {
  OPB_SENSE_NOTHING,
  OPB_SENSE_LE,
  OPB_SENSE_GE,
  OPB_SENSE_EQ
}
 

Functions

static void syntaxError (SCIP *scip, OPBINPUT *opbinput, const char *msg)
 
static SCIP_Bool hasError (OPBINPUT *opbinput)
 
static SCIP_Bool isDelimChar (char c)
 
static SCIP_Bool isTokenChar (char c)
 
static SCIP_Bool isValueChar (char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, OPBEXPTYPE *exptype)
 
static SCIP_Bool getNextLine (SCIP *scip, OPBINPUT *opbinput)
 
static void swapPointers (char **pointer1, char **pointer2)
 
static SCIP_Bool getNextToken (SCIP *scip, OPBINPUT *opbinput)
 
static void pushToken (OPBINPUT *opbinput)
 
static void pushBufferToken (OPBINPUT *opbinput)
 
static void swapTokenBuffer (OPBINPUT *opbinput)
 
static SCIP_Bool isEndLine (OPBINPUT *opbinput)
 
static SCIP_Bool isSign (OPBINPUT *opbinput, int *sign)
 
static SCIP_Bool isValue (SCIP *scip, OPBINPUT *opbinput, SCIP_Real *value)
 
static SCIP_Bool isSense (OPBINPUT *opbinput, OPBSENSE *sense)
 
static SCIP_Bool isStartingSoftConstraintWeight (SCIP *scip, OPBINPUT *opbinput)
 
static SCIP_Bool isEndingSoftConstraintWeight (SCIP *scip, OPBINPUT *opbinput)
 
static SCIP_RETCODE createVariable (SCIP *scip, SCIP_VAR **var, char *name)
 
static SCIP_RETCODE getVariableOrTerm (SCIP *scip, OPBINPUT *opbinput, SCIP_VAR ***vars, int *nvars, int *varssize)
 
static SCIP_RETCODE readCoefficients (SCIP *const scip, OPBINPUT *const opbinput, char *const name, SCIP_VAR ***linvars, SCIP_Real **lincoefs, int *const nlincoefs, SCIP_VAR ****terms, SCIP_Real **termcoefs, int **ntermvars, int *const ntermcoefs, SCIP_Bool *const newsection, SCIP_Bool *const isNonlinear, SCIP_Bool *const issoftcons, SCIP_Real *const weight)
 
static SCIP_RETCODE setObjective (SCIP *const scip, OPBINPUT *const opbinput, const char *sense, SCIP_VAR **const linvars, SCIP_Real *const coefs, int const ncoefs, SCIP_VAR ***const terms, SCIP_Real *const termcoefs, int *const ntermvars, int const ntermcoefs)
 
static SCIP_RETCODE readConstraints (SCIP *scip, OPBINPUT *opbinput, int *nNonlinearConss)
 
static SCIP_RETCODE getMaxAndConsDim (SCIP *scip, OPBINPUT *opbinput, const char *filename)
 
static SCIP_RETCODE readOPBFile (SCIP *scip, OPBINPUT *opbinput, const char *filename)
 
static SCIP_RETCODE getBinVarsRepresentatives (SCIP *const scip, SCIP_VAR **const vars, int const nvars, SCIP_Bool const transformed)
 
static SCIP_RETCODE getActiveVariables (SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
 
static SCIP_RETCODE computeAndConstraintInfos (SCIP *const scip, SCIP_Bool const transformed, SCIP_VAR ***resvars, int *nresvars, SCIP_VAR ****andvars, int **nandvars, SCIP_Bool *const existandconshdlr, SCIP_Bool *const existands)
 
static void clearBuffer (char *linebuffer, int *linecnt)
 
static void writeBuffer (SCIP *scip, FILE *file, char *linebuffer, int *linecnt)
 
static void appendBuffer (SCIP *scip, FILE *file, char *linebuffer, int *linecnt, const char *extension)
 
static SCIP_RETCODE writeOpbObjective (SCIP *const scip, FILE *const file, SCIP_VAR **const vars, int const nvars, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, SCIP_OBJSENSE const objsense, SCIP_Real const objscale, SCIP_Real const objoffset, char const *const multisymbol, SCIP_Bool const existands, SCIP_Bool const transformed)
 
static SCIP_RETCODE printNLRow (SCIP *const scip, FILE *const file, char const *const type, SCIP_VAR **const vars, SCIP_Real const *const vals, int const nvars, SCIP_Real lhs, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, SCIP_Longint weight, SCIP_Longint *const mult, char const *const multisymbol)
 
static SCIP_RETCODE printNonLinearCons (SCIP *const scip, FILE *const file, SCIP_VAR **const vars, SCIP_Real *const vals, int const nvars, SCIP_Real const lhs, SCIP_Real const rhs, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, SCIP_Longint weight, SCIP_Bool const transformed, char const *const multisymbol)
 
static SCIP_RETCODE printRow (SCIP *scip, FILE *file, const char *type, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real lhs, SCIP_Longint weight, SCIP_Longint *mult, const char *multisymbol)
 
static SCIP_RETCODE printLinearCons (SCIP *scip, FILE *file, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real lhs, SCIP_Real rhs, SCIP_Longint weight, SCIP_Bool transformed, const char *multisymbol)
 
static SCIP_RETCODE printPBRow (SCIP *const scip, FILE *const file, const char *type, SCIP_VAR **const linvars, SCIP_Real *const linvals, int const nlinvars, SCIP_VAR ***const termvars, int *const ntermvars, SCIP_Real *const termvals, int const ntermvals, SCIP_Bool **const negatedarrays, SCIP_VAR *const indvar, SCIP_Real lhs, SCIP_Longint *mult, const char *multisymbol)
 
static SCIP_RETCODE printPseudobooleanCons (SCIP *const scip, FILE *const file, SCIP_VAR **const linvars, SCIP_Real *const linvals, int const nlinvars, SCIP_VAR ***const termvars, int *const ntermvars, SCIP_Real *const termvals, int const ntermvals, SCIP_VAR *const indvar, SCIP_Real const lhs, SCIP_Real const rhs, SCIP_Bool transformed, const char *multisymbol)
 
static SCIP_RETCODE writeOpbConstraints (SCIP *const scip, FILE *const file, SCIP_CONS **const conss, int const nconss, SCIP_VAR **const vars, int const nvars, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, char const *const multisymbol, SCIP_Bool const existandconshdlr, SCIP_Bool const existands, SCIP_Bool const transformed)
 
static SCIP_RETCODE writeOpbRelevantAnds (SCIP *const scip, FILE *const file, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, char const *const multisymbol, SCIP_Bool const transformed)
 
static SCIP_RETCODE writeOpb (SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_OBJSENSE objsense, SCIP_Real objscale, SCIP_Real objoffset, SCIP_VAR **vars, int nvars, SCIP_CONS **conss, int nconss, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, SCIP_Bool const existandconshdlr, SCIP_Bool const existands, SCIP_RESULT *result)
 
SCIP_RETCODE SCIPreadOpb (SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
 
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)
 
static SCIP_DECL_READERCOPY (readerCopyOpb)
 
static SCIP_DECL_READERREAD (readerReadOpb)
 
static SCIP_DECL_READERWRITE (readerWriteOpb)
 
SCIP_RETCODE SCIPincludeReaderOpb (SCIP *scip)
 

Variables

static const char commentchars [] = "*"
 

Macro Definition Documentation

#define READER_NAME   "opbreader"
#define READER_DESC   "file reader for pseudo-Boolean problem in opb format"

Definition at line 102 of file reader_opb.c.

Referenced by SCIPincludeReaderOpb().

#define READER_EXTENSION   "opb"

Definition at line 103 of file reader_opb.c.

Referenced by SCIPincludeReaderOpb().

#define GENCONSNAMES   TRUE /* remove if no constraint names should be generated */

Definition at line 105 of file reader_opb.c.

#define LINEAROBJECTIVE
Value:
TRUE /* will all non-linear parts inside the objective function be linearized or will
* an artificial integer variable be created which will represent the objective
* function
*/
#define TRUE
Definition: def.h:55

Definition at line 106 of file reader_opb.c.

#define INDICATORVARNAME   "indicatorvar" /* standard part of name for all indicator variables */

Definition at line 111 of file reader_opb.c.

Referenced by printPBRow(), printRow(), readConstraints(), SCIPwriteOpb(), and writeOpbObjective().

#define INDICATORSLACKVARNAME   "indslack" /* standard part of name for all indicator slack variables; should be the same in cons_indicator */

Definition at line 112 of file reader_opb.c.

Referenced by SCIPwriteOpb().

#define TOPCOSTCONSNAME   "topcostcons" /* standard name for artificial topcost constraint in wbo problems */

Definition at line 113 of file reader_opb.c.

Referenced by readOPBFile(), and writeOpbObjective().

#define OPB_MAX_LINELEN   65536
#define OPB_MAX_PUSHEDTOKENS   2

Definition at line 119 of file reader_opb.c.

Referenced by pushBufferToken(), pushToken(), and SCIPreadOpb().

#define OPB_INIT_COEFSSIZE   8192

Definition at line 120 of file reader_opb.c.

Referenced by readCoefficients().

#define HASHTABLESIZE_FACTOR   5

Definition at line 3192 of file reader_opb.c.

Referenced by writeOpbConstraints().

Typedef Documentation

typedef enum OpbExpType OPBEXPTYPE

Definition at line 129 of file reader_opb.c.

typedef enum OpbSense OPBSENSE

Definition at line 138 of file reader_opb.c.

typedef struct OpbInput OPBINPUT

Definition at line 166 of file reader_opb.c.

Enumeration Type Documentation

enum OpbExpType

Section in OPB File

Enumerator
OPB_EXP_NONE 
OPB_EXP_UNSIGNED 
OPB_EXP_SIGNED 

Definition at line 123 of file reader_opb.c.

enum OpbSense
Enumerator
OPB_SENSE_NOTHING 
OPB_SENSE_LE 
OPB_SENSE_GE 
OPB_SENSE_EQ 

Definition at line 131 of file reader_opb.c.

Function Documentation

static void syntaxError ( SCIP scip,
OPBINPUT opbinput,
const char *  msg 
)
static

issues an error message and marks the OPB data to have errors

Parameters
scipSCIP data structure
opbinputOPB reading data
msgerror message

Definition at line 175 of file reader_opb.c.

References NULL, SCIPerrorMessage, and TRUE.

Referenced by getVariableOrTerm(), readCoefficients(), and readConstraints().

static SCIP_Bool hasError ( OPBINPUT opbinput)
static

returns whether a syntax error was detected

Parameters
opbinputOPB reading data

Definition at line 198 of file reader_opb.c.

References NULL.

Referenced by readCoefficients(), readConstraints(), readOPBFile(), and setObjective().

static SCIP_Bool isDelimChar ( char  c)
static

returns whether the given character is a token delimiter

Parameters
cinput character

Definition at line 209 of file reader_opb.c.

References FALSE, and TRUE.

Referenced by getNextToken().

static SCIP_Bool isTokenChar ( char  c)
static

returns whether the given character is a single token

Parameters
cinput character

Definition at line 230 of file reader_opb.c.

References FALSE, and TRUE.

Referenced by getNextToken(), and getVariableOrTerm().

static SCIP_Bool isValueChar ( char  c,
char  nextc,
SCIP_Bool  firstchar,
SCIP_Bool hasdot,
OPBEXPTYPE exptype 
)
static

returns whether the current character is member of a value string

Parameters
cinput character
nextcnext input character
firstcharis the given character the first char of the token?
hasdotpointer to update the dot flag
exptypepointer to update the exponent type

Definition at line 253 of file reader_opb.c.

References FALSE, NULL, OPB_EXP_NONE, OPB_EXP_SIGNED, OPB_EXP_UNSIGNED, and TRUE.

Referenced by getNextToken().

static SCIP_Bool getNextLine ( SCIP scip,
OPBINPUT opbinput 
)
static

reads the next line from the input file into the line buffer; skips comments; returns whether a line could be read

Parameters
scipSCIP data structure
opbinputOPB reading data

Definition at line 297 of file reader_opb.c.

References commentchars, FALSE, NULL, OPB_MAX_LINELEN, SCIPdebugMessage, SCIPfgets(), SCIPfseek(), SCIPwarningMessage(), and TRUE.

Referenced by getNextToken().

static void swapPointers ( char **  pointer1,
char **  pointer2 
)
static

swaps the addresses of two pointers

Parameters
pointer1first pointer
pointer2second pointer

Definition at line 393 of file reader_opb.c.

Referenced by getNextToken(), pushBufferToken(), pushToken(), and swapTokenBuffer().

static SCIP_Bool getNextToken ( SCIP scip,
OPBINPUT opbinput 
)
static

reads the next token from the input file into the token buffer; returns whether a token was read

Parameters
scipSCIP data structure
opbinputOPB reading data

Definition at line 407 of file reader_opb.c.

References FALSE, getNextLine(), isDelimChar(), isTokenChar(), isValueChar(), NULL, OPB_EXP_NONE, OPB_MAX_LINELEN, SCIP_Bool, SCIPdebugMessage, swapPointers(), and TRUE.

Referenced by getVariableOrTerm(), readCoefficients(), and readConstraints().

static void pushToken ( OPBINPUT opbinput)
static

puts the current token on the token stack, such that it is read at the next call to getNextToken()

Parameters
opbinputOPB reading data

Definition at line 513 of file reader_opb.c.

References NULL, OPB_MAX_PUSHEDTOKENS, and swapPointers().

Referenced by getVariableOrTerm(), and readCoefficients().

static void pushBufferToken ( OPBINPUT opbinput)
static

puts the buffered token on the token stack, such that it is read at the next call to getNextToken()

Parameters
opbinputOPB reading data

Definition at line 526 of file reader_opb.c.

References NULL, OPB_MAX_PUSHEDTOKENS, and swapPointers().

Referenced by readCoefficients().

static void swapTokenBuffer ( OPBINPUT opbinput)
static

swaps the current token with the token buffer

Parameters
opbinputOPB reading data

Definition at line 539 of file reader_opb.c.

References NULL, and swapPointers().

Referenced by readCoefficients().

static SCIP_Bool isEndLine ( OPBINPUT opbinput)
static

checks whether the current token is a section identifier, and if yes, switches to the corresponding section

Parameters
opbinputOPB reading data

Definition at line 550 of file reader_opb.c.

References FALSE, NULL, and TRUE.

Referenced by readCoefficients(), readConstraints(), and setObjective().

static SCIP_Bool isSign ( OPBINPUT opbinput,
int *  sign 
)
static

returns whether the current token is a sign

Parameters
opbinputOPB reading data
signpointer to update the sign

Definition at line 564 of file reader_opb.c.

References FALSE, NULL, and TRUE.

Referenced by readCoefficients(), and readConstraints().

static SCIP_Bool isValue ( SCIP scip,
OPBINPUT opbinput,
SCIP_Real value 
)
static

returns whether the current token is a value

Parameters
scipSCIP data structure
opbinputOPB reading data
valuepointer to store the value (unchanged, if token is no value)

Definition at line 591 of file reader_opb.c.

References FALSE, NULL, SCIPinfinity(), and TRUE.

Referenced by readCoefficients(), and readConstraints().

static SCIP_Bool isSense ( OPBINPUT opbinput,
OPBSENSE sense 
)
static

returns whether the current token is an equation sense

Parameters
opbinputOPB reading data
sensepointer to store the equation sense, or NULL

Definition at line 625 of file reader_opb.c.

References FALSE, NULL, OPB_SENSE_EQ, OPB_SENSE_GE, OPB_SENSE_LE, and TRUE.

Referenced by readCoefficients(), and readConstraints().

static SCIP_Bool isStartingSoftConstraintWeight ( SCIP scip,
OPBINPUT opbinput 
)
static

returns whether the current token is a value

Parameters
scipSCIP data structure
opbinputOPB reading data

Definition at line 656 of file reader_opb.c.

References FALSE, NULL, and TRUE.

Referenced by readCoefficients().

static SCIP_Bool isEndingSoftConstraintWeight ( SCIP scip,
OPBINPUT opbinput 
)
static

returns whether the current token is a value

Parameters
scipSCIP data structure
opbinputOPB reading data

Definition at line 672 of file reader_opb.c.

References FALSE, NULL, and TRUE.

Referenced by readCoefficients().

static SCIP_RETCODE createVariable ( SCIP scip,
SCIP_VAR **  var,
char *  name 
)
static

create binary variable with given name

Parameters
scipSCIP data structure
varpointer to store the variable
namename for the variable

Definition at line 688 of file reader_opb.c.

References NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_BINARY, SCIPaddVar(), SCIPcreateVar(), SCIPdebugMessage, SCIPgetBoolParam(), and SCIPreleaseVar().

Referenced by getVariableOrTerm(), and readConstraints().

static SCIP_RETCODE getVariableOrTerm ( SCIP scip,
OPBINPUT opbinput,
SCIP_VAR ***  vars,
int *  nvars,
int *  varssize 
)
static

returns the variable with the given name, or creates a new variable if it does not exist

Parameters
scipSCIP data structure
opbinputOPB reading data
varspointer to store the variables
nvarspointer to store the number of variables
varssizepointer to store the varsize, if changed (should already be initialized)

Definition at line 720 of file reader_opb.c.

References createVariable(), FALSE, getNextToken(), isTokenChar(), NULL, pushToken(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), SCIPfindVar(), SCIPgetNegatedVar(), SCIPreallocBufferArray, syntaxError(), and TRUE.

Referenced by readCoefficients().

static SCIP_RETCODE readCoefficients ( SCIP *const  scip,
OPBINPUT *const  opbinput,
char *const  name,
SCIP_VAR ***  linvars,
SCIP_Real **  lincoefs,
int *const  nlincoefs,
SCIP_VAR ****  terms,
SCIP_Real **  termcoefs,
int **  ntermvars,
int *const  ntermcoefs,
SCIP_Bool *const  newsection,
SCIP_Bool *const  isNonlinear,
SCIP_Bool *const  issoftcons,
SCIP_Real *const  weight 
)
static

reads an objective or constraint with name and coefficients

Parameters
scipSCIP data structure
opbinputOPB reading data
namepointer to store the name of the line; must be at least of size OPB_MAX_LINELEN
linvarspointer to store the array with linear variables (must be freed by caller)
lincoefspointer to store the array with linear coefficients (must be freed by caller)
nlincoefspointer to store the number of linear coefficients
termspointer to store the array with nonlinear variables (must be freed by caller)
termcoefspointer to store the array with nonlinear coefficients (must be freed by caller)
ntermvarspointer to store the number of nonlinear variables in the terms (must be freed by caller)
ntermcoefspointer to store the number of nonlinear coefficients
newsectionpointer to store whether a new section was encountered
isNonlinearpointer to store if we have a nonlinear constraint
issoftconspointer to store whether it is a soft constraint (for wbo files)
weightpointer to store the weight of the soft constraint

Definition at line 796 of file reader_opb.c.

References FALSE, getNextToken(), getVariableOrTerm(), hasError(), isEndingSoftConstraintWeight(), isEndLine(), isSense(), isSign(), isStartingSoftConstraintWeight(), isValue(), NULL, OPB_INIT_COEFSSIZE, pushBufferToken(), pushToken(), SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPcalcMemGrowSize(), SCIPdebugMessage, SCIPdebugPrintf, SCIPfeof(), SCIPfreeBufferArray, SCIPgetNConss(), SCIPgetNVars(), SCIPisIntegral(), SCIPisZero(), SCIPmemccpy(), SCIPreallocBufferArray, SCIPvarGetName(), SCIPwarningMessage(), swapTokenBuffer(), syntaxError(), and TRUE.

Referenced by readConstraints().

static SCIP_RETCODE setObjective ( SCIP *const  scip,
OPBINPUT *const  opbinput,
const char *  sense,
SCIP_VAR **const  linvars,
SCIP_Real *const  coefs,
int const  ncoefs,
SCIP_VAR ***const  terms,
SCIP_Real *const  termcoefs,
int *const  ntermvars,
int const  ntermcoefs 
)
static

set the objective section

Parameters
scipSCIP data structure
opbinputOPB reading data
senseobjective sense
linvarsarray of linear variables
coefsarray of objective values for linear variables
ncoefsnumber of coefficients for linear part
termsarray with nonlinear variables
termcoefsarray of objective values for nonlinear variables
ntermvarsnumber of nonlinear variables in the terms
ntermcoefsnumber of nonlinear coefficients

Definition at line 1149 of file reader_opb.c.

References ARTIFICIALVARNAMEPREFIX, FALSE, hasError(), isEndLine(), NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OBJSENSE_MAXIMIZE, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_INTEGER, SCIPaddCons(), SCIPaddOrigObjoffset(), SCIPaddVar(), SCIPchgVarBranchPriority(), SCIPchgVarObj(), SCIPcreateConsAnd(), SCIPcreateConsPseudoboolean(), SCIPcreateVar(), SCIPdebugAddSolVal, SCIPdebugGetSolVal, SCIPdebugPrintCons, SCIPisFeasEQ(), SCIPisFeasGE(), SCIPisFeasLE(), SCIPisFeasZero(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), SCIPvarGetNegationVar(), SCIPvarGetObj(), SCIPvarIsNegated(), and TRUE.

Referenced by readConstraints().

static SCIP_RETCODE getMaxAndConsDim ( SCIP scip,
OPBINPUT opbinput,
const char *  filename 
)
static

tries to read the first comment line which usually contains information about the max size of "and" products

Parameters
scipSCIP data structure
opbinputOPB reading data
filenamename of the input file

Definition at line 1575 of file reader_opb.c.

References commentchars, delimchars, FALSE, NULL, SCIP_Bool, SCIP_OKAY, SCIPdebugMessage, SCIPfclose(), SCIPfeof(), SCIPfgets(), SCIPfopen(), SCIPfseek(), and TRUE.

Referenced by readOPBFile().

static SCIP_RETCODE getBinVarsRepresentatives ( SCIP *const  scip,
SCIP_VAR **const  vars,
int const  nvars,
SCIP_Bool const  transformed 
)
static

transforms given and constraint variables to the corresponding active or negated variables

Parameters
scipSCIP data structure
varsvars array to get active variables for
nvarspointer to number of variables and values in vars and vals array
transformedtransformed constraint?

Definition at line 1753 of file reader_opb.c.

References NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPgetBinvarRepresentative(), SCIPgetNegatedVar(), SCIPisEQ(), SCIPisZero(), and SCIPvarGetOrigvarSum().

Referenced by computeAndConstraintInfos().

static SCIP_RETCODE getActiveVariables ( SCIP scip,
SCIP_VAR **  vars,
SCIP_Real scalars,
int *  nvars,
SCIP_Real constant,
SCIP_Bool  transformed 
)
static

transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant

Parameters
scipSCIP data structure
varsvars array to get active variables for
scalarsscalars a_1, ..., a_n in linear sum a_1*x_1 + ... + a_n*x_n + c
nvarspointer to number of variables and values in vars and vals array
constantpointer to constant c in linear sum a_1*x_1 + ... + a_n*x_n + c
transformedtransformed constraint?

Definition at line 1817 of file reader_opb.c.

References NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetOrigvarSum(), and TRUE.

Referenced by printLinearCons(), printNonLinearCons(), and printPseudobooleanCons().

static SCIP_RETCODE computeAndConstraintInfos ( SCIP *const  scip,
SCIP_Bool const  transformed,
SCIP_VAR ***  resvars,
int *  nresvars,
SCIP_VAR ****  andvars,
int **  nandvars,
SCIP_Bool *const  existandconshdlr,
SCIP_Bool *const  existands 
)
static
Parameters
scipSCIP data structure
transformedtransformed problem?
resvarspointer to store all resultant variables
nresvarspointer to store the number of all resultant variables
andvarspointer to store to all resultant variables their corresponding active( or negated) and-constraint variables
nandvarspointer to store the number of all corresponding and-variables to their corresponding resultant variable
existandconshdlrpointer to store whether the and-constrainthandler exists
existandspointer to store if their exists some and-constraints

Definition at line 1862 of file reader_opb.c.

References FALSE, getBinVarsRepresentatives(), NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPallocBufferArray, SCIPallocMemoryArray, SCIPconsGetHdlr(), SCIPconshdlrGetConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNConss(), SCIPdebug, SCIPdebugMessage, SCIPduplicateMemoryArray, SCIPfindConshdlr(), SCIPfreeBufferArray, SCIPgetNOrigConss(), SCIPgetNVarsAnd(), SCIPgetOrigConss(), SCIPgetResultantAnd(), SCIPgetVarsAnd(), SCIPprintVar(), SCIPreallocMemoryArray, SCIPsortedvecFindPtr(), SCIPsortPtrPtrInt(), SCIPwarningMessage(), and TRUE.

Referenced by SCIPwriteOpb().

static void clearBuffer ( char *  linebuffer,
int *  linecnt 
)
static

clears the given line buffer

Parameters
linebufferline
linecntnumber of characters in line

Definition at line 2059 of file reader_opb.c.

References NULL.

Referenced by printNLRow(), printPBRow(), printRow(), writeBuffer(), writeOpbObjective(), and writeOpbRelevantAnds().

static void writeBuffer ( SCIP scip,
FILE *  file,
char *  linebuffer,
int *  linecnt 
)
static

ends the given line with '\0' and prints it to the given file stream

Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
linebufferline
linecntnumber of characters in line

Definition at line 2074 of file reader_opb.c.

References clearBuffer(), NULL, and SCIPinfoMessage().

Referenced by appendBuffer(), printNLRow(), printPBRow(), printRow(), writeOpbObjective(), and writeOpbRelevantAnds().

static void appendBuffer ( SCIP scip,
FILE *  file,
char *  linebuffer,
int *  linecnt,
const char *  extension 
)
static

appends extension to line and prints it to the give file stream if the line buffer get full

Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
linebufferline buffer
linecntnumber of characters in line
extensionstring to extent the line

Definition at line 2096 of file reader_opb.c.

References NULL, OPB_MAX_LINELEN, and writeBuffer().

Referenced by printNLRow(), printPBRow(), printRow(), writeOpbObjective(), and writeOpbRelevantAnds().

static SCIP_RETCODE writeOpbObjective ( SCIP *const  scip,
FILE *const  file,
SCIP_VAR **const  vars,
int const  nvars,
SCIP_VAR **const  resvars,
int const  nresvars,
SCIP_VAR **const *const  andvars,
int const *const  nandvars,
SCIP_OBJSENSE const  objsense,
SCIP_Real const  objscale,
SCIP_Real const  objoffset,
char const *const  multisymbol,
SCIP_Bool const  existands,
SCIP_Bool const  transformed 
)
static

write objective function

Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used
varsarray with active (binary) variables
nvarsnumber of active variables in the problem
resvarsarray of resultant variables
nresvarsnumber of resultant variables
andvarscorresponding array of and-variables
nandvarsarray of numbers of corresponding and-variables
objsenseobjective sense
objscalescalar applied to objective function; external objective value is extobj = objsense * objscale * (intobj + objoffset)
objoffsetobjective offset from bound shifting and fixing
multisymbolthe multiplication symbol to use between coefficient and variable
existandsdoes some and-constraints exist?
transformedTRUE iff problem is the transformed problem

Definition at line 2119 of file reader_opb.c.

References appendBuffer(), clearBuffer(), FALSE, INDICATORVARNAME, NULL, OPB_MAX_LINELEN, SCIP_Bool, SCIP_INVALIDDATA, SCIP_Longint, SCIP_LONGINT_MAX, SCIP_OBJSENSE_MAXIMIZE, SCIP_OKAY, SCIP_VARSTATUS_NEGATED, SCIP_VARSTATUS_ORIGINAL, SCIPABORT, SCIPconsGetHdlr(), SCIPconshdlrGetConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNConss(), SCIPdebugMessage, SCIPerrorMessage, SCIPfindCons(), SCIPfindConshdlr(), SCIPgetCapacityKnapsack(), SCIPgetNVarsKnapsack(), SCIPgetNVarsLinear(), SCIPgetNVarsSetppc(), SCIPgetRhsLinear(), SCIPgetVarsKnapsack(), SCIPgetVarsLinear(), SCIPgetVarsSetppc(), SCIPinfoMessage(), SCIPisIntegral(), SCIPisZero(), SCIPround(), SCIPsnprintf(), SCIPsortedvecFindPtr(), SCIPvarGetIndex(), SCIPvarGetName(), SCIPvarGetNegationVar(), SCIPvarGetObj(), SCIPvarGetStatus(), SCIPvarIsNegated(), TOPCOSTCONSNAME, TRUE, and writeBuffer().

Referenced by writeOpb().

static SCIP_RETCODE printNLRow ( SCIP *const  scip,
FILE *const  file,
char const *const  type,
SCIP_VAR **const  vars,
SCIP_Real const *const  vals,
int const  nvars,
SCIP_Real  lhs,
SCIP_VAR **const  resvars,
int const  nresvars,
SCIP_VAR **const *const  andvars,
int const *const  nandvars,
SCIP_Longint  weight,
SCIP_Longint *const  mult,
char const *const  multisymbol 
)
static
Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
typerow type ("=" or ">=")
varsarray of variables
valsarray of values
nvarsnumber of variables
lhsleft hand side
resvarsarray of resultant variables
nresvarsnumber of resultant variables
andvarscorresponding array of and-variables
nandvarsarray of numbers of corresponding and-variables
weightif we found a soft constraint this is the weight, otherwise 0
multmultiplier for the coefficients
multisymbolthe multiplication symbol to use between coefficient and variable

Definition at line 2489 of file reader_opb.c.

References appendBuffer(), clearBuffer(), NULL, OPB_MAX_LINELEN, SCIP_Bool, SCIP_INVALIDDATA, SCIP_Longint, SCIP_LONGINT_MAX, SCIP_OKAY, SCIPerrorMessage, SCIPinfoMessage(), SCIPisIntegral(), SCIPisZero(), SCIPround(), SCIPsnprintf(), SCIPsortedvecFindPtr(), SCIPvarGetIndex(), SCIPvarGetName(), SCIPvarGetNegationVar(), SCIPvarIsNegated(), and writeBuffer().

Referenced by printNonLinearCons().

static SCIP_RETCODE printNonLinearCons ( SCIP *const  scip,
FILE *const  file,
SCIP_VAR **const  vars,
SCIP_Real *const  vals,
int const  nvars,
SCIP_Real const  lhs,
SCIP_Real const  rhs,
SCIP_VAR **const  resvars,
int const  nresvars,
SCIP_VAR **const *const  andvars,
int const *const  nandvars,
SCIP_Longint  weight,
SCIP_Bool const  transformed,
char const *const  multisymbol 
)
static

prints given maybe non-linear constraint information in OPB format to file stream

Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
varsarray of variables
valsarray of coefficients values (or NULL if all coefficient values are 1)
nvarsnumber of variables
lhsleft hand side
rhsright hand side
resvarsarray of resultant variables
nresvarsnumber of resultant variables
andvarscorresponding array of and-variables
nandvarsarray of numbers of corresponding and-variables
weightif we found a soft constraint this is the weight, otherwise 0
transformedtransformed constraint?
multisymbolthe multiplication symbol to use between coefficient and variable

Definition at line 2623 of file reader_opb.c.

References getActiveVariables(), NULL, printNLRow(), SCIP_CALL, SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPisEQ(), and SCIPisInfinity().

Referenced by writeOpbConstraints().

static SCIP_RETCODE printRow ( SCIP scip,
FILE *  file,
const char *  type,
SCIP_VAR **  vars,
SCIP_Real vals,
int  nvars,
SCIP_Real  lhs,
SCIP_Longint  weight,
SCIP_Longint mult,
const char *  multisymbol 
)
static
Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
typerow type ("=" or ">=")
varsarray of variables
valsarray of values
nvarsnumber of variables
lhsleft hand side
weightif we found a soft constraint this is the weight, otherwise 0
multmultiplier for the coefficients
multisymbolthe multiplication symbol to use between coefficient and variable

Definition at line 2721 of file reader_opb.c.

References appendBuffer(), clearBuffer(), INDICATORVARNAME, NULL, OPB_MAX_LINELEN, SCIP_Bool, SCIP_INVALIDDATA, SCIP_Longint, SCIP_LONGINT_MAX, SCIP_OKAY, SCIPerrorMessage, SCIPinfoMessage(), SCIPisIntegral(), SCIPisZero(), SCIPround(), SCIPsnprintf(), SCIPvarGetName(), SCIPvarGetNegationVar(), SCIPvarIsNegated(), and writeBuffer().

Referenced by printLinearCons().

static SCIP_RETCODE printLinearCons ( SCIP scip,
FILE *  file,
SCIP_VAR **  vars,
SCIP_Real vals,
int  nvars,
SCIP_Real  lhs,
SCIP_Real  rhs,
SCIP_Longint  weight,
SCIP_Bool  transformed,
const char *  multisymbol 
)
static

prints given linear constraint information in OPB format to file stream

Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
varsarray of variables
valsarray of coefficients values (or NULL if all coefficient values are 1)
nvarsnumber of variables
lhsleft hand side
rhsright hand side
weightif we found a soft constraint this is the weight, otherwise 0
transformedtransformed constraint?
multisymbolthe multiplication symbol to use between coefficient and variable

Definition at line 2816 of file reader_opb.c.

References getActiveVariables(), NULL, printRow(), SCIP_CALL, SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPisEQ(), and SCIPisInfinity().

Referenced by writeOpbConstraints().

static SCIP_RETCODE printPBRow ( SCIP *const  scip,
FILE *const  file,
const char *  type,
SCIP_VAR **const  linvars,
SCIP_Real *const  linvals,
int const  nlinvars,
SCIP_VAR ***const  termvars,
int *const  ntermvars,
SCIP_Real *const  termvals,
int const  ntermvals,
SCIP_Bool **const  negatedarrays,
SCIP_VAR *const  indvar,
SCIP_Real  lhs,
SCIP_Longint mult,
const char *  multisymbol 
)
static
Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
typerow type ("=" or ">=")
linvarsarray of variables
linvalsarray of values
nlinvarsnumber of variables
termvarsterm array with array of variables to print
ntermvarsarray with number of variables in each term
termvalsarray of coefficient values for non-linear variables
ntermvalsnumber non-linear variables in the problem
negatedarraysarray of arrays to know which variable in a non-linear part is negated
indvarindicator variable, or NULL
lhsleft hand side
multmultiplier for the coefficients
multisymbolthe multiplication symbol to use between coefficient and variable

Definition at line 2905 of file reader_opb.c.

References appendBuffer(), clearBuffer(), INDICATORVARNAME, NULL, OPB_MAX_LINELEN, SCIP_Bool, SCIP_INVALIDDATA, SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIPinfoMessage(), SCIPisIntegral(), SCIPisZero(), SCIPround(), SCIPsnprintf(), SCIPvarGetName(), SCIPvarGetNegationVar(), SCIPvarGetObj(), SCIPvarIsNegated(), and writeBuffer().

Referenced by printPseudobooleanCons().

static SCIP_RETCODE printPseudobooleanCons ( SCIP *const  scip,
FILE *const  file,
SCIP_VAR **const  linvars,
SCIP_Real *const  linvals,
int const  nlinvars,
SCIP_VAR ***const  termvars,
int *const  ntermvars,
SCIP_Real *const  termvals,
int const  ntermvals,
SCIP_VAR *const  indvar,
SCIP_Real const  lhs,
SCIP_Real const  rhs,
SCIP_Bool  transformed,
const char *  multisymbol 
)
static

prints given pseudo boolean constraint information in OPB format to file stream

Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used
linvarsarray with variables of linear part
linvalsarray of coefficients values of linear part
nlinvarsnumber variables in linear part of the problem
termvarsterm array with array of variables to print
ntermvarsarray with number of variables in each term
termvalsarray of coefficient values for non-linear variables
ntermvalsnumber non-linear variables in the problem
indvarindicator variable, or NULL
lhsleft hand side of constraint
rhsright hand side of constraint
transformedshould the transformed problem be printed ?
multisymbolthe multiplication symbol to use between coefficient and variable

Definition at line 3042 of file reader_opb.c.

References BMSclearMemoryArray, getActiveVariables(), NULL, printPBRow(), SCIP_Bool, SCIP_CALL, SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPgetBinvarRepresentatives(), SCIPisEQ(), and SCIPisInfinity().

Referenced by writeOpbConstraints().

static SCIP_RETCODE writeOpbConstraints ( SCIP *const  scip,
FILE *const  file,
SCIP_CONS **const  conss,
int const  nconss,
SCIP_VAR **const  vars,
int const  nvars,
SCIP_VAR **const  resvars,
int const  nresvars,
SCIP_VAR **const *const  andvars,
int const *const  nandvars,
char const *const  multisymbol,
SCIP_Bool const  existandconshdlr,
SCIP_Bool const  existands,
SCIP_Bool const  transformed 
)
static
Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used
conssarray with constraints of the problem
nconssnumber of constraints in the problem
varsarray with active (binary) variables
nvarsnumber of active variables in the problem
resvarsarray of resultant variables
nresvarsnumber of resultant variables
andvarscorresponding array of and-variables
nandvarsarray of numbers of corresponding and-variables
multisymbolthe multiplication symbol to use between coefficient and variable
existandconshdlrdoes and-constrainthandler exist?
existandsdoes some and-constraints exist?
transformedTRUE iff problem is the transformed problem

Definition at line 3195 of file reader_opb.c.

References FALSE, HASHTABLESIZE_FACTOR, NULL, printLinearCons(), printNonLinearCons(), printPseudobooleanCons(), SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIP_SETPPCTYPE_COVERING, SCIP_SETPPCTYPE_PACKING, SCIP_SETPPCTYPE_PARTITIONING, SCIP_VARSTATUS_AGGREGATED, SCIP_VARSTATUS_MULTAGGR, SCIP_VARSTATUS_NEGATED, SCIP_VARTYPE_BINARY, SCIPallocBufferArray, SCIPblkmem(), SCIPcalcHashtableSize(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNConss(), SCIPconsIsEnabled(), SCIPconsIsTransformed(), SCIPduplicateBufferArray, SCIPerrorMessage, SCIPfindConshdlr(), SCIPfreeBufferArray, SCIPgetAndDatasPseudoboolean(), SCIPgetBinaryVarIndicator(), SCIPgetCapacityKnapsack(), SCIPgetIndVarPseudoboolean(), SCIPgetLhsLinear(), SCIPgetLhsPseudoboolean(), SCIPgetLhsVarbound(), SCIPgetLinDatasWithoutAndPseudoboolean(), SCIPgetLinearConsIndicator(), SCIPgetLinearConsPseudoboolean(), SCIPgetNAndsPseudoboolean(), SCIPgetNLinVarsWithoutAndPseudoboolean(), SCIPgetNVarsAnd(), SCIPgetNVarsKnapsack(), SCIPgetNVarsLinear(), SCIPgetNVarsLogicor(), SCIPgetNVarsSetppc(), SCIPgetRhsLinear(), SCIPgetRhsPseudoboolean(), SCIPgetRhsVarbound(), SCIPgetSlackVarIndicator(), SCIPgetTypeSetppc(), SCIPgetValsLinear(), SCIPgetVarsAnd(), SCIPgetVarsKnapsack(), SCIPgetVarsLinear(), SCIPgetVarsLogicor(), SCIPgetVarsSetppc(), SCIPgetVarVarbound(), SCIPgetVbdcoefVarbound(), SCIPgetVbdvarVarbound(), SCIPgetWeightsKnapsack(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPhashmapInsert(), SCIPinfinity(), SCIPinfoMessage(), SCIPisGT(), SCIPprintCons(), SCIPvarGetNegationVar(), SCIPvarGetObj(), SCIPvarGetStatus(), SCIPvarGetType(), SCIPwarningMessage(), and TRUE.

Referenced by writeOpb().

static SCIP_RETCODE writeOpbRelevantAnds ( SCIP *const  scip,
FILE *const  file,
SCIP_VAR **const  resvars,
int const  nresvars,
SCIP_VAR **const *const  andvars,
int const *const  nandvars,
char const *const  multisymbol,
SCIP_Bool const  transformed 
)
static
Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used
resvarsarray of resultant variables
nresvarsnumber of resultant variables
andvarscorresponding array of and-variables
nandvarsarray of numbers of corresponding and-variables
multisymbolthe multiplication symbol to use between coefficient and variable
transformedTRUE iff problem is the transformed problem

Definition at line 3746 of file reader_opb.c.

References appendBuffer(), clearBuffer(), FALSE, NULL, OPB_MAX_LINELEN, SCIP_Bool, SCIP_CALL, SCIP_Longint, SCIP_OKAY, SCIPgetBinvarRepresentative(), SCIPisFeasIntegral(), SCIPsnprintf(), SCIPsortedvecFindPtr(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetNegationVar(), SCIPvarGetUbLocal(), SCIPvarIsActive(), SCIPvarIsNegated(), TRUE, and writeBuffer().

Referenced by writeOpb().

static SCIP_RETCODE writeOpb ( SCIP scip,
FILE *  file,
const char *  name,
SCIP_Bool  transformed,
SCIP_OBJSENSE  objsense,
SCIP_Real  objscale,
SCIP_Real  objoffset,
SCIP_VAR **  vars,
int  nvars,
SCIP_CONS **  conss,
int  nconss,
SCIP_VAR **const  resvars,
int const  nresvars,
SCIP_VAR **const *const  andvars,
int const *const  nandvars,
SCIP_Bool const  existandconshdlr,
SCIP_Bool const  existands,
SCIP_RESULT result 
)
static
Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used
nameproblem name
transformedTRUE iff problem is the transformed problem
objsenseobjective sense
objscalescalar applied to objective function; external objective value is extobj = objsense * objscale * (intobj + objoffset)
objoffsetobjective offset from bound shifting and fixing
varsarray with active (binary) variables
nvarsnumber of acitve variables in the problem
conssarray with constraints of the problem
nconssnumber of constraints in the problem
resvarsarray of resultant variables
nresvarsnumber of resultant variables
andvarscorresponding array of and-variables
nandvarsarray of numbers of corresponding and-variables
existandconshdlrdoes and-constrainthandler exist?
existandsdoes some and-constraints exist?
resultpointer to store the result of the file writing call

Definition at line 3968 of file reader_opb.c.

References NULL, OPB_MAX_LINELEN, READER_NAME, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_SUCCESS, SCIPgetBoolParam(), SCIPinfoMessage(), SCIPsnprintf(), writeOpbConstraints(), writeOpbObjective(), and writeOpbRelevantAnds().

Referenced by SCIPwriteOpb().

SCIP_RETCODE SCIPreadOpb ( SCIP scip,
SCIP_READER reader,
const char *  filename,
SCIP_RESULT result 
)

reads problem from file

Parameters
scipSCIP data structure
readerthe file reader itself
filenamefull path and name of file to read, or NULL if stdin should be used
resultpointer to store the result of the file reading call

Definition at line 4035 of file reader_opb.c.

References FALSE, NULL, OPB_MAX_LINELEN, OPB_MAX_PUSHEDTOKENS, readOPBFile(), SCIP_CALL, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_READERROR, SCIP_SUCCESS, SCIPallocBufferArray, SCIPfreeBufferArrayNull, SCIPinfinity(), SCIPsetObjsense(), and SCIPwarningMessage().

Referenced by SCIP_DECL_READERREAD().

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 
)

writes problem to file

Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used
nameproblem name
transformedTRUE iff problem is the transformed problem
objsenseobjective sense
objscalescalar applied to objective function; external objective value is extobj = objsense * objscale * (intobj + objoffset)
objoffsetobjective offset from bound shifting and fixing
varsarray with active variables ordered binary, integer, implicit, continuous
nvarsnumber of active variables in the problem
nbinvarsnumber of binary variables
nintvarsnumber of general integer variables
nimplvarsnumber of implicit integer variables
ncontvarsnumber of continuous variables
fixedvarsarray with fixed variables
nfixedvarsnumber of fixed and aggregated variables in the problem
conssarray with constraints of the problem
nconssnumber of constraints in the problem
genericnamesshould generic variable and constraint names be used
resultpointer to store the result of the file writing call

Definition at line 4110 of file reader_opb.c.

References computeAndConstraintInfos(), FALSE, INDICATORSLACKVARNAME, INDICATORVARNAME, NULL, SCIP_Bool, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_SUCCESS, SCIP_WRITEERROR, SCIPconshdlrGetNConss(), SCIPfindConshdlr(), SCIPfreeMemoryArray, SCIPprintOrigProblem(), SCIPprintTransProblem(), SCIPprintVar(), SCIPsortedvecFindPtr(), SCIPvarGetName(), SCIPwarningMessage(), TRUE, and writeOpb().

Referenced by SCIP_DECL_READERWRITE().

static SCIP_DECL_READERCOPY ( readerCopyOpb  )
static

copy method for reader plugins (called when SCIP copies plugins)

Definition at line 4287 of file reader_opb.c.

References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderOpb(), and SCIPreaderGetName().

static SCIP_DECL_READERREAD ( readerReadOpb  )
static

problem reading method of reader

Definition at line 4302 of file reader_opb.c.

References SCIP_CALL, SCIP_OKAY, and SCIPreadOpb().

static SCIP_DECL_READERWRITE ( readerWriteOpb  )
static

problem writing method of reader

Definition at line 4313 of file reader_opb.c.

References SCIP_CALL, SCIP_OKAY, and SCIPwriteOpb().

SCIP_RETCODE SCIPincludeReaderOpb ( SCIP scip)

includes the opb file reader in SCIP

Parameters
scipSCIP data structure

Definition at line 4327 of file reader_opb.c.

References FALSE, NULL, READER_DESC, READER_EXTENSION, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPaddBoolParam(), SCIPincludeReaderBasic(), SCIPsetReaderCopy(), SCIPsetReaderRead(), SCIPsetReaderWrite(), and TRUE.

Referenced by SCIP_DECL_READERCOPY(), and SCIPincludeDefaultPlugins().

Variable Documentation

const char commentchars[] = "*"
static

Definition at line 168 of file reader_opb.c.

Referenced by getMaxAndConsDim(), and getNextLine().