48 if( edge->
adjac == node2 )
104 assert( graph_ != 0 );
105 assert( tour_ != 0 );
117 assert( heur != NULL );
133 int nnodes = graph_->nnodes;
136 if( nnodes < 4 || sol == NULL || ncalls_ >= nnodes )
157 while( edge != NULL )
167 for(j = i; j > 0 && tour_[j-1]->length < edge->
length; j-- )
168 tour_[j] = tour_[j-1];
179 }
while ( node != &nodes[0] );
180 assert( i == nnodes );
189 for(
int i = 0; i < ncalls_ && *result !=
SCIP_FOUNDSOL; i++ )
191 edges2test[0] = tour_[ncalls_];
192 edges2test[1] = tour_[i];
194 edges2test[3] =
findEdge( nodes, edges2test[0]->adjac, edges2test[1]->adjac );
195 assert( edges2test[2] != NULL );
196 assert( edges2test[3] != NULL );
199 if( edges2test[0]->length + edges2test[1]->length > edges2test[2]->length + edges2test[3]->length
212 for(
int j = 0; j <
nnodes; j++)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
2-Optimum - combinatorial improvement heuristic for TSP
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_DECL_HEUREXITSOL(Heur2opt::scip_exitsol)
SCIP_RETCODE SCIPaddSolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool *stored)
SCIP_DECL_HEURINIT(Heur2opt::scip_init)
generator for global cuts in undirected graphs
#define SCIPfreeBufferArray(scip, ptr)
SCIP_DECL_HEURFREE(Heur2opt::scip_free)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_DECL_HEUREXEC(Heur2opt::scip_exec)
struct GraphEdge * first_edge
SCIP_DECL_HEUREXIT(Heur2opt::scip_exit)
C++ wrapper classes for SCIP.
static GRAPHEDGE * findEdge(GRAPHNODE *nodes, GRAPHNODE *node1, GRAPHNODE *node2)
C++ problem data for TSP.
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
SCIP_DECL_HEURINITSOL(Heur2opt::scip_initsol)
SCIP_DECL_HEURCLONE(scip::ObjCloneable *Heur2opt::clone)
scip::ObjProbData * SCIPgetObjProbData(SCIP *scip)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition of base class for all clonable classes.
void capture_graph(GRAPH *gr)
void release_graph(GRAPH **gr)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)