Skip to content

Commit 4a480e0

Browse files
author
Martin Bergner
committed
reader_ref.c:
- prepare for writing ref files (EXTENSION WILL CHANGE TO REF) dec_arrowheur.c: - fixed some issues in when presolving is on heur_gcgcoefdiving.c: - disabled DEBUG output hmetis: - added hmetis so that it can now actually run from svn
1 parent 68f0ec7 commit 4a480e0

File tree

4 files changed

+80
-45
lines changed

4 files changed

+80
-45
lines changed

hmetis

754 KB
Binary file not shown.

src/dec_arrowheur.c

+17-3
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,25 @@ int computeHyperedgeWeight(SCIP *scip, SCIP_ARROWHEURDATA *arrowheurdata, SCIP_C
365365
{
366366
int j;
367367
int ncurvars;
368+
SCIP_Bool upgraded;
368369
SCIP_CONS* upgdcons;
369370
const char* hdlrname;
371+
372+
upgraded = FALSE;
370373
*cost = arrowheurdata->consWeight;
374+
hdlrname = SCIPconshdlrGetName(SCIPconsGetHdlr(cons));
375+
376+
if((strcmp("linear", hdlrname) == 0))
377+
{
378+
SCIP_CALL(SCIPupgradeConsLinear(scip, cons, &upgdcons));
379+
if(upgdcons != NULL)
380+
upgraded = TRUE;
381+
}
382+
else
383+
{
384+
upgdcons = cons;
385+
}
371386

372-
SCIP_CALL(SCIPupgradeConsLinear(scip, cons, &upgdcons));
373387

374388
if(upgdcons != NULL)
375389
{
@@ -448,7 +462,7 @@ int computeHyperedgeWeight(SCIP *scip, SCIP_ARROWHEURDATA *arrowheurdata, SCIP_C
448462
}
449463

450464
}
451-
if(upgdcons != NULL)
465+
if(upgraded == TRUE)
452466
{
453467
SCIP_CALL(SCIPreleaseCons(scip, &upgdcons));
454468
}
@@ -1465,7 +1479,7 @@ SCIP_RETCODE detectAndBuildArrowHead(
14651479
else
14661480
{
14671481
SCIP_Real bestscore = 1E20;
1468-
int bestsetting;
1482+
int bestsetting = -1;
14691483
for( i = arrowheurdata->minblocks; i <= arrowheurdata->maxblocks; ++i)
14701484
{
14711485
SCIP_Real cumscore;

src/heur_gcgcoefdiving.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
2020

2121
/* toggle debug mode */
22-
#define SCIP_DEBUG
22+
//#define SCIP_DEBUG
2323

2424
#include <assert.h>
2525
#include <string.h>

src/reader_ref.c

+62-41
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ static const char delimchars[] = " \f\n\r\t\v";
9696
static const char tokenchars[] = "-+:<>=";
9797
static const char commentchars[] = "\\";
9898

99+
struct SCIP_ReaderData
100+
{
101+
DECDECOMP* decdecomp;
102+
};
99103

100104

101105

@@ -822,55 +826,32 @@ SCIP_RETCODE readREFFile(
822826

823827
/** writes a BLK file */
824828
static
825-
SCIP_RETCODE writeBLKFile(
829+
SCIP_RETCODE writeREFFile(
826830
SCIP* scip, /**< SCIP data structure */
827-
REFINPUT* refinput /**< REF reading data */
831+
SCIP_READER* reader,
832+
FILE* file
833+
828834
)
829835
{
830-
char filename[SCIP_MAXSTRLEN];
831-
FILE* outfile;
832-
SCIP_VAR** vars;
833-
SCIP_VARDATA* vardata;
834-
int nvars;
835-
836-
int i;
837-
int v;
838-
839-
SCIPsnprintf(filename, SCIP_MAXSTRLEN, "%s.blk", SCIPgetProbName(scip));
840-
outfile = fopen(filename, "w");
841-
842-
SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
836+
SCIP_READERDATA* readerdata;
843837

844-
SCIPinfoMessage(scip, outfile, "NBlocks\n");
845-
SCIPinfoMessage(scip, outfile, "%d\n", refinput->nblocks);
838+
int nvars;
839+
int nconss;
846840

847-
for( i = 0; i < refinput->nblocks; i++ )
848-
{
849-
SCIPinfoMessage(scip, outfile, "Block %d\n", i + 1);
841+
assert(scip != NULL);
842+
assert(reader != NULL);
843+
assert(file != NULL);
844+
assert(result != NULL);
850845

851-
for( v = 0; v < nvars; v++ )
852-
{
853-
vardata = SCIPvarGetData(vars[v]);
854-
if( vardata->blocknr == i )
855-
{
856-
SCIPinfoMessage(scip, outfile, "%s\n", SCIPvarGetName(vars[v]));
857-
}
858-
}
859-
}
846+
readerdata = SCIPreaderGetData(reader);
847+
assert(readerdata != NULL);
860848

861-
if( refinput->nmarkedmasterconss > 0 )
849+
if(readerdata->decdecomp == NULL)
862850
{
863-
SCIPinfoMessage(scip, outfile, "Masterconss\n");
864-
for( i = 0; i < refinput->nmarkedmasterconss; i++ )
865-
{
866-
SCIPinfoMessage(scip, outfile, "%s\n", SCIPconsGetName(refinput->markedmasterconss[i]));
867-
}
851+
SCIPerrorMessage("No reformulation exists, cannot write reformulation file!\n");
852+
return SCIP_INVALIDCALL;
868853
}
869854

870-
SCIPinfoMessage(scip, outfile, "END\n");
871-
872-
fclose(outfile);
873-
874855
return SCIP_OKAY;
875856
}
876857

@@ -880,7 +861,20 @@ SCIP_RETCODE writeBLKFile(
880861
*/
881862

882863
/** destructor of reader to free user data (called when SCIP is exiting) */
883-
#define readerFreeRef NULL
864+
SCIP_DECL_READERFREE(readerFreeRef)
865+
{
866+
SCIP_READERDATA* readerdata;
867+
assert(scip != NULL);
868+
assert(reader != NULL);
869+
870+
assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
871+
readerdata = SCIPreaderGetData(reader);
872+
assert(readerdata != NULL);
873+
874+
SCIPfreeMemory(scip, &readerdata);
875+
876+
return SCIP_OKAY;
877+
}
884878

885879

886880
/** problem reading method of reader */
@@ -897,6 +891,8 @@ SCIP_DECL_READERREAD(readerReadRef)
897891
static
898892
SCIP_DECL_READERWRITE(readerWriteRef)
899893
{
894+
SCIP_CALL(writeREFFile(scip, reader, file));
895+
*result = SCIP_SUCCESS;
900896
return SCIP_OKAY;
901897
}
902898

@@ -912,7 +908,7 @@ SCIP_RETCODE SCIPincludeReaderRef(
912908
SCIP_READERDATA* readerdata;
913909

914910
/* create blk reader data */
915-
readerdata = NULL;
911+
SCIP_CALL(SCIPallocMemory(scip, readerdata));
916912

917913
/* include lp reader */
918914
SCIP_CALL( SCIPincludeReader(scip, READER_NAME, READER_DESC, READER_EXTENSION,
@@ -1007,3 +1003,28 @@ SCIP_RETCODE SCIPreadRef(
10071003

10081004
return SCIP_OKAY;
10091005
}
1006+
1007+
/** set the decomp structure */
1008+
extern
1009+
SCIP_RETCODE SCIPReaderREFSetDecomp(
1010+
SCIP* scip, /**< SCIP data structure */
1011+
SCIP_READER* reader, /**< Reader data structure */
1012+
DECDECOMP* decdecomp /**< DECOMP data structure */
1013+
1014+
)
1015+
{
1016+
1017+
SCIP_READERDATA* readerdata;
1018+
assert(scip != NULL);
1019+
assert(decdecomp != NULL);
1020+
assert(reader != NULL);
1021+
1022+
assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
1023+
readerdata = SCIPreaderGetData(reader);
1024+
1025+
assert(readerdata != NULL);
1026+
1027+
readerdata->decdecomp = decdecomp;
1028+
1029+
return SCIP_OKAY;
1030+
}

0 commit comments

Comments
 (0)