Scippy

UG

Ubiquity Generator framework

scipParaCommTh.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 scipParaCommTh.h
27 * @brief SCIP ParaComm extension for threads communication.
28 * @author Yuji Shinano
29 *
30 *
31 *
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36
37#ifndef __SCIP_PARA_COMM_TH_H__
38#define __SCIP_PARA_COMM_TH_H__
39#include "ug_bb/bbParaComm.h"
40#include "scipParaTagDef.h"
41#include "scipParaInstanceTh.h"
42#include "scipParaSolutionTh.h"
46#include "scip/scip.h"
47
48namespace ParaSCIP
49{
50
51///
52/// scip defined transfer data types
53///
56
57class ScipParaSolver;
59
60#ifdef _COMM_PTH
62#endif
63#ifdef _COMM_CPP11
65#endif
66{
67
68 std::mutex interruptMsgMonitorLockMutex; ///< mutex for interrupt message monitor
69
70protected:
71
72 static const char *tagStringTable[]; ///< tag name string table
73
74 ///
75 /// check if tag string table (for debugging) set up correctly
76 /// @return true if tag string table is set up correctly, false otherwise
77 ///
79 );
80
81 ///
82 /// get Tag string for debugging
83 /// @return string which shows Tag
84 ///
85 const char *getTagString(
86 int tag /// tag to be converted to string
87 );
88
89public:
92
93 ///
94 /// lock interrupt message monitor to synchronize with the monitor thread
95 ///
97 )
98 {
100 }
101
102 ///
103 /// unlock interrupt message monitor to synchronize with the monitor thread
104 ///
106 )
107 {
109 }
110
111 /*******************************************************************************
112 * transfer object factory
113 *******************************************************************************/
120
121 ScipParaInstance *createScipParaInstance(SCIP *scip, int method);
122 ScipParaSolution *createScipParaSolution(ScipParaSolver *solver, SCIP_Real objval, int inNvars, SCIP_VAR ** vars, SCIP_Real *vals);
123 ScipParaSolution *createScipParaSolution(SCIP_Real objval, int inNvars, int *inIndicesAmongSolvers, SCIP_Real *vals);
124
126 SCIP *scip,
127 ScipParaSolver *scipParaSolver,
128 int nNewBranchVars,
129 SCIP_VAR **newBranchVars,
130 SCIP_Real *newBranchBounds,
131 SCIP_BOUNDTYPE *newBoundTypes,
132 int nAddedConss,
133 SCIP_CONS **addedConss
134 );
137 int inMaxDepth,
138 int inMaxTotalDepth,
139 int inNVarBranchStatsDown,
140 int inNVarBranchStatsUp,
141 int *inIdxLBranchStatsVarsDown,
142 int *inNVarBranchingDown,
143 int *inIdxLBranchStatsVarsUp,
144 int *inNVarBranchingUp,
145 SCIP_Real *inDownpscost,
146 SCIP_Real *inDownvsids,
147 SCIP_Real *inDownconflen,
148 SCIP_Real *inDowninfer,
149 SCIP_Real *inDowncutoff,
150 SCIP_Real *inUppscost,
151 SCIP_Real *inUpvsids,
152 SCIP_Real *inUpconflen,
153 SCIP_Real *inUpinfer,
154 SCIP_Real *inUpcutoff
155 );
157 int inTerminationCriteria,
158 int inNNodesLeft,
159 double inTimeLimit,
160 int inScipRacingParamSeed,
161 int inPermuteProbSeed,
162 int inGenerateBranchOrderSeed,
163 ScipDiffParamSet *inScipDiffParamSet
164 );
167};
168
169#define DEF_SCIP_PARA_COMM( scip_para_comm, comm ) ScipParaCommTh *scip_para_comm = dynamic_cast< ScipParaCommTh* >(comm)
170
171}
172#endif // __SCIP_PARA_COMM_TH_H__
Base class of communicator for UG Framework.
ScipParaInitialStat * createScipParaInitialStat(SCIP *scip)
void unlockInterruptMsg()
unlock interrupt message monitor to synchronize with the monitor thread
UG::ParaDiffSubproblem * createParaDiffSubproblem()
std::mutex interruptMsgMonitorLockMutex
mutex for interrupt message monitor
UG::ParaRacingRampUpParamSet * createParaRacingRampUpParamSet()
bool tagStringTableIsSetUpCoorectly()
check if tag string table (for debugging) set up correctly
ScipParaDiffSubproblem * createScipParaDiffSubproblem(SCIP *scip, ScipParaSolver *scipParaSolver, int nNewBranchVars, SCIP_VAR **newBranchVars, SCIP_Real *newBranchBounds, SCIP_BOUNDTYPE *newBoundTypes, int nAddedConss, SCIP_CONS **addedConss)
ScipParaSolution * createScipParaSolution(ScipParaSolver *solver, SCIP_Real objval, int inNvars, SCIP_VAR **vars, SCIP_Real *vals)
ScipParaInstance * createScipParaInstance(SCIP *scip, int method)
const char * getTagString(int tag)
get Tag string for debugging
UG::ParaInstance * createParaInstance()
static const char * tagStringTable[]
tag name string table
void lockInterruptMsg()
lock interrupt message monitor to synchronize with the monitor thread
UG::ParaInitialStat * createParaInitialStat()
UG::ParaSolution * createParaSolution()
ScipParaRacingRampUpParamSet * createScipParaRacingRampUpParamSet(int inTerminationCriteria, int inNNodesLeft, double inTimeLimit, int inScipRacingParamSeed, int inPermuteProbSeed, int inGenerateBranchOrderSeed, ScipDiffParamSet *inScipDiffParamSet)
ScipDiffParamSet * createScipDiffParamSet()
UG::ParaParamSet * createParaParamSet()
Communicator object for C++11 thread communications.
Communicator object for pthreads thread communications.
Definition: bbParaCommPth.h:79
Class for the difference between instance and subproblem.
class for initial statistics collecting after racing
class for instance data
Definition: paraInstance.h:51
class ParaParamSet
Definition: paraParamSet.h:850
class ParaRacingRampUpParamSet (parameter set for racing ramp-up)
class for solution
Definition: paraSolution.h:54
static const int ParaInitialStatType
static const int SCIP_USER_TYPE_FIRST
scip defined transfer data types
static const int BB_USER_TYPE_LAST
ScipParaDiffSubproblem extension for threads communication.
ScipParaInitialStat extension for threads communication.
ScipParaInstance extension for threads communication.
ScipParaRacingRampUpParamSet extension for threads communication.
ScipParaSolution extension for threads communication.