Google OR-Tools v9.11
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-2024 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 <string>
18#include <utility>
19#include <vector>
20
21#include "absl/strings/string_view.h"
22#include "absl/synchronization/mutex.h"
24#include "ortools/sat/model.h"
26#include "ortools/sat/util.h"
28
30
31// Contains the table we display after the solver is done.
33 public:
35
36 // Add a line to the corresponding table.
37 void AddTimingStat(const SubSolver& subsolver);
38
39 void AddSearchStat(absl::string_view name, Model* model);
40
41 void AddClausesStat(absl::string_view name, Model* model);
42
43 void AddLpStat(absl::string_view name, Model* model);
44
45 void AddLnsStat(absl::string_view name,
46 const NeighborhoodGenerator& generator);
47
48 void AddLsStat(absl::string_view name, int64_t num_batches,
49 int64_t num_restarts, int64_t num_linear_moves,
50 int64_t num_general_moves, int64_t num_compound_moves,
51 int64_t num_bactracks, int64_t num_weight_updates,
52 int64_t num_scores_computed);
53
54 // Display the set of table at the end.
55 void Display(SolverLogger* logger);
56
57 private:
58 mutable absl::Mutex mutex_;
59
60 std::vector<std::vector<std::string>> timing_table_ ABSL_GUARDED_BY(mutex_);
61 std::vector<std::vector<std::string>> search_table_ ABSL_GUARDED_BY(mutex_);
62 std::vector<std::vector<std::string>> clauses_table_ ABSL_GUARDED_BY(mutex_);
63
64 std::vector<std::vector<std::string>> lp_table_ ABSL_GUARDED_BY(mutex_);
65 std::vector<std::vector<std::string>> lp_dim_table_ ABSL_GUARDED_BY(mutex_);
66 std::vector<std::vector<std::string>> lp_debug_table_ ABSL_GUARDED_BY(mutex_);
67 std::vector<std::vector<std::string>> lp_manager_table_
68 ABSL_GUARDED_BY(mutex_);
69
70 std::vector<std::vector<std::string>> lns_table_ ABSL_GUARDED_BY(mutex_);
71 std::vector<std::vector<std::string>> ls_table_ ABSL_GUARDED_BY(mutex_);
72
73 // This one is dynamic, so we generate it in Display().
74 std::vector<std::pair<std::string, absl::btree_map<std::string, int>>>
75 lp_cut_table_ ABSL_GUARDED_BY(mutex_);
76};
77
78} // namespace operations_research::sat
79
80#endif // OR_TOOLS_SAT_STAT_TABLES_H_
Base class for a CpModelProto neighborhood generator.
Contains the table we display after the solver is done.
Definition stat_tables.h:32
void AddTimingStat(const SubSolver &subsolver)
Add a line to the corresponding table.
void AddSearchStat(absl::string_view name, Model *model)
void Display(SolverLogger *logger)
Display the set of table at the end.
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_bactracks, int64_t num_weight_updates, int64_t num_scores_computed)
void AddClausesStat(absl::string_view name, Model *model)
void AddLpStat(absl::string_view name, Model *model)
void AddLnsStat(absl::string_view name, const NeighborhoodGenerator &generator)
const std::string name
A name for logging purposes.
GRBmodel * model