14#ifndef OR_TOOLS_BOP_BOP_PORTFOLIO_H_
15#define OR_TOOLS_BOP_BOP_PORTFOLIO_H_
22#include "absl/strings/string_view.h"
26#include "ortools/bop/bop_parameters.pb.h"
30#include "ortools/sat/boolean_problem.pb.h"
73 const BopSolverOptimizerSet& optimizer_set,
74 absl::string_view
name);
87 void AddOptimizer(
const sat::LinearBooleanProblem& problem,
89 const BopOptimizerMethod& optimizer_method);
90 void CreateOptimizers(
const sat::LinearBooleanProblem& problem,
92 const BopSolverOptimizerSet& optimizer_set);
95 int64_t state_update_stamp_;
97 std::unique_ptr<OptimizerSelector> selector_;
100 BopParameters parameters_;
103 int number_of_consecutive_failing_optimizers_;
161 std::string
PrintStats(OptimizerIndex optimizer_index)
const;
170 void NewSolutionFound(int64_t gain);
173 void UpdateDeterministicTime(
double time_spent);
179 RunInfo(OptimizerIndex i, absl::string_view n)
180 : optimizer_index(i),
186 time_spent_since_last_solution(0),
191 bool RunnableAndSelectable()
const {
return runnable && selectable; }
193 OptimizerIndex optimizer_index;
199 double time_spent_since_last_solution;
205 std::vector<RunInfo> run_infos_;
const std::string & name() const
Returns the name given at construction.
OptimizerIndex SelectOptimizer()
std::string PrintStats(OptimizerIndex optimizer_index) const
Returns statistics about the given optimizer.
void TemporarilyMarkOptimizerAsUnselectable(OptimizerIndex optimizer_index)
void SetOptimizerRunnability(OptimizerIndex optimizer_index, bool runnable)
void UpdateScore(int64_t gain, double time_spent)
int NumCallsForOptimizer(OptimizerIndex optimizer_index) const
void DebugPrint() const
Prints some debug information. Should not be used in production.
OptimizerSelector(const util_intops::StrongVector< OptimizerIndex, BopOptimizerBase * > &optimizers)
bool ShouldBeRun(const ProblemState &problem_state) const override
Status Optimize(const BopParameters ¶meters, const ProblemState &problem_state, LearnedInfo *learned_info, TimeLimit *time_limit) override
~PortfolioOptimizer() override
PortfolioOptimizer(const ProblemState &problem_state, const BopParameters ¶meters, const BopSolverOptimizerSet &optimizer_set, absl::string_view name)
const OptimizerIndex kInvalidOptimizerIndex(-1)
In SWIG mode, we don't want anything besides these top-level includes.
std::mt19937_64 random_engine_t
#define DEFINE_STRONG_INDEX_TYPE(index_type_name)