TCPSPSuite
matrixedgescorer.hpp
1 #ifndef MATRIXEDGESCORER_HPP
2 #define MATRIXEDGESCORER_HPP
3 
4 #include <cstddef>
5 #include <vector>
6 
7 // Forwards
8 class SolverConfig;
9 class Instance;
10 namespace swag {
11 namespace detail {
12 class Edge;
13 }
14 } // namespace swag
15 
16 namespace swag {
17 
18 class MatrixEdgeScorer {
19 public:
20  MatrixEdgeScorer(const Instance & instance,
21  const SolverConfig & sconf) noexcept;
22 
23  double get_score_for(size_t s, size_t t) const noexcept;
24  void incorporate_result(
25  double quality, const std::vector<unsigned int> & start_times,
26  const std::vector<std::vector<detail::Edge>> & adjacency_list);
27  void iteration(size_t iteration) noexcept;
28 
29 private:
30  const Instance & instance;
31 
32  size_t score_window_size;
33  double score_window_fraction_threshold;
34  double score_exponent;
35 
36  bool use_score_a;
37  unsigned int aging_interval;
38  unsigned int age_period;
39  std::vector<std::pair<unsigned int, double>> score_matrix_a;
40  std::vector<std::pair<unsigned int, double>> score_matrix_b;
41 
42  void adjust_score_for(unsigned int s, unsigned int t, double delta) noexcept;
43 
44  std::vector<double> last_scores;
45  size_t last_scores_offset;
46 };
47 
48 } // namespace swag
49 
50 #endif
Instance
a TCPSP instance
Definition: instance.hpp:24