32 #define EVENTHDLR_NAME "bestsol" 33 #define EVENTHDLR_DESC "event handler for best solutions found" 40 assert(eventhdlr != NULL);
41 assert(strcmp(SCIPeventhdlrGetName(eventhdlr),
EVENTHDLR_NAME) == 0);
54 assert(eventhdlr != NULL);
55 assert(strcmp(SCIPeventhdlrGetName(eventhdlr),
EVENTHDLR_NAME) == 0);
58 SCIP_CALL( SCIPcatchEvent( scip, SCIP_EVENTTYPE_BESTSOLFOUND, eventhdlr, NULL, NULL) );
68 assert(eventhdlr != NULL);
69 assert(strcmp(SCIPeventhdlrGetName(eventhdlr),
EVENTHDLR_NAME) == 0);
72 SCIP_CALL( SCIPdropEvent( scip, SCIP_EVENTTYPE_BESTSOLFOUND, eventhdlr, NULL, -1) );
83 SCIP_Real factor = 1.0;
88 assert(eventhdlr != NULL);
89 assert(strcmp(SCIPeventhdlrGetName(eventhdlr),
EVENTHDLR_NAME) == 0);
90 assert(event != NULL);
92 assert(SCIPeventGetType(event) == SCIP_EVENTTYPE_BESTSOLFOUND);
94 SCIPdebugMessage(
"exec method of event handler for best solution found\n");
96 bestsol = SCIPgetBestSol(scip);
97 assert(bestsol != NULL);
98 solvalue = factor * SCIPgetSolOrigObj(scip, bestsol);
108 SCIP_PROBDATA* probdata;
125 probdata = SCIPgetProbData(scip);
126 assert(probdata != NULL);
134 primalobj = SCIPgetPrimalbound(scip);
139 SCIP_CALL( SCIPallocBufferArray(scip, &heap, nnodes + 1) );
140 SCIP_CALL( SCIPallocBufferArray(scip, &state, nnodes) );
141 SCIP_CALL( SCIPallocBufferArray(scip, &cost, nedges) );
142 SCIP_CALL( SCIPallocBufferArray(scip, &radius, nnodes) );
143 SCIP_CALL( SCIPallocBufferArray(scip, &costrev, nedges) );
144 SCIP_CALL( SCIPallocBufferArray(scip, &vbase, nnodes) );
145 SCIP_CALL( SCIPallocBufferArray(scip, &pathedge, nnodes) );
146 SCIP_CALL( SCIPallocBufferArray(scip, &vnoi, nnodes) );
148 printf(
"perfrom HC %f\n", offset);
149 SCIP_CALL(
hcrcbound_reduce(scip, g, vnoi, cost, costrev, radius, offset, primalobj, heap, state, vbase, &hcrcnelims, pathedge,
TRUE) );
152 SCIPfreeBufferArray(scip, &vnoi);
153 SCIPfreeBufferArray(scip, &pathedge);
154 SCIPfreeBufferArray(scip, &vbase);
155 SCIPfreeBufferArray(scip, &costrev);
156 SCIPfreeBufferArray(scip, &radius);
157 SCIPfreeBufferArray(scip, &cost);
158 SCIPfreeBufferArray(scip, &state);
159 SCIPfreeBufferArray(scip, &heap);
170 SCIP_EVENTHDLRDATA* eventhdlrdata;
171 SCIP_EVENTHDLR* eventhdlr;
172 eventhdlrdata = NULL;
177 assert(eventhdlr != NULL);
179 SCIP_CALL( SCIPsetEventhdlrCopy(scip, eventhdlr, eventCopyBestsol) );
180 SCIP_CALL( SCIPsetEventhdlrInit(scip, eventhdlr, eventInitBestsol) );
181 SCIP_CALL( SCIPsetEventhdlrExit(scip, eventhdlr, eventExitBestsol) );
SCIP_RETCODE hcrcbound_reduce(SCIP *, GRAPH *, PATH *, SCIP_Real *, SCIP_Real *, SCIP_Real *, SCIP_Real, int *, int *, int *, int *, int *, SCIP_Bool)
static SCIP_DECL_EVENTINIT(eventInitBestsol)
static SCIP_DECL_EVENTEXIT(eventExitBestsol)
SCIP_RETCODE SCIPprobdataWriteIntermediateSolution(SCIP *scip)
Problem data for stp problem.
GRAPH * SCIPprobdataGetGraph(SCIP_PROBDATA *probdata)
void SCIPprobdataWriteLogLine(SCIP *scip, const char *formatstr,...)
SCIP_Real SCIPprobdataGetOffset(SCIP *scip)
#define STP_MAX_NODE_WEIGHT
int SCIPprobdataGetType(SCIP *scip)
eventhdlr for best solution found
static SCIP_DECL_EVENTCOPY(eventCopyBestsol)
includes various files containing graph methods used for Steiner problems
SCIP_RETCODE SCIPincludeEventHdlrBestsol(SCIP *scip)
static SCIP_DECL_EVENTEXEC(eventExecBestsol)