Camargue
branch_util.hpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
5 
6 #ifndef CMR_BRANCH_UTIL_H
7 #define CMR_BRANCH_UTIL_H
8 
9 #include "graph.hpp"
10 #include "lp_util.hpp"
11 #include "util.hpp"
12 
13 #include <algorithm>
14 #include <iostream>
15 #include <string>
16 #include <utility>
17 #include <vector>
18 
19 namespace CMR {
20 
22 namespace ABC {
23 
25 namespace SB {
26 
27 constexpr double LongMult = 10;
28 constexpr double StrongMult = 100;
29 
30 constexpr int Cands1 = 5;
31 constexpr int Cands2 = 2;
32 
33 constexpr int Lim1Min = 10;
34 constexpr int Lim2Max = 500;
35 
36 inline int round1_limit(int avg_itcount)
37 {
38  return std::min(std::max(Lim1Min, 2 * avg_itcount), Lim2Max);
39 }
40 
41 inline int round2_limit(int avg_itcount)
42 {
43  return std::min(4 * avg_itcount, Lim2Max);
44 }
45 
46 }
47 
49 int large_len(int ncount, const std::vector<Graph::Edge> &edges);
50 
52 double var_score(double mult, double v0, double v1);
53 
54 
56 std::vector<int> length_weighted_cands(const std::vector<Graph::Edge> &edges,
57  const std::vector<int> &indices,
58  const std::vector<double> &x,
59  const int num_return);
60 
61 
62 struct ScoreTuple {
63  ScoreTuple() = default;
64 
66  LP::Basis base, double mult, double ub);
67 
68  EndPts ends;
69 
70  LP::Estimate down_est;
71  LP::Estimate up_est;
72 
73  double score;
74 
75  LP::Basis contra_base;
76 };
77 
78 std::ostream &operator<<(std::ostream &os, const ScoreTuple &T);
79 
80 
82 std::vector<ScoreTuple> ranked_cands(const std::vector<int> &cand_inds,
83  std::vector<LP::Estimate> &down_est,
84  std::vector<LP::Estimate> &up_est,
85  const std::vector<Graph::Edge> &edges,
86  std::vector<LP::Basis> &contra_bases,
87  double mult, double ub, int num_return);
88 
89 
90 
91 }
92 }
93 
94 #endif
Miscellaneous functions, structs/enums, and constants for LPs.
int large_len(int ncount, const std::vector< Graph::Edge > &edges)
Return a "large" edge length relative to the capacities in ecap.
Header for classes/structures/functions to work with graphs.
std::vector< int > length_weighted_cands(const std::vector< Graph::Edge > &edges, const std::vector< int > &indices, const std::vector< double > &x, const int num_return)
Get a list of candidate branch edges using fractional long edge branching.
Row and column basic statuses corresponding to some LP solution.
Definition: lp_util.hpp:76
Utility functions, macros, and structures.
Definition: branch_util.hpp:62
std::vector< ScoreTuple > ranked_cands(const std::vector< int > &cand_inds, std::vector< LP::Estimate > &down_est, std::vector< LP::Estimate > &up_est, const std::vector< Graph::Edge > &edges, std::vector< LP::Basis > &contra_bases, double mult, double ub, int num_return)
Produce a list of fixed max size containing ranked scored branching edges.
Struct for storing info from branching estimates.
Definition: lp_util.hpp:98
The namespace for this project.
Definition: abc_nodesel.hpp:20
Simple base class for storing edge of a graph as a sorted pair of nodes.
Definition: util.hpp:239
double var_score(double mult, double v0, double v1)
Rank a branching variable in terms of its down and up estimates.
Definition: branch_util.cpp:28