52 for(
int i = 0; i <
nnodes; i++ )
73 nnodes = graph->
knots;
74 nedges = graph->
edges;
78 for(
int i = 0; i < nedges; i++ )
119 for(
int i = 0; i <
nnodes; i++ )
131 nnodes = graph->
knots;
132 nedges = graph->
edges;
136 for(
int i = 0; i <
nnodes; i++ )
137 graph->
prize[i] = 0.0;
139 graph->
prize[0] = 5.0;
140 graph->
prize[2] = 3.0;
141 graph->
prize[3] = 3.1;
142 graph->
prize[4] = 3.1;
153 nnodes = graph->
knots;
154 nedges = graph->
edges;
164 for(
int i = 0; i < nedges; i++ )
167 for(
int i = 0; i <
nnodes; i++ )
168 steinertree_nodes[i] =
FALSE;
170 steinertree_nodes[0] =
TRUE;
171 steinertree_nodes[1] =
TRUE;
172 steinertree_nodes[2] =
TRUE;
173 steinertree_nodes[3] =
TRUE;
174 steinertree_nodes[4] =
TRUE;
218 for(
int i = 0; i <
nnodes; i++ )
231 nnodes = graph->
knots;
232 nedges = graph->
edges;
236 for(
int i = 0; i <
nnodes; i++ )
237 graph->
prize[i] = 0.0;
239 graph->
prize[0] = 5.0;
240 graph->
prize[2] = 3.0;
241 graph->
prize[3] = 3.1;
242 graph->
prize[4] = 3.1;
243 graph->
prize[5] = 1.0;
244 graph->
prize[6] = 1.0;
256 nnodes = graph->
knots;
257 nedges = graph->
edges;
267 for(
int i = 0; i < nedges; i++ )
270 for(
int i = 0; i <
nnodes; i++ )
271 steinertree_nodes[i] =
FALSE;
273 steinertree_nodes[0] =
TRUE;
274 steinertree_nodes[1] =
TRUE;
275 steinertree_nodes[2] =
TRUE;
276 steinertree_nodes[3] =
TRUE;
277 steinertree_nodes[4] =
TRUE;
294 if( !
SCIPisEQ(scip, cost1 + 1.0, cost0) )
325 for(
int i = 0; i <
nnodes; i++ )
339 nnodes = graph->
knots;
340 nedges = graph->
edges;
345 graph->
prize[0] = 5.0;
346 graph->
prize[1] = -2.0;
347 graph->
prize[2] = -2.0;
348 graph->
prize[3] = 3.0;
349 graph->
prize[4] = 3.0;
350 graph->
prize[5] = -1.0;
351 graph->
prize[6] = 0.5;
352 graph->
prize[7] = -1.0;
356 nnodes = graph->
knots;
357 nedges = graph->
edges;
367 for(
int i = 0; i < nedges; i++ )
370 for(
int i = 0; i <
nnodes; i++ )
371 steinertree_nodes[i] =
FALSE;
373 steinertree_nodes[0] =
TRUE;
374 steinertree_nodes[1] =
TRUE;
375 steinertree_nodes[2] =
TRUE;
376 steinertree_nodes[3] =
TRUE;
377 steinertree_nodes[4] =
TRUE;
394 if( !
SCIPisEQ(scip, cost1 + 0.5, cost0) )
425 for(
int i = 0; i <
nnodes; i++ )
439 nnodes = graph->
knots;
440 nedges = graph->
edges;
454 for(
int i = 0; i < nedges; i++ )
457 for(
int i = 0; i <
nnodes; i++ )
458 steinertree_nodes[i] =
FALSE;
460 steinertree_nodes[0] =
TRUE;
461 steinertree_nodes[1] =
TRUE;
462 steinertree_nodes[2] =
TRUE;
463 steinertree_nodes[3] =
TRUE;
464 steinertree_nodes[4] =
TRUE;
482 if( !
SCIPisEQ(scip, cost1 + 1.0, cost0) )
516 for(
int i = 0; i <
nnodes; i++ )
530 nnodes = graph->
knots;
531 nedges = graph->
edges;
535 for(
int i = 0; i <
nnodes; i++ )
536 graph->
prize[i] = 0.0;
538 graph->
prize[0] = 5.0;
540 graph->
prize[3] = 3.0;
541 graph->
prize[4] = 3.0;
542 graph->
prize[5] = 1.5;
543 graph->
prize[6] = 1.0;
555 nnodes = graph->
knots;
556 nedges = graph->
edges;
566 for(
int i = 0; i < nedges; i++ )
569 for(
int i = 0; i <
nnodes; i++ )
570 steinertree_nodes[i] =
FALSE;
572 steinertree_nodes[0] =
TRUE;
573 steinertree_nodes[1] =
TRUE;
574 steinertree_nodes[2] =
TRUE;
575 steinertree_nodes[3] =
TRUE;
576 steinertree_nodes[4] =
TRUE;
593 if( !
SCIPisEQ(scip, cost1 + 0.5, cost0) )
626 for(
int i = 0; i <
nnodes; i++ )
647 nnodes = graph->
knots;
648 nedges = graph->
edges;
652 for(
int i = 0; i <
nnodes; i++ )
653 graph->
prize[i] = 0.0;
655 graph->
prize[0] = 5.0;
657 graph->
prize[3] = 3.0;
658 graph->
prize[4] = 3.0;
659 graph->
prize[6] = 1.5;
660 graph->
prize[8] = 1.0;
673 nnodes = graph->
knots;
674 nedges = graph->
edges;
684 for(
int i = 0; i < nedges; i++ )
687 for(
int i = 0; i <
nnodes; i++ )
688 steinertree_nodes[i] =
FALSE;
690 steinertree_nodes[0] =
TRUE;
691 steinertree_nodes[1] =
TRUE;
692 steinertree_nodes[2] =
TRUE;
693 steinertree_nodes[3] =
TRUE;
694 steinertree_nodes[4] =
TRUE;
712 if( !
SCIPisEQ(scip, cost1 + 0.5, cost0) )
745 for(
int i = 0; i <
nnodes; i++ )
765 nnodes = graph->
knots;
766 nedges = graph->
edges;
770 for(
int i = 0; i <
nnodes; i++ )
771 graph->
prize[i] = 0.0;
773 graph->
prize[0] = 5.0;
775 graph->
prize[3] = 3.0;
776 graph->
prize[4] = 3.0;
777 graph->
prize[6] = 1.0;
778 graph->
prize[7] = 2.5;
780 graph->
prize[8] = 0.5;
794 nnodes = graph->
knots;
795 nedges = graph->
edges;
805 for(
int i = 0; i < nedges; i++ )
808 for(
int i = 0; i <
nnodes; i++ )
809 steinertree_nodes[i] =
FALSE;
811 steinertree_nodes[0] =
TRUE;
812 steinertree_nodes[1] =
TRUE;
813 steinertree_nodes[2] =
TRUE;
814 steinertree_nodes[3] =
TRUE;
815 steinertree_nodes[4] =
TRUE;
826 if( !
SCIPisEQ(scip, cost1 + 0.5, cost0) )
857 for(
int i = 0; i <
nnodes; i++ )
880 nnodes = graph->
knots;
881 nedges = graph->
edges;
885 for(
int i = 0; i < nedges; i++ )
903 if( !
SCIPisEQ(scip, cost1 + 1.0, cost0) )
934 for(
int i = 0; i <
nnodes; i++ )
957 nnodes = graph->
knots;
958 nedges = graph->
edges;
962 for(
int i = 0; i < nedges; i++ )
980 if( !
SCIPisEQ(scip, cost1 + 1.5, cost0) )
982 printf(
"localInsertion2 unit test failed \n");
983 printf(
"cost1=%f, cost0=%f \n", cost1, cost0);
1017 for(
int i = 0; i <
nnodes; i++ )
1032 nnodes = graph->
knots;
1033 nedges = graph->
edges;
1037 for(
int i = 0; i <
nnodes; i++ )
1038 graph->
prize[i] = 0.0;
1040 graph->
prize[0] = 5.0;
1041 graph->
prize[1] = 0.75;
1042 graph->
prize[2] = 2.1;
1043 graph->
prize[3] = 4.0;
1044 graph->
prize[4] = 4.0;
1054 nnodes = graph->
knots;
1055 nedges = graph->
edges;
1062 nnodes = graph->
knots;
1063 nedges = graph->
edges;
1068 for(
int i = 0; i < nedges; i++ )
1071 for(
int i = 0; i <
nnodes; i++ )
1072 steinertree_nodes[i] =
FALSE;
1074 steinertree_nodes[0] =
TRUE;
1075 steinertree_nodes[1] =
TRUE;
1076 steinertree_nodes[2] =
TRUE;
1077 steinertree_nodes[3] =
TRUE;
1078 steinertree_nodes[4] =
TRUE;
1089 if( !
SCIPisEQ(scip, cost1 + 0.75, cost0) )
1091 printf(
"localInsertion2pc unit test failed \n");
1092 printf(
"obj: new=%f, old=%f \n", cost1, cost0);
1125 printf(
"stptest_heur_local: all ok \n");
static SCIP_RETCODE localKeyVertexPc(SCIP *scip)
void graph_knot_chg(GRAPH *, int, int)
static SCIP_RETCODE localInsertion(SCIP *scip)
#define SCIPfreeMemoryArray(scip, ptr)
#define SCIPallocMemoryArray(scip, ptr, num)
includes methods for Steiner tree problem solutions
void graph_free(SCIP *, GRAPH **, SCIP_Bool)
SCIP_RETCODE graph_path_init(SCIP *, GRAPH *)
enum SCIP_Retcode SCIP_RETCODE
includes various files containing graph methods used for Steiner tree problems
static SCIP_RETCODE localKeyPathExchangePc(SCIP *scip)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE localKeyVertexPc2(SCIP *scip)
SCIP_RETCODE graph_pc_initPrizes(SCIP *, GRAPH *, int)
static SCIP_RETCODE localExtendPc(SCIP *scip)
SCIP_RETCODE graph_transMw(SCIP *, GRAPH *)
static SCIP_RETCODE localKeyVertex(SCIP *scip)
SCIP_RETCODE graph_transPc(SCIP *, GRAPH *)
SCIP_RETCODE graph_initHistory(SCIP *, GRAPH *)
void graph_edge_add(SCIP *, GRAPH *, int, int, double, double)
void graph_knot_add(GRAPH *, int)
SCIP_RETCODE SCIPStpHeurLocalRun(SCIP *scip, GRAPH *graph, int *solEdges)
Improvement heuristic for Steiner problems.
SCIP_Real solstp_getObjBounded(const GRAPH *g, const int *soledge, SCIP_Real offset, int nedges)
static SCIP_RETCODE localKeyPathExchange(SCIP *scip)
static SCIP_RETCODE localKeyPathExchangePc2(SCIP *scip)
SCIP_RETCODE stptest_testHeurLocal(SCIP *scip)
void graph_path_exit(SCIP *, GRAPH *)
includes various testing methods for Steiner tree problems
static SCIP_RETCODE localInsertion2(SCIP *scip)
shortest paths based primal heuristics for Steiner problems
SCIP_RETCODE SCIPStpHeurLocalExtendPcMw(SCIP *scip, GRAPH *graph, const SCIP_Real *cost, int *stedge, STP_Bool *stvertex)
SCIP_RETCODE graph_init(SCIP *, GRAPH **, int, int, int)
SCIP_Bool solstp_isValid(SCIP *scip, const GRAPH *graph, const int *result)
SCIP_RETCODE solstp_prune(SCIP *scip, const GRAPH *g, int *result, STP_Bool *connected)
static SCIP_RETCODE localKeyPathExchangeMw(SCIP *scip)
static SCIP_RETCODE localInsertion2pc(SCIP *scip)