Detailed Description
C++ file reader for TSP data files.
Definition in file ReaderTSP.cpp.
#include <iostream>
#include <string>
#include <sstream>
#include "objscip/objscip.h"
#include "scip/cons_linear.h"
#include "scip/pub_fileio.h"
#include <math.h>
#include "ReaderTSP.h"
#include "ProbDataTSP.h"
#include "ConshdlrSubtour.h"
#include "GomoryHuTree.h"
Go to the source code of this file.
Macros | |
#define | NINT(x) (floor(x+0.5)) |
Functions | |
string | getToken (char *&str) |
SCIP_DECL_READERFREE (ReaderTSP::scip_free) | |
SCIP_DECL_READERREAD (ReaderTSP::scip_read) | |
SCIP_DECL_READERWRITE (ReaderTSP::scip_write) | |
Macro Definition Documentation
◆ NINT
Definition at line 51 of file ReaderTSP.cpp.
Referenced by SCIP_DECL_READERREAD().
Function Documentation
◆ getToken()
string getToken | ( | char *& | str | ) |
get token
Definition at line 54 of file ReaderTSP.cpp.
References GraphEdge::back, GraphNode::first_edge, GraphNode::id, nnodes, Graph::nnodes, Graph::nodes, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPcaptureVar(), SCIPerrorMessage, SCIPfeof(), SCIPfgets(), SCIPstrToIntValue(), SCIPstrToRealValue(), GraphEdge::var, GraphNode::x, and GraphNode::y.
Referenced by SCIP_DECL_READERREAD().
◆ SCIP_DECL_READERFREE()
SCIP_DECL_READERFREE | ( | ReaderTSP::scip_free | ) |
destructor of file reader to free user data (called when SCIP is exiting)
Definition at line 198 of file ReaderTSP.cpp.
References SCIP_OKAY.
◆ SCIP_DECL_READERREAD()
SCIP_DECL_READERREAD | ( | ReaderTSP::scip_read | ) |
problem reading method of reader
possible return values for *result:
- SCIP_SUCCESS : the reader read the file correctly and created an appropritate problem
- SCIP_DIDNOTRUN : the reader is not responsible for given input file
If the reader detected an error in the input file, it should return with RETCODE SCIP_READERR or SCIP_NOFILE.
! [SnippetTSPVariableCreation]
! [SnippetTSPVariableCreation]
! [SnippetTSPDegreeConstraintCreation]
! [SnippetTSPDegreeConstraintCreation]
! [SnippetTSPNosubtourConstraintCreation]
! [SnippetTSPNosubtourConstraintCreation]
Definition at line 211 of file ReaderTSP.cpp.
References ABS, GraphEdge::adjac, GraphEdge::back, create_graph(), Graph::edges, FALSE, GraphNode::first_edge, getToken(), GraphNode::id, GraphEdge::length, MAX, GraphEdge::next, NINT, nnodes, Graph::nodes, NULL, release_graph(), SCIP_CALL, SCIP_DIDNOTRUN, SCIP_INVALIDDATA, SCIP_MAXSTRLEN, SCIP_NOMEMORY, SCIP_OKAY, SCIP_READERROR, SCIP_SUCCESS, SCIP_VARTYPE_BINARY, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPcreateConsLinear(), tsp::SCIPcreateConsSubtour(), SCIPcreateObjProb(), SCIPcreateVar(), SCIPerrorMessage, SCIPfclose(), SCIPfeof(), SCIPfgets(), SCIPfopen(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPstrToIntValue(), TRUE, GraphEdge::var, x, and y.
◆ SCIP_DECL_READERWRITE()
SCIP_DECL_READERWRITE | ( | ReaderTSP::scip_write | ) |
problem writing method of reader; NOTE: if the parameter "genericnames" is TRUE, then SCIP already set all variable and constraint names to generic names; therefore, this method should always use SCIPvarGetName() and SCIPconsGetName();
possible return values for *result:
- SCIP_SUCCESS : the reader read the file correctly and created an appropritate problem
- SCIP_DIDNOTRUN : the reader is not responsible for given input file
If the reader detected an error in the writing to the file stream, it should return with RETCODE SCIP_WRITEERROR.
Definition at line 546 of file ReaderTSP.cpp.
References SCIP_DIDNOTRUN, and SCIP_OKAY.