Scippy

SCIP

Solving Constraint Integer Programs

ProbDataTSP.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2022 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License. */
12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file ProbDataTSP.h
17  * @brief C++ problem data for TSP
18  * @author Timo Berthold
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #ifndef __TSPPROBDATA_H__
24 #define __TSPPROBDATA_H__
25 
26 #include "objscip/objscip.h"
27 #include "GomoryHuTree.h"
28 
29 namespace tsp
30 {
31 
32 /** SCIP user problem data for TSP */
34 {
35  GRAPH* graph_; /**< graph data */
36 
37 public:
38 
39  /** default constructor */
41  GRAPH* g /**< graph data */
42  )
43  : graph_(g)
44  {
45  capture_graph(graph_);
46  }
47 
48  /** destructor */
49  virtual ~ProbDataTSP()
50  {
51  if( graph_ != NULL )
52  release_graph(&graph_); /*lint !e1551*/
53  }
54 
55  /** Copies user data if you want to copy it to a subscip */
56  virtual SCIP_RETCODE scip_copy(
57  SCIP* scip, /**< SCIP data structure */
58  SCIP* sourcescip, /**< source SCIP main data structure */
59  SCIP_HASHMAP* varmap, /**< a hashmap which stores the mapping of source variables to
60  * corresponding target variables */
61  SCIP_HASHMAP* consmap, /**< a hashmap which stores the mapping of source contraints to
62  * corresponding target constraints */
63  ObjProbData** objprobdata, /**< pointer to store the copied problem data object */
64  SCIP_Bool global, /**< create a global or a local copy? */
65  SCIP_RESULT* result /**< pointer to store the result of the call */
66  );
67 
68  /** destructor of user problem data to free original user data (called when original problem is freed) */
69  virtual SCIP_RETCODE scip_delorig(
70  SCIP* scip /**< SCIP data structure */
71  );
72 
73  /** destructor of user problem data to free transformed user data (called when transformed problem is freed) */
75  SCIP* scip /**< SCIP data structure */
76  );
77 
78  /** creates user data of transformed problem by transforming the original user problem data
79  * (called after problem was transformed)
80  */
81  virtual SCIP_RETCODE scip_trans(
82  SCIP* scip, /**< SCIP data structure */
83  ObjProbData** objprobdata, /**< pointer to store the transformed problem data object */
84  SCIP_Bool* deleteobject /**< pointer to store whether SCIP should delete the object after solving */
85  );
86 
87  /* get the graph */
89  {
90  return graph_;
91  }
92 
93 };/*lint !e1712*/
94 
95 } /* namespace tsp */
96 
97 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
virtual SCIP_RETCODE scip_copy(SCIP *scip, SCIP *sourcescip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, ObjProbData **objprobdata, SCIP_Bool global, SCIP_RESULT *result)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
generator for global cuts in undirected graphs
virtual SCIP_RETCODE scip_delorig(SCIP *scip)
C++ wrapper for user problem data.
Definition: objprobdata.h:43
#define NULL
Definition: lpi_spx1.cpp:155
C++ wrapper classes for SCIP.
GRAPH * getGraph()
Definition: ProbDataTSP.h:88
virtual SCIP_RETCODE scip_trans(SCIP *scip, ObjProbData **objprobdata, SCIP_Bool *deleteobject)
#define SCIP_Bool
Definition: def.h:84
virtual SCIP_RETCODE scip_deltrans(SCIP *scip)
ProbDataTSP(GRAPH *g)
Definition: ProbDataTSP.h:40
virtual ~ProbDataTSP()
Definition: ProbDataTSP.h:49
void capture_graph(GRAPH *gr)
void release_graph(GRAPH **gr)