49#define READER_NAME "csolreader"
50#define READER_DESC "file reader which reads and writes csol-files"
51#define READER_EXTENSION "csol"
53#define COL_MAX_LINELEN 65535
69 while ( isspace(**s) )
74 while ( (**s != 0) && (!isspace(**s)) )
101 const char* probname;
103 SCIP_Bool correctinstance;
144 while ( !isspace(buf[
i]) )
151 printf(
"Reading solution for %s...\n", solprobname);
157 correctinstance =
TRUE;
158 for ( j = 0; j <=
i; j++ )
160 if ( solprobname[j] != probname[j] )
162 correctinstance =
FALSE;
165 if ( !correctinstance )
167 SCIPerrorMessage(
"The selected solution file doesn't belong to the current problem!\n");
183 for (
i = 0;
i < nsets;
i++ )
198 sets[color][setlengths[color]] =
i;
199 sets[color][setlengths[color]+1] = -1;
204 for (
i = 0;
i < nsets;
i++ )
208 while ( sets[
i][j] != -1 )
230 printf(
"testing validity...\n");
232 for (
i = 0;
i < nsets;
i++ )
234 for ( j = 0; j < setlengths[
i]; j++ )
236 for ( k = j+1; k < setlengths[
i]; k++ )
238 if ( tcliqueIsEdge(graph, sets[
i][j], sets[
i][k]) )
252 for (
i = 0;
i < nsets;
i++ )
256 for ( j = 0; j < setlengths[
i]; j++ )
258 if ( sets[
i][j] == node )
262 if ( tcliqueIsEdge(graph, sets[
i][j], node) )
267 if ( j == setlengths[
i] )
269 sets[
i][setlengths[
i]] = node;
270 sets[
i][setlengths[
i]+1] = -1;
277 for (
i = 0;
i < nsets;
i++ )
291 for ( j = 0; j < setlengths[
i]; j++ )
300 for (
i = nsets-1;
i >= 0;
i-- )
323 SCIP_Bool colorpossible;
363 for (
i = 0;
i < nsets;
i++ )
368 for ( j = 0; j < nsetelements[
i]; j++ )
370 if ( colors[originalnodes[sets[
i][j]]] == -1 )
372 colors[originalnodes[sets[
i][j]]] = actcolor;
381 while ( deletednodes[
i] == -1 )
389 node = deletednodes[
i];
391 while ( colors[node] == -1 )
393 colorpossible =
TRUE;
396 while ( firstedge <= lastedge )
398 if ( colors[*firstedge] == j )
400 colorpossible =
FALSE;
405 if ( colorpossible ==
TRUE )
417 SCIPinfoMessage(
scip, file,
"%s %d generated by ColumnGenerationColoring\n", name, actcolor);
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
SCIP_RETCODE SCIPaddCoefSetppc(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
const char * SCIPgetProbName(SCIP *scip)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
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)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_RETCODE SCIPcreateVar(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
SCIP_RETCODE SCIPchgVarUbLazy(SCIP *scip, SCIP_VAR *var, SCIP_Real lazyub)
void SCIPsortDownInt(int *intarray, int len)
int SCIPstrncpy(char *t, const char *s, int size)
assert(minobj< SCIPgetCutoffbound(scip))
int COLORprobGetNewNodeForOriginalNode(SCIP *scip, int node)
TCLIQUE_GRAPH * COLORprobGetOriginalGraph(SCIP *scip)
SCIP_CONS ** COLORprobGetConstraints(SCIP *scip)
SCIP_RETCODE COLORprobAddNewStableSet(SCIP *scip, int *stablesetnodes, int nstablesetnodes, int *setindex)
int * COLORprobGetOriginalNodesForNewNodes(SCIP *scip)
int COLORprobGetNNodes(SCIP *scip)
int COLORprobGetOriginalNNodes(SCIP *scip)
SCIP_VAR * COLORprobGetVarForStableSet(SCIP *scip, int setindex)
void COLORprobGetStableSets(SCIP *scip, int ***stablesets, int **nelements, int *nstablesets)
TCLIQUE_GRAPH * COLORprobGetGraph(SCIP *scip)
SCIP_RETCODE COLORprobAddVarForStableSet(SCIP *scip, int setindex, SCIP_VAR *var)
int * COLORprobGetDeletedNodes(SCIP *scip)
problem data for vertex coloring algorithm
struct SCIP_File SCIP_FILE
file reader for vertex coloring instances
SCIP_RETCODE SCIPincludeReaderCsol(SCIP *scip)
static long getNextNumber(char **s)
file reader and writer for vertex coloring solutions
int * tcliqueGetLastAdjedge(TCLIQUE_GRAPH *tcliquegraph, int node)
int * tcliqueGetFirstAdjedge(TCLIQUE_GRAPH *tcliquegraph, int node)
struct TCLIQUE_Graph TCLIQUE_GRAPH
#define SCIP_DECL_READERWRITE(x)
struct SCIP_ReaderData SCIP_READERDATA
#define SCIP_DECL_READERREAD(x)
#define SCIP_DECL_READERCOPY(x)
enum SCIP_Retcode SCIP_RETCODE
struct SCIP_VarData SCIP_VARDATA