Scippy

UG

Ubiquity Generator framework

scipParaObjLimitUpdator.cpp
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 scipParaObjLimitUpdator.cpp
27 * @brief heuristic to update objlimit
28 * @author Yuji Shinano
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#include <cassert>
34#include <iostream>
35
36#include "objscip/objscip.h"
38
39using namespace ParaSCIP;
40using namespace std;
41
42
43/** destructor of primal heuristic to free user data (called when SCIP is exiting) */
44SCIP_DECL_HEURFREE(ScipParaObjLimitUpdator::scip_free)
45{ /*lint --e{715}*/
46 return SCIP_OKAY;
47}
48
49
50/** initialization method of primal heuristic (called after problem was transformed) */
51SCIP_DECL_HEURINIT(ScipParaObjLimitUpdator::scip_init)
52{ /*lint --e{715}*/
53 return SCIP_OKAY;
54}
55
56
57/** deinitialization method of primal heuristic (called before transformed problem is freed) */
58SCIP_DECL_HEUREXIT(ScipParaObjLimitUpdator::scip_exit)
59{ /*lint --e{715}*/
60 return SCIP_OKAY;
61}
62
63
64/** solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
65 *
66 * This method is called when the presolving was finished and the branch and bound process is about to begin.
67 * The primal heuristic may use this call to initialize its branch and bound specific data.
68 *
69 */
70SCIP_DECL_HEURINITSOL(ScipParaObjLimitUpdator::scip_initsol)
71{ /*lint --e{715}*/
72 return SCIP_OKAY;
73}
74
75
76/** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)
77 *
78 * This method is called before the branch and bound process is freed.
79 * The primal heuristic should use this call to clean up its branch and bound data.
80 */
81SCIP_DECL_HEUREXITSOL(ScipParaObjLimitUpdator::scip_exitsol)
82{ /*lint --e{715}*/
83 return SCIP_OKAY;
84}
85
86
87/** execution method of primal heuristic 2-Opt */
88SCIP_DECL_HEUREXEC(ScipParaObjLimitUpdator::scip_exec)
89{ /*lint --e{715}*/
90 if( updated )
91 {
92 if( scipParaSolver->getGlobalBestIncumbentValue() < SCIPgetObjlimit(scip) )
93 {
94 SCIP_CALL_ABORT( SCIPsetObjlimit(scip, scipParaSolver->getGlobalBestIncumbentValue()) );
95 }
96 scipParaSolver->globalIncumbnetValueIsReflected();
97 updated = false;
98 }
99 return SCIP_OKAY;
100}
101
102
103/** clone method which will be used to copy a objective plugin */
104SCIP_DECL_HEURCLONE(scip::ObjCloneable* ScipParaObjLimitUpdator::clone) /*lint !e665*/
105{
106 return new ScipParaObjLimitUpdator(scip, scipParaSolver);
107}
SCIP_DECL_HEURFREE(ScipParaObjLimitUpdator::scip_free)
SCIP_DECL_HEUREXIT(ScipParaObjLimitUpdator::scip_exit)
SCIP_DECL_HEURINIT(ScipParaObjLimitUpdator::scip_init)
SCIP_DECL_HEUREXEC(ScipParaObjLimitUpdator::scip_exec)
SCIP_DECL_HEUREXITSOL(ScipParaObjLimitUpdator::scip_exitsol)
SCIP_DECL_HEURCLONE(scip::ObjCloneable *ScipParaObjLimitUpdator::clone)
SCIP_DECL_HEURINITSOL(ScipParaObjLimitUpdator::scip_initsol)
heuristic to update objlimit