Scippy

UG

Ubiquity Generator framework

scipParaObjSelfSplitNodesel.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and software framework */
4/* UG --- Ubquity Generator Framework */
5/* */
6/* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7/* Copyright (C) 2021-2024 by Zuse Institute Berlin, */
8/* licensed under LGPL version 3 or later. */
9/* Commercial licenses are available through <licenses@zib.de> */
10/* */
11/* This code is free software; you can redistribute it and/or */
12/* modify it under the terms of the GNU Lesser General Public License */
13/* as published by the Free Software Foundation; either version 3 */
14/* of the License, or (at your option) any later version. */
15/* */
16/* This program is distributed in the hope that it will be useful, */
17/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19/* GNU Lesser General Public License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23/* */
24/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25
26/**@file scipParaObjSelfSplitNodesel.h
27 * @brief node selector for self-split ramp-up
28 * @author Yuji Shinano
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#ifndef __SCIP_PARA_OBJ_SELF_SPLIT_NODESEL_H__
34#define __SCIP_PARA_OBJ_SELF_SPLIT_NODESEL_H__
35
36#include <cstring>
37
38#include "scipParaComm.h"
39#include "scipParaSolver.h"
40#include "scip/scipdefplugins.h"
41#include "objscip/objnodesel.h"
42
43#if SCIP_APIVERSION >= 101
44
45namespace ParaSCIP
46{
47
48class ScipParaSolver;
49
50/** @brief C++ wrapper for primal heuristics
51 *
52 * This class defines the interface for node selectors implemented in C++. Note that there is a pure virtual
53 * function (this function has to be implemented). This function is: scip_comp().
54 *
55 * - \ref NODESEL "Instructions for implementing a node selector"
56 * - \ref NODESELECTORS "List of available node selectors"
57 * - \ref type_nodesel.h "Corresponding C interface"
58 */
59// class ScipParaObjSelfSplitNodesel : public ObjCloneable
60class ScipParaObjSelfSplitNodesel : public scip::ObjNodesel
61{
62 // SCIP_NODESEL* nodesel_estimate;
63
64 int selfsplitrank;
65 int selfsplitsize;
66 int depthlimit;
67
68 bool sampling;
69
70 UG::ParaComm *paraComm;
71 ScipParaSolver *scipParaSolver;
72
73
74 void keepParaNode(SCIP *scip, int depth, SCIP_NODE* node);
75
76 bool ifFeasibleInOriginalProblem(
77 SCIP *scip,
78 int nBranchVars,
79 SCIP_VAR **branchVars,
80 SCIP_Real *inBranchBounds);
81
82public:
83 /*lint --e{1540}*/
84
85 /** default constructor */
86 ScipParaObjSelfSplitNodesel(
87 int rank,
88 int size,
89 int depth,
91 ScipParaSolver *solver,
92 SCIP *scip
93 )
94 : scip::ObjNodesel::ObjNodesel(scip, "ScipParaObjSelfSplitNodeSel", "Node selector for self-split ramp-up",
95 INT_MAX/4, 0),
96 // nodesel_estimate(0),
97 selfsplitrank(rank),
98 selfsplitsize(size),
99 depthlimit(depth),
100 sampling(true),
101 paraComm(comm),
102 scipParaSolver(solver)
103 {
104 // SCIP *scip = solver->getScip();
105 // nodesel_estimate = SCIPfindNodesel(scip, "estimate");
106 // assert(nodesel_estimate != NULL);
107 }
108
109 /** destructor */
110 virtual ~ScipParaObjSelfSplitNodesel()
111 {
112 /* the macro SCIPfreeMemoryArray does not need the first argument: */
113 /*lint --e{64}*/
114// SCIPfreeMemoryArray(scip_, &scip_name_);
115// SCIPfreeMemoryArray(scip_, &scip_desc_);
116 }
117
118 /** node selection method of node selector
119 *
120 * @see SCIP_DECL_NODESELSELECT(x) in @ref type_nodesel.h
121 */
122 virtual SCIP_DECL_NODESELSELECT(scip_select);
123
124 /** node comparison method of node selector
125 *
126 * @see SCIP_DECL_NODESELCOMP(x) in @ref type_nodesel.h
127 */
128 virtual SCIP_DECL_NODESELCOMP(scip_comp);
129
130 bool inSampling(
131 )
132 {
133 return sampling;
134 }
135
136};
137
138} /* namespace scip */
139
140#endif
141#endif
Base class of communicator object.
Definition: paraComm.h:102
static ScipParaCommTh * comm
Definition: fscip.cpp:73
ParaComm extension for SCIP solver.
SCIP_DECL_NODESELSELECT(ScipParaObjNodesel::scip_select)
SCIP_DECL_NODESELCOMP(ScipParaObjNodesel::scip_comp)
ParaSolver extension for SCIP: Parallelized solver implementation for SCIP.