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-2024 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file ProbDataTSP.h
26 * @brief C++ problem data for TSP
27 * @author Timo Berthold
28 */
29
30/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
31
32#ifndef __TSPPROBDATA_H__
33#define __TSPPROBDATA_H__
34
35#include "objscip/objscip.h"
36#include "GomoryHuTree.h"
37
38namespace tsp
39{
40
41/** SCIP user problem data for TSP */
43{
44 GRAPH* graph_; /**< graph data */
45
46public:
47
48 /** default constructor */
50 GRAPH* g /**< graph data */
51 )
52 : graph_(g)
53 {
54 capture_graph(graph_);
55 }
56
57 /** destructor */
58 virtual ~ProbDataTSP()
59 {
60 if( graph_ != NULL )
61 release_graph(&graph_); /*lint !e1551*/
62 }
63
64 /** Copies user data if you want to copy it to a subscip */
65 virtual SCIP_RETCODE scip_copy(
66 SCIP* scip, /**< SCIP data structure */
67 SCIP* sourcescip, /**< source SCIP main data structure */
68 SCIP_HASHMAP* varmap, /**< a hashmap which stores the mapping of source variables to
69 * corresponding target variables */
70 SCIP_HASHMAP* consmap, /**< a hashmap which stores the mapping of source contraints to
71 * corresponding target constraints */
72 ObjProbData** objprobdata, /**< pointer to store the copied problem data object */
73 SCIP_Bool global, /**< create a global or a local copy? */
74 SCIP_RESULT* result /**< pointer to store the result of the call */
75 );
76
77 /** destructor of user problem data to free original user data (called when original problem is freed) */
79 SCIP* scip /**< SCIP data structure */
80 );
81
82 /** destructor of user problem data to free transformed user data (called when transformed problem is freed) */
84 SCIP* scip /**< SCIP data structure */
85 );
86
87 /** creates user data of transformed problem by transforming the original user problem data
88 * (called after problem was transformed)
89 */
91 SCIP* scip, /**< SCIP data structure */
92 ObjProbData** objprobdata, /**< pointer to store the transformed problem data object */
93 SCIP_Bool* deleteobject /**< pointer to store whether SCIP should delete the object after solving */
94 );
95
96 /* get the graph */
98 {
99 return graph_;
100 }
101
102};/*lint !e1712*/
103
104} /* namespace tsp */
105
106#endif
void capture_graph(GRAPH *gr)
void release_graph(GRAPH **gr)
generator for global cuts in undirected graphs
C++ wrapper for user problem data.
Definition: objprobdata.h:53
virtual SCIP_RETCODE scip_copy(SCIP *scip, SCIP *sourcescip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, ObjProbData **objprobdata, SCIP_Bool global, SCIP_RESULT *result)
virtual SCIP_RETCODE scip_delorig(SCIP *scip)
virtual SCIP_RETCODE scip_trans(SCIP *scip, ObjProbData **objprobdata, SCIP_Bool *deleteobject)
ProbDataTSP(GRAPH *g)
Definition: ProbDataTSP.h:49
virtual SCIP_RETCODE scip_deltrans(SCIP *scip)
GRAPH * getGraph()
Definition: ProbDataTSP.h:97
virtual ~ProbDataTSP()
Definition: ProbDataTSP.h:58
#define NULL
Definition: def.h:267
#define SCIP_Bool
Definition: def.h:91
C++ wrapper classes for SCIP.
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:61
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63