Scippy

SCIP

Solving Constraint Integer Programs

HeurFrats.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-2023 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 HeurFrats.h
26  * @brief fractional travelling salesman heuristic - Rounding heuristic for TSP
27  * @author Timo Berthold
28  */
29 
30 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
31 
32 #ifndef __HEURFRATS_H__
33 #define __HEURFRATS_H__
34 
35 
36 #include "objscip/objheur.h"
37 #include "GomoryHuTree.h"
38 
39 namespace tsp
40 {
41 
42 /** C++ rounding heuristic for TSP */
43 class HeurFrats : public scip::ObjHeur
44 {
45  GRAPH* graph; /**< the underlying graph of the TSP */
46  SCIP_SOL* sol; /**< current solution */
47 
48 public:
49  /** default constructor */
51  SCIP* scip
52  )
53  : ObjHeur(scip, "frats", "fractional travelling salesman: TSP rounding heuristic", 'T',-50000, 5, 0, -1,
55  graph(NULL),
56  sol(NULL)
57  {
58  }
59 
60  /** destructor */
61  virtual ~HeurFrats()
62  {
63  } /*lint !e1540*/
64 
65  /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
66  virtual SCIP_DECL_HEURFREE(scip_free);
67 
68  /** initialization method of primal heuristic (called after problem was transformed) */
69  virtual SCIP_DECL_HEURINIT(scip_init);
70 
71  /** deinitialization method of primal heuristic (called before transformed problem is freed) */
72  virtual SCIP_DECL_HEUREXIT(scip_exit);
73 
74  /** solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
75  *
76  * This method is called when the presolving was finished and the branch and bound process is about to begin.
77  * The primal heuristic may use this call to initialize its branch and bound specific data.
78  *
79  */
80  virtual SCIP_DECL_HEURINITSOL(scip_initsol);
81 
82  /** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)
83  *
84  * This method is called before the branch and bound process is freed.
85  * The primal heuristic should use this call to clean up its branch and bound data.
86  */
87  virtual SCIP_DECL_HEUREXITSOL(scip_exitsol);
88 
89  /** execution method of primal heuristic
90  *
91  * Searches for feasible primal solutions. The method is called in the node processing loop.
92  *
93  * possible return values for *result:
94  * - SCIP_FOUNDSOL : at least one feasible primal solution was found
95  * - SCIP_DIDNOTFIND : the heuristic searched, but did not find a feasible solution
96  * - SCIP_DIDNOTRUN : the heuristic was skipped
97  * - SCIP_DELAYED : the heuristic was skipped, but should be called again as soon as possible, disregarding
98  * its frequency
99  */
100  virtual SCIP_DECL_HEUREXEC(scip_exec);
101 
102  /** clone method which will be used to copy a objective plugin */
103  virtual SCIP_DECL_HEURCLONE(ObjCloneable* clone); /*lint !e665*/
104 
105  /** returns whether the objective plugin is copyable */
106  virtual SCIP_DECL_HEURISCLONEABLE(iscloneable)
107  {
108  return TRUE;
109  }
110 }; /*lint !e1712*/
111 
112 }
113 #endif
virtual SCIP_DECL_HEURISCLONEABLE(iscloneable)
Definition: HeurFrats.h:106
C++ wrapper for primal heuristics.
Definition: objheur.h:53
#define FALSE
Definition: def.h:96
HeurFrats(SCIP *scip)
Definition: HeurFrats.h:50
#define TRUE
Definition: def.h:95
virtual SCIP_DECL_HEUREXEC(scip_exec)
generator for global cuts in undirected graphs
virtual SCIP_DECL_HEURINITSOL(scip_initsol)
virtual SCIP_DECL_HEUREXITSOL(scip_exitsol)
#define SCIP_HEURTIMING_AFTERLPNODE
Definition: type_timing.h:82
#define NULL
Definition: lpi_spx1.cpp:164
C++ wrapper for primal heuristics.
virtual SCIP_DECL_HEUREXIT(scip_exit)
virtual ~HeurFrats()
Definition: HeurFrats.h:61
ObjHeur(SCIP *scip, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip)
Definition: objheur.h:89
virtual SCIP_DECL_HEURCLONE(ObjCloneable *clone)
virtual SCIP_DECL_HEURFREE(scip_free)
virtual SCIP_DECL_HEURINIT(scip_init)