Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::bop::PortfolioOptimizer Class Reference

#include <bop_portfolio.h>

Inheritance diagram for operations_research::bop::PortfolioOptimizer:
operations_research::bop::BopOptimizerBase

Public Member Functions

 PortfolioOptimizer (const ProblemState &problem_state, const BopParameters &parameters, const BopSolverOptimizerSet &optimizer_set, absl::string_view name)
 
 ~PortfolioOptimizer () override
 
bool ShouldBeRun (const ProblemState &problem_state) const override
 
Status Optimize (const BopParameters &parameters, const ProblemState &problem_state, LearnedInfo *learned_info, TimeLimit *time_limit) override
 
- Public Member Functions inherited from operations_research::bop::BopOptimizerBase
 BopOptimizerBase (absl::string_view name)
 
virtual ~BopOptimizerBase ()
 
const std::string & name () const
 Returns the name given at construction.
 

Additional Inherited Members

- Public Types inherited from operations_research::bop::BopOptimizerBase
enum  Status {
  OPTIMAL_SOLUTION_FOUND , SOLUTION_FOUND , INFEASIBLE , LIMIT_REACHED ,
  INFORMATION_FOUND , CONTINUE , ABORT
}
 
- Static Public Member Functions inherited from operations_research::bop::BopOptimizerBase
static std::string GetStatusString (Status status)
 Returns a string describing the status.
 
- Protected Attributes inherited from operations_research::bop::BopOptimizerBase
const std::string name_
 
StatsGroup stats_
 

Detailed Description

This class implements a portfolio optimizer. The portfolio currently includes all the following optimizers:

  • SAT_CORE_BASED
  • SAT_LINEAR_SEARCH
  • LINEAR_RELAXATION
  • LOCAL_SEARCH
  • RANDOM_FIRST_SOLUTION
  • RANDOM_CONSTRAINT_LNS
  • RANDOM_VARIABLE_LNS
  • COMPLETE_LNS
  • LP_FIRST_SOLUTION
  • OBJECTIVE_FIRST_SOLUTION
  • USER_GUIDED_FIRST_SOLUTION
  • FEASIBILITY_PUMP_FIRST_SOLUTION
  • RANDOM_CONSTRAINT_LNS_GUIDED_BY_LP
  • RANDOM_VARIABLE_LNS_GUIDED_BY_LP
  • RELATION_GRAPH_LNS
  • RELATION_GRAPH_LNS_GUIDED_BY_LP

At each call of Optimize(), the portfolio optimizer selects the next optimizer to run and runs it. The selection is auto-adaptative, meaning that optimizers that succeeded more in the previous calls to Optimizer() are more likely to be selected.

Definition at line 69 of file bop_portfolio.h.

Constructor & Destructor Documentation

◆ PortfolioOptimizer()

operations_research::bop::PortfolioOptimizer::PortfolioOptimizer ( const ProblemState & problem_state,
const BopParameters & parameters,
const BopSolverOptimizerSet & optimizer_set,
absl::string_view name )

PortfolioOptimizer

Definition at line 83 of file bop_portfolio.cc.

◆ ~PortfolioOptimizer()

operations_research::bop::PortfolioOptimizer::~PortfolioOptimizer ( )
override
Note
unique pointers are not used due to unsupported emplace_back in ITIVectors.

Definition at line 100 of file bop_portfolio.cc.

Member Function Documentation

◆ Optimize()

BopOptimizerBase::Status operations_research::bop::PortfolioOptimizer::Optimize ( const BopParameters & parameters,
const ProblemState & problem_state,
LearnedInfo * learned_info,
TimeLimit * time_limit )
overridevirtual

Tries to infer more information about the problem state, i.e. reduces the gap by increasing the lower bound or finding a better solution. Returns SOLUTION_FOUND when a new solution with a better objective cost is found before a time limit. The learned information is cleared and the filled with any new information about the problem, e.g. a new lower bound.

Preconditions: ShouldBeRun() must returns true.

ABORT means that this optimizer can't be run until we found a new solution.

The gain is defined as 1 for the first solution.

Todo
(user): Is 1 the right value? It might be better to use a percentage of the gap, or use the same gain as for the second solution.

Stop the portfolio optimizer after too many unsuccessful calls.

Todo
(user): don't penalize the SatCoreBasedOptimizer or the LinearRelaxation when they improve the lower bound.
Todo
Todo
(user): Do we want to re-order the optimizers in the selector when the status is BopOptimizerBase::INFORMATION_FOUND?

Implements operations_research::bop::BopOptimizerBase.

Definition at line 145 of file bop_portfolio.cc.

◆ ShouldBeRun()

bool operations_research::bop::PortfolioOptimizer::ShouldBeRun ( const ProblemState & problem_state) const
inlineoverridevirtual

Returns true if this optimizer should be run on the given problem state. Some optimizer requires a feasible solution to run for instance.

Note
a similar effect can be achieved if Optimize() returns ABORT right away. However, doing the later will lower the chance of this optimizer to be called again since it will count as a failure to improve the current state.

Implements operations_research::bop::BopOptimizerBase.

Definition at line 77 of file bop_portfolio.h.


The documentation for this class was generated from the following files: