1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 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 */
33 class ProbDataTSP : public scip::ObjProbData
34 {
35    GRAPH*                graph_;             /**< graph data */
36 
37 public:
38 
39    /** default constructor */
ProbDataTSP(GRAPH * g)40    ProbDataTSP(
41       GRAPH*             g                   /**< graph data */
42       )
43       : graph_(g)
44    {
45       capture_graph(graph_);
46    }
47 
48    /** destructor */
~ProbDataTSP()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) */
74    virtual SCIP_RETCODE scip_deltrans(
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 */
getGraph()88    GRAPH* getGraph()
89    {
90       return graph_;
91    }
92 
93 };/*lint !e1712*/
94 
95 } /* namespace tsp */
96 
97 #endif
98