Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
stat_tables.h
Go to the documentation of this file.
1// Copyright 2010-2025 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#ifndef OR_TOOLS_SAT_STAT_TABLES_H_
15#define OR_TOOLS_SAT_STAT_TABLES_H_
16
17#include <cstdint>
18#include <string>
19#include <utility>
20#include <vector>
21
22#include "absl/base/thread_annotations.h"
23#include "absl/container/btree_map.h"
24#include "absl/strings/string_view.h"
25#include "absl/synchronization/mutex.h"
26#include "ortools/sat/model.h"
29
31
32// Contains the table we display after the solver is done.
34 public:
36
37 // Add a line to the corresponding table.
38 void AddTimingStat(const SubSolver& subsolver);
39
40 void AddSearchStat(absl::string_view name, Model* model);
41
42 void AddClausesStat(absl::string_view name, Model* model);
43
44 void AddLpStat(absl::string_view name, Model* model);
45
46 void AddLnsStat(absl::string_view name, int64_t num_fully_solved_calls,
47 int64_t num_calls, int64_t num_improving_calls,
48 double difficulty, double deterministic_limit);
49
50 void AddLsStat(absl::string_view name, int64_t num_batches,
51 int64_t num_restarts, int64_t num_linear_moves,
52 int64_t num_general_moves, int64_t num_compound_moves,
53 int64_t num_backtracks, int64_t num_weight_updates,
54 int64_t num_scores_computed);
55
56 // Display the set of table at the end.
57 void Display(SolverLogger* logger);
58
59 private:
60 mutable absl::Mutex mutex_;
61
62 std::vector<std::vector<std::string>> timing_table_ ABSL_GUARDED_BY(mutex_);
63 std::vector<std::vector<std::string>> search_table_ ABSL_GUARDED_BY(mutex_);
64 std::vector<std::vector<std::string>> clauses_table_ ABSL_GUARDED_BY(mutex_);
65
66 std::vector<std::vector<std::string>> lp_table_ ABSL_GUARDED_BY(mutex_);
67 std::vector<std::vector<std::string>> lp_dim_table_ ABSL_GUARDED_BY(mutex_);
68 std::vector<std::vector<std::string>> lp_debug_table_ ABSL_GUARDED_BY(mutex_);
69 std::vector<std::vector<std::string>> lp_manager_table_
70 ABSL_GUARDED_BY(mutex_);
71
72 std::vector<std::vector<std::string>> lns_table_ ABSL_GUARDED_BY(mutex_);
73 std::vector<std::vector<std::string>> ls_table_ ABSL_GUARDED_BY(mutex_);
74
75 // This one is dynamic, so we generate it in Display().
76 std::vector<std::pair<std::string, absl::btree_map<std::string, int>>>
77 lp_cut_table_ ABSL_GUARDED_BY(mutex_);
78};
79
80} // namespace operations_research::sat
81
82#endif // OR_TOOLS_SAT_STAT_TABLES_H_
void AddTimingStat(const SubSolver &subsolver)
Add a line to the corresponding table.
void AddLsStat(absl::string_view name, int64_t num_batches, int64_t num_restarts, int64_t num_linear_moves, int64_t num_general_moves, int64_t num_compound_moves, int64_t num_backtracks, int64_t num_weight_updates, int64_t num_scores_computed)
void AddLnsStat(absl::string_view name, int64_t num_fully_solved_calls, int64_t num_calls, int64_t num_improving_calls, double difficulty, double deterministic_limit)
void AddSearchStat(absl::string_view name, Model *model)
void Display(SolverLogger *logger)
Display the set of table at the end.
void AddClausesStat(absl::string_view name, Model *model)
void AddLpStat(absl::string_view name, Model *model)