( edge !=
NULL)
57 if( edge->
adjac->
id== index2 )
78 while( edge !=
NULL)
144 int nnodes= graph_->nnodes;
145 intnedges = graph_->nedges;
148 for(
inte = 0; e < nedges; ++e)
153hasFixedEdges =
TRUE;
159 if(
nnodes< 3 || hasFixedEdges )
176 for( i = 0; i <
nnodes; i++ )
177assert( i == nodes[i].
id);
187 for( i = 0; i <
nnodes; i++ )
192 for(
intu = 0; u <
nnodes- 2 && !foundThreeCircle; ++u)
194 for(
intv = u + 1; v <
nnodes- 1 && !foundThreeCircle; ++v)
201 for(
int w= v + 1; (
w<
nnodes) && !foundThreeCircle; ++
w)
212foundThreeCircle =
TRUE;
220subtour[
w] =
true;
231 if( !foundThreeCircle )
244 intsubtourlength = 3;
245 for(; subtourlength <
nnodes; subtourlength++ )
250 for( i = 0; i <
nnodes; i++)
252 if( (maxmin < dist[i] && dist[i] != DBL_MAX) || (maxmin == dist[i] && !subtour[i]) )
258 if(newnodeindex == -1)
260couldNotInsert =
TRUE;
269 while( edge !=
NULL)
276assert(edge !=
NULL);
277assert(subtour[edge->
adjac->
id]);
283startnode = edge->
adjac;
289edges[1] = successor[node->
id];
290edges[2] =
findEdge(nodes, edges[1]->adjac->id, newnodeindex);
291assert( edges[2] !=
NULL);
299 for( i = 0; i < 3; i++ )
300bestedges[i] = edges[i];
302node = edges[1]->
adjac;
303edges[0] = edges[2]->
back;
305 while( node != startnode);
307 if( minval == DBL_MAX )
309couldNotInsert =
TRUE;
315assert(bestedges[0]->adjac->id == bestedges[1]->
back->
adjac->
id);
316assert(bestedges[1]->adjac->id == bestedges[2]->
back->
adjac->
id);
317assert(bestedges[2]->adjac->id == bestedges[0]->
back->
adjac->
id);
318assert(subtour[bestedges[0]->adjac->id]);
319assert(subtour[bestedges[1]->adjac->id]);
320assert(bestedges[2]->adjac->id == newnodeindex);
321assert(!subtour[newnodeindex]);
324successor[bestedges[0]->
adjac->
id] = bestedges[0]->
back;
325successor[bestedges[2]->adjac->id] = bestedges[2]->
back;
326dist[newnodeindex] = 0.0;
327subtour[newnodeindex] =
true;
343 for( i = 0; i <
nnodes; i++ )
void capture_graph(GRAPH *gr)
void release_graph(GRAPH **gr)
generator for global cuts in undirected graphs
static GRAPHEDGE * findEdge(GRAPHNODE *nodes, int index1, int index2)
SCIP_DECL_HEURCLONE(scip::ObjCloneable *HeurFarthestInsert::clone)
SCIP_DECL_HEURFREE(HeurFarthestInsert::scip_free)
static void updateDistances(GRAPHNODE *nodes, double *dist, int idx)
SCIP_DECL_HEUREXIT(HeurFarthestInsert::scip_exit)
SCIP_DECL_HEURINITSOL(HeurFarthestInsert::scip_initsol)
SCIP_DECL_HEUREXITSOL(HeurFarthestInsert::scip_exitsol)
SCIP_DECL_HEURINIT(HeurFarthestInsert::scip_init)
SCIP_DECL_HEUREXEC(HeurFarthestInsert::scip_exec)
farthest insert - combinatorial heuristic for TSP
C++ problem data for TSP.
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
SCIP_RETCODE SCIPtrySol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
#define BMSclearMemoryArray(ptr, num)
scip::ObjProbData * SCIPgetObjProbData(SCIP *scip)
C++ wrapper classes for SCIP.
struct GraphEdge * first_edge
Definition of base class for all clonable classes.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4