-
Notifications
You must be signed in to change notification settings - Fork 0
/
NodeExplorer.h
73 lines (50 loc) · 1.79 KB
/
NodeExplorer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// Created by nandgate on 10/27/2024.
//
#ifndef NODEEXPLORER_H
#define NODEEXPLORER_H
#include "DD.h"
#include "Cut.h"
#include "gurobi_c++.h"
#include "grb.h"
// #include "DDSolver.h"
extern const Network network;
//
class OutObject{
public:
double lb;
double ub;
vector<Node_t> nodes;
bool success;
OutObject(double lb_, double ub_, vector<Node_t> nodes_, bool s) :
lb{lb_}, ub{ub_}, nodes{std::move(nodes_)}, success{s}{}
};
class NodeExplorer {
//shared_ptr<Network> networkPtr;
CutContainer feasibilityCuts;
CutContainer optimalityCuts;
GRBEnv env = GRBEnv();
const shared_ptr<Network> networkPtr;
public:
explicit NodeExplorer(const shared_ptr<Network>& networkPtr_) : networkPtr{networkPtr_}, feasibilityCuts{FEASIBILITY}, optimalityCuts{OPTIMALITY} {
// env = GRBEnv();
env.set(GRB_IntParam_OutputFlag,0);
env.set(GRB_IntParam_Threads,1);
}
NodeExplorer(const shared_ptr<Network>& networkPtr_, pair<CutContainer, CutContainer> cuts): networkPtr{networkPtr_}, feasibilityCuts{cuts.first}, optimalityCuts{cuts.second} {
env.set(GRB_IntParam_OutputFlag,0);
env.set(GRB_IntParam_Threads,1);
}
pair<CutContainer, CutContainer> getCuts() noexcept { return {feasibilityCuts, optimalityCuts};}
OutObject process(Node_t node, double optimalLB);
OutObject process2(Node_t node, double optimalLB);
OutObject process3(Node_t node, double optimalLB);
void clearCuts();
#ifdef SOLVER_STATS
void displayCutStats() const noexcept {
cout << "Number of feasibility cuts in the container " << feasibilityCuts.cuts.size() << endl;
cout << "Number of optimality cuts in the container: " << optimalityCuts.cuts.size() << endl;
}
#endif
};
#endif //NODEEXPLORER_H