42#define READER_NAME "colreader"
43#define READER_DESC "file reader for a .col-file representing a graph that should be colored"
44#define READER_EXTENSION "col"
46#define COL_MAX_LINELEN 1024
62 while ( isspace(**s) )
67 while ( (**s != 0) && (!isspace(**s)) )
109 while ( (filename[
i] !=
'/') && (filename[
i] !=
'\0') )
113 if ( filename[
i] !=
'/' )
121 while ( filename[
i] ==
'/' && filename[j] !=
'\0' )
124 while ( filename[j] !=
'\0' )
127 if ( filename[j] ==
'/' )
140 (void) strncpy(probname, &filename[
i+1], (j-
i-5));
141 probname[j-
i-5]=
'\0';
144 while( !
SCIPfeof(fp) && (buf[0] !=
'p') )
157 if ( buf[2] !=
'e' || buf[3] !=
'd' || buf[4] !=
'g' || buf[5] !=
'e' )
165 if ( *char_p ==
's' )
187 for(
i = 0;
i < nedges;
i++)
199 duplicateedge =
FALSE;
204 for ( j = 0; j <
i; j++)
206 if ( ((edges[j][0] == begin) && (edges[j][1] == end))
207 || ((edges[j][1] == begin) && (edges[j][0] == end)) )
209 duplicateedge =
TRUE;
214 if ( !duplicateedge )
218 SCIPerrorMessage(
"more edges than expected: expected %d many, but got already %d'th (non-duplicate) edge", nedges,
i+1);
229 if(
i + nduplicateedges != nedges )
231 SCIPerrorMessage(
"incorrect number of edges: expected %d many, but got %d many\n", nedges,
i + nduplicateedges);
235 printf(
"Read graph: %d nodes, %d edges (%d duplicates)\n",
nnodes, nedges, nduplicateedges);
247 for (
i = nedges-1;
i >= 0;
i--)
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
int SCIPfeof(SCIP_FILE *stream)
int SCIPfclose(SCIP_FILE *fp)
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
SCIP_RETCODE SCIPsetObjIntegral(SCIP *scip)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_PRICER * SCIPfindPricer(SCIP *scip, const char *name)
SCIP_RETCODE SCIPactivatePricer(SCIP *scip, SCIP_PRICER *pricer)
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 SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader,)
const char * SCIPreaderGetName(SCIP_READER *reader)
assert(minobj< SCIPgetCutoffbound(scip))
SCIP_RETCODE SCIPcreateProbColoring(SCIP *scip, const char *name, int nnodes, int nedges, int **edges)
SCIP_RETCODE COLORprobSetUpArrayOfCons(SCIP *scip)
struct SCIP_File SCIP_FILE
SCIP_RETCODE SCIPincludeReaderCol(SCIP *scip)
static SCIP_RETCODE readCol(SCIP *scip, const char *filename)
static long getNextNumber(char **s)
file reader for vertex coloring instances
struct SCIP_ReaderData SCIP_READERDATA
struct SCIP_Reader SCIP_READER
#define SCIP_DECL_READERREAD(x)
#define SCIP_DECL_READERCOPY(x)
enum SCIP_Retcode SCIP_RETCODE