cmin file reader
Definition in file reader_cmin.c.
#include <stdlib.h>#include <assert.h>#include <string.h>#include <strings.h>#include <ctype.h>#include "scip/cons_linear.h"#include "scip/cons_setppc.h"#include "scip/cons_knapsack.h"#include "cons_optcumulative.h"#include "heur_optcumulative.h"#include "reader_cmin.h"Go to the source code of this file.
Data Structures | |
| struct | CminInput |
Macros | |
| #define | READER_NAME "cminreader" |
| #define | READER_DESC "file reader for cmin file format" |
| #define | READER_EXTENSION "cmin" |
| #define | DEFAULT_FILENAME "-" |
| #define | DEFAULT_DUALREDUCTION TRUE |
| #define | DEFAULT_MIP FALSE |
| #define | DEFAULT_INITIAL TRUE |
| #define | DEFAULT_CIP TRUE |
| #define | DEFAULT_RELAXATION 3 |
Functions | |
| static void | syntaxError (SCIP *scip, CMININPUT *cmininput, const char *msg) |
| static SCIP_Bool | getNextLine (CMININPUT *cmininput) |
| static SCIP_Bool | isDelimChar (char c) |
| static SCIP_Bool | getNextToken (CMININPUT *cmininput) |
| static SCIP_RETCODE | findBestObjectiveValue (SCIP *scip, SCIP_Real *objval) |
| static void | createSortedEventpoints (SCIP *scip, int *releasedates, int *deadlinedates, int *starttimes, int *endtimes, int *startindices, int *endindices, int njobs) |
| static SCIP_Longint | computeMaxEnergy (int njobs, int *durations, int *demands, int *releasedates, int *deadlinedates, int starttime, int endtime) |
| static int | removeRedundantRows (SCIP_Longint *rowtightness, int *startidxs, int nrows, SCIP_Longint tightness) |
| static SCIP_RETCODE | createIntervalRelaxation (SCIP *scip, int relaxation, int resource, SCIP_VAR **vars, int *durations, int *demands, int capacity, int *releasedates, int *deadlinedates, int njobs) |
| static SCIP_RETCODE | createMipFormulation (SCIP *scip, int **durations, int **demands, int **costs, int *capacities, int *releasedates, int *deadlinedates, int njobs, int nmachines) |
| static SCIP_RETCODE | createMipCpFormulation (SCIP *scip, int **durations, int **demands, int **costs, int *capacities, int *releasedates, int *deadlinedates, int njobs, int nmachines) |
| static SCIP_RETCODE | createCipFormulation (SCIP *scip, int **durations, int **demands, int **costs, int *capacities, int *releasedates, int *deadlinedates, int njobs, int nmachines) |
| static SCIP_RETCODE | readFile (SCIP *scip, CMININPUT *cmininput, const char *filename) |
| static | SCIP_DECL_READERREAD (readerReadCmin) |
| SCIP_RETCODE | SCIPincludeReaderCmin (SCIP *scip) |
Variables | |
| static const char | delimchars [] = " \f\n\r\t\v" |
| #define READER_NAME "cminreader" |
Definition at line 49 of file reader_cmin.c.
| #define READER_DESC "file reader for cmin file format" |
Definition at line 50 of file reader_cmin.c.
| #define READER_EXTENSION "cmin" |
Definition at line 51 of file reader_cmin.c.
| #define DEFAULT_FILENAME "-" |
name of the file including best known solutions
Definition at line 53 of file reader_cmin.c.
| #define DEFAULT_DUALREDUCTION TRUE |
add locks to avoid dual reductions
Definition at line 54 of file reader_cmin.c.
Referenced by SCIPincludeReaderCmin().
| #define DEFAULT_MIP FALSE |
create a MIP formulation
Definition at line 55 of file reader_cmin.c.
Referenced by SCIPincludeReaderCmin().
| #define DEFAULT_INITIAL TRUE |
should model constraints be in initial LP?
Definition at line 56 of file reader_cmin.c.
Referenced by SCIPincludeReaderCmin().
| #define DEFAULT_CIP TRUE |
create a CIP formulation
Definition at line 57 of file reader_cmin.c.
Referenced by SCIPincludeReaderCmin().
| #define DEFAULT_RELAXATION 3 |
which relaxation should be added to the maseter (0: none; 1: single; 2: edge-finding; 3: energetic-reasoning
Definition at line 58 of file reader_cmin.c.
Referenced by SCIPincludeReaderCmin().
Definition at line 77 of file reader_cmin.c.
issues an error message and marks the LP data to have errors
Definition at line 81 of file reader_cmin.c.
References assert(), CminInput::haserror, CminInput::linebuf, CminInput::linenumber, NULL, SCIP_VERBLEVEL_MINIMAL, SCIPverbMessage(), CminInput::token, and TRUE.
Referenced by readFile().
gets the next line out of the file stream
| cmininput | CMIN reading data |
Definition at line 99 of file reader_cmin.c.
References assert(), BMSclearMemoryArray, FALSE, CminInput::file, CminInput::haserror, CminInput::linebuf, CminInput::linenumber, CminInput::linepos, NULL, SCIP_Bool, SCIP_MAXSTRLEN, SCIPdebugMessage, SCIPfgets(), and TRUE.
Referenced by getNextToken().
|
static |
returns whether the given character is a token delimiter
| c | input character |
Definition at line 132 of file reader_cmin.c.
References c, delimchars, NULL, and SCIP_Bool.
Referenced by getNextToken().
reads the next token from the input file into the token buffer; returns whether a token was read
| cmininput | CMIN reading data |
Definition at line 141 of file reader_cmin.c.
References assert(), FALSE, getNextLine(), isDelimChar(), CminInput::linebuf, CminInput::linenumber, CminInput::linepos, NULL, SCIP_Bool, SCIP_MAXSTRLEN, SCIPdebugMessage, CminInput::token, and TRUE.
Referenced by readFile().
|
static |
method parses the best known solution for the total leftover out of the give file; if file does not exist or the problem is not listed the best known solution is set to -1 which means unknown
Definition at line 192 of file reader_cmin.c.
References assert(), FALSE, CminInput::file, NULL, objval, READER_NAME, SCIP_Bool, SCIP_CALL, SCIP_INVALIDCALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPfclose(), SCIPfgets(), SCIPfopen(), SCIPgetProbName(), SCIPgetStringParam(), SCIPinfinity(), SCIPsnprintf(), SCIPstrtok(), SCIPwarningMessage(), CminInput::token, and TRUE.
Referenced by createCipFormulation().
|
static |
initialize the sorted event point arrays
| scip | SCIP data structure |
| releasedates | release dates |
| deadlinedates | deadline dates |
| starttimes | array to store sorted start events |
| endtimes | array to store sorted end events |
| startindices | permutation with rspect to the start times |
| endindices | permutation with rspect to the end times |
| njobs | number of jobs |
Definition at line 302 of file reader_cmin.c.
References SCIPsortIntInt().
Referenced by createIntervalRelaxation().
|
static |
computes the maximum energy for all variables which correspond to jobs which start between the given start time and end time
| njobs | number of jobs |
| durations | durations |
| demands | demands |
| releasedates | release dates |
| deadlinedates | deadline dates |
| starttime | start time |
| endtime | end time |
Definition at line 336 of file reader_cmin.c.
References assert(), and SCIP_Longint.
Referenced by createIntervalRelaxation().
|
static |
remove row which have a tightness which is smaller or equal to the given one
| rowtightness | array containing the tightness for the previously selected rows |
| startidxs | array containing for each row the index for the start event |
| nrows | current number of rows |
| tightness | tightness to use to detect redundant rows |
Definition at line 367 of file reader_cmin.c.
References SCIP_Longint.
Referenced by createIntervalRelaxation().
|
static |
create interval relaxation for given sub-problem
| scip | SCIP data structure |
| relaxation | a linear relaxation base on edge-finding idea or energetic-reasoning idea |
| resource | resource id |
| vars | assignment variables |
| durations | durations |
| demands | demands |
| capacity | machine capacity |
| releasedates | release dates |
| deadlinedates | deadline dates |
| njobs | number of jobs |
Definition at line 394 of file reader_cmin.c.
References assert(), BMSclearMemoryArray, computeMaxEnergy(), createSortedEventpoints(), i, MIN, MIN3, NULL, removeRedundantRows(), SCIP_CALL, SCIP_Longint, SCIP_LONGINT_FORMAT, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPaddCoefKnapsack(), SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsBasicKnapsack(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPinfoMessage(), SCIPreleaseCons(), SCIPsnprintf(), and vars.
Referenced by createMipFormulation().
|
static |
create MIP formulation and CP constraints
| scip | SCIP data structure |
| durations | durations |
| demands | demands |
| costs | cost |
| capacities | machine capacities |
| releasedates | release dates |
| deadlinedates | deadline dates |
| njobs | number of jobs |
| nmachines | number of machines |
Definition at line 566 of file reader_cmin.c.
References createIntervalRelaxation(), h, i, MAX, MIN, NULL, objval, READER_NAME, SCIP_CALL, SCIP_Longint, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPaddCoefKnapsack(), SCIPaddCoefLinear(), SCIPaddCoefSetppc(), SCIPaddCons(), SCIPaddVar(), SCIPallocBufferArray, SCIPcreateConsBasicKnapsack(), SCIPcreateConsBasicLinear(), SCIPcreateConsBasicSetpart(), SCIPcreateVarBasic(), SCIPfreeBufferArray, SCIPgetIntParam(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), var, and vars.
Referenced by readFile().
|
static |
create MIP formulation
| scip | SCIP data structure |
| durations | durations |
| demands | demands |
| costs | cost |
| capacities | machine capacities |
| releasedates | release dates |
| deadlinedates | deadline dates |
| njobs | number of jobs |
| nmachines | number of machines |
Definition at line 784 of file reader_cmin.c.
References BMSclearMemoryArray, FALSE, h, i, MAX, MIN, NULL, SCIP_CALL, SCIP_IMPLINTTYPE_STRONG, SCIP_Longint, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIPaddCoefKnapsack(), SCIPaddCoefLinear(), SCIPaddCoefSetppc(), SCIPaddCons(), SCIPaddVar(), SCIPallocBufferArray, SCIPcreateConsKnapsack(), SCIPcreateConsLinear(), SCIPcreateConsOptcumulative(), SCIPcreateConsSetpart(), SCIPcreateVar(), SCIPcreateVarImpl(), SCIPfreeBufferArray, SCIPgetNegatedVar(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), TRUE, var, and vars.
Referenced by readFile().
|
static |
create CIP formulation
| scip | SCIP data structure |
| durations | durations |
| demands | demands |
| costs | cost |
| capacities | machine capacities |
| releasedates | release dates |
| deadlinedates | deadline dates |
| njobs | number of jobs |
| nmachines | number of machines |
Definition at line 998 of file reader_cmin.c.
References BMSclearMemoryArray, FALSE, findBestObjectiveValue(), i, NULL, nvars, objval, READER_NAME, SCIP_Bool, SCIP_CALL, SCIP_LOCKTYPE_MODEL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_INTEGER, SCIPaddCoefSetppc(), SCIPaddCons(), SCIPaddVar(), SCIPaddVarLocksType(), SCIPallocBufferArray, SCIPcreateConsBasicSetpart(), SCIPcreateConsOptcumulative(), SCIPcreateVarBasic(), SCIPfreeBufferArray, SCIPgetBoolParam(), SCIPgetIntParam(), SCIPinitHeurOptcumulative(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsetObjlimit(), SCIPsnprintf(), separate(), TRUE, var, and vars.
Referenced by readFile().
|
static |
read given file and create corresponding problem
Definition at line 1148 of file reader_cmin.c.
References assert(), createCipFormulation(), createMipCpFormulation(), createMipFormulation(), FALSE, getNextToken(), CminInput::haserror, i, NULL, READER_NAME, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPcreateProbBasic(), SCIPdebug, SCIPdebugMessage, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPgetBoolParam(), SCIPsplitFilename(), syntaxError(), and CminInput::token.
Referenced by SCIP_DECL_READERREAD().
|
static |
problem reading method of reader
Definition at line 1339 of file reader_cmin.c.
References FALSE, CminInput::file, CminInput::haserror, CminInput::linebuf, CminInput::linenumber, CminInput::linepos, NULL, readFile(), result, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_NOFILE, SCIP_OKAY, SCIP_READERROR, SCIP_SUCCESS, SCIPallocBufferArray, SCIPfclose(), SCIPfopen(), SCIPfreeBufferArray, and CminInput::token.
| SCIP_RETCODE SCIPincludeReaderCmin | ( | SCIP * | scip | ) |
includes the cp file reader in SCIP
Definition at line 1381 of file reader_cmin.c.
References DEFAULT_CIP, DEFAULT_DUALREDUCTION, DEFAULT_FILENAME, DEFAULT_INITIAL, DEFAULT_MIP, DEFAULT_RELAXATION, FALSE, NULL, READER_DESC, READER_EXTENSION, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPaddBoolParam(), SCIPaddIntParam(), SCIPaddStringParam(), SCIPincludeReaderBasic(), SCIPsetReaderRead(), and TRUE.
Referenced by runShell().
|
static |
Definition at line 60 of file reader_cmin.c.