51#define NINT(x) (floor(x+0.5))
55void ReaderTSP::getNodesFromFile(
73 if( nodenumber-1 !=
i)
75 cout <<
"warning: nodenumber <" << nodenumber <<
"> does not match its index in node list <" <<
i+1
76 <<
">. Node will get number " <<
i+1 <<
" when naming variables and constraints!" <<
endl;
111bool ReaderTSP::checkValid(
113 const std::string& name,
114 const std::string& type,
123 cout <<
"parse error in file <" << name <<
"> dimension should be greater than 0"<<
endl ;
129 cout <<
"parse error in file <" << name <<
"> type should be TSP" <<
endl;
136 cout <<
"parse error in file <" << name <<
"> unknown weight type, should be EUC_2D, MAX_2D, MAN_2D, ATT, or GEO" <<
endl;
142 cout <<
"error while reading file <" << name <<
">, graph is uninitialized. ";
143 cout <<
"Probably NODE_COORD_SECTION is missing" <<
endl;
181 double** weights =
NULL;
192 string name =
"MY_OWN_LITTLE_TSP";
210 if( token ==
"NAME:" )
212 else if( token ==
"NAME" )
214 else if( token ==
"TYPE:" )
216 else if( token ==
"TYPE" )
218 else if( token ==
"DIMENSION:" )
223 else if( token ==
"DIMENSION" )
228 else if( token ==
"EDGE_WEIGHT_TYPE:" )
230 else if( token ==
"EDGE_WEIGHT_TYPE" )
232 else if( token ==
"NODE_COORD_SECTION" || token ==
"DISPLAY_DATA_SECTION" )
256 else if( token ==
"COMMENT:" || token ==
"COMMENT" || token ==
"DISPLAY_DATA_TYPE" || token ==
"DISPLAY_DATA_TYPE:" )
258 else if( token ==
"EOF" )
260 else if( token ==
"" )
264 cout <<
"parse error in file <" << name <<
"> unknown keyword <" << token <<
">" <<
endl;
282 weights =
new double* [
nnodes];
284 weights[
i] =
new double[
nnodes];
314 const double pi = 3.141592653589793;
327 for(
k = 0;
k < 4;
k++ )
386 if( weights !=
NULL )
414 for(
i = 0;
i < nedges/2;
i++ )
424 varname <<
"x_e_" <<
edge->back->adjac->id+1 <<
"-" <<
edge->adjac->id+1;
447 consname <<
"deg_con_v" << node->
id+1;
C++ constraint handler for TSP subtour elimination constraints.
SCIP_Bool create_graph(int n, int m, GRAPH **gr)
void release_graph(GRAPH **gr)
generator for global cuts in undirected graphs
C++ problem data for TSP.
C++ file reader for TSP data files.
std::ifstream tspifstream
Constraint handler for linear constraints in their most general form, .
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_RETCODE SCIPcreateVar(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
assert(minobj< SCIPgetCutoffbound(scip))
SCIP_RETCODE SCIPcreateConsSubtour(SCIP *scip, SCIP_CONS **cons, const char *name, GRAPH *graph, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable)
SCIP_RETCODE SCIPcreateObjProb(SCIP *scip, const char *name, scip::ObjProbData *objprobdata, SCIP_Bool deleteobject)
C++ wrapper classes for SCIP.
struct GraphEdge * first_edge
#define SCIP_DECL_READERWRITE(x)
#define SCIP_DECL_READERREAD(x)
#define SCIP_DECL_READERFREE(x)
enum SCIP_Retcode SCIP_RETCODE