Scippy

SCIP

Solving Constraint Integer Programs

ReaderTSP.cpp File Reference

Detailed Description

C++ file reader for TSP data files.

Author
Timo Berthold

Definition in file ReaderTSP.cpp.

#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include "objscip/objscip.h"
#include "scip/cons_linear.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

 SCIP_DECL_READERFREE (ReaderTSP::scip_free)
 
 SCIP_DECL_READERREAD (ReaderTSP::scip_read)
 
 SCIP_DECL_READERWRITE (ReaderTSP::scip_write)
 

Macro Definition Documentation

◆ NINT

#define NINT (   x)    (floor(x+0.5))

Definition at line 51 of file ReaderTSP.cpp.

Referenced by SCIP_DECL_READERREAD().

Function Documentation

◆ 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 152 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 165 of file ReaderTSP.cpp.

References GraphEdge::adjac, GraphEdge::back, create_graph(), Graph::edges, FALSE, GraphNode::first_edge, GraphNode::id, GraphEdge::length, MAX, GraphEdge::next, NINT, nnodes, Graph::nodes, NULL, release_graph(), SCIP_CALL, SCIP_DIDNOTRUN, SCIP_NOMEMORY, SCIP_OKAY, SCIP_READERROR, SCIP_SUCCESS, SCIP_VARTYPE_BINARY, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPcreateConsLinear(), tsp::SCIPcreateConsSubtour(), SCIPcreateObjProb(), SCIPcreateVar(), SCIPreleaseCons(), SCIPreleaseVar(), 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 496 of file ReaderTSP.cpp.

References SCIP_DIDNOTRUN, and SCIP_OKAY.