assert(lpinput !=
NULL);
130 SCIPerrorMessage(
"Syntax error in line %d ('%s'): %s \n", lpinput->linenumber, lpinput->token, msg);
131 if( lpinput->linebuf[lpinput->linebufsize - 1] ==
'\n')
139(void)
SCIPsnprintf(formatstr, 256,
" %%%ds\n", lpinput->linepos);
141lpinput->section =
LP_END;
142lpinput->haserror =
TRUE;
151assert(lpinput !=
NULL);
153 returnlpinput->haserror;
211assert(hasdot !=
NULL);
212assert(exptype !=
NULL);
214 if( isdigit((
unsigned char)c) )
216 else if( (*exptype ==
LP_EXP_NONE) && !(*hasdot) && (c ==
'.') && isdigit((
unsigned char)nextc) )
221 else if( !firstchar && (*exptype ==
LP_EXP_NONE) && (c ==
'e'|| c ==
'E') )
223 if( nextc ==
'+'|| nextc ==
'-')
228 else if( isdigit((
unsigned char)nextc) )
234 else if( (*exptype ==
LP_EXP_SIGNED) && (c ==
'+'|| c ==
'-') )
254assert(lpinput !=
NULL);
257lpinput->linepos = 0;
258lpinput->linebuf[lpinput->linebufsize - 2] =
'\0';
260 if(
SCIPfgets(lpinput->linebuf, lpinput->linebufsize, lpinput->file) ==
NULL)
268lpinput->linenumber++;
271 while( lpinput->linebuf[lpinput->linebufsize - 2] !=
'\0')
278lpinput->linebuf[newsize-2] =
'\0';
279 if(
SCIPfgets(lpinput->linebuf + lpinput->linebufsize - 1, newsize - lpinput->linebufsize + 1, lpinput->file) ==
NULL)
281lpinput->linebufsize = newsize;
283lpinput->linebuf[lpinput->linebufsize - 1] =
'\0';
290commentstart = strchr(lpinput->linebuf,
commentchars[i]);
291 if( commentstart !=
NULL)
293*commentstart =
'\0';
294*(commentstart+1) =
'\0';
313*pointer1 = *pointer2;
329assert(lpinput !=
NULL);
330assert(lpinput->linepos < lpinput->linebufsize);
333 if( lpinput->npushedtokens > 0 )
335 swapPointers(&lpinput->token, &lpinput->pushedtokens[lpinput->npushedtokens-1]);
336lpinput->npushedtokens--;
338 SCIPdebugMsg(
scip,
"(line %d) read token again: '%s'\n", lpinput->linenumber, lpinput->token);
343buf = lpinput->linebuf;
346 if( buf[lpinput->linepos] ==
'\0')
350lpinput->section =
LP_END;
354assert(lpinput->linepos == 0);
356buf = lpinput->linebuf;
361assert(lpinput->linepos < lpinput->linebufsize);
363assert(buf[lpinput->linepos] !=
'\0');
368 if(
isValueChar(buf[lpinput->linepos], buf[lpinput->linepos+1],
TRUE, &hasdot, &exptype) )
376lpinput->token[tokenlen] = buf[lpinput->linepos];
380 while(
isValueChar(buf[lpinput->linepos], buf[lpinput->linepos+1],
FALSE, &hasdot, &exptype) );
389lpinput->token[tokenlen] = buf[lpinput->linepos];
392 if( tokenlen == 1 &&
isTokenChar(lpinput->token[0]) )
401 if( tokenlen >= 1 && lpinput->token[tokenlen-1] ==
'^'&& buf[lpinput->linepos] ==
'2')
406&& (lpinput->token[tokenlen-1] ==
'<'|| lpinput->token[tokenlen-1] ==
'>'|| lpinput->token[tokenlen-1] ==
'=')
407&& buf[lpinput->linepos] ==
'=')
411 else if( lpinput->token[tokenlen-1] ==
'='&& (buf[lpinput->linepos] ==
'<'|| buf[lpinput->linepos] ==
'>') )
413lpinput->token[tokenlen-1] = buf[lpinput->linepos];
418lpinput->token[tokenlen] =
'\0';
420 SCIPdebugMsg(
scip,
"(line %d) read token: '%s'\n", lpinput->linenumber, lpinput->token);
431assert(lpinput !=
NULL);
434 swapPointers(&lpinput->pushedtokens[lpinput->npushedtokens], &lpinput->token);
435lpinput->npushedtokens++;
444assert(lpinput !=
NULL);
447 swapPointers(&lpinput->pushedtokens[lpinput->npushedtokens], &lpinput->tokenbuf);
448lpinput->npushedtokens++;
457assert(lpinput !=
NULL);
472assert(lpinput !=
NULL);
481iscolon = (*lpinput->token ==
':');
492len = strlen(lpinput->token);
496 if( len > 1 && (len < 9 || len == 15) )
501 while( lpinput->token[c] !=
'\0')
503token[c] = toupper(lpinput->token[c]);
509 if( (len == 3 && strcmp(token,
"MIN") == 0)
510|| (len == 7 && strcmp(token,
"MINIMUM") == 0)
511|| (len == 8 && strcmp(token,
"MINIMIZE") == 0) )
513 SCIPdebugMsg(
scip,
"(line %d) new section: OBJECTIVE\n", lpinput->linenumber);
519 if( (len == 3 && strcmp(token,
"MAX") == 0)
520|| (len == 7 && strcmp(token,
"MAXIMUM") == 0)
521|| (len == 8 && strcmp(token,
"MAXIMIZE") == 0) )
523 SCIPdebugMsg(
scip,
"(line %d) new section: OBJECTIVE\n", lpinput->linenumber);
529 if( len == 3 && strcmp(token,
"END") == 0 )
531 SCIPdebugMsg(
scip,
"(line %d) new section: END\n", lpinput->linenumber);
532lpinput->section =
LP_END;
547assert(lpinput !=
NULL);
548assert(sign !=
NULL);
549assert(*sign == +1 || *sign == -1);
551 if( lpinput->token[1] ==
'\0')
553 if( *lpinput->token ==
'+')
555 else if( *lpinput->token ==
'-')
573assert(lpinput !=
NULL);
574assert(value !=
NULL);
586val = strtod(lpinput->token, &endptr);
587 if( endptr != lpinput->token && *endptr ==
'\0')
604assert(lpinput !=
NULL);
606 if( strcmp(lpinput->token,
"<") == 0 )
612 else if( strcmp(lpinput->token,
">") == 0 )
618 else if( strcmp(lpinput->token,
"=") == 0 )
636assert(name !=
NULL);
637assert(var !=
NULL);
654assert(lpinput !=
NULL);
688assert(lpinput !=
NULL);
689assert(name !=
NULL);
690assert(coefssize !=
NULL);
691assert(vars !=
NULL);
692assert(coefs !=
NULL);
693assert(ncoefs !=
NULL);
694assert(newsection !=
NULL);
701*newsection =
FALSE;
719 if( strcmp(lpinput->token,
":") == 0 )
725 SCIPdebugMsg(
scip,
"(line %d) read constraint name: '%s'\n", lpinput->linenumber, name);
757 if(
isSign(lpinput, &coefsign) )
759 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", lpinput->linenumber, coefsign);
767 SCIPdebugMsg(
scip,
"(line %d) read coefficient value: %g with sign %+d\n", lpinput->linenumber, coef, coefsign);
794 if( (isobjective || (!havevalue && !havesign)) &&
isNewSection(
scip, lpinput) )
796 if( havesign && !havevalue )
798 SCIPwarningMessage(
scip,
"skipped single sign %c without value or variable in objective\n", coefsign == 1 ?
'+':
'-');
800 else if( isobjective && havevalue && !
SCIPisZero(
scip, coef) )
810 if( *lpinput->token ==
'[')
812 syntaxError(
scip, lpinput,
"diff reader does not support quadratic objective function.");
817 if( *ncoefs > 0 && !havesign )
819 syntaxError(
scip, lpinput,
"expected sign ('+' or '-') or sense ('<' or '>').");
824 if( *lpinput->token ==
'^')
826 syntaxError(
scip, lpinput,
"diff reader does not support quadratic objective function.");
840 if( *ncoefs >= *coefssize )
844oldcoefssize = *coefssize;
846*coefssize =
MAX(*coefssize, (*ncoefs)+1);
850assert(*ncoefs < *coefssize);
853(*vars)[*ncoefs] = var;
854(*coefs)[*ncoefs] = coefsign * coef;
882assert(lpinput !=
NULL);
902 const char* filename
905assert(lpinput !=
NULL);
908lpinput->file =
SCIPfopen(filename,
"r");
909 if( lpinput->file ==
NULL)
930 switch( lpinput->section )
962assert(reader !=
NULL);
1015 const char* filename,
1023assert(reader !=
NULL);
1026lpinput.file =
NULL;
1028lpinput.linebuf[0] =
'\0';
1030lpinput.probname[0] =
'\0';
1031lpinput.objname[0] =
'\0';
1033lpinput.token[0] =
'\0';
1035lpinput.tokenbuf[0] =
'\0';
1041lpinput.npushedtokens = 0;
1042lpinput.linenumber = 0;
1043lpinput.linepos = 0;
1046lpinput.haserror =
FALSE;
1061 if( lpinput.haserror )
#define SCIP_CALL_ABORT(x)
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
int SCIPfclose(SCIP_FILE *fp)
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
SCIP_RETCODE SCIPreadDiff(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
SCIP_RETCODE SCIPincludeReaderDiff(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_RETCODE SCIPchgReoptObjective(SCIP *scip, SCIP_OBJSENSE objsense, SCIP_VAR **vars, SCIP_Real *coefs, int nvars)
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERFREE((*readerfree)))
const char * SCIPreaderGetName(SCIP_READER *reader)
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
SCIP_Bool SCIPisReoptEnabled(SCIP *scip)
SCIP_RETCODE SCIPfreeReoptSolve(SCIP *scip)
SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
const char * SCIPvarGetName(SCIP_VAR *var)
int SCIPstrcasecmp(const char *s1, const char *s2)
int SCIPsnprintf(char *t, int len, const char *s,...)
void SCIPprintSysError(const char *message)
int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
#define BMSclearMemoryArray(ptr, num)
wrapper functions to map file i/o to standard or zlib file i/o
struct SCIP_File SCIP_FILE
public methods for message output
public data structures and miscellaneous methods
public methods for input file readers
public methods for problem variables
#define LP_INIT_COEFSSIZE
static SCIP_DECL_READERCOPY(readerCopyDiff)
static SCIP_Bool isSign(LPINPUT *lpinput, int *sign)
static SCIP_Bool isNewSection(SCIP *scip, LPINPUT *lpinput)
static SCIP_Bool hasError(LPINPUT *lpinput)
static void pushToken(LPINPUT *lpinput)
static SCIP_Bool getNextLine(SCIP *scip, LPINPUT *lpinput)
static SCIP_RETCODE getVariable(SCIP *scip, char *name, SCIP_VAR **var)
static void swapTokenBuffer(LPINPUT *lpinput)
static SCIP_Bool getNextToken(SCIP *scip, LPINPUT *lpinput)
static const char commentchars[]
static SCIP_Bool isValueChar(char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, LPEXPTYPE *exptype)
#define LP_MAX_PUSHEDTOKENS
static SCIP_DECL_READERREAD(readerReadDiff)
static SCIP_RETCODE readObjective(SCIP *scip, LPINPUT *lpinput)
static SCIP_Bool isValue(SCIP *scip, LPINPUT *lpinput, SCIP_Real *value)
static void syntaxError(SCIP *scip, LPINPUT *lpinput, const char *msg)
static void pushBufferToken(LPINPUT *lpinput)
static SCIP_RETCODE readCoefficients(SCIP *scip, LPINPUT *lpinput, SCIP_Bool isobjective, char *name, int *coefssize, SCIP_VAR ***vars, SCIP_Real **coefs, int *ncoefs, SCIP_Bool *newsection)
static SCIP_Bool isSense(LPINPUT *lpinput, LPSENSE *sense)
static SCIP_Bool isDelimChar(char c)
static void swapPointers(char **pointer1, char **pointer2)
static SCIP_DECL_READERFREE(readerFreeDiff)
static SCIP_RETCODE readStart(SCIP *scip, LPINPUT *lpinput)
static SCIP_RETCODE readDiffFile(SCIP *scip, LPINPUT *lpinput, const char *filename)
static SCIP_Bool isTokenChar(char c)
public methods for memory management
public methods for message handling
public methods for numerical tolerances
public methods for global and local (sub)problems
public methods for reader plugins
enum SCIP_Objsense SCIP_OBJSENSE
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4